diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-02-01 07:53:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-06 14:38:14 -0500 |
commit | f07af4b630d52fb911574031ed7feb9252e65f24 (patch) | |
tree | e7ca5961f68f949bef0dbaa2d3339dc04cba672b /drivers/usb/wusbcore | |
parent | 4d2079c190558dfa9b766a90a34cb30b8d49c8eb (diff) |
USB: wusbcore/wa-xfer: error handling fixes in setup_segs()
1) It didn't free xfer->seg[0] so there was a leak.
2) xfer->seg[cnt] can be NULL.
3) Use usb_free_urb() for ->dto_urb instead of kfree().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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 | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 57c01ab09ad8..6ef94bce8c0d 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -695,9 +695,9 @@ error_dto_alloc: | |||
695 | cnt--; | 695 | cnt--; |
696 | error_seg_kzalloc: | 696 | error_seg_kzalloc: |
697 | /* use the fact that cnt is left at were it failed */ | 697 | /* use the fact that cnt is left at were it failed */ |
698 | for (; cnt > 0; cnt--) { | 698 | for (; cnt >= 0; cnt--) { |
699 | if (xfer->is_inbound == 0) | 699 | if (xfer->seg[cnt] && xfer->is_inbound == 0) |
700 | kfree(xfer->seg[cnt]->dto_urb); | 700 | usb_free_urb(xfer->seg[cnt]->dto_urb); |
701 | kfree(xfer->seg[cnt]); | 701 | kfree(xfer->seg[cnt]); |
702 | } | 702 | } |
703 | error_segs_kzalloc: | 703 | error_segs_kzalloc: |