1. 05 Sep, 2018 2 commits
    • Tommi Rantala's avatar
      xfrm: fix missing dst_release() after policy blocking lbcast and multicast · 590f312a
      Tommi Rantala authored
      [ Upstream commit 8cc88773 ]
      
      Fix missing dst_release() when local broadcast or multicast traffic is
      xfrm policy blocked.
      
      For IPv4 this results to dst leak: ip_route_output_flow() allocates
      dst_entry via __ip_route_output_key() and passes it to
      xfrm_lookup_route(). xfrm_lookup returns ERR_PTR(-EPERM) that is
      propagated. The dst that was allocated is never released.
      
      IPv4 local broadcast testcase:
       ping -b 192.168.1.255 &
       sleep 1
       ip xfrm policy add src 0.0.0.0/0 dst 192.168.1.255/32 dir out action block
      
      IPv4 multicast testcase:
       ping 224.0.0.1 &
       sleep 1
       ip xfrm policy add src 0.0.0.0/0 dst 224.0.0.1/32 dir out action block
      
      For IPv6 the missing dst_release() causes trouble e.g. when used in netns:
       ip netns add TEST
       ip netns exec TEST ip link set lo up
       ip link add dummy0 type dummy
       ip link set dev dummy0 netns TEST
       ip netns exec TEST ip addr add fd00::1111 dev dummy0
       ip netns exec TEST ip link set dummy0 up
       ip netns exec TEST ping -6 -c 5 ff02::1%dummy0 &
       sleep 1
       ip netns exec TEST ip xfrm policy add src ::/0 dst ff02::1 dir out action block
       wait
       ip netns del TEST
      
      After netns deletion we see:
      [  258.239097] unregister_netdevice: waiting for lo to become free. Usage count = 2
      [  268.279061] unregister_netdevice: waiting for lo to become free. Usage count = 2
      [  278.367018] unregister_netdevice: waiting for lo to become free. Usage count = 2
      [  288.375259] unregister_netdevice: waiting for lo to become free. Usage count = 2
      
      Fixes: ac37e251 ("xfrm: release dst_orig in case of error in xfrm_lookup()")
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      590f312a
    • Eyal Birger's avatar
      vti6: fix PMTU caching and reporting on xmit · ce723f86
      Eyal Birger authored
      [ Upstream commit d6990976 ]
      
      When setting the skb->dst before doing the MTU check, the route PMTU
      caching and reporting is done on the new dst which is about to be
      released.
      
      Instead, PMTU handling should be done using the original dst.
      
      This is aligned with IPv4 VTI.
      
      Fixes: ccd740cb ("vti6: Add pmtu handling to vti6_xmit.")
      Signed-off-by: default avatarEyal Birger <eyal.birger@gmail.com>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce723f86
  2. 24 Aug, 2018 38 commits