Commit 88ad4175 authored by Bjørn Mork's avatar Bjørn Mork Committed by David S. Miller

net/core: use netdev name in warning if no parent

A recent flaw in the netdev feature setting resulted in warnings
like this one from VLAN interfaces:

 WARNING: CPU: 1 PID: 4975 at net/core/dev.c:2419 skb_warn_bad_offload+0xbc/0xcb()
 : caps=(0x00000000001b5820, 0x00000000001b5829) len=2782 data_len=0 gso_size=1348 gso_type=16 ip_summed=3

The ":" is supposed to be preceded by a driver name, but in this
case it is an empty string since the device has no parent.

There are many types of network devices without a parent. The
anonymous warnings for these devices can be hard to debug.  Log
the network device name instead in these cases to assist further
debugging.

This is mostly similar to how __netdev_printk() handles orphan
devices.
Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8844f972
...@@ -2403,17 +2403,20 @@ static void skb_warn_bad_offload(const struct sk_buff *skb) ...@@ -2403,17 +2403,20 @@ static void skb_warn_bad_offload(const struct sk_buff *skb)
{ {
static const netdev_features_t null_features = 0; static const netdev_features_t null_features = 0;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
const char *driver = ""; const char *name = "";
if (!net_ratelimit()) if (!net_ratelimit())
return; return;
if (dev && dev->dev.parent) if (dev) {
driver = dev_driver_string(dev->dev.parent); if (dev->dev.parent)
name = dev_driver_string(dev->dev.parent);
else
name = netdev_name(dev);
}
WARN(1, "%s: caps=(%pNF, %pNF) len=%d data_len=%d gso_size=%d " WARN(1, "%s: caps=(%pNF, %pNF) len=%d data_len=%d gso_size=%d "
"gso_type=%d ip_summed=%d\n", "gso_type=%d ip_summed=%d\n",
driver, dev ? &dev->features : &null_features, name, dev ? &dev->features : &null_features,
skb->sk ? &skb->sk->sk_route_caps : &null_features, skb->sk ? &skb->sk->sk_route_caps : &null_features,
skb->len, skb->data_len, skb_shinfo(skb)->gso_size, skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
skb_shinfo(skb)->gso_type, skb->ip_summed); skb_shinfo(skb)->gso_type, skb->ip_summed);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment