NFSD: Don't hold unrefcounted creds over call to nfsd_setuser()
commit172cad5201cad098f408202a7523f41039b80933
authorDavid Howells <dhowells@redhat.com>
Thu, 2 Jul 2009 13:35:32 +0000 (2 14:35 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 30 Jul 2009 21:38:59 +0000 (30 14:38 -0700)
tree0228c031ab6000168ee2b1970031f78568c4babd
parent29104c8829cd5c5eabff413ecf423c194523840d
NFSD: Don't hold unrefcounted creds over call to nfsd_setuser()

commit 033a666ccb842ab4134fcd0c861d5ba9f5d6bf3a upstream.

nfsd_open() gets an unrefcounted pointer to the current process's effective
credentials at the top of the function, then calls nfsd_setuser() via
fh_verify() - which may replace and destroy the current process's effective
credentials - and then passes the unrefcounted pointer to dentry_open() - but
the credentials may have been destroyed by this point.

Instead, the value from current_cred() should be passed directly to
dentry_open() as one of its arguments, rather than being cached in a variable.

Possibly fh_verify() should return the creds to use.

This is a regression introduced by
745ca2475a6ac596e3d8d37c2759c0fbe2586227 "CRED: Pass credentials through
dentry_open()".

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-and-Verified-By: Steve Dickson <steved@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfsd/vfs.c