aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/auth_gss.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/auth_gss/auth_gss.c')
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 8da2a0e68574..dcfc66bab2bb 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -373,7 +373,7 @@ gss_handle_downcall_result(struct gss_cred *gss_cred, struct gss_upcall_msg *gss
373static void 373static void
374gss_upcall_callback(struct rpc_task *task) 374gss_upcall_callback(struct rpc_task *task)
375{ 375{
376 struct gss_cred *gss_cred = container_of(task->tk_msg.rpc_cred, 376 struct gss_cred *gss_cred = container_of(task->tk_rqstp->rq_cred,
377 struct gss_cred, gc_base); 377 struct gss_cred, gc_base);
378 struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall; 378 struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall;
379 struct inode *inode = &gss_msg->inode->vfs_inode; 379 struct inode *inode = &gss_msg->inode->vfs_inode;
@@ -502,7 +502,7 @@ static void warn_gssd(void)
502static inline int 502static inline int
503gss_refresh_upcall(struct rpc_task *task) 503gss_refresh_upcall(struct rpc_task *task)
504{ 504{
505 struct rpc_cred *cred = task->tk_msg.rpc_cred; 505 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
506 struct gss_auth *gss_auth = container_of(cred->cr_auth, 506 struct gss_auth *gss_auth = container_of(cred->cr_auth,
507 struct gss_auth, rpc_auth); 507 struct gss_auth, rpc_auth);
508 struct gss_cred *gss_cred = container_of(cred, 508 struct gss_cred *gss_cred = container_of(cred,
@@ -928,6 +928,7 @@ gss_do_free_ctx(struct gss_cl_ctx *ctx)
928{ 928{
929 dprintk("RPC: gss_free_ctx\n"); 929 dprintk("RPC: gss_free_ctx\n");
930 930
931 gss_delete_sec_context(&ctx->gc_gss_ctx);
931 kfree(ctx->gc_wire_ctx.data); 932 kfree(ctx->gc_wire_ctx.data);
932 kfree(ctx); 933 kfree(ctx);
933} 934}
@@ -942,13 +943,7 @@ gss_free_ctx_callback(struct rcu_head *head)
942static void 943static void
943gss_free_ctx(struct gss_cl_ctx *ctx) 944gss_free_ctx(struct gss_cl_ctx *ctx)
944{ 945{
945 struct gss_ctx *gc_gss_ctx;
946
947 gc_gss_ctx = rcu_dereference(ctx->gc_gss_ctx);
948 rcu_assign_pointer(ctx->gc_gss_ctx, NULL);
949 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback); 946 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback);
950 if (gc_gss_ctx)
951 gss_delete_sec_context(&gc_gss_ctx);
952} 947}
953 948
954static void 949static void
@@ -1064,12 +1059,12 @@ out:
1064static __be32 * 1059static __be32 *
1065gss_marshal(struct rpc_task *task, __be32 *p) 1060gss_marshal(struct rpc_task *task, __be32 *p)
1066{ 1061{
1067 struct rpc_cred *cred = task->tk_msg.rpc_cred; 1062 struct rpc_rqst *req = task->tk_rqstp;
1063 struct rpc_cred *cred = req->rq_cred;
1068 struct gss_cred *gss_cred = container_of(cred, struct gss_cred, 1064 struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
1069 gc_base); 1065 gc_base);
1070 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); 1066 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
1071 __be32 *cred_len; 1067 __be32 *cred_len;
1072 struct rpc_rqst *req = task->tk_rqstp;
1073 u32 maj_stat = 0; 1068 u32 maj_stat = 0;
1074 struct xdr_netobj mic; 1069 struct xdr_netobj mic;
1075 struct kvec iov; 1070 struct kvec iov;
@@ -1119,7 +1114,7 @@ out_put_ctx:
1119 1114
1120static int gss_renew_cred(struct rpc_task *task) 1115static int gss_renew_cred(struct rpc_task *task)
1121{ 1116{
1122 struct rpc_cred *oldcred = task->tk_msg.rpc_cred; 1117 struct rpc_cred *oldcred = task->tk_rqstp->rq_cred;
1123 struct gss_cred *gss_cred = container_of(oldcred, 1118 struct gss_cred *gss_cred = container_of(oldcred,
1124 struct gss_cred, 1119 struct gss_cred,
1125 gc_base); 1120 gc_base);
@@ -1133,7 +1128,7 @@ static int gss_renew_cred(struct rpc_task *task)
1133 new = gss_lookup_cred(auth, &acred, RPCAUTH_LOOKUP_NEW); 1128 new = gss_lookup_cred(auth, &acred, RPCAUTH_LOOKUP_NEW);
1134 if (IS_ERR(new)) 1129 if (IS_ERR(new))
1135 return PTR_ERR(new); 1130 return PTR_ERR(new);
1136 task->tk_msg.rpc_cred = new; 1131 task->tk_rqstp->rq_cred = new;
1137 put_rpccred(oldcred); 1132 put_rpccred(oldcred);
1138 return 0; 1133 return 0;
1139} 1134}
@@ -1161,7 +1156,7 @@ static int gss_cred_is_negative_entry(struct rpc_cred *cred)
1161static int 1156static int
1162gss_refresh(struct rpc_task *task) 1157gss_refresh(struct rpc_task *task)
1163{ 1158{
1164 struct rpc_cred *cred = task->tk_msg.rpc_cred; 1159 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
1165 int ret = 0; 1160 int ret = 0;
1166 1161
1167 if (gss_cred_is_negative_entry(cred)) 1162 if (gss_cred_is_negative_entry(cred))
@@ -1172,7 +1167,7 @@ gss_refresh(struct rpc_task *task)
1172 ret = gss_renew_cred(task); 1167 ret = gss_renew_cred(task);
1173 if (ret < 0) 1168 if (ret < 0)
1174 goto out; 1169 goto out;
1175 cred = task->tk_msg.rpc_cred; 1170 cred = task->tk_rqstp->rq_cred;
1176 } 1171 }
1177 1172
1178 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags)) 1173 if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags))
@@ -1191,7 +1186,7 @@ gss_refresh_null(struct rpc_task *task)
1191static __be32 * 1186static __be32 *
1192gss_validate(struct rpc_task *task, __be32 *p) 1187gss_validate(struct rpc_task *task, __be32 *p)
1193{ 1188{
1194 struct rpc_cred *cred = task->tk_msg.rpc_cred; 1189 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
1195 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); 1190 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
1196 __be32 seq; 1191 __be32 seq;
1197 struct kvec iov; 1192 struct kvec iov;
@@ -1400,7 +1395,7 @@ static int
1400gss_wrap_req(struct rpc_task *task, 1395gss_wrap_req(struct rpc_task *task,
1401 kxdrproc_t encode, void *rqstp, __be32 *p, void *obj) 1396 kxdrproc_t encode, void *rqstp, __be32 *p, void *obj)
1402{ 1397{
1403 struct rpc_cred *cred = task->tk_msg.rpc_cred; 1398 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
1404 struct gss_cred *gss_cred = container_of(cred, struct gss_cred, 1399 struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
1405 gc_base); 1400 gc_base);
1406 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); 1401 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
@@ -1503,7 +1498,7 @@ static int
1503gss_unwrap_resp(struct rpc_task *task, 1498gss_unwrap_resp(struct rpc_task *task,
1504 kxdrproc_t decode, void *rqstp, __be32 *p, void *obj) 1499 kxdrproc_t decode, void *rqstp, __be32 *p, void *obj)
1505{ 1500{
1506 struct rpc_cred *cred = task->tk_msg.rpc_cred; 1501 struct rpc_cred *cred = task->tk_rqstp->rq_cred;
1507 struct gss_cred *gss_cred = container_of(cred, struct gss_cred, 1502 struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
1508 gc_base); 1503 gc_base);
1509 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); 1504 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);