Skip to content

Commit 84b0172

Browse files
pskrgagjgunthorpe
authored andcommitted
RDMA: Fix use-after-free in rxe_queue_cleanup
On error handling path in rxe_qp_from_init() qp->sq.queue is freed and then rxe_create_qp() will drop last reference to this object. qp clean up function will try to free this queue one time and it causes UAF bug. Fix it by zeroing queue pointer after freeing queue in rxe_qp_from_init(). Fixes: 514aee6 ("RDMA: Globally allocate and release QP memory") Link: https://lore.kernel.org/r/[email protected] Reported-by: [email protected] Signed-off-by: Pavel Skripkin <[email protected]> Reviewed-by: Zhu Yanjun <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 1360572 commit 84b0172

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/infiniband/sw/rxe/rxe_qp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
359359

360360
err2:
361361
rxe_queue_cleanup(qp->sq.queue);
362+
qp->sq.queue = NULL;
362363
err1:
363364
qp->pd = NULL;
364365
qp->rcq = NULL;

0 commit comments

Comments
 (0)