Skip to content

Commit

Permalink
usb: wusbcore: set pointers to NULL after freeing in error cases
Browse files Browse the repository at this point in the history
This patch fixes two cases where error handling code was freeing memory
but not setting the pointer to NULL.  This could lead to a double free
in the HWA shutdown code.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Thomas Pugliese authored and Greg Kroah-Hartman committed Sep 26, 2013
1 parent d5b5c9f commit 6741448
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/wusbcore/wa-xfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,7 @@ static void wa_xfer_result_chew(struct wahc *wa, struct wa_xfer *xfer,
xfer, seg_idx, result);
seg->result = result;
kfree(wa->buf_in_urb->sg);
wa->buf_in_urb->sg = NULL;
error_sg_alloc:
__wa_xfer_abort(xfer);
error_complete:
Expand Down Expand Up @@ -1859,6 +1860,7 @@ void wa_handle_notif_xfer(struct wahc *wa, struct wa_notif_hdr *notif_hdr)

error_dti_urb_submit:
usb_put_urb(wa->buf_in_urb);
wa->buf_in_urb = NULL;
error_buf_in_urb_alloc:
usb_put_urb(wa->dti_urb);
wa->dti_urb = NULL;
Expand Down

0 comments on commit 6741448

Please sign in to comment.