From mboxrd@z Thu Jan 1 00:00:00 1970 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 9D88F3515DC; Wed, 30 Sep 2026 16:30:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790785828; cv=none; b=Wk+5SFsEmFml0W7AF7zSVtYNLyVLd5h+xOusq/E575Yw7VXIUAa9Tpd1zhFddYuCc0bFS6Mcr15mvwlKMYkIEbMdCv6GYCY4DZalN/eZRmBf8PNeNM4eq8aXsWaQq8VNs1BvtM5jsAd41OXs+RdLk+8EksZS0VPP0BWGs4Bw+Ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790785828; c=relaxed/simple; bh=3AuqhMhEAoRZ7bzIvI1iYs6DPrt3jBx7/X1Y3nO3ENs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J6lsvMiQf+xoGaszwjZ3zqMoYyZ05VeXr9pV3JW5SMlApA0L+BcGTmiuZ2GirFocDQETquW3J+bWHFEtkl+6QjCKckK1KrXC3Pg8+ioYsmyrHcSlY6mb5DxyIKSPdrhm3IevMBjWGgEUYJMp9oUxWGt7rwxC3R4FhkTkzEqXmJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BHDOr5Wq; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BHDOr5Wq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0115A1F000FF; Wed, 30 Sep 2026 16:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790785827; bh=HpDws0HQU5H6KxllCe4zt6bNhBuHMNyzfC9OSxa7V7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BHDOr5WqXni8Rth8eeyNN80uvZGDZFskalYyLmjwRjCxpqvlkKvwTp0gyZ0LTZncp vO15V1yAf6qpdPu1r1VHtWHL43pnRk6ySX8ICVnItoCFxZ7jk/pRbbOVcId2wi1VKI TewRBiCsjKcuBO0ew/oACy1Km/XiqlBhfUmu3uMs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.1 647/982] RDMA/siw: Bound fragmented header copies by the remaining length Date: Wed, 30 Sep 2026 17:23:03 +0200 Message-ID: <20260930152430.664720392@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jérémy Jean [ Upstream commit 9ff797e516dbc1ecb73701ec4c24055712d44411 ] siw_get_hdr() can receive an extended DDP/RDMAP header across more than one TCP callback. The first callback may receive most of the header, while the next one still limits the copy to hdrlen - MIN_DDP_HDR instead of the number of missing bytes. This makes the destination move past the end of the header and overwrite the receive state, including fpdu_part_rcvd. A later callback can then use a negative fpdu_part_rcvd value as a copy offset, which creates an OOB write. Use the number of header bytes already received when calculating the next copy length. Fixes: 754209850df8 ("RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall.") Signed-off-by: Jérémy Jean Link: https://patch.msgid.link/20260908085520.1746329-1-Jeremy.Jean@oss.cyber.gouv.fr Assisted-by: Codex:gpt-6 Acked-by: Bernard Metzler Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_qp_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c index 743ffb3754e80..d608ecc67dd9d 100644 --- a/drivers/infiniband/sw/siw/siw_qp_rx.c +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c @@ -1095,7 +1095,7 @@ static int siw_get_hdr(struct siw_rx_stream *srx) if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { int hdrlen = iwarp_pktinfo[opcode].hdr_len; - bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); + bytes = min_t(int, hdrlen - srx->fpdu_part_rcvd, srx->skb_new); skb_copy_bits(skb, srx->skb_offset, (char *)c_hdr + srx->fpdu_part_rcvd, bytes); -- 2.53.0