* [PATCH 1/1] media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
@ 2022-02-02 14:11 Sakari Ailus
2022-02-02 14:35 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2022-02-02 14:11 UTC (permalink / raw)
To: linux-media; +Cc: laurent.pinchart
From: Dan Carpenter <dan.carpenter@oracle.com>
This error path needs to drop the mutex to avoid a deadlock.
Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/ov08d10.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c
index 1f42dd714ef6..e5ef6466a3ec 100644
--- a/drivers/media/i2c/ov08d10.c
+++ b/drivers/media/i2c/ov08d10.c
@@ -1264,8 +1264,10 @@ static int ov08d10_enum_frame_size(struct v4l2_subdev *sd,
return -EINVAL;
mutex_lock(&ov08d10->mutex);
- if (fse->code != ov08d10_get_format_code(ov08d10))
+ if (fse->code != ov08d10_get_format_code(ov08d10)) {
+ mutex_unlock(&ov08d10->mutex);
return -EINVAL;
+ }
mutex_unlock(&ov08d10->mutex);
fse->min_width = ov08d10->priv_lane->sp_modes[fse->index].width;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
2022-02-02 14:11 [PATCH 1/1] media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size() Sakari Ailus
@ 2022-02-02 14:35 ` Laurent Pinchart
2022-02-02 15:36 ` Sakari Ailus
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2022-02-02 14:35 UTC (permalink / raw)
To: Sakari Ailus; +Cc: linux-media
On Wed, Feb 02, 2022 at 04:11:21PM +0200, Sakari Ailus wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
>
> This error path needs to drop the mutex to avoid a deadlock.
>
> Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
I want RAII in C :-)
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/i2c/ov08d10.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c
> index 1f42dd714ef6..e5ef6466a3ec 100644
> --- a/drivers/media/i2c/ov08d10.c
> +++ b/drivers/media/i2c/ov08d10.c
> @@ -1264,8 +1264,10 @@ static int ov08d10_enum_frame_size(struct v4l2_subdev *sd,
> return -EINVAL;
>
> mutex_lock(&ov08d10->mutex);
> - if (fse->code != ov08d10_get_format_code(ov08d10))
> + if (fse->code != ov08d10_get_format_code(ov08d10)) {
> + mutex_unlock(&ov08d10->mutex);
> return -EINVAL;
> + }
> mutex_unlock(&ov08d10->mutex);
>
> fse->min_width = ov08d10->priv_lane->sp_modes[fse->index].width;
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
2022-02-02 14:35 ` Laurent Pinchart
@ 2022-02-02 15:36 ` Sakari Ailus
0 siblings, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2022-02-02 15:36 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
Hi Laurent,
On Wed, Feb 02, 2022 at 04:35:56PM +0200, Laurent Pinchart wrote:
> On Wed, Feb 02, 2022 at 04:11:21PM +0200, Sakari Ailus wrote:
> > From: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > This error path needs to drop the mutex to avoid a deadlock.
> >
> > Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> I want RAII in C :-)
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Oops. This wasn't the patch I intended to send. But thanks for the
Reviewed-by: nonetheless. :-)
--
Sakari Ailus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-02 15:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 14:11 [PATCH 1/1] media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size() Sakari Ailus
2022-02-02 14:35 ` Laurent Pinchart
2022-02-02 15:36 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).