Skip to content

Commit 024cb55

Browse files
committed
net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
JIRA: https://issues.redhat.com/browse/RHEL-46358 JIRA: https://issues.redhat.com/browse/RHEL-47900 CVE: CVE-2024-40928 Upstream Status: net.git commit 0dcc53a commit 0dcc53a Author: Su Hui <suhui@nfschina.com> Date: Wed Jun 5 11:47:43 2024 +0800 net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() Clang static checker (scan-build) warning: net/ethtool/ioctl.c:line 2233, column 2 Called function pointer is null (null dereference). Return '-EOPNOTSUPP' when 'ops->get_ethtool_phy_stats' is NULL to fix this typo error. Fixes: 201ed31 ("net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers") Signed-off-by: Su Hui <suhui@nfschina.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Hariprasad Kelam <hkelam@marvell.com> Link: https://lore.kernel.org/r/20240605034742.921751-1-suhui@nfschina.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
1 parent 095cf60 commit 024cb55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ethtool/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ static int ethtool_get_phy_stats_ethtool(struct net_device *dev,
22302230
const struct ethtool_ops *ops = dev->ethtool_ops;
22312231
int n_stats, ret;
22322232

2233-
if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats)
2233+
if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats)
22342234
return -EOPNOTSUPP;
22352235

22362236
n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);

0 commit comments

Comments
 (0)