From 6d819a14f95d84acba923875702ea6e303b01eb1 Mon Sep 17 00:00:00 2001 From: lily Date: Mon, 13 Feb 2023 14:33:34 +0800 Subject: [PATCH] net/core/skbuff: Check the return value of skb_copy_bits() stable inclusion from stable-v5.10.143 commit 9d040a629e7e7965c70e3ff16e1a8180470b8746 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0U6 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9d040a629e7e7965c70e3ff16e1a8180470b8746 -------------------------------- [ Upstream commit c624c58e08b15105662b9ab9be23d14a6b945a49 ] skb_copy_bits() could fail, which requires a check on the return value. Signed-off-by: Li Zhong Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Jialin Zhang Reviewed-by: Zheng Zengkai --- net/core/skbuff.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7f0b5e3a5f78..1172b75e86e1 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4063,9 +4063,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, SKB_GSO_CB(nskb)->csum_start = skb_headroom(nskb) + doffset; } else { - skb_copy_bits(head_skb, offset, - skb_put(nskb, len), - len); + if (skb_copy_bits(head_skb, offset, skb_put(nskb, len), len)) + goto err; } continue; } -- GitLab