From: Sasha Levin <levinsasha928@gmail.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] pipe: Fail cleanly when root tries F_SETPIPE_SZ with big size
Date: Fri, 02 Dec 2011 19:47:05 +0200 [thread overview]
Message-ID: <1322848025.3780.8.camel@lappy> (raw)
In-Reply-To: <CAOJsxLFvVUbnHrCKGL-kuN_JYQ6qwtU_kzvncrAmWAdjP2RvQw@mail.gmail.com>
Al, Ping?
On Sat, 2011-11-19 at 10:06 +0200, Pekka Enberg wrote:
> On Sat, Nov 19, 2011 at 9:34 AM, Sasha Levin <levinsasha928@gmail.com> wrote:
> > When a user with the CAP_SYS_RESOURCE cap tries to F_SETPIPE_SZ a pipe with
> > size bigger than what kmalloc() can alloc it spits out an ugly warning:
>
> [snip]
>
> > Instead, make kcalloc() handle the overflow case and fail quietly.
> >
> > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> > Cc: Pekka Enberg <penberg@kernel.org>
> > Cc: linux-fsdevel@vger.kernel.org
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>
> Acked-by: Pekka Enberg <penberg@kernel.org>
>
> > ---
> > fs/pipe.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/pipe.c b/fs/pipe.c
> > index 4065f07..3e38dc6 100644
> > --- a/fs/pipe.c
> > +++ b/fs/pipe.c
> > @@ -1137,7 +1137,7 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages)
> > if (nr_pages < pipe->nrbufs)
> > return -EBUSY;
> >
> > - bufs = kcalloc(nr_pages, sizeof(struct pipe_buffer), GFP_KERNEL);
> > + bufs = kcalloc(nr_pages, sizeof(struct pipe_buffer), GFP_KERNEL | __GFP_NOWARN);
> > if (unlikely(!bufs))
> > return -ENOMEM;
> >
> > --
> > 1.7.8.rc1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> >
--
Sasha.
prev parent reply other threads:[~2011-12-02 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-19 7:34 [PATCH v2] pipe: Fail cleanly when root tries F_SETPIPE_SZ with big size Sasha Levin
2011-11-19 8:06 ` Pekka Enberg
2011-12-02 17:47 ` Sasha Levin [this message]
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=1322848025.3780.8.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@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;
as well as URLs for NNTP newsgroup(s).