]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ctnetlink: fix conntrack creation race
authorPatrick McHardy <kaber@trash.net>
Mon, 24 Nov 2008 23:56:17 +0000 (15:56 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Nov 2008 23:56:17 +0000 (15:56 -0800)
commit4f07303a90f7af44538f360a87642718cd9e4c03
tree580b23b89c04c85ad9795b37f81174e1bbb5311b
parent503c60ad0350b91a0632d460b2dc4a5aae56d8ec
netfilter: ctnetlink: fix conntrack creation race

Conntrack creation through ctnetlink has two races:

- the timer may expire and free the conntrack concurrently, causing an
  invalid memory access when attempting to put it in the hash tables

- an identical conntrack entry may be created in the packet processing
  path in the time between the lookup and hash insertion

Hold the conntrack lock between the lookup and insertion to avoid this.

Reported-by: Zoltan Borbely <bozo@andrews.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_netlink.c