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=1796049080; b=zNbdgvwiUCGv3xTBk4EvNSb9CHZRAzjqgZgBmrjPclVYEidv3wKESjiPSUwTQHruKw5d bZU2ICZqqP59jV7wlVx/vQG8t9DDQo05NdJMZN2xu/jWRlNY/omCjxlh+4sZo5BG6AgII S4NYcDhyxe5VjgJHo4dihjS4cZP38nSWPYa8TCnk1lqvuKSp37wtnPUjf5NpJY8T+eaNZ WX+e0SxeZ6kmzLjV5iP9V2j8vBzLuSL39x/VrB+XW4MJvP5Ax06HMBkU5vjrB/RjSp7ET ZROhpk6VMcJuMmnYH7WgI8VIoV976Gg6w+VMj6sS1tXi5R/WesS3Iy825gXJIh7DqiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796049080; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=B3FO3BbaOKx/awtfTkYikrOrIGG7Vxt4Wh8L+06Lh8M=; b=3sYjKbWPRhLeyRBohWd7uTpgiCfFG2lHpH52VjfqNRTfpKdfMjwQNtBbd93w+qzfngkA gGwKgqglTTpDRivu54hMlv40xx1GX/v1hXf9eky+gcuQh9ZEzDmOmrcNbElu5D/fOSsVZ 3z7MpzLyced8MuUtSd/XMSHeAxsINZphKvC8BWKGaFEiy4+VrwCQz2X4I7LM5TFjC7Xog xwTEdSFTvNycD8cjAXLTajbzkDzubftWp1FNeTbeG+zvDk8VWs6+DTa2lrKaUDO9jH1H+ iiN6IhqxjCIocpEqK/I0R3GdopdL4dPDqDR5dcJ3X3wLEfCIQczljTinEArl+59MnDA== 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=AFuj3fXi; 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 B2FE6606A320 for ; Mon, 30 Nov 2026 14:31:20 +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=AFuj3fXi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 340E81F00896; Mon, 30 Nov 2026 14:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796049080; bh=B3FO3BbaOKx/awtfTkYikrOrIGG7Vxt4Wh8L+06Lh8M=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=AFuj3fXi8lldLUy22wzXIKutl3lhXCdnCgNNS7HaXwjCWAs47unkqdO6uHnwX0kjz eQCJU55IngSms0bFp+xjGmMCFPq/1rRkhir7OMGSRVivNYL9tkAwvdVHhPci4RdQ9T 0lgKyEUWhBUz60ilWyd4G4Xdskybl9aea1VTXRcJW/cP08Kd1WB2cHojzRitOwL8X2 CQoVM9UCKyTDImgzbp3MQrAlhYcze9eqY02fK3wEYxnrJqsXOJPhrAr8AfaKG0ZEgC 9UA8UbL6FDZQNVtYcbpN0lk60GAvesXNzOHjyg7SO4XViPeQtEByeGYrtX2S6DrvJH u4h4c95hB1o/g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] USB: hso: fix skb leak on device close and teardown Reply-To: sashiko-reviews@lists.linux.dev To: zhengzongmin , linux-usb@vger.kernel.org In-Reply-To: <6b0c372a.1800fd7e.25977e.57fb@mx.google.com> References: <6b0c372a.1800fd7e.25977e.57fb@mx.google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 14:31:19 +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 2 potential issues to consider: - [High] USB: hso: race between hso_net_close() and hso_resume() on skb_tx_buf - [Low] USB: hso: missing Fixes trailer for skb_tx_buf leak fix -- commit 3d6f9f23f19489f009b13c37018dd2945051ad93 Author: zhengzongmin > USB: hso: fix skb leak on device close and teardown > > hso_net_start_xmit() stashes an outgoing skb in odev->skb_tx_buf when > hso_get_activity() returns -EAGAIN. Neither hso_net_close() nor > hso_free_net_device() frees that skb, so when the device is brought > down or disconnected before it resumes, the skb and its head buffer > are permanently leaked. syzbot hit this with an IPv6 Router > Solicitation packet allocated by ndisc_send_rs(). > > Free the stashed skb in both paths. dev_kfree_skb() is NULL-safe, so > no extra check is needed, and clear the pointer afterwards. > > Reported-by: syzbot+bf62ca9997f43d2fa521@syzkaller.appspotmail.com > Signed-off-by: zhengzongmin [Severity: Low] Should this bug fix include a Fixes: tag for the commit that introduced skb_tx_buf stashing: Fixes: 72dc1c096c70 ("HSO: add option hso driver") > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c > index 71caa3764b239..2f46d51269d0a 100644 > --- a/drivers/net/usb/hso.c > +++ b/drivers/net/usb/hso.c > @@ -726,6 +726,11 @@ static int hso_net_close(struct net_device *net) > /* no longer running */ > clear_bit(HSO_NET_RUNNING, &odev->flags); > =20 > + /* Release a packet stashed by hso_net_start_xmit() when the device > + * was busy. Otherwise it leaks when the device is brought down. */ > + dev_kfree_skb(odev->skb_tx_buf); > + odev->skb_tx_buf =3D NULL; [Severity: High] Can freeing odev->skb_tx_buf here race with hso_resume() and cause a use-after-free and double free? When hso_get_activity() returns -EAGAIN during transmit, it schedules async_get_intf to resume the USB interface. hso_resume() runs under the USB device PM lock without holding rtnl_lock or any lock shared with hso_net_close(), and only clears skb_tx_buf after hso_net_start_xmit() has transmitted and freed it: drivers/net/usb/hso.c:hso_resume() { ... if (hso_net->flags & IFF_UP) { /* First transmit any lingering data, then restart the device. */ if (hso_net->skb_tx_buf) { dev_dbg(&iface->dev, "Transmitting" " lingering data\n"); hso_net_start_xmit(hso_net->skb_tx_buf, hso_net->net); hso_net->skb_tx_buf =3D NULL; } ... } If the interface is brought down while async_get_intf (or system resume) is running hso_resume(), both paths can consume the same skb: CPU0 CPU1 (kworker / async_get_intf) hso_resume() if (hso_net->flags & IFF_UP) skb =3D hso_net->skb_tx_buf hso_net_close() clear_bit(HSO_NET_RUNNING, ...) dev_kfree_skb(odev->skb_tx_buf) odev->skb_tx_buf =3D NULL hso_net_start_xmit(skb, ...) memcpy(..., skb->data, skb->len) <-- use-after-free dev_kfree_skb(skb) <-- double free --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/6b0c372a.1800fd7e.2= 5977e.57fb@mx.google.com?part=3D1