]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/rxe: Fix error unwind in rxe_create_qp()
authorZhu Yanjun <yanjun.zhu@linux.dev>
Sun, 31 Jul 2022 06:36:21 +0000 (02:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:59 +0000 (11:17 +0200)
commit7b22612d9a6f05f89b5998a94a98c0746d8cec3f
treea761e4dc697aa6016d2aa8401ef640fa6af17328
parent1530b6898594577c66288b4fa5120a47de799099
RDMA/rxe: Fix error unwind in rxe_create_qp()

[ Upstream commit 286d6936dc9c55046704d16919f1732b83c0ba23 ]

In the function rxe_create_qp(), rxe_qp_from_init() is called to
initialize qp, internally things like the spin locks are not setup until
rxe_qp_init_req().

If an error occures before this point then the unwind will call
rxe_cleanup() and eventually to rxe_qp_do_cleanup()/rxe_cleanup_task()
which will oops when trying to access the uninitialized spinlock.

Move the spinlock initializations earlier before any failures.

Fixes: 5deaf88696f1 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20220731063621.298405-1-yanjun.zhu@linux.dev
Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/sw/rxe/rxe_qp.c