Re: [PATCH] spi: Add HiSilicon SPI controller driver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 08, 2021 at 02:11:01PM +0000, Mark Brown wrote:
> On Sun, Mar 07, 2021 at 03:43:13PM +0100, Lukas Wunner wrote:
> > Transfers may still be ongoing until spi_unregister_controller() returns.
> > (It's called from devres_release_all() in this case.)  Since the IRQ is
> > presumably necessary to handle those transfers, freeing the IRQ after
> > unregistering is actually correct.  So the code looks fine in principle.
> > However, because the IRQ is requested with IRQF_SHARED, the handler may
> > be invoked at any time, even after the controller has been unregistered.
> > It is therefore necessary to quiesce the SPI controller's interrupt on
> > unregistering and it is also necessary to check in the IRQ handler whether
> > an interrupt is actually pending (and bail out if not).
> 
> It's also important and even more of a concern that even if there is a
> valid interrupt the handler doesn't try to use structures that might
> have been deallocated before the handler uses it as this controller
> does, that will segfault which is more serious.

At least struct spi_controller and struct hisi_spi are allocated with
devm_*() before the call to devm_request_irq(), hence those two
are always accessible from the IRQ handler AFAICS.

Thanks,

Lukas



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux