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] [thread-next>] [day] [month] [year] [list]
Message-ID: <h74uhtfdqzhq4qgcfqonwrlvoddaspi73h2m7u6bg6akjq3ugm@vxjt5ttzfkkx>
Date: Mon, 23 Sep 2024 19:50:18 +0200
From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
To: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>, 
	Mauro Carvalho Chehab <mchehab@...nel.org>, Shawn Guo <shawnguo@...nel.org>, 
	Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix Kernel Team <kernel@...gutronix.de>, 
	Fabio Estevam <festevam@...il.com>, Guoniu Zhou <guoniu.zhou@....com>, 
	Jacopo Mondi <jacopo@...ndi.org>, Christian Hemp <c.hemp@...tec.de>, 
	Stefan Riedmueller <s.riedmueller@...tec.de>, linux-media@...r.kernel.org, imx@...ts.linux.dev, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: nxp: imx8-isi: add m2m usage_count check in
 streamoff

Hi Laurentiu

On Fri, Sep 20, 2024 at 05:27:15PM GMT, Laurentiu Palcu wrote:
> Currently, if streamon/streamoff calls are imbalanced we can end up
> with a negative ISI m2m usage_count. When that happens, the next
> streamon call will not enable the ISI m2m channel.
>
> So, instead of throwing a warning in streamoff when usage_count drops
> below 0, just make sure we don't get there.

Isn't the whole purpose of the WARN() to highlight something's wrong
with userspace ? I think it's expected to have the same number of
streamon and streamoff calls, do you have any idea why it might not be
happening ?

Thanks
  j

>
> Fixes: cf21f328fcafac ("media: nxp: Add i.MX8 ISI driver")
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
> ---
>  drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> index 9745d6219a166..b71195a3ba256 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> @@ -575,6 +575,9 @@ static int mxc_isi_m2m_streamoff(struct file *file, void *fh,
>
>  	mutex_lock(&m2m->lock);
>
> +	if (m2m->usage_count == 0)
> +		goto unlock;
> +
>  	/*
>  	 * If the last context is this one, reset it to make sure the device
>  	 * will be reconfigured when streaming is restarted.
> @@ -594,8 +597,7 @@ static int mxc_isi_m2m_streamoff(struct file *file, void *fh,
>  		mxc_isi_channel_release(m2m->pipe);
>  	}
>
> -	WARN_ON(m2m->usage_count < 0);
> -
> +unlock:
>  	mutex_unlock(&m2m->lock);
>
>  	return 0;
> --
> 2.34.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ