1
linux/drivers/media/radio
iceberg 2b97e2201e [media] double mutex lock in drivers/media/radio/si470x/radio-si470x-
KERNEL_VERSION: 2.6.37
common.c in function ssize_t si470x_fops_read.

1. First mutex_lock on &radio->lock in line 441
2. Second in line 462

I think that mutex in line 462 is not needed.

 433static ssize_t si470x_fops_read(struct file *file, char __user *buf,
 434                size_t count, loff_t *ppos)
 435{
....
 441        mutex_lock(&radio->lock);
 442        if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
 443                si470x_rds_on(radio);
 444
 445        /* block if no new data available */
 446        while (radio->wr_index == radio->rd_index) {
 447                if (file->f_flags & O_NONBLOCK) {
 448                        retval = -EWOULDBLOCK;
 449                        goto done;
 450                }
 451                if (wait_event_interruptible(radio->read_queue,
 452                        radio->wr_index != radio->rd_index) < 0) {
 453                        retval = -EINTR;
 454                        goto done;
 455                }
 456        }
 457
 458        /* calculate block count from byte count */
 459        count /= 3;
 460
 461        /* copy RDS block out of internal buffer and to user buffer */
 462        mutex_lock(&radio->lock);

Found by Linux Device Drivers Verification Project

Remove second mutex.

Signed-off-by: Alexander Strakh <strakh@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21 20:31:56 -03:00
..
si470x [media] double mutex lock in drivers/media/radio/si470x/radio-si470x- 2011-03-21 20:31:56 -03:00
dsbr100.c
Kconfig [media] radio-gemtek-pci: remove duplicate driver 2011-01-19 11:28:23 -02:00
Makefile [media] radio-gemtek-pci: remove duplicate driver 2011-01-19 11:28:23 -02:00
radio-aimslab.c [media] radio-aimslab.c needs #include <linux/delay.h> 2011-01-19 11:45:57 -02:00
radio-aztech.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-cadet.c [media] cadet: use unlocked_ioctl 2010-12-01 20:10:06 -02:00
radio-gemtek.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-maestro.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-maxiradio.c [media] radio-maxiradio.c: use sensible frequency range 2011-01-19 11:28:22 -02:00
radio-miropcm20.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-mr800.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
radio-rtrack2.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-sf16fmi.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-sf16fmr2.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-si4713.c Merge branch 'bkl_removal' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2010-12-17 09:28:17 -08:00
radio-tea5764.c [media] tea5764: convert to unlocked_ioctl 2010-12-01 20:10:07 -02:00
radio-terratec.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-timb.c [media] radio-timb: convert to unlocked_ioctl 2010-12-01 20:10:15 -02:00
radio-trust.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
radio-typhoon.c [media] typhoon: convert to unlocked_ioctl 2010-12-01 20:10:09 -02:00
radio-wl1273.c [media] V4L2: WL1273 FM Radio: Replace ioctl with unlocked_ioctl 2011-01-19 11:45:47 -02:00
radio-zoltrix.c [media] BKL: trivial BKL removal from V4L2 radio drivers 2010-12-01 20:10:05 -02:00
saa7706h.c
si4713-i2c.c [media] radio-si4713: Add regulator framework support 2010-12-29 08:16:35 -02:00
si4713-i2c.h [media] radio-si4713: Add regulator framework support 2010-12-29 08:16:35 -02:00
tef6862.c V4L/DVB: v4l: remove unused i2c-id.h headers 2010-10-21 01:06:05 -02:00