[media] exynos4-is: Add locking at fimc(-lite) subdev unregistered handler
Protect the fimc/fimc-lite video nodes unregistration with their video lock. This prevents a kernel crash when e.g. udev opens a video node right after the driver registers it and then the driver tries to unregister it and defers its probing. Using video_is_unregistered() together with the video mutex allows safe unregistration of the video nodes at any time. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
52917bcbe0
commit
26d63d13da
@@ -1855,6 +1855,8 @@ static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd)
|
||||
if (fimc == NULL)
|
||||
return;
|
||||
|
||||
mutex_lock(&fimc->lock);
|
||||
|
||||
fimc_unregister_m2m_device(fimc);
|
||||
vdev = &fimc->vid_cap.ve.vdev;
|
||||
|
||||
@@ -1866,6 +1868,8 @@ static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd)
|
||||
}
|
||||
kfree(fimc->vid_cap.ctx);
|
||||
fimc->vid_cap.ctx = NULL;
|
||||
|
||||
mutex_unlock(&fimc->lock);
|
||||
}
|
||||
|
||||
static const struct v4l2_subdev_internal_ops fimc_capture_sd_internal_ops = {
|
||||
|
Reference in New Issue
Block a user