linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* usbip: vhci_hcd: check port number before using
@ 2018-10-08 19:19 Sudip Mukherjee
  0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2018-10-08 19:19 UTC (permalink / raw)
  To: Valentina Manea, Shuah Khan, Greg Kroah-Hartman
  Cc: linux-kernel, linux-usb, syzbot+600b03e0cf1b73bb23c4,
	Sudip Mukherjee, stable

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

The port number is checked and it just prints an error message but it
still continues to use the invalid port. And as a result it accesses
memory which is not its resulting in  BUG report from KASAN.

Reported-by: syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/usb/usbip/vhci_hcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index d11f3f8dad40..71883aa788ac 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -334,8 +334,10 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 	usbip_dbg_vhci_rh("typeReq %x wValue %x wIndex %x\n", typeReq, wValue,
 			  wIndex);
 
-	if (wIndex > VHCI_HC_PORTS)
+	if (wIndex > VHCI_HC_PORTS) {
 		pr_err("invalid port number %d\n", wIndex);
+		return -ENODEV;
+	}
 	rhport = wIndex - 1;
 
 	vhci_hcd = hcd_to_vhci_hcd(hcd);

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

* usbip: vhci_hcd: check port number before using
@ 2018-10-08 19:28 Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2018-10-08 19:28 UTC (permalink / raw)
  To: Sudip Mukherjee, Valentina Manea, Greg Kroah-Hartman
  Cc: linux-kernel, linux-usb, syzbot+600b03e0cf1b73bb23c4, stable,
	Shuah Khan

Hi Sudip,

On 10/08/2018 01:19 PM, Sudip Mukherjee wrote:
> From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> 
> The port number is checked and it just prints an error message but it
> still continues to use the invalid port. And as a result it accesses
> memory which is not its resulting in  BUG report from KASAN.

Yes there is an issue with out of bounds access. But this isn't the
right fix.

> 
> Reported-by: syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

I sent in a fix for this last Friday.

https://patchwork.kernel.org/patch/10628833/

thanks,
-- Shuah

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

* usbip: vhci_hcd: check port number before using
@ 2018-10-08 20:01 Sudip Mukherjee
  0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2018-10-08 20:01 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Valentina Manea, Greg Kroah-Hartman, linux-kernel, linux-usb,
	syzbot+600b03e0cf1b73bb23c4, Stable

On Mon, Oct 8, 2018 at 8:29 PM Shuah Khan <shuah@kernel.org> wrote:
>
> Hi Sudip,
>
> On 10/08/2018 01:19 PM, Sudip Mukherjee wrote:
> > From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> >
> > The port number is checked and it just prints an error message but it
> > still continues to use the invalid port. And as a result it accesses
> > memory which is not its resulting in  BUG report from KASAN.
>
> Yes there is an issue with out of bounds access. But this isn't the
> right fix.
>
> >
> > Reported-by: syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com
> > Cc: stable <stable@vger.kernel.org>
> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
>
> I sent in a fix for this last Friday.
>
> https://patchwork.kernel.org/patch/10628833/

And I can confirm this patch also fixes the issue tested with the
reproducer I was using in my vm.

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

* usbip: vhci_hcd: check port number before using
@ 2018-10-08 20:06 Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2018-10-08 20:06 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Valentina Manea, Greg Kroah-Hartman, linux-kernel, linux-usb,
	syzbot+600b03e0cf1b73bb23c4, Stable, Shuah Khan

On 10/08/2018 02:01 PM, Sudip Mukherjee wrote:
> On Mon, Oct 8, 2018 at 8:29 PM Shuah Khan <shuah@kernel.org> wrote:
>>
>> Hi Sudip,
>>
>> On 10/08/2018 01:19 PM, Sudip Mukherjee wrote:
>>> From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
>>>
>>> The port number is checked and it just prints an error message but it
>>> still continues to use the invalid port. And as a result it accesses
>>> memory which is not its resulting in  BUG report from KASAN.
>>
>> Yes there is an issue with out of bounds access. But this isn't the
>> right fix.
>>
>>>
>>> Reported-by: syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com
>>> Cc: stable <stable@vger.kernel.org>
>>> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
>>
>> I sent in a fix for this last Friday.
>>
>> https://patchwork.kernel.org/patch/10628833/
> 
> And I can confirm this patch also fixes the issue tested with the
> reproducer I was using in my vm.
> 
> 

Great Thanks for testing the patch.

thanks,
-- Shuah

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

end of thread, other threads:[~2018-10-08 20:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 20:01 usbip: vhci_hcd: check port number before using Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08 20:06 Shuah Khan
2018-10-08 19:28 Shuah Khan
2018-10-08 19:19 Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).