1. 15 Sep, 2018 6 commits
    • Alexey Kodanev's avatar
      vti6: remove !skb->ignore_df check from vti6_xmit() · 4890349d
      Alexey Kodanev authored
      [ Upstream commit 9f289546 ]
      
      Before the commit d6990976 ("vti6: fix PMTU caching and reporting
      on xmit") '!skb->ignore_df' check was always true because the function
      skb_scrub_packet() was called before it, resetting ignore_df to zero.
      
      In the commit, skb_scrub_packet() was moved below, and now this check
      can be false for the packet, e.g. when sending it in the two fragments,
      this prevents successful PMTU updates in such case. The next attempts
      to send the packet lead to the same tx error. Moreover, vti6 initial
      MTU value relies on PMTU adjustments.
      
      This issue can be reproduced with the following LTP test script:
          udp_ipsec_vti.sh -6 -p ah -m tunnel -s 2000
      
      Fixes: ccd740cb ("vti6: Add pmtu handling to vti6_xmit.")
      Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
      Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4890349d
    • Florian Westphal's avatar
      tcp: do not restart timewait timer on rst reception · 86a0a007
      Florian Westphal authored
      [ Upstream commit 63cc357f ]
      
      RFC 1337 says:
       ''Ignore RST segments in TIME-WAIT state.
         If the 2 minute MSL is enforced, this fix avoids all three hazards.''
      
      So with net.ipv4.tcp_rfc1337=1, expected behaviour is to have TIME-WAIT sk
      expire rather than removing it instantly when a reset is received.
      
      However, Linux will also re-start the TIME-WAIT timer.
      
      This causes connect to fail when tying to re-use ports or very long
      delays (until syn retry interval exceeds MSL).
      
      packetdrill test case:
      // Demonstrate bogus rearming of TIME-WAIT timer in rfc1337 mode.
      `sysctl net.ipv4.tcp_rfc1337=1`
      
      0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
      0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
      0.000 bind(3, ..., ...) = 0
      0.000 listen(3, 1) = 0
      
      0.100 < S 0:0(0) win 29200 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      0.100 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      0.200 < . 1:1(0) ack 1 win 257
      0.200 accept(3, ..., ...) = 4
      
      // Receive first segment
      0.310 < P. 1:1001(1000) ack 1 win 46
      
      // Send one ACK
      0.310 > . 1:1(0) ack 1001
      
      // read 1000 byte
      0.310 read(4, ..., 1000) = 1000
      
      // Application writes 100 bytes
      0.350 write(4, ..., 100) = 100
      0.350 > P. 1:101(100) ack 1001
      
      // ACK
      0.500 < . 1001:1001(0) ack 101 win 257
      
      // close the connection
      0.600 close(4) = 0
      0.600 > F. 101:101(0) ack 1001 win 244
      
      // Our side is in FIN_WAIT_1 & waits for ack to fin
      0.7 < . 1001:1001(0) ack 102 win 244
      
      // Our side is in FIN_WAIT_2 with no outstanding data.
      0.8 < F. 1001:1001(0) ack 102 win 244
      0.8 > . 102:102(0) ack 1002 win 244
      
      // Our side is now in TIME_WAIT state, send ack for fin.
      0.9 < F. 1002:1002(0) ack 102 win 244
      0.9 > . 102:102(0) ack 1002 win 244
      
      // Peer reopens with in-window SYN:
      1.000 < S 1000:1000(0) win 9200 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      
      // Therefore, reply with ACK.
      1.000 > . 102:102(0) ack 1002 win 244
      
      // Peer sends RST for this ACK.  Normally this RST results
      // in tw socket removal, but rfc1337=1 setting prevents this.
      1.100 < R 1002:1002(0) win 244
      
      // second syn. Due to rfc1337=1 expect another pure ACK.
      31.0 < S 1000:1000(0) win 9200 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      31.0 > . 102:102(0) ack 1002 win 244
      
      // .. and another RST from peer.
      31.1 < R 1002:1002(0) win 244
      31.2 `echo no timer restart;ss -m -e -a -i -n -t -o state TIME-WAIT`
      
      // third syn after one minute.  Time-Wait socket should have expired by now.
      63.0 < S 1000:1000(0) win 9200 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      
      // so we expect a syn-ack & 3whs to proceed from here on.
      63.0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      
      Without this patch, 'ss' shows restarts of tw timer and last packet is
      thus just another pure ack, more than one minute later.
      
      This restores the original code from commit 283fd6cf0be690a83
      ("Merge in ANK networking jumbo patch") in netdev-vger-cvs.git .
      
      For some reason the else branch was removed/lost in 1f28b683339f7
      ("Merge in TCP/UDP optimizations and [..]") and timer restart became
      unconditional.
      Reported-by: default avatarMichal Tesar <mtesar@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86a0a007
    • Manish Chopra's avatar
      qlge: Fix netdev features configuration. · 375e8874
      Manish Chopra authored
      [ Upstream commit 6750c870 ]
      
      qlge_fix_features() is not supposed to modify hardware or
      driver state, rather it is supposed to only fix requested
      fetures bits. Currently qlge_fix_features() also goes for
      interface down and up unnecessarily if there is not even
      any change in features set.
      
      This patch changes/fixes following -
      
      1) Move reload of interface or device re-config from
         qlge_fix_features() to qlge_set_features().
      2) Reload of interface in qlge_set_features() only if
         relevant feature bit (NETIF_F_HW_VLAN_CTAG_RX) is changed.
      3) Get rid of qlge_fix_features() since driver is not really
         required to fix any features bit.
      Signed-off-by: default avatarManish <manish.chopra@cavium.com>
      Reviewed-by: default avatarBenjamin Poirier <bpoirier@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      375e8874
    • Doug Berger's avatar
      net: bcmgenet: use MAC link status for fixed phy · e1e4b0be
      Doug Berger authored
      [ Upstream commit c3c397c1 ]
      
      When using the fixed PHY with GENET (e.g. MOCA) the PHY link
      status can be determined from the internal link status captured
      by the MAC. This allows the PHY state machine to use the correct
      link state with the fixed PHY even if MAC link event interrupts
      are missed when the net device is opened.
      
      Fixes: 8d88c6eb ("net: bcmgenet: enable MoCA link state change detection")
      Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1e4b0be
    • Greg Hackmann's avatar
      staging: android: ion: fix ION_IOC_{MAP,SHARE} use-after-free · 2c155709
      Greg Hackmann authored
      The ION_IOC_{MAP,SHARE} ioctls drop and reacquire client->lock several
      times while operating on one of the client's ion_handles.  This creates
      windows where userspace can call ION_IOC_FREE on the same client with
      the same handle, and effectively make the kernel drop its own reference.
      For example:
      
      - thread A: ION_IOC_ALLOC creates an ion_handle with refcount 1
      - thread A: starts ION_IOC_MAP and increments the refcount to 2
      - thread B: ION_IOC_FREE decrements the refcount to 1
      - thread B: ION_IOC_FREE decrements the refcount to 0 and frees the
                  handle
      - thread A: continues ION_IOC_MAP with a dangling ion_handle * to
                  freed memory
      
      Fix this by holding client->lock for the duration of
      ION_IOC_{MAP,SHARE}, preventing the concurrent ION_IOC_FREE.  Also
      remove ion_handle_get_by_id(), since there's literally no way to use it
      safely.
      
      This patch is applied on top of 4.4.y, and applies to older kernels
      too.  4.9.y was fixed separately.  Kernels 4.12 and later are
      unaffected, since all the underlying ion_handle infrastructure has been
      ripped out.
      
      Cc: stable@vger.kernel.org # v4.4-
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      Acked-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c155709
    • Michal Hocko's avatar
      x86/speculation/l1tf: Fix up pte->pfn conversion for PAE · e3dea38f
      Michal Hocko authored
      commit e14d7dfb upstream.
      
      Jan has noticed that pte_pfn and co. resp. pfn_pte are incorrect for
      CONFIG_PAE because phys_addr_t is wider than unsigned long and so the
      pte_val reps. shift left would get truncated. Fix this up by using proper
      types.
      
      [Just one chunk, again, needed here.  Thanks to Ben and Guenter for
      finding and fixing this. - gregkh]
      
      Fixes: 6b28baca ("x86/speculation/l1tf: Protect PROT_NONE PTEs against speculation")
      Reported-by: default avatarJan Beulich <JBeulich@suse.com>
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e3dea38f
  2. 09 Sep, 2018 34 commits