]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ctnetlink: don't dump ct extensions of unconfirmed conntracks
authorFlorian Westphal <fw@strlen.de>
Tue, 15 Oct 2019 13:19:14 +0000 (15:19 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 17 Oct 2019 09:46:51 +0000 (11:46 +0200)
commita3ab73f583f5fec7db37893151a04206cbab81d1
treec8f09c6d9710875110ac3d12dcd9f5fcf83a2f24
parent31a2a99d5d45ec66279c872b945585bab9efe818
netfilter: ctnetlink: don't dump ct extensions of unconfirmed conntracks

When dumping the unconfirmed lists, the cpu that is processing the ct
entry can reallocate ct->ext at any time.

Right now accessing the extensions from another CPU is ok provided
we're holding rcu read lock: extension reallocation does use rcu.

Once RCU isn't used anymore this becomes unsafe, so skip extensions for
the unconfirmed list.

Dumping the extension area for confirmed or dying conntracks is fine:
no reallocations are allowed and list iteration holds appropriate
locks that prevent ct (and this ct->ext) from getting free'd.

v2: fix compiler warnings due to misue of 'const' and missing return
    statement (kbuild robot).

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_netlink.c