diff --git a/patches.suse/0001-net-tls-fix-possible-race-condition-between-do_tls_g.patch b/patches.suse/0001-net-tls-fix-possible-race-condition-between-do_tls_g.patch new file mode 100644 index 0000000..b6a585a --- /dev/null +++ b/patches.suse/0001-net-tls-fix-possible-race-condition-between-do_tls_g.patch @@ -0,0 +1,66 @@ +From 49c47cc21b5b7a3d8deb18fc57b0aa2ab1286962 Mon Sep 17 00:00:00 2001 +From: Hangyu Hua +Date: Fri, 12 May 2023 18:14:32 +0200 +Subject: [PATCH] net: tls: fix possible race condition between + do_tls_getsockopt_conf() and do_tls_setsockopt_conf() +Git-commit: 49c47cc21b5b7a3d8deb18fc57b0aa2ab1286962 +Patch-mainline: v6.3-rc2 +References: bsc#1209366 CVE-2023-28466 + +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 +Link: https://lore.kernel.org/r/20230228023344.9623-1-hbh25y@gmail.com +Signed-off-by: Jakub Kicinski +Acked-by: Vasant Karasulli + +--- + net/tls/tls_main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c +index f88878b9a..3ff2d03f1 100644 +--- a/net/tls/tls_main.c ++++ b/net/tls/tls_main.c +@@ -364,13 +364,11 @@ static int do_tls_getsockopt_tx(struct sock *sk, char __user *optval, + rc = -EINVAL; + goto out; + } +- lock_sock(sk); + memcpy(crypto_info_aes_gcm_128->iv, + ctx->tx.iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, + TLS_CIPHER_AES_GCM_128_IV_SIZE); + memcpy(crypto_info_aes_gcm_128->rec_seq, ctx->tx.rec_seq, + TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE); +- release_sock(sk); + if (copy_to_user(optval, + crypto_info_aes_gcm_128, + sizeof(*crypto_info_aes_gcm_128))) +@@ -390,6 +388,8 @@ static int do_tls_getsockopt(struct sock *sk, int optname, + { + int rc = 0; + ++ lock_sock(sk); ++ + switch (optname) { + case TLS_TX: + rc = do_tls_getsockopt_tx(sk, optval, optlen); +@@ -398,6 +398,9 @@ static int do_tls_getsockopt(struct sock *sk, int optname, + rc = -ENOPROTOOPT; + break; + } ++ ++ release_sock(sk); ++ + return rc; + } + +-- +2.34.1 + diff --git a/series.conf b/series.conf index 7a09ba5..64f125e 100644 --- a/series.conf +++ b/series.conf @@ -63297,6 +63297,7 @@ patches.suse/media-rc-Fix-use-after-free-bugs-caused-by-ene_tx_ir.patch patches.suse/watchdog-pcwd_usb-Fix-attempting-to-access-uninitial.patch patches.suse/x86-speculation-Allow-enabling-STIBP-with-legacy-IBR.patch + patches.suse/0001-net-tls-fix-possible-race-condition-between-do_tls_g.patch patches.suse/net-usb-qmi_wwan-add-Telit-0x1080-composition.patch patches.suse/SUNRPC-Fix-a-server-shutdown-leak.patch patches.suse/scsi-qla2xxx-Add-option-to-disable-FC2-Target-suppor.patch