[Devel] [PATCH RHEL COMMIT] ms/ipv6: fix NULL deref in ip6_rcv_core()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 14 16:47:16 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.18.1.vz9.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after vz9-latest
------>
commit 521cb417834c13fae88c1bd65600bb557ee200c8
Author: Eric Dumazet <edumazet at google.com>
Date:   Thu Mar 9 17:14:04 2023 +0200

    ms/ipv6: fix NULL deref in ip6_rcv_core()
    
    idev can be NULL, as the surrounding code suggests.
    
    mFixes: 4daf841a2ef3 ("net: ipv6: add skb drop reasons to ip6_rcv_core()")
    Signed-off-by: Eric Dumazet <edumazet at google.com>
    Link: https://lore.kernel.org/r/20220413205653.1178458-1-eric.dumazet@gmail.com
    Signed-off-by: Jakub Kicinski <kuba at kernel.org>
    
    Cherry-picked from ms commit ("0339d25a2807 ipv6: fix NULL deref in
    ip6_rcv_core()")
    
    https://jira.sw.ru/browse/PSBM-145683
    
    Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
    
    Feature: fix ms/net
---
 net/ipv6/ip6_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 59bb2a92ddcb..9add683c8f16 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -165,7 +165,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL ||
 	    !idev || unlikely(idev->cnf.disable_ipv6)) {
 		__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
-		if (unlikely(idev->cnf.disable_ipv6))
+		if (idev && unlikely(idev->cnf.disable_ipv6))
 			SKB_DR_SET(reason, IPV6DISABLED);
 		goto drop;
 	}


More information about the Devel mailing list