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: <lbsj2h2zut3eafu5vy6ysuv4y7xjuqtemovqtg3lzuyhp6fjbl@4xwikb3bxl7k>
Date: Mon, 10 Mar 2025 21:23:32 +0300
From: Fedor Pchelkin <pchelkin@...ras.ru>
To: Frank Li <Frank.li@....com>
Cc: Peter Chen <peter.chen@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Shawn Guo <shawnguo@...nel.org>, 
	Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix Kernel Team <kernel@...gutronix.de>, 
	Fabio Estevam <festevam@...il.com>, Joe Hattori <joe@...is.s.u-tokyo.ac.jp>, 
	Sebastian Reichel <sre@...nel.org>, Fabien Lahoudere <fabien.lahoudere@...labora.co.uk>, 
	linux-usb@...r.kernel.org, imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org, stable@...r.kernel.org
Subject: Re: [PATCH 2/3] usb: chipidea: ci_hdrc_imx: disable regulator on
 error path in probe

On Mon, 10. Mar 10:53, Frank Li wrote:
> On Sun, Mar 09, 2025 at 08:57:58PM +0300, Fedor Pchelkin wrote:
> > Upon encountering errors during the HSIC pinctrl handling section the
> > regulator should be disabled.
> >
> > After the above-stated changes it is possible to jump onto
> > "disable_hsic_regulator" label without having added the CPU latency QoS
> > request previously. This would result in cpu_latency_qos_remove_request()
> > yielding a WARNING.
> >
> > So rearrange the error handling path to follow the reverse order of
> > different probing phases.
> 
> Suggest use devm_add_action() to simple whole error handle code.

I'll try with that in v2 then, thanks for suggestion.

> 
> >
> > Found by Linux Verification Center (linuxtesting.org).
> 
> I think this sentense have not provide valuable informaiton for reader.

Well, that's a line which the organization rules specify to put into
every bugfix patch found on its behalf. I must follow these rules.

Btw, you can find this in the changelogs of many other commits existing
in the main kernel tree:

$ git shortlog --grep="linuxtesting.org" --group=format:""
 (859):
      kernel/range.c: fix clean_sort_range() for the case of full array
      Staging: pohmelfs/dir.c: Remove unneeded mutex_unlock() from pohmelfs_rename()
      USB: usb-gadget: unlock data->lock mutex on error path in ep_read()
      ...

> 
> Frank
> 
> >
> > Fixes: 4d6141288c33 ("usb: chipidea: imx: pinctrl for HSIC is optional")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Fedor Pchelkin <pchelkin@...ras.ru>
> > ---
> >  drivers/usb/chipidea/ci_hdrc_imx.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> > index 619779eef333..3f11ae071c7f 100644
> > --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> > @@ -407,13 +407,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> >  				"pinctrl_hsic_idle lookup failed, err=%ld\n",
> >  					PTR_ERR(pinctrl_hsic_idle));
> >  			ret = PTR_ERR(pinctrl_hsic_idle);
> > -			goto err_put;
> > +			goto disable_hsic_regulator;
> >  		}
> >
> >  		ret = pinctrl_select_state(data->pinctrl, pinctrl_hsic_idle);
> >  		if (ret) {
> >  			dev_err(dev, "hsic_idle select failed, err=%d\n", ret);
> > -			goto err_put;
> > +			goto disable_hsic_regulator;
> >  		}
> >
> >  		data->pinctrl_hsic_active = pinctrl_lookup_state(data->pinctrl,
> > @@ -423,7 +423,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> >  				"pinctrl_hsic_active lookup failed, err=%ld\n",
> >  					PTR_ERR(data->pinctrl_hsic_active));
> >  			ret = PTR_ERR(data->pinctrl_hsic_active);
> > -			goto err_put;
> > +			goto disable_hsic_regulator;
> >  		}
> >  	}
> >
> > @@ -432,11 +432,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> >
> >  	ret = imx_get_clks(dev);
> >  	if (ret)
> > -		goto disable_hsic_regulator;
> > +		goto qos_remove_request;
> >
> >  	ret = imx_prepare_enable_clks(dev);
> >  	if (ret)
> > -		goto disable_hsic_regulator;
> > +		goto qos_remove_request;
> >
> >  	ret = clk_prepare_enable(data->clk_wakeup);
> >  	if (ret)
> > @@ -526,12 +526,13 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
> >  	clk_disable_unprepare(data->clk_wakeup);
> >  err_wakeup_clk:
> >  	imx_disable_unprepare_clks(dev);
> > +qos_remove_request:
> > +	if (pdata.flags & CI_HDRC_PMQOS)
> > +		cpu_latency_qos_remove_request(&data->pm_qos_req);
> >  disable_hsic_regulator:
> >  	if (data->hsic_pad_regulator)
> >  		/* don't overwrite original ret (cf. EPROBE_DEFER) */
> >  		regulator_disable(data->hsic_pad_regulator);
> > -	if (pdata.flags & CI_HDRC_PMQOS)
> > -		cpu_latency_qos_remove_request(&data->pm_qos_req);
> >  	data->ci_pdev = NULL;
> >  err_put:
> >  	if (data->usbmisc_data)
> > --
> > 2.48.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ