Thread (3 messages) 3 messages, 3 authors, 2021-08-03

Re: [PATCH for-rc] RDMA/hns: Fix the double unlock problem of poll_sem

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-08-02 10:46:41

On Mon, Aug 02, 2021 at 02:56:14PM +0800, Wenpeng Liang wrote:
From: Yangyang Li <redacted>

If hns_roce_cmd_use_events() fails then it means that the poll_sem is not
obtained, but the poll_sem is released in hns_roce_cmd_use_polling(), this
will cause an unlock problem.

This is the static checker warning:
	drivers/infiniband/hw/hns/hns_roce_main.c:926 hns_roce_init()
	error: double unlocked '&hr_dev->cmd.poll_sem' (orig line 879)

Event mode and polling mode are mutually exclusive and resources are
separated, so there is no need to process polling mode resources in
event mode.

The initial mode of cmd is polling mode, so even if cmd fails to switch to
event mode, it is not necessary to switch to polling mode.

Fixes: a389d016c030 ("RDMA/hns: Enable all CMDQ context")
Fixes: 3d50503b3b33 ("RDMA/hns: Optimize cmd init and mode selection for hip08")
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Yangyang Li <redacted>
Signed-off-by: Wenpeng Liang <redacted>
---
 drivers/infiniband/hw/hns/hns_roce_cmd.c  | 7 +++----
 drivers/infiniband/hw/hns/hns_roce_main.c | 4 +---
 2 files changed, 4 insertions(+), 7 deletions(-)
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help