]> www.infradead.org Git - users/dwmw2/linux.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>
Sun, 21 Aug 2022 13:16:03 +0000 (15:16 +0200)
commit3ef491b26c720a87fcfbd78b7dc8eb83d9753fe6
tree31c6acad39eb28a8f2153bb9e189b2690329a194
parent53da1f0fa0e2e197df1a95729a15b27f7b2b911c
RDMA/rxe: Fix error unwind in rxe_create_qp()

[ Upstream commit fd5382c5805c4bcb50fd25b7246247d3f7114733 ]

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: 8700e3e7c485 ("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