提交 4db394e6 编写于 作者: L Lang Cheng 提交者: Xie XiuQi

RDMA/hns: clear event flag after free cmd context

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

For cmd, when change mode form event to poll, we should
release context used for event mode and clear event flag.

After hem init failed, cmd release event context
without clearing the flag, resulting eq using
the context memory that has been freed.

These operations should be placed together.

Feature or Bugfix:Bugfix
Signed-off-by: NLang Cheng <chenglang@huawei.com>
Reviewed-by: Nliuyixian <liuyixian@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 fd126225
......@@ -261,7 +261,10 @@ void hns_roce_cmd_use_polling(struct hns_roce_dev *hr_dev)
{
struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd;
if (hr_cmd->use_events) {
kfree(hr_cmd->context);
hr_cmd->use_events = 0;
}
}
struct hns_roce_cmd_mailbox
......
......@@ -1435,8 +1435,8 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
hns_roce_cleanup_hem(hr_dev);
error_failed_init_hem:
if (hr_dev->cmd.use_events)
kfree(hr_dev->cmd.context);
if (hr_dev->cmd_mod)
hns_roce_cmd_use_polling(hr_dev);
hr_dev->hw->cleanup_eq(hr_dev);
error_failed_eq_table:
......@@ -1468,10 +1468,8 @@ void hns_roce_exit(struct hns_roce_dev *hr_dev)
hns_roce_cleanup_bitmap(hr_dev);
hns_roce_cleanup_hem(hr_dev);
if (hr_dev->cmd_mod) {
kfree(hr_dev->cmd.context);
if (hr_dev->cmd_mod)
hns_roce_cmd_use_polling(hr_dev);
}
hr_dev->hw->cleanup_eq(hr_dev);
hns_roce_cmd_cleanup(hr_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册