summaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2013-08-15 14:37:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-15 17:36:27 -0700
commit79731cbd783d3693d4b84731e3cfc79b9f828170 (patch)
treefbddbce062055bdc3d02d5d1c8bd9db294c02ead /drivers/usb/wusbcore
parent11b1bf81bf68cab0ad7d7d4d08dbfb236d5cbcaa (diff)
downloadlinux-79731cbd783d3693d4b84731e3cfc79b9f828170.tar.gz
linux-79731cbd783d3693d4b84731e3cfc79b9f828170.tar.bz2
linux-79731cbd783d3693d4b84731e3cfc79b9f828170.zip
USB: WUSBCORE: fix leak of urb in wa_xfer_destroy.
The check to free the URB was the opposite of the correct case. This patch removes the check altogether since the ptr will be NULL if the URB was not allocated. Also use usb_free_urb instead of usb_put_urb. 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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 75a2bea62102..956aab51cbda 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -166,8 +166,8 @@ static inline void wa_xfer_init(struct wa_xfer *xfer)
/*
* Destroy a transfer structure
*
- * Note that the xfer->seg[index] thingies follow the URB life cycle,
- * so we need to put them, not free them.
+ * Note that freeing xfer->seg[cnt]->urb will free the containing
+ * xfer->seg[cnt] memory that was allocated by __wa_xfer_setup_segs.
*/
static void wa_xfer_destroy(struct kref *_xfer)
{
@@ -175,9 +175,8 @@ static void wa_xfer_destroy(struct kref *_xfer)
if (xfer->seg) {
unsigned cnt;
for (cnt = 0; cnt < xfer->segs; cnt++) {
- if (xfer->is_inbound)
- usb_put_urb(xfer->seg[cnt]->dto_urb);
- usb_put_urb(&xfer->seg[cnt]->urb);
+ usb_free_urb(xfer->seg[cnt]->dto_urb);
+ usb_free_urb(&xfer->seg[cnt]->urb);
}
}
kfree(xfer);