Commit 77daec38 authored by Zhu Yanjun's avatar Zhu Yanjun Committed by Zheng Zengkai
Browse files

RDMA/rxe: Fix error unwind in rxe_create_qp()

stable inclusion
from stable-v5.10.137
commit 3ef491b26c720a87fcfbd78b7dc8eb83d9753fe6
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3ef491b26c720a87fcfbd78b7dc8eb83d9753fe6

--------------------------------

[ Upstream commit fd5382c5 ]

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: 8700e3e7 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20220731063621.298405-1-yanjun.zhu@linux.dev


Reported-by: default avatar <syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com>
Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 41ae3ae2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment