android_kernel_google_msm/fs/nfsd
Stanislav Kinsbursky a6d5f5393d nfsd: check passed socket's net matches NFSd superblock's one
commit 3064639423 upstream.

There could be a case, when NFSd file system is mounted in network, different
to socket's one, like below:

"ip netns exec" creates new network and mount namespace, which duplicates NFSd
mount point, created in init_net context. And thus NFS server stop in nested
network context leads to RPCBIND client destruction in init_net.
Then, on NFSd start in nested network context, rpc.nfsd process creates socket
in nested net and passes it into "write_ports", which leads to RPCBIND sockets
creation in init_net context because of the same reason (NFSd monut point was
created in init_net context). An attempt to register passed socket in nested
net leads to panic, because no RPCBIND client present in nexted network
namespace.

This patch add check that passed socket's net matches NFSd superblock's one.
And returns -EINVAL error to user psace otherwise.

v2: Put socket on exit.

Reported-by: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[wengmeiling: backport to 3.4: adjust context]
Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-11 12:04:19 -07:00
..
acl.h nfsd4: remove outdated pathname-comments 2011-01-04 18:22:10 -05:00
auth.c
auth.h
cache.h nfsd: turn on reply cache for NFSv4 2011-07-18 09:39:01 -04:00
current_stateid.h nfsd41: use current stateid by value 2012-02-15 11:20:45 -05:00
export.c nfsd: add get_uint for u32's 2012-11-17 13:16:12 -08:00
fault_inject.c debugfs-related mode_t whack-a-mole 2012-03-20 21:29:53 -04:00
fault_inject.h NFSD: Added fault injection 2011-11-07 21:10:47 -05:00
idmap.h nfsd4: return nfs errno from name_to_id functions 2011-01-04 18:22:11 -05:00
Kconfig NFSD: Added fault injection 2011-11-07 21:10:47 -05:00
lockd.c nfsd: Remove deprecated nfsctl system call and related code. 2011-07-15 18:58:42 -04:00
Makefile NFSD: Added fault injection 2011-11-07 21:10:47 -05:00
netns.h nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled 2012-03-29 08:01:07 -04:00
nfs2acl.c
nfs3acl.c
nfs3proc.c nfsd41: make sure nfs server process OPEN with EXCLUSIVE4_1 correctly 2011-04-29 20:47:52 -04:00
nfs3xdr.c nfsd: fix compose_entry_fh() failure exits 2012-04-13 10:12:02 -04:00
nfs4acl.c NFSD: Call ->set_acl with a NULL ACL structure if no entries 2014-06-07 16:02:03 -07:00
nfs4callback.c nfsd4: use auth_unix unconditionally on backchannel 2012-03-28 19:14:36 -04:00
nfs4idmap.c NFSD: pass null terminated buf to kstrtouint() 2012-10-21 09:27:57 -07:00
nfs4proc.c nfsd: don't run get_file if nfs4_preprocess_stateid_op return error 2014-06-07 16:02:05 -07:00
nfs4recover.c nfsd: fix nfs4recover.c printk format warning 2012-04-30 12:28:48 -07:00
nfs4state.c nfsd4: remove lockowner when removing lock stateid 2014-06-07 16:02:03 -07:00
nfs4xdr.c nfsd4: fix xdr decoding of large non-write compounds 2014-06-07 16:02:04 -07:00
nfscache.c nfsd: turn on reply cache for NFSv4 2011-07-18 09:39:01 -04:00
nfsctl.c nfsd: check passed socket's net matches NFSd superblock's one 2014-06-11 12:04:19 -07:00
nfsd.h nfsd: pass net to nfsd_set_nrthreads() 2014-06-11 12:04:19 -07:00
nfsfh.c fs: propagate umode_t, misc bits 2012-01-03 22:55:10 -05:00
nfsfh.h fs: propagate umode_t, misc bits 2012-01-03 22:55:10 -05:00
nfsproc.c nfsd4: return nfs errno from name_to_id functions 2011-01-04 18:22:11 -05:00
nfssvc.c nfsd: containerize NFSd filesystem 2014-06-11 12:04:19 -07:00
nfsxdr.c Fix common misspellings 2011-03-31 11:26:23 -03:00
state.h nfsd: add nfsd4_client_tracking_ops struct and a way to set it 2012-03-26 11:49:47 -04:00
stats.c SUNRPC: register service stats /proc entries in passed network namespace context 2012-01-31 19:28:18 -05:00
vfs.c nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file 2014-06-07 16:02:05 -07:00
vfs.h nfsd: vfs_llseek() with 32 or 64 bit offsets (hashes) 2012-03-18 22:44:50 -04:00
xdr.h
xdr3.h
xdr4.h NFSD: Fix nfs4_verifier memory alignment 2012-03-20 15:36:15 -04:00