[media] uvcvideo: fix null pointer dereference
Henry Lin [Wed, 23 Nov 2016 11:51:34 +0000 (19:51 +0800)]
stream->urb_num needs to set to 0 while freeing urbs to avoid null
pointer dereference afterwards.

Bug 200237870

Change-Id: Ib26f7b23f34db049790e7a5b31a8bde181b74d99
Signed-off-by: Henry Lin <henryl@nvidia.com>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/1258903
(cherry picked from commit 5531411014e4b1239a597a1511c736d1bfb31cb0)
Reviewed-on: http://git-master/r/1281107
GVS: Gerrit_Virtual_Submit

drivers/media/usb/uvc/uvc_video.c

index a91753e..f5234f8 100644 (file)
@@ -1346,6 +1346,7 @@ static void uvc_free_urbs(struct uvc_streaming *stream)
        kfree(stream->urb_dma);
 
        stream->urb = NULL;
+       stream->urb_num = 0;
        stream->urb_buffer = NULL;
        stream->urb_dma = NULL;
 }