Skip to content

Commit

Permalink
media: omap3isp: Acquire graph mutex for graph traversal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sakari Ailus authored and mchehab committed Apr 6, 2021
1 parent a1946ca commit ba689d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/media/platform/omap3isp/isp.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,

pipe->do_propagation = false;

mutex_lock(&isp->media_dev.graph_mutex);

entity = &pipe->output->video.entity;
while (1) {
pad = &entity->pads[0];
Expand All @@ -705,8 +707,10 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
subdev = media_entity_to_v4l2_subdev(entity);

ret = v4l2_subdev_call(subdev, video, s_stream, mode);
if (ret < 0 && ret != -ENOIOCTLCMD)
if (ret < 0 && ret != -ENOIOCTLCMD) {
mutex_unlock(&isp->media_dev.graph_mutex);
return ret;
}

if (subdev == &isp->isp_ccdc.subdev) {
v4l2_subdev_call(&isp->isp_aewb.subdev, video,
Expand All @@ -723,6 +727,8 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
break;
}

mutex_unlock(&isp->media_dev.graph_mutex);

return 0;
}

Expand Down Expand Up @@ -2028,6 +2034,8 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
struct v4l2_subdev *sd;
int ret;

mutex_lock(&isp->media_dev.graph_mutex);

ret = media_entity_enum_init(&isp->crashed, &isp->media_dev);
if (ret)
return ret;
Expand All @@ -2038,10 +2046,14 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)

ret = isp_link_entity(isp, &sd->entity,
v4l2_subdev_to_bus_cfg(sd)->interface);
if (ret < 0)
if (ret < 0) {
mutex_unlock(&isp->media_dev.graph_mutex);
return ret;
}
}

mutex_unlock(&isp->media_dev.graph_mutex);

ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (ret < 0)
return ret;
Expand Down

0 comments on commit ba689d9

Please sign in to comment.