]> git.baikalelectronics.ru Git - kernel.git/commit
net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_set...
authorHangyu Hua <hbh25y@gmail.com>
Thu, 23 Mar 2023 05:30:32 +0000 (05:30 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Apr 2023 09:16:36 +0000 (11:16 +0200)
commit6f26dbaee52771e265d4f86807b7a3b9831d8e33
tree243f67a543537e876fe4a533298700d09c4ee146
parent900c89a89dcd87fa143c44224be7c830913e416f
net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf()

commit 49c47cc21b5b7a3d8deb18fc57b0aa2ab1286962 upstream.

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: 3a71956a2d9a ("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>
Signed-off-by: Meena Shanmugam <meenashanmugam@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tls/tls_main.c