diff options
author | Thomas Pugliese <thomas.pugliese@gmail.com> | 2014-03-04 12:24:56 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-07 15:39:39 -0500 |
commit | 5090ecea133325f762704f00963bca1b024ee691 (patch) | |
tree | d2df02d31eacd3ea3cf1ca3e797c0667934c7a2c /drivers/usb/wusbcore | |
parent | 2a6da97ff530650d26570a6a1ec0ac1deac927bd (diff) |
usb: wusbcore: don't mark WA_SEG_DTI_PENDING segs as done in urb_dequeue
Data for transfer segments in the WA_SEG_DTI_PENDING state is actively
being read by the driver. Let the buffer read callback handle the
transfer cleanup since cleaning it up in wa_urb_dequeue will cause the
read callback to access invalid memory if the transfer is completed.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/wusbcore')
-rw-r--r-- | drivers/usb/wusbcore/wa-xfer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 6e0d377d437c..cf7c95ceebe0 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -2007,6 +2007,16 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb, int status) | |||
2007 | case WA_SEG_ABORTED: | 2007 | case WA_SEG_ABORTED: |
2008 | break; | 2008 | break; |
2009 | /* | 2009 | /* |
2010 | * The buf_in data for a segment in the | ||
2011 | * WA_SEG_DTI_PENDING state is actively being read. | ||
2012 | * Let wa_buf_in_cb handle it since it will be called | ||
2013 | * and will increment xfer->segs_done. Cleaning up | ||
2014 | * here could cause wa_buf_in_cb to access the xfer | ||
2015 | * after it has been completed/freed. | ||
2016 | */ | ||
2017 | case WA_SEG_DTI_PENDING: | ||
2018 | break; | ||
2019 | /* | ||
2010 | * In the states below, the HWA device already knows | 2020 | * In the states below, the HWA device already knows |
2011 | * about the transfer. If an abort request was sent, | 2021 | * about the transfer. If an abort request was sent, |
2012 | * allow the HWA to process it and wait for the | 2022 | * allow the HWA to process it and wait for the |
@@ -2015,7 +2025,6 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb, int status) | |||
2015 | */ | 2025 | */ |
2016 | case WA_SEG_SUBMITTED: | 2026 | case WA_SEG_SUBMITTED: |
2017 | case WA_SEG_PENDING: | 2027 | case WA_SEG_PENDING: |
2018 | case WA_SEG_DTI_PENDING: | ||
2019 | /* | 2028 | /* |
2020 | * Check if the abort was successfully sent. This could | 2029 | * Check if the abort was successfully sent. This could |
2021 | * be false if the HWA has been removed but we haven't | 2030 | * be false if the HWA has been removed but we haven't |