Skip to contentSkip to conversation

missing copy_from_user check in munich driver

PATCH New [email protected] 1 participant 1 message Aug 11, 2003 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 missing copy_from_user check in munich driver

drivers/net/wan/comx-hw-munich.c +4 -1
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/wan/comx-hw-munich.c linux-2.5/drivers/net/wan/comx-hw-munich.c
@@ -2414,7 +2414,10 @@ static int munich_write_proc(struct file
 	return -ENOMEM;
 
     /* Copy user data and cut trailing \n */
-    copy_from_user(page, buffer, count = min(count, PAGE_SIZE));
+    if (copy_from_user(page, buffer, count = min(count, PAGE_SIZE))) {
+	    free_page((unsigned long)page);
+	    return -EFAULT;
+    }
     if (*(page + count - 1) == '\n')
 	*(page + count - 1) = 0;
     *(page + PAGE_SIZE - 1) = 0;