Skip to contentSkip to conversation

/fs/proc/: 'larger than buffer size' memory accesses by clear_user()

PATCH New Adam Jerome 1 participant 1 message Jul 10, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /fs/proc/: 'larger than buffer size' memory accesses by clear_user()

From: Adam B. Jerome <[email protected]>

This patch addresses potential 'larger than buffer size' memory accesses by clear_user().
Without this patch, this call to clear_user() can attempt to clear too many (tsz) bytes
resulting in a wrong (-EFAULT) return code by read_kcore().

---

I do not subscribe to the list. Please CC posted answers/comments CC me <[email protected]>.
Thanks; -adam

diff -urpN linux-2.6-git/fs/proc/kcore.c linux-2.6-cur/fs/proc/kcore.c
--- linux-2.6-git/fs/proc/kcore.c 2006-07-07 15:39:23.000000000
-0600
+++ linux-2.6-cur/fs/proc/kcore.c 2006-07-07 16:11:58.000000000
-0600
@@ -384,7 +384,7 @@ read_kcore(struct file *file, char __use
*/
if (n) {
if (clear_user(buffer + tsz -
n,
- tsz -
n))
+ n))
return -EFAULT;
}
} else {