Skip to content

Commit

Permalink
net: Fix NETDEV_CHANGE notifier usage causing spurious arp flush
Browse files Browse the repository at this point in the history
A bug was introduced in NETDEV_CHANGE notifier sequence causing the
arp table to be sometimes spuriously cleared (including manual arp
entries marked permanent), upon network link carrier changes.

The changed argument for the notifier was applied only to a single
caller of NETDEV_CHANGE, missing among others netdev_state_change().
So upon net_carrier events induced by the network, which are
triggering a call to netdev_state_change(), arp_netdev_event() would
decide whether to clear or not arp cache based on random/junk stack
values (a kind of read buffer overflow).

Fixes: be9efd3 ("net: pass changed flags along with NETDEV_CHANGE event")
Fixes: 6c8b4e3 ("arp: flush arp cache on IFF_NOARP change")
Signed-off-by: Loic Prylli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Loic Prylli authored and davem330 committed Jul 8, 2014
1 parent 8dcb4b1 commit 5495119
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ struct list_head ptype_all __read_mostly; /* Taps */
static struct list_head offload_base __read_mostly;

static int netif_rx_internal(struct sk_buff *skb);
static int call_netdevice_notifiers_info(unsigned long val,
struct net_device *dev,
struct netdev_notifier_info *info);

/*
* The @dev_base_head list is protected by @dev_base_lock and the rtnl
Expand Down Expand Up @@ -1207,7 +1210,11 @@ EXPORT_SYMBOL(netdev_features_change);
void netdev_state_change(struct net_device *dev)
{
if (dev->flags & IFF_UP) {
call_netdevice_notifiers(NETDEV_CHANGE, dev);
struct netdev_notifier_change_info change_info;

change_info.flags_changed = 0;
call_netdevice_notifiers_info(NETDEV_CHANGE, dev,
&change_info.info);
rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
}
}
Expand Down

0 comments on commit 5495119

Please sign in to comment.