[DVB patch 03/51] core: fix race condition in FE_READ_STATUS ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Beutner <[email protected]>

Fix a race condition where an application which issued a FE_READ_STATUS
ioctl directly after FE_SET_FRONTEND would see an old status, i.e.
FE_READ_STATUS would be executed before the frontend thread
has even seen the tungin request from FE_SET_FRONTEND.

Signed-off-by: Peter Beutner <[email protected]>
Signed-off-by: Johannes Stezenbach <[email protected]>

 drivers/media/dvb/dvb-core/dvb_frontend.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

Index: linux-2.6.12-git8/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
--- linux-2.6.12-git8.orig/drivers/media/dvb/dvb-core/dvb_frontend.c	2005-06-27 13:18:22.000000000 +0200
+++ linux-2.6.12-git8/drivers/media/dvb/dvb-core/dvb_frontend.c	2005-06-27 13:22:55.000000000 +0200
@@ -626,11 +626,21 @@ static int dvb_frontend_ioctl(struct ino
 		break;
 	}
 
-	case FE_READ_STATUS:
+	case FE_READ_STATUS: {
+		fe_status_t* status = parg;
+
+		/* if retune was requested but hasn't occured yet, prevent
+		 * that user get signal state from previous tuning */
+		if(fepriv->state == FESTATE_RETUNE) {
+			err=0;
+			*status = 0;
+			break;
+		}
+
 		if (fe->ops->read_status)
-			err = fe->ops->read_status(fe, (fe_status_t*) parg);
+			err = fe->ops->read_status(fe, status);
 		break;
-
+	}
 	case FE_READ_BER:
 		if (fe->ops->read_ber)
 			err = fe->ops->read_ber(fe, (__u32*) parg);

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux