aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-10-15 12:07:30 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-22 10:01:31 -0400
commit475d5263114d55eb9024e6ab4b6ea74e28386970 (patch)
tree30625190caaae24933d685c4c6637e67579cf84c /drivers/media
parent3bcc95760c9ee7adb8509173b78914339baa7f4f (diff)
V4L/DVB (6323): V4L: cinergyT2, remove bad usage of ERESTARTSYS
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 'drivers/media')
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index a05e5c182288..db08b0a8888a 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -345,7 +345,9 @@ static int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed)
345 struct dvb_demux *demux = dvbdmxfeed->demux; 345 struct dvb_demux *demux = dvbdmxfeed->demux;
346 struct cinergyt2 *cinergyt2 = demux->priv; 346 struct cinergyt2 *cinergyt2 = demux->priv;
347 347
348 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 348 if (cinergyt2->disconnect_pending)
349 return -EAGAIN;
350 if (mutex_lock_interruptible(&cinergyt2->sem))
349 return -ERESTARTSYS; 351 return -ERESTARTSYS;
350 352
351 if (cinergyt2->streaming == 0) 353 if (cinergyt2->streaming == 0)
@@ -361,7 +363,9 @@ static int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
361 struct dvb_demux *demux = dvbdmxfeed->demux; 363 struct dvb_demux *demux = dvbdmxfeed->demux;
362 struct cinergyt2 *cinergyt2 = demux->priv; 364 struct cinergyt2 *cinergyt2 = demux->priv;
363 365
364 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 366 if (cinergyt2->disconnect_pending)
367 return -EAGAIN;
368 if (mutex_lock_interruptible(&cinergyt2->sem))
365 return -ERESTARTSYS; 369 return -ERESTARTSYS;
366 370
367 if (--cinergyt2->streaming == 0) 371 if (--cinergyt2->streaming == 0)
@@ -481,12 +485,16 @@ static int cinergyt2_open (struct inode *inode, struct file *file)
481{ 485{
482 struct dvb_device *dvbdev = file->private_data; 486 struct dvb_device *dvbdev = file->private_data;
483 struct cinergyt2 *cinergyt2 = dvbdev->priv; 487 struct cinergyt2 *cinergyt2 = dvbdev->priv;
484 int err = -ERESTARTSYS; 488 int err = -EAGAIN;
485 489
486 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) 490 if (cinergyt2->disconnect_pending)
491 goto out;
492 err = mutex_lock_interruptible(&cinergyt2->wq_sem);
493 if (err)
487 goto out; 494 goto out;
488 495
489 if (mutex_lock_interruptible(&cinergyt2->sem)) 496 err = mutex_lock_interruptible(&cinergyt2->sem);
497 if (err)
490 goto out_unlock1; 498 goto out_unlock1;
491 499
492 if ((err = dvb_generic_open(inode, file))) 500 if ((err = dvb_generic_open(inode, file)))
@@ -550,7 +558,9 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct
550 struct cinergyt2 *cinergyt2 = dvbdev->priv; 558 struct cinergyt2 *cinergyt2 = dvbdev->priv;
551 unsigned int mask = 0; 559 unsigned int mask = 0;
552 560
553 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 561 if (cinergyt2->disconnect_pending)
562 return -EAGAIN;
563 if (mutex_lock_interruptible(&cinergyt2->sem))
554 return -ERESTARTSYS; 564 return -ERESTARTSYS;
555 565
556 poll_wait(file, &cinergyt2->poll_wq, wait); 566 poll_wait(file, &cinergyt2->poll_wq, wait);
@@ -625,7 +635,9 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
625 if (copy_from_user(&p, (void __user*) arg, sizeof(p))) 635 if (copy_from_user(&p, (void __user*) arg, sizeof(p)))
626 return -EFAULT; 636 return -EFAULT;
627 637
628 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 638 if (cinergyt2->disconnect_pending)
639 return -EAGAIN;
640 if (mutex_lock_interruptible(&cinergyt2->sem))
629 return -ERESTARTSYS; 641 return -ERESTARTSYS;
630 642
631 param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; 643 param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS;
@@ -996,7 +1008,9 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
996{ 1008{
997 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 1009 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
998 1010
999 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) 1011 if (cinergyt2->disconnect_pending)
1012 return -EAGAIN;
1013 if (mutex_lock_interruptible(&cinergyt2->wq_sem))
1000 return -ERESTARTSYS; 1014 return -ERESTARTSYS;
1001 1015
1002 cinergyt2_suspend_rc(cinergyt2); 1016 cinergyt2_suspend_rc(cinergyt2);
@@ -1017,16 +1031,18 @@ static int cinergyt2_resume (struct usb_interface *intf)
1017{ 1031{
1018 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 1032 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
1019 struct dvbt_set_parameters_msg *param = &cinergyt2->param; 1033 struct dvbt_set_parameters_msg *param = &cinergyt2->param;
1020 int err = -ERESTARTSYS; 1034 int err = -EAGAIN;
1021 1035
1022 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) 1036 if (cinergyt2->disconnect_pending)
1037 goto out;
1038 err = mutex_lock_interruptible(&cinergyt2->wq_sem);
1039 if (err)
1023 goto out; 1040 goto out;
1024 1041
1025 if (mutex_lock_interruptible(&cinergyt2->sem)) 1042 err = mutex_lock_interruptible(&cinergyt2->sem);
1043 if (err)
1026 goto out_unlock1; 1044 goto out_unlock1;
1027 1045
1028 err = 0;
1029
1030 if (!cinergyt2->sleeping) { 1046 if (!cinergyt2->sleeping) {
1031 cinergyt2_sleep(cinergyt2, 0); 1047 cinergyt2_sleep(cinergyt2, 0);
1032 cinergyt2_command(cinergyt2, (char *) param, sizeof(*param), NULL, 0); 1048 cinergyt2_command(cinergyt2, (char *) param, sizeof(*param), NULL, 0);