1. 05 7月, 2017 28 次提交
  2. 04 7月, 2017 12 次提交
    • D
      ipv4: Export rtm_ipv4_policy. · bf72acef
      David S. Miller 提交于
      The MPLS code now needs it.
      
      Fixes: 397fc9e5 ("mpls: route get support")
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf72acef
    • R
      mpls: route get support · 397fc9e5
      Roopa Prabhu 提交于
      This patch adds RTM_GETROUTE doit handler for mpls routes.
      
      Input:
      RTA_DST - input label
      RTA_NEWDST - labels in packet for multipath selection
      
      By default the getroute handler returns matched
      nexthop label, via and oif
      
      With RTM_F_FIB_MATCH flag, full matched route is
      returned.
      
      example (with patched iproute2):
      $ip -f mpls route show
      101
              nexthop as to 102/103 via inet 172.16.2.2 dev virt1-2
              nexthop as to 302/303 via inet 172.16.12.2 dev virt1-12
      201
              nexthop as to 202/203 via inet6 2001:db8:2::2 dev virt1-2
              nexthop as to 402/403 via inet6 2001:db8:12::2 dev virt1-12
      
      $ip -f mpls route get 103
      RTNETLINK answers: Network is unreachable
      
      $ip -f mpls route get 101
      101 as to 102/103 via inet 172.16.2.2 dev virt1-2
      
      $ip -f mpls route get as to 302/303 101
      101 as to 302/303 via inet 172.16.12.2 dev virt1-12
      
      $ip -f mpls route get fibmatch 103
      RTNETLINK answers: Network is unreachable
      
      $ip -f mpls route get fibmatch 101
      101
              nexthop as to 102/103 via inet 172.16.2.2 dev virt1-2
              nexthop as to 302/303 via inet 172.16.12.2 dev virt1-12
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      397fc9e5
    • N
      bridge: allow ext learned entries to change ports · 7597b266
      Nikolay Aleksandrov 提交于
      current code silently ignores change of port in the request
      message. This patch makes sure the port is modified and
      notification is sent to userspace.
      
      Fixes: cf6b8e1e ("bridge: add API to notify bridge driver of learned FBD on offloaded device")
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: NRoopa Prabhu <roopa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7597b266
    • J
      net: reflect mark on tcp syn ack packets · e05a90ec
      Jamal Hadi Salim 提交于
      SYN-ACK responses on a server in response to a SYN from a client
      did not get the injected skb mark that was tagged on the SYN packet.
      
      Fixes: 84f39b08 ("net: support marking accepting TCP sockets")
      Reviewed-by: NLorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e05a90ec
    • S
      net: ethernet: mediatek: fixed deadlock captured by lockdep · 8d32e062
      Sean Wang 提交于
      Lockdep found an inconsistent lock state when mtk_get_stats64 is called
      in user context while NAPI updates MAC statistics in softirq.
      
      Use spin_trylock_bh/spin_unlock_bh fix following lockdep warning.
      
      [   81.321030] WARNING: inconsistent lock state
      [   81.325266] 4.12.0-rc1-00035-gd9dda65 #32 Not tainted
      [   81.330273] --------------------------------
      [   81.334505] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
      [   81.340464] ksoftirqd/0/7 [HC0[0]:SC1[1]:HE1:SE0] takes:
      [   81.345731]  (&syncp->seq#2){+.?...}, at: [<c054ba3c>] mtk_handle_status_irq.part.6+0x70/0x84
      [   81.354219] {SOFTIRQ-ON-W} state was registered at:
      [   81.359062]   lock_acquire+0xfc/0x2b0
      [   81.362696]   mtk_stats_update_mac+0x60/0x2c0
      [   81.367017]   mtk_get_stats64+0x17c/0x18c
      [   81.370995]   dev_get_stats+0x48/0xbc
      [   81.374628]   rtnl_fill_stats+0x48/0x128
      [   81.378520]   rtnl_fill_ifinfo+0x4ac/0xd1c
      [   81.382584]   rtmsg_ifinfo_build_skb+0x7c/0xe0
      [   81.386991]   rtmsg_ifinfo.part.5+0x24/0x54
      [   81.391139]   rtmsg_ifinfo+0x24/0x28
      [   81.394685]   __dev_notify_flags+0xa4/0xac
      [   81.398749]   dev_change_flags+0x50/0x58
      [   81.402640]   devinet_ioctl+0x768/0x85c
      [   81.406444]   inet_ioctl+0x1a4/0x1d0
      [   81.409990]   sock_ioctl+0x16c/0x33c
      [   81.413538]   do_vfs_ioctl+0xb4/0xa34
      [   81.417169]   SyS_ioctl+0x44/0x6c
      [   81.420458]   ret_fast_syscall+0x0/0x1c
      [   81.424260] irq event stamp: 3354692
      [   81.427806] hardirqs last  enabled at (3354692): [<c0678168>] net_rx_action+0xc0/0x504
      [   81.435660] hardirqs last disabled at (3354691): [<c0678134>] net_rx_action+0x8c/0x504
      [   81.443515] softirqs last  enabled at (3354106): [<c0101944>] __do_softirq+0x4b4/0x614
      [   81.451370] softirqs last disabled at (3354109): [<c012f0c4>] run_ksoftirqd+0x44/0x80
      [   81.459134]
      [   81.459134] other info that might help us debug this:
      [   81.465608]  Possible unsafe locking scenario:
      [   81.465608]
      [   81.471478]        CPU0
      [   81.473900]        ----
      [   81.476321]   lock(&syncp->seq#2);
      [   81.479701]   <Interrupt>
      [   81.482294]     lock(&syncp->seq#2);
      [   81.485847]
      [   81.485847]  *** DEADLOCK ***
      [   81.485847]
      [   81.491720] 1 lock held by ksoftirqd/0/7:
      [   81.495693]  #0:  (&(&mac->hw_stats->stats_lock)->rlock){+.+...}, at: [<c054ba14>] mtk_handle_status_irq.part.6+0x48/0x84
      [   81.506579]
      [   81.506579] stack backtrace:
      [   81.510904] CPU: 0 PID: 7 Comm: ksoftirqd/0 Not tainted 4.12.0-rc1-00035-gd9dda65 #32
      [   81.518668] Hardware name: Mediatek Cortex-A7 (Device Tree)
      [   81.524208] [<c0113dc4>] (unwind_backtrace) from [<c010e3f0>] (show_stack+0x20/0x24)
      [   81.531899] [<c010e3f0>] (show_stack) from [<c03f9c64>] (dump_stack+0xb4/0xe0)
      [   81.539072] [<c03f9c64>] (dump_stack) from [<c017e970>] (print_usage_bug+0x234/0x2e0)
      [   81.546846] [<c017e970>] (print_usage_bug) from [<c017f058>] (mark_lock+0x63c/0x7bc)
      [   81.554532] [<c017f058>] (mark_lock) from [<c017fe90>] (__lock_acquire+0x654/0x1bfc)
      [   81.562217] [<c017fe90>] (__lock_acquire) from [<c0181d04>] (lock_acquire+0xfc/0x2b0)
      [   81.569990] [<c0181d04>] (lock_acquire) from [<c054b76c>] (mtk_stats_update_mac+0x60/0x2c0)
      [   81.578283] [<c054b76c>] (mtk_stats_update_mac) from [<c054ba3c>] (mtk_handle_status_irq.part.6+0x70/0x84)
      [   81.587865] [<c054ba3c>] (mtk_handle_status_irq.part.6) from [<c054c2b8>] (mtk_napi_tx+0x358/0x37c)
      [   81.596845] [<c054c2b8>] (mtk_napi_tx) from [<c06782ec>] (net_rx_action+0x244/0x504)
      [   81.604533] [<c06782ec>] (net_rx_action) from [<c01015c4>] (__do_softirq+0x134/0x614)
      [   81.612306] [<c01015c4>] (__do_softirq) from [<c012f0c4>] (run_ksoftirqd+0x44/0x80)
      [   81.619907] [<c012f0c4>] (run_ksoftirqd) from [<c0154680>] (smpboot_thread_fn+0x14c/0x25c)
      [   81.628110] [<c0154680>] (smpboot_thread_fn) from [<c014f8cc>] (kthread+0x150/0x180)
      [   81.635798] [<c014f8cc>] (kthread) from [<c0109290>] (ret_from_fork+0x14/0x24)
      Signed-off-by: NSean Wang <sean.wang@mediatek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d32e062
    • D
      Merge branch 'ipv4-ipv6-refcount_t' · 2671e9fc
      David S. Miller 提交于
      Elena Reshetova says:
      
      ====================
      v2 ipv4/ipv6 refcount conversions
      
      Changes in v2:
       * rebase on top of net-next
       * currently by default refcount_t = atomic_t (*) and uses all
         atomic standard operations unless CONFIG_REFCOUNT_FULL is enabled.
         This is a compromise for the systems that are critical on
         performance (such as net) and cannot accept even slight delay
         on the refcounter operations.
      
      This series, for ipv4/ipv6 network components, replaces atomic_t reference
      counters with the new refcount_t type and API (see include/linux/refcount.h).
      By doing this we prevent intentional or accidental
      underflows or overflows that can led to use-after-free vulnerabilities.
      
      The patches are fully independent and can be cherry-picked separately.
      In order to try with refcount functionality enabled in run-time,
      CONFIG_REFCOUNT_FULL must be enabled.
      
      NOTE: automatic kernel builder for some reason doesn't like all my
      network branches and regularly times out the builds on these branches.
      Suggestion for "waiting a day for a good coverage" doesn't work, as
      we have seen with generic network conversions. So please wait for the
      full report from kernel test rebot before merging further up.
      This has been compile-tested in 116 configs, but 71 timed out (including
      all s390-related configs again). I am trying to see if they can fix
      build coverage for me in meanwhile.
      
      * The respective change is currently merged into -next as
        "locking/refcount: Create unchecked atomic_t implementation".
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2671e9fc
    • R
      net, ipv4: convert fib_info.fib_clntref from atomic_t to refcount_t · 0029c0de
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0029c0de
    • R
      net, ipv4: convert cipso_v4_doi.refcount from atomic_t to refcount_t · f6a6fede
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f6a6fede
    • R
      net, ipv6: convert ip6addrlbl_entry.refcnt from atomic_t to refcount_t · 87078f26
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      87078f26
    • R
      net, ipv6: convert xfrm6_tunnel_spi.refcnt from atomic_t to refcount_t · d12f3827
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d12f3827
    • R
      net, ipv6: convert ifacaddr6.aca_refcnt from atomic_t to refcount_t · affa78bc
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      affa78bc
    • R
      net, ipv6: convert ifmcaddr6.mca_refcnt from atomic_t to refcount_t · d3981bc6
      Reshetova, Elena 提交于
      refcount_t type and corresponding API should be
      used instead of atomic_t when the variable is used as
      a reference counter. This allows to avoid accidental
      refcounter overflows that might lead to use-after-free
      situations.
      Signed-off-by: NElena Reshetova <elena.reshetova@intel.com>
      Signed-off-by: NHans Liljestrand <ishkamiel@gmail.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid Windsor <dwindsor@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d3981bc6