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=1795019862; b=Dt2WxTYcukA88/UTTd4446RiRwqwfRpyfGmKFyy6WXqtFVZfFXJZN2vEk1IPMrsB3r1W mmMn9M9DHOAbLR+It5hqBkeENjja1PhTGjpcnttnDWuHlck4wrQR0eNetfT/sYNrYqW/u PpxBRaCcj0fqv8rosyhQwVs+lfRjWmx0oPtoxmq6CqTYNIByRZVkoJnyIPrxuJeHL5Cy1 tkgq7KsZjOfpEsKqTdyUdka2+VnMAAmifDW+Os0qNQ3qCOzqiJMsvleQTIagWlzaMuiHh 6v2YTw+1cg9v6l6rSzCVJ+dBwp9H4Cd/u8rpANReSKo+0/EWZwKROFE5gPFgS0WgUbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795019862; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=78/rjhHl+XBkXaaVsnexi9Ng5YuqrCKOmqyQEGfLWLg=; b=ToS9fzH8t3kQvDLBOj9cmsJIWrFeEnVW3nCxWbkA0Thq+jhpyRgoHTOLkLj72u8apnw2 De+qzE1xXFXVHkEGrOnZLxscQxssRJ/K5WaO1Iy7qXjzDqs5w68HuCIDH2qSVMkzTEZJE /2IWoUvCbRCJBvRZXiYazvx0Lgu+VWEUFuPRTWZ/SBrvMd+aezu9nkjX0IavdPrvDD5kB mqGH3UpGmfla/ue/RTS5w7ohEKAWyr0cdopN0nJvx1Jl14AxGdgMlmMBASWjkraIVxfUq A9YKUdQjSfMLkLClaczvfclsJP7AGmRPdmI8LWdzTgOmjBPtDzrhs2a4ls5uaNsW1Mw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="yxoUZVG/"; 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 7E2EF606A32A; Wed, 18 Nov 2026 16:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=yxoUZVG/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A261E1F000C5; Wed, 18 Nov 2026 16:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795019862; bh=78/rjhHl+XBkXaaVsnexi9Ng5YuqrCKOmqyQEGfLWLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yxoUZVG/RJkKhTBipKVhVva7H+K5nr3hZVygkqq6NkC9qi+3MWhMgRK7rvoAlP3sw qHASqbsSdHRyeEe9d3QTd40cQHz+PBfQ+LPqo3Hdh6F5mky5bM7hS3pV0tSL5HNFsT cidDPKgrAExPpnqvprG0zmkJqa0IvBElw3/Y3d4E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haitam Lazaar , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 7.3 1706/2651] RDMA/siw: Enforce IB_ACCESS_REMOTE_READ for read responses Date: Wed, 18 Nov 2026 15:49:06 +0100 Message-ID: <20261118150349.059278463@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haitam Lazaar [ Upstream commit f74eac4fc6c56274fb96c2c44ffad8f01c325f17 ] When generating an RDMA READ response (SIW_OP_READ_RESPONSE), siw_check_sgl_tx() unconditionally passes 0 as the required permission mask: /* Reference memory to be tx'd w/o checking access for LOCAL_READ */ rv = siw_check_sgl_tx(qp->pd, wqe, 0); Because perms is 0, siw_check_mem()'s authorization test: if ((mem->perms & perms) < perms) evaluates to (mem->perms & 0) < 0, which is always false. Consequently, an untrusted remote peer can issue an RDMA Read targeting any valid STag in the Protection Domain, even if the memory was registered strictly as write-only (IB_ACCESS_REMOTE_WRITE) without IB_ACCESS_REMOTE_READ. Enforce that the target memory region was granted IB_ACCESS_REMOTE_READ when answering SIW_OP_READ_RESPONSE work queue entries, while preserving perms = 0 for standard local sends. Fixes: b9be6f18cf9e ("rdma/siw: transmit path") Signed-off-by: Haitam Lazaar Link: https://patch.msgid.link/1a12ad1d83f.19cd98924357428.7073029566232810804@lazaarsec.com Acked-by: Bernard Metzler Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_qp_tx.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c index 54c9d97015e8f..c133c20b835d2 100644 --- a/drivers/infiniband/sw/siw/siw_qp_tx.c +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c @@ -805,17 +805,21 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe) if (wqe->wr_status == SIW_WR_QUEUED) { if (!(wqe->sqe.flags & SIW_WQE_INLINE)) { - if (tx_type(wqe) == SIW_OP_READ_RESPONSE) - wqe->sqe.num_sge = 1; - if (tx_type(wqe) != SIW_OP_READ && tx_type(wqe) != SIW_OP_READ_LOCAL_INV) { + enum ib_access_flags perms = 0; + /* - * Reference memory to be tx'd w/o checking - * access for LOCAL_READ permission, since - * not defined in RDMA core. + * Local READ permission doesn't exist in RDMA core. + * A READ RESPONSE source is read by the remote peer, + * so it must be checked for REMOTE_READ permission. */ - rv = siw_check_sgl_tx(qp->pd, wqe, 0); + if (tx_type(wqe) == SIW_OP_READ_RESPONSE) { + perms = IB_ACCESS_REMOTE_READ; + wqe->sqe.num_sge = 1; + } + + rv = siw_check_sgl_tx(qp->pd, wqe, perms); if (rv < 0) { if (tx_type(wqe) == SIW_OP_READ_RESPONSE) -- 2.53.0