]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: add NULL pointer check for hns3_set/get_ringparam()
authorHao Chen <chenhao288@hisilicon.com>
Sat, 26 Mar 2022 09:51:04 +0000 (17:51 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Mar 2022 16:16:49 +0000 (09:16 -0700)
commitf945c6e940515f7c4967f52bcd635dc5d03e1ca0
treeec72f2be77641f93370cd8734435ca8758a693c9
parentbf3c5ef149df0f89602f4e3556fac15149026bba
net: hns3: add NULL pointer check for hns3_set/get_ringparam()

When pci devices init failed and haven't reinit, priv->ring is
NULL and hns3_set/get_ringparam() will access priv->ring. it
causes call trace.

So, add NULL pointer check for hns3_set/get_ringparam() to
avoid this situation.

Fixes: 129e90806081 ("net: hns3: add support for set_ringparam")
Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c