From 09cd5f28c1bcb6cfae3af6b83c0cb56b6773306e Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Mon, 6 Jun 2005 17:51:27 +0000 Subject: Fix a race condition where an application which issued FE_READ_STATUS 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 --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index d6b7a9de4..1439346a5 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -627,11 +627,21 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, 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); -- cgit v1.2.3