Netfilter: bridge-netfilter: fix net_device refcnt leaks
authorPatrick McHardy <kaber@trash.net>
Tue, 29 Jan 2008 18:08:28 +0000 (19:08 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:49 +0000 (12:01 -0800)
commit50b85eb6699dac080b5047034da19c7282c821f2
tree86b2ba682329d5a5c5311867f7d4e049c07e674b
parent418b48ea165b0b03652c85436807ac6760838c21
Netfilter: bridge-netfilter: fix net_device refcnt leaks

[NETFILTER]: bridge-netfilter: fix net_device refcnt leaks

Upstream commit 2dc2f207fb251666d2396fe1a69272b307ecc333

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/bridge/br_netfilter.c