netfilter: bridge: replace physindev with physinif in nf_bridge_info
[platform/kernel/linux-starfive.git] / net / ipv6 / netfilter / nf_reject_ipv6.c
index 58ccdb0..71d6927 100644 (file)
@@ -278,7 +278,6 @@ static int nf_reject6_fill_skb_dst(struct sk_buff *skb_in)
 void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb,
                    int hook)
 {
-       struct net_device *br_indev __maybe_unused;
        struct sk_buff *nskb;
        struct tcphdr _otcph;
        const struct tcphdr *otcph;
@@ -354,9 +353,15 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb,
         * build the eth header using the original destination's MAC as the
         * source, and send the RST packet directly.
         */
-       br_indev = nf_bridge_get_physindev(oldskb);
-       if (br_indev) {
+       if (nf_bridge_info_exists(oldskb)) {
                struct ethhdr *oeth = eth_hdr(oldskb);
+               struct net_device *br_indev;
+
+               br_indev = nf_bridge_get_physindev(oldskb, net);
+               if (!br_indev) {
+                       kfree_skb(nskb);
+                       return;
+               }
 
                nskb->dev = br_indev;
                nskb->protocol = htons(ETH_P_IPV6);