All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: dhowells@redhat.com, Evgeniy Polyakov <zbr@ioremap.net>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	linux-fsdevel@vger.kernel.org
Subject: Re: NFS/credentials leak in 2.6.29-rc1
Date: Thu, 22 Jan 2009 07:08:33 +0000	[thread overview]
Message-ID: <24419.1232608113@redhat.com> (raw)
In-Reply-To: <20090121223710.GF4295@fieldses.org>

J. Bruce Fields <bfields@fieldses.org> wrote:

> If the only difference is just whether it takes a reference on the
> passed-in cred it might be clearest just to write
> 
> 	set_creds(new);
> 
> or
> 	set_creds(get_creds(new));
> 
> depending on which you want?

The former would be preferable, if it transfers the reference on the creds to
the task_struct, thus eliminating the need for a put_cred().

> In any case, yes, the revert_creds()/override_creds() names don't tell
> me much.
> 
> > > Looking through nfsd_setuser(), one obvious bug: in the (flags &
> > > NFSEXP_ALLSQUASH) case, we never check the return value from the
> > > groups_alloc(0).  If it returns NULL, we dereference it anyway.
> > 
> > Since a zero-length groups list must be copied before writing, can I recommend
> > that we make groups_alloc(0) a special case that returns pointer to a
> > statically allocated groups list (after inc'ing the refcount) that represents
> > a zero-length list, thus meaning groups_alloc(0) will never fail?
> 
> Is there a really big advantage to that?  On the face of it it strikes
> me as a weird corner case that I'll trip over every time I look at this
> code.

It'll remove a potential OOM condition.  It's a minor optimisation, I think.

David

  reply	other threads:[~2009-01-22  7:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 11:46 NFS/credentials leak in 2.6.29-rc1 Evgeniy Polyakov
2009-01-20 13:37 ` Trond Myklebust
2009-01-20 13:49   ` Evgeniy Polyakov
2009-01-20 15:11 ` J. Bruce Fields
2009-01-20 15:23   ` Evgeniy Polyakov
2009-01-20 23:53     ` J. Bruce Fields
2009-01-21 12:23       ` David Howells
2009-01-21 12:37         ` Evgeniy Polyakov
2009-01-21 13:17           ` David Howells
2009-01-21 13:18             ` Evgeniy Polyakov
2009-01-21 22:39           ` J. Bruce Fields
2009-01-21 22:46             ` Evgeniy Polyakov
2009-01-21 23:18               ` J. Bruce Fields
2009-01-21 23:31                 ` Evgeniy Polyakov
2009-01-27  0:49           ` J. Bruce Fields
2009-01-27  9:26             ` Evgeniy Polyakov
2009-01-27 22:07               ` J. Bruce Fields
2009-01-29 14:37                 ` Evgeniy Polyakov
2009-01-29 18:52                   ` J. Bruce Fields
2009-01-29 19:00                     ` Evgeniy Polyakov
2009-02-05 13:22             ` David Howells
2009-02-05 17:21               ` J. Bruce Fields
2009-01-21 22:37         ` J. Bruce Fields
2009-01-22  7:08           ` David Howells [this message]
2009-01-22 16:43             ` J. Bruce Fields
2009-01-20 21:44   ` David Howells
2009-01-21 22:42     ` J. Bruce Fields

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=24419.1232608113@redhat.com \
    --to=dhowells@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --cc=zbr@ioremap.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.