]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: hns3: fix debugfs concurrency issue between kfree buffer and read
authorHao Chen <chenhao418@huawei.com>
Wed, 6 Sep 2023 07:20:15 +0000 (15:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:23:00 +0000 (12:23 +0200)
commit2c9643fa63602f9fd200330512fef1464564606b
tree963fe529614eec4dbbc0e896b6a36e24c9342086
parent8bfa87cf4a860fac55b3c1ce54f5a819256f7629
net: hns3: fix debugfs concurrency issue between kfree buffer and read

[ Upstream commit c295160b1d95e885f1af4586a221cb221d232d10 ]

Now in hns3_dbg_uninit(), there may be concurrency between
kfree buffer and read, it may result in memory error.

Moving debugfs_remove_recursive() in front of kfree buffer to ensure
they don't happen at the same time.

Fixes: 5e69ea7ee2a6 ("net: hns3: refactor the debugfs process")
Signed-off-by: Hao Chen <chenhao418@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c