[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250105084052.20694-1-lirongqing@baidu.com>
Date: Sun, 5 Jan 2025 16:40:52 +0800
From: Li RongQing <lirongqing@...du.com>
To: netdev@...r.kernel.org
Cc: Li RongQing <lirongqing@...du.com>
Subject: [PATCH][Resend][net-next] net: ethtool: Use hwprov under rcu_read_lock
hwprov should be protected by rcu_read_lock to prevent possible UAF
Fixes: 4c61d809cf60 ("net: ethtool: Fix suspicious rcu_dereference usage")
Signed-off-by: Li RongQing <lirongqing@...du.com>
---
net/ethtool/common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 2607aea..b200e53 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -869,6 +869,7 @@ int __ethtool_get_ts_info(struct net_device *dev,
struct kernel_ethtool_ts_info *info)
{
struct hwtstamp_provider *hwprov;
+ int ret;
rcu_read_lock();
hwprov = rcu_dereference(dev->hwprov);
@@ -892,8 +893,9 @@ int __ethtool_get_ts_info(struct net_device *dev,
return err;
}
+ ret = ethtool_get_ts_info_by_phc(dev, info, &hwprov->desc);
rcu_read_unlock();
- return ethtool_get_ts_info_by_phc(dev, info, &hwprov->desc);
+ return ret;
}
bool net_support_hwtstamp_qualifier(struct net_device *dev,
--
2.9.4
Powered by blists - more mailing lists