1. 13 10月, 2021 1 次提交
  2. 26 4月, 2021 1 次提交
    • E
      xfrm: Use actual socket sk instead of skb socket for xfrm_output_resume · 46471fd8
      Evan Nimmo 提交于
      stable inclusion
      from stable-5.10.30
      commit c7a175a24b0e44ea1547cf45ca8a8519dde76c7c
      bugzilla: 51791
      
      --------------------------------
      
      [ Upstream commit 9ab1265d ]
      
      A situation can occur where the interface bound to the sk is different
      to the interface bound to the sk attached to the skb. The interface
      bound to the sk is the correct one however this information is lost inside
      xfrm_output2 and instead the sk on the skb is used in xfrm_output_resume
      instead. This assumes that the sk bound interface and the bound interface
      attached to the sk within the skb are the same which can lead to lookup
      failures inside ip_route_me_harder resulting in the packet being dropped.
      
      We have an l2tp v3 tunnel with ipsec protection. The tunnel is in the
      global VRF however we have an encapsulated dot1q tunnel interface that
      is within a different VRF. We also have a mangle rule that marks the
      packets causing them to be processed inside ip_route_me_harder.
      
      Prior to commit 31c70d59 ("l2tp: keep original skb ownership") this
      worked fine as the sk attached to the skb was changed from the dot1q
      encapsulated interface to the sk for the tunnel which meant the interface
      bound to the sk and the interface bound to the skb were identical.
      Commit 46d6c5ae ("netfilter: use actual socket sk rather than skb sk
      when routing harder") fixed some of these issues however a similar
      problem existed in the xfrm code.
      
      Fixes: 31c70d59 ("l2tp: keep original skb ownership")
      Signed-off-by: NEvan Nimmo <evan.nimmo@alliedtelesis.co.nz>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: N  Weilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      46471fd8
  3. 29 1月, 2021 1 次提交
  4. 28 7月, 2020 1 次提交
  5. 07 7月, 2020 1 次提交
  6. 28 4月, 2020 2 次提交
  7. 19 2月, 2020 1 次提交
  8. 01 7月, 2019 1 次提交
  9. 06 6月, 2019 1 次提交
  10. 21 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 · 1ccea77e
      Thomas Gleixner 提交于
      Based on 2 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details you
        should have received a copy of the gnu general public license along
        with this program if not see http www gnu org licenses
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details [based]
        [from] [clk] [highbank] [c] you should have received a copy of the
        gnu general public license along with this program if not see http
        www gnu org licenses
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 355 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NJilayne Lovejoy <opensource@jilayne.com>
      Reviewed-by: NSteve Winslow <swinslow@gmail.com>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190519154041.837383322@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ccea77e
  11. 28 1月, 2019 1 次提交
    • M
      esp: Skip TX bytes accounting when sending from a request socket · 09db5124
      Martin Willi 提交于
      On ESP output, sk_wmem_alloc is incremented for the added padding if a
      socket is associated to the skb. When replying with TCP SYNACKs over
      IPsec, the associated sk is a casted request socket, only. Increasing
      sk_wmem_alloc on a request socket results in a write at an arbitrary
      struct offset. In the best case, this produces the following WARNING:
      
      WARNING: CPU: 1 PID: 0 at lib/refcount.c:102 esp_output_head+0x2e4/0x308 [esp4]
      refcount_t: addition on 0; use-after-free.
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.0.0-rc3 #2
      Hardware name: Marvell Armada 380/385 (Device Tree)
      [...]
      [<bf0ff354>] (esp_output_head [esp4]) from [<bf1006a4>] (esp_output+0xb8/0x180 [esp4])
      [<bf1006a4>] (esp_output [esp4]) from [<c05dee64>] (xfrm_output_resume+0x558/0x664)
      [<c05dee64>] (xfrm_output_resume) from [<c05d07b0>] (xfrm4_output+0x44/0xc4)
      [<c05d07b0>] (xfrm4_output) from [<c05956bc>] (tcp_v4_send_synack+0xa8/0xe8)
      [<c05956bc>] (tcp_v4_send_synack) from [<c0586ad8>] (tcp_conn_request+0x7f4/0x948)
      [<c0586ad8>] (tcp_conn_request) from [<c058c404>] (tcp_rcv_state_process+0x2a0/0xe64)
      [<c058c404>] (tcp_rcv_state_process) from [<c05958ac>] (tcp_v4_do_rcv+0xf0/0x1f4)
      [<c05958ac>] (tcp_v4_do_rcv) from [<c0598a4c>] (tcp_v4_rcv+0xdb8/0xe20)
      [<c0598a4c>] (tcp_v4_rcv) from [<c056eb74>] (ip_protocol_deliver_rcu+0x2c/0x2dc)
      [<c056eb74>] (ip_protocol_deliver_rcu) from [<c056ee6c>] (ip_local_deliver_finish+0x48/0x54)
      [<c056ee6c>] (ip_local_deliver_finish) from [<c056eecc>] (ip_local_deliver+0x54/0xec)
      [<c056eecc>] (ip_local_deliver) from [<c056efac>] (ip_rcv+0x48/0xb8)
      [<c056efac>] (ip_rcv) from [<c0519c2c>] (__netif_receive_skb_one_core+0x50/0x6c)
      [...]
      
      The issue triggers only when not using TCP syncookies, as for syncookies
      no socket is associated.
      
      Fixes: cac2661c ("esp4: Avoid skb_cow_data whenever possible")
      Fixes: 03e2a30f ("esp6: Avoid skb_cow_data whenever possible")
      Signed-off-by: NMartin Willi <martin@strongswan.org>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      09db5124
  12. 20 12月, 2018 1 次提交
  13. 29 8月, 2018 1 次提交
  14. 27 6月, 2018 1 次提交
  15. 08 1月, 2018 1 次提交
    • H
      xfrm: Return error on unknown encap_type in init_state · bcfd09f7
      Herbert Xu 提交于
      Currently esp will happily create an xfrm state with an unknown
      encap type for IPv4, without setting the necessary state parameters.
      This patch fixes it by returning -EINVAL.
      
      There is a similar problem in IPv6 where if the mode is unknown
      we will skip initialisation while returning zero.  However, this
      is harmless as the mode has already been checked further up the
      stack.  This patch removes this anomaly by aligning the IPv6
      behaviour with IPv4 and treating unknown modes (which cannot
      actually happen) as transport mode.
      
      Fixes: 38320c70 ("[IPSEC]: Use crypto_aead and authenc in ESP")
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      bcfd09f7
  16. 20 12月, 2017 2 次提交
  17. 03 11月, 2017 1 次提交
  18. 27 10月, 2017 1 次提交
  19. 23 10月, 2017 1 次提交
  20. 31 8月, 2017 1 次提交
  21. 25 8月, 2017 2 次提交
  22. 02 8月, 2017 2 次提交
  23. 13 7月, 2017 1 次提交
  24. 01 7月, 2017 1 次提交
  25. 16 6月, 2017 1 次提交
    • J
      networking: make skb_push & __skb_push return void pointers · d58ff351
      Johannes Berg 提交于
      It seems like a historic accident that these return unsigned char *,
      and in many places that means casts are required, more often than not.
      
      Make these functions return void * and remove all the casts across
      the tree, adding a (u8 *) cast only where the unsigned char pointer
      was used directly, all done with the following spatch:
      
          @@
          expression SKB, LEN;
          typedef u8;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          @@
          - *(fn(SKB, LEN))
          + *(u8 *)fn(SKB, LEN)
      
          @@
          expression E, SKB, LEN;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          type T;
          @@
          - E = ((T *)(fn(SKB, LEN)))
          + E = fn(SKB, LEN)
      
          @@
          expression SKB, LEN;
          identifier fn = { skb_push, __skb_push, skb_push_rcsum };
          @@
          - fn(SKB, LEN)[0]
          + *(u8 *)fn(SKB, LEN)
      
      Note that the last part there converts from push(...)[0] to the
      more idiomatic *(u8 *)push(...).
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d58ff351
  26. 05 6月, 2017 1 次提交
  27. 22 5月, 2017 1 次提交
  28. 24 4月, 2017 1 次提交
  29. 14 4月, 2017 5 次提交
  30. 17 1月, 2017 2 次提交
  31. 30 11月, 2016 1 次提交