PATCH: fix cosa verify_area

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Mon Apr 07 2003 - 19:26:58 EST


diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.67/drivers/net/wan/cosa.c linux-2.5.67-ac1/drivers/net/wan/cosa.c
--- linux-2.5.67/drivers/net/wan/cosa.c 2003-03-26 19:59:52.000000000 +0000
+++ linux-2.5.67-ac1/drivers/net/wan/cosa.c 2003-03-26 20:06:13.000000000 +0000
@@ -1057,7 +1057,8 @@
                 return -EPERM;
         }
 
- if (get_user(addr, &(d->addr)) ||
+ if (verify_area(VERIFY_READ, d, sizeof(*d)) ||
+ __get_user(addr, &(d->addr)) ||
             __get_user(len, &(d->len)) ||
             __get_user(code, &(d->code)))
                 return -EFAULT;
@@ -1098,7 +1099,8 @@
                 return -EPERM;
         }
 
- if (get_user(addr, &(d->addr)) ||
+ if (verify_area(VERIFY_READ, d, sizeof(*d)) ||
+ __get_user(addr, &(d->addr)) ||
             __get_user(len, &(d->len)) ||
             __get_user(code, &(d->code)))
                 return -EFAULT;
@@ -1106,7 +1108,7 @@
         /* If something fails, force the user to reset the card */
         cosa->firmware_status &= ~COSA_FW_RESET;
 
- if ((i=readmem(cosa, d->code, len, addr)) < 0) {
+ if ((i=readmem(cosa, code, len, addr)) < 0) {
                 printk(KERN_NOTICE "cosa%d: reading memory failed: %d\n",
                         cosa->num, i);
                 return -EIO;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 07 2003 - 22:00:34 EST