USB: fix linked-list corruption in rh_call_control()
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 24 Mar 2017 17:38:28 +0000 (13:38 -0400)
committerJiri Slaby <jslaby@suse.cz>
Mon, 10 Apr 2017 12:21:31 +0000 (14:21 +0200)
commitf8f0b4202206714c4c748a46b792dfc3e17324ca
treee0537190a7a087f1c78cd47fc505a43d4bf0ad52
parent5178151bd9f4fdcb80a9dbaa55644e95ee83a864
USB: fix linked-list corruption in rh_call_control()

commit 1633682053a7ee8058e10c76722b9b28e97fb73f upstream.

Using KASAN, Dmitry found a bug in the rh_call_control() routine: If
buffer allocation fails, the routine returns immediately without
unlinking its URB from the control endpoint, eventually leading to
linked-list corruption.

This patch fixes the problem by jumping to the end of the routine
(where the URB is unlinked) when an allocation failure occurs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/usb/core/hcd.c