From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: stable@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH 3/8] USB: serial: keyspan: fix use-after-free in probe error path
Date: Sun, 8 May 2016 20:07:58 +0200 [thread overview]
Message-ID: <1462730883-9025-4-git-send-email-johan@kernel.org> (raw)
In-Reply-To: <1462730883-9025-1-git-send-email-johan@kernel.org>
The interface instat and indat URBs were submitted in attach, but never
unlinked in release before deallocating the corresponding transfer
buffers.
In the case of a late probe error (e.g. due to failed minor allocation),
disconnect would not have been called before release, causing the
buffers to be freed while the URBs are still in use. We'd also end up
with active URBs for an unbound interface.
Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
release")
Cc: stable <stable@vger.kernel.org> # v2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/keyspan.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index b6bd8e4a6486..1cf05883f48c 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2376,6 +2376,10 @@ static void keyspan_release(struct usb_serial *serial)
s_priv = usb_get_serial_data(serial);
+ /* Make sure to unlink the URBs submitted in attach. */
+ usb_kill_urb(s_priv->instat_urb);
+ usb_kill_urb(s_priv->indat_urb);
+
usb_free_urb(s_priv->instat_urb);
usb_free_urb(s_priv->indat_urb);
usb_free_urb(s_priv->glocont_urb);
--
2.7.3
next prev parent reply other threads:[~2016-05-08 18:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 18:07 [PATCH 0/8] USB: serial: fix interface URB leaks and use-after-free Johan Hovold
2016-05-08 18:07 ` [PATCH 1/8] USB: serial: io_edgeport: fix memory leaks in attach error path Johan Hovold
2016-05-08 18:07 ` [PATCH 2/8] USB: serial: io_edgeport: fix memory leaks in probe " Johan Hovold
2016-05-08 18:07 ` Johan Hovold [this message]
2016-05-08 18:07 ` [PATCH 4/8] USB: serial: keyspan: fix URB unlink Johan Hovold
2016-05-08 18:08 ` [PATCH 5/8] USB: serial: keyspan: fix debug and error messages Johan Hovold
2016-05-08 18:08 ` [PATCH 6/8] USB: serial: mxuport: fix use-after-free in probe error path Johan Hovold
2016-05-08 18:08 ` [PATCH 7/8] USB: serial: quatech2: " Johan Hovold
2016-05-08 18:08 ` [PATCH 8/8] USB: serial: fix minor-number allocation Johan Hovold
2016-05-09 5:26 ` Greg KH
2016-05-10 7:45 ` 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=1462730883-9025-4-git-send-email-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).