瀏覽代碼

usb: wusbcore: set pointers to NULL after freeing in error cases

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>
Thomas Pugliese 12 年之前
父節點
當前提交
6741448eb0
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/usb/wusbcore/wa-xfer.c

+ 2 - 0
drivers/usb/wusbcore/wa-xfer.c

@@ -1560,6 +1560,7 @@ error_submit_buf_in:
 			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:
@@ -1859,6 +1860,7 @@ out:
 
 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;