mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-08-18 11:19:28 +00:00
usb: dwc2: Fix use after free in debug code
commit 9ea06a3fbf9f16e0d98c52cb3b99642be15ec281 upstream.
We're not allowed to dereference "urb" after calling
usb_hcd_giveback_urb() so save the urb->status ahead of time.
Fixes: 7359d482eb ("staging: HCD files for the DWC2 driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://patch.msgid.link/ag1NwBpqT4IEQcdJ@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
This commit is contained in:
committed by
Ulrich Hecht
parent
3bb3bfc137
commit
c71e074940
@ -4880,6 +4880,7 @@ static int _dwc2_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
|
||||
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
|
||||
int rc;
|
||||
unsigned long flags;
|
||||
int urb_status;
|
||||
|
||||
dev_dbg(hsotg->dev, "DWC OTG HCD URB Dequeue\n");
|
||||
dwc2_dump_urb_info(hcd, urb, "urb_dequeue");
|
||||
@ -4904,11 +4905,12 @@ static int _dwc2_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
|
||||
|
||||
/* Higher layer software sets URB status */
|
||||
spin_unlock(&hsotg->lock);
|
||||
urb_status = urb->status;
|
||||
usb_hcd_giveback_urb(hcd, urb, status);
|
||||
spin_lock(&hsotg->lock);
|
||||
|
||||
dev_dbg(hsotg->dev, "Called usb_hcd_giveback_urb()\n");
|
||||
dev_dbg(hsotg->dev, " urb->status = %d\n", urb->status);
|
||||
dev_dbg(hsotg->dev, " urb->status = %d\n", urb_status);
|
||||
out:
|
||||
spin_unlock_irqrestore(&hsotg->lock, flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user