]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: fix use-after-free bug in usb_hcd_unlink_urb()
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 30 Jan 2015 17:58:26 +0000 (12:58 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:57:34 +0000 (14:57 -0800)
commit07cc714778101a93ea971dd9d01a1bff8f00dc94
treebbf09aa8431f4daa54ff454b1e1836079365e49a
parent19e554a1b79597a9780fc7d273927d89852a3667
USB: fix use-after-free bug in usb_hcd_unlink_urb()

commit c99197902da284b4b723451c1471c45b18537cde upstream.

The usb_hcd_unlink_urb() routine in hcd.c contains two possible
use-after-free errors.  The dev_dbg() statement at the end of the
routine dereferences urb and urb->dev even though both structures may
have been deallocated.

This patch fixes the problem by storing urb->dev in a local variable
(avoiding the dereference of urb) and moving the dev_dbg() up before
the usb_put_dev() call.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c