OSDN Git Service

net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_set...
authorHangyu Hua <hbh25y@gmail.com>
Tue, 28 Feb 2023 02:33:44 +0000 (10:33 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 2 Mar 2023 04:30:01 +0000 (20:30 -0800)
commit49c47cc21b5b7a3d8deb18fc57b0aa2ab1286962
treea42d8662eabed9313fc47b5bfe97d24e5f40ae39
parent81563d8548b0478075c720666be348d4199b8591
net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf()

ctx->crypto_send.info is not protected by lock_sock in
do_tls_getsockopt_conf(). A race condition between do_tls_getsockopt_conf()
and error paths of do_tls_setsockopt_conf() may lead to a use-after-free
or null-deref.

More discussion:  https://lore.kernel.org/all/Y/ht6gQL+u6fj3dG@hog/

Fixes: 3c4d7559159b ("tls: kernel TLS support")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20230228023344.9623-1-hbh25y@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tls/tls_main.c