hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/net/sunrpc/auth_gss/gss_krb5_seal.c
....@@ -69,8 +69,6 @@
6969 # define RPCDBG_FACILITY RPCDBG_AUTH
7070 #endif
7171
72
-DEFINE_SPINLOCK(krb5_seq_lock);
73
-
7472 static void *
7573 setup_token(struct krb5_ctx *ctx, struct xdr_netobj *token)
7674 {
....@@ -133,14 +131,14 @@
133131 struct xdr_netobj md5cksum = {.len = sizeof(cksumdata),
134132 .data = cksumdata};
135133 void *ptr;
136
- s32 now;
134
+ time64_t now;
137135 u32 seq_send;
138136 u8 *cksumkey;
139137
140138 dprintk("RPC: %s\n", __func__);
141139 BUG_ON(ctx == NULL);
142140
143
- now = get_seconds();
141
+ now = ktime_get_real_seconds();
144142
145143 ptr = setup_token(ctx, token);
146144
....@@ -155,9 +153,7 @@
155153
156154 memcpy(ptr + GSS_KRB5_TOK_HDR_LEN, md5cksum.data, md5cksum.len);
157155
158
- spin_lock(&krb5_seq_lock);
159
- seq_send = ctx->seq_send++;
160
- spin_unlock(&krb5_seq_lock);
156
+ seq_send = atomic_fetch_inc(&ctx->seq_send);
161157
162158 if (krb5_make_seq_num(ctx, ctx->seq, ctx->initiate ? 0 : 0xff,
163159 seq_send, ptr + GSS_KRB5_TOK_HDR_LEN, ptr + 8))
....@@ -174,8 +170,7 @@
174170 struct xdr_netobj cksumobj = { .len = sizeof(cksumdata),
175171 .data = cksumdata};
176172 void *krb5_hdr;
177
- s32 now;
178
- u64 seq_send;
173
+ time64_t now;
179174 u8 *cksumkey;
180175 unsigned int cksum_usage;
181176 __be64 seq_send_be64;
....@@ -186,11 +181,7 @@
186181
187182 /* Set up the sequence number. Now 64-bits in clear
188183 * text and w/o direction indicator */
189
- spin_lock(&krb5_seq_lock);
190
- seq_send = ctx->seq_send64++;
191
- spin_unlock(&krb5_seq_lock);
192
-
193
- seq_send_be64 = cpu_to_be64(seq_send);
184
+ seq_send_be64 = cpu_to_be64(atomic64_fetch_inc(&ctx->seq_send64));
194185 memcpy(krb5_hdr + 8, (char *) &seq_send_be64, 8);
195186
196187 if (ctx->initiate) {
....@@ -207,7 +198,7 @@
207198
208199 memcpy(krb5_hdr + GSS_KRB5_TOK_HDR_LEN, cksumobj.data, cksumobj.len);
209200
210
- now = get_seconds();
201
+ now = ktime_get_real_seconds();
211202
212203 return (ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE;
213204 }
....@@ -223,7 +214,6 @@
223214 BUG();
224215 case ENCTYPE_DES_CBC_RAW:
225216 case ENCTYPE_DES3_CBC_RAW:
226
- case ENCTYPE_ARCFOUR_HMAC:
227217 return gss_get_mic_v1(ctx, text, token);
228218 case ENCTYPE_AES128_CTS_HMAC_SHA1_96:
229219 case ENCTYPE_AES256_CTS_HMAC_SHA1_96: