1. 18 Dec, 2016 18 commits
    • Sudip Mukherjee's avatar
      net: mv643xx_eth: fix build failure · 3e3397e7
      Sudip Mukherjee authored
      The build of sparc allmodconfig fails with the error:
      "of_irq_to_resource" [drivers/net/ethernet/marvell/mv643xx_eth.ko]
      	undefined!
      
      of_irq_to_resource() is defined when CONFIG_OF_IRQ is defined. And also
      CONFIG_OF_IRQ can only be defined if CONFIG_IRQ is defined. So we can
      safely use #if defined(CONFIG_OF_IRQ) in the code.
      Signed-off-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e3397e7
    • Emese Revfy's avatar
      isdn: Constify some function parameters · a6b3c483
      Emese Revfy authored
      The coming initify gcc plugin expects const pointer types, and caught
      some __printf arguments that weren't const yet. This fixes those.
      Signed-off-by: default avatarEmese Revfy <re.emese@gmail.com>
      [kees: expanded commit message]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6b3c483
    • Ido Schimmel's avatar
      mlxsw: spectrum: Mark split ports as such · 9a60c907
      Ido Schimmel authored
      When a port is split we should mark it as such, as otherwise the split
      ports aren't renamed correctly (e.g. sw1p3 -> sw1p3s1) and the unsplit
      operation fails:
      
      $ devlink port split sw1p3 count 4
      $ devlink port unsplit eth0
      devlink answers: Invalid argument
      [  598.565307] mlxsw_spectrum 0000:03:00.0 eth0: Port wasn't split
      
      Fixes: 67963a33 ("mlxsw: Make devlink port instances independent of spectrum/switchx2 port instances")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reported-by: default avatarTamir Winetroub <tamirw@mellanox.com>
      Reviewed-by: default avatarElad Raz <eladr@mellanox.com>
      Tested-by: default avatarTamir Winetroub <tamirw@mellanox.com>
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a60c907
    • Andy Lutomirski's avatar
      cgroup: Fix CGROUP_BPF config · 483c4933
      Andy Lutomirski authored
      CGROUP_BPF depended on SOCK_CGROUP_DATA which can't be manually
      enabled, making it rather challenging to turn CGROUP_BPF on.
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      483c4933
    • David S. Miller's avatar
      Merge tag 'mac80211-for-davem-2016-12-16' of... · 67a72a58
      David S. Miller authored
      Merge tag 'mac80211-for-davem-2016-12-16' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
      
      Johannes Berg says:
      
      ====================
      Three fixes:
       * avoid a WARN_ON() when trying to use WEP with AP_VLANs
       * ensure enough headroom on mesh forwarding packets
       * don't report unknown/invalid rates to userspace
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67a72a58
    • Arnd Bergmann's avatar
      qed: fix old-style function definition · 7729bad4
      Arnd Bergmann authored
      The newly added file causes a harmless warning, with "make W=1":
      
      drivers/net/ethernet/qlogic/qed/qed_iscsi.c: In function 'qed_get_iscsi_ops':
      drivers/net/ethernet/qlogic/qed/qed_iscsi.c:1268:29: warning: old-style function definition [-Wold-style-definition]
      
      This makes it a proper prototype.
      
      Fixes: fc831825 ("qed: Add support for hardware offloaded iSCSI.")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7729bad4
    • Mantas M's avatar
      net: ipv6: check route protocol when deleting routes · c2ed1880
      Mantas M authored
      The protocol field is checked when deleting IPv4 routes, but ignored for
      IPv6, which causes problems with routing daemons accidentally deleting
      externally set routes (observed by multiple bird6 users).
      
      This can be verified using `ip -6 route del <prefix> proto something`.
      Signed-off-by: default avatarMantas Mikulėnas <grawity@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c2ed1880
    • Manuel Bessler's avatar
      r6040: move spinlock in r6040_close as SOFTIRQ-unsafe lock order detected · c762eaa7
      Manuel Bessler authored
      'ifconfig eth0 down' makes r6040_close() trigger:
       INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
      
      Fixed by moving calls to phy_stop(), napi_disable(), netif_stop_queue()
      to outside of the module's private spin_lock_irq block.
      
      Found on a Versalogic Tomcat SBC with a Vortex86 SoC
      
      s1660e_5150:~# sudo ifconfig eth0 down
      [   61.306415] ======================================================
      [   61.306415] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
      [   61.306415] 4.9.0-gb898d2d-manuel #1 Not tainted
      [   61.306415] ------------------------------------------------------
      [   61.306415] ifconfig/449 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
      [   61.306415]  (&dev->lock){+.+...}, at: [<c1336276>] phy_stop+0x16/0x80
      
      [   61.306415] and this task is already holding:
      [   61.306415]  (&(&lp->lock)->rlock){+.-...}, at: [<d0934c84>] r6040_close+0x24/0x230 [r6040]
      which would create a new lock dependency:
      [   61.306415]  (&(&lp->lock)->rlock){+.-...} -> (&dev->lock){+.+...}
      
      [   61.306415] but this new dependency connects a SOFTIRQ-irq-safe lock:
      [   61.306415]  (&(&lp->lock)->rlock){+.-...}
      [   61.306415] ... which became SOFTIRQ-irq-safe at:
      [   61.306415]   [   61.306415] [<c1075bc5>] __lock_acquire+0x555/0x1770
      [   61.306415]   [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]   [   61.306415] [<c14bb334>] _raw_spin_lock_irqsave+0x24/0x40
      [   61.306415]   [   61.306415] [<d0934ac0>] r6040_start_xmit+0x30/0x1d0 [r6040]
      [   61.306415]   [   61.306415] [<c13a7d4d>] dev_hard_start_xmit+0x9d/0x2d0
      [   61.306415]   [   61.306415] [<c13c8a38>] sch_direct_xmit+0xa8/0x140
      [   61.306415]   [   61.306415] [<c13a8436>] __dev_queue_xmit+0x416/0x780
      [   61.306415]   [   61.306415] [<c13a87aa>] dev_queue_xmit+0xa/0x10
      [   61.306415]   [   61.306415] [<c13b4837>] neigh_resolve_output+0x147/0x220
      [   61.306415]   [   61.306415] [<c144541b>] ip6_finish_output2+0x2fb/0x910
      [   61.306415]   [   61.306415] [<c14494e6>] ip6_finish_output+0xa6/0x1a0
      [   61.306415]   [   61.306415] [<c1449635>] ip6_output+0x55/0x320
      [   61.306415]   [   61.306415] [<c146f4d2>] mld_sendpack+0x352/0x560
      [   61.306415]   [   61.306415] [<c146fe55>] mld_ifc_timer_expire+0x155/0x280
      [   61.306415]   [   61.306415] [<c108b081>] call_timer_fn+0x81/0x270
      [   61.306415]   [   61.306415] [<c108b331>] expire_timers+0xc1/0x180
      [   61.306415]   [   61.306415] [<c108b4f7>] run_timer_softirq+0x77/0x150
      [   61.306415]   [   61.306415] [<c1043d04>] __do_softirq+0xb4/0x3d0
      [   61.306415]   [   61.306415] [<c101a15c>] do_softirq_own_stack+0x1c/0x30
      [   61.306415]   [   61.306415] [<c104416e>] irq_exit+0x8e/0xa0
      [   61.306415]   [   61.306415] [<c1019d31>] do_IRQ+0x51/0x100
      [   61.306415]   [   61.306415] [<c14bc176>] common_interrupt+0x36/0x40
      [   61.306415]   [   61.306415] [<c1134928>] set_root+0x68/0xf0
      [   61.306415]   [   61.306415] [<c1136120>] path_init+0x400/0x640
      [   61.306415]   [   61.306415] [<c11386bf>] path_lookupat+0xf/0xe0
      [   61.306415]   [   61.306415] [<c1139ebc>] filename_lookup+0x6c/0x100
      [   61.306415]   [   61.306415] [<c1139fd5>] user_path_at_empty+0x25/0x30
      [   61.306415]   [   61.306415] [<c11298c6>] SyS_faccessat+0x86/0x1e0
      [   61.306415]   [   61.306415] [<c1129a30>] SyS_access+0x10/0x20
      [   61.306415]   [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]   [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]
      [   61.306415] to a SOFTIRQ-irq-unsafe lock:
      [   61.306415]  (&dev->lock){+.+...}
      [   61.306415] ... which became SOFTIRQ-irq-unsafe at:
      [   61.306415] ...[   61.306415]
      [   61.306415] [<c1075c0c>] __lock_acquire+0x59c/0x1770
      [   61.306415]   [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]   [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]   [   61.306415] [<c133747d>] phy_probe+0x4d/0xc0
      [   61.306415]   [   61.306415] [<c1338afe>] phy_attach_direct+0xbe/0x190
      [   61.306415]   [   61.306415] [<c1338ca7>] phy_connect_direct+0x17/0x60
      [   61.306415]   [   61.306415] [<c1338d23>] phy_connect+0x33/0x70
      [   61.306415]   [   61.306415] [<d09357a0>] r6040_init_one+0x3a0/0x500 [r6040]
      [   61.306415]   [   61.306415] [<c12a78c7>] pci_device_probe+0x77/0xd0
      [   61.306415]   [   61.306415] [<c12f5e15>] driver_probe_device+0x145/0x280
      [   61.306415]   [   61.306415] [<c12f5fd9>] __driver_attach+0x89/0x90
      [   61.306415]   [   61.306415] [<c12f43ef>] bus_for_each_dev+0x4f/0x80
      [   61.306415]   [   61.306415] [<c12f5954>] driver_attach+0x14/0x20
      [   61.306415]   [   61.306415] [<c12f55b7>] bus_add_driver+0x197/0x210
      [   61.306415]   [   61.306415] [<c12f6a21>] driver_register+0x51/0xd0
      [   61.306415]   [   61.306415] [<c12a6955>] __pci_register_driver+0x45/0x50
      [   61.306415]   [   61.306415] [<d0938017>] 0xd0938017
      [   61.306415]   [   61.306415] [<c100043f>] do_one_initcall+0x2f/0x140
      [   61.306415]   [   61.306415] [<c10e48c0>] do_init_module+0x4a/0x19b
      [   61.306415]   [   61.306415] [<c10a680e>] load_module+0x1b2e/0x2070
      [   61.306415]   [   61.306415] [<c10a6eb9>] SyS_finit_module+0x69/0x80
      [   61.306415]   [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]   [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]
      [   61.306415] other info that might help us debug this:
      [   61.306415]
      [   61.306415]  Possible interrupt unsafe locking scenario:
      [   61.306415]
      [   61.306415]        CPU0                    CPU1
      [   61.306415]        ----                    ----
      [   61.306415]   lock(&dev->lock);
      [   61.306415]                                local_irq_disable();
      [   61.306415]                                lock(&(&lp->lock)->rlock);
      [   61.306415]                                lock(&dev->lock);
      [   61.306415]   <Interrupt>
      [   61.306415]     lock(&(&lp->lock)->rlock);
      [   61.306415]
      [   61.306415]  *** DEADLOCK ***
      [   61.306415]
      [   61.306415] 2 locks held by ifconfig/449:
      [   61.306415]  #0:  (rtnl_mutex){+.+.+.}, at: [<c13b68ef>] rtnl_lock+0xf/0x20
      [   61.306415]  #1:  (&(&lp->lock)->rlock){+.-...}, at: [<d0934c84>] r6040_close+0x24/0x230 [r6040]
      [   61.306415]
      [   61.306415] the dependencies between SOFTIRQ-irq-safe lock and the holding lock:
      [   61.306415] -> (&(&lp->lock)->rlock){+.-...} ops: 3049 {
      [   61.306415]    HARDIRQ-ON-W at:
      [   61.306415]                     [   61.306415] [<c1075be7>] __lock_acquire+0x577/0x1770
      [   61.306415]                     [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                     [   61.306415] [<c14bb21b>] _raw_spin_lock+0x1b/0x30
      [   61.306415]                     [   61.306415] [<d09343cc>] r6040_poll+0x2c/0x330 [r6040]
      [   61.306415]                     [   61.306415] [<c13a5577>] net_rx_action+0x197/0x340
      [   61.306415]                     [   61.306415] [<c1043d04>] __do_softirq+0xb4/0x3d0
      [   61.306415]                     [   61.306415] [<c1044037>] run_ksoftirqd+0x17/0x40
      [   61.306415]                     [   61.306415] [<c105fe91>] smpboot_thread_fn+0x141/0x180
      [   61.306415]                     [   61.306415] [<c105c84e>] kthread+0xde/0x110
      [   61.306415]                     [   61.306415] [<c14bb949>] ret_from_fork+0x19/0x30
      [   61.306415]    IN-SOFTIRQ-W at:
      [   61.306415]                     [   61.306415] [<c1075bc5>] __lock_acquire+0x555/0x1770
      [   61.306415]                     [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                     [   61.306415] [<c14bb334>] _raw_spin_lock_irqsave+0x24/0x40
      [   61.306415]                     [   61.306415] [<d0934ac0>] r6040_start_xmit+0x30/0x1d0 [r6040]
      [   61.306415]                     [   61.306415] [<c13a7d4d>] dev_hard_start_xmit+0x9d/0x2d0
      [   61.306415]                     [   61.306415] [<c13c8a38>] sch_direct_xmit+0xa8/0x140
      [   61.306415]                     [   61.306415] [<c13a8436>] __dev_queue_xmit+0x416/0x780
      [   61.306415]                     [   61.306415] [<c13a87aa>] dev_queue_xmit+0xa/0x10
      [   61.306415]                     [   61.306415] [<c13b4837>] neigh_resolve_output+0x147/0x220
      [   61.306415]                     [   61.306415] [<c144541b>] ip6_finish_output2+0x2fb/0x910
      [   61.306415]                     [   61.306415] [<c14494e6>] ip6_finish_output+0xa6/0x1a0
      [   61.306415]                     [   61.306415] [<c1449635>] ip6_output+0x55/0x320
      [   61.306415]                     [   61.306415] [<c146f4d2>] mld_sendpack+0x352/0x560
      [   61.306415]                     [   61.306415] [<c146fe55>] mld_ifc_timer_expire+0x155/0x280
      [   61.306415]                     [   61.306415] [<c108b081>] call_timer_fn+0x81/0x270
      [   61.306415]                     [   61.306415] [<c108b331>] expire_timers+0xc1/0x180
      [   61.306415]                     [   61.306415] [<c108b4f7>] run_timer_softirq+0x77/0x150
      [   61.306415]                     [   61.306415] [<c1043d04>] __do_softirq+0xb4/0x3d0
      [   61.306415]                     [   61.306415] [<c101a15c>] do_softirq_own_stack+0x1c/0x30
      [   61.306415]                     [   61.306415] [<c104416e>] irq_exit+0x8e/0xa0
      [   61.306415]                     [   61.306415] [<c1019d31>] do_IRQ+0x51/0x100
      [   61.306415]                     [   61.306415] [<c14bc176>] common_interrupt+0x36/0x40
      [   61.306415]                     [   61.306415] [<c1134928>] set_root+0x68/0xf0
      [   61.306415]                     [   61.306415] [<c1136120>] path_init+0x400/0x640
      [   61.306415]                     [   61.306415] [<c11386bf>] path_lookupat+0xf/0xe0
      [   61.306415]                     [   61.306415] [<c1139ebc>] filename_lookup+0x6c/0x100
      [   61.306415]                     [   61.306415] [<c1139fd5>] user_path_at_empty+0x25/0x30
      [   61.306415]                     [   61.306415] [<c11298c6>] SyS_faccessat+0x86/0x1e0
      [   61.306415]                     [   61.306415] [<c1129a30>] SyS_access+0x10/0x20
      [   61.306415]                     [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]                     [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]    INITIAL USE at:
      [   61.306415]                    [   61.306415] [<c107586e>] __lock_acquire+0x1fe/0x1770
      [   61.306415]                    [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                    [   61.306415] [<c14bb334>] _raw_spin_lock_irqsave+0x24/0x40
      [   61.306415]                    [   61.306415] [<d093474e>] r6040_get_stats+0x1e/0x60 [r6040]
      [   61.306415]                    [   61.306415] [<c139fb16>] dev_get_stats+0x96/0xc0
      [   61.306415]                    [   61.306415] [<c14b416e>] rtnl_fill_stats+0x36/0xfd
      [   61.306415]                    [   61.306415] [<c13b7b3c>] rtnl_fill_ifinfo+0x47c/0xce0
      [   61.306415]                    [   61.306415] [<c13bc08e>] rtmsg_ifinfo_build_skb+0x4e/0xd0
      [   61.306415]                    [   61.306415] [<c13bc120>] rtmsg_ifinfo.part.20+0x10/0x40
      [   61.306415]                    [   61.306415] [<c13bc16b>] rtmsg_ifinfo+0x1b/0x20
      [   61.306415]                    [   61.306415] [<c13a9d19>] register_netdevice+0x409/0x550
      [   61.306415]                    [   61.306415] [<c13a9e72>] register_netdev+0x12/0x20
      [   61.306415]                    [   61.306415] [<d09357e8>] r6040_init_one+0x3e8/0x500 [r6040]
      [   61.306415]                    [   61.306415] [<c12a78c7>] pci_device_probe+0x77/0xd0
      [   61.306415]                    [   61.306415] [<c12f5e15>] driver_probe_device+0x145/0x280
      [   61.306415]                    [   61.306415] [<c12f5fd9>] __driver_attach+0x89/0x90
      [   61.306415]                    [   61.306415] [<c12f43ef>] bus_for_each_dev+0x4f/0x80
      [   61.306415]                    [   61.306415] [<c12f5954>] driver_attach+0x14/0x20
      [   61.306415]                    [   61.306415] [<c12f55b7>] bus_add_driver+0x197/0x210
      [   61.306415]                    [   61.306415] [<c12f6a21>] driver_register+0x51/0xd0
      [   61.306415]                    [   61.306415] [<c12a6955>] __pci_register_driver+0x45/0x50
      [   61.306415]                    [   61.306415] [<d0938017>] 0xd0938017
      [   61.306415]                    [   61.306415] [<c100043f>] do_one_initcall+0x2f/0x140
      [   61.306415]                    [   61.306415] [<c10e48c0>] do_init_module+0x4a/0x19b
      [   61.306415]                    [   61.306415] [<c10a680e>] load_module+0x1b2e/0x2070
      [   61.306415]                    [   61.306415] [<c10a6eb9>] SyS_finit_module+0x69/0x80
      [   61.306415]                    [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]                    [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]  }
      [   61.306415]  ... key      at: [<d0936280>] __key.45893+0x0/0xfffff739 [r6040]
      [   61.306415]  ... acquired at:
      [   61.306415]    [   61.306415] [<c1074a32>] check_irq_usage+0x42/0xb0
      [   61.306415]    [   61.306415] [<c107677c>] __lock_acquire+0x110c/0x1770
      [   61.306415]    [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]    [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]    [   61.306415] [<c1336276>] phy_stop+0x16/0x80
      [   61.306415]    [   61.306415] [<d0934ce9>] r6040_close+0x89/0x230 [r6040]
      [   61.306415]    [   61.306415] [<c13a0a91>] __dev_close_many+0x61/0xa0
      [   61.306415]    [   61.306415] [<c13a0bbf>] __dev_close+0x1f/0x30
      [   61.306415]    [   61.306415] [<c13a9127>] __dev_change_flags+0x87/0x150
      [   61.306415]    [   61.306415] [<c13a9213>] dev_change_flags+0x23/0x60
      [   61.306415]    [   61.306415] [<c1416238>] devinet_ioctl+0x5f8/0x6f0
      [   61.306415]    [   61.306415] [<c1417f75>] inet_ioctl+0x65/0x90
      [   61.306415]    [   61.306415] [<c1389b54>] sock_ioctl+0x124/0x2b0
      [   61.306415]    [   61.306415] [<c113cf7c>] do_vfs_ioctl+0x7c/0x790
      [   61.306415]    [   61.306415] [<c113d6b8>] SyS_ioctl+0x28/0x50
      [   61.306415]    [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]    [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]
      [   61.306415]
      the dependencies between the lock to be acquired[   61.306415]  and SOFTIRQ-irq-unsafe lock:
      [   61.306415] -> (&dev->lock){+.+...} ops: 56 {
      [   61.306415]    HARDIRQ-ON-W at:
      [   61.306415]                     [   61.306415] [<c1075be7>] __lock_acquire+0x577/0x1770
      [   61.306415]                     [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                     [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]                     [   61.306415] [<c133747d>] phy_probe+0x4d/0xc0
      [   61.306415]                     [   61.306415] [<c1338afe>] phy_attach_direct+0xbe/0x190
      [   61.306415]                     [   61.306415] [<c1338ca7>] phy_connect_direct+0x17/0x60
      [   61.306415]                     [   61.306415] [<c1338d23>] phy_connect+0x33/0x70
      [   61.306415]                     [   61.306415] [<d09357a0>] r6040_init_one+0x3a0/0x500 [r6040]
      [   61.306415]                     [   61.306415] [<c12a78c7>] pci_device_probe+0x77/0xd0
      [   61.306415]                     [   61.306415] [<c12f5e15>] driver_probe_device+0x145/0x280
      [   61.306415]                     [   61.306415] [<c12f5fd9>] __driver_attach+0x89/0x90
      [   61.306415]                     [   61.306415] [<c12f43ef>] bus_for_each_dev+0x4f/0x80
      [   61.306415]                     [   61.306415] [<c12f5954>] driver_attach+0x14/0x20
      [   61.306415]                     [   61.306415] [<c12f55b7>] bus_add_driver+0x197/0x210
      [   61.306415]                     [   61.306415] [<c12f6a21>] driver_register+0x51/0xd0
      [   61.306415]                     [   61.306415] [<c12a6955>] __pci_register_driver+0x45/0x50
      [   61.306415]                     [   61.306415] [<d0938017>] 0xd0938017
      [   61.306415]                     [   61.306415] [<c100043f>] do_one_initcall+0x2f/0x140
      [   61.306415]                     [   61.306415] [<c10e48c0>] do_init_module+0x4a/0x19b
      [   61.306415]                     [   61.306415] [<c10a680e>] load_module+0x1b2e/0x2070
      [   61.306415]                     [   61.306415] [<c10a6eb9>] SyS_finit_module+0x69/0x80
      [   61.306415]                     [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]                     [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]    SOFTIRQ-ON-W at:
      [   61.306415]                     [   61.306415] [<c1075c0c>] __lock_acquire+0x59c/0x1770
      [   61.306415]                     [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                     [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]                     [   61.306415] [<c133747d>] phy_probe+0x4d/0xc0
      [   61.306415]                     [   61.306415] [<c1338afe>] phy_attach_direct+0xbe/0x190
      [   61.306415]                     [   61.306415] [<c1338ca7>] phy_connect_direct+0x17/0x60
      [   61.306415]                     [   61.306415] [<c1338d23>] phy_connect+0x33/0x70
      [   61.306415]                     [   61.306415] [<d09357a0>] r6040_init_one+0x3a0/0x500 [r6040]
      [   61.306415]                     [   61.306415] [<c12a78c7>] pci_device_probe+0x77/0xd0
      [   61.306415]                     [   61.306415] [<c12f5e15>] driver_probe_device+0x145/0x280
      [   61.306415]                     [   61.306415] [<c12f5fd9>] __driver_attach+0x89/0x90
      [   61.306415]                     [   61.306415] [<c12f43ef>] bus_for_each_dev+0x4f/0x80
      [   61.306415]                     [   61.306415] [<c12f5954>] driver_attach+0x14/0x20
      [   61.306415]                     [   61.306415] [<c12f55b7>] bus_add_driver+0x197/0x210
      [   61.306415]                     [   61.306415] [<c12f6a21>] driver_register+0x51/0xd0
      [   61.306415]                     [   61.306415] [<c12a6955>] __pci_register_driver+0x45/0x50
      [   61.306415]                     [   61.306415] [<d0938017>] 0xd0938017
      [   61.306415]                     [   61.306415] [<c100043f>] do_one_initcall+0x2f/0x140
      [   61.306415]                     [   61.306415] [<c10e48c0>] do_init_module+0x4a/0x19b
      [   61.306415]                     [   61.306415] [<c10a680e>] load_module+0x1b2e/0x2070
      [   61.306415]                     [   61.306415] [<c10a6eb9>] SyS_finit_module+0x69/0x80
      [   61.306415]                     [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]                     [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]    INITIAL USE at:
      [   61.306415]                    [   61.306415] [<c107586e>] __lock_acquire+0x1fe/0x1770
      [   61.306415]                    [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]                    [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]                    [   61.306415] [<c133747d>] phy_probe+0x4d/0xc0
      [   61.306415]                    [   61.306415] [<c1338afe>] phy_attach_direct+0xbe/0x190
      [   61.306415]                    [   61.306415] [<c1338ca7>] phy_connect_direct+0x17/0x60
      [   61.306415]                    [   61.306415] [<c1338d23>] phy_connect+0x33/0x70
      [   61.306415]                    [   61.306415] [<d09357a0>] r6040_init_one+0x3a0/0x500 [r6040]
      [   61.306415]                    [   61.306415] [<c12a78c7>] pci_device_probe+0x77/0xd0
      [   61.306415]                    [   61.306415] [<c12f5e15>] driver_probe_device+0x145/0x280
      [   61.306415]                    [   61.306415] [<c12f5fd9>] __driver_attach+0x89/0x90
      [   61.306415]                    [   61.306415] [<c12f43ef>] bus_for_each_dev+0x4f/0x80
      [   61.306415]                    [   61.306415] [<c12f5954>] driver_attach+0x14/0x20
      [   61.306415]                    [   61.306415] [<c12f55b7>] bus_add_driver+0x197/0x210
      [   61.306415]                    [   61.306415] [<c12f6a21>] driver_register+0x51/0xd0
      [   61.306415]                    [   61.306415] [<c12a6955>] __pci_register_driver+0x45/0x50
      [   61.306415]                    [   61.306415] [<d0938017>] 0xd0938017
      [   61.306415]                    [   61.306415] [<c100043f>] do_one_initcall+0x2f/0x140
      [   61.306415]                    [   61.306415] [<c10e48c0>] do_init_module+0x4a/0x19b
      [   61.306415]                    [   61.306415] [<c10a680e>] load_module+0x1b2e/0x2070
      [   61.306415]                    [   61.306415] [<c10a6eb9>] SyS_finit_module+0x69/0x80
      [   61.306415]                    [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]                    [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]  }
      [   61.306415]  ... key      at: [<c1f28f39>] __key.43998+0x0/0x8
      [   61.306415]  ... acquired at:
      [   61.306415]    [   61.306415] [<c1074a32>] check_irq_usage+0x42/0xb0
      [   61.306415]    [   61.306415] [<c107677c>] __lock_acquire+0x110c/0x1770
      [   61.306415]    [   61.306415] [<c107717c>] lock_acquire+0x7c/0x150
      [   61.306415]    [   61.306415] [<c14b7add>] mutex_lock_nested+0x2d/0x4a0
      [   61.306415]    [   61.306415] [<c1336276>] phy_stop+0x16/0x80
      [   61.306415]    [   61.306415] [<d0934ce9>] r6040_close+0x89/0x230 [r6040]
      [   61.306415]    [   61.306415] [<c13a0a91>] __dev_close_many+0x61/0xa0
      [   61.306415]    [   61.306415] [<c13a0bbf>] __dev_close+0x1f/0x30
      [   61.306415]    [   61.306415] [<c13a9127>] __dev_change_flags+0x87/0x150
      [   61.306415]    [   61.306415] [<c13a9213>] dev_change_flags+0x23/0x60
      [   61.306415]    [   61.306415] [<c1416238>] devinet_ioctl+0x5f8/0x6f0
      [   61.306415]    [   61.306415] [<c1417f75>] inet_ioctl+0x65/0x90
      [   61.306415]    [   61.306415] [<c1389b54>] sock_ioctl+0x124/0x2b0
      [   61.306415]    [   61.306415] [<c113cf7c>] do_vfs_ioctl+0x7c/0x790
      [   61.306415]    [   61.306415] [<c113d6b8>] SyS_ioctl+0x28/0x50
      [   61.306415]    [   61.306415] [<c100179f>] do_int80_syscall_32+0x3f/0x110
      [   61.306415]    [   61.306415] [<c14bba3f>] restore_all+0x0/0x61
      [   61.306415]
      [   61.306415]
      [   61.306415] stack backtrace:
      [   61.306415] CPU: 0 PID: 449 Comm: ifconfig Not tainted 4.9.0-gb898d2d-manuel #1
      [   61.306415] Call Trace:
      [   61.306415]  dump_stack+0x16/0x19
      [   61.306415]  check_usage+0x3f6/0x550
      [   61.306415]  ? check_usage+0x4d/0x550
      [   61.306415]  check_irq_usage+0x42/0xb0
      [   61.306415]  __lock_acquire+0x110c/0x1770
      [   61.306415]  lock_acquire+0x7c/0x150
      [   61.306415]  ? phy_stop+0x16/0x80
      [   61.306415]  mutex_lock_nested+0x2d/0x4a0
      [   61.306415]  ? phy_stop+0x16/0x80
      [   61.306415]  ? r6040_close+0x24/0x230 [r6040]
      [   61.306415]  ? __delay+0x9/0x10
      [   61.306415]  phy_stop+0x16/0x80
      [   61.306415]  r6040_close+0x89/0x230 [r6040]
      [   61.306415]  __dev_close_many+0x61/0xa0
      [   61.306415]  __dev_close+0x1f/0x30
      [   61.306415]  __dev_change_flags+0x87/0x150
      [   61.306415]  dev_change_flags+0x23/0x60
      [   61.306415]  devinet_ioctl+0x5f8/0x6f0
      [   61.306415]  inet_ioctl+0x65/0x90
      [   61.306415]  sock_ioctl+0x124/0x2b0
      [   61.306415]  ? dlci_ioctl_set+0x30/0x30
      [   61.306415]  do_vfs_ioctl+0x7c/0x790
      [   61.306415]  ? trace_hardirqs_on+0xb/0x10
      [   61.306415]  ? call_rcu_sched+0xd/0x10
      [   61.306415]  ? __put_cred+0x32/0x50
      [   61.306415]  ? SyS_faccessat+0x178/0x1e0
      [   61.306415]  SyS_ioctl+0x28/0x50
      [   61.306415]  do_int80_syscall_32+0x3f/0x110
      [   61.306415]  entry_INT80_32+0x2f/0x2f
      [   61.306415] EIP: 0xb764d364
      [   61.306415] EFLAGS: 00000286 CPU: 0
      [   61.306415] EAX: ffffffda EBX: 00000004 ECX: 00008914 EDX: bfa99d7c
      [   61.306415] ESI: bfa99e4c EDI: fffffffe EBP: 00000004 ESP: bfa99d58
      [   61.306415]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
      [   63.836607] r6040 0000:00:08.0 eth0: Link is Down
      Signed-off-by: default avatarManuel Bessler <manuel.bessler@sensus.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c762eaa7
    • Dan Carpenter's avatar
      irda: w83977af_ir: cleanup an indent issue · 3a7f0762
      Dan Carpenter authored
      In commit 99d8d215 ("irda: w83977af_ir: Neaten logging"), we
      accidentally added an extra tab to these lines.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a7f0762
    • Philippe Reynes's avatar
      net: sfc: use new api ethtool_{get|set}_link_ksettings · 7cafe8f8
      Philippe Reynes authored
      The ethtool api {get|set}_settings is deprecated.
      We move this driver to new api {get|set}_link_ksettings.
      Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
      Tested-by: default avatarBert Kenward <bkenward@solarflare.com>
      Acked-by: default avatarBert Kenward <bkenward@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7cafe8f8
    • Philippe Reynes's avatar
      net: davicom: dm9000: use new api ethtool_{get|set}_link_ksettings · 99bff5ee
      Philippe Reynes authored
      The ethtool api {get|set}_settings is deprecated.
      We move this driver to new api {get|set}_link_ksettings.
      Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      99bff5ee
    • Philippe Reynes's avatar
      net: cirrus: ep93xx: use new api ethtool_{get|set}_link_ksettings · 93dfe6c2
      Philippe Reynes authored
      The ethtool api {get|set}_settings is deprecated.
      We move this driver to new api {get|set}_link_ksettings.
      Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93dfe6c2
    • Philippe Reynes's avatar
      net: chelsio: cxgb3: use new api ethtool_{get|set}_link_ksettings · b7b44fd2
      Philippe Reynes authored
      The ethtool api {get|set}_settings is deprecated.
      We move this driver to new api {get|set}_link_ksettings.
      Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7b44fd2
    • Philippe Reynes's avatar
      net: chelsio: cxgb2: use new api ethtool_{get|set}_link_ksettings · 49cad939
      Philippe Reynes authored
      The ethtool api {get|set}_settings is deprecated.
      We move this driver to new api {get|set}_link_ksettings.
      Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      49cad939
    • David S. Miller's avatar
      Merge branch 'bpf-fixes' · 6219d055
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      Couple of BPF fixes
      
      This set contains three BPF fixes for net, one that addresses the
      complaint from Geert wrt static allocations, and the other is a fix
      wrt mem accounting that I found recently during testing and there's
      still one more fix on the map value marking.
      
      Thanks!
      
      v1 -> v2:
        - Patch 1 as is.
        - Fixed kbuild bot issue by letting charging helpers stay in the
          syscall.c, since there locked_vm is valid and only export the
          ones needed by bpf_prog_realloc(). Add empty stubs in case the
          bpf syscall is not enabled.
        - Added patch 3 that addresses one more issue in map val marking.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6219d055
    • Daniel Borkmann's avatar
      bpf: fix mark_reg_unknown_value for spilled regs on map value marking · 6760bf2d
      Daniel Borkmann authored
      Martin reported a verifier issue that hit the BUG_ON() for his
      test case in the mark_reg_unknown_value() function:
      
        [  202.861380] kernel BUG at kernel/bpf/verifier.c:467!
        [...]
        [  203.291109] Call Trace:
        [  203.296501]  [<ffffffff811364d5>] mark_map_reg+0x45/0x50
        [  203.308225]  [<ffffffff81136558>] mark_map_regs+0x78/0x90
        [  203.320140]  [<ffffffff8113938d>] do_check+0x226d/0x2c90
        [  203.331865]  [<ffffffff8113a6ab>] bpf_check+0x48b/0x780
        [  203.343403]  [<ffffffff81134c8e>] bpf_prog_load+0x27e/0x440
        [  203.355705]  [<ffffffff8118a38f>] ? handle_mm_fault+0x11af/0x1230
        [  203.369158]  [<ffffffff812d8188>] ? security_capable+0x48/0x60
        [  203.382035]  [<ffffffff811351a4>] SyS_bpf+0x124/0x960
        [  203.393185]  [<ffffffff810515f6>] ? __do_page_fault+0x276/0x490
        [  203.406258]  [<ffffffff816db320>] entry_SYSCALL_64_fastpath+0x13/0x94
      
      This issue got uncovered after the fix in a08dd0da ("bpf: fix
      regression on verifier pruning wrt map lookups"). The reason why it
      wasn't noticed before was, because as mentioned in a08dd0da,
      mark_map_regs() was doing the id matching incorrectly based on the
      uncached regs[regno].id. So, in the first loop, we walked all regs
      and as soon as we found regno == i, then this reg's id was cleared
      when calling mark_reg_unknown_value() thus that every subsequent
      register was probed against id of 0 (which, in combination with the
      PTR_TO_MAP_VALUE_OR_NULL type is an invalid condition that no other
      register state can hold), and therefore wasn't type transitioned such
      as in the spilled register case for the second loop.
      
      Now since that got fixed, it turned out that 57a09bf0 ("bpf:
      Detect identical PTR_TO_MAP_VALUE_OR_NULL registers") used
      mark_reg_unknown_value() incorrectly for the spilled regs, and thus
      hitting the BUG_ON() in some cases due to regno >= MAX_BPF_REG.
      
      Although spilled regs have the same type as the non-spilled regs
      for the verifier state, that is, struct bpf_reg_state, they are
      semantically different from the non-spilled regs. In other words,
      there can be up to 64 (MAX_BPF_STACK / BPF_REG_SIZE) spilled regs
      in the stack, for example, register R<x> could have been spilled by
      the program to stack location X, Y, Z, and in mark_map_regs() we
      need to scan these stack slots of type STACK_SPILL for potential
      registers that we have to transition from PTR_TO_MAP_VALUE_OR_NULL.
      Therefore, depending on the location, the spilled_regs regno can
      be a lot higher than just MAX_BPF_REG's value since we operate on
      stack instead. The reset in mark_reg_unknown_value() itself is
      just fine, only that the BUG_ON() was inappropriate for this. Fix
      it by making a __mark_reg_unknown_value() version that can be
      called from mark_map_reg() generically; we know for the non-spilled
      case that the regno is always < MAX_BPF_REG anyway.
      
      Fixes: 57a09bf0 ("bpf: Detect identical PTR_TO_MAP_VALUE_OR_NULL registers")
      Reported-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6760bf2d
    • Daniel Borkmann's avatar
      bpf: fix overflow in prog accounting · 5ccb071e
      Daniel Borkmann authored
      Commit aaac3ba9 ("bpf: charge user for creation of BPF maps and
      programs") made a wrong assumption of charging against prog->pages.
      Unlike map->pages, prog->pages are still subject to change when we
      need to expand the program through bpf_prog_realloc().
      
      This can for example happen during verification stage when we need to
      expand and rewrite parts of the program. Should the required space
      cross a page boundary, then prog->pages is not the same anymore as
      its original value that we used to bpf_prog_charge_memlock() on. Thus,
      we'll hit a wrap-around during bpf_prog_uncharge_memlock() when prog
      is freed eventually. I noticed this that despite having unlimited
      memlock, programs suddenly refused to load with EPERM error due to
      insufficient memlock.
      
      There are two ways to fix this issue. One would be to add a cached
      variable to struct bpf_prog that takes a snapshot of prog->pages at the
      time of charging. The other approach is to also account for resizes. I
      chose to go with the latter for a couple of reasons: i) We want accounting
      rather to be more accurate instead of further fooling limits, ii) adding
      yet another page counter on struct bpf_prog would also be a waste just
      for this purpose. We also do want to charge as early as possible to
      avoid going into the verifier just to find out later on that we crossed
      limits. The only place that needs to be fixed is bpf_prog_realloc(),
      since only here we expand the program, so we try to account for the
      needed delta and should we fail, call-sites check for outcome anyway.
      On cBPF to eBPF migrations, we don't grab a reference to the user as
      they are charged differently. With that in place, my test case worked
      fine.
      
      Fixes: aaac3ba9 ("bpf: charge user for creation of BPF maps and programs")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ccb071e
    • Daniel Borkmann's avatar
      bpf: dynamically allocate digest scratch buffer · aafe6ae9
      Daniel Borkmann authored
      Geert rightfully complained that 7bd509e3 ("bpf: add prog_digest
      and expose it via fdinfo/netlink") added a too large allocation of
      variable 'raw' from bss section, and should instead be done dynamically:
      
        # ./scripts/bloat-o-meter kernel/bpf/core.o.1 kernel/bpf/core.o.2
        add/remove: 3/0 grow/shrink: 0/0 up/down: 33291/0 (33291)
        function                                     old     new   delta
        raw                                            -   32832  +32832
        [...]
      
      Since this is only relevant during program creation path, which can be
      considered slow-path anyway, lets allocate that dynamically and be not
      implicitly dependent on verifier mutex. Move bpf_prog_calc_digest() at
      the beginning of replace_map_fd_with_map_ptr() and also error handling
      stays straight forward.
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aafe6ae9
  2. 17 Dec, 2016 22 commits
    • David S. Miller's avatar
      Merge branch 'gtp-fixes' · 40e972ab
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      GTP tunneling fixes for net
      
      The following patchset contains two GTP tunneling fixes for your net
      tree, they are:
      
      1) Offset to IPv4 header in gtp_check_src_ms_ipv4() is incorrect, thus
         this function always succeeds and therefore this defeats this sanity
         check. This allows packets that have no PDP to go though, patch from
         Lionel Gauthier.
      
      2) According to Note 0 of Figure 2 in Section 6 of 3GPP TS 29.060 v13.5.0
         Release 13, always set GTPv1 reserved bit to zero. This may cause
         interoperability problems, patch from Harald Welte.
      
      Please, apply, thanks a lot!
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40e972ab
    • Harald Welte's avatar
      gtp: Fix initialization of Flags octet in GTPv1 header · d928be81
      Harald Welte authored
      When generating a GTPv1 header in gtp1_push_header(), initialize the
      'reserved' bit to zero.  All 3GPP specifications for GTPv1 from Release
      99 through Release 13 agree that a transmitter shall set this bit to
      zero, see e.g. Note 0 of Figure 2 in Section 6 of 3GPP TS 29.060 v13.5.0
      Release 13, available from
      http://www.etsi.org/deliver/etsi_ts/129000_129099/129060/13.05.00_60/ts_129060v130500p.pdfSigned-off-by: default avatarHarald Welte <laforge@gnumonks.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d928be81
    • Lionel Gauthier's avatar
      gtp: gtp_check_src_ms_ipv4() always return success · 88edf103
      Lionel Gauthier authored
      gtp_check_src_ms_ipv4() did not find the PDP context matching with the
      UE IP address because the memory location is not right, but the result
      is inverted by the Boolean "not" operator.  So whatever is the PDP
      context, any call to this function is successful.
      Signed-off-by: default avatarLionel Gauthier <Lionel.Gauthier@eurecom.fr>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88edf103
    • Kees Cook's avatar
      net/x25: use designated initializers · e999cb43
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e999cb43
    • Kees Cook's avatar
      isdn: use designated initializers · ebf12f13
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ebf12f13
    • Kees Cook's avatar
      bna: use designated initializers · 9751362a
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9751362a
    • Kees Cook's avatar
      WAN: use designated initializers · aabd7ad9
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aabd7ad9
    • Kees Cook's avatar
      net: use designated initializers · 9d1c0ca5
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d1c0ca5
    • Kees Cook's avatar
      ATM: use designated initializers · 99a5e178
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      99a5e178
    • Kees Cook's avatar
      isdn/gigaset: use designated initializers · 47941950
      Kees Cook authored
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47941950
    • David S. Miller's avatar
      Merge branch 'virtio_net-XDP' · cd333e37
      David S. Miller authored
      John Fastabend says:
      
      ====================
      XDP for virtio_net
      
      This implements virtio_net for the mergeable buffers and big_packet
      modes. I tested this with vhost_net running on qemu and did not see
      any issues. For testing num_buf > 1 I added a hack to vhost driver
      to only but 100 bytes per buffer.
      
      There are some restrictions for XDP to be enabled and work well
      (see patch 3) for more details.
      
        1. GUEST_TSO{4|6} must be off
        2. MTU must be less than PAGE_SIZE
        3. queues must be available to dedicate to XDP
        4. num_bufs received in mergeable buffers must be 1
        5. big_packet mode must have all data on single page
      
      To test this I used pktgen in the hypervisor and ran the XDP sample
      programs xdp1 and xdp2 from ./samples/bpf in the host. The default
      mode that is used with these patches with Linux guest and QEMU/Linux
      hypervisor is the mergeable buffers mode. I tested this mode for 2+
      days running xdp2 without issues. Additionally I did a series of
      driver unload/load tests to check the allocate/release paths.
      
      To test the big_packets path I applied the following simple patch against
      the virtio driver forcing big_packets mode,
      
      --- a/drivers/net/virtio_net.c
      +++ b/drivers/net/virtio_net.c
      @@ -2242,7 +2242,7 @@ static int virtnet_probe(struct virtio_device *vdev)
                      vi->big_packets = true;
      
              if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
      -               vi->mergeable_rx_bufs = true;
      +               vi->mergeable_rx_bufs = false;
      
              if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF) ||
                  virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
      
      I then repeated the tests with xdp1 and xdp2. After letting them run
      for a few hours I called it good enough.
      
      Testing the unexpected case where virtio receives a packet across
      multiple buffers required patching the hypervisor vhost driver to
      convince it to send these unexpected packets. Then I used ping with
      the -s option to trigger the case with multiple buffers. This mode
      is not expected to be used but as MST pointed out per spec it is
      not strictly speaking illegal to generate multi-buffer packets so we
      need someway to handle these. The following patch can be used to
      generate multiple buffers,
      
      --- a/drivers/vhost/vhost.c
      +++ b/drivers/vhost/vhost.c
      @@ -1777,7 +1777,8 @@ static int translate_desc(struct vhost_virtqueue
      *vq, u64
      
                      _iov = iov + ret;
                      size = node->size - addr + node->start;
      -               _iov->iov_len = min((u64)len - s, size);
      +               printk("%s: build 100 length headers!\n", __func__);
      +               _iov->iov_len = min((u64)len - s, (u64)100);//size);
                      _iov->iov_base = (void __user *)(unsigned long)
                              (node->userspace_addr + addr - node->start);
                      s += size;
      
      The qemu command I most frequently used for testing (although I did test
      various other combinations of devices) is the following,
      
       ./x86_64-softmmu/qemu-system-x86_64              \
          -hda /var/lib/libvirt/images/Fedora-test0.img \
          -m 4096  -enable-kvm -smp 2                   \
          -netdev tap,id=hn0,queues=4,vhost=on          \
          -device virtio-net-pci,netdev=hn0,mq=on,vectors=9,guest_tso4=off,guest_tso6=off \
          -serial stdio
      
      The options 'guest_tso4=off,guest_tso6=off' are required because we
      do not support LRO with XDP at the moment.
      
      Please review any comments/feedback welcome as always.
      ====================
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd333e37
    • John Fastabend's avatar
      virtio_net: xdp, add slowpath case for non contiguous buffers · 72979a6c
      John Fastabend authored
      virtio_net XDP support expects receive buffers to be contiguous.
      If this is not the case we enable a slowpath to allow connectivity
      to continue but at a significan performance overhead associated with
      linearizing data. To make it painfully aware to users that XDP is
      running in a degraded mode we throw an xdp buffer error.
      
      To linearize packets we allocate a page and copy the segments of
      the data, including the header, into it. After this the page can be
      handled by XDP code flow as normal.
      
      Then depending on the return code the page is either freed or sent
      to the XDP xmit path. There is no attempt to optimize this path.
      
      This case is being handled simple as a precaution in case some
      unknown backend were to generate packets in this form. To test this
      I had to hack qemu and force it to generate these packets. I do not
      expect this case to be generated by "real" backends.
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      72979a6c
    • John Fastabend's avatar
      virtio_net: add XDP_TX support · 56434a01
      John Fastabend authored
      This adds support for the XDP_TX action to virtio_net. When an XDP
      program is run and returns the XDP_TX action the virtio_net XDP
      implementation will transmit the packet on a TX queue that aligns
      with the current CPU that the XDP packet was processed on.
      
      Before sending the packet the header is zeroed.  Also XDP is expected
      to handle checksum correctly so no checksum offload  support is
      provided.
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56434a01
    • John Fastabend's avatar
      virtio_net: add dedicated XDP transmit queues · 672aafd5
      John Fastabend authored
      XDP requires using isolated transmit queues to avoid interference
      with normal networking stack (BQL, NETDEV_TX_BUSY, etc). This patch
      adds a XDP queue per cpu when a XDP program is loaded and does not
      expose the queues to the OS via the normal API call to
      netif_set_real_num_tx_queues(). This way the stack will never push
      an skb to these queues.
      
      However virtio/vhost/qemu implementation only allows for creating
      TX/RX queue pairs at this time so creating only TX queues was not
      possible. And because the associated RX queues are being created I
      went ahead and exposed these to the stack and let the backend use
      them. This creates more RX queues visible to the network stack than
      TX queues which is worth mentioning but does not cause any issues as
      far as I can tell.
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      672aafd5
    • John Fastabend's avatar
      virtio_net: Add XDP support · f600b690
      John Fastabend authored
      This adds XDP support to virtio_net. Some requirements must be
      met for XDP to be enabled depending on the mode. First it will
      only be supported with LRO disabled so that data is not pushed
      across multiple buffers. Second the MTU must be less than a page
      size to avoid having to handle XDP across multiple pages.
      
      If mergeable receive is enabled this patch only supports the case
      where header and data are in the same buf which we can check when
      a packet is received by looking at num_buf. If the num_buf is
      greater than 1 and a XDP program is loaded the packet is dropped
      and a warning is thrown. When any_header_sg is set this does not
      happen and both header and data is put in a single buffer as expected
      so we check this when XDP programs are loaded.  Subsequent patches
      will process the packet in a degraded mode to ensure connectivity
      and correctness is not lost even if backend pushes packets into
      multiple buffers.
      
      If big packets mode is enabled and MTU/LRO conditions above are
      met then XDP is allowed.
      
      This patch was tested with qemu with vhost=on and vhost=off where
      mergeable and big_packet modes were forced via hard coding feature
      negotiation. Multiple buffers per packet was forced via a small
      test patch to vhost.c in the vhost=on qemu mode.
      Suggested-by: default avatarShrijeet Mukherjee <shrijeet@gmail.com>
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f600b690
    • John Fastabend's avatar
      net: xdp: add invalid buffer warning · f23bc46c
      John Fastabend authored
      This adds a warning for drivers to use when encountering an invalid
      buffer for XDP. For normal cases this should not happen but to catch
      this in virtual/qemu setups that I may not have expected from the
      emulation layer having a standard warning is useful.
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f23bc46c
    • Xin Long's avatar
      sctp: sctp_transport_lookup_process should rcu_read_unlock when transport is null · 08abb795
      Xin Long authored
      Prior to this patch, sctp_transport_lookup_process didn't rcu_read_unlock
      when it failed to find a transport by sctp_addrs_lookup_transport.
      
      This patch is to fix it by moving up rcu_read_unlock right before checking
      transport and also to remove the out path.
      
      Fixes: 1cceda78 ("sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08abb795
    • Xin Long's avatar
      sctp: sctp_epaddr_lookup_transport should be protected by rcu_read_lock · 5cb2cd68
      Xin Long authored
      Since commit 7fda702f ("sctp: use new rhlist interface on sctp transport
      rhashtable"), sctp has changed to use rhlist_lookup to look up transport, but
      rhlist_lookup doesn't call rcu_read_lock inside, unlike rhashtable_lookup_fast.
      
      It is called in sctp_epaddr_lookup_transport and sctp_addrs_lookup_transport.
      sctp_addrs_lookup_transport is always in the protection of rcu_read_lock(),
      as __sctp_lookup_association is called in rx path or sctp_lookup_association
      which are in the protection of rcu_read_lock() already.
      
      But sctp_epaddr_lookup_transport is called by sctp_endpoint_lookup_assoc, it
      doesn't call rcu_read_lock, which may cause "suspicious rcu_dereference_check
      usage' in __rhashtable_lookup.
      
      This patch is to fix it by adding rcu_read_lock in sctp_endpoint_lookup_assoc
      before calling sctp_epaddr_lookup_transport.
      
      Fixes: 7fda702f ("sctp: use new rhlist interface on sctp transport rhashtable")
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5cb2cd68
    • David S. Miller's avatar
      Merge branch 'dpaa_eth-fixes' · 10a3ecf4
      David S. Miller authored
      Madalin Bucur says:
      
      ====================
      dpaa_eth: a couple of fixes
      
      This patch set introduces big endian accessors in the dpaa_eth driver
      making sure accesses to the QBMan HW are correct on little endian
      platforms. Removing a redundant Kconfig dependency on FSL_SOC.
      Adding myself as maintainer of the dpaa_eth driver.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      10a3ecf4
    • Madalin Bucur's avatar
      MAINTAINERS: net: add entry for Freescale QorIQ DPAA Ethernet driver · 63f4b4b0
      Madalin Bucur authored
      Add record for Freescale QORIQ DPAA Ethernet driver adding myself as
      maintainer.
      Signed-off-by: default avatarMadalin Bucur <madalin.bucur@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63f4b4b0
    • Madalin Bucur's avatar
    • Claudiu Manoil's avatar
      dpaa_eth: use big endian accessors · 7d6f8dc0
      Claudiu Manoil authored
      Ensure correct access to the big endian QMan HW through proper
      accessors.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarMadalin Bucur <madalin.bucur@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d6f8dc0