V4L/DVB: DVB: fix dvr node refcounting
authorJiri Slaby <jslaby@suse.cz>
Sun, 18 Jul 2010 18:34:18 +0000 (15:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 2 Aug 2010 19:43:16 +0000 (16:43 -0300)
In dvb_dvr_release, there is a test dvbdev->users==-1, but users are
never negative. This error results in hung tasks:
  task                        PC stack   pid father
bash          D ffffffffa000c948     0  3264   3170 0x00000000
 ffff88003aec5ce8 0000000000000086 0000000000011f80 0000000000011f80
 ffff88003aec5fd8 ffff88003aec5fd8 ffff88003b848670 0000000000011f80
 ffff88003aec5fd8 0000000000011f80 ffff88003e02a030 ffff88003b848670
Call Trace:
 [<ffffffff813dd4a5>] dvb_dmxdev_release+0xc5/0x130
 [<ffffffff8107b750>] ? autoremove_wake_function+0x0/0x40
 [<ffffffffa00013a2>] dvb_usb_adapter_dvb_exit+0x42/0x70 [dvb_usb]
 [<ffffffffa0000525>] dvb_usb_exit+0x55/0xd0 [dvb_usb]
 [<ffffffffa00005ee>] dvb_usb_device_exit+0x4e/0x70 [dvb_usb]
 [<ffffffffa000a065>] af9015_usb_device_exit+0x55/0x60 [dvb_usb_af9015]
 [<ffffffff813a3f05>] usb_unbind_interface+0x55/0x1a0
 [<ffffffff81316000>] __device_release_driver+0x70/0xe0
...

So check against 1 there instead.

BTW why's the TODO there? Adding TODOs to the code without
descriptions is like adding nothing.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-core/dmxdev.c

index 425862f..0042306 100644 (file)
@@ -207,7 +207,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file)
        }
        /* TODO */
        dvbdev->users--;
-       if(dvbdev->users==-1 && dmxdev->exit==1) {
+       if (dvbdev->users == 1 && dmxdev->exit == 1) {
                fops_put(file->f_op);
                file->f_op = NULL;
                mutex_unlock(&dmxdev->mutex);