[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06f61db2-da3d-4de0-8ce5-04e135add870@suswa.mountain>
Date: Thu, 17 Jul 2025 07:44:58 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Abdelrahman Fekry <abdelrahmanfekry375@...il.com>
Cc: hansg@...nel.org, mchehab@...nel.org, sakari.ailus@...ux.intel.com,
andy@...nel.org, gregkh@...uxfoundation.org,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-kernel-mentees@...ts.linux.dev,
skhan@...uxfoundation.org
Subject: Re: [PATCH v2] staging: media: atomisp: add missing mutex lock in
atomisp_s_fmt_cap
On Thu, Jul 17, 2025 at 04:30:03AM +0300, Abdelrahman Fekry wrote:
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> index bb8b2f2213b0..d3b8e480065e 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> @@ -9,6 +9,7 @@
>
> #include <linux/delay.h>
> #include <linux/pci.h>
> +#include <linux/cleanup.h>
>
> #include <media/v4l2-ioctl.h>
> #include <media/v4l2-event.h>
> @@ -416,8 +417,15 @@ static int atomisp_s_fmt_cap(struct file *file, void *fh,
> struct v4l2_format *f)
> {
> struct video_device *vdev = video_devdata(file);
> + struct atomisp_device *isp = video_get_drvdata(vdev);
> +
Delete this blank line.
> + int ret;
>
> - return atomisp_set_fmt(vdev, f);
> + scoped_guard(mutex, &isp->mutex)
> + {
This open curly brace should have gone on the line before:
scoped_guard(mutex, &isp->mutex) {
But actually just use:
guard(mutex)(&isp->mutex);
It will hold the lock until the end of the function.
regards,
dan carpenter
> + ret = atomisp_set_fmt(vdev, f);
> + }
> + return ret;
> }
Powered by blists - more mailing lists