Re: [PATCH v2 1/2] nfc: pn533: complete failed queued commands and keep queue moving

From: Simon Horman

Date: Wed Oct 28 2026 - 11:46:52 EST


On Tue, Oct 27, 2026 at 03:01:34PM +0800, Zhao Feng wrote:
> When pn533_wq_cmd() fails to send a queued command it silently drops
> it: the completion callback is never called, cmd_pending stays set and
> cmd_work is never rescheduled. As a result:
>
> - a synchronous caller sleeps forever in pn533_send_cmd_sync()'s
> wait_for_completion();
> - an asynchronous caller is never completed, leaking its callback
> context (e.g. struct pn533_data_exchange_arg, and the sock_hold()
> reference for rawsock);
> - cmd_pending stuck at 1 makes every later command queue up without
> ever being sent, freezing the device until unbind.
>
> The broken error path is as old as the command queue, but it used to
> require an URB submission error to trigger; a device that stalls the
> OUT endpoint reaches it via the send timeout added by the next patch.
>
> Call the command's completion callback with the error and reschedule
> cmd_work (unless the callback chained a direct command by returning
> -EINPROGRESS) so that every queued command completes with an error and
> the queue drains instead of freezing.
>
> Signed-off-by: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>

I think this patch also warrants a Fixes tag.

I don't think it's necessary to repost just to address that,
rather you can just respond to this email with the appropriate tag.

Also, I note that this patch did not apply cleanly (using git am)
and thus the CI did not run. I think this is due to minor fuzz -
git am is very fussy about that. I am unsure if there is value in
reposting to address that.

I've looked over the review of v1 and the updates made in v2.
And overall this looks good to me.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>