From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: Johan Hovold <johan@kernel.org>, stable <stable@vger.kernel.org>
Subject: [PATCH 12/24] USB: serial: mos7720: fix use-after-free on probe errors
Date: Tue, 3 Jan 2017 16:39:51 +0100 [thread overview]
Message-ID: <20170103154003.31860-13-johan@kernel.org> (raw)
In-Reply-To: <20170103154003.31860-1-johan@kernel.org>
The interrupt URB was submitted on probe but never stopped on probe
errors. This can lead to use-after-free issues in the completion
handler when accessing the freed usb-serial struct:
Unable to handle kernel paging request at virtual address 6b6b6be7
...
[<bf052e70>] (mos7715_interrupt_callback [mos7720]) from [<c052a894>] (__usb_hcd_giveback_urb+0x80/0x140)
[<c052a894>] (__usb_hcd_giveback_urb) from [<c052a9a4>] (usb_hcd_giveback_urb+0x50/0x138)
[<c052a9a4>] (usb_hcd_giveback_urb) from [<c0550684>] (musb_giveback+0xc8/0x1cc)
Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel
port on moschip 7715")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/mos7720.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 3220d0bc767b..9170ae856b34 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1962,8 +1962,10 @@ static int mos7720_startup(struct usb_serial *serial)
#ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
if (product == MOSCHIP_DEVICE_ID_7715) {
ret_val = mos7715_parport_init(serial);
- if (ret_val < 0)
+ if (ret_val < 0) {
+ usb_kill_urb(serial->port[0]->interrupt_in_urb);
return ret_val;
+ }
}
#endif
/* LSR For Port 1 */
@@ -1975,6 +1977,8 @@ static int mos7720_startup(struct usb_serial *serial)
static void mos7720_release(struct usb_serial *serial)
{
+ usb_kill_urb(serial->port[0]->interrupt_in_urb);
+
#ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
/* close the parallel port */
--
2.10.2
next prev parent reply other threads:[~2017-01-03 15:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170103154003.31860-1-johan@kernel.org>
2017-01-03 15:39 ` [PATCH 01/24] USB: serial: cyberjack: fix NULL-deref at open Johan Hovold
2017-01-03 16:27 ` Greg KH
2017-01-03 16:48 ` Johan Hovold
2017-01-03 16:55 ` Greg KH
2017-01-03 15:39 ` [PATCH 02/24] USB: serial: garmin_gps: fix memory leak on failed URB submit Johan Hovold
2017-01-03 15:39 ` [PATCH 03/24] USB: serial: io_edgeport: fix NULL-deref at open Johan Hovold
2017-01-03 15:39 ` [PATCH 04/24] USB: serial: io_ti: " Johan Hovold
2017-01-03 15:39 ` [PATCH 05/24] USB: serial: io_ti: fix another " Johan Hovold
2017-01-03 15:39 ` [PATCH 06/24] USB: serial: io_ti: fix I/O after disconnect Johan Hovold
2017-01-03 15:39 ` [PATCH 08/24] USB: serial: iuu_phoenix: fix NULL-deref at open Johan Hovold
2017-01-03 15:39 ` [PATCH 09/24] USB: serial: keyspan_pda: verify endpoints at probe Johan Hovold
2017-01-03 15:39 ` [PATCH 10/24] USB: serial: kobil_sct: fix NULL-deref in write Johan Hovold
2017-01-03 15:39 ` [PATCH 11/24] USB: serial: mos7720: fix NULL-deref at open Johan Hovold
2017-01-03 15:39 ` Johan Hovold [this message]
2017-01-03 15:39 ` [PATCH 13/24] USB: serial: mos7720: fix parport use-after-free on probe errors Johan Hovold
2017-01-03 15:39 ` [PATCH 14/24] USB: serial: mos7720: fix parallel probe Johan Hovold
2017-01-03 15:39 ` [PATCH 16/24] USB: serial: mos7840: fix NULL-deref at open Johan Hovold
2017-01-03 15:39 ` [PATCH 19/24] USB: serial: omninet: fix NULL-derefs at open and disconnect Johan Hovold
2017-01-03 15:39 ` [PATCH 20/24] USB: serial: oti6858: fix NULL-deref at open Johan Hovold
2017-01-03 15:40 ` [PATCH 21/24] USB: serial: pl2303: " Johan Hovold
2017-01-03 15:40 ` [PATCH 22/24] USB: serial: quatech2: fix sleep-while-atomic in close Johan Hovold
2017-01-03 15:40 ` [PATCH 23/24] USB: serial: spcp8x5: fix NULL-deref at open Johan Hovold
2017-01-03 15:40 ` [PATCH 24/24] USB: serial: ti_usb_3410_5052: " Johan Hovold
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=20170103154003.31860-13-johan@kernel.org \
--to=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).