]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: conntrack: fix race in __nf_conntrack_confirm against get_next_corpse
authorbill bonaparte <programme110@gmail.com>
Thu, 6 Nov 2014 13:36:48 +0000 (14:36 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 14 Nov 2014 16:43:05 +0000 (17:43 +0100)
commit07b62f7bf07525a2ec9fc6d1ab88d5d2a94600b4
tree4cb248fa4103774404e2d8b50cb1c230e694dfaa
parentfc597f93b12b2519daa56539ecf814d5761533d0
netfilter: conntrack: fix race in __nf_conntrack_confirm against get_next_corpse

After removal of the central spinlock nf_conntrack_lock, in
commit ab9997edf3b6a ("netfilter: conntrack: remove central
spinlock nf_conntrack_lock"), it is possible to race against
get_next_corpse().

The race is against the get_next_corpse() cleanup on
the "unconfirmed" list (a per-cpu list with seperate locking),
which set the DYING bit.

Fix this race, in __nf_conntrack_confirm(), by removing the CT
from unconfirmed list before checking the DYING bit.  In case
race occured, re-add the CT to the dying list.

While at this, fix coding style of the comment that has been
updated.

Fixes: ab9997edf3b6a ("netfilter: conntrack: remove central spinlock nf_conntrack_lock")
Reported-by: bill bonaparte <programme110@gmail.com>
Signed-off-by: bill bonaparte <programme110@gmail.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_core.c