🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5167

Re: [PATCH net] hinic3: bound the Rx fragment count to MAX_SKB_FRAGS

#5167
From: Sebastian Andrzej Siewior
Date: Mon, 19 Oct 2026 22:13
46 lines
11438 bytes
On 2026-10-19 09:10:37 [+0900], Yehyeong Lee wrote:
> Thanks for the review.
> 
> A well-behaved device can't reach it. rx_buf_len is fixed at 2048
> regardless of MTU, so the frag count is ceil(pkt_len / 2048): a max-MTU
> frame (9600) is 5 frags, and LRO -- off by default, capped at 32K when
> enabled -- is at most 16, both below the 17 the array holds. Only the
> 16-bit length field in the completion descriptor (RQ_CQE_SGE_LEN_MASK)
> lets a device claim up to 65535 bytes, i.e. 32 frags. So it takes a
> device reporting a bogus length, i.e. broken or malicious firmware,
> which is why I treated it as a robustness fix -- I should have said so
> in the changelog.

If this is something that in general opinion never can be reached then
it might be something to target net-next and not net looking like a fix.

> I found it by code inspection, not in the field, and I don't have a
> hinic3 card, so it's untested on real hardware; I reproduced it by
> injecting an out-of-range length to get the KASAN splat in the
> changelog. The netdev bot asked for these same two things, so this
> answers it as well.

I see. That KASAN splat makes it look like something that was really
reproduced. I assumed jumbo frames and aggregation at HW level.
Just because a field is 16 bit wide, it does not mean the hardware will
utilise all its fields. 

> You're right that the bare drop is unhelpful. It only surfaces as
> rx_dropped via ndo_get_stats64, not in ethtool -S -- hinic3 has no
> get_ethtool_stats, and the stats series in net-next doesn't export
> dropped either. I'm happy to add a net_warn_ratelimited() on the
> discard path in v2; it only fires for a misbehaving device, so it won't
> spam a healthy system. Let me know if you'd like that.

I would suggest to target net-next if this can not be reached and is
just there to address a possible overflow. Maybe a warning if it was
reached after all. Fan has probably an opinion here.

> For reference, eea does the same thing -- it drops once nr_frags
> reaches MAX_SKB_FRAGS.
> 
> Thanks,
> Yehyeong

Sebastian
Technical Details
Message-ID: <20261019221306.d6dfPY_y@linutronix.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348870-linux-kernel-netdev=dewy.ru
References: <20261010030901.1712792-1-yhlee@isslab.korea.ac.kr> <20261018170531.bILLh5Zw@linutronix.de> <20261019001037.3496843-1-yhlee@isslab.korea.ac.kr>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348870-linux-kernel-netdev=dewy.ru
From: bigeasy@linutronix.de (Sebastian Andrzej Siewior)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] hinic3: bound the Rx fragment count to MAX_SKB_FRAGS
Date: Tue, 20 Oct 2026 00:13:06 +0200
Organization: Usenet Network
Message-ID: <20261019221306.d6dfPY_y@linutronix.de>
References: <20261010030901.1712792-1-yhlee@isslab.korea.ac.kr>
 <20261018170531.bILLh5Zw@linutronix.de>
 <20261019001037.3496843-1-yhlee@isslab.korea.ac.kr>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="3727763"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:p8FWAXXsqhkOjkioB/Jj6MfKB6M= sha256:dXoxyAWlTRQ7SltHaPDXflJD6abHD2zASHi6j9SXTBk=
	sha1:AfoI4zONw+zPHzA5h1if+NdIdA8= sha256:q7O9C1FTHb1BG638wiMNQ3RLhRfb321QfE+Zymw5Mik=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id CA408110B4A; Tue, 20 Oct 2026 01:15:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=linutronix.de header.b=mk6XQCdT; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=linutronix.de header.b=vq2PLd9b
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id FuSYgTDInF3X;
	Tue, 20 Oct 2026 01:15:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-348870-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linutronix.de
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 86AC1110B59; Tue, 20 Oct 2026 01:15:04 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id DFC6F3DD3A; Mon, 19 Oct 2026 22:13:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792447998;
	b=FMs4G60pPMowXwWtufFshmRrk33HiNrWeMf5z8RK4aPkMuEhM7UU9wsj6KPi3ex43GyV
	 hlkudxA600DlZ9wgjvERQCkZMVvCw8yfSdp6feo9wtxqBLdZRWWsbX2+t6ve/gF/Mzr3s
	 8qupzt7fAYcb82La2Gf5CXMvPpk2B+P0uX5up+IU53Vi8e97WeL81S8QXgx8T+01hdYZc
	 rWLEKF8JCby3ScvpnzsdImVsSN+PotnEBHZF3NFjcY0nhM4KIXWiPOdLSOJgM1b8vSEpZ
	 cbuYu8IZIA6fTq7WW+fwt23tZRWnl2RiBeHoHkLFiHSoSCbIDZQ79+joLR3o/uk9EzQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792447998;
	h=X-Original-To:Received:DMARC-Filter:Date:DKIM-Signature:
	 DKIM-Signature:From:To:Cc:Subject:Message-ID:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=tEkPMBUY3is8qUNhwEjXM/7z4i29Jmc9M5lXhnaOsa4=;
	b=yXZDfRol8CgDs6phUhTgUP3dgMgZkimfA1tnjexoFtCGT5tU3KKUvLlSOw+Z3GcxkyTY
	 SJj8/Fmv7JA2MaRpXEJ57kMBZ3C8aD+0Ah4CRV6ixjQRRlHtIRwJjDNXJRpe3sLmp/Uiz
	 /fmyguD3EYcVWeetTDrWy/ikeTgi8kBYSwXc3kgucrN8XogDTyHyxYFaBQKl8r17xCepq
	 2v8zhRLCFNHrGcykCzGKmU3TQv9CshbZKrImtZbiHbi1NycyN7dWNns5KeOgqQcqs/kDu
	 F7Tv7vW2W9cIKvY1vv4Lma8CY7UoV8+2hAcApG1fybicqbzq4jBxVzMpzUyecyhxWGQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=mk6XQCdT;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=vq2PLd9b;
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A3EB2606A336;
	Mon, 19 Oct 2026 22:13:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=mk6XQCdT;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=vq2PLd9b
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792447990;
	b=dF0rOiMuLvzLFPTX0WIoCYPgq74U9NfV77mnI8gCGQzcGLeZIOCorxvEoz0PfLjeAMUM
	 VHQ3B/zKuT3yp5O2HvHo/UOgpYStzpox8p+TMXJ+3aqSfzRCEM3dQ8mxmhm1mFw1THmL0
	 tFopLWu35Sk90uZ1RtP7/1A/MpuBnNvtvpAjc17zegDG6ucPu3Dqvdt0OJ0K2EnUH+7vl
	 49hSMj8pB/aNy5KVsVowGIQDXgFNLEL/dX6d0YCcqdzqPvUo8fcfnh2m+a9CeaxjjxM1S
	 PcokTohrX3QYJlzpHacZnSdtpwgMC97BmHgOogE+43jMqkh1oaa4YWUin1AgQnlfIJA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792447990;
	h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=tEkPMBUY3is8qUNhwEjXM/7z4i29Jmc9M5lXhnaOsa4=;
	b=ZO7rdULt3TlpvQQO+FbdABAsujhc2xhKu9D8av6wk5rsA0OFSELYPPOoJrXffFjMeqTO
	 RCMccR/wv0EDw8V5PpxULPkaFx3TDhwhC5aU0gyDSWAQuZL7rXPdihE/Yy0XrGDVsvmcD
	 50WZAs7H8HTCEpqYKtZault+IWsMfmzjldVsgZnsEnAisi8J/i576I/d5LpO2sJMhp15J
	 smmYqUp9/bJu9+hQmqOLrO3k38X4hY44GvVIk+GpCN5Pp+d//c4XBX4tPnAhK3miTQkIS
	 t2ApLXjI/OZc6ZjpbiiFJemLPVvIBHTUP2nsdQiTBF3OyTnUP5gbtwSH41XmyDNn2LA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=mk6XQCdT;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=vq2PLd9b;
	arc=none smtp.remote-ip=193.142.43.55
X-Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB298606A319;
	Mon, 19 Oct 2026 22:13:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EB298606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020; t=1792447987;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=tEkPMBUY3is8qUNhwEjXM/7z4i29Jmc9M5lXhnaOsa4=;
	b=mk6XQCdTNAxu6g/VChpbVZiDbwQxr79w6PQbjG/TSiGsIjS8+RmIlhpTRPOaNhFPof0c2U
	0CUqCfRgiKlQwYblxS+w/nOio0BuX5L3WhMsYR3RJjyQspFToSxw2BeysUFRbAVyfMlyOs
	sqBkpUegZ2CM2qnp26TeyTXG5fLctLzBUCR0zXtF76BCkHP62r0QKlvcYZ7y71sg8s+U8D
	w2CmoCYxUfJ91IAZB6V2d4tKjEvYoTb7Cbhf8ahx9I13zG1h1dU0yv14+RNm+JyYL2eIKj
	Mg3tvI9hn05eHabMYiueK8HxXov1eysIHU1wORoiYsn30Fo2hsE+NSFa70NaRg==
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020e; t=1792447987;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=tEkPMBUY3is8qUNhwEjXM/7z4i29Jmc9M5lXhnaOsa4=;
	b=vq2PLd9bEIj+nT29+S4J+T1fZznn4lc+TS86Lef4i197NXqVZxYH/i35vn1xXikqrFpMOo
	pNVQuASl8pfeJrAA==
X-Cc: Fan Gong <gongfan1@huawei.com>, netdev@vger.kernel.org,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Xin Guo <guoxin09@huawei.com>, Gur Stavi <gur.stavi@huawei.com>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261019001037.3496843-1-yhlee@isslab.korea.ac.kr>