diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2019-12-05 13:45:05 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-12-11 16:37:02 +0800 |
commit | a2ce15b668c6001804d34080c79e5e3c9979eda7 (patch) | |
tree | 8882b35528df0c3893247b6e61badc5797645890 /crypto/af_alg.c | |
parent | 55d26d1cf88c38d5dbdf142754c58db2537c171b (diff) | |
download | linux-crypto-a2ce15b668c6001804d34080c79e5e3c9979eda7.tar.gz linux-crypto-a2ce15b668c6001804d34080c79e5e3c9979eda7.zip |
crypto: af_alg - Use bh_lock_sock in sk_destruct
As af_alg_release_parent may be called from BH context (most notably
due to an async request that only completes after socket closure,
or as reported here because of an RCU-delayed sk_destruct call), we
must use bh_lock_sock instead of lock_sock.
Reported-by: syzbot+c2f1558d49e25cc36e5e@syzkaller.appspotmail.com
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: 796caacfda1c ("crypto: af_alg - Disallow bind/setkey/...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r-- | crypto/af_alg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 0dceaabc..3d8e5301 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -134,11 +134,13 @@ void af_alg_release_parent(struct sock *sk) sk = ask->parent; ask = alg_sk(sk); - lock_sock(sk); + local_bh_disable(); + bh_lock_sock(sk); ask->nokey_refcnt -= nokey; if (!last) last = !--ask->refcnt; - release_sock(sk); + bh_unlock_sock(sk); + local_bh_enable(); if (last) sock_put(sk); |