aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2013-08-15 15:37:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-15 20:36:27 -0400
commit11b1bf81bf68cab0ad7d7d4d08dbfb236d5cbcaa (patch)
tree1125edc4b5686b73d74d276e2973d85c71b996b0 /drivers/usb/wusbcore
parent6d33f7bb8c3863e54f8bdede0a2bf97a3585ac20 (diff)
USB: WUSBCORE: fix resource cleanup in error path in __wa_xfer_setup_segs
Use usb_free_urb instead of kfree in error path and point to the correct URB. Also remember to clean up the sg list for the URB if it was allocated. 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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index d74fe1ae16ac..75a2bea62102 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -804,15 +804,17 @@ static int __wa_xfer_setup_segs(struct wa_xfer *xfer, size_t xfer_hdr_size)
804 return 0; 804 return 0;
805 805
806error_sg_alloc: 806error_sg_alloc:
807 kfree(seg->dto_urb); 807 usb_free_urb(xfer->seg[cnt]->dto_urb);
808error_dto_alloc: 808error_dto_alloc:
809 kfree(xfer->seg[cnt]); 809 kfree(xfer->seg[cnt]);
810 cnt--; 810 cnt--;
811error_seg_kzalloc: 811error_seg_kzalloc:
812 /* use the fact that cnt is left at were it failed */ 812 /* use the fact that cnt is left at were it failed */
813 for (; cnt >= 0; cnt--) { 813 for (; cnt >= 0; cnt--) {
814 if (xfer->seg[cnt] && xfer->is_inbound == 0) 814 if (xfer->seg[cnt] && xfer->is_inbound == 0) {
815 usb_free_urb(xfer->seg[cnt]->dto_urb); 815 usb_free_urb(xfer->seg[cnt]->dto_urb);
816 kfree(xfer->seg[cnt]->dto_urb->sg);
817 }
816 kfree(xfer->seg[cnt]); 818 kfree(xfer->seg[cnt]);
817 } 819 }
818error_segs_kzalloc: 820error_segs_kzalloc: