All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
       [not found] ` <20210823170624.GA1420@agape.jhs>
@ 2021-08-24  2:07   ` iLifetruth
  2021-08-24  7:04     ` iLifetruth
  0 siblings, 1 reply; 7+ messages in thread
From: iLifetruth @ 2021-08-24  2:07 UTC (permalink / raw)
  To: Fabio Aiuto
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-staging,
	linux-kernel, Qiang Liu, yajin

I haven't committed the patch yet since the Linux staging tree may
seem special. It's not clear to me where to submit the patch. So could
you please fix it?

Regards and thanks for your confirmation,
- iLifetruth


On Tue, Aug 24, 2021 at 1:08 AM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
>
> Hello,
>
> On Mon, Aug 23, 2021 at 11:19:09PM +0800, iLifetruth wrote:
> > Hi, in the latest version of Linux staging tree, we may have found an
> > unfixed security bug in the staging/driver/rtl8723bs related to the
> > CVE-2021-28660. Now, we would like to contact you to confirm this
> > problem.
> >
> > ===========
> > Here is the description of CVE-2021-28660:
> >
> > "It was discovered that the rtl8188eu WiFi driver did not correctly
> > limit the length of SSIDs copied into scan results. An attacker within
> > WiFi range could use this to cause a denial of service (crash or
> > memory corruption) or possibly to execute code on a vulnerable
> > system."
> >
> > ===========
> > The staging driver "rtl8188eu" was fixed by commit
> > 74b6b20df8cfe90ada777d621b54c32e69e27cd7 on 2021-03-10.
> >
> > However, in another similar staging driver numbered "rtl8723bs", a
> > function named “rtw_wx_set_scan” remains the same problem unfixed. And
> > it is detected in the
> > “drivers/staging/rtl8723bs/os_dep/ioctl_linux.c#Line1354" without
> > checking to prevent writing beyond the end of the ->ssid[] array.
> >
> > Therefore, shall we port the same fix from RTL8188EU to RTL8723BS?
>
> I think it's a good idea, moreover I've just sent a patch series
> aimed at removing that piece of code for it belongs to very
> old wext implementation.
>
> But until it's not accepted by the maintainer that security bug
> is present and harmful. If you fix it thank you, if you don't
> thank you for reporting this, I will fix as soon as possible.
>
> >
> > Thank you!
>
> thank you,
>
> fabio

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
  2021-08-24  2:07   ` staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs iLifetruth
@ 2021-08-24  7:04     ` iLifetruth
  2021-08-24  7:28       ` Greg KH
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: iLifetruth @ 2021-08-24  7:04 UTC (permalink / raw)
  To: Fabio Aiuto
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin

Here are the fixes and the contents of the patch file we suggest.

[PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()

This fixing patch is ported from the upstream commit
74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
This code has a check to prevent read overflow but it needs another
check to prevent writing beyond the end of the ->ssid[] array in
driver rtl8723bs.

---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index f95000df8942..3b859b71bf43 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
*dev, struct iw_request_info *a,

                                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++;
                                }

--

Thanks for your confirmation,
- iLifetruth


On Tue, Aug 24, 2021 at 10:07 AM iLifetruth <yixiaonn@gmail.com> wrote:
>
> I haven't committed the patch yet since the Linux staging tree may
> seem special. It's not clear to me where to submit the patch. So could
> you please fix it?
>
> Regards and thanks for your confirmation,
> - iLifetruth
>
>
> On Tue, Aug 24, 2021 at 1:08 AM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
> >
> > Hello,
> >
> > On Mon, Aug 23, 2021 at 11:19:09PM +0800, iLifetruth wrote:
> > > Hi, in the latest version of Linux staging tree, we may have found an
> > > unfixed security bug in the staging/driver/rtl8723bs related to the
> > > CVE-2021-28660. Now, we would like to contact you to confirm this
> > > problem.
> > >
> > > ===========
> > > Here is the description of CVE-2021-28660:
> > >
> > > "It was discovered that the rtl8188eu WiFi driver did not correctly
> > > limit the length of SSIDs copied into scan results. An attacker within
> > > WiFi range could use this to cause a denial of service (crash or
> > > memory corruption) or possibly to execute code on a vulnerable
> > > system."
> > >
> > > ===========
> > > The staging driver "rtl8188eu" was fixed by commit
> > > 74b6b20df8cfe90ada777d621b54c32e69e27cd7 on 2021-03-10.
> > >
> > > However, in another similar staging driver numbered "rtl8723bs", a
> > > function named “rtw_wx_set_scan” remains the same problem unfixed. And
> > > it is detected in the
> > > “drivers/staging/rtl8723bs/os_dep/ioctl_linux.c#Line1354" without
> > > checking to prevent writing beyond the end of the ->ssid[] array.
> > >
> > > Therefore, shall we port the same fix from RTL8188EU to RTL8723BS?
> >
> > I think it's a good idea, moreover I've just sent a patch series
> > aimed at removing that piece of code for it belongs to very
> > old wext implementation.
> >
> > But until it's not accepted by the maintainer that security bug
> > is present and harmful. If you fix it thank you, if you don't
> > thank you for reporting this, I will fix as soon as possible.
> >
> > >
> > > Thank you!
> >
> > thank you,
> >
> > fabio

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
  2021-08-24  7:04     ` iLifetruth
@ 2021-08-24  7:28       ` Greg KH
  2021-08-24  7:40       ` Fabio Aiuto
  2021-08-24  7:46       ` Fabio Aiuto
  2 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2021-08-24  7:28 UTC (permalink / raw)
  To: iLifetruth
  Cc: Fabio Aiuto, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin

On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote:
> Here are the fixes and the contents of the patch file we suggest.
> 
> [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()
> 
> This fixing patch is ported from the upstream commit
> 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
> rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
> This code has a check to prevent read overflow but it needs another
> check to prevent writing beyond the end of the ->ssid[] array in
> driver rtl8723bs.
> 
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index f95000df8942..3b859b71bf43 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
> *dev, struct iw_request_info *a,
> 
>                                 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++;
>                                 }
> 
> --

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch is malformed (tabs converted to spaces, linewrapped, etc.)
  and can not be applied.  Please read the file,
  Documentation/email-clients.txt in order to fix this.

- Your patch does not have a Signed-off-by: line.  Please read the
  kernel file, Documentation/SubmittingPatches and resend it after
  adding that line.  Note, the line needs to be in the body of the
  email, before the patch, not at the bottom of the patch or in the
  email signature.

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what is needed in order to
  properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
  and everyone else, to know what this patch is all about.  Please read
  the section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what a proper Subject: line should
  look like.

- It looks like you did not use your "real" name for the patch on either
  the Signed-off-by: line, or the From: line (both of which have to
  match).  Please read the kernel file, Documentation/SubmittingPatches
  for how to do this correctly.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
  2021-08-24  7:04     ` iLifetruth
  2021-08-24  7:28       ` Greg KH
@ 2021-08-24  7:40       ` Fabio Aiuto
  2021-08-24  7:46       ` Fabio Aiuto
  2 siblings, 0 replies; 7+ messages in thread
From: Fabio Aiuto @ 2021-08-24  7:40 UTC (permalink / raw)
  To: iLifetruth
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin, hdegoede, Larry.Finger, Martin Kaiser,
	Phillip Potter, Michael Straube, fmdefrancesco

Hello,

On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote:
> Here are the fixes and the contents of the patch file we suggest.
> 
> [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()
> 
> This fixing patch is ported from the upstream commit
> 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
> rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
> This code has a check to prevent read overflow but it needs another
> check to prevent writing beyond the end of the ->ssid[] array in
> driver rtl8723bs.
> 
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index f95000df8942..3b859b71bf43 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
> *dev, struct iw_request_info *a,
> 
>                                 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++;
>                                 }
> 
> --
> 
> Thanks for your confirmation,
> - iLifetruth
> 

the patch looks fine. Just some points:

- If the patch related to wext support removal will
  be accepted, the patch isn't necessary. So I will wait
  until I know the community-maintainer decision.


> 
> On Tue, Aug 24, 2021 at 10:07 AM iLifetruth <yixiaonn@gmail.com> wrote:
> >
> > I haven't committed the patch yet since the Linux staging tree may
> > seem special. It's not clear to me where to submit the patch. So could
> > you please fix it?
> >
> > Regards and thanks for your confirmation,
> > - iLifetruth
> >
> >
> > On Tue, Aug 24, 2021 at 1:08 AM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > On Mon, Aug 23, 2021 at 11:19:09PM +0800, iLifetruth wrote:
> > > > Hi, in the latest version of Linux staging tree, we may have found an
> > > > unfixed security bug in the staging/driver/rtl8723bs related to the
> > > > CVE-2021-28660. Now, we would like to contact you to confirm this
> > > > problem.
> > > >
> > > > ===========
> > > > Here is the description of CVE-2021-28660:
> > > >
> > > > "It was discovered that the rtl8188eu WiFi driver did not correctly
> > > > limit the length of SSIDs copied into scan results. An attacker within
> > > > WiFi range could use this to cause a denial of service (crash or
> > > > memory corruption) or possibly to execute code on a vulnerable
> > > > system."
> > > >
> > > > ===========
> > > > The staging driver "rtl8188eu" was fixed by commit
> > > > 74b6b20df8cfe90ada777d621b54c32e69e27cd7 on 2021-03-10.

- The driver rtl8188eu is deprecated. Now exists r8188eu which has
  the same security bug, so it needs to be fixed. Again feel free
  to submit your own patch.

- If you decide to submit your own patch I suggest to put
  your full name in the email address as you submitted a legal
  document.
  
  vim 409+ Documentation/process/submitting-patches.rst

> > > >
> > > > However, in another similar staging driver numbered "rtl8723bs", a
> > > > function named “rtw_wx_set_scan” remains the same problem unfixed. And
> > > > it is detected in the
> > > > “drivers/staging/rtl8723bs/os_dep/ioctl_linux.c#Line1354" without
> > > > checking to prevent writing beyond the end of the ->ssid[] array.
> > > >
> > > > Therefore, shall we port the same fix from RTL8188EU to RTL8723BS?
> > >
> > > I think it's a good idea, moreover I've just sent a patch series
> > > aimed at removing that piece of code for it belongs to very
> > > old wext implementation.
> > >
> > > But until it's not accepted by the maintainer that security bug
> > > is present and harmful. If you fix it thank you, if you don't
> > > thank you for reporting this, I will fix as soon as possible.
> > >
> > > >
> > > > Thank you!
> > >
> > > thank you,
> > >
> > > fabio

thank you for your report,

fabio

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
  2021-08-24  7:04     ` iLifetruth
  2021-08-24  7:28       ` Greg KH
  2021-08-24  7:40       ` Fabio Aiuto
@ 2021-08-24  7:46       ` Fabio Aiuto
  2021-08-24  8:47           ` iLifetruth
  2 siblings, 1 reply; 7+ messages in thread
From: Fabio Aiuto @ 2021-08-24  7:46 UTC (permalink / raw)
  To: iLifetruth
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin, hdegoede, Larry.Finger, Martin Kaiser,
	Phillip Potter, Michael Straube, fmdefrancesco, linux-staging,
	paskripkin

Hello,

[sorry for resend, I updated the CC field]

On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote:
> Here are the fixes and the contents of the patch file we suggest.
> 
> [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()
> 
> This fixing patch is ported from the upstream commit
> 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
> rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
> This code has a check to prevent read overflow but it needs another
> check to prevent writing beyond the end of the ->ssid[] array in
> driver rtl8723bs.
> 
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index f95000df8942..3b859b71bf43 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
> *dev, struct iw_request_info *a,
> 
>                                 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++;
>                                 }
> 
> --
> 
> Thanks for your confirmation,
> - iLifetruth
> 

the patch looks fine. Just some points:

- If the patch related to wext support removal will
  be accepted, the patch isn't necessary. So I will wait
  until I know the community-maintainer decision.


> 
> On Tue, Aug 24, 2021 at 10:07 AM iLifetruth <yixiaonn@gmail.com> wrote:
> >
> > I haven't committed the patch yet since the Linux staging tree may
> > seem special. It's not clear to me where to submit the patch. So could
> > you please fix it?
> >
> > Regards and thanks for your confirmation,
> > - iLifetruth
> >
> >
> > On Tue, Aug 24, 2021 at 1:08 AM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > On Mon, Aug 23, 2021 at 11:19:09PM +0800, iLifetruth wrote:
> > > > Hi, in the latest version of Linux staging tree, we may have found an
> > > > unfixed security bug in the staging/driver/rtl8723bs related to the
> > > > CVE-2021-28660. Now, we would like to contact you to confirm this
> > > > problem.
> > > >
> > > > ===========
> > > > Here is the description of CVE-2021-28660:
> > > >
> > > > "It was discovered that the rtl8188eu WiFi driver did not correctly
> > > > limit the length of SSIDs copied into scan results. An attacker within
> > > > WiFi range could use this to cause a denial of service (crash or
> > > > memory corruption) or possibly to execute code on a vulnerable
> > > > system."
> > > >
> > > > ===========
> > > > The staging driver "rtl8188eu" was fixed by commit
> > > > 74b6b20df8cfe90ada777d621b54c32e69e27cd7 on 2021-03-10.

- The driver rtl8188eu is deprecated. Now exists r8188eu which has
  the same security bug, so it needs to be fixed. Again feel free
  to submit your own patch.

- If you decide to submit your own patch I suggest to put
  your full name in the email address as you submitted a legal
  document.
  
  vim 409+ Documentation/process/submitting-patches.rst

> > > >
> > > > However, in another similar staging driver numbered "rtl8723bs", a
> > > > function named “rtw_wx_set_scan” remains the same problem unfixed. And
> > > > it is detected in the
> > > > “drivers/staging/rtl8723bs/os_dep/ioctl_linux.c#Line1354" without
> > > > checking to prevent writing beyond the end of the ->ssid[] array.
> > > >
> > > > Therefore, shall we port the same fix from RTL8188EU to RTL8723BS?
> > >
> > > I think it's a good idea, moreover I've just sent a patch series
> > > aimed at removing that piece of code for it belongs to very
> > > old wext implementation.
> > >
> > > But until it's not accepted by the maintainer that security bug
> > > is present and harmful. If you fix it thank you, if you don't
> > > thank you for reporting this, I will fix as soon as possible.
> > >
> > > >
> > > > Thank you!
> > >
> > > thank you,
> > >
> > > fabio

thank you for your report,

fabio

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
  2021-08-24  7:46       ` Fabio Aiuto
@ 2021-08-24  8:47           ` iLifetruth
  0 siblings, 0 replies; 7+ messages in thread
From: iLifetruth @ 2021-08-24  8:47 UTC (permalink / raw)
  To: Fabio Aiuto
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin, hdegoede, Larry.Finger, Martin Kaiser,
	Phillip Potter, Michael Straube, fmdefrancesco, linux-staging,
	paskripkin

On Tue, Aug 24, 2021 at 3:46 PM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
>
> Hello,
>
> [sorry for resend, I updated the CC field]
>
> On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote:
> > Here are the fixes and the contents of the patch file we suggest.
> >
> > [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()
> >
> > This fixing patch is ported from the upstream commit
> > 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
> > rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
> > This code has a check to prevent read overflow but it needs another
> > check to prevent writing beyond the end of the ->ssid[] array in
> > driver rtl8723bs.
> >
> > ---
> >  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > index f95000df8942..3b859b71bf43 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
> > *dev, struct iw_request_info *a,
> >
> >                                 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++;
> >                                 }
> >
> > --
> >
> > Thanks for your confirmation,
> > - iLifetruth
> >
>
> the patch looks fine. Just some points:
>
> - If the patch related to wext support removal will
>   be accepted, the patch isn't necessary. So I will wait
>   until I know the community-maintainer decision.
>

OK, I see the situation now, and I will submit a relevant patch to the
Linux-staging tree at a suitable time.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs
@ 2021-08-24  8:47           ` iLifetruth
  0 siblings, 0 replies; 7+ messages in thread
From: iLifetruth @ 2021-08-24  8:47 UTC (permalink / raw)
  To: Fabio Aiuto
  Cc: gregkh, ross.schm.dev, marcocesati, insafonov, linux-kernel,
	Qiang Liu, yajin, hdegoede, Larry.Finger, Martin Kaiser,
	Phillip Potter, Michael Straube, fmdefrancesco, linux-staging,
	paskripkin

On Tue, Aug 24, 2021 at 3:46 PM Fabio Aiuto <fabioaiuto83@gmail.com> wrote:
>
> Hello,
>
> [sorry for resend, I updated the CC field]
>
> On Tue, Aug 24, 2021 at 03:04:04PM +0800, iLifetruth wrote:
> > Here are the fixes and the contents of the patch file we suggest.
> >
> > [PATCH]staging: rtl8723bs: prevent ->ssid overflow in rtw_wx_set_scan()
> >
> > This fixing patch is ported from the upstream commit
> > 74b6b20df8cf(staging: rtl8188eu: prevent ->ssid overflow in
> > rtw_wx_set_scan()) which fixes on another driver numbered rtl8188eu.
> > This code has a check to prevent read overflow but it needs another
> > check to prevent writing beyond the end of the ->ssid[] array in
> > driver rtl8723bs.
> >
> > ---
> >  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > index f95000df8942..3b859b71bf43 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> > @@ -1222,9 +1222,9 @@ static int rtw_wx_set_scan(struct net_device
> > *dev, struct iw_request_info *a,
> >
> >                                 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++;
> >                                 }
> >
> > --
> >
> > Thanks for your confirmation,
> > - iLifetruth
> >
>
> the patch looks fine. Just some points:
>
> - If the patch related to wext support removal will
>   be accepted, the patch isn't necessary. So I will wait
>   until I know the community-maintainer decision.
>

OK, I see the situation now, and I will submit a relevant patch to the
Linux-staging tree at a suitable time.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-24  8:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CABv53a_q4jzsXib7ovRs=eOwqcQ-oKb8c7DA7uUSPf+0tt6aog@mail.gmail.com>
     [not found] ` <20210823170624.GA1420@agape.jhs>
2021-08-24  2:07   ` staging: possible buffer overflow in rtw_wx_set_scan function in driver/staging/rtl8723bs iLifetruth
2021-08-24  7:04     ` iLifetruth
2021-08-24  7:28       ` Greg KH
2021-08-24  7:40       ` Fabio Aiuto
2021-08-24  7:46       ` Fabio Aiuto
2021-08-24  8:47         ` iLifetruth
2021-08-24  8:47           ` iLifetruth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.