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=1796041562; b=HjZzmnEkz1YoauWqmFZmmrS4XbbgxbVvjAire70otJnNv24h9KUp5LO0a82heV6z/Kj8 7J8EVWlRFI02pSwlM+0RkrPxB7SFcunL17WUJVMok+qdmsZp+Us14jznjNek8qEJprEbc 9SNheD1czK9qmBWBoa+5RJYXeNBPa5K9sKzpMSuo2v6a1U5Qs4DzuutKifB5+q5hkMCnj +DesfFSAzwWOcrC6f9y/uxNuF+Z8kACELkDvdipjrbLsgiY5V87fz8+kDyU9wUa+kH8I8 09tp2CzC9jg1KZ42V5jIMgE3jLdtOJ4WKxVend4csfOHjtZV2CmJ3gJmziXhXfRE8tg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796041562; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=UqoVUh3HvOwK32U9awmoDa0bdap5UT79uLMJRXAJ4Wo=; b=icFQcum49kqjiydqMsJ2XUxyroEq84T3CXDrPrW7Uw0UcmBd6Y1SDKFDcuzOraVftA+f 7BKlk921JWj055Qw/Wy763bDTX/yWq/K3of5/tA5oB5Dgyf6HSYo3/2Hj+ZhJrRKo114+ E/IHZcfyP/1nkRzKk/VCwCdjKedIpHmfeYbs1UbUowd1gBSSykhbx9x2z9w/S5w8ONlN/ uFN+NoNlhTuJmCWD5GeV50ptqzaN5xUIcanhD/ZJmDPqMbuWazOA9pulwViIlmJ7nMVNE eLTF4sRWej5aBSgxPESRJNuid2TU2XXiAHeWMYNWy1oa5/R0O9k/bFs1rPws+son/xw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TlmwhJ7I; 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 8048E606A320 for ; Mon, 30 Nov 2026 12:26:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TlmwhJ7I Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC5901F0089A; Mon, 30 Nov 2026 12:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796041561; bh=UqoVUh3HvOwK32U9awmoDa0bdap5UT79uLMJRXAJ4Wo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=TlmwhJ7ImMk+7EAMjrOYTTp7EbK4AZszJK3P1TwGm3gZpZkQYP/VdMCahToTZdDD6 L00v/sEBEbaadbNRfo5sxGuGenGg5SRTEyLDWoyyWwYlsviZKlf+y7A63zIsNu95Pz RkXery9tepP+pkSH1+0JROgAf7NgaDXVN/ArncruGumBNAQoMzwWaHS4cIu/iXWvMu Ff6oF+M3R31dtex0SzpMhbe6HkKJ2XzxlhIhml4XlPLseDcB4fLDEC5uYZ8qP01usw RpCYyjrzCg7w0L6KOBpMsSoPLMjy1Rf0sqNWnvXvO0QgflrzCQriXdJVBaKkCaEp8R HnThiaP5L3XyA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/3] USB: serial: kobil_sct: serialize concurrent writes Reply-To: sashiko-reviews@lists.linux.dev To: "YuanZhe Liu" <25031212351@stu.xidian.edu.cn> Cc: linux-usb@vger.kernel.org In-Reply-To: <20261130120548.8509-3-25031212351@stu.xidian.edu.cn> References: <20261130120548.8509-1-25031212351@stu.xidian.edu.cn> <20261130120548.8509-3-25031212351@stu.xidian.edu.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 12:25:58 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] USB: serial: kobil_sct: uninitialized priv->sending in kobil_port_probe() -- commit 2fcc2a6c5514be5945d43741a898bd74daec0c68 Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn> USB: serial: kobil_sct: serialize concurrent writes This commit adds a spinlock and a sending flag to struct kobil_private to serialize access to the transmit buffer in kobil_write() and kobil_write_room(). > diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sc= t.c > index f1c3b53c264f2..aa4170ba36763 100644 > --- a/drivers/usb/serial/kobil_sct.c > +++ b/drivers/usb/serial/kobil_sct.c > @@ -106,6 +106,8 @@ struct kobil_private { > int cur_pos; /* index of the next char to send in buf */ > __u16 device_type; > struct completion write_done; > + spinlock_t lock; /* protects the transmit buffer state */ > + bool sending; > }; > =20 > static int kobil_ctrl_send(struct usb_serial_port *port, u8 req, u16 val) > @@ -137,6 +139,7 @@ static int kobil_port_probe(struct usb_serial_port *p= ort) > priv->cur_pos =3D 0; > priv->device_type =3D le16_to_cpu(serial->dev->descriptor.idProduct); > init_completion(&priv->write_done); > + spin_lock_init(&priv->lock); [Severity: High] Is priv->sending left uninitialized here? kobil_port_probe() allocates priv with kmalloc_obj(), which does not zero memory. If the uninitialized byte backing priv->sending is non-zero, kobil_write() and kobil_write_room() always see priv->sending as true and return 0 without ever reaching the path that clears it, wedging all transmissions on the port. A later patch in this series, commit "USB: serial: kobil_sct: move block transmission to a work queue", initializes priv->sending in kobil_open(), though kobil_port_probe() still leaves it uninitialized after kmalloc_obj(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130120548.8509= -1-25031212351@stu.xidian.edu.cn?part=3D2