1. 27 1月, 2020 4 次提交
  2. 25 1月, 2020 1 次提交
  3. 23 1月, 2020 1 次提交
    • E
      net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link() · d836f5c6
      Eric Dumazet 提交于
      rtnl_create_link() needs to apply dev->min_mtu and dev->max_mtu
      checks that we apply in do_setlink()
      
      Otherwise malicious users can crash the kernel, for example after
      an integer overflow :
      
      BUG: KASAN: use-after-free in memset include/linux/string.h:365 [inline]
      BUG: KASAN: use-after-free in __alloc_skb+0x37b/0x5e0 net/core/skbuff.c:238
      Write of size 32 at addr ffff88819f20b9c0 by task swapper/0/0
      
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.5.0-rc1-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x197/0x210 lib/dump_stack.c:118
       print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
       __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:639
       check_memory_region_inline mm/kasan/generic.c:185 [inline]
       check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
       memset+0x24/0x40 mm/kasan/common.c:108
       memset include/linux/string.h:365 [inline]
       __alloc_skb+0x37b/0x5e0 net/core/skbuff.c:238
       alloc_skb include/linux/skbuff.h:1049 [inline]
       alloc_skb_with_frags+0x93/0x590 net/core/skbuff.c:5664
       sock_alloc_send_pskb+0x7ad/0x920 net/core/sock.c:2242
       sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2259
       mld_newpack+0x1d7/0x7f0 net/ipv6/mcast.c:1609
       add_grhead.isra.0+0x299/0x370 net/ipv6/mcast.c:1713
       add_grec+0x7db/0x10b0 net/ipv6/mcast.c:1844
       mld_send_cr net/ipv6/mcast.c:1970 [inline]
       mld_ifc_timer_expire+0x3d3/0x950 net/ipv6/mcast.c:2477
       call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404
       expire_timers kernel/time/timer.c:1449 [inline]
       __run_timers kernel/time/timer.c:1773 [inline]
       __run_timers kernel/time/timer.c:1740 [inline]
       run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786
       __do_softirq+0x262/0x98c kernel/softirq.c:292
       invoke_softirq kernel/softirq.c:373 [inline]
       irq_exit+0x19b/0x1e0 kernel/softirq.c:413
       exiting_irq arch/x86/include/asm/apic.h:536 [inline]
       smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137
       apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
       </IRQ>
      RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
      Code: 98 6b ea f9 eb 8a cc cc cc cc cc cc e9 07 00 00 00 0f 00 2d 44 1c 60 00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 34 1c 60 00 fb f4 <c3> cc 55 48 89 e5 41 57 41 56 41 55 41 54 53 e8 4e 5d 9a f9 e8 79
      RSP: 0018:ffffffff89807ce8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
      RAX: 1ffffffff13266ae RBX: ffffffff8987a1c0 RCX: 0000000000000000
      RDX: dffffc0000000000 RSI: 0000000000000006 RDI: ffffffff8987aa54
      RBP: ffffffff89807d18 R08: ffffffff8987a1c0 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
      R13: ffffffff8a799980 R14: 0000000000000000 R15: 0000000000000000
       arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:690
       default_idle_call+0x84/0xb0 kernel/sched/idle.c:94
       cpuidle_idle_call kernel/sched/idle.c:154 [inline]
       do_idle+0x3c8/0x6e0 kernel/sched/idle.c:269
       cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:361
       rest_init+0x23b/0x371 init/main.c:451
       arch_call_rest_init+0xe/0x1b
       start_kernel+0x904/0x943 init/main.c:784
       x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:490
       x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:471
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:242
      
      The buggy address belongs to the page:
      page:ffffea00067c82c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
      raw: 057ffe0000000000 ffffea00067c82c8 ffffea00067c82c8 0000000000000000
      raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff88819f20b880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
       ffff88819f20b900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      >ffff88819f20b980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                 ^
       ffff88819f20ba00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
       ffff88819f20ba80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      
      Fixes: 61e84623 ("net: centralize net_device min/max MTU checking")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d836f5c6
  4. 17 1月, 2020 1 次提交
    • T
      xdp: Move devmap bulk queue into struct net_device · 75ccae62
      Toke Høiland-Jørgensen 提交于
      Commit 96360004 ("xdp: Make devmap flush_list common for all map
      instances"), changed devmap flushing to be a global operation instead of a
      per-map operation. However, the queue structure used for bulking was still
      allocated as part of the containing map.
      
      This patch moves the devmap bulk queue into struct net_device. The
      motivation for this is reusing it for the non-map variant of XDP_REDIRECT,
      which will be changed in a subsequent commit.  To avoid other fields of
      struct net_device moving to different cache lines, we also move a couple of
      other members around.
      
      We defer the actual allocation of the bulk queue structure until the
      NETDEV_REGISTER notification devmap.c. This makes it possible to check for
      ndo_xdp_xmit support before allocating the structure, which is not possible
      at the time struct net_device is allocated. However, we keep the freeing in
      free_netdev() to avoid adding another RCU callback on NETDEV_UNREGISTER.
      
      Because of this change, we lose the reference back to the map that
      originated the redirect, so change the tracepoint to always return 0 as the
      map ID and index. Otherwise no functional change is intended with this
      patch.
      
      After this patch, the relevant part of struct net_device looks like this,
      according to pahole:
      
      	/* --- cacheline 14 boundary (896 bytes) --- */
      	struct netdev_queue *      _tx __attribute__((__aligned__(64))); /*   896     8 */
      	unsigned int               num_tx_queues;        /*   904     4 */
      	unsigned int               real_num_tx_queues;   /*   908     4 */
      	struct Qdisc *             qdisc;                /*   912     8 */
      	unsigned int               tx_queue_len;         /*   920     4 */
      	spinlock_t                 tx_global_lock;       /*   924     4 */
      	struct xdp_dev_bulk_queue * xdp_bulkq;           /*   928     8 */
      	struct xps_dev_maps *      xps_cpus_map;         /*   936     8 */
      	struct xps_dev_maps *      xps_rxqs_map;         /*   944     8 */
      	struct mini_Qdisc *        miniq_egress;         /*   952     8 */
      	/* --- cacheline 15 boundary (960 bytes) --- */
      	struct hlist_head  qdisc_hash[16];               /*   960   128 */
      	/* --- cacheline 17 boundary (1088 bytes) --- */
      	struct timer_list  watchdog_timer;               /*  1088    40 */
      
      	/* XXX last struct has 4 bytes of padding */
      
      	int                        watchdog_timeo;       /*  1128     4 */
      
      	/* XXX 4 bytes hole, try to pack */
      
      	struct list_head   todo_list;                    /*  1136    16 */
      	/* --- cacheline 18 boundary (1152 bytes) --- */
      Signed-off-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NBjörn Töpel <bjorn.topel@intel.com>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/157918768397.1458396.12673224324627072349.stgit@toke.dk
      75ccae62
  5. 04 1月, 2020 1 次提交
  6. 28 12月, 2019 1 次提交
    • M
      ethtool: support for netlink notifications · 6b08d6c1
      Michal Kubecek 提交于
      Add infrastructure for ethtool netlink notifications. There is only one
      multicast group "monitor" which is used to notify userspace about changes
      and actions performed. Notification messages (types using suffix _NTF)
      share the format with replies to GET requests.
      
      Notifications are supposed to be broadcasted on every configuration change,
      whether it is done using the netlink interface or ioctl one. Netlink SET
      requests only trigger a notification if some data is actually changed.
      
      To trigger an ethtool notification, both ethtool netlink and external code
      use ethtool_notify() helper. This helper requires RTNL to be held and may
      sleep. Handlers sending messages for specific notification message types
      are registered in ethnl_notify_handlers array. As notifications can be
      triggered from other code, ethnl_ok flag is used to prevent an attempt to
      send notification before genetlink family is registered.
      Signed-off-by: NMichal Kubecek <mkubecek@suse.cz>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6b08d6c1
  7. 19 12月, 2019 1 次提交
  8. 18 12月, 2019 2 次提交
  9. 13 12月, 2019 1 次提交
    • M
      netdev: pass the stuck queue to the timeout handler · 0290bd29
      Michael S. Tsirkin 提交于
      This allows incrementing the correct timeout statistic without any mess.
      Down the road, devices can learn to reset just the specific queue.
      
      The patch was generated with the following script:
      
      use strict;
      use warnings;
      
      our $^I = '.bak';
      
      my @work = (
      ["arch/m68k/emu/nfeth.c", "nfeth_tx_timeout"],
      ["arch/um/drivers/net_kern.c", "uml_net_tx_timeout"],
      ["arch/um/drivers/vector_kern.c", "vector_net_tx_timeout"],
      ["arch/xtensa/platforms/iss/network.c", "iss_net_tx_timeout"],
      ["drivers/char/pcmcia/synclink_cs.c", "hdlcdev_tx_timeout"],
      ["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
      ["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
      ["drivers/message/fusion/mptlan.c", "mpt_lan_tx_timeout"],
      ["drivers/misc/sgi-xp/xpnet.c", "xpnet_dev_tx_timeout"],
      ["drivers/net/appletalk/cops.c", "cops_timeout"],
      ["drivers/net/arcnet/arcdevice.h", "arcnet_timeout"],
      ["drivers/net/arcnet/arcnet.c", "arcnet_timeout"],
      ["drivers/net/arcnet/com20020.c", "arcnet_timeout"],
      ["drivers/net/ethernet/3com/3c509.c", "el3_tx_timeout"],
      ["drivers/net/ethernet/3com/3c515.c", "corkscrew_timeout"],
      ["drivers/net/ethernet/3com/3c574_cs.c", "el3_tx_timeout"],
      ["drivers/net/ethernet/3com/3c589_cs.c", "el3_tx_timeout"],
      ["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
      ["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
      ["drivers/net/ethernet/3com/typhoon.c", "typhoon_tx_timeout"],
      ["drivers/net/ethernet/8390/8390.h", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/8390.h", "eip_tx_timeout"],
      ["drivers/net/ethernet/8390/8390.c", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/8390p.c", "eip_tx_timeout"],
      ["drivers/net/ethernet/8390/ax88796.c", "ax_ei_tx_timeout"],
      ["drivers/net/ethernet/8390/axnet_cs.c", "axnet_tx_timeout"],
      ["drivers/net/ethernet/8390/etherh.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/8390/hydra.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/8390/mac8390.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/8390/mcf8390.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/8390/lib8390.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/8390/ne2k-pci.c", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/pcnet_cs.c", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/smc-ultra.c", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/wd.c", "ei_tx_timeout"],
      ["drivers/net/ethernet/8390/zorro8390.c", "__ei_tx_timeout"],
      ["drivers/net/ethernet/adaptec/starfire.c", "tx_timeout"],
      ["drivers/net/ethernet/agere/et131x.c", "et131x_tx_timeout"],
      ["drivers/net/ethernet/allwinner/sun4i-emac.c", "emac_timeout"],
      ["drivers/net/ethernet/alteon/acenic.c", "ace_watchdog"],
      ["drivers/net/ethernet/amazon/ena/ena_netdev.c", "ena_tx_timeout"],
      ["drivers/net/ethernet/amd/7990.h", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/7990.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/a2065.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/am79c961a.c", "am79c961_timeout"],
      ["drivers/net/ethernet/amd/amd8111e.c", "amd8111e_tx_timeout"],
      ["drivers/net/ethernet/amd/ariadne.c", "ariadne_tx_timeout"],
      ["drivers/net/ethernet/amd/atarilance.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/au1000_eth.c", "au1000_tx_timeout"],
      ["drivers/net/ethernet/amd/declance.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/lance.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/mvme147.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/ni65.c", "ni65_timeout"],
      ["drivers/net/ethernet/amd/nmclan_cs.c", "mace_tx_timeout"],
      ["drivers/net/ethernet/amd/pcnet32.c", "pcnet32_tx_timeout"],
      ["drivers/net/ethernet/amd/sunlance.c", "lance_tx_timeout"],
      ["drivers/net/ethernet/amd/xgbe/xgbe-drv.c", "xgbe_tx_timeout"],
      ["drivers/net/ethernet/apm/xgene-v2/main.c", "xge_timeout"],
      ["drivers/net/ethernet/apm/xgene/xgene_enet_main.c", "xgene_enet_timeout"],
      ["drivers/net/ethernet/apple/macmace.c", "mace_tx_timeout"],
      ["drivers/net/ethernet/atheros/ag71xx.c", "ag71xx_tx_timeout"],
      ["drivers/net/ethernet/atheros/alx/main.c", "alx_tx_timeout"],
      ["drivers/net/ethernet/atheros/atl1c/atl1c_main.c", "atl1c_tx_timeout"],
      ["drivers/net/ethernet/atheros/atl1e/atl1e_main.c", "atl1e_tx_timeout"],
      ["drivers/net/ethernet/atheros/atlx/atl.c", "atlx_tx_timeout"],
      ["drivers/net/ethernet/atheros/atlx/atl1.c", "atlx_tx_timeout"],
      ["drivers/net/ethernet/atheros/atlx/atl2.c", "atl2_tx_timeout"],
      ["drivers/net/ethernet/broadcom/b44.c", "b44_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bcmsysport.c", "bcm_sysport_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bnx2.c", "bnx2_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h", "bnx2x_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c", "bnx2x_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c", "bnx2x_tx_timeout"],
      ["drivers/net/ethernet/broadcom/bnxt/bnxt.c", "bnxt_tx_timeout"],
      ["drivers/net/ethernet/broadcom/genet/bcmgenet.c", "bcmgenet_timeout"],
      ["drivers/net/ethernet/broadcom/sb1250-mac.c", "sbmac_tx_timeout"],
      ["drivers/net/ethernet/broadcom/tg3.c", "tg3_tx_timeout"],
      ["drivers/net/ethernet/calxeda/xgmac.c", "xgmac_tx_timeout"],
      ["drivers/net/ethernet/cavium/liquidio/lio_main.c", "liquidio_tx_timeout"],
      ["drivers/net/ethernet/cavium/liquidio/lio_vf_main.c", "liquidio_tx_timeout"],
      ["drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c", "lio_vf_rep_tx_timeout"],
      ["drivers/net/ethernet/cavium/thunder/nicvf_main.c", "nicvf_tx_timeout"],
      ["drivers/net/ethernet/cirrus/cs89x0.c", "net_timeout"],
      ["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
      ["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
      ["drivers/net/ethernet/cortina/gemini.c", "gmac_tx_timeout"],
      ["drivers/net/ethernet/davicom/dm9000.c", "dm9000_timeout"],
      ["drivers/net/ethernet/dec/tulip/de2104x.c", "de_tx_timeout"],
      ["drivers/net/ethernet/dec/tulip/tulip_core.c", "tulip_tx_timeout"],
      ["drivers/net/ethernet/dec/tulip/winbond-840.c", "tx_timeout"],
      ["drivers/net/ethernet/dlink/dl2k.c", "rio_tx_timeout"],
      ["drivers/net/ethernet/dlink/sundance.c", "tx_timeout"],
      ["drivers/net/ethernet/emulex/benet/be_main.c", "be_tx_timeout"],
      ["drivers/net/ethernet/ethoc.c", "ethoc_tx_timeout"],
      ["drivers/net/ethernet/faraday/ftgmac100.c", "ftgmac100_tx_timeout"],
      ["drivers/net/ethernet/fealnx.c", "fealnx_tx_timeout"],
      ["drivers/net/ethernet/freescale/dpaa/dpaa_eth.c", "dpaa_tx_timeout"],
      ["drivers/net/ethernet/freescale/fec_main.c", "fec_timeout"],
      ["drivers/net/ethernet/freescale/fec_mpc52xx.c", "mpc52xx_fec_tx_timeout"],
      ["drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c", "fs_timeout"],
      ["drivers/net/ethernet/freescale/gianfar.c", "gfar_timeout"],
      ["drivers/net/ethernet/freescale/ucc_geth.c", "ucc_geth_timeout"],
      ["drivers/net/ethernet/fujitsu/fmvj18x_cs.c", "fjn_tx_timeout"],
      ["drivers/net/ethernet/google/gve/gve_main.c", "gve_tx_timeout"],
      ["drivers/net/ethernet/hisilicon/hip04_eth.c", "hip04_timeout"],
      ["drivers/net/ethernet/hisilicon/hix5hd2_gmac.c", "hix5hd2_net_timeout"],
      ["drivers/net/ethernet/hisilicon/hns/hns_enet.c", "hns_nic_net_timeout"],
      ["drivers/net/ethernet/hisilicon/hns3/hns3_enet.c", "hns3_nic_net_timeout"],
      ["drivers/net/ethernet/huawei/hinic/hinic_main.c", "hinic_tx_timeout"],
      ["drivers/net/ethernet/i825xx/82596.c", "i596_tx_timeout"],
      ["drivers/net/ethernet/i825xx/ether1.c", "ether1_timeout"],
      ["drivers/net/ethernet/i825xx/lib82596.c", "i596_tx_timeout"],
      ["drivers/net/ethernet/i825xx/sun3_82586.c", "sun3_82586_timeout"],
      ["drivers/net/ethernet/ibm/ehea/ehea_main.c", "ehea_tx_watchdog"],
      ["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
      ["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
      ["drivers/net/ethernet/ibm/ibmvnic.c", "ibmvnic_tx_timeout"],
      ["drivers/net/ethernet/intel/e100.c", "e100_tx_timeout"],
      ["drivers/net/ethernet/intel/e1000/e1000_main.c", "e1000_tx_timeout"],
      ["drivers/net/ethernet/intel/e1000e/netdev.c", "e1000_tx_timeout"],
      ["drivers/net/ethernet/intel/fm10k/fm10k_netdev.c", "fm10k_tx_timeout"],
      ["drivers/net/ethernet/intel/i40e/i40e_main.c", "i40e_tx_timeout"],
      ["drivers/net/ethernet/intel/iavf/iavf_main.c", "iavf_tx_timeout"],
      ["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
      ["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
      ["drivers/net/ethernet/intel/igb/igb_main.c", "igb_tx_timeout"],
      ["drivers/net/ethernet/intel/igbvf/netdev.c", "igbvf_tx_timeout"],
      ["drivers/net/ethernet/intel/ixgb/ixgb_main.c", "ixgb_tx_timeout"],
      ["drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c", "adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);"],
      ["drivers/net/ethernet/intel/ixgbe/ixgbe_main.c", "ixgbe_tx_timeout"],
      ["drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c", "ixgbevf_tx_timeout"],
      ["drivers/net/ethernet/jme.c", "jme_tx_timeout"],
      ["drivers/net/ethernet/korina.c", "korina_tx_timeout"],
      ["drivers/net/ethernet/lantiq_etop.c", "ltq_etop_tx_timeout"],
      ["drivers/net/ethernet/marvell/mv643xx_eth.c", "mv643xx_eth_tx_timeout"],
      ["drivers/net/ethernet/marvell/pxa168_eth.c", "pxa168_eth_tx_timeout"],
      ["drivers/net/ethernet/marvell/skge.c", "skge_tx_timeout"],
      ["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
      ["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
      ["drivers/net/ethernet/mediatek/mtk_eth_soc.c", "mtk_tx_timeout"],
      ["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
      ["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
      ["drivers/net/ethernet/mellanox/mlx5/core/en_main.c", "mlx5e_tx_timeout"],
      ["drivers/net/ethernet/micrel/ks8842.c", "ks8842_tx_timeout"],
      ["drivers/net/ethernet/micrel/ksz884x.c", "netdev_tx_timeout"],
      ["drivers/net/ethernet/microchip/enc28j60.c", "enc28j60_tx_timeout"],
      ["drivers/net/ethernet/microchip/encx24j600.c", "encx24j600_tx_timeout"],
      ["drivers/net/ethernet/natsemi/sonic.h", "sonic_tx_timeout"],
      ["drivers/net/ethernet/natsemi/sonic.c", "sonic_tx_timeout"],
      ["drivers/net/ethernet/natsemi/jazzsonic.c", "sonic_tx_timeout"],
      ["drivers/net/ethernet/natsemi/macsonic.c", "sonic_tx_timeout"],
      ["drivers/net/ethernet/natsemi/natsemi.c", "ns_tx_timeout"],
      ["drivers/net/ethernet/natsemi/ns83820.c", "ns83820_tx_timeout"],
      ["drivers/net/ethernet/natsemi/xtsonic.c", "sonic_tx_timeout"],
      ["drivers/net/ethernet/neterion/s2io.h", "s2io_tx_watchdog"],
      ["drivers/net/ethernet/neterion/s2io.c", "s2io_tx_watchdog"],
      ["drivers/net/ethernet/neterion/vxge/vxge-main.c", "vxge_tx_watchdog"],
      ["drivers/net/ethernet/netronome/nfp/nfp_net_common.c", "nfp_net_tx_timeout"],
      ["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
      ["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
      ["drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c", "pch_gbe_tx_timeout"],
      ["drivers/net/ethernet/packetengines/hamachi.c", "hamachi_tx_timeout"],
      ["drivers/net/ethernet/packetengines/yellowfin.c", "yellowfin_tx_timeout"],
      ["drivers/net/ethernet/pensando/ionic/ionic_lif.c", "ionic_tx_timeout"],
      ["drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c", "netxen_tx_timeout"],
      ["drivers/net/ethernet/qlogic/qla3xxx.c", "ql3xxx_tx_timeout"],
      ["drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c", "qlcnic_tx_timeout"],
      ["drivers/net/ethernet/qualcomm/emac/emac.c", "emac_tx_timeout"],
      ["drivers/net/ethernet/qualcomm/qca_spi.c", "qcaspi_netdev_tx_timeout"],
      ["drivers/net/ethernet/qualcomm/qca_uart.c", "qcauart_netdev_tx_timeout"],
      ["drivers/net/ethernet/rdc/r6040.c", "r6040_tx_timeout"],
      ["drivers/net/ethernet/realtek/8139cp.c", "cp_tx_timeout"],
      ["drivers/net/ethernet/realtek/8139too.c", "rtl8139_tx_timeout"],
      ["drivers/net/ethernet/realtek/atp.c", "tx_timeout"],
      ["drivers/net/ethernet/realtek/r8169_main.c", "rtl8169_tx_timeout"],
      ["drivers/net/ethernet/renesas/ravb_main.c", "ravb_tx_timeout"],
      ["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
      ["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
      ["drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c", "sxgbe_tx_timeout"],
      ["drivers/net/ethernet/seeq/ether3.c", "ether3_timeout"],
      ["drivers/net/ethernet/seeq/sgiseeq.c", "timeout"],
      ["drivers/net/ethernet/sfc/efx.c", "efx_watchdog"],
      ["drivers/net/ethernet/sfc/falcon/efx.c", "ef4_watchdog"],
      ["drivers/net/ethernet/sgi/ioc3-eth.c", "ioc3_timeout"],
      ["drivers/net/ethernet/sgi/meth.c", "meth_tx_timeout"],
      ["drivers/net/ethernet/silan/sc92031.c", "sc92031_tx_timeout"],
      ["drivers/net/ethernet/sis/sis190.c", "sis190_tx_timeout"],
      ["drivers/net/ethernet/sis/sis900.c", "sis900_tx_timeout"],
      ["drivers/net/ethernet/smsc/epic100.c", "epic_tx_timeout"],
      ["drivers/net/ethernet/smsc/smc911x.c", "smc911x_timeout"],
      ["drivers/net/ethernet/smsc/smc9194.c", "smc_timeout"],
      ["drivers/net/ethernet/smsc/smc91c92_cs.c", "smc_tx_timeout"],
      ["drivers/net/ethernet/smsc/smc91x.c", "smc_timeout"],
      ["drivers/net/ethernet/stmicro/stmmac/stmmac_main.c", "stmmac_tx_timeout"],
      ["drivers/net/ethernet/sun/cassini.c", "cas_tx_timeout"],
      ["drivers/net/ethernet/sun/ldmvsw.c", "sunvnet_tx_timeout_common"],
      ["drivers/net/ethernet/sun/niu.c", "niu_tx_timeout"],
      ["drivers/net/ethernet/sun/sunbmac.c", "bigmac_tx_timeout"],
      ["drivers/net/ethernet/sun/sungem.c", "gem_tx_timeout"],
      ["drivers/net/ethernet/sun/sunhme.c", "happy_meal_tx_timeout"],
      ["drivers/net/ethernet/sun/sunqe.c", "qe_tx_timeout"],
      ["drivers/net/ethernet/sun/sunvnet.c", "sunvnet_tx_timeout_common"],
      ["drivers/net/ethernet/sun/sunvnet_common.c", "sunvnet_tx_timeout_common"],
      ["drivers/net/ethernet/sun/sunvnet_common.h", "sunvnet_tx_timeout_common"],
      ["drivers/net/ethernet/synopsys/dwc-xlgmac-net.c", "xlgmac_tx_timeout"],
      ["drivers/net/ethernet/ti/cpmac.c", "cpmac_tx_timeout"],
      ["drivers/net/ethernet/ti/cpsw.c", "cpsw_ndo_tx_timeout"],
      ["drivers/net/ethernet/ti/cpsw_priv.c", "cpsw_ndo_tx_timeout"],
      ["drivers/net/ethernet/ti/cpsw_priv.h", "cpsw_ndo_tx_timeout"],
      ["drivers/net/ethernet/ti/davinci_emac.c", "emac_dev_tx_timeout"],
      ["drivers/net/ethernet/ti/netcp_core.c", "netcp_ndo_tx_timeout"],
      ["drivers/net/ethernet/ti/tlan.c", "tlan_tx_timeout"],
      ["drivers/net/ethernet/toshiba/ps3_gelic_net.h", "gelic_net_tx_timeout"],
      ["drivers/net/ethernet/toshiba/ps3_gelic_net.c", "gelic_net_tx_timeout"],
      ["drivers/net/ethernet/toshiba/ps3_gelic_wireless.c", "gelic_net_tx_timeout"],
      ["drivers/net/ethernet/toshiba/spider_net.c", "spider_net_tx_timeout"],
      ["drivers/net/ethernet/toshiba/tc35815.c", "tc35815_tx_timeout"],
      ["drivers/net/ethernet/via/via-rhine.c", "rhine_tx_timeout"],
      ["drivers/net/ethernet/wiznet/w5100.c", "w5100_tx_timeout"],
      ["drivers/net/ethernet/wiznet/w5300.c", "w5300_tx_timeout"],
      ["drivers/net/ethernet/xilinx/xilinx_emaclite.c", "xemaclite_tx_timeout"],
      ["drivers/net/ethernet/xircom/xirc2ps_cs.c", "xirc_tx_timeout"],
      ["drivers/net/fjes/fjes_main.c", "fjes_tx_retry"],
      ["drivers/net/slip/slip.c", "sl_tx_timeout"],
      ["include/linux/usb/usbnet.h", "usbnet_tx_timeout"],
      ["drivers/net/usb/aqc111.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/ax88172a.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/ax88179_178a.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/catc.c", "catc_tx_timeout"],
      ["drivers/net/usb/cdc_mbim.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/cdc_ncm.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/dm9601.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/hso.c", "hso_net_tx_timeout"],
      ["drivers/net/usb/int51x1.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/ipheth.c", "ipheth_tx_timeout"],
      ["drivers/net/usb/kaweth.c", "kaweth_tx_timeout"],
      ["drivers/net/usb/lan78xx.c", "lan78xx_tx_timeout"],
      ["drivers/net/usb/mcs7830.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/pegasus.c", "pegasus_tx_timeout"],
      ["drivers/net/usb/qmi_wwan.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/r8152.c", "rtl8152_tx_timeout"],
      ["drivers/net/usb/rndis_host.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/rtl8150.c", "rtl8150_tx_timeout"],
      ["drivers/net/usb/sierra_net.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/smsc75xx.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/smsc95xx.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/sr9700.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/sr9800.c", "usbnet_tx_timeout"],
      ["drivers/net/usb/usbnet.c", "usbnet_tx_timeout"],
      ["drivers/net/vmxnet3/vmxnet3_drv.c", "vmxnet3_tx_timeout"],
      ["drivers/net/wan/cosa.c", "cosa_net_timeout"],
      ["drivers/net/wan/farsync.c", "fst_tx_timeout"],
      ["drivers/net/wan/fsl_ucc_hdlc.c", "uhdlc_tx_timeout"],
      ["drivers/net/wan/lmc/lmc_main.c", "lmc_driver_timeout"],
      ["drivers/net/wan/x25_asy.c", "x25_asy_timeout"],
      ["drivers/net/wimax/i2400m/netdev.c", "i2400m_tx_timeout"],
      ["drivers/net/wireless/intel/ipw2x00/ipw2100.c", "ipw2100_tx_timeout"],
      ["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
      ["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
      ["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
      ["drivers/net/wireless/intersil/orinoco/main.c", "orinoco_tx_timeout"],
      ["drivers/net/wireless/intersil/orinoco/orinoco_usb.c", "orinoco_tx_timeout"],
      ["drivers/net/wireless/intersil/orinoco/orinoco.h", "orinoco_tx_timeout"],
      ["drivers/net/wireless/intersil/prism54/islpci_dev.c", "islpci_eth_tx_timeout"],
      ["drivers/net/wireless/intersil/prism54/islpci_eth.c", "islpci_eth_tx_timeout"],
      ["drivers/net/wireless/intersil/prism54/islpci_eth.h", "islpci_eth_tx_timeout"],
      ["drivers/net/wireless/marvell/mwifiex/main.c", "mwifiex_tx_timeout"],
      ["drivers/net/wireless/quantenna/qtnfmac/core.c", "qtnf_netdev_tx_timeout"],
      ["drivers/net/wireless/quantenna/qtnfmac/core.h", "qtnf_netdev_tx_timeout"],
      ["drivers/net/wireless/rndis_wlan.c", "usbnet_tx_timeout"],
      ["drivers/net/wireless/wl3501_cs.c", "wl3501_tx_timeout"],
      ["drivers/net/wireless/zydas/zd1201.c", "zd1201_tx_timeout"],
      ["drivers/s390/net/qeth_core.h", "qeth_tx_timeout"],
      ["drivers/s390/net/qeth_core_main.c", "qeth_tx_timeout"],
      ["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
      ["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
      ["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
      ["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
      ["drivers/staging/ks7010/ks_wlan_net.c", "ks_wlan_tx_timeout"],
      ["drivers/staging/qlge/qlge_main.c", "qlge_tx_timeout"],
      ["drivers/staging/rtl8192e/rtl8192e/rtl_core.c", "_rtl92e_tx_timeout"],
      ["drivers/staging/rtl8192u/r8192U_core.c", "tx_timeout"],
      ["drivers/staging/unisys/visornic/visornic_main.c", "visornic_xmit_timeout"],
      ["drivers/staging/wlan-ng/p80211netdev.c", "p80211knetdev_tx_timeout"],
      ["drivers/tty/n_gsm.c", "gsm_mux_net_tx_timeout"],
      ["drivers/tty/synclink.c", "hdlcdev_tx_timeout"],
      ["drivers/tty/synclink_gt.c", "hdlcdev_tx_timeout"],
      ["drivers/tty/synclinkmp.c", "hdlcdev_tx_timeout"],
      ["net/atm/lec.c", "lec_tx_timeout"],
      ["net/bluetooth/bnep/netdev.c", "bnep_net_timeout"]
      );
      
      for my $p (@work) {
      	my @pair = @$p;
      	my $file = $pair[0];
      	my $func = $pair[1];
      	print STDERR $file , ": ", $func,"\n";
      	our @ARGV = ($file);
      	while (<ARGV>) {
      		if (m/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/) {
      			print STDERR "found $1+$2 in $file\n";
      		}
      		if (s/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/$1, unsigned int txqueue$2/) {
      			print STDERR "$func found in $file\n";
      		}
      		print;
      	}
      }
      
      where the list of files and functions is simply from:
      
      git grep ndo_tx_timeout, with manual addition of headers
      in the rare cases where the function is from a header,
      then manually changing the few places which actually
      call ndo_tx_timeout.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Acked-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Acked-by: NShannon Nelson <snelson@pensando.io>
      Reviewed-by: NMartin Habets <mhabets@solarflare.com>
      
      changes from v9:
      	fixup a forward declaration
      changes from v9:
      	more leftovers from v3 change
      changes from v8:
              fix up a missing direct call to timeout
              rebased on net-next
      changes from v7:
      	fixup leftovers from v3 change
      changes from v6:
      	fix typo in rtl driver
      changes from v5:
      	add missing files (allow any net device argument name)
      changes from v4:
      	add a missing driver header
      changes from v3:
              change queue # to unsigned
      Changes from v2:
              added headers
      Changes from v1:
              Fix errors found by kbuild:
              generalize the pattern a bit, to pick up
              a couple of instances missed by the previous
              version.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0290bd29
  10. 08 12月, 2019 1 次提交
    • E
      inet: protect against too small mtu values. · 501a90c9
      Eric Dumazet 提交于
      syzbot was once again able to crash a host by setting a very small mtu
      on loopback device.
      
      Let's make inetdev_valid_mtu() available in include/net/ip.h,
      and use it in ip_setup_cork(), so that we protect both ip_append_page()
      and __ip_append_data()
      
      Also add a READ_ONCE() when the device mtu is read.
      
      Pairs this lockless read with one WRITE_ONCE() in __dev_set_mtu(),
      even if other code paths might write over this field.
      
      Add a big comment in include/linux/netdevice.h about dev->mtu
      needing READ_ONCE()/WRITE_ONCE() annotations.
      
      Hopefully we will add the missing ones in followup patches.
      
      [1]
      
      refcount_t: saturated; leaking memory.
      WARNING: CPU: 0 PID: 9464 at lib/refcount.c:22 refcount_warn_saturate+0x138/0x1f0 lib/refcount.c:22
      Kernel panic - not syncing: panic_on_warn set ...
      CPU: 0 PID: 9464 Comm: syz-executor850 Not tainted 5.4.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x197/0x210 lib/dump_stack.c:118
       panic+0x2e3/0x75c kernel/panic.c:221
       __warn.cold+0x2f/0x3e kernel/panic.c:582
       report_bug+0x289/0x300 lib/bug.c:195
       fixup_bug arch/x86/kernel/traps.c:174 [inline]
       fixup_bug arch/x86/kernel/traps.c:169 [inline]
       do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:267
       do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:286
       invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1027
      RIP: 0010:refcount_warn_saturate+0x138/0x1f0 lib/refcount.c:22
      Code: 06 31 ff 89 de e8 c8 f5 e6 fd 84 db 0f 85 6f ff ff ff e8 7b f4 e6 fd 48 c7 c7 e0 71 4f 88 c6 05 56 a6 a4 06 01 e8 c7 a8 b7 fd <0f> 0b e9 50 ff ff ff e8 5c f4 e6 fd 0f b6 1d 3d a6 a4 06 31 ff 89
      RSP: 0018:ffff88809689f550 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffffffff815e4336 RDI: ffffed1012d13e9c
      RBP: ffff88809689f560 R08: ffff88809c50a3c0 R09: fffffbfff15d31b1
      R10: fffffbfff15d31b0 R11: ffffffff8ae98d87 R12: 0000000000000001
      R13: 0000000000040100 R14: ffff888099041104 R15: ffff888218d96e40
       refcount_add include/linux/refcount.h:193 [inline]
       skb_set_owner_w+0x2b6/0x410 net/core/sock.c:1999
       sock_wmalloc+0xf1/0x120 net/core/sock.c:2096
       ip_append_page+0x7ef/0x1190 net/ipv4/ip_output.c:1383
       udp_sendpage+0x1c7/0x480 net/ipv4/udp.c:1276
       inet_sendpage+0xdb/0x150 net/ipv4/af_inet.c:821
       kernel_sendpage+0x92/0xf0 net/socket.c:3794
       sock_sendpage+0x8b/0xc0 net/socket.c:936
       pipe_to_sendpage+0x2da/0x3c0 fs/splice.c:458
       splice_from_pipe_feed fs/splice.c:512 [inline]
       __splice_from_pipe+0x3ee/0x7c0 fs/splice.c:636
       splice_from_pipe+0x108/0x170 fs/splice.c:671
       generic_splice_sendpage+0x3c/0x50 fs/splice.c:842
       do_splice_from fs/splice.c:861 [inline]
       direct_splice_actor+0x123/0x190 fs/splice.c:1035
       splice_direct_to_actor+0x3b4/0xa30 fs/splice.c:990
       do_splice_direct+0x1da/0x2a0 fs/splice.c:1078
       do_sendfile+0x597/0xd00 fs/read_write.c:1464
       __do_sys_sendfile64 fs/read_write.c:1525 [inline]
       __se_sys_sendfile64 fs/read_write.c:1511 [inline]
       __x64_sys_sendfile64+0x1dd/0x220 fs/read_write.c:1511
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x441409
      Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fffb64c4f78 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441409
      RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000005
      RBP: 0000000000073b8a R08: 0000000000000010 R09: 0000000000000010
      R10: 0000000000010001 R11: 0000000000000246 R12: 0000000000402180
      R13: 0000000000402210 R14: 0000000000000000 R15: 0000000000000000
      Kernel Offset: disabled
      Rebooting in 86400 seconds..
      
      Fixes: 1470ddf7 ("inet: Remove explicit write references to sk/inet in ip_append_data")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      501a90c9
  11. 23 11月, 2019 1 次提交
    • D
      net/core: Add support for getting VF GUIDs · 30aad417
      Danit Goldberg 提交于
      Introduce a new ndo: ndo_get_vf_guid, to get from the net
      device the port and node GUID.
      
      New applications can choose to use this interface to show
      GUIDs with iproute2 with commands such as:
      
      - ip link show ib4
      ib4: <BROADCAST,MULTICAST> mtu 4092 qdisc noop state DOWN mode DEFAULT group default qlen 256
      link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
      vf 0     link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff,
      spoof checking off, NODE_GUID 22:44:33:00:33:11:00:33, PORT_GUID 10:21:33:12:00:11:22:10, link-state disable, trust off, query_rss off
      Signed-off-by: NDanit Goldberg <danitg@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      30aad417
  12. 13 11月, 2019 1 次提交
    • P
      netfilter: nf_flow_table: hardware offload support · c29f74e0
      Pablo Neira Ayuso 提交于
      This patch adds the dataplane hardware offload to the flowtable
      infrastructure. Three new flags represent the hardware state of this
      flow:
      
      * FLOW_OFFLOAD_HW: This flow entry resides in the hardware.
      * FLOW_OFFLOAD_HW_DYING: This flow entry has been scheduled to be remove
        from hardware. This might be triggered by either packet path (via TCP
        RST/FIN packet) or via aging.
      * FLOW_OFFLOAD_HW_DEAD: This flow entry has been already removed from
        the hardware, the software garbage collector can remove it from the
        software flowtable.
      
      This patch supports for:
      
      * IPv4 only.
      * Aging via FLOW_CLS_STATS, no packet and byte counter synchronization
        at this stage.
      
      This patch also adds the action callback that specifies how to convert
      the flow entry into the flow_rule object that is passed to the driver.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c29f74e0
  13. 08 11月, 2019 3 次提交
  14. 25 10月, 2019 4 次提交
    • T
      net: remove unnecessary variables and callback · f3b0a18b
      Taehee Yoo 提交于
      This patch removes variables and callback these are related to the nested
      device structure.
      devices that can be nested have their own nest_level variable that
      represents the depth of nested devices.
      In the previous patch, new {lower/upper}_level variables are added and
      they replace old private nest_level variable.
      So, this patch removes all 'nest_level' variables.
      
      In order to avoid lockdep warning, ->ndo_get_lock_subclass() was added
      to get lockdep subclass value, which is actually lower nested depth value.
      But now, they use the dynamic lockdep key to avoid lockdep warning instead
      of the subclass.
      So, this patch removes ->ndo_get_lock_subclass() callback.
      Signed-off-by: NTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3b0a18b
    • T
      net: core: add ignore flag to netdev_adjacent structure · 32b6d34f
      Taehee Yoo 提交于
      In order to link an adjacent node, netdev_upper_dev_link() is used
      and in order to unlink an adjacent node, netdev_upper_dev_unlink() is used.
      unlink operation does not fail, but link operation can fail.
      
      In order to exchange adjacent nodes, we should unlink an old adjacent
      node first. then, link a new adjacent node.
      If link operation is failed, we should link an old adjacent node again.
      But this link operation can fail too.
      It eventually breaks the adjacent link relationship.
      
      This patch adds an ignore flag into the netdev_adjacent structure.
      If this flag is set, netdev_upper_dev_link() ignores an old adjacent
      node for a moment.
      
      This patch also adds new functions for other modules.
      netdev_adjacent_change_prepare()
      netdev_adjacent_change_commit()
      netdev_adjacent_change_abort()
      
      netdev_adjacent_change_prepare() inserts new device into adjacent list
      but new device is not allowed to use immediately.
      If netdev_adjacent_change_prepare() fails, it internally rollbacks
      adjacent list so that we don't need any other action.
      netdev_adjacent_change_commit() deletes old device in the adjacent list
      and allows new device to use.
      netdev_adjacent_change_abort() rollbacks adjacent list.
      Signed-off-by: NTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      32b6d34f
    • T
      net: core: add generic lockdep keys · ab92d68f
      Taehee Yoo 提交于
      Some interface types could be nested.
      (VLAN, BONDING, TEAM, MACSEC, MACVLAN, IPVLAN, VIRT_WIFI, VXLAN, etc..)
      These interface types should set lockdep class because, without lockdep
      class key, lockdep always warn about unexisting circular locking.
      
      In the current code, these interfaces have their own lockdep class keys and
      these manage itself. So that there are so many duplicate code around the
      /driver/net and /net/.
      This patch adds new generic lockdep keys and some helper functions for it.
      
      This patch does below changes.
      a) Add lockdep class keys in struct net_device
         - qdisc_running, xmit, addr_list, qdisc_busylock
         - these keys are used as dynamic lockdep key.
      b) When net_device is being allocated, lockdep keys are registered.
         - alloc_netdev_mqs()
      c) When net_device is being free'd llockdep keys are unregistered.
         - free_netdev()
      d) Add generic lockdep key helper function
         - netdev_register_lockdep_key()
         - netdev_unregister_lockdep_key()
         - netdev_update_lockdep_key()
      e) Remove unnecessary generic lockdep macro and functions
      f) Remove unnecessary lockdep code of each interfaces.
      
      After this patch, each interface modules don't need to maintain
      their lockdep keys.
      Signed-off-by: NTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ab92d68f
    • T
      net: core: limit nested device depth · 5343da4c
      Taehee Yoo 提交于
      Current code doesn't limit the number of nested devices.
      Nested devices would be handled recursively and this needs huge stack
      memory. So, unlimited nested devices could make stack overflow.
      
      This patch adds upper_level and lower_level, they are common variables
      and represent maximum lower/upper depth.
      When upper/lower device is attached or dettached,
      {lower/upper}_level are updated. and if maximum depth is bigger than 8,
      attach routine fails and returns -EMLINK.
      
      In addition, this patch converts recursive routine of
      netdev_walk_all_{lower/upper} to iterator routine.
      
      Test commands:
          ip link add dummy0 type dummy
          ip link add link dummy0 name vlan1 type vlan id 1
          ip link set vlan1 up
      
          for i in {2..55}
          do
      	    let A=$i-1
      
      	    ip link add vlan$i link vlan$A type vlan id $i
          done
          ip link del dummy0
      
      Splat looks like:
      [  155.513226][  T908] BUG: KASAN: use-after-free in __unwind_start+0x71/0x850
      [  155.514162][  T908] Write of size 88 at addr ffff8880608a6cc0 by task ip/908
      [  155.515048][  T908]
      [  155.515333][  T908] CPU: 0 PID: 908 Comm: ip Not tainted 5.4.0-rc3+ #96
      [  155.516147][  T908] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      [  155.517233][  T908] Call Trace:
      [  155.517627][  T908]
      [  155.517918][  T908] Allocated by task 0:
      [  155.518412][  T908] (stack is not available)
      [  155.518955][  T908]
      [  155.519228][  T908] Freed by task 0:
      [  155.519885][  T908] (stack is not available)
      [  155.520452][  T908]
      [  155.520729][  T908] The buggy address belongs to the object at ffff8880608a6ac0
      [  155.520729][  T908]  which belongs to the cache names_cache of size 4096
      [  155.522387][  T908] The buggy address is located 512 bytes inside of
      [  155.522387][  T908]  4096-byte region [ffff8880608a6ac0, ffff8880608a7ac0)
      [  155.523920][  T908] The buggy address belongs to the page:
      [  155.524552][  T908] page:ffffea0001822800 refcount:1 mapcount:0 mapping:ffff88806c657cc0 index:0x0 compound_mapcount:0
      [  155.525836][  T908] flags: 0x100000000010200(slab|head)
      [  155.526445][  T908] raw: 0100000000010200 ffffea0001813808 ffffea0001a26c08 ffff88806c657cc0
      [  155.527424][  T908] raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
      [  155.528429][  T908] page dumped because: kasan: bad access detected
      [  155.529158][  T908]
      [  155.529410][  T908] Memory state around the buggy address:
      [  155.530060][  T908]  ffff8880608a6b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  155.530971][  T908]  ffff8880608a6c00: fb fb fb fb fb f1 f1 f1 f1 00 f2 f2 f2 f3 f3 f3
      [  155.531889][  T908] >ffff8880608a6c80: f3 fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  155.532806][  T908]                                            ^
      [  155.533509][  T908]  ffff8880608a6d00: fb fb fb fb fb fb fb fb fb f1 f1 f1 f1 00 00 00
      [  155.534436][  T908]  ffff8880608a6d80: f2 f3 f3 f3 f3 fb fb fb 00 00 00 00 00 00 00 00
      [ ... ]
      Signed-off-by: NTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5343da4c
  15. 09 10月, 2019 1 次提交
  16. 02 10月, 2019 4 次提交
  17. 17 9月, 2019 1 次提交
    • V
      taprio: Add support for hardware offloading · 9c66d156
      Vinicius Costa Gomes 提交于
      This allows taprio to offload the schedule enforcement to capable
      network cards, resulting in more precise windows and less CPU usage.
      
      The gate mask acts on traffic classes (groups of queues of same
      priority), as specified in IEEE 802.1Q-2018, and following the existing
      taprio and mqprio semantics.
      It is up to the driver to perform conversion between tc and individual
      netdev queues if for some reason it needs to make that distinction.
      
      Full offload is requested from the network interface by specifying
      "flags 2" in the tc qdisc creation command, which in turn corresponds to
      the TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD bit.
      
      The important detail here is the clockid which is implicitly /dev/ptpN
      for full offload, and hence not configurable.
      
      A reference counting API is added to support the use case where Ethernet
      drivers need to keep the taprio offload structure locally (i.e. they are
      a multi-port switch driver, and configuring a port depends on the
      settings of other ports as well). The refcount_t variable is kept in a
      private structure (__tc_taprio_qopt_offload) and not exposed to drivers.
      
      In the future, the private structure might also be expanded with a
      backpointer to taprio_sched *q, to implement the notification system
      described in the patch (of when admin became oper, or an error occurred,
      etc, so the offload can be monitored with 'tc qdisc show').
      Signed-off-by: NVinicius Costa Gomes <vinicius.gomes@intel.com>
      Signed-off-by: NVoon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: NVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c66d156
  18. 25 8月, 2019 1 次提交
  19. 18 8月, 2019 1 次提交
  20. 09 8月, 2019 1 次提交
    • E
      net: use listified RX for handling GRO_NORMAL skbs · 323ebb61
      Edward Cree 提交于
      When GRO decides not to coalesce a packet, in napi_frags_finish(), instead
       of passing it to the stack immediately, place it on a list in the napi
       struct.  Then, at flush time (napi_complete_done(), napi_poll(), or
       napi_busy_loop()), call netif_receive_skb_list_internal() on the list.
      We'd like to do that in napi_gro_flush(), but it's not called if
       !napi->gro_bitmask, so we have to do it in the callers instead.  (There are
       a handful of drivers that call napi_gro_flush() themselves, but it's not
       clear why, or whether this will affect them.)
      Because a full 64 packets is an inefficiently large batch, also consume the
       list whenever it exceeds gro_normal_batch, a new net/core sysctl that
       defaults to 8.
      Signed-off-by: NEdward Cree <ecree@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      323ebb61
  21. 02 7月, 2019 1 次提交
  22. 31 5月, 2019 1 次提交
  23. 28 4月, 2019 1 次提交
  24. 11 4月, 2019 1 次提交
    • S
      failover: allow name change on IFF_UP slave interfaces · 8065a779
      Si-Wei Liu 提交于
      When a netdev appears through hot plug then gets enslaved by a failover
      master that is already up and running, the slave will be opened
      right away after getting enslaved. Today there's a race that userspace
      (udev) may fail to rename the slave if the kernel (net_failover)
      opens the slave earlier than when the userspace rename happens.
      Unlike bond or team, the primary slave of failover can't be renamed by
      userspace ahead of time, since the kernel initiated auto-enslavement is
      unable to, or rather, is never meant to be synchronized with the rename
      request from userspace.
      
      As the failover slave interfaces are not designed to be operated
      directly by userspace apps: IP configuration, filter rules with
      regard to network traffic passing and etc., should all be done on master
      interface. In general, userspace apps only care about the
      name of master interface, while slave names are less important as long
      as admin users can see reliable names that may carry
      other information describing the netdev. For e.g., they can infer that
      "ens3nsby" is a standby slave of "ens3", while for a
      name like "eth0" they can't tell which master it belongs to.
      
      Historically the name of IFF_UP interface can't be changed because
      there might be admin script or management software that is already
      relying on such behavior and assumes that the slave name can't be
      changed once UP. But failover is special: with the in-kernel
      auto-enslavement mechanism, the userspace expectation for device
      enumeration and bring-up order is already broken. Previously initramfs
      and various userspace config tools were modified to bypass failover
      slaves because of auto-enslavement and duplicate MAC address. Similarly,
      in case that users care about seeing reliable slave name, the new type
      of failover slaves needs to be taken care of specifically in userspace
      anyway.
      
      It's less risky to lift up the rename restriction on failover slave
      which is already UP. Although it's possible this change may potentially
      break userspace component (most likely configuration scripts or
      management software) that assumes slave name can't be changed while
      UP, it's relatively a limited and controllable set among all userspace
      components, which can be fixed specifically to listen for the rename
      events on failover slaves. Userspace component interacting with slaves
      is expected to be changed to operate on failover master interface
      instead, as the failover slave is dynamic in nature which may come and
      go at any point.  The goal is to make the role of failover slaves less
      relevant, and userspace components should only deal with failover master
      in the long run.
      
      Fixes: 30c8bd5a ("net: Introduce generic failover module")
      Signed-off-by: NSi-Wei Liu <si-wei.liu@oracle.com>
      Reviewed-by: NLiran Alon <liran.alon@oracle.com>
      Acked-by: NSridhar Samudrala <sridhar.samudrala@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8065a779
  25. 05 4月, 2019 1 次提交
  26. 02 4月, 2019 2 次提交
    • F
      net: move skb->xmit_more hint to softnet data · 6b16f9ee
      Florian Westphal 提交于
      There are two reasons for this.
      
      First, the xmit_more flag conceptually doesn't fit into the skb, as
      xmit_more is not a property related to the skb.
      Its only a hint to the driver that the stack is about to transmit another
      packet immediately.
      
      Second, it was only done this way to not have to pass another argument
      to ndo_start_xmit().
      
      We can place xmit_more in the softnet data, next to the device recursion.
      The recursion counter is already written to on each transmit. The "more"
      indicator is placed right next to it.
      
      Drivers can use the netdev_xmit_more() helper instead of skb->xmit_more
      to check the "more packets coming" hint.
      
      skb->xmit_more is retained (but always 0) to not cause build breakage.
      
      This change takes care of the simple s/skb->xmit_more/netdev_xmit_more()/
      conversions.  Remaining drivers are converted in the next patches.
      Suggested-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6b16f9ee
    • F
      net: place xmit recursion in softnet data · 97cdcf37
      Florian Westphal 提交于
      This fills a hole in softnet data, so no change in structure size.
      
      Also prepares for xmit_more placement in the same spot;
      skb->xmit_more will be removed in followup patch.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      97cdcf37
  27. 29 3月, 2019 1 次提交