[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <855d90d7-70a2-da82-d62c-e8c030411852@oracle.com>
Date: Wed, 18 May 2022 11:49:27 +0400
From: Denis Efremov <denis.e.efremov@...cle.com>
To: Larry.Finger@...inger.net
Cc: phil@...lpotter.co.uk, gregkh@...uxfoundation.org,
dan.carpenter@...cle.com, straube.linux@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, stable <stable@...r.kernel.org>
Subject: Re: [PATCH] staging: r8188eu: prevent ->Ssid overflow in
rtw_wx_set_scan()
On 5/18/22 11:00, Denis Efremov wrote:
> 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: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")
> Cc: stable <stable@...r.kernel.org>
> Signed-off-by: Denis Efremov <denis.e.efremov@...cle.com>
> ---
>
> This patch is a copy of Dan's 74b6b20df8cf (CVE-2021-28660).
> Drivers r8188eu and rtl8188eu share the same code.
I also found same code pattern in rtl8723bs driver in
stable kernels 5.10, 5.4, 4.19, 4.14.
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c?h=linux-5.10.y#n1354
I can send the same fix to stable trees if appropriate.
>
> drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> index eb9375b0c660..a2692ce02bc2 100644
> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> @@ -1131,9 +1131,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
> 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].SsidLength = sec_len;
> - memcpy(ssid[ssid_index].Ssid, pos, ssid[ssid_index].SsidLength);
> + memcpy(ssid[ssid_index].Ssid, pos, sec_len);
> ssid_index++;
> }
> pos += sec_len;
Powered by blists - more mailing lists