From 1c488ea9d52032d07dd320d31e0720239c93dd64 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Sun, 18 Jul 2010 15:34:18 -0300 Subject: [PATCH] V4L/DVB: DVB: fix dvr node refcounting 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: [] dvb_dmxdev_release+0xc5/0x130 [] ? autoremove_wake_function+0x0/0x40 [] dvb_usb_adapter_dvb_exit+0x42/0x70 [dvb_usb] [] dvb_usb_exit+0x55/0xd0 [dvb_usb] [] dvb_usb_device_exit+0x4e/0x70 [dvb_usb] [] af9015_usb_device_exit+0x55/0x60 [dvb_usb_af9015] [] usb_unbind_interface+0x55/0x1a0 [] __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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dmxdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 425862ffb285..0042306ea11b 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c @@ -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); -- GitLab