This is a note to let you know that I've just added the patch titled staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-rtl8188eu-prevent-ssid-overflow-in-rtw_wx_set_scan.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 74b6b20df8cfe90ada777d621b54c32e69e27cd7 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Fri, 5 Mar 2021 11:58:03 +0300 Subject: staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan() From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit 74b6b20df8cfe90ada777d621b54c32e69e27cd7 upstream. This code has a check to prevent read overflow but it needs another check to prevent writing beyond the end of the ->ssid[] array. Fixes: a2c60d42d97c ("staging: r8188eu: Add files for new driver - part 16") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: stable <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/YEHymwsnHewzoam7@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -1144,9 +1144,11 @@ static int rtw_wx_set_scan(struct net_de break; } sec_len = *(pos++); len -= 1; - if (sec_len > 0 && sec_len <= len) { + if (sec_len > 0 && + sec_len <= len && + sec_len <= 32) { ssid[ssid_index].ssid_length = sec_len; - memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length); + memcpy(ssid[ssid_index].ssid, pos, sec_len); ssid_index++; } pos += sec_len; Patches currently in stable-queue which might be from dan.carpenter@xxxxxxxxxx are queue-5.10/usb-gadget-u_ether-fix-a-configfs-return-code.patch queue-5.10/tcp-fix-sign-comparison-bug-in-getsockopt-tcp_zerocopy_receive.patch queue-5.10/staging-rtl8192e-fix-possible-buffer-overflow-in-_rtl92e_wx_set_scan.patch queue-5.10/staging-rtl8188eu-fix-potential-memory-corruption-in-rtw_check_beacon_data.patch queue-5.10/staging-ks7010-prevent-buffer-overflow-in-ks_wlan_set_scan.patch queue-5.10/staging-rtl8188eu-prevent-ssid-overflow-in-rtw_wx_set_scan.patch queue-5.10/staging-rtl8712-unterminated-string-leads-to-read-overflow.patch queue-5.10/staging-rtl8192u-fix-ssid-overflow-in-r8192_wx_set_scan.patch