From: Jan Kiszka <jan.kiszka@siemens.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
"Helight.Xu" <helight.xu@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] proc: Report file name on detected read_proc overflow
Date: Thu, 01 Apr 2010 15:09:34 +0200 [thread overview]
Message-ID: <4BB49B0E.8070306@siemens.com> (raw)
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)
next reply other threads:[~2010-04-01 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 13:09 Jan Kiszka [this message]
2010-04-01 14:41 ` [PATCH] proc: Report file name on detected read_proc overflow Frans Pop
2010-04-01 16:16 ` [PATCH v2] " Jan Kiszka
2010-04-02 6:28 ` [PATCH] " Alexey Dobriyan
2010-04-06 16:48 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB49B0E.8070306@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=helight.xu@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox