Skip to content

Commit

Permalink
videodev: BKL pushdown
Browse files Browse the repository at this point in the history
Put explicit lock_kernel() calls into videodev_open().  That function
itself seems OK, but one never knows about all the open() functions
provided by underlying video drivers.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent b5b4aa6 commit 6606470
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/video/videodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/system.h>

Expand Down Expand Up @@ -496,6 +497,7 @@ static int video_open(struct inode *inode, struct file *file)

if(minor>=VIDEO_NUM_DEVICES)
return -ENODEV;
lock_kernel();
mutex_lock(&videodev_lock);
vfl=video_device[minor];
if(vfl==NULL) {
Expand All @@ -505,6 +507,7 @@ static int video_open(struct inode *inode, struct file *file)
vfl=video_device[minor];
if (vfl==NULL) {
mutex_unlock(&videodev_lock);
unlock_kernel();
return -ENODEV;
}
}
Expand All @@ -518,6 +521,7 @@ static int video_open(struct inode *inode, struct file *file)
}
fops_put(old_fops);
mutex_unlock(&videodev_lock);
unlock_kernel();
return err;
}

Expand Down

0 comments on commit 6606470

Please sign in to comment.