]> 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)
commita27f198b4ea7afc6e3e3716d85c511a00fdad339
tree243f67a543537e876fe4a533298700d09c4ee146
parentadd4fb6d35acaf842e3eee9f9ae001d82b5b3044
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: c2c217d10788 ("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