]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/erdma: Prevent use-after-free in erdma_accept_newconn()
authorCheng Xu <chengyou@linux.alibaba.com>
Thu, 6 Mar 2025 12:04:40 +0000 (20:04 +0800)
committerLeon Romanovsky <leon@kernel.org>
Thu, 6 Mar 2025 13:25:38 +0000 (08:25 -0500)
After the erdma_cep_put(new_cep) being called, new_cep will be freed,
and the following dereference will cause a UAF problem. Fix this issue.

Fixes: 920d93eac8b9 ("RDMA/erdma: Add connection management (CM) support")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/erdma/erdma_cm.c

index 1b23c698ec25c3fd9860f5582546db1fbcb2504d..e0acc185e719304362be09d08af4a1c04a41e944 100644 (file)
@@ -709,7 +709,6 @@ error:
                erdma_cancel_mpatimer(new_cep);
 
                erdma_cep_put(new_cep);
-               new_cep->sock = NULL;
        }
 
        if (new_s) {