ipv4: Don't do expensive useless work during inetdev destroy. 40/154940/2
authorDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2016 03:28:00 +0000 (23:28 -0400)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 11 Oct 2017 11:56:28 +0000 (11:56 +0000)
commit0b7ec1475828801019fdf5e218b6074c9df02e39
treec1fff3e84f0bb060ccec7920f1adb622feb1b8eb
parent2d0539cd6b7e4f6a315fa8cccf7586ba126edae8
ipv4: Don't do expensive useless work during inetdev destroy.

commit fbd40ea0180a2d328c5adc61414dc8bab9335ce2 upstream.

When an inetdev is destroyed, every address assigned to the interface
is removed.  And in this scenerio we do two pointless things which can
be very expensive if the number of assigned interfaces is large:

1) Address promotion.  We are deleting all addresses, so there is no
   point in doing this.

2) A full nf conntrack table purge for every address.  We only need to
   do this once, as is already caught by the existing
   masq_dev_notifier so masq_inet_event() can skip this.

Reported-by: Solar Designer <solar@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
[sw0312.kim: backport from mainline to fix CVE-2016-3156 as like linux-3.16.y:
  - file rename: nf_nat_masquerade_ipv4.c -> ipt_MASQUERADE.c ]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ied3f425ebd7b4551a603dc435731d011f14991a9
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/netfilter/ipt_MASQUERADE.c