net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs
authorYonglong Liu <liuyonglong@huawei.com>
Fri, 10 Nov 2023 09:37:10 +0000 (17:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:07:04 +0000 (17:07 +0000)
commit07f5b8c47152cadbd9102e053dcb60685820aa09
tree6456cc2adcdccf76b77617f0fd2613a51b28fdef
parent83a177b942fa014c322143a5ddcb86d19eb3d475
net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs

[ Upstream commit 53aba458f23846112c0d44239580ff59bc5c36c3 ]

The hns3 driver define an array of string to show the coalesce
info, but if the kernel adds a new mode or a new state,
out-of-bounds access may occur when coalesce info is read via
debugfs, this patch fix the problem.

Fixes: c99fead7cb07 ("net: hns3: add debugfs support for interrupt coalesce")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c