linux/net
Florian Westphal 82b8759a69 netfilter: nf_nat: fix oops on netns removal
commit 945b2b2d25 upstream.

Quoting Samu Kallio:

 Basically what's happening is, during netns cleanup,
 nf_nat_net_exit gets called before ipv4_net_exit. As I understand
 it, nf_nat_net_exit is supposed to kill any conntrack entries which
 have NAT context (through nf_ct_iterate_cleanup), but for some
 reason this doesn't happen (perhaps something else is still holding
 refs to those entries?).

 When ipv4_net_exit is called, conntrack entries (including those
 with NAT context) are cleaned up, but the
 nat_bysource hashtable is long gone - freed in nf_nat_net_exit. The
 bug happens when attempting to free a conntrack entry whose NAT hash
 'prev' field points to a slot in the freed hash table (head for that
 bin).

We ignore conntracks with null nat bindings.  But this is wrong,
as these are in bysource hash table as well.

Restore nat-cleaning for the netns-is-being-removed case.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=65191

Fixes: c2d421e171 ('netfilter: nf_nat: fix race when unloading protocol modules')
Reported-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Debugged-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Tested-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 11:18:28 -07:00
..
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: Allow change security level on ATT_CID in slave role 2014-07-09 11:18:26 -07:00
bridge bridge: Prevent insertion of FDB entry with disallowed vlan 2014-06-26 15:15:39 -04:00
caif
can net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
ceph libceph: fix corruption when using page_count 0 page in rbd 2014-06-07 10:28:28 -07:00
core rtnetlink: fix userspace API breakage for iproute2 < v3.9.0 2014-06-26 15:15:40 -04:00
dcb net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
dccp
decnet net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
dns_resolver
dsa
ethernet
hsr
ieee802154
ipv4 udp: ipv4: do not waste time in __udp4_lib_mcast_demux_lookup 2014-06-26 15:15:40 -04:00
ipv6 ipip, sit: fix ipv4_{update_pmtu,redirect} calls 2014-06-26 15:15:40 -04:00
ipx
irda
iucv af_iucv: wrong mapping of sent and confirmed skbs 2014-06-30 20:11:51 -07:00
key
l2tp
lapb
llc
mac80211 mac80211: fix a memory leak on sta rate selection table 2014-07-09 11:18:26 -07:00
mac802154
mpls
netfilter netfilter: nf_nat: fix oops on netns removal 2014-07-09 11:18:28 -07:00
netlabel
netlink netlink: Only check file credentials for implicit destinations 2014-06-26 15:15:38 -04:00
netrom
nfc
openvswitch
packet net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
phonet net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
rds
rfkill
rose
rxrpc
sched net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
sctp sctp: Fix sk_ack_backlog wrap-around problem 2014-06-26 15:15:40 -04:00
sunrpc SUNRPC: Fix a module reference leak in svc_handle_xprt 2014-07-06 18:57:27 -07:00
tipc net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
unix
vmw_vsock
wimax
wireless
x25
xfrm net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-06-26 15:15:38 -04:00
Kconfig
Makefile
compat.c
nonet.c
socket.c
sysctl_net.c