Commit 645f1081 authored by Olga Kornievskaia's avatar Olga Kornievskaia Committed by Ben Hutchings

SUNRPC: allow for upcalls for same uid but different gss service

commit 9130b8db upstream.

It's possible to have simultaneous upcalls for the same UIDs but
different GSS service. In that case, we need to allow for the
upcall to gssd to proceed so that not the same context is used
by two different GSS services. Some servers lock the use of context
to the GSS service.
Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent fad71d7f
...@@ -326,12 +326,14 @@ gss_release_msg(struct gss_upcall_msg *gss_msg) ...@@ -326,12 +326,14 @@ gss_release_msg(struct gss_upcall_msg *gss_msg)
} }
static struct gss_upcall_msg * static struct gss_upcall_msg *
__gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid) __gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid, const struct gss_auth *auth)
{ {
struct gss_upcall_msg *pos; struct gss_upcall_msg *pos;
list_for_each_entry(pos, &pipe->in_downcall, list) { list_for_each_entry(pos, &pipe->in_downcall, list) {
if (!uid_eq(pos->uid, uid)) if (!uid_eq(pos->uid, uid))
continue; continue;
if (auth && pos->auth->service != auth->service)
continue;
atomic_inc(&pos->count); atomic_inc(&pos->count);
dprintk("RPC: %s found msg %p\n", __func__, pos); dprintk("RPC: %s found msg %p\n", __func__, pos);
return pos; return pos;
...@@ -351,7 +353,7 @@ gss_add_msg(struct gss_upcall_msg *gss_msg) ...@@ -351,7 +353,7 @@ gss_add_msg(struct gss_upcall_msg *gss_msg)
struct gss_upcall_msg *old; struct gss_upcall_msg *old;
spin_lock(&pipe->lock); spin_lock(&pipe->lock);
old = __gss_find_upcall(pipe, gss_msg->uid); old = __gss_find_upcall(pipe, gss_msg->uid, gss_msg->auth);
if (old == NULL) { if (old == NULL) {
atomic_inc(&gss_msg->count); atomic_inc(&gss_msg->count);
list_add(&gss_msg->list, &pipe->in_downcall); list_add(&gss_msg->list, &pipe->in_downcall);
...@@ -700,7 +702,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) ...@@ -700,7 +702,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
err = -ENOENT; err = -ENOENT;
/* Find a matching upcall */ /* Find a matching upcall */
spin_lock(&pipe->lock); spin_lock(&pipe->lock);
gss_msg = __gss_find_upcall(pipe, uid); gss_msg = __gss_find_upcall(pipe, uid, NULL);
if (gss_msg == NULL) { if (gss_msg == NULL) {
spin_unlock(&pipe->lock); spin_unlock(&pipe->lock);
goto err_put_ctx; goto err_put_ctx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment