]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA: Fix use-after-free in rxe_queue_cleanup
authorPavel Skripkin <paskripkin@gmail.com>
Sun, 21 Nov 2021 20:22:39 +0000 (23:22 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 25 Nov 2021 17:15:59 +0000 (13:15 -0400)
commit578bd7665e8d00a25cd2511ed3cbcf2e033108cb
tree63fce32bb5394e7b4c9f318916aaa0e6d32fe6ec
parentbdf2074c36ff2ec1e88ae41beb6e104f4e7f0cff
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: 0a422dec2a13 ("RDMA: Globally allocate and release QP memory")
Link: https://lore.kernel.org/r/20211121202239.3129-1-paskripkin@gmail.com
Reported-by: syzbot+aab53008a5adf26abe91@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_qp.c