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: <632455db.df0a0220.9684.aafc@mx.google.com>
Date:   Fri, 16 Sep 2022 05:11:33 +0200
From:   Christian Marangi <ansuelsmth@...il.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Manivannan Sadhasivam <mani@...nel.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Vinod Koul <vkoul@...nel.org>, Mark Brown <broonie@...nel.org>,
        linux-mtd@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] mtd: nand: raw: qcom_nandc: handle error pointer from
 adm prep_slave_sg

On Fri, Sep 16, 2022 at 11:01:11AM +0200, Arnd Bergmann wrote:
> On Fri, Sep 16, 2022, at 2:10 AM, Christian Marangi wrote:
> > ADM dma engine has changed to also provide error pointer instaed of
> > plain NULL pointer on invalid configuration of prep_slave_sg function.
> > Currently this is not handled and an error pointer is detected as a
> > valid dma_desc. This cause kernel panic as the driver doesn't fail
> > with an invalid dma engine configuration.
> >
> > Correctly handle this case by checking if dma_desc is NULL or IS_ERR.
> 
> Using IS_ERR_OR_NULL() is almost never a correct solution. I think
> in this case the problem is the adm_prep_slave_sg() function
> that returns an invalid error code.
>

Yes I was honestly not certain on what to fix... The adm driver or the
nand driver. Dediced to fix the nand driver since it was the one that
was causing the panic and to me it seemd bad to remove error code from
the adm driver. (But we have debug log anyway so...)

> While error pointers are often better than NULL pointers for
> passing information to the caller, a driver can't just change
> the calling conventions on its own. If we want to change
> the dmaengine_prep_slave_sg() API, I would suggest coming
> up with a new name for a replacement interface that uses
> error pointers instead of NULL first, and then changing
> all callers to the new interface.
> 
>        Arnd

I also notice this that dmaengine_prep_slave_sg always return NULL in
case of error so you are right and the real problem here is the changed
calling concention. Seems overkill to introduce a new API just for a
commit that changed the naming convention...

So I think we should just ignore this and I will send a better fix that
will just return NULL and fix the adm driver. 

Thanks for the review and the clarification!
(Also extra point the fixes tag will match the driver)

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ