]> 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:13:31 +0000 (11:13 +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 d5e860573ecd409e7e75072caa7aa7cae6909e20..79fa2d7852efa5b126c957a61991092e045a2cae 100644 (file)
@@ -547,7 +547,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];