diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-03-22 19:00:21 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-07 00:54:00 +0400 |
commit | bcf398537630bf20b4dbe59ba855b69f404c93cf (patch) | |
tree | 0f44291e1cb72c146ed7187e6b476cedb6ad7d74 /Documentation/usb | |
parent | c825bab0cef8b90bab8b63eb5686b8c8eb22e798 (diff) | |
download | linux-bcf398537630bf20b4dbe59ba855b69f404c93cf.tar.xz |
USB: don't clear urb->dev in scatter-gather library
This patch (as1517b) fixes an error in the USB scatter-gather library.
The library code uses urb->dev to determine whether or nor an URB is
currently active; the completion handler sets urb->dev to NULL.
However the core unlinking routines need to use urb->dev. Since
unlinking always racing with completion, the completion handler must
not clear urb->dev -- it can lead to invalid memory accesses when a
transfer has to be cancelled.
This patch fixes the problem by getting rid of the lines that clear
urb->dev after urb has been submitted. As a result we may end up
trying to unlink an URB that failed in submission or that has already
completed, so an extra check is added after each unlink to avoid
printing an error message when this happens. The checks are updated
in both sg_complete() and sg_cancel(), and the second is updated to
match the first (currently it prints out unnecessary warning messages
if a device is unplugged while a transfer is in progress).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Illia Zaitsev <I.Zaitsev@adbglobal.com>
CC: Ming Lei <tom.leiming@gmail.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/usb')
0 files changed, 0 insertions, 0 deletions