diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-06-10 14:18:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-26 14:58:46 -0400 |
commit | 913f5fc209247b607b1994a710315966f4f9d358 (patch) | |
tree | de8ae1f4b58c61a293b91072d9a3ccbbda1d7637 /drivers/media | |
parent | a14fe9605bfdfe360b97acc9ef912779eb860507 (diff) |
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: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 94b2585bdf5b..1c8cd0ef4a65 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -112,7 +112,6 @@ static int ts_release(struct inode *inode, struct file *file) | |||
112 | 112 | ||
113 | videobuf_stop(&dev->empress_tsq); | 113 | videobuf_stop(&dev->empress_tsq); |
114 | videobuf_mmap_free(&dev->empress_tsq); | 114 | videobuf_mmap_free(&dev->empress_tsq); |
115 | dev->empress_users--; | ||
116 | 115 | ||
117 | /* stop the encoder */ | 116 | /* stop the encoder */ |
118 | ts_reset_encoder(dev); | 117 | ts_reset_encoder(dev); |
@@ -121,6 +120,8 @@ static int ts_release(struct inode *inode, struct file *file) | |||
121 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, | 120 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, |
122 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); | 121 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); |
123 | 122 | ||
123 | dev->empress_users--; | ||
124 | |||
124 | return 0; | 125 | return 0; |
125 | } | 126 | } |
126 | 127 | ||