[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BB4C6D6.6020602@siemens.com>
Date: Thu, 01 Apr 2010 18:16:22 +0200
From: Jan Kiszka <jan.kiszka@...mens.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Frans Pop <elendil@...net.nl>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"adobriyan@...il.com" <adobriyan@...il.com>,
"helight.xu@...il.com" <helight.xu@...il.com>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>
Subject: [PATCH v2] proc: Report file name on detected read_proc overflow
This can help identifying the buggy read_proc handler.
Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
---
fs/proc/generic.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
changes in v2:
- keep "Apparent buffer overflow" in the same source code line
- quote the file name with ''
(Thanks, Frans!)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 08f4d71..ce14eca 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -132,7 +132,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
if (start == NULL) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
n -= *ppos;
@@ -144,7 +146,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
} else if (start < page) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
if (n > count) {
@@ -159,7 +163,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
unsigned long startoff = (unsigned long)(start - page);
if (n > (PAGE_SIZE - startoff)) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE - startoff;
}
if (n > count)
--
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