• Mike Isely's avatar
    V4L: pvrusb2: Solve mutex deadlock · 7c34f701
    Mike Isely authored
    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: default avatarMike Isely <isely@pobox.com>
    Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    7c34f701
pvrusb2-v4l2.c 24 KB