Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=baff6cdd3328e7b35c4e155d79105621812bceec
Commit:     baff6cdd3328e7b35c4e155d79105621812bceec
Parent:     40ae91a758df916d7a5640fb2de20537ef7849fd
Author:     Ricardo Cerqueira <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 13 22:41:15 2008 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Mon Feb 18 12:18:08 2008 -0300

    V4L/DVB (7201): cx88-mpeg: Fix race condition in variable access
    
    There was a possible race condition in the increment/decrement of
    the active device references counter.
    Thanks to Trent Piepho ([EMAIL PROTECTED]) for bringing it up.
    
    Signed-off-by: Ricardo Cerqueira <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/cx88/cx88-mpeg.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/cx88/cx88-mpeg.c 
b/drivers/media/video/cx88/cx88-mpeg.c
index f12733d..e357f41 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -615,8 +615,8 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
 
        if (drv->advise_acquire)
        {
-               core->active_ref++;
                mutex_lock(&drv->core->lock);
+               core->active_ref++;
                if (core->active_type_id == CX88_BOARD_NONE) {
                        core->active_type_id = drv->type_id;
                        drv->advise_acquire(drv);
@@ -634,14 +634,14 @@ static int cx8802_request_release(struct cx8802_driver 
*drv)
 {
        struct cx88_core *core = drv->core;
 
+       mutex_lock(&drv->core->lock);
        if (drv->advise_release && --core->active_ref == 0)
        {
-               mutex_lock(&drv->core->lock);
                drv->advise_release(drv);
                core->active_type_id = CX88_BOARD_NONE;
-               mutex_unlock(&drv->core->lock);
                mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, 
cx_read(MO_GP0_IO));
        }
+       mutex_unlock(&drv->core->lock);
 
        return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-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