Commit 172129db authored by Chengchang Tang's avatar Chengchang Tang Committed by Jeiwei Li
Browse files

RDMA/hns: Fix unregistering device and accessing to debugfs concurrently

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I87LCF



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

When unregistering the device or destroying of ucontext and accessing
dca debugfs concurrently, there may be a problem of accessing a null
pointer.

This patch fixes it by delaying the pointer assignment to null until
debugfs has been unregistered.

Fixes: a2178118 ("RDMA/hns: Add debugfs support for DCA")
Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
parent 4ad79d38
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -525,8 +525,8 @@ void hns_roce_unregister_uctx_debugfs(struct hns_roce_dev *hr_dev,
	struct hns_dca_ctx_debugfs *dbgfs = uctx->dca_dbgfs;

	if (dbgfs) {
		uctx->dca_dbgfs = NULL;
		cleanup_dca_ctx_debugfs(dbgfs);
		uctx->dca_dbgfs = NULL;
		kfree(dbgfs);
	}
}
@@ -567,14 +567,13 @@ void hns_roce_unregister_debugfs(struct hns_roce_dev *hr_dev)
	if (!dbgfs)
		return;

	hr_dev->dbgfs = NULL;

	if (dbgfs->dca_root) {
		destroy_dca_debugfs(dbgfs->dca_root);
		dbgfs->dca_root = NULL;
	}

	debugfs_remove_recursive(dbgfs->root);
	hr_dev->dbgfs = NULL;
	kfree(dbgfs);
}