aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/phy_link_topology.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c
index 1f1eb5d59b38..aed3b26c1674 100644
--- a/drivers/net/phy/phy_link_topology.c
+++ b/drivers/net/phy/phy_link_topology.c
@@ -10,6 +10,7 @@
#include <linux/phy.h>
#include <linux/rtnetlink.h>
#include <linux/xarray.h>
+#include <net/netdev_lock.h>
static int netdev_alloc_phy_link_topology(struct net_device *dev)
{
@@ -35,6 +36,13 @@ int phy_link_topo_add_phy(struct net_device *dev,
struct phy_device_node *pdn;
int ret;
+ /* ethtool ops may run without rtnl_lock, and rtnl_lock is what
+ * currently protects the PHY topology. No driver currently mixes
+ * the two, flag if someone tries. See also ethnl_req_get_phydev().
+ */
+ if (WARN_ON_ONCE(netdev_need_ops_lock(dev)))
+ return -EOPNOTSUPP;
+
if (!topo) {
ret = netdev_alloc_phy_link_topology(dev);
if (ret)