]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
RDMA/irdma: Fix kernel stack leak in irdma_create_user_ah()
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 16 Feb 2026 15:02:49 +0000 (11:02 -0400)
committerLeon Romanovsky <leon@kernel.org>
Tue, 24 Feb 2026 10:03:15 +0000 (05:03 -0500)
struct irdma_create_ah_resp {  // 8 bytes, no padding
    __u32 ah_id;               // offset 0 - SET (uresp.ah_id = ah->sc_ah.ah_info.ah_idx)
    __u8  rsvd[4];             // offset 4 - NEVER SET <- LEAK
};

rsvd[4]: 4 bytes of stack memory leaked unconditionally. Only ah_id is assigned before ib_respond_udata().

The reserved members of the structure were not zeroed.

Cc: stable@vger.kernel.org
Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://patch.msgid.link/3-v1-83e918d69e73+a9-rdma_udata_rc_jgg@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/irdma/verbs.c

index 15af53237217c7c767a0d06a188fab3f0f57f359..7251cd7a21471e80e821210341f118257d3370ed 100644 (file)
@@ -5212,7 +5212,7 @@ static int irdma_create_user_ah(struct ib_ah *ibah,
 #define IRDMA_CREATE_AH_MIN_RESP_LEN offsetofend(struct irdma_create_ah_resp, rsvd)
        struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah);
        struct irdma_device *iwdev = to_iwdev(ibah->pd->device);
-       struct irdma_create_ah_resp uresp;
+       struct irdma_create_ah_resp uresp = {};
        struct irdma_ah *parent_ah;
        int err;