Commit 913f5fc2 authored by Marcin Slusarz's avatar Marcin Slusarz Committed by Mauro Carvalho Chehab

V4L/DVB (8022): saa7134: fix race between opening and closing the device

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: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent a14fe960
...@@ -112,7 +112,6 @@ static int ts_release(struct inode *inode, struct file *file) ...@@ -112,7 +112,6 @@ static int ts_release(struct inode *inode, struct file *file)
videobuf_stop(&dev->empress_tsq); videobuf_stop(&dev->empress_tsq);
videobuf_mmap_free(&dev->empress_tsq); videobuf_mmap_free(&dev->empress_tsq);
dev->empress_users--;
/* stop the encoder */ /* stop the encoder */
ts_reset_encoder(dev); ts_reset_encoder(dev);
...@@ -121,6 +120,8 @@ static int ts_release(struct inode *inode, struct file *file) ...@@ -121,6 +120,8 @@ static int ts_release(struct inode *inode, struct file *file)
saa_writeb(SAA7134_AUDIO_MUTE_CTRL, saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
dev->empress_users--;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment