@@ -1757,7 +1757,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
slave_dev->priv_flags |= IFF_BONDING;
/* initialize slave stats */
- dev_get_stats(new_slave->dev, &new_slave->slave_stats);
+ res = dev_get_stats(new_slave->dev, &new_slave->slave_stats);
+ if (res) {
+ slave_err(bond_dev, slave_dev, "dev_get_stats returned %d\n",
+ res);
+ goto err_close;
+ }
if (bond_is_lb(bond)) {
/* bond_alb_init_slave() must be called before all other stages since
@@ -2094,7 +2099,13 @@ static int __bond_release_one(struct net_device *bond_dev,
bond_sysfs_slave_del(slave);
/* recompute stats just before removing the slave */
- bond_get_stats(bond->dev, &bond->bond_stats);
+ err = bond_get_stats(bond->dev, &bond->bond_stats);
+ if (err) {
+ slave_info(bond_dev, slave_dev, "dev_get_stats returned %d\n",
+ err);
+ unblock_netpoll_tx();
+ return err;
+ }
bond_upper_dev_unlink(bond, slave);
/* unregister rx_handler early so bond_handle_frame wouldn't be called
@@ -370,7 +370,12 @@ static __inline__ int led_get_net_activity(void)
in_dev_put(in_dev);
- dev_get_stats(dev, &stats);
+ retval = dev_get_stats(dev, &stats);
+ if (retval) {
+ netif_lists_unlock(&init_net);
+ return retval;
+ }
+
rx_total += stats.rx_packets;
tx_total += stats.tx_packets;
}
@@ -198,7 +198,9 @@ static int gen_ndis_query_resp(struct rndis_params *params, u32 OID, u8 *buf,
resp->InformationBufferOffset = cpu_to_le32(16);
net = params->dev;
- dev_get_stats(net, &stats);
+ retval = dev_get_stats(net, &stats);
+ if (retval)
+ return retval;
switch (OID) {
@@ -244,12 +244,15 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
const struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev);
static const char fmt64[] = "%30s %12llu\n";
struct rtnl_link_stats64 stats;
- int i;
+ int err, i;
if (!is_vlan_dev(vlandev))
return 0;
- dev_get_stats(vlandev, &stats);
+ err = dev_get_stats(vlandev, &stats);
+ if (err)
+ return err;
+
seq_printf(seq,
"%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n",
vlandev->name, vlan->vlan_id,
@@ -78,11 +78,14 @@ static void dev_seq_stop(struct seq_file *seq, void *v)
netif_lists_unlock(net);
}
-static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
+static int dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
{
struct rtnl_link_stats64 stats;
+ int err;
- dev_get_stats(dev, &stats);
+ err = dev_get_stats(dev, &stats);
+ if (err)
+ return err;
seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %5llu %10llu %9llu "
"%8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n",
@@ -101,6 +104,8 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
stats.tx_window_errors +
stats.tx_heartbeat_errors,
stats.tx_compressed);
+
+ return 0;
}
/*
@@ -109,6 +114,8 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
*/
static int dev_seq_show(struct seq_file *seq, void *v)
{
+ int err = 0;
+
if (v == SEQ_START_TOKEN)
seq_puts(seq, "Inter-| Receive "
" | Transmit\n"
@@ -116,8 +123,9 @@ static int dev_seq_show(struct seq_file *seq, void *v)
"compressed multicast|bytes packets errs "
"drop fifo colls carrier compressed\n");
else
- dev_seq_printf_stats(seq, v);
- return 0;
+ err = dev_seq_printf_stats(seq, v);
+
+ return err;
}
static u32 softnet_backlog_len(struct softnet_data *sd)
@@ -588,7 +588,9 @@ static ssize_t netstat_show(const struct device *d,
if (dev_isalive(dev)) {
struct rtnl_link_stats64 stats;
- dev_get_stats(dev, &stats);
+ ret = dev_get_stats(dev, &stats);
+ if (ret)
+ return ret;
ret = sprintf(buf, fmt_u64, *(u64 *)(((u8 *)&stats) + offset));
}
@@ -1201,6 +1201,7 @@ static noinline_for_stack int rtnl_fill_stats(struct sk_buff *skb,
{
struct rtnl_link_stats64 *sp;
struct nlattr *attr;
+ int err;
attr = nla_reserve_64bit(skb, IFLA_STATS64,
sizeof(struct rtnl_link_stats64), IFLA_PAD);
@@ -1208,7 +1209,9 @@ static noinline_for_stack int rtnl_fill_stats(struct sk_buff *skb,
return -EMSGSIZE;
sp = nla_data(attr);
- dev_get_stats(dev, sp);
+ err = dev_get_stats(dev, sp);
+ if (err)
+ return err;
attr = nla_reserve(skb, IFLA_STATS,
sizeof(struct rtnl_link_stats));
@@ -5135,7 +5138,9 @@ static int rtnl_fill_statsinfo(struct sk_buff *skb, struct net_device *dev,
goto nla_put_failure;
sp = nla_data(attr);
- dev_get_stats(dev, sp);
+ err = dev_get_stats(dev, sp);
+ if (err)
+ goto nla_put_failure;
}
if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_XSTATS, *idxattr)) {