diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-10 12:18:16 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-10 12:18:16 -0300 |
commit | ce21406c4ed59ed6f4ed14d0309962bec8b728d6 (patch) | |
tree | 0604486a95b3b9657886607c50c7830fbf967e35 | |
parent | e84663cb04183962a0af5df76906275e370543ae (diff) | |
download | mediapointer-dvb-s2-ce21406c4ed59ed6f4ed14d0309962bec8b728d6.tar.gz mediapointer-dvb-s2-ce21406c4ed59ed6f4ed14d0309962bec8b728d6.tar.bz2 |
v4l: saa7134: fix race between opening and closing the device
From: Marcin Slusarz <marcin.slusarz@gmail.com>
decrementing dev->empress_users should be done as last action of ts_release,
because it sleeps and write access to dev->empress_started is not protected
in any way
(additionally closing thread could mute audio after opening thread unmuted it)
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: video4linux-list@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-empress.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c index 02f4bb906..9ad75423a 100644 --- a/linux/drivers/media/video/saa7134/saa7134-empress.c +++ b/linux/drivers/media/video/saa7134/saa7134-empress.c @@ -121,7 +121,6 @@ static int ts_release(struct inode *inode, struct file *file) videobuf_stop(&dev->empress_tsq); videobuf_mmap_free(&dev->empress_tsq); - dev->empress_users--; /* stop the encoder */ ts_reset_encoder(dev); @@ -130,6 +129,8 @@ static int ts_release(struct inode *inode, struct file *file) saa_writeb(SAA7134_AUDIO_MUTE_CTRL, saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); + dev->empress_users--; + return 0; } |