From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Valentina Manea <valentina.manea.m@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
stable <stable@vger.kernel.org>
Subject: [PATCH] usbip: vhci_hcd: check port number before using
Date: Mon, 8 Oct 2018 20:19:13 +0100 [thread overview]
Message-ID: <20181008191913.11527-1-sudip.mukherjee@codethink.co.uk> (raw)
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);
--
2.11.0
next reply other threads:[~2018-10-08 19:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 19:19 Sudip Mukherjee [this message]
2018-10-08 19:28 ` [PATCH] usbip: vhci_hcd: check port number before using Shuah Khan
2018-10-08 20:01 ` Sudip Mukherjee
2018-10-08 20:06 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181008191913.11527-1-sudip.mukherjee@codethink.co.uk \
--to=sudipm.mukherjee@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+600b03e0cf1b73bb23c4@syzkaller.appspotmail.com \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).