lkml.org 
[lkml]   [2010]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 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@siemens.com>
---
fs/proc/generic.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 08f4d71..cc7e671 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)


\
 
 \ /
  Last update: 2010-04-01 15:41    [W:0.045 / U:2.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site