🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #35

Re: [PATCH net] RDS/IB: validate receive completion payload length

#35
From: Allison Henderson
Date: Wed, 07 Oct 2026 01:13
70 lines
7881 bytes
On Wed, 2026-10-07 at 05:52 +0900, sungbyeongchan wrote:
> An RDS/RDMA peer can declare a fragment length larger than the payload
> reported by the receive completion. The receive path attaches the recycled
> receive fragment without validating those lengths, allowing recvmsg() to
> return stale bytes beyond the actual payload.
> 
> Validate data_len against the expected current-fragment length before
> transferring fragment ownership. Disconnect and reconnect on mismatch.
> 
> The issue reproduced in two clean QEMU boots. A peer declared 4096 bytes
> while posting only 16 bytes, and a receiver under a different UID obtained
> 4080-byte tails from prior messages in all 256 attempts in each boot. With
> this change, the malformed message was not delivered, reconnection
> succeeded, and a subsequent normal 4096-byte message was delivered intact.
> 
> Fixes: 1e23b3ee0e94 ("RDS/IB: Receive datagrams via IB")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>

Hi Sungbyeongchan,

Thanks for sending this, and for following up on the earlier feedback so
quickly.  However, I realized after I sent it that another contributor had
already publicly sent an equivalent fix earlier today, and the convention is
to take the first correct patch on the list.
https://lore.kernel.org/netdev/20261006125720.81227-1-shubham@octane.security/

So no need to follow up with the sashiko review, and I apologize for the
miss-communication, but I will ask your Reported-by tag to be applied since you
were the first to report the same bug. This was a solid find, and the reproduction
was very well done. Please continue to send RDS fixes as you find them.

Thank you!
Allison

> ---
>  net/rds/ib_recv.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
> index bd6cb3ffaa571..0daddb108c8a7 100644
> --- a/net/rds/ib_recv.c
> +++ b/net/rds/ib_recv.c
> @@ -949,6 +949,15 @@ static void rds_ib_process_recv(struct rds_connection *conn,
>  		}
>  	}
>  
> +	if (data_len != min_t(u32, ic->i_recv_data_rem, RDS_FRAG_SIZE)) {
> +		rds_ib_conn_error(conn,
> +				  "incoming fragment payload length %u, expected %u; "
> +				  "disconnecting and reconnecting\n",
> +				  data_len,
> +				  min_t(u32, ic->i_recv_data_rem, RDS_FRAG_SIZE));
> +		goto done;
> +	}
> +
>  	list_add_tail(&recv->r_frag->f_item, &ibinc->ii_frags);
>  	recv->r_frag = NULL;
>  
Technical Details
Message-ID: <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342154-linux-kernel-netdev=dewy.ru
References: <20261006205204.1322102-1-tjdqudcks0424@naver.com>

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-342154-linux-kernel-netdev=dewy.ru
From: achender@kernel.org (Allison Henderson)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] RDS/IB: validate receive completion payload length
Date: Tue, 06 Oct 2026 18:13:17 -0700
Organization: Usenet Network
Message-ID: <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org>
References: <20261006205204.1322102-1-tjdqudcks0424@naver.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="550344"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:W6Xeuw+KoFw1y4bEF/PtltdErYA= sha256:0DVv1FUyltMfJ8s/OC21HnknzQFrYOsPUyIlzDb5drI=
	sha1:OD4837yDHrGliCM9TxeTMVSpQu4= sha256:G5bNGBcrNVGr3Wv+aQIUa2hsW8lkbrpSYh0N2rvOG64=
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 BDCB910F0B0; Wed,  7 Oct 2026 04:13:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, 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 5FgmM8ohe11v;
	Wed,  7 Oct 2026 04:13:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-342154-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A24FC10F067; Wed,  7 Oct 2026 04:13:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 059972C8AD; Wed,  7 Oct 2026 01:13:21 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 52EAC330656;
	Wed,  7 Oct 2026 01:13:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RbiTx7b5"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 487481C861D;
	Wed,  7 Oct 2026 01:13:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791335600; cv=none; b=GbdhcR3NPJyOzJMPkdOitQAxAV8gaN5+DFfbxZm/y18egWwdjvy0ZNzLf/H2lz0CHG2vJ4jcF5YSsp+cmGgfHTF0ACoiDKBXMdv+xbYO2794gVCf97PfNywMqSp40dsdO6r5bjEZHQ18QCijb+GvKURhIaSKBiqcQZY7ZYG83yc=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791335600; c=relaxed/simple;
	bh=DBFA5sFC9WD+opKlW7ITYJCAfHENnpaiqVEyIAbo2BQ=;
	h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
	 Content-Type:MIME-Version; b=nsl7Kbl8tEhW47ZD5goO9hdIWYtT9Ehg1iBgp2yc9Av9xNDWGVnQ7Dc8EbNffjYtqd04i/887jOkCveDDZt3L6yCCxrkVBwGB+uZggQ+Sz3eMR8kdKaixQqP+T6DwYMdKPfYSVcLbkH64djKetmnSmhJ2Ack+Ttu81Fr8AO/AsE=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RbiTx7b5; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 573361F0089B;
	Wed,  7 Oct 2026 01:13:18 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791335598;
	bh=qjyKuDRA86Hk/S2fjOT5ttpFNeWmESp7ej6Do7qKEUQ=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=RbiTx7b5M3wwKXtYVAXET5krPtmPJM+sCxjwAfCox8DNFG96mj24oc0GAUq23xNgt
	 OMLzkfnuQz4oebYTQylWcA2Q6dZS7GrOLcixh9Kdw72k0NUOJQoyTNJC6MU6aeBsad
	 sAIppy1iP3Z4sd6sJpT6Qno+bE3+sUJUPq+2YDuRfpukMymrYhbeT9BxgOYKCQoNYq
	 RxZNlrEQFm852jGifXLqbmYnhOSqcc1UT9/2jcoyNIwfaTzwfXOLhvrtTLTq+7ukZp
	 sy4BZM72XVnv6XhottcVuPh6rGdJjLrsqB7/oWThxRA4Mg5Mv4XLNW4w8XKmbvsvzQ
	 ynxWaGqPfk9kw==
X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, 
	rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261006205204.1322102-1-tjdqudcks0424@naver.com>
X-User-Agent: Evolution 3.52.3-0ubuntu1.1 
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>