From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796385160; b=U6w7x227Ai/S7/WabSifcCTXg0UcZpSK0wNGJu1abfhAnG8skcIBJ3iZ0o2YrAFKWTNj s2Pjelh5E6d8WyPK+F72wACEBuAbKaB1q1ChcHTSTt+sprMpifNoHSRc5oqfi29W9cxIE OxD2V7P8zpbFIxLcPAYo0W03iuyetjCkjkdGiCncyqrqpItiqgEEq8lrGDlWf4CWa9Oik lp/A19koTZd21pkpMZX3lD0aEgJCjMSwIXtERWWm1JdX0+O77E8xqAofPyCWAYAkwKW56 rSpwb6vlKTTh/S43d6YtWx8AXWYMlpGNTfbgDVhby/+XdwRqwskrQRE/X6720YOt8tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385160; 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=ec0l9nzjMEhPRO4sB15aXG813dvF1o5bStmwco+mOFI=; b=l6f4mwUGpJttFn48Qaj07S68lg5n66AOqmLPiQSU1RyKrGZPzHcgFoImGxOzCo/n6rQT 1THyguMG0eyAIUz10aE4XSlw8e+3Kqylf7xpAIQ8hc6wmgHT18egri4XM5v1+o+8STZUw 7NpMBnOXMFLf2n5G1kP77bNdP4pisjRhc2XZurTcYpSr5f04l2CwqxxTKjhVt4WBiAf9d RRJq1ryrSzmvMsqs8sT3BG9mEeGGF11OOxdQncDqwyoAUHHbomligbBj/tcov53BzUayt ddMdOgcZhorzekoMHxf8ZrL9CbSD0iMmtStsRhoLO4dTy8nejenhc/uG0ingugtNB7A== 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=KzhzOmzN; 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 6982D606A32C; Fri, 4 Dec 2026 11:52:40 +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=KzhzOmzN Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58B31F000C2; Fri, 4 Dec 2026 11:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385160; bh=ec0l9nzjMEhPRO4sB15aXG813dvF1o5bStmwco+mOFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KzhzOmzNPtmEDCCDXfp9MSJ/MC3F+uR/OOuPt9vT1lNXgcYVmEobrJdm1bOAY5OaU 3XYyVF9U34+2yXryZUms3VDtUeOY82AEe9XMZq82V3BIUwvLKJDYoTFh9IxsMn9Z1+ h2Y/wEJXzLISicMwJiS3/bRg9TpOpA897JK5BpUE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Serhat Kumral , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.6 0442/1167] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Date: Fri, 4 Dec 2026 18:57:49 +0900 Message-ID: <20261204100713.528055183@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Serhat Kumral [ Upstream commit bb75e5580b15cd23ededf15683a5ad67d7b61aab ] In MLX5_IB_METHOD_STEERING_ANCHOR_CREATE, the user-supplied u16 priority is passed directly to _get_flow_table() without an upper bound check. This can lead to out-of-bounds array accesses on dev->flow_db priority tables. Check that priority does not exceed MLX5_IB_FLOW_LAST_PRIO before calling _get_flow_table(), matching the existing validation in raw_fs_rule_add() and mlx5_ib_create_flow(). Fixes: 0c6ab0ca9a66 ("RDMA/mlx5: Expose steering anchor to userspace") Signed-off-by: Serhat Kumral Link: https://patch.msgid.link/20261018144907.20123-1-serhatkumral1@gmail.com Signed-off-by: Leon Romanovsky [ sashal: Context line adapted: the backport keeps the older kzalloc(sizeof(*obj), GFP_KERNEL) call instead of upstream's kzalloc_obj(*obj), with the same priority bounds check inserted before it. ] Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c index 186085cfb4e9b..369cea6b31857 100644 --- a/drivers/infiniband/hw/mlx5/fs.c +++ b/drivers/infiniband/hw/mlx5/fs.c @@ -2427,6 +2427,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)( if (err) return err; + if (priority > MLX5_IB_FLOW_LAST_PRIO) + return -EINVAL; + obj = kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) return -ENOMEM; -- 2.53.0