Skip to content

Commit f937193

Browse files
tachicialexkuba-moo
authored andcommitted
net: ethernet: adi: adin1110: Add check in netdev_event
Check whether this driver actually is the intended recipient of upper change event. Fixes: bc93e19 ("net: ethernet: adi: Add ADIN1110 support") Signed-off-by: Alexandru Tachici <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 229a002 commit f937193

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/net/ethernet/adi/adin1110.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,11 @@ static int adin1110_port_bridge_leave(struct adin1110_port_priv *port_priv,
11691169
return ret;
11701170
}
11711171

1172+
static bool adin1110_port_dev_check(const struct net_device *dev)
1173+
{
1174+
return dev->netdev_ops == &adin1110_netdev_ops;
1175+
}
1176+
11721177
static int adin1110_netdevice_event(struct notifier_block *unused,
11731178
unsigned long event, void *ptr)
11741179
{
@@ -1177,6 +1182,9 @@ static int adin1110_netdevice_event(struct notifier_block *unused,
11771182
struct netdev_notifier_changeupper_info *info = ptr;
11781183
int ret = 0;
11791184

1185+
if (!adin1110_port_dev_check(dev))
1186+
return NOTIFY_DONE;
1187+
11801188
switch (event) {
11811189
case NETDEV_CHANGEUPPER:
11821190
if (netif_is_bridge_master(info->upper_dev)) {
@@ -1202,11 +1210,6 @@ static void adin1110_disconnect_phy(void *data)
12021210
phy_disconnect(data);
12031211
}
12041212

1205-
static bool adin1110_port_dev_check(const struct net_device *dev)
1206-
{
1207-
return dev->netdev_ops == &adin1110_netdev_ops;
1208-
}
1209-
12101213
static int adin1110_port_set_forwarding_state(struct adin1110_port_priv *port_priv)
12111214
{
12121215
struct adin1110_priv *priv = port_priv->priv;

0 commit comments

Comments
 (0)