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, 19 Apr 2021 07:09:35 +0000
From:   "Alice Guo (OSS)" <alice.guo@....nxp.com>
To:     Dominique MARTINET <dominique.martinet@...ark-techno.com>,
        "Alice Guo (OSS)" <alice.guo@....nxp.com>
CC:     "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "rafael@...nel.org" <rafael@...nel.org>,
        Horia Geanta <horia.geanta@....com>,
        Aymen Sghaier <aymen.sghaier@....com>,
        "herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "tony@...mide.com" <tony@...mide.com>,
        "geert+renesas@...der.be" <geert+renesas@...der.be>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "sboyd@...nel.org" <sboyd@...nel.org>,
        "vkoul@...nel.org" <vkoul@...nel.org>,
        "peter.ujfalusi@...il.com" <peter.ujfalusi@...il.com>,
        "a.hajda@...sung.com" <a.hajda@...sung.com>,
        "narmstrong@...libre.com" <narmstrong@...libre.com>,
        "robert.foss@...aro.org" <robert.foss@...aro.org>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        "khilman@...libre.com" <khilman@...libre.com>,
        "tomba@...nel.org" <tomba@...nel.org>,
        "jyri.sarha@....fi" <jyri.sarha@....fi>,
        "joro@...tes.org" <joro@...tes.org>,
        "will@...nel.org" <will@...nel.org>,
        "mchehab@...nel.org" <mchehab@...nel.org>,
        "ulf.hansson@...aro.org" <ulf.hansson@...aro.org>,
        "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
        "kishon@...com" <kishon@...com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        Roy Pledge <roy.pledge@....com>, Leo Li <leoyang.li@....com>,
        "ssantosh@...nel.org" <ssantosh@...nel.org>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
        "edubezval@...il.com" <edubezval@...il.com>,
        "j-keerthy@...com" <j-keerthy@...com>,
        "balbi@...nel.org" <balbi@...nel.org>,
        "linux@...sktech.co.nz" <linux@...sktech.co.nz>,
        "stern@...land.harvard.edu" <stern@...land.harvard.edu>,
        "wim@...ux-watchdog.org" <wim@...ux-watchdog.org>,
        "linux@...ck-us.net" <linux@...ck-us.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        "linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-amlogic@...ts.infradead.org" 
        <linux-amlogic@...ts.infradead.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-phy@...ts.infradead.org" <linux-phy@...ts.infradead.org>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        "linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
        dl-linux-imx <linux-imx@....com>
Subject: RE: [RFC v1 PATCH 3/3] driver: update all the code that use
 soc_device_match



> -----Original Message-----
> From: Dominique MARTINET <dominique.martinet@...ark-techno.com>
> Sent: 2021年4月19日 13:03
> To: Alice Guo (OSS) <alice.guo@....nxp.com>
> Subject: Re: [RFC v1 PATCH 3/3] driver: update all the code that use
> soc_device_match
> 
> Alice Guo (OSS) wrote on Mon, Apr 19, 2021 at 12:27:22PM +0800:
> > From: Alice Guo <alice.guo@....com>
> >
> > Update all the code that use soc_device_match
> 
> A single patch might be difficult to accept for all components, a each maintainer
> will probably want to have a say on their subsystem?
> 
> I would suggest to split these for a non-RFC version; a this will really need to be
> case-by-case handling.
> 
> > because add support for soc_device_match returning -EPROBE_DEFER.
> 
> (English does not parse here for me)
> 
> I've only commented a couple of places in the code itself, but this doesn't seem
> to add much support for errors, just sweep the problem under the rug.
> 
> > Signed-off-by: Alice Guo <alice.guo@....com>
> > ---
> >
> > diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index
> > 5fae60f8c135..00c59aa217c1 100644
> > --- a/drivers/bus/ti-sysc.c
> > +++ b/drivers/bus/ti-sysc.c
> > @@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata)
> >  	}
> >
> >  	match = soc_device_match(sysc_soc_feat_match);
> > -	if (!match)
> > +	if (!match || IS_ERR(match))
> >  		return 0;
> 
> This function handles errors, I would recommend returning the error as is if
> soc_device_match returned one so the probe can be retried later.
> 
> >
> >  	if (match->data)
> > diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c
> > b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> > index c32d2c678046..90a18336a4c3 100644
> > --- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
> > +++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
> > @@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[]
> > __initconst = {
> >
> >  static int __init r8a7795_cpg_mssr_init(struct device *dev)  {
> > +	const struct soc_device_attribute *match;
> >  	const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
> >  	u32 cpg_mode;
> >  	int error;
> > @@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device
> *dev)
> >  		return -EINVAL;
> >  	}
> >
> > -	if (soc_device_match(r8a7795es1)) {
> > +	match = soc_device_match(r8a7795es1);
> > +	if (!IS_ERR(match) && match) {
> 
> Same, return the error.
> Assuming an error means no match will just lead to hard to debug problems
> because the driver potentially assumed the wrong device when it's just not
> ready yet.
> 
> >  		cpg_core_nullify_range(r8a7795_core_clks,
> >  				       ARRAY_SIZE(r8a7795_core_clks),
> >  				       R8A7795_CLK_S0D2, R8A7795_CLK_S0D12); [...]
> diff --git
> > a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index
> > eaaec0a55cc6..13a06b613379 100644
> > --- a/drivers/iommu/ipmmu-vmsa.c
> > +++ b/drivers/iommu/ipmmu-vmsa.c
> > @@ -757,17 +757,20 @@ static const char * const devices_allowlist[] =
> > {
> >
> >  static bool ipmmu_device_is_allowed(struct device *dev)  {
> > +	const struct soc_device_attribute *match1, *match2;
> >  	unsigned int i;
> >
> >  	/*
> >  	 * R-Car Gen3 and RZ/G2 use the allow list to opt-in devices.
> >  	 * For Other SoCs, this returns true anyway.
> >  	 */
> > -	if (!soc_device_match(soc_needs_opt_in))
> > +	match1 = soc_device_match(soc_needs_opt_in);
> > +	if (!IS_ERR(match1) && !match1)
> 
> I'm not sure what you intended to do, but !match1 already means there is no
> error so the original code is identical.
> 
> In this case ipmmu_device_is_allowed does not allow errors so this is one of the
> "difficult" drivers that require slightly more thinking.
> It is only called in ipmmu_of_xlate which does return errors properly, so in this
> case the most straightforward approach would be to make
> ipmmu_device_is_allowed return an int and forward errors as well.
> 

I will reconsider the existing problems. Thank you for your advice

> 
> ...
> This is going to need quite some more work to be acceptable, in my opinion, but
> I think it should be possible.
> 
> Thanks,
> --
> Dominique

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ