Re: [PATCH net-next 1/2] nfc: s3fwrn5: fix order of freeing resources

From: Dmitry Torokhov
Date: Thu Sep 29 2022 - 03:37:22 EST


On September 29, 2022 12:27:19 AM PDT, Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:
>On 29/09/2022 09:26, Krzysztof Kozlowski wrote:
>> On 29/09/2022 07:04, Dmitry Torokhov wrote:
>>> Caution needs to be exercised when mixing together regular and managed
>>> resources. In case of this driver devm_request_threaded_irq() should
>>> not be used, because it will result in the interrupt being freed too
>>> late, and there being a chance that it fires up at an inopportune
>>> moment and reference already freed data structures.
>>
>> Non-devm was so far recommended only for IRQF_SHARED, not for regular
>> ones.

If we are absolutely sure there is no possibility of interrupts firing then devm
should be ok, but it is much safer not to use it. Or use custom devm actions
to free non-managed resources.

>> Otherwise you have to fix half of Linux kernel drivers...

Yes, if they are doing the wrong thing.

>> why is s3fwrn5 special?
>>

I simply happened to look at it.

>
>> Please use scripts/get_maintainers.pl to Cc also netdev folks.
>
>Ah, they are not printed for NFC drivers. So never mind last comment.
>
>Best regards,
>Krzysztof
>

Thanks.

--
Dmitry