From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Ingo Oeser <ioe-lkml@rameria.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Vegard Nossum <vegard.nossum@gmail.com>,
bfields@fieldses.org, neilb@suse.de
Subject: Re: [PATCH] sunrpc - fixup userspace buffer possible overrun v2
Date: Sun, 31 Aug 2008 18:41:29 +0400 [thread overview]
Message-ID: <20080831144129.GB2884@lenovo> (raw)
In-Reply-To: <200808311609.12275.ioe-lkml@rameria.de>
[Ingo Oeser - Sun, Aug 31, 2008 at 04:09:10PM +0200]
| Hi Cyrill,
|
| On Sunday 31 August 2008, Cyrill Gorcunov wrote:
| > The conclusion is that proc_do_xprt doesn't check for userside buffer
| > size indeed so fix. Also set lenp to number of bytes were really written.
|
| Why not use simple_read_from_buffer() for the read case and
| keep the -EINVAL for the write case.
Ah, thanks Ingo - good idea. Btw does libfs.c depends
on anything?
|
| > Reported-by: Vegard Nossum <vegard.nossum@gmail.com>
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > CC: David Wagner <daw@cs.berkeley.edu>
| > ---
| >
| > Please review.
| >
| > Index: linux-2.6.git/net/sunrpc/sysctl.c
| > ===================================================================
| > --- linux-2.6.git.orig/net/sunrpc/sysctl.c 2008-08-31 13:43:46.000000000 +0400
| > +++ linux-2.6.git/net/sunrpc/sysctl.c 2008-08-31 13:58:14.000000000 +0400
| > @@ -60,23 +60,26 @@ static int proc_do_xprt(ctl_table *table
| > void __user *buffer, size_t *lenp, loff_t *ppos)
| > {
| > char tmpbuf[256];
| > - int len;
| > + size_t len;
| > +
| + ssize_t ret;
| > if ((*ppos && !write) || !*lenp) {
| > *lenp = 0;
| > return 0;
| > }
| > +
| > if (write)
| > return -EINVAL;
|
| len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
| ret = simple_read_from_buffer(buffer, ppos, tmpbuf, len);
| if (ret >= 0) {
| *lenp = ret;
| ret = 0;
| }
|
| return ret;
| }
|
|
| Best Regards
|
| Ingo Oeser
|
- Cyrill -
next prev parent reply other threads:[~2008-08-31 14:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-31 10:08 [PATCH] sunrpc - fixup userspace buffer possible overrun v2 Cyrill Gorcunov
2008-08-31 10:35 ` Vegard Nossum
2008-08-31 14:09 ` Ingo Oeser
2008-08-31 14:41 ` Cyrill Gorcunov [this message]
2008-08-31 14:44 ` Cyrill Gorcunov
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=20080831144129.GB2884@lenovo \
--to=gorcunov@gmail.com \
--cc=bfields@fieldses.org \
--cc=ioe-lkml@rameria.de \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=vegard.nossum@gmail.com \
/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