Re: [PATCH v2] net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write

From: Krzysztof Kozlowski

Date: Thu Dec 18 2025 - 10:54:48 EST


On 18/12/2025 02:23, Deepanshu Kartikey wrote:
> A deadlock can occur between nfc_unregister_device() and rfkill_fop_write()
> due to lock ordering inversion between device_lock and rfkill_global_mutex.
>
> The problematic lock order is:
>
> Thread A (rfkill_fop_write):
> rfkill_fop_write()
> mutex_lock(&rfkill_global_mutex)
> rfkill_set_block()
> nfc_rfkill_set_block()
> nfc_dev_down()
> device_lock(&dev->dev) <- waits for device_lock
>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

Best regards,
Krzysztof