aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-25 10:15:15 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:35 -0400
commitfc432dd90760a629c57026e57f65ff80a1a31d2f (patch)
tree1df060f199effb8cfd52772e618c0bac7b8d0e9f /net/sunrpc/auth_gss
parent696e38df9d1b256e97b077ecde7afb8dd60364fd (diff)
SUNRPC: Enforce atomic updates of rpc_cred->cr_flags
Convert to the use of atomic bitops... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 766de0a41b22..55c47ae0a258 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -114,8 +114,8 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
114 write_lock(&gss_ctx_lock); 114 write_lock(&gss_ctx_lock);
115 old = gss_cred->gc_ctx; 115 old = gss_cred->gc_ctx;
116 gss_cred->gc_ctx = ctx; 116 gss_cred->gc_ctx = ctx;
117 cred->cr_flags |= RPCAUTH_CRED_UPTODATE; 117 set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
118 cred->cr_flags &= ~RPCAUTH_CRED_NEW; 118 clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags);
119 write_unlock(&gss_ctx_lock); 119 write_unlock(&gss_ctx_lock);
120 if (old) 120 if (old)
121 gss_put_ctx(old); 121 gss_put_ctx(old);
@@ -128,7 +128,7 @@ gss_cred_is_uptodate_ctx(struct rpc_cred *cred)
128 int res = 0; 128 int res = 0;
129 129
130 read_lock(&gss_ctx_lock); 130 read_lock(&gss_ctx_lock);
131 if ((cred->cr_flags & RPCAUTH_CRED_UPTODATE) && gss_cred->gc_ctx) 131 if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) && gss_cred->gc_ctx)
132 res = 1; 132 res = 1;
133 read_unlock(&gss_ctx_lock); 133 read_unlock(&gss_ctx_lock);
134 return res; 134 return res;
@@ -732,7 +732,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
732 * Note: in order to force a call to call_refresh(), we deliberately 732 * Note: in order to force a call to call_refresh(), we deliberately
733 * fail to flag the credential as RPCAUTH_CRED_UPTODATE. 733 * fail to flag the credential as RPCAUTH_CRED_UPTODATE.
734 */ 734 */
735 cred->gc_base.cr_flags = RPCAUTH_CRED_NEW; 735 cred->gc_base.cr_flags = 1UL << RPCAUTH_CRED_NEW;
736 cred->gc_service = gss_auth->service; 736 cred->gc_service = gss_auth->service;
737 return &cred->gc_base; 737 return &cred->gc_base;
738 738
@@ -764,7 +764,7 @@ gss_match(struct auth_cred *acred, struct rpc_cred *rc, int flags)
764 * we don't really care if the credential has expired or not, 764 * we don't really care if the credential has expired or not,
765 * since the caller should be prepared to reinitialise it. 765 * since the caller should be prepared to reinitialise it.
766 */ 766 */
767 if ((flags & RPCAUTH_LOOKUP_NEW) && (rc->cr_flags & RPCAUTH_CRED_NEW)) 767 if ((flags & RPCAUTH_LOOKUP_NEW) && test_bit(RPCAUTH_CRED_NEW, &rc->cr_flags))
768 goto out; 768 goto out;
769 /* Don't match with creds that have expired. */ 769 /* Don't match with creds that have expired. */
770 if (gss_cred->gc_ctx && time_after(jiffies, gss_cred->gc_ctx->gc_expiry)) 770 if (gss_cred->gc_ctx && time_after(jiffies, gss_cred->gc_ctx->gc_expiry))
@@ -820,7 +820,7 @@ gss_marshal(struct rpc_task *task, __be32 *p)
820 mic.data = (u8 *)(p + 1); 820 mic.data = (u8 *)(p + 1);
821 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &verf_buf, &mic); 821 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &verf_buf, &mic);
822 if (maj_stat == GSS_S_CONTEXT_EXPIRED) { 822 if (maj_stat == GSS_S_CONTEXT_EXPIRED) {
823 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 823 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
824 } else if (maj_stat != 0) { 824 } else if (maj_stat != 0) {
825 printk("gss_marshal: gss_get_mic FAILED (%d)\n", maj_stat); 825 printk("gss_marshal: gss_get_mic FAILED (%d)\n", maj_stat);
826 goto out_put_ctx; 826 goto out_put_ctx;
@@ -873,7 +873,7 @@ gss_validate(struct rpc_task *task, __be32 *p)
873 873
874 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic); 874 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic);
875 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 875 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
876 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 876 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
877 if (maj_stat) 877 if (maj_stat)
878 goto out_bad; 878 goto out_bad;
879 /* We leave it to unwrap to calculate au_rslack. For now we just 879 /* We leave it to unwrap to calculate au_rslack. For now we just
@@ -927,7 +927,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
927 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &integ_buf, &mic); 927 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &integ_buf, &mic);
928 status = -EIO; /* XXX? */ 928 status = -EIO; /* XXX? */
929 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 929 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
930 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 930 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
931 else if (maj_stat) 931 else if (maj_stat)
932 return status; 932 return status;
933 q = xdr_encode_opaque(p, NULL, mic.len); 933 q = xdr_encode_opaque(p, NULL, mic.len);
@@ -1026,7 +1026,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1026 /* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was 1026 /* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was
1027 * done anyway, so it's safe to put the request on the wire: */ 1027 * done anyway, so it's safe to put the request on the wire: */
1028 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 1028 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
1029 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 1029 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
1030 else if (maj_stat) 1030 else if (maj_stat)
1031 return status; 1031 return status;
1032 1032
@@ -1113,7 +1113,7 @@ gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1113 1113
1114 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf, &mic); 1114 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf, &mic);
1115 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 1115 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
1116 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 1116 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
1117 if (maj_stat != GSS_S_COMPLETE) 1117 if (maj_stat != GSS_S_COMPLETE)
1118 return status; 1118 return status;
1119 return 0; 1119 return 0;
@@ -1138,7 +1138,7 @@ gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1138 1138
1139 maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset, rcv_buf); 1139 maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset, rcv_buf);
1140 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 1140 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
1141 cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; 1141 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
1142 if (maj_stat != GSS_S_COMPLETE) 1142 if (maj_stat != GSS_S_COMPLETE)
1143 return status; 1143 return status;
1144 if (ntohl(*(*p)++) != rqstp->rq_seqno) 1144 if (ntohl(*(*p)++) != rqstp->rq_seqno)