public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qmi_wwan: Fix out-of-bounds read
@ 2019-06-27 10:01 Kristian Evensen
  2019-06-28  4:14 ` Kristian Evensen
  0 siblings, 1 reply; 4+ messages in thread
From: Kristian Evensen @ 2019-06-27 10:01 UTC (permalink / raw)
  To: stable; +Cc: Kristian Evensen, syzbot+b68605d7fadd21510de1, Bjørn Mork

commit 904d88d743b0c94092c5117955eab695df8109e8 upstream.

The syzbot reported

 Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0xca/0x13e lib/dump_stack.c:113
  print_address_description+0x67/0x231 mm/kasan/report.c:188
  __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
  kasan_report+0xe/0x20 mm/kasan/common.c:614
  qmi_wwan_probe+0x342/0x360 drivers/net/usb/qmi_wwan.c:1417
  usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
  really_probe+0x281/0x660 drivers/base/dd.c:509
  driver_probe_device+0x104/0x210 drivers/base/dd.c:670
  __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
  bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454

Caused by too many confusing indirections and casts.
id->driver_info is a pointer stored in a long.  We want the
pointer here, not the address of it.

Thanks-to: Hillf Danton <hdanton@sina.com>
Reported-by: syzbot+b68605d7fadd21510de1@syzkaller.appspotmail.com
Cc: Kristian Evensen <kristian.evensen@gmail.com>
Fixes: e4bf63482c30 ("qmi_wwan: Add quirk for Quectel dynamic config")
Signed-off-by: Bjørn Mork <bjorn@mork.no>

[Upstream commit did not apply because I shuffled two lines in the
backport. The fixes tag for 4.14 is 3a6a5107ceb3.]

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
---
 drivers/net/usb/qmi_wwan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c2d6c501d..063daa343 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1395,14 +1395,14 @@ static int qmi_wwan_probe(struct usb_interface *intf,
 		return -ENODEV;
 	}
 
-	info = (void *)&id->driver_info;
-
 	/* Several Quectel modems supports dynamic interface configuration, so
 	 * we need to match on class/subclass/protocol. These values are
 	 * identical for the diagnostic- and QMI-interface, but bNumEndpoints is
 	 * different. Ignore the current interface if the number of endpoints
 	 * equals the number for the diag interface (two).
 	 */
+	info = (void *)id->driver_info;
+
 	if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) {
 		if (desc->bNumEndpoints == 2)
 			return -ENODEV;
-- 
2.20.1


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

* Re: [PATCH] qmi_wwan: Fix out-of-bounds read
  2019-06-27 10:01 [PATCH] qmi_wwan: Fix out-of-bounds read Kristian Evensen
@ 2019-06-28  4:14 ` Kristian Evensen
  2019-06-28 14:11   ` Sasha Levin
  2019-06-28 14:14   ` Sasha Levin
  0 siblings, 2 replies; 4+ messages in thread
From: Kristian Evensen @ 2019-06-28  4:14 UTC (permalink / raw)
  To: stable; +Cc: Bjørn Mork

Hi,

On Thu, Jun 27, 2019 at 12:01 PM Kristian Evensen
<kristian.evensen@gmail.com> wrote:
>
> commit 904d88d743b0c94092c5117955eab695df8109e8 upstream.
>
> The syzbot reported
>
>  Call Trace:
>   __dump_stack lib/dump_stack.c:77 [inline]
>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>   print_address_description+0x67/0x231 mm/kasan/report.c:188
>   __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
>   kasan_report+0xe/0x20 mm/kasan/common.c:614
>   qmi_wwan_probe+0x342/0x360 drivers/net/usb/qmi_wwan.c:1417
>   usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
>   really_probe+0x281/0x660 drivers/base/dd.c:509
>   driver_probe_device+0x104/0x210 drivers/base/dd.c:670
>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
>   bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
>
> Caused by too many confusing indirections and casts.
> id->driver_info is a pointer stored in a long.  We want the
> pointer here, not the address of it.
>
> Thanks-to: Hillf Danton <hdanton@sina.com>
> Reported-by: syzbot+b68605d7fadd21510de1@syzkaller.appspotmail.com
> Cc: Kristian Evensen <kristian.evensen@gmail.com>
> Fixes: e4bf63482c30 ("qmi_wwan: Add quirk for Quectel dynamic config")
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>
> [Upstream commit did not apply because I shuffled two lines in the
> backport. The fixes tag for 4.14 is 3a6a5107ceb3.]
>
> Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
> ---

I see now that I forgot to set the correct prefix for the patch. The
prefix should be PATCH 4.14. Sorry about that. Please let me know if I
should resubmit.

BR,
Kristian

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

* Re: [PATCH] qmi_wwan: Fix out-of-bounds read
  2019-06-28  4:14 ` Kristian Evensen
@ 2019-06-28 14:11   ` Sasha Levin
  2019-06-28 14:14   ` Sasha Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2019-06-28 14:11 UTC (permalink / raw)
  To: Kristian Evensen; +Cc: stable, Bjørn Mork

On Fri, Jun 28, 2019 at 06:14:33AM +0200, Kristian Evensen wrote:
>Hi,
>
>On Thu, Jun 27, 2019 at 12:01 PM Kristian Evensen
><kristian.evensen@gmail.com> wrote:
>>
>> commit 904d88d743b0c94092c5117955eab695df8109e8 upstream.
>>
>> The syzbot reported
>>
>>  Call Trace:
>>   __dump_stack lib/dump_stack.c:77 [inline]
>>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>>   print_address_description+0x67/0x231 mm/kasan/report.c:188
>>   __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
>>   kasan_report+0xe/0x20 mm/kasan/common.c:614
>>   qmi_wwan_probe+0x342/0x360 drivers/net/usb/qmi_wwan.c:1417
>>   usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
>>   really_probe+0x281/0x660 drivers/base/dd.c:509
>>   driver_probe_device+0x104/0x210 drivers/base/dd.c:670
>>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
>>   bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
>>
>> Caused by too many confusing indirections and casts.
>> id->driver_info is a pointer stored in a long.  We want the
>> pointer here, not the address of it.
>>
>> Thanks-to: Hillf Danton <hdanton@sina.com>
>> Reported-by: syzbot+b68605d7fadd21510de1@syzkaller.appspotmail.com
>> Cc: Kristian Evensen <kristian.evensen@gmail.com>
>> Fixes: e4bf63482c30 ("qmi_wwan: Add quirk for Quectel dynamic config")
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>
>> [Upstream commit did not apply because I shuffled two lines in the
>> backport. The fixes tag for 4.14 is 3a6a5107ceb3.]
>>
>> Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
>> ---
>
>I see now that I forgot to set the correct prefix for the patch. The
>prefix should be PATCH 4.14. Sorry about that. Please let me know if I
>should resubmit.

I've queued it for 4.14, thank you.

--
Thanks,
Sasha

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

* Re: [PATCH] qmi_wwan: Fix out-of-bounds read
  2019-06-28  4:14 ` Kristian Evensen
  2019-06-28 14:11   ` Sasha Levin
@ 2019-06-28 14:14   ` Sasha Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2019-06-28 14:14 UTC (permalink / raw)
  To: Kristian Evensen; +Cc: stable, Bjørn Mork

On Fri, Jun 28, 2019 at 06:14:33AM +0200, Kristian Evensen wrote:
>Hi,
>
>On Thu, Jun 27, 2019 at 12:01 PM Kristian Evensen
><kristian.evensen@gmail.com> wrote:
>>
>> commit 904d88d743b0c94092c5117955eab695df8109e8 upstream.
>>
>> The syzbot reported
>>
>>  Call Trace:
>>   __dump_stack lib/dump_stack.c:77 [inline]
>>   dump_stack+0xca/0x13e lib/dump_stack.c:113
>>   print_address_description+0x67/0x231 mm/kasan/report.c:188
>>   __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
>>   kasan_report+0xe/0x20 mm/kasan/common.c:614
>>   qmi_wwan_probe+0x342/0x360 drivers/net/usb/qmi_wwan.c:1417
>>   usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
>>   really_probe+0x281/0x660 drivers/base/dd.c:509
>>   driver_probe_device+0x104/0x210 drivers/base/dd.c:670
>>   __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
>>   bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
>>
>> Caused by too many confusing indirections and casts.
>> id->driver_info is a pointer stored in a long.  We want the
>> pointer here, not the address of it.
>>
>> Thanks-to: Hillf Danton <hdanton@sina.com>
>> Reported-by: syzbot+b68605d7fadd21510de1@syzkaller.appspotmail.com
>> Cc: Kristian Evensen <kristian.evensen@gmail.com>
>> Fixes: e4bf63482c30 ("qmi_wwan: Add quirk for Quectel dynamic config")
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>
>> [Upstream commit did not apply because I shuffled two lines in the
>> backport. The fixes tag for 4.14 is 3a6a5107ceb3.]
>>
>> Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
>> ---
>
>I see now that I forgot to set the correct prefix for the patch. The
>prefix should be PATCH 4.14. Sorry about that. Please let me know if I
>should resubmit.

I've also queued the upstream fix to 5.1 and 4.19.

--
Thanks,
Sasha

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

end of thread, other threads:[~2019-06-28 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-27 10:01 [PATCH] qmi_wwan: Fix out-of-bounds read Kristian Evensen
2019-06-28  4:14 ` Kristian Evensen
2019-06-28 14:11   ` Sasha Levin
2019-06-28 14:14   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox