Skip to content

Commit 41b9749

Browse files
Mathis Foerstgregkh
authored andcommitted
media: mt9m114: Fix deadlock in get_frame_interval/set_frame_interval
commit 298d147 upstream. Getting / Setting the frame interval using the V4L2 subdev pad ops get_frame_interval/set_frame_interval causes a deadlock, as the subdev state is locked in the [1] but also in the driver itself. In [2] it's described that the caller is responsible to acquire and release the lock in this case. Therefore, acquiring the lock in the driver is wrong. Remove the lock acquisitions/releases from mt9m114_ifp_get_frame_interval() and mt9m114_ifp_set_frame_interval(). [1] drivers/media/v4l2-core/v4l2-subdev.c - line 1129 [2] Documentation/driver-api/media/v4l2-subdev.rst Fixes: 24d756e ("media: i2c: Add driver for onsemi MT9M114 camera sensor") Cc: stable@vger.kernel.org Signed-off-by: Mathis Foerst <mathis.foerst@mt.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bd5811e commit 41b9749

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

drivers/media/i2c/mt9m114.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,13 +1599,9 @@ static int mt9m114_ifp_get_frame_interval(struct v4l2_subdev *sd,
15991599
if (interval->which != V4L2_SUBDEV_FORMAT_ACTIVE)
16001600
return -EINVAL;
16011601

1602-
mutex_lock(sensor->ifp.hdl.lock);
1603-
16041602
ival->numerator = 1;
16051603
ival->denominator = sensor->ifp.frame_rate;
16061604

1607-
mutex_unlock(sensor->ifp.hdl.lock);
1608-
16091605
return 0;
16101606
}
16111607

@@ -1624,8 +1620,6 @@ static int mt9m114_ifp_set_frame_interval(struct v4l2_subdev *sd,
16241620
if (interval->which != V4L2_SUBDEV_FORMAT_ACTIVE)
16251621
return -EINVAL;
16261622

1627-
mutex_lock(sensor->ifp.hdl.lock);
1628-
16291623
if (ival->numerator != 0 && ival->denominator != 0)
16301624
sensor->ifp.frame_rate = min_t(unsigned int,
16311625
ival->denominator / ival->numerator,
@@ -1639,8 +1633,6 @@ static int mt9m114_ifp_set_frame_interval(struct v4l2_subdev *sd,
16391633
if (sensor->streaming)
16401634
ret = mt9m114_set_frame_rate(sensor);
16411635

1642-
mutex_unlock(sensor->ifp.hdl.lock);
1643-
16441636
return ret;
16451637
}
16461638

0 commit comments

Comments
 (0)