2008-01-25 16:59:41

by Myklebust, Trond

[permalink] [raw]
Subject: [PATCH 020/112] SUNRPC: Mask signals across the call to rpc_call_setup() in rpc_run_task

To ensure that the RPCSEC_GSS upcall is performed with the correct sigmask.

Signed-off-by: Trond Myklebust <[email protected]>
---

net/sunrpc/auth.c | 3 +++
net/sunrpc/clnt.c | 13 +++++++------
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index eca941c..bcd9abd 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -385,6 +385,7 @@ rpcauth_bindcred(struct rpc_task *task)
.group_info = current->group_info,
};
struct rpc_cred *ret;
+ sigset_t oldset;
int flags = 0;

dprintk("RPC: %5u looking up %s cred\n",
@@ -392,7 +393,9 @@ rpcauth_bindcred(struct rpc_task *task)
get_group_info(acred.group_info);
if (task->tk_flags & RPC_TASK_ROOTCREDS)
flags |= RPCAUTH_LOOKUP_ROOTCREDS;
+ rpc_clnt_sigmask(task->tk_client, &oldset);
ret = auth->au_ops->lookup_cred(auth, &acred, flags);
+ rpc_clnt_sigunmask(task->tk_client, &oldset);
if (!IS_ERR(ret))
task->tk_msg.rpc_cred = ret;
else
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 9aad459..aefe3ae 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -501,12 +501,12 @@ static void rpc_save_sigmask(sigset_t *oldset, int intr)
sigprocmask(SIG_BLOCK, &sigmask, oldset);
}

-static inline void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset)
+static void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset)
{
rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task));
}

-static inline void rpc_restore_sigmask(sigset_t *oldset)
+static void rpc_restore_sigmask(sigset_t *oldset)
{
sigprocmask(SIG_SETMASK, oldset, NULL);
}
@@ -536,11 +536,10 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data)
if (task == NULL) {
rpc_release_calldata(task_setup_data->callback_ops,
task_setup_data->callback_data);
- return ERR_PTR(-ENOMEM);
+ ret = ERR_PTR(-ENOMEM);
+ goto out;
}

- /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
- rpc_task_sigmask(task, &oldset);
if (task_setup_data->rpc_message != NULL) {
rpc_call_setup(task, task_setup_data->rpc_message, 0);
if (task->tk_status != 0) {
@@ -550,10 +549,12 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data)
}
}
atomic_inc(&task->tk_count);
+ /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
+ rpc_task_sigmask(task, &oldset);
rpc_execute(task);
+ rpc_restore_sigmask(&oldset);
ret = task;
out:
- rpc_restore_sigmask(&oldset);
return ret;
}
EXPORT_SYMBOL_GPL(rpc_run_task);