[NETFILTER]: nfnetlink_log: fix crash on bridged packet
authorPatrick McHardy <kaber@trash.net>
Wed, 7 Mar 2007 04:24:53 +0000 (20:24 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Mar 2007 00:08:03 +0000 (16:08 -0800)
physoutdev is only set on purely bridged packet, when nfnetlink_log is used
in the OUTPUT/FORWARD/POSTROUTING hooks on packets forwarded from or to a
bridge it crashes when trying to dereference skb->nf_bridge->physoutdev.

Reported by Holger Eitzenberger <heitzenberger@astaro.com>

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

index 12f92e235a13359240559c63ec09a7476069c090..5cb30ebba0f4fd1538c7c3bb36f6902ae8109541 100644 (file)
@@ -486,7 +486,7 @@ __build_packet_message(struct nfulnl_instance *inst,
                         * for physical device (when called from ipv4) */
                        NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV,
                                sizeof(tmp_uint), &tmp_uint);
-                       if (skb->nf_bridge) {
+                       if (skb->nf_bridge && skb->nf_bridge->physoutdev) {
                                tmp_uint =
                                    htonl(skb->nf_bridge->physoutdev->ifindex);
                                NFA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV,