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: <20191015091642.6f49dd8f@cakuba.netronome.com>
Date:   Tue, 15 Oct 2019 09:16:42 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Lars Poeschel <poeschel@...onage.de>
Cc:     Jilayne Lovejoy <opensource@...ayne.com>,
        Kate Stewart <kstewart@...uxfoundation.org>,
        Allison Randal <allison@...utok.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Steve Winslow <swinslow@...il.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Johan Hovold <johan@...nel.org>,
        "open list:NFC SUBSYSTEM" <netdev@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        Claudiu Beznea <Claudiu.Beznea@...rochip.com>
Subject: Re: [PATCH v9 4/7] nfc: pn533: Split pn533 init & nfc_register

On Tue, 15 Oct 2019 11:51:24 +0200, Lars Poeschel wrote:
> > > -	priv->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols,
> > > -					   priv->ops->tx_header_len +
> > > -					   PN533_CMD_DATAEXCH_HEAD_LEN,
> > > -					   priv->ops->tx_tail_len);
> > > -	if (!priv->nfc_dev) {
> > > -		rc = -ENOMEM;
> > > -		goto destroy_wq;
> > > -	}
> > > -
> > > -	nfc_set_parent_dev(priv->nfc_dev, parent);
> > > -	nfc_set_drvdata(priv->nfc_dev, priv);
> > > -
> > > -	rc = nfc_register_device(priv->nfc_dev);
> > > -	if (rc)
> > > -		goto free_nfc_dev;  
> > 
> > Aren't you moving too much out of here? Looking at commit 32ecc75ded72
> > ("NFC: pn533: change order operations in dev registation") it seems like
> > IRQ handler may want to access the data structures, do this change not
> > reintroduce the problem?  
> 
> Yes, you are right, there could be a problem if an irq gets served
> before the driver is registered to the nfc subsystem.
> Well, but the purpose of this patch is exactly that: Prevent use of nfc
> subsystem before the chip is fully initialized.
> To address this, I would not change the part above, but move the
> request_threaded_irq to the very bottom in pn533_i2c_probe, after the
> call to pn53x_register_nfc. So it is not possible to use nfc before the
> chip is initialized and irqs don't get served before the driver is
> registered to nfc subsystem.
> Thank you for this!
> I will include this in v10 of the patchset.

You can run nfc_allocate_device() etc. early, then allocate the IRQ,
and then run nfc_register_device(), would that work? Is that what you
have in mind?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ