Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8479A36EA89; Tue, 10 Mar 2026 11:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773141138; cv=none; b=TpLs7LCa9c1awZPaGkKJvVK78JvzrlYTtbNK5kX61FReaaeE8/LIGoJfA+2eAHyU3VFe/HWpsl51qtxzI/JFmghy5nz4oWX7MXFo039HfBUHWuwCf+qCubJfP+E2Ojh6oUR0+A2SGftHurCnwKYRaEpGBDz0GK++C3dWcqMvWt4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773141138; c=relaxed/simple; bh=Pn5BGJbcgfzC6g35oA/yN9XarwmBoWfno7+j+YQGA/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NBvxiJFq4tHFidR1UZ7QiYZT4XvlI+ndCg0Y2jSMWe2HmOukea6/LhTwV1Se1Th6J2WEmOMON7UAZqL96wopDlCB2i3irIRwLVuCZm2BqwymOHOn8yFGy9W1Ut0ecVMvnJer7hq0edyK0+B40+JtgRg12ZN39QgjcJJPB3RrO1U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K1FVBgoB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K1FVBgoB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B980AC19423; Tue, 10 Mar 2026 11:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773141138; bh=Pn5BGJbcgfzC6g35oA/yN9XarwmBoWfno7+j+YQGA/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K1FVBgoBbZLJNlAz38pbzYW12Wz89W3uvC9M6JKyRpUujg52rX+f0iAaqX8q16uUU HaX4Y0J6PZALc9FNLnod50sidozdzfAOSnKqq72t5AtHeUiA8kZWckb5JFJTX9HKVf U6qB89GHi4vkx5Fj+nvbr8/gKvcMXLfPTkSlVj5wnxdG/EVlqb851pr4whjbfOWWPI a48nSd8Etlw/gFld9MWrvzgZAc81GNj8V2i694bd+jYRGQekGsb2flDbGjostuQANX 73/gXhWdDfSH7stivcL0mQ13Ofu35fkk4HB52VQX1oHyrvm6Y4ywUD/JLUiq4J9jsd SafKzvkXO9trg== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Jason Gunthorpe , Abhijit Gangurde , Leon Romanovsky , Greg Kroah-Hartman Subject: [PATCH 6.19 142/311] RDMA/ionic: Fix kernel stack leak in ionic_create_cq() Date: Tue, 10 Mar 2026 07:03:09 -0400 Message-ID: X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jason Gunthorpe commit faa72102b178c7ae6c6afea23879e7c84fc59b4e upstream. struct ionic_cq_resp resp { __u32 cqid[2]; // offset 0 - PARTIALLY SET (see below) __u8 udma_mask; // offset 8 - SET (resp.udma_mask = vcq->udma_mask) __u8 rsvd[7]; // offset 9 - NEVER SET <- LEAK }; rsvd[7]: 7 bytes of stack memory leaked unconditionally. cqid[2]: The loop at line 1256 iterates over udma_idx but skips indices where !(vcq->udma_mask & BIT(udma_idx)). The array has 2 entries but udma_count could be 1, meaning cqid[1] might never be written via ionic_create_cq_common(). If udma_mask only has bit 0 set, cqid[1] (4 bytes) is also leaked. So potentially 11 bytes leaked. Cc: stable@vger.kernel.org Fixes: e8521822c733 ("RDMA/ionic: Register device ops for control path") Signed-off-by: Jason Gunthorpe Link: https://patch.msgid.link/4-v1-83e918d69e73+a9-rdma_udata_rc_jgg@nvidia.com Acked-by: Abhijit Gangurde Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/ionic/ionic_controlpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c index ea12d9b8e125f..83573721af2c0 100644 --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c @@ -1218,7 +1218,7 @@ int ionic_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, rdma_udata_to_drv_context(udata, struct ionic_ctx, ibctx); struct ionic_vcq *vcq = to_ionic_vcq(ibcq); struct ionic_tbl_buf buf = {}; - struct ionic_cq_resp resp; + struct ionic_cq_resp resp = {}; struct ionic_cq_req req; int udma_idx = 0, rc; -- 2.51.0