]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Avoid access icmp_err_convert when icmp code is ICMP_FRAG_NEEDED
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 24 Aug 2020 11:15:04 +0000 (07:15 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2020 01:11:43 +0000 (18:11 -0700)
There is no need to fetch errno and fatal info from icmp_err_convert when
icmp code is ICMP_FRAG_NEEDED.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/raw.c

index 1eb936f4a463020777a179e53aadf56951ecbec0..dfba39473b1d5b92e4cf4f83c3e41e0e037597e0 100644 (file)
@@ -260,11 +260,12 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
                err = EHOSTUNREACH;
                if (code > NR_ICMP_UNREACH)
                        break;
-               err = icmp_err_convert[code].errno;
-               harderr = icmp_err_convert[code].fatal;
                if (code == ICMP_FRAG_NEEDED) {
                        harderr = inet->pmtudisc != IP_PMTUDISC_DONT;
                        err = EMSGSIZE;
+               } else {
+                       err = icmp_err_convert[code].errno;
+                       harderr = icmp_err_convert[code].fatal;
                }
        }