]> git.baikalelectronics.ru Git - kernel.git/commit
[NETFILTER]: bridge-netfilter: fix net_device refcnt leaks
authorPatrick McHardy <kaber@trash.net>
Sun, 20 Jan 2008 14:25:48 +0000 (06:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Jan 2008 04:31:41 +0000 (20:31 -0800)
commit660d24787694d5151c76ba400167b4d2b1f67b5b
treefb18f4f6ac06050cca0c39c20f075285e88d98fa
parent7d9d0f5762be56edc9b5b7435bfa402d1841f54d
[NETFILTER]: bridge-netfilter: fix net_device refcnt leaks

When packets are flood-forwarded to multiple output devices, the
bridge-netfilter code reuses skb->nf_bridge for each clone to store
the bridge port. When queueing packets using NFQUEUE netfilter takes
a reference to skb->nf_bridge->physoutdev, which is overwritten
when the packet is forwarded to the second port. This causes
refcount unterflows for the first device and refcount leaks for all
others. Additionally this provides incorrect data to the iptables
physdev match.

Unshare skb->nf_bridge by copying it if it is shared before assigning
the physoutdev device.

Reported, tested and based on initial patch by
Jan Christoph Nordholz <hesso@pool.math.tu-berlin.de>.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_netfilter.c