From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796033957; b=zsyhNkl+HJoYaJWxXdflydt2zC1Dlje3rCDszpVruYjKG9BTP96drVzI35kKIcJTeKFg 4z/lE/dgsiXJlLn87OGwm961eU7xLIDO+dawP7gOBto+KdrSk4b/CkFXx09lZ3RsZZLpV +BYlJLzLZM4fz3s9jLM7AnrZdM1jU/Zf3T9Ghtu2JRNneTqHx1/PH8EtNnae7W7L81jWu cSVE40smc9MGJuCfBRQPRVd3XdZucmjlZT2O13AqLgi4R6meGfKVc2SRwWOwsY9OoypwE LckWx2k5vmpUfx26KZNjliKgZeI9P6AnV1ZFZKvUT1VoKx2iaOaBq4LB0LlN/8h7MUA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796033957; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=XdOo8kXwo1crPCqhQs1cUxeWKsxAQb+A0U8/a0fFkRw=; b=BfCss4MXHzWPg8vf5T7+T3TyAuXSIRkJ1buhpg4eJAMkwcogKp8u4qELufAF6ydSSZLe vofbseHMX50SEXS8QNPx4BgvKWvF+YAGl21ardDOEL9dkcv5eLRerUwRi5/sKSv/aYl9b JwklNlDitAd8d28XvOLCcvrfr9D8phSOIo+X0M3DLWjKAkdNh92rm1mcbdrF/b2CmLnmJ 9Ze1ksf93EQverZQqQkR1hvSK+xemaFSi6yqzvkZg50p8fq2DxK/+MJsejGXxjHUS5/GE bc17kgF276U52+QWHPoblJuPh3eRImYdvjiZIJAHCIte9yQc+Dx++EdCPu+Lgx9RY7w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=g4nu33sS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99E3C606A31C; Mon, 30 Nov 2026 10:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=g4nu33sS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D9A01F008A0; Mon, 30 Nov 2026 10:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796033956; bh=XdOo8kXwo1crPCqhQs1cUxeWKsxAQb+A0U8/a0fFkRw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=g4nu33sSm6CghSAvnbYsoO5K14w0kmx20np4FPNWRi/Gnk7RPBZmm3kKoC8zohP9a Picmni9SRxruxWTcAOchmRFvACP43knd+u0T1XXds+vs/UfcDbNC57SRJwGD1QQZw1 AhJo3D9NIpBo6eZUwzxIxH7xMkB5G2XoigMq+VHM= Date: Mon, 30 Nov 2026 11:19:14 +0100 From: Greg Kroah-Hartman To: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Bin Yu , Cheng Wen Subject: Re: [PATCH] USB: serial: f81534: fix write urb reuse while still in flight Message-ID: <2026113058-strum-bloomers-fdcf@gregkh> References: <20261130090037.24537-1-25031212351@stu.xidian.edu.cn> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > Signed-off-by: Bin Yu > Co-developed-by: Cheng Wen > Signed-off-by: Cheng Wen > 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