bridge: check return value of ipv6_dev_get_saddr()
[firefly-linux-kernel-4.4.55.git] / net / bridge / br_netfilter.c
index 56149ec36d7fd5d8a411b3996f5e7985a3792c77..3dc7f5446a9d29c8e6eafaa92aea2487eab8c4d3 100644 (file)
@@ -343,24 +343,26 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
 static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
 {
        struct nf_bridge_info *nf_bridge = skb->nf_bridge;
+       struct neighbour *neigh;
        struct dst_entry *dst;
 
        skb->dev = bridge_parent(skb->dev);
        if (!skb->dev)
                goto free_skb;
        dst = skb_dst(skb);
+       neigh = dst_get_neighbour(dst);
        if (dst->hh) {
                neigh_hh_bridge(dst->hh, skb);
                skb->dev = nf_bridge->physindev;
                return br_handle_frame_finish(skb);
-       } else if (dst->neighbour) {
+       } else if (neigh) {
                /* the neighbour function below overwrites the complete
                 * MAC header, so we save the Ethernet source address and
                 * protocol number. */
                skb_copy_from_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN), skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
                /* tell br_dev_xmit to continue with forwarding */
                nf_bridge->mask |= BRNF_BRIDGED_DNAT;
-               return dst->neighbour->output(skb);
+               return neigh->output(skb);
        }
 free_skb:
        kfree_skb(skb);