SUNRPC: Cache the process user cred in the RPC server listener
In order to be able to interpret uids and gids correctly in knfsd, we should cache the user namespace of the process that created the RPC server's listener. To do so, we refcount the credential of that process. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:

committed by
J. Bruce Fields

parent
e333f3bbef
commit
4df493a260
@@ -41,11 +41,13 @@ static struct svc_program nfs4_callback_program;
|
||||
|
||||
static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net)
|
||||
{
|
||||
const struct cred *cred = current_cred();
|
||||
int ret;
|
||||
struct nfs_net *nn = net_generic(net, nfs_net_id);
|
||||
|
||||
ret = svc_create_xprt(serv, "tcp", net, PF_INET,
|
||||
nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
|
||||
nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS,
|
||||
cred);
|
||||
if (ret <= 0)
|
||||
goto out_err;
|
||||
nn->nfs_callback_tcpport = ret;
|
||||
@@ -53,7 +55,8 @@ static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net)
|
||||
nn->nfs_callback_tcpport, PF_INET, net->ns.inum);
|
||||
|
||||
ret = svc_create_xprt(serv, "tcp", net, PF_INET6,
|
||||
nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
|
||||
nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS,
|
||||
cred);
|
||||
if (ret > 0) {
|
||||
nn->nfs_callback_tcpport6 = ret;
|
||||
dprintk("NFS: Callback listener port = %u (af %u, net %x)\n",
|
||||
|
Reference in New Issue
Block a user