linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manu Gautam <mgautam@codeaurora.org>
To: Felipe Balbi <balbi@kernel.org>
Cc: linux-usb@vger.kernel.org, Manu Gautam <mgautam@codeaurora.org>
Subject: usb: gadget: core: Fix use-after-free of usb_request
Date: Thu, 21 Dec 2017 09:54:25 +0530	[thread overview]
Message-ID: <1513830265-9006-1-git-send-email-mgautam@codeaurora.org> (raw)

Driver is tracing usb_request after freeing it.
Fix it by changing the order.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
---
 drivers/usb/gadget/udc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index d41d07a..ab0a075 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -191,8 +191,8 @@ struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
 void usb_ep_free_request(struct usb_ep *ep,
 				       struct usb_request *req)
 {
-	ep->ops->free_request(ep, req);
 	trace_usb_ep_free_request(ep, req, 0);
+	ep->ops->free_request(ep, req);
 }
 EXPORT_SYMBOL_GPL(usb_ep_free_request);
 

             reply	other threads:[~2017-12-21  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  4:24 Manu Gautam [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-31  5:25 usb: gadget: core: Fix use-after-free of usb_request Manu Gautam

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=1513830265-9006-1-git-send-email-mgautam@codeaurora.org \
    --to=mgautam@codeaurora.org \
    --cc=balbi@kernel.org \
    --cc=linux-usb@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).