]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: omap4iss: Acquire graph mutex for graph traversal
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 19 Mar 2021 16:31:08 +0000 (17:31 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 6 Apr 2021 12:34:38 +0000 (14:34 +0200)
Acquire the graph_mutex for traversing the media graph. This seems to have
been missing all the time.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/omap4iss/iss.c
drivers/staging/media/omap4iss/iss_video.c

index 085397045b36d49ecdeb49ad32ee6ac4a0288ab7..ac8a96be3e30183fad5a4bc567c735e2294e2987 100644 (file)
@@ -456,6 +456,8 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
 
        pipe->do_propagation = false;
 
+       mutex_lock(&iss->media_dev.graph_mutex);
+
        entity = &pipe->output->video.entity;
        while (1) {
                pad = &entity->pads[0];
@@ -472,6 +474,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
                ret = v4l2_subdev_call(subdev, video, s_stream, mode);
                if (ret < 0 && ret != -ENOIOCTLCMD) {
                        iss_pipeline_disable(pipe, entity);
+                       mutex_unlock(&iss->media_dev.graph_mutex);
                        return ret;
                }
 
@@ -480,7 +483,9 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
                        pipe->do_propagation = true;
        }
 
+       mutex_unlock(&iss->media_dev.graph_mutex);
        iss_print_status(pipe->output->iss);
+
        return 0;
 }
 
index 66975a37dc85f1ff5624d4862cf289a1ded182b1..930f638f51eba67fb93ba9a98a97428e2acb3106 100644 (file)
@@ -854,6 +854,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
        struct iss_video *video = video_drvdata(file);
        struct media_graph graph;
        struct media_entity *entity = &video->video.entity;
+       struct media_device *mdev = entity->graph_obj.mdev;
        enum iss_pipeline_state state;
        struct iss_pipeline *pipe;
        struct iss_video *far_end;
@@ -890,9 +891,11 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
        if (ret < 0)
                goto err_media_pipeline_start;
 
+       mutex_lock(&mdev->graph_mutex);
        media_graph_walk_start(&graph, entity);
        while ((entity = media_graph_walk_next(&graph)))
                media_entity_enum_set(&pipe->ent_enum, entity);
+       mutex_unlock(&mdev->graph_mutex);
 
        /*
         * Verify that the currently configured format matches the output of