diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-15 14:07:30 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-15 14:07:30 -0200 |
commit | 43c6bf56f71301d6a4f3ae79ffb91f309a65d91d (patch) | |
tree | a56a175ab8131486b1bb07de474f18df42d0eef9 /linux/drivers/media/dvb/cinergyT2/cinergyT2.c | |
parent | d64d374f003ecd32b679f723dc53caabbebcee89 (diff) | |
download | mediapointer-dvb-s2-43c6bf56f71301d6a4f3ae79ffb91f309a65d91d.tar.gz mediapointer-dvb-s2-43c6bf56f71301d6a4f3ae79ffb91f309a65d91d.tar.bz2 |
V4L: cinergyT2, remove bad usage of ERESTARTSYS
From: Jiri Slaby <jirislaby@gmail.com>
cinergyT2, remove bad usage of ERESTARTSYS
test of cinergyt2->disconnect_pending doesn't ensure pending signal and so
ERESTARTSYS would reach userspace, which is not permitted. Change it to
EAGAIN
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/dvb/cinergyT2/cinergyT2.c')
-rw-r--r-- | linux/drivers/media/dvb/cinergyT2/cinergyT2.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c index f2977f237..455e50cee 100644 --- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -379,7 +379,9 @@ static int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed) struct dvb_demux *demux = dvbdmxfeed->demux; struct cinergyt2 *cinergyt2 = demux->priv; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; if (cinergyt2->streaming == 0) @@ -395,7 +397,9 @@ static int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed) struct dvb_demux *demux = dvbdmxfeed->demux; struct cinergyt2 *cinergyt2 = demux->priv; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; if (--cinergyt2->streaming == 0) @@ -515,12 +519,16 @@ static int cinergyt2_open (struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; struct cinergyt2 *cinergyt2 = dvbdev->priv; - int err = -ERESTARTSYS; + int err = -EAGAIN; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + goto out; + err = mutex_lock_interruptible(&cinergyt2->wq_sem); + if (err) goto out; - if (mutex_lock_interruptible(&cinergyt2->sem)) + err = mutex_lock_interruptible(&cinergyt2->sem); + if (err) goto out_unlock1; if ((err = dvb_generic_open(inode, file))) @@ -584,7 +592,9 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct struct cinergyt2 *cinergyt2 = dvbdev->priv; unsigned int mask = 0; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; poll_wait(file, &cinergyt2->poll_wq, wait); @@ -659,7 +669,9 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file, if (copy_from_user(&p, (void __user*) arg, sizeof(p))) return -EFAULT; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; @@ -1062,7 +1074,9 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->wq_sem)) return -ERESTARTSYS; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) @@ -1089,16 +1103,18 @@ static int cinergyt2_resume (struct usb_interface *intf) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); struct dvbt_set_parameters_msg *param = &cinergyt2->param; - int err = -ERESTARTSYS; + int err = -EAGAIN; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + goto out; + err = mutex_lock_interruptible(&cinergyt2->wq_sem); + if (err) goto out; - if (mutex_lock_interruptible(&cinergyt2->sem)) + err = mutex_lock_interruptible(&cinergyt2->sem); + if (err) goto out_unlock1; - err = 0; - if (!cinergyt2->sleeping) { cinergyt2_sleep(cinergyt2, 0); cinergyt2_command(cinergyt2, (char *) param, sizeof(*param), NULL, 0); |