[PATCH v1] net/core/skbuff: Check the return value of skb_copy_bits()

lily posted 1 patch 3 years, 7 months ago
net/core/skbuff.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH v1] net/core/skbuff: Check the return value of skb_copy_bits()
Posted by lily 3 years, 7 months ago
skb_copy_bits() could fail, which requires a check on the return
value.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 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 974bbbbe7138..5ea1d074a920 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4205,9 +4205,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;
 		}
-- 
2.25.1
Re: [PATCH v1] net/core/skbuff: Check the return value of skb_copy_bits()
Posted by patchwork-bot+netdevbpf@kernel.org 3 years, 7 months ago
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 22 Aug 2022 22:44:11 -0700 you wrote:
> skb_copy_bits() could fail, which requires a check on the return
> value.
> 
> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
>  net/core/skbuff.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [v1] net/core/skbuff: Check the return value of skb_copy_bits()
    https://git.kernel.org/netdev/net/c/c624c58e08b1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html