]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ipv4: fix return value check in esp_remove_trailer
authorMa Ke <make_ruc2021@163.com>
Mon, 9 Oct 2023 01:13:37 +0000 (09:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 09:58:56 +0000 (11:58 +0200)
commit 513f61e2193350c7a345da98559b80f61aec4fa6 upstream.

In esp_remove_trailer(), to avoid an unexpected result returned by
pskb_trim, we should check the return value of pskb_trim().

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/esp4.c

index 386e9875e5b80467ab7938ce147a2dbda5b9831d..ca0cd94eb22d1bf75f89668b8c0f0d4ff7a9826b 100644 (file)
@@ -739,7 +739,9 @@ static inline int esp_remove_trailer(struct sk_buff *skb)
                skb->csum = csum_block_sub(skb->csum, csumdiff,
                                           skb->len - trimlen);
        }
-       pskb_trim(skb, skb->len - trimlen);
+       ret = pskb_trim(skb, skb->len - trimlen);
+       if (unlikely(ret))
+               return ret;
 
        ret = nexthdr[1];