[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130731090836.GE8210@elgon.mountain>
Date: Wed, 31 Jul 2013 12:08:36 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Tim Waugh <tim@...erelk.net>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] paride: underflow bug in pg_write()
The test here can underflow so we pass bogus lengths to the hardware.
It's a static checker fix and I don't know the impact.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 4a27b1d..2ce3dfd 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -581,7 +581,7 @@ static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count,
if (hdr.magic != PG_MAGIC)
return -EINVAL;
- if (hdr.dlen > PG_MAX_DATA)
+ if (hdr.dlen < 0 || hdr.dlen > PG_MAX_DATA)
return -EINVAL;
if ((count - hs) > PG_MAX_DATA)
return -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists