Message ID | 20240705211741.9334-2-vinicius.peixoto@canonical.com |
---|---|
State | New |
Headers | show |
Series | ipv6: prevent NULL dereference in ip6_output() | expand |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 3b1efab423b8b..e72b47bf8af97 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -221,7 +221,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) skb->protocol = htons(ETH_P_IPV6); skb->dev = dev; - if (unlikely(idev->cnf.disable_ipv6)) { + if (unlikely(!idev || READ_ONCE(idev->cnf.disable_ipv6))) { IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); kfree_skb(skb); return 0;