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]
Date:   Mon, 24 Jan 2022 22:01:56 +0100
From:   Christian Eggers <ceggers@...i.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Pavel Machek <pavel@...x.de>
CC:     <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        Stefan Riedmueller <s.riedmueller@...tec.de>,
        Han Xu <han.xu@....com>,
        Miquel Raynal <miquel.raynal@...tlin.com>
Subject: Re: [PATCH 5.4 007/320] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings

Hi Pavel,

On Monday, 24 January 2022, 21:41:48 CET, Pavel Machek wrote:
> Hi!
> 
> > commit f53d4c109a666bf1a4883b45d546fba079258717 upstream.
> > 
> > gpmi_io clock needs to be gated off when changing the parent/dividers of
> > enfc_clk_root (i.MX6Q/i.MX6UL) respectively qspi2_clk_root (i.MX6SX).
> > Otherwise this rate change can lead to an unresponsive GPMI core which
> > results in DMA timeouts and failed driver probe:
> ...
> 
> > @@ -2429,7 +2449,9 @@ static int gpmi_nfc_exec_op(struct nand_
> >  	 */
> >  	if (this->hw.must_apply_timings) {
> >  		this->hw.must_apply_timings = false;
> > -		gpmi_nfc_apply_timings(this);
> > +		ret = gpmi_nfc_apply_timings(this);
> > +		if (ret)
> > +			return ret;
> >  	}
> >  
> >  	dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
> >
> 
> AFAICT this leaks pm reference in the error case. Not sure what
> variant is right, there, so...
You're right, thanks for pointing this out. I think that the error path
currently should not appear in practice, but I plan to add further patches
in future where this could happen then.

Although there's a potential new error, I think that this patch should
improve the situation.

> 
> Best regards,
> 								Pavel
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 1b64c5a5140d..06840cff6945 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -2284,8 +2284,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
>  	if (this->hw.must_apply_timings) {
>  		this->hw.must_apply_timings = false;
>  		ret = gpmi_nfc_apply_timings(this);
> -		if (ret)
> +		if (ret) {
> +			pm_runtime_put_....(this->dev);
>  			return ret;
> +		}
>  	}
>  
>  	dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);

I'll prepare and send a new patch tomorrow.

regards
Christian




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ