From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Mathis Foerst <mathis.foerst@mt.com>
Cc: linux-kernel@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
manuel.traut@mt.com, mathis.foerst@zuehlke.com,
stable@vger.kernel.org
Subject: Re: [PATCH v4 5/6] media: mt9m114: Fix deadlock in get_frame_interval/set_frame_interval
Date: Wed, 23 Apr 2025 21:16:20 +0300 [thread overview]
Message-ID: <20250423181620.GD2675@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250307093140.370061-6-mathis.foerst@mt.com>
Hi Mathis,
Thank you for the patch.
On Fri, Mar 07, 2025 at 10:31:39AM +0100, Mathis Foerst wrote:
> 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: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor")
> Cc: stable@vger.kernel.org
>
You can delete this blank line.
> Signed-off-by: Mathis Foerst <mathis.foerst@mt.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/i2c/mt9m114.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
> index 65b9124e464f..79c97ab19be9 100644
> --- a/drivers/media/i2c/mt9m114.c
> +++ b/drivers/media/i2c/mt9m114.c
> @@ -1644,13 +1644,9 @@ static int mt9m114_ifp_get_frame_interval(struct v4l2_subdev *sd,
> if (interval->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> return -EINVAL;
>
> - mutex_lock(sensor->ifp.hdl.lock);
> -
> ival->numerator = 1;
> ival->denominator = sensor->ifp.frame_rate;
>
> - mutex_unlock(sensor->ifp.hdl.lock);
> -
> return 0;
> }
>
> @@ -1669,8 +1665,6 @@ static int mt9m114_ifp_set_frame_interval(struct v4l2_subdev *sd,
> if (interval->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> return -EINVAL;
>
> - mutex_lock(sensor->ifp.hdl.lock);
> -
> if (ival->numerator != 0 && ival->denominator != 0)
> sensor->ifp.frame_rate = min_t(unsigned int,
> ival->denominator / ival->numerator,
> @@ -1684,8 +1678,6 @@ static int mt9m114_ifp_set_frame_interval(struct v4l2_subdev *sd,
> if (sensor->streaming)
> ret = mt9m114_set_frame_rate(sensor);
>
> - mutex_unlock(sensor->ifp.hdl.lock);
> -
> return ret;
> }
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-04-23 18:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 9:31 [PATCH v4 0/6] MT9M114 driver bugfix and improvements Mathis Foerst
2025-03-07 9:31 ` [PATCH v4 1/6] media: dt-bindings: mt9m114: Add slew-rate DT-binding Mathis Foerst
2025-03-10 9:36 ` Krzysztof Kozlowski
2025-04-23 18:01 ` Laurent Pinchart
2025-03-07 9:31 ` [PATCH v4 2/6] media: mt9m114: Bypass PLL if required Mathis Foerst
2025-04-23 18:09 ` Laurent Pinchart
2025-03-07 9:31 ` [PATCH v4 3/6] media: mt9m114: Factor out mt9m114_configure_pa Mathis Foerst
2025-04-23 18:14 ` Laurent Pinchart
2025-03-07 9:31 ` [PATCH v4 4/6] media: mt9m114: Allow set_selection while streaming Mathis Foerst
2025-04-23 18:39 ` Laurent Pinchart
2025-05-22 14:21 ` Mathis Foerst
2025-03-07 9:31 ` [PATCH v4 5/6] media: mt9m114: Fix deadlock in get_frame_interval/set_frame_interval Mathis Foerst
2025-04-23 18:16 ` Laurent Pinchart [this message]
2025-03-07 9:31 ` [PATCH v4 6/6] media: mt9m114: Set pad-slew-rate Mathis Foerst
2025-04-23 18:23 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250423181620.GD2675@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=manuel.traut@mt.com \
--cc=mathis.foerst@mt.com \
--cc=mathis.foerst@zuehlke.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®