Lines Matching refs:ctx
118 gss_get_ctx(struct gss_cl_ctx *ctx) in gss_get_ctx() argument
120 atomic_inc(&ctx->count); in gss_get_ctx()
121 return ctx; in gss_get_ctx()
125 gss_put_ctx(struct gss_cl_ctx *ctx) in gss_put_ctx() argument
127 if (atomic_dec_and_test(&ctx->count)) in gss_put_ctx()
128 gss_free_ctx(ctx); in gss_put_ctx()
137 gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx) in gss_cred_set_ctx() argument
143 gss_get_ctx(ctx); in gss_cred_set_ctx()
144 rcu_assign_pointer(gss_cred->gc_ctx, ctx); in gss_cred_set_ctx()
183 struct gss_cl_ctx *ctx = NULL; in gss_cred_get_ctx() local
186 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_cred_get_ctx()
187 if (ctx) in gss_cred_get_ctx()
188 gss_get_ctx(ctx); in gss_cred_get_ctx()
190 return ctx; in gss_cred_get_ctx()
196 struct gss_cl_ctx *ctx; in gss_alloc_context() local
198 ctx = kzalloc(sizeof(*ctx), GFP_NOFS); in gss_alloc_context()
199 if (ctx != NULL) { in gss_alloc_context()
200 ctx->gc_proc = RPC_GSS_PROC_DATA; in gss_alloc_context()
201 ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ in gss_alloc_context()
202 spin_lock_init(&ctx->gc_seq_lock); in gss_alloc_context()
203 atomic_set(&ctx->count,1); in gss_alloc_context()
205 return ctx; in gss_alloc_context()
210 gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct gss_api_mech *gm) in gss_fill_context() argument
228 ctx->gc_expiry = now + ((unsigned long)timeout * HZ); in gss_fill_context()
235 ctx->gc_win = window_size; in gss_fill_context()
237 if (ctx->gc_win == 0) { in gss_fill_context()
249 p = simple_get_netobj(p, end, &ctx->gc_wire_ctx); in gss_fill_context()
261 ret = gss_import_sec_context(p, seclen, gm, &ctx->gc_gss_ctx, NULL, GFP_NOFS); in gss_fill_context()
274 p = simple_get_netobj(q, end, &ctx->gc_acceptor); in gss_fill_context()
279 __func__, ctx->gc_expiry, now, timeout, ctx->gc_acceptor.len, in gss_fill_context()
280 ctx->gc_acceptor.data); in gss_fill_context()
298 struct gss_cl_ctx *ctx; member
335 if (gss_msg->ctx != NULL) in gss_release_msg()
336 gss_put_ctx(gss_msg->ctx); in gss_release_msg()
405 if (gss_msg->ctx == NULL) in gss_handle_downcall_result()
408 gss_cred_set_ctx(&gss_cred->gc_base, gss_msg->ctx); in gss_handle_downcall_result()
592 else if (gss_msg->ctx == NULL && gss_msg->msg.errno >= 0) { in gss_refresh_upcall()
651 if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) { in gss_create_upcall()
661 if (gss_msg->ctx) in gss_create_upcall()
662 gss_cred_set_ctx(cred, gss_msg->ctx); in gss_create_upcall()
684 struct gss_cl_ctx *ctx; in gss_pipe_downcall() local
714 ctx = gss_alloc_context(); in gss_pipe_downcall()
715 if (ctx == NULL) in gss_pipe_downcall()
729 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); in gss_pipe_downcall()
751 gss_msg->ctx = gss_get_ctx(ctx); in gss_pipe_downcall()
760 gss_put_ctx(ctx); in gss_pipe_downcall()
1216 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1); in gss_destroying_context() local
1222 ctx->gc_proc = RPC_GSS_PROC_DESTROY; in gss_destroying_context()
1241 gss_do_free_ctx(struct gss_cl_ctx *ctx) in gss_do_free_ctx() argument
1245 gss_delete_sec_context(&ctx->gc_gss_ctx); in gss_do_free_ctx()
1246 kfree(ctx->gc_wire_ctx.data); in gss_do_free_ctx()
1247 kfree(ctx->gc_acceptor.data); in gss_do_free_ctx()
1248 kfree(ctx); in gss_do_free_ctx()
1254 struct gss_cl_ctx *ctx = container_of(head, struct gss_cl_ctx, gc_rcu); in gss_free_ctx_callback() local
1255 gss_do_free_ctx(ctx); in gss_free_ctx_callback()
1259 gss_free_ctx(struct gss_cl_ctx *ctx) in gss_free_ctx() argument
1261 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback); in gss_free_ctx()
1283 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1); in gss_destroy_nullcred() local
1287 if (ctx) in gss_destroy_nullcred()
1288 gss_put_ctx(ctx); in gss_destroy_nullcred()
1360 struct gss_cl_ctx *ctx; in gss_stringify_acceptor() local
1365 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_stringify_acceptor()
1366 if (!ctx) in gss_stringify_acceptor()
1369 len = ctx->gc_acceptor.len; in gss_stringify_acceptor()
1381 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_stringify_acceptor()
1384 if (!ctx || !ctx->gc_acceptor.len) { in gss_stringify_acceptor()
1390 acceptor = &ctx->gc_acceptor; in gss_stringify_acceptor()
1418 struct gss_cl_ctx *ctx; in gss_key_timeout() local
1423 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_key_timeout()
1424 if (ctx) in gss_key_timeout()
1425 expire = ctx->gc_expiry - (gss_key_expire_timeo * HZ); in gss_key_timeout()
1427 if (!ctx || time_after(now, expire)) in gss_key_timeout()
1436 struct gss_cl_ctx *ctx; in gss_match() local
1443 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_match()
1444 if (!ctx || time_after(jiffies, ctx->gc_expiry)) { in gss_match()
1488 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_marshal() local
1500 spin_lock(&ctx->gc_seq_lock); in gss_marshal()
1501 req->rq_seqno = ctx->gc_seq++; in gss_marshal()
1502 spin_unlock(&ctx->gc_seq_lock); in gss_marshal()
1505 *p++ = htonl((u32) ctx->gc_proc); in gss_marshal()
1508 p = xdr_encode_netobj(p, &ctx->gc_wire_ctx); in gss_marshal()
1522 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &verf_buf, &mic); in gss_marshal()
1530 gss_put_ctx(ctx); in gss_marshal()
1533 gss_put_ctx(ctx); in gss_marshal()
1613 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_validate() local
1637 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic); in gss_validate()
1648 gss_put_ctx(ctx); in gss_validate()
1653 gss_put_ctx(ctx); in gss_validate()
1669 gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_wrap_req_integ() argument
1702 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &integ_buf, &mic); in gss_wrap_req_integ()
1760 gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_wrap_req_priv() argument
1801 maj_stat = gss_wrap(ctx->gc_gss_ctx, offset, snd_buf, inpages); in gss_wrap_req_priv()
1834 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_wrap_req() local
1838 if (ctx->gc_proc != RPC_GSS_PROC_DATA) { in gss_wrap_req()
1852 status = gss_wrap_req_integ(cred, ctx, encode, rqstp, p, obj); in gss_wrap_req()
1855 status = gss_wrap_req_priv(cred, ctx, encode, rqstp, p, obj); in gss_wrap_req()
1859 gss_put_ctx(ctx); in gss_wrap_req()
1865 gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_unwrap_resp_integ() argument
1893 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf, &mic); in gss_unwrap_resp_integ()
1902 gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_unwrap_resp_priv() argument
1918 maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset, rcv_buf); in gss_unwrap_resp_priv()
1946 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_unwrap_resp() local
1952 if (ctx->gc_proc != RPC_GSS_PROC_DATA) in gss_unwrap_resp()
1958 status = gss_unwrap_resp_integ(cred, ctx, rqstp, &p); in gss_unwrap_resp()
1963 status = gss_unwrap_resp_priv(cred, ctx, rqstp, &p); in gss_unwrap_resp()
1974 gss_put_ctx(ctx); in gss_unwrap_resp()