Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61865
b: refs/heads/master
c: be879c4
h: refs/heads/master
i:
  61863: 9dcee3f
v: v3
  • Loading branch information
J. Bruce Fields authored and Trond Myklebust committed Jul 19, 2007
1 parent 513bdf7 commit d729c5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3a535e1739a9da3cc316ccdfe5cd4bf84d745ac
refs/heads/master: be879c4e249a8875d7129f3b0c1bb62584dafbd8
16 changes: 16 additions & 0 deletions trunk/include/linux/sunrpc/xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/uio.h>
#include <asm/byteorder.h>
#include <linux/scatterlist.h>
#include <linux/smp_lock.h>

/*
* Buffer adjustment
Expand All @@ -35,6 +36,21 @@ struct xdr_netobj {
*/
typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);

/*
* We're still requiring the BKL in the xdr code until it's been
* more carefully audited, at which point this wrapper will become
* unnecessary.
*/
static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
{
int ret;

lock_kernel();
ret = xdrproc(rqstp, data, obj);
unlock_kernel();
return ret;
}

/*
* Basic structure for transmission/reception of a client XDR message.
* Features a header (for a linear buffer containing RPC headers
Expand Down
13 changes: 2 additions & 11 deletions trunk/net/sunrpc/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/errno.h>
#include <linux/sunrpc/clnt.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>

#ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_AUTH
Expand Down Expand Up @@ -476,36 +475,28 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp,
__be32 *data, void *obj)
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
int ret;

dprintk("RPC: %5u using %s cred %p to wrap rpc data\n",
task->tk_pid, cred->cr_ops->cr_name, cred);
if (cred->cr_ops->crwrap_req)
return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
/* By default, we encode the arguments normally. */
lock_kernel();
ret = encode(rqstp, data, obj);
unlock_kernel();
return ret;
return rpc_call_xdrproc(encode, rqstp, data, obj);
}

int
rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp,
__be32 *data, void *obj)
{
struct rpc_cred *cred = task->tk_msg.rpc_cred;
int ret;

dprintk("RPC: %5u using %s cred %p to unwrap rpc data\n",
task->tk_pid, cred->cr_ops->cr_name, cred);
if (cred->cr_ops->crunwrap_resp)
return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
data, obj);
/* By default, we decode the arguments normally. */
lock_kernel();
ret = decode(rqstp, data, obj);
unlock_kernel();
return ret;
return rpc_call_xdrproc(decode, rqstp, data, obj);
}

int
Expand Down
21 changes: 5 additions & 16 deletions trunk/net/sunrpc/auth_gss/auth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/pagemap.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/auth.h>
Expand Down Expand Up @@ -1000,9 +999,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
*p++ = htonl(rqstp->rq_seqno);

lock_kernel();
status = encode(rqstp, p, obj);
unlock_kernel();
status = rpc_call_xdrproc(encode, rqstp, p, obj);
if (status)
return status;

Expand Down Expand Up @@ -1096,9 +1093,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
*p++ = htonl(rqstp->rq_seqno);

lock_kernel();
status = encode(rqstp, p, obj);
unlock_kernel();
status = rpc_call_xdrproc(encode, rqstp, p, obj);
if (status)
return status;

Expand Down Expand Up @@ -1157,16 +1152,12 @@ gss_wrap_req(struct rpc_task *task,
/* The spec seems a little ambiguous here, but I think that not
* wrapping context destruction requests makes the most sense.
*/
lock_kernel();
status = encode(rqstp, p, obj);
unlock_kernel();
status = rpc_call_xdrproc(encode, rqstp, p, obj);
goto out;
}
switch (gss_cred->gc_service) {
case RPC_GSS_SVC_NONE:
lock_kernel();
status = encode(rqstp, p, obj);
unlock_kernel();
status = rpc_call_xdrproc(encode, rqstp, p, obj);
break;
case RPC_GSS_SVC_INTEGRITY:
status = gss_wrap_req_integ(cred, ctx, encode,
Expand Down Expand Up @@ -1282,9 +1273,7 @@ gss_unwrap_resp(struct rpc_task *task,
cred->cr_auth->au_rslack = cred->cr_auth->au_verfsize + (p - savedp)
+ (savedlen - head->iov_len);
out_decode:
lock_kernel();
status = decode(rqstp, p, obj);
unlock_kernel();
status = rpc_call_xdrproc(decode, rqstp, p, obj);
out:
gss_put_ctx(ctx);
dprintk("RPC: %5u gss_unwrap_resp returning %d\n", task->tk_pid,
Expand Down

0 comments on commit d729c5d

Please sign in to comment.