This is a note to let you know that I've just added the patch titled staging: ks7010: prevent buffer overflow in ks_wlan_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-ks7010-prevent-buffer-overflow-in-ks_wlan_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 e163b9823a0b08c3bb8dc4f5b4b5c221c24ec3e5 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Tue, 2 Mar 2021 14:19:39 +0300 Subject: staging: ks7010: prevent buffer overflow in ks_wlan_set_scan() From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit e163b9823a0b08c3bb8dc4f5b4b5c221c24ec3e5 upstream. The user can specify a "req->essid_len" of up to 255 but if it's over IW_ESSID_MAX_SIZE (32) that can lead to memory corruption. Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: stable <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/YD4fS8+HmM/Qmrw6@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/ks7010/ks_wlan_net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_d { struct ks_wlan_private *priv = netdev_priv(dev); struct iw_scan_req *req = NULL; + int len; if (priv->sleep_mode == SLP_SLEEP) return -EPERM; @@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_d if (wrqu->data.length == sizeof(struct iw_scan_req) && wrqu->data.flags & IW_SCAN_THIS_ESSID) { req = (struct iw_scan_req *)extra; - priv->scan_ssid_len = req->essid_len; - memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len); + len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE); + priv->scan_ssid_len = len; + memcpy(priv->scan_ssid, req->essid, len); } else { priv->scan_ssid_len = 0; } 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