lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aJ-Sept8uMm2Opeq@stanley.mountain>
Date: Fri, 15 Aug 2025 23:03:06 +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, Hans de Goede <hdegoede@...hat.com>
Subject: Re: [PATCH] staging: media: atomisp: Add lock asserts for mutex
 protection

On Fri, Aug 15, 2025 at 08:09:01PM +0300, Abdelrahman Fekry wrote:
> Add lockdep_assert_held(&isp->mutex) to critical functions accessing
> shared device state. This enforces proper locking and detects violations.
> 
> Suggested-by: Hans de Goede <hdegoede@...hat.com>
> Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@...il.com>
> ---
>  .../staging/media/atomisp/pci/atomisp_cmd.c   |  3 ++
>  .../media/atomisp/pci/atomisp_compat_css20.c  | 31 +++++++++++++++++++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index 3a4eb4f6d3be..48ca33e1c92d 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -3794,6 +3794,7 @@ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f,
>  		    const struct atomisp_format_bridge **fmt_ret,
>  		    const struct atomisp_format_bridge **snr_fmt_ret)
>  {
> +	lockdep_assert_held(&isp->mutex);

This should go after the declarations.

>  	const struct atomisp_format_bridge *fmt, *snr_fmt;
>  	struct atomisp_sub_device *asd = &isp->asd;
>  	struct v4l2_mbus_framefmt ffmt = { };
> @@ -4324,6 +4325,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, const struct v4l2_p
>  int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)
>  {
>  	struct atomisp_device *isp = video_get_drvdata(vdev);
> +	lockdep_assert_held(&isp->mutex);

Same.  Etc...

> +
>  	struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
>  	struct atomisp_sub_device *asd = pipe->asd;
>  	const struct atomisp_format_bridge *format_bridge;

[ snip ]

> @@ -1726,6 +1746,10 @@ int atomisp_css_input_configure_port(
>  {
>  	int i;
>  	struct atomisp_stream_env *stream_env;
> +

No blank line here.

> +	struct atomisp_device *isp = asd->isp;
> +
> +	lockdep_assert_held(&isp->mutex);
>  	/*
>  	 * Calculate rx_count as follows:
>  	 * Input: mipi_freq                 : CSI-2 bus frequency in Hz

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ