On Mon, Mar 08, 2021 at 07:18:39PM +0100, Lukas Wunner wrote: > On Mon, Mar 08, 2021 at 02:11:01PM +0000, Mark Brown wrote: > > 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. For stuff like this I'd rather the code were obviously correct rather than having to think about it, dereferencing the struct is the most obvious thing but there's also the possibility that we cause something else to happen which explodes on us, or that someone later modifies the code in a way that introduces an issue. It does look safe right now but the whole implicitly managed asynchronous code thing always makes me nervous.
Attachment:
signature.asc
Description: PGP signature