diff options
-rw-r--r-- | drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/rdc/r6040.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/realtek/8139cp.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/smsc/smsc911x.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/tile/tilepro.c | 3 | ||||
-rw-r--r-- | drivers/net/usb/asix.c | 4 | ||||
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 4 | ||||
-rw-r--r-- | drivers/net/usb/ipheth.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/sierra_net.c | 2 | ||||
-rw-r--r-- | include/linux/memcontrol.h | 2 | ||||
-rw-r--r-- | include/linux/netdevice.h | 5 | ||||
-rw-r--r-- | mm/memcontrol.c | 19 | ||||
-rw-r--r-- | net/core/dev_addr_lists.c | 16 | ||||
-rw-r--r-- | net/core/pktgen.c | 4 | ||||
-rw-r--r-- | net/core/sock.c | 9 | ||||
-rw-r--r-- | net/ipv4/Kconfig | 6 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 2 | ||||
-rw-r--r-- | net/unix/Kconfig | 2 |
19 files changed, 57 insertions, 32 deletions
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index a11a8ad9422..d44331eb07f 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1469,7 +1469,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev, return 0; } -static struct ethtool_ops bcm_enet_ethtool_ops = { +static const struct ethtool_ops bcm_enet_ethtool_ops = { .get_strings = bcm_enet_get_strings, .get_sset_count = bcm_enet_get_sset_count, .get_ethtool_stats = bcm_enet_get_ethtool_stats, diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6c46753aeb4..a6bcdb5cd2b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3080,7 +3080,7 @@ fw_exit: return status; } -static struct net_device_ops be_netdev_ops = { +static const struct net_device_ops be_netdev_ops = { .ndo_open = be_open, .ndo_stop = be_close, .ndo_start_xmit = be_xmit, diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c index 87aa4393507..cb0eca80785 100644 --- a/drivers/net/ethernet/rdc/r6040.c +++ b/drivers/net/ethernet/rdc/r6040.c @@ -1160,7 +1160,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, lp->dev = dev; /* Init RDC private data */ - lp->mcr0 = MCR0_XMTEN | MCR0; + lp->mcr0 = MCR0_XMTEN | MCR0_RCVEN; /* The RDC-specific entries in the device structure. */ dev->netdev_ops = &r6040_netdev_ops; diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index cc6b391479c..abc79076f86 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -563,6 +563,7 @@ rx_next: if (cpr16(IntrStatus) & cp_rx_intr_mask) goto rx_status_loop; + napi_gro_flush(napi); spin_lock_irqsave(&cp->lock, flags); __napi_complete(napi); cpw16_f(IntrMask, cp_intr_mask); diff --git a/drivers/net/ethernet/smsc/smsc911x.h b/drivers/net/ethernet/smsc/smsc911x.h index 938ecf29081..9ad5e5d39a0 100644 --- a/drivers/net/ethernet/smsc/smsc911x.h +++ b/drivers/net/ethernet/smsc/smsc911x.h @@ -401,8 +401,6 @@ #include <asm/smsc911x.h> #endif -#ifdef CONFIG_SMSC_PHY #include <linux/smscphy.h> -#endif #endif /* __SMSC911X_H__ */ diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index 6b75063988e..d9951afb926 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c @@ -2260,8 +2260,7 @@ static int tile_net_get_mac(struct net_device *dev) return 0; } - -static struct net_device_ops tile_net_ops = { +static const struct net_device_ops tile_net_ops = { .ndo_open = tile_net_open, .ndo_stop = tile_net_stop, .ndo_start_xmit = tile_net_tx, diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 1ff7163bc34..d0937c4634c 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -376,7 +376,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) skb_pull(skb, (size + 1) & 0xfffe); - if (skb->len == 0) + if (skb->len < sizeof(header)) break; head = (u8 *) skb->data; @@ -1152,7 +1152,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) return 0; } -static struct ethtool_ops ax88178_ethtool_ops = { +static const struct ethtool_ops ax88178_ethtool_ops = { .get_drvinfo = asix_get_drvinfo, .get_link = asix_get_link, .get_msglevel = usbnet_get_msglevel, diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index cb8e595c502..3a539a9cac5 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -138,7 +138,7 @@ struct cdc_ncm_ctx { static void cdc_ncm_tx_timeout(unsigned long arg); static const struct driver_info cdc_ncm_info; static struct usb_driver cdc_ncm_driver; -static struct ethtool_ops cdc_ncm_ethtool_ops; +static const struct ethtool_ops cdc_ncm_ethtool_ops; static const struct usb_device_id cdc_devs[] = { { USB_INTERFACE_INFO(USB_CLASS_COMM, @@ -1220,7 +1220,7 @@ static struct usb_driver cdc_ncm_driver = { .supports_autosuspend = 1, }; -static struct ethtool_ops cdc_ncm_ethtool_ops = { +static const struct ethtool_ops cdc_ncm_ethtool_ops = { .get_drvinfo = cdc_ncm_get_drvinfo, .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 08a4df23879..e84662db51c 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c @@ -420,7 +420,7 @@ static u32 ipheth_ethtool_op_get_link(struct net_device *net) return netif_carrier_ok(dev->net); } -static struct ethtool_ops ops = { +static const struct ethtool_ops ops = { .get_link = ipheth_ethtool_op_get_link }; diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index e45dfdcb871..b59cf20c781 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@ -618,7 +618,7 @@ static u32 sierra_net_get_link(struct net_device *net) return sierra_net_get_private(dev)->link_up && netif_running(net); } -static struct ethtool_ops sierra_net_ethtool_ops = { +static const struct ethtool_ops sierra_net_ethtool_ops = { .get_drvinfo = sierra_net_get_drvinfo, .get_link = sierra_net_get_link, .get_msglevel = usbnet_get_msglevel, diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 9b296ea41bb..f944591765e 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -390,7 +390,6 @@ enum { OVER_LIMIT, }; -#ifdef CONFIG_INET struct sock; #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM void sock_update_memcg(struct sock *sk); @@ -403,6 +402,5 @@ static inline void sock_release_memcg(struct sock *sk) { } #endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */ -#endif /* CONFIG_INET */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4c06cc0f194..0eac07c9525 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev) spin_lock(&dev->addr_list_lock); } +static inline void netif_addr_lock_nested(struct net_device *dev) +{ + spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); +} + static inline void netif_addr_lock_bh(struct net_device *dev) { spin_lock_bh(&dev->addr_list_lock); diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 00d4fa27d3e..d87aa3510c5 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -381,16 +381,25 @@ static void mem_cgroup_put(struct mem_cgroup *memcg); static bool mem_cgroup_is_root(struct mem_cgroup *memcg); void sock_update_memcg(struct sock *sk) { - /* A socket spends its whole life in the same cgroup */ - if (sk->sk_cgrp) { - WARN_ON(1); - return; - } if (static_branch(&memcg_socket_limit_enabled)) { struct mem_cgroup *memcg; BUG_ON(!sk->sk_prot->proto_cgroup); + /* Socket cloning can throw us here with sk_cgrp already + * filled. It won't however, necessarily happen from + * process context. So the test for root memcg given + * the current task's memcg won't help us in this case. + * + * Respecting the original socket's memcg is a better + * decision in this case. + */ + if (sk->sk_cgrp) { + BUG_ON(mem_cgroup_is_root(sk->sk_cgrp->memcg)); + mem_cgroup_get(sk->sk_cgrp->memcg); + return; + } + rcu_read_lock(); memcg = mem_cgroup_from_task(current); if (!mem_cgroup_is_root(memcg)) { diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index febba516db6..29c07fef922 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c @@ -427,7 +427,7 @@ EXPORT_SYMBOL(dev_uc_del); * * Add newly added addresses to the destination device and release * addresses that have no users left. The source device must be - * locked by netif_tx_lock_bh. + * locked by netif_addr_lock_bh. * * This function is intended to be called from the dev->set_rx_mode * function of layered software devices. @@ -439,11 +439,11 @@ int dev_uc_sync(struct net_device *to, struct net_device *from) if (to->addr_len != from->addr_len) return -EINVAL; - netif_addr_lock_bh(to); + netif_addr_lock_nested(to); err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); if (!err) __dev_set_rx_mode(to); - netif_addr_unlock_bh(to); + netif_addr_unlock(to); return err; } EXPORT_SYMBOL(dev_uc_sync); @@ -463,7 +463,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from) return; netif_addr_lock_bh(from); - netif_addr_lock(to); + netif_addr_lock_nested(to); __hw_addr_unsync(&to->uc, &from->uc, to->addr_len); __dev_set_rx_mode(to); netif_addr_unlock(to); @@ -590,7 +590,7 @@ EXPORT_SYMBOL(dev_mc_del_global); * * Add newly added addresses to the destination device and release * addresses that have no users left. The source device must be - * locked by netif_tx_lock_bh. + * locked by netif_addr_lock_bh. * * This function is intended to be called from the ndo_set_rx_mode * function of layered software devices. @@ -602,11 +602,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from) if (to->addr_len != from->addr_len) return -EINVAL; - netif_addr_lock_bh(to); + netif_addr_lock_nested(to); err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); if (!err) __dev_set_rx_mode(to); - netif_addr_unlock_bh(to); + netif_addr_unlock(to); return err; } EXPORT_SYMBOL(dev_mc_sync); @@ -626,7 +626,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from) return; netif_addr_lock_bh(from); - netif_addr_lock(to); + netif_addr_lock_nested(to); __hw_addr_unsync(&to->mc, &from->mc, to->addr_len); __dev_set_rx_mode(to); netif_addr_unlock(to); diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 449fe0f068f..65f80c7b165 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2024,13 +2024,13 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, pkt_dev->odevname); - pkt_dev->queue_map_min = ntxq - 1; + pkt_dev->queue_map_min = (ntxq ?: 1) - 1; } if (pkt_dev->queue_map_max >= ntxq) { pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, pkt_dev->odevname); - pkt_dev->queue_map_max = ntxq - 1; + pkt_dev->queue_map_max = (ntxq ?: 1) - 1; } /* Default to the interface's mac if not explicitly set. */ diff --git a/net/core/sock.c b/net/core/sock.c index 002939cfc06..5c5af9988f9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -112,6 +112,7 @@ #include <linux/highmem.h> #include <linux/user_namespace.h> #include <linux/jump_label.h> +#include <linux/memcontrol.h> #include <asm/uaccess.h> #include <asm/system.h> @@ -1272,6 +1273,12 @@ void sk_release_kernel(struct sock *sk) } EXPORT_SYMBOL(sk_release_kernel); +static void sk_update_clone(const struct sock *sk, struct sock *newsk) +{ + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) + sock_update_memcg(newsk); +} + /** * sk_clone_lock - clone a socket, and lock its clone * @sk: the socket to clone @@ -1362,6 +1369,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) sk_set_socket(newsk, NULL); newsk->sk_wq = NULL; + sk_update_clone(sk, newsk); + if (newsk->sk_prot->sockets_allocated) sk_sockets_allocated_inc(newsk); diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 335ca7abbd4..aa2a2c79776 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig @@ -408,8 +408,12 @@ config INET_TCP_DIAG def_tristate INET_DIAG config INET_UDP_DIAG + tristate "UDP: socket monitoring interface" depends on INET_DIAG - def_tristate INET_DIAG && IPV6 + default n + ---help--- + Support for UDP socket monitoring interface used by the ss tool. + If unsure, say Y. menuconfig TCP_CONG_ADVANCED bool "TCP: advanced congestion control" diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index fa057d105be..5104bc0bbdb 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -880,6 +880,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, * to be intended in a v3 query. */ max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); + if (!max_delay) + max_delay = 1; /* can't mod w/ 0 */ } else { /* v3 */ if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) return; diff --git a/net/unix/Kconfig b/net/unix/Kconfig index c2128b10e5f..8b31ab85d05 100644 --- a/net/unix/Kconfig +++ b/net/unix/Kconfig @@ -22,7 +22,7 @@ config UNIX config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIX - default UNIX + default n ---help--- Support for UNIX socket monitoring interface used by the ss tool. If unsure, say Y. |