]> git.baikalelectronics.ru Git - kernel.git/commit
media: uvcvideo: Fix driver reference counting
authorPhilipp Zabel <philipp.zabel@gmail.com>
Mon, 21 May 2018 10:24:58 +0000 (06:24 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 28 May 2018 20:49:47 +0000 (16:49 -0400)
commit796d26cc5a0c5ae03003fa543a62f27e389853ed
tree3056d7b1b874e007d756dd264691faba460530f1
parent6d86a939aa56294c739de84bffbb0a9e6e86c8cb
media: uvcvideo: Fix driver reference counting

kref_init initializes the reference count to 1, not 0. This additional
reference is never released since the conversion to reference counters.
As a result, uvc_delete is not called anymore when UVC cameras are
disconnected.
Fix this by adding an additional kref_put in uvc_disconnect and in the
probe error path. This also allows to remove the temporary additional
reference in uvc_unregister_video.

Fixes: 093fe334e2d4 ("media: uvcvideo: Convert from using an atomic variable to a reference count")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/uvc/uvc_driver.c