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: <20210128123136.417eea7c@slackpad.fritz.box>
Date:   Thu, 28 Jan 2021 12:31:36 +0000
From:   Andre Przywara <andre.przywara@....com>
To:     Mark Brown <broonie@...nel.org>
Cc:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Maxime Ripard <mripard@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...l.net>,
        Samuel Holland <samuel@...lland.org>,
        Icenowy Zheng <icenowy@...c.io>, Rob Herring <robh@...nel.org>,
        Clément Péron 
        <peron.clem@...il.com>,
        Shuosheng Huang <huangshuosheng@...winnertech.com>,
        Yangtao Li <tiny.windzz@...il.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-sunxi@...glegroups.com, Lee Jones <lee.jones@...aro.org>,
        linux-input@...r.kernel.org
Subject: Re: [PATCH v5 05/20] Input: axp20x-pek: Bail out if AXP has no
 interrupt line connected

On Thu, 28 Jan 2021 11:36:01 +0000
Mark Brown <broonie@...nel.org> wrote:

> On Thu, Jan 28, 2021 at 11:11:28AM +0000, Andre Przywara wrote:
> > Dmitry Torokhov <dmitry.torokhov@...il.com> wrote:  
> > > On Wed, Jan 27, 2021 at 05:24:45PM +0000, Andre Przywara wrote:  
> 
> > > > Check for the regmap_irqc member to be not NULL before proceeding with
> > > > probe. This gets normally filled by the call to regmap_add_irq_chip(),
> > > > which we allow to skip now, when the DT node lacks an interrupt
> > > > property.    
> 
> It sounds like you're trying to register an IRQ chip with a somehow
> bogus configuration?

Quick background: Those AXP PMICs have an IRQ pin, that was always
connected to the NMI pin on Allwinner SoCs. This was used for the power
button GPIO interrupt. Now the H616 does not have this pin anymore, and
the board does not use a GPIO either.
I patched the AXP MFD driver [1] to skip the regmap-irq creation when no
interrupts DT property was found, but this NULL pointer now
understandably confuses the -pek driver, and leads to this crash:

http://lists.infradead.org/pipermail/linux-arm-kernel/2021-January/634969.html

Hence I wanted to plug this hole, which seems useful regardless of this
particular issue.

[1]
http://lists.infradead.org/pipermail/linux-arm-kernel/2021-January/634971.html

> > > No, the driver is not the right place to patch this; regmap should be
> > > fixed so it does not crash instead.  
> 
> > I am not sure this is the right approach, those regmap functions look
> > more like an internal interface to me, with lots of wrapper functions
> > happily dereferencing pointers and reaching into structs. Moving
> > NULL checks into those does not sound like the right thing. CC:ing Mark
> > for more opinions on this.  
> 
> Without having seen the actual issue if you're trying to register an
> interrupt controller with a known broken hardware configuration that
> does seem like something the caller just shouldn't be doing, it's not
> something that's going to transiently happen at runtime and we're very
> much trusting that the caller got things right.
> 
> > A more general solution would be to not instantiate this driver here
> > at all, when we don't have an interrupt line.
> > However at the moment the AXP MFD driver uses a const struct to hold
> > all MFD cells, so there is no easy way of omitting the power key
> > device dynamically. And even then it would hard code the requirement
> > for an interrupt into the MFD driver, when this could be considered an
> > implementation detail of the axp20x-pek driver.  
> 
> Another approach is to just register the optional device separately.

I will have a look at how much this takes.

Thanks,
Andre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ