提交 9c84d89b 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

[media] radio-mr800: fix locking order

Don't hold the lock before unregistering the device, since when the
device is unregistered the datastruct containing the lock may be freed
(if the refcount went to 0).

Also fixed the framework documentation that erroneously suggested the
wrong locking order as well.
Reported-by: NDavid Ellingsworth <david@identd.dyndns.org>
Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Acked-by: NDavid Ellingsworth <david@identd.dyndns.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 1cd72781
......@@ -488,7 +488,7 @@ also waits in the code, then you should do the same to allow other processes
to access the device node while the first process is waiting for something.
The implementation of a hotplug disconnect should also take the lock before
calling v4l2_device_disconnect and video_unregister_device.
calling v4l2_device_disconnect.
video_device registration
-------------------------
......
......@@ -285,8 +285,8 @@ static void usb_amradio_disconnect(struct usb_interface *intf)
mutex_lock(&radio->lock);
v4l2_device_disconnect(&radio->v4l2_dev);
video_unregister_device(&radio->videodev);
mutex_unlock(&radio->lock);
video_unregister_device(&radio->videodev);
}
/* vidioc_querycap - query device capabilities */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册