]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
media: staging: rkisp1: stats: protect write to 'is_streaming' in start_streaming cb
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tue, 22 Sep 2020 11:33:59 +0000 (13:33 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 27 Sep 2020 09:35:04 +0000 (11:35 +0200)
The field stats->is_streaming is written in 'start_streaming' callback
without the stats->lock protection.
The isr might run together with the callback so 'spin_lock_irq'
should be used.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/rkisp1/rkisp1-stats.c

index 6aa18d970f2bc34d27f6e62bbceeea8bee44740c..51c64f75fe29aba0a3788c41193b81da4000b9bd 100644 (file)
@@ -157,7 +157,9 @@ rkisp1_stats_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
 {
        struct rkisp1_stats *stats = queue->drv_priv;
 
+       spin_lock_irq(&stats->lock);
        stats->is_streaming = true;
+       spin_unlock_irq(&stats->lock);
 
        return 0;
 }