Re: [PATCH 4/5] usb:Push BKL on open down into the drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Neukum wrote:
> From 271f10a4643c788be08cc481dc594ee87af25140 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oliver@xxxxxxxxxx>
> Date: Wed, 13 Jan 2010 14:46:08 +0100
> Subject: [PATCH 4/5] usb:Push BKL on open down into the drivers
> 
> Straightforward push into the drivers to allow
> auditing individual drivers separately
> 
> Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>

> diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c
> index ee43876..3f3d39b 100644
> --- a/drivers/media/video/dabusb.c
> +++ b/drivers/media/video/dabusb.c
> @@ -616,10 +616,12 @@ static int dabusb_open (struct inode *inode, struct file *file)
>  {
>  	int devnum = iminor(inode);
>  	pdabusb_t s;
> +	int r;
>  
>  	if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
>  		return -EIO;
>  
> +	lock_kernel();
>  	s = &dabusb[devnum - DABUSB_MINOR];
>  
>  	dbg("dabusb_open");
> @@ -634,6 +636,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
>  		msleep_interruptible(500);
>  
>  		if (signal_pending (current)) {
> +			unlock_kernel();
>  			return -EAGAIN;
>  		}
>  		mutex_lock(&s->mutex);
> @@ -641,6 +644,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
>  	if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
>  		mutex_unlock(&s->mutex);
>  		dev_err(&s->usbdev->dev, "set_interface failed\n");
> +		unlock_kernel();
>  		return -EINVAL;
>  	}
>  	s->opened = 1;
> @@ -649,7 +653,9 @@ static int dabusb_open (struct inode *inode, struct file *file)
>  	file->f_pos = 0;
>  	file->private_data = s;
>  
> -	return nonseekable_open(inode, file);
> +	r = nonseekable_open(inode, file);
> +	unlock_kernel();
> +	return r;
>  }
>  
>  static int dabusb_release (struct inode *inode, struct file *file)

With respect to media changes (dabusb), they seem ok to me.

Acked-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

Yet, this driver is not being actively maintained, so we're just transferring
the problem to be handled later inside the driver. 

The better is if you could later submit a patch transforming BKL into a mutex there.

Cheers,
Mauro.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux