tree 472bad3348464fa74910d6ac8978b6a63cb01a35
parent 25a26ec3b60b29300a652d7d81a69b6bc08b35b5
author Peter Beutner <[EMAIL PROTECTED]> Fri, 08 Jul 2005 07:57:36 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 08 Jul 2005 08:23:53 -0700

[PATCH] dvb: core: fix race condition in FE_READ_STATUS ioctl

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]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

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

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -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 bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to