summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-04-28 13:35:27 -0400
committerDevin Heitmueller <dheitmueller@kernellabs.com>2009-04-28 13:35:27 -0400
commita7dc2838bf1a5069828ca5a4f9e7a35916c95f7e (patch)
treed0eac98267a44b78471310f243edca83151b99a2 /linux/drivers/media/video/cx88/cx88-video.c
parentdac2a57af684d3f1fd146a0b84a559c011d84102 (diff)
downloadmediapointer-dvb-s2-a7dc2838bf1a5069828ca5a4f9e7a35916c95f7e.tar.gz
mediapointer-dvb-s2-a7dc2838bf1a5069828ca5a4f9e7a35916c95f7e.tar.bz2
cx88: Fix race condition between cx8800 startup and hald
From: Devin Heitmueller <dheitmueller@kernellabs.com> A power management fix to properly put the xc5000 into low power mode revealed a race condition where hald could detect the creation of the device file and connect to the device while the initial device configuration is still in progress. Lock the core structure so that video_release cannot be called and put the tuner to sleep in the middle of the initial call to cx88_set_tvnorm() in cx8800_initdev() Thanks to Michael Krufky for discovering the issue and providing an environment to test in. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Cc: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-video.c')
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 88a326f61..2dfa4c9c3 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1152,8 +1152,10 @@ static int video_release(struct file *file)
file->private_data = NULL;
kfree(fh);
+ mutex_lock(&dev->core->lock);
if(atomic_dec_and_test(&dev->core->users))
call_all(dev->core, tuner, s_standby);
+ mutex_unlock(&dev->core->lock);
return 0;
}