From nobody Sun Sep 14 22:45:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7C0EC6FA82 for ; Tue, 13 Sep 2022 15:07:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235393AbiIMPHG (ORCPT ); Tue, 13 Sep 2022 11:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235477AbiIMPEg (ORCPT ); Tue, 13 Sep 2022 11:04:36 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ECF374DD0; Tue, 13 Sep 2022 07:30:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E4B02CE127B; Tue, 13 Sep 2022 14:17:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C054CC433D7; Tue, 13 Sep 2022 14:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078628; bh=7ugp5ty9y2SVErup3yXd45MfMy636Z5Inp/YD6EjimU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nNI5Uc3cYzAYsnwjhKBg4XYWMuAxASYAmHACfV+ejOfhee24/oI0lu1a8qxwdYuJ6 kt6UYRYjguWSsMgSZCRy/0RM+Ki/7nJST5+MVhSZqU8qYhvTqnXSYm0BcqcXFyKQhM m4BK8gdH/umZUi429DgUOZPdyVJ/+pRDHNQNoOZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Zhong , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 022/121] net/core/skbuff: Check the return value of skb_copy_bits() Date: Tue, 13 Sep 2022 16:03:33 +0200 Message-Id: <20220913140358.298585115@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140357.323297659@linuxfoundation.org> References: <20220913140357.323297659@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: lily [ 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 --- 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 563848242ad33..3c193e7d4bc67 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4188,9 +4188,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, SKB_GSO_CB(nskb)->csum_start =3D 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; } --=20 2.35.1