]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ipv4/ip_output.c
net: fix NULL dereferences in check_peer_redir()
[karo-tx-linux.git] / net / ipv4 / ip_output.c
index ccaaa851ab429ee48b0aa803fd5bf8edd5ee34ce..77d3eded665ad2e30c03f8e62ea30b29ad1b4bb9 100644 (file)
@@ -204,9 +204,15 @@ static inline int ip_finish_output2(struct sk_buff *skb)
                skb = skb2;
        }
 
+       rcu_read_lock();
        neigh = dst_get_neighbour(dst);
-       if (neigh)
-               return neigh_output(neigh, skb);
+       if (neigh) {
+               int res = neigh_output(neigh, skb);
+
+               rcu_read_unlock();
+               return res;
+       }
+       rcu_read_unlock();
 
        if (net_ratelimit())
                printk(KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n");