V4L: pvrusb2: Solve mutex deadlock
commit7c34f70100b3114253c2141fcf4e8caac06e01a6
authorMike Isely <isely@pobox.com>
Sun, 8 Oct 2006 18:42:08 +0000 (8 14:42 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Oct 2006 20:23:21 +0000 (13 13:23 -0700)
treedb73d132e96388bf1c0d7e718453c89b53e4decd
parent17983c7efc5a1e2deace277ade4ac9933c0db68f
V4L: pvrusb2: Solve mutex deadlock

There is a mutex ordering problem between the pvrusb2 driver and the
v4l core.  Two different pathways take mutexes in opposing orders and
this (under rare circumstances) can cause a deadlock.  The two mutexes
in question are videodev_lock in the v4l core and device_lock inside
the pvrusb2 driver.  The device_lock instance in the driver protects a
private global array of context pointers which had been implemented in
advance of v4l core changes which eliminate the video_set_drvdata()
and video_get_drvdata() functions.

This patch restores the use of video_get_drvdata() and
video_set_drvdata(), eliminating the need for the array and the mutex.
(This is actually a patch to restore the previous implementation.)  We
can do this for 2.6.18 since those functions are in fact still
present.  A better (and larger) solution will be done for later
kernels.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/media/video/pvrusb2/pvrusb2-v4l2.c