.. | .. |
---|
92 | 92 | break; |
---|
93 | 93 | } |
---|
94 | 94 | |
---|
95 | | - if (sk_wait_event(sk, timeo, !sk->sk_write_pending, &wait)) |
---|
| 95 | + if (sk_wait_event(sk, timeo, |
---|
| 96 | + !READ_ONCE(sk->sk_write_pending), &wait)) |
---|
96 | 97 | break; |
---|
97 | 98 | } |
---|
98 | 99 | remove_wait_queue(sk_sleep(sk), &wait); |
---|
.. | .. |
---|
386 | 387 | rc = -EINVAL; |
---|
387 | 388 | goto out; |
---|
388 | 389 | } |
---|
389 | | - lock_sock(sk); |
---|
390 | 390 | memcpy(crypto_info_aes_gcm_128->iv, |
---|
391 | 391 | cctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, |
---|
392 | 392 | TLS_CIPHER_AES_GCM_128_IV_SIZE); |
---|
393 | 393 | memcpy(crypto_info_aes_gcm_128->rec_seq, cctx->rec_seq, |
---|
394 | 394 | TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE); |
---|
395 | | - release_sock(sk); |
---|
396 | 395 | if (copy_to_user(optval, |
---|
397 | 396 | crypto_info_aes_gcm_128, |
---|
398 | 397 | sizeof(*crypto_info_aes_gcm_128))) |
---|
.. | .. |
---|
410 | 409 | rc = -EINVAL; |
---|
411 | 410 | goto out; |
---|
412 | 411 | } |
---|
413 | | - lock_sock(sk); |
---|
414 | 412 | memcpy(crypto_info_aes_gcm_256->iv, |
---|
415 | 413 | cctx->iv + TLS_CIPHER_AES_GCM_256_SALT_SIZE, |
---|
416 | 414 | TLS_CIPHER_AES_GCM_256_IV_SIZE); |
---|
417 | 415 | memcpy(crypto_info_aes_gcm_256->rec_seq, cctx->rec_seq, |
---|
418 | 416 | TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE); |
---|
419 | | - release_sock(sk); |
---|
420 | 417 | if (copy_to_user(optval, |
---|
421 | 418 | crypto_info_aes_gcm_256, |
---|
422 | 419 | sizeof(*crypto_info_aes_gcm_256))) |
---|
.. | .. |
---|
436 | 433 | { |
---|
437 | 434 | int rc = 0; |
---|
438 | 435 | |
---|
| 436 | + lock_sock(sk); |
---|
| 437 | + |
---|
439 | 438 | switch (optname) { |
---|
440 | 439 | case TLS_TX: |
---|
441 | 440 | case TLS_RX: |
---|
.. | .. |
---|
446 | 445 | rc = -ENOPROTOOPT; |
---|
447 | 446 | break; |
---|
448 | 447 | } |
---|
| 448 | + |
---|
| 449 | + release_sock(sk); |
---|
| 450 | + |
---|
449 | 451 | return rc; |
---|
450 | 452 | } |
---|
451 | 453 | |
---|