🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26235

[PATCH net v3 7/7] net/smc: skip the urgent byte when it is the next unread byte

#26235
From: Bryam Vargas via B4 Relay
Date: Thu, 03 Dec 2026 09:15
73 lines
13410 bytes
From: Bryam Vargas <hexlabsecurity@proton.me>

recv(MSG_OOB) returns the urgent byte and relies on
smc_rx_update_consumer() to skip the byte's place in the RMB.
recv(MSG_OOB) asks for that skip by setting urg_rx_skip_pend, but only
when there is unread data in front of the byte. When the urgent byte is
the next unread byte, e.g. after a one-byte send(MSG_OOB) to a reader
that has read everything else, no skip is pending and urg_state is
SMC_URG_READ: the byte is never skipped, and the sender, which waits
for its urgent data to be consumed, stalls on its next send(). A
zero-length recv(MSG_OOB) consumes the byte as well, but neither sets
urg_rx_skip_pend nor calls smc_rx_update_consumer().

Set urg_rx_skip_pend whenever the reader has not passed the urgent
byte, and call smc_rx_update_consumer() for any length.

Fixes: de8474eb9d50 ("net/smc: urgent data support")
Suggested-by: Sidraya Jayagond <sidraya@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
---
 net/smc/smc_rx.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 2680b91e882b..579ee008900c 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -342,12 +342,14 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,
 	valid = conn->urg_state == SMC_URG_VALID;
 	if (valid) {
 		byte = conn->urg_rx_byte;
-		if (len > 0) {
-			smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn);
-			if (smc_curs_sdiff(conn->rmb_desc->len, &cons,
-					   &conn->urg_curs) > 1)
-				conn->urg_rx_skip_pend = true;
-		}
+		/* The reader has not passed the urgent byte: have
+		 * smc_rx_update_consumer() skip it once it is the next
+		 * unread byte.
+		 */
+		smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn);
+		if (smc_curs_sdiff(conn->rmb_desc->len, &cons,
+				   &conn->urg_curs) > 0)
+			conn->urg_rx_skip_pend = true;
 		if (!(flags & MSG_PEEK))
 			conn->urg_state = SMC_URG_READ;
 	}
@@ -362,14 +364,14 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,
 		if (!(flags & MSG_TRUNC))
 			rc = memcpy_to_msg(msg, &byte, 1);
 		len = 1;
-		/* Urgent Byte was already accounted for, but trigger
-		 * skipping the urgent byte in non-inline case
-		 */
-		if (!(flags & MSG_PEEK))
-			smc_rx_update_consumer(smc, cons, 0);
 	} else {
 		msg->msg_flags |= MSG_TRUNC;
 	}
+	/* Urgent Byte was already accounted for, but trigger
+	 * skipping the urgent byte in non-inline case
+	 */
+	if (!(flags & MSG_PEEK))
+		smc_rx_update_consumer(smc, cons, 0);
 
 	return rc ? -EFAULT : len;
 }

-- 
2.56.1
Technical Details
Message-ID: <20261203-b4-disp-ba1ad55e-v3-7-6834ff90c5d0@proton.me>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376436-linux-kernel-netdev=dewy.ru
References: <20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376436-linux-kernel-netdev=dewy.ru
From: devnull+hexlabsecurity.proton.me@kernel.org (Bryam Vargas via B4 Relay)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 7/7] net/smc: skip the urgent byte when it is the
 next unread byte
Date: Thu, 03 Dec 2026 04:15:09 -0500
Organization: Usenet Network
Message-ID: <20261203-b4-disp-ba1ad55e-v3-7-6834ff90c5d0@proton.me>
References: <20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2445635"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Ib6a6n2ouoMZ7txeTJ7PAocDW2M= sha256:Awc605ZjyVylfnmuSoSN+XtIc05MpHcTWRZ8PUTHjRg=
	sha1:KLh3Ya311ZRXnzbf/876SZdkbgA= sha256:xHwP08ZwalU+JgZ8Rq7elTbUg1RFoOpquYxVOMn3/dE=
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 CE62B11789B; Thu,  3 Dec 2026 12:15:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org
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 QaL4UJg_AXr3;
	Thu,  3 Dec 2026 12:15:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376436-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 122F7117897; Thu,  3 Dec 2026 12:15:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 32D98603CD4; Thu,  3 Dec 2026 09:15:42 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796289312;
	b=dsfAz2yrqlRlCHdChi2KX7YRORD+j7H7vjfXlga+y8gAwLELSOOCkcBsL3Wvo8HArbFv
	 gwEkC2p5zcZIEERExbHyWUvJgpq3gzY7lUFbyDL+OIL1T9Egi3UQM3xitNXw1ywajm7WQ
	 0PYYRRvZEdcZVbDn245jvz15L8jmp5gZH44rg5Z+lkz7jPexGHbNzdK7q87EAbb0aoBte
	 y6Ch4vJdQbYx2iZX5BftfOkBp9QKVCipLcMkt9EqSqf/q4BLCPtvmasehyHiGmBzGx913
	 Qj2tPXicQ/jCp6guYAZEGx1ZuTQyfA8I5rHMVRaTM5SwiPSJMwfabY9jOt87FlH1r/w==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796289312;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=Us6FmfgGu+K5EbrSr40Xy0siF7ZaRKe/39s6Btl8ZYo=;
	b=f9/LQ3fj0VfU/uy9sM1ZQuIpc4uKpf6t5DETECpeFiy20lGC5b83HVuV0/T1u0JxTCPA
	 BSQ6ZBpQQhaMh9NtKx27CXNrl+w1vQ2kkMjRlOC+kHr0iapnZdkKYrf6JjM7CmULqaQHT
	 uOOBlUlRt4yBbMAIAb++nePsAQb1t9IBo1DToe1WzNSaiOvbNX6toTdX5ianr2kTztfWf
	 N7zp1nzAwj6eJAhZKoBBv6H/0FyeHAv6TYXcL/LOxrFnzBU7KDSMN9ZqN/Y6Juvxw/3Gy
	 Vs1SR5lQu+UhGsYyolFoZ5FsmsdU3QPG3PrrbVWdeq+sjoLrVsN2KAe/UtJYHzj5Tnw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WIpWWG0w;
	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 9AE2F606A692;
	Thu,  3 Dec 2026 09:15:12 +0000 (UTC)
X-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=WIpWWG0w
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796289307;
	b=hYqku3ncFiZVe8VKJSRsnqkK/3ddnbYbL/ZUAmtF6HufYXyYWsjGinQDs0Ys89boKbos
	 Ajh2sbkd1bIUu3Q6hne4MqrlzASn9EhTUXcrc7m23F4IZl2TV8EembRhYWk+kn701ULBY
	 ugfh2oCyOizcrRW9UBncA9CWrSSUesE2h7mJ7vM4psvngO/y+31eYyEBZE8Z6ziDAeGVq
	 x+aZNGIpCAUne1l4ggvKnbXfn9kWR8xzc+Sqvi9bfBgFSQYySHd7DN15/EpprKeiErVen
	 91Lpp5MIsTePN7Uf+XJwiCjYrdQdv5qsujPo40bEeAlo9uVTQZXfwO1euy5FsK8N77A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796289307;
	h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version:
	 Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=Us6FmfgGu+K5EbrSr40Xy0siF7ZaRKe/39s6Btl8ZYo=;
	b=qcQNq8tgW5er1+m/JpGBepXwByBwMRWnphdE/bOgbC5J8ny0bP8/XKQuQ6y2vRGeeGlk
	 QrMOwG5JRRQ2o2H4lPTwebSsVRuU6tF4GTNyRplTG2YUg6IvKqaamwSM4WUy4ati3E19g
	 NTjFmqxr4Z0Bz1a2CW2JtXUUCX6JPQ43PM7LgdhEfBxhsq7kIzu9jDLuJopHHy4A4QVsb
	 jnJFTdEbMwhey7vQXqxhzhduYjLCtAOFG6gtrfFIgSE6vIvOzsfynEcd7s6YH4Ni60ZK9
	 MFRm5WVpSrb+ofVbR8PIBmJ3oWRFNl/Fy/pjtKA35Qkm6m6WxK2ADW56bnfvN3m7HXA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WIpWWG0w;
	arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-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 ED7C0606A689;
	Thu,  3 Dec 2026 09:15:06 +0000 (UTC)
X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77
X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none;
	t=1796289306;
	b=rFhr3yldgzFtja77ccVaN0IvlfB7BNyrvc0VeLYaeZy5E69qsqGC9E4kVcfWtb/DRw31
	 /XOtT0Jjy5kTEPMbn8M/5mCaJV26t0olAd0gQfTIm6asulVhnRIVsPJ0S8INuoCkB18sM
	 TNFUgTBd0+igZ6at8XynOoSsif3ptfxzTfDCZi6oaI3SiGxFPLPg7lz6VX95dHxc+soFp
	 UMz/Xs9zYVsMuZJtei3CZORkXW+hvY8J7R3Hl1zxH5vzCNHuULku58qRgt8yBPx4eatDP
	 zo8WyJCkalbfSS/Pgjwq4LBNJEij+tpH+W1YLNpjiwNU771BgxyYvroItSzd+In7Xrw==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1796289306;
	h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=Us6FmfgGu+K5EbrSr40Xy0siF7ZaRKe/39s6Btl8ZYo=;
	b=1SVbQeZ5yq0ku2NJxuOmMwF46vvAiYDv5mXvD5qxFWkXzEQyGyN9mFVH9GM7ImgYMFa1
	 4AEjhMko9gB0qrM4SXtq0IhfGNMC50YQWd7KK5zc1A6bx4cThycdtcVtllt4wI9NfdHAG
	 ipD2uBXeYzCgI2Rnrt3j+3NY/5KVaAevnIJE+64T7vWi01VzNC8+CWDSbMw5xTwdmE8oG
	 3WfAYxcYj/nmRpgRg/Rh2W+iM5VRovBsK8gcGiU8YdGGrC2ZzP4f72FUrNEC1R513Xqdo
	 Ud2NC81+aE+fJaRRuVDnfU+lnngMW7sLa2jFswiyDIRQR27mu6EWWFh0G0i13O27PoQ==
X-ARC-Authentication-Results: i=1; smtp.kernel.org; 
	arc=none smtp.remote-ip=100.80.115.77
X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77])
	(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.kernel.org (Postfix) with ESMTPS id 093061F0089A;
	Thu,  3 Dec 2026 09:15:06 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796289306;
	bh=Us6FmfgGu+K5EbrSr40Xy0siF7ZaRKe/39s6Btl8ZYo=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To;
	b=WIpWWG0wHzk2h8fVDMqwhoh9zPxzJ8mKe0WffloSJf8E5EjLvtNO2ufICHiyVPYHg
	 ff+TiYNdzTbcadgS2JgKTy5N/yHhDofRAl5f2a6zM215MEwrj42YbzxO8m+Fdb9SWz
	 wSqt0PnNYKJLUNZu2LsbSqYXdtU7aThBXq3ajrCtW+t9cNXUOq3L9IEYx/zBAc5c6q
	 p+BcY7ibvzdjdeuWrbBrUkK6CN2dekVvXAMAZcFpMdbWKMbVSZWf6Z28UMcgxpLeXd
	 RMoOd6esTpmt0EFYSclVv1eEr4hICOoW3z3LgttnlzOlPRdbam696eDmATN8vC4xbQ
	 0hTISa3Mk1b8w==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id 7B5F14F8C3;
	Thu,  3 Dec 2026 09:15:04 +0000 (UTC)
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: <20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me>
X-Cc: Wen Gu <guwen@linux.alibaba.com>, 
 Guangguan Wang <guangguan.wang@linux.alibaba.com>, 
 Tony Lu <tonylu@linux.alibaba.com>, Ursula Braun <ubraun@linux.ibm.com>, 
 linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, 
 Hidayath Khan <hidayath@linux.ibm.com>, Simon Horman <horms@kernel.org>, 
 Wenjia Zhang <wenjia@linux.ibm.com>, linux-kernel@vger.kernel.org, 
 Stefan Raspl <raspl@linux.ibm.com>, netdev@vger.kernel.org
X-Mailer: b4 0.15.2
X-Developer-Signature: v=1; a=ed25519-sha256; t=1796289302; l=2679;
 i=hexlabsecurity@proton.me; s=default; h=from:subject:message-id;
 bh=Ig6S9hD/OxH7CBPfPSVhol4mmZdvB2DPfR8traa6on8=;
 b=e/WdW4WKmaV8NBX/jCispwaD9yNybYgKsTbt2r9CjGJO6R/gJJN8Qc4JDO8Z2739P1Zu4twzx
 rSnMVVksY9aCCPlMIcrrkFACT8x8lZfwMbYt2AzdOUewzXzVhIqPZ34
X-Developer-Key: i=hexlabsecurity@proton.me; a=ed25519;
 pk=xw1AhCtQdvuoQc+bOQIYy9o8G++cp4/VniI2G/tc3G8=
X-Endpoint-Received: by B4 Relay for hexlabsecurity@proton.me/default with
 auth_id=893
X-Original-From: Bryam Vargas <hexlabsecurity@proton.me>
X-Reply-To: hexlabsecurity@proton.me