From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Johan Hovold <johan@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Bin Yu <byu@xidian.edu.cn>,
Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH] USB: serial: f81534: fix write urb reuse while still in flight
Date: Mon, 30 Nov 2026 11:19:14 +0100 [thread overview]
Message-ID: <2026113058-strum-bloomers-fdcf@gregkh> (raw)
In-Reply-To: <20261130090037.24537-1-25031212351@stu.xidian.edu.cn>
On Mon, Nov 30, 2026 at 05:00:37PM +0800, YuanZhe Liu wrote:
> The driver uses the device's TX_EMPTY notification as the only gate for
> reusing the single bulk-out urb. That notification only tells that the
> device transmitter has drained; it does not guarantee that the host has
> retired the previous transfer, which is completed asynchronously.
>
> When a TX_EMPTY block is received while the tty layer is submitting the
> next transfer, the block is parsed in the bulk-in completion handler and
> f81534_submit_writer() submits the same urb again:
>
> URB 00000000f03a9f3b submitted while active
> WARNING: drivers/usb/core/urb.c:379 at usb_submit_urb
> ...
> f81534_submit_writer
> f81534_process_read_urb
> ...
> f81534_submit_writer
> f81534_write
>
> usb_submit_urb() rejects the urb with -EBUSY and the transfer buffer is
> rewritten while the controller may still be using it.
>
> Track whether the write urb is in flight and only reuse it after the
> completion handler has run. A TX_EMPTY notification received while a
> transfer is pending is kept and the completion handler submits the next
> transfer as soon as the urb is available.
>
> Fixes: 0c9bd6004d25 ("USB: serial: add Fintek F81532/534 driver")
> Cc: stable@vger.kernel.org
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
> ---
> drivers/usb/serial/f81534.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c
> index 8fc60c4d6166..13bd29d5075b 100644
> --- a/drivers/usb/serial/f81534.c
> +++ b/drivers/usb/serial/f81534.c
> @@ -159,6 +159,7 @@ struct f81534_port_private {
> struct work_struct lsr_work;
> struct usb_serial_port *port;
> unsigned long tx_empty;
> + unsigned long write_urb_active;
Why are you using an unsigned long for a boolean flag?
LLMs are dumb auto-word-generators, please use your judgement when
reviewing their output, this shows it was not reviewed :(
And LLMs _love_ adding new boolean flags, be very sure that this is the
only solution for this "problem" before proposing it again. Odds are,
based on what we have seen for kernel-output from these tools, it's
almost always not the proper solution (i.e. they can deduce state easy
from this type of change, when the real solution is a logic change
instead.)
good luck!
greg k-h
prev parent reply other threads:[~2026-11-30 10:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:00 [PATCH] USB: serial: f81534: fix write urb reuse while still in flight YuanZhe Liu
2026-11-30 9:20 ` sashiko-bot
2026-11-30 10:19 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026113058-strum-bloomers-fdcf@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=25031212351@stu.xidian.edu.cn \
--cc=byu@xidian.edu.cn \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wencheng@xidian.edu.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox