Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4510832rwe; Tue, 30 Aug 2022 11:23:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4CDb5FX+Q4vgHUPLvUAjg6eYKoLrgWuzMA84Fl0Y7F38GZPI7NWBH6sY9obUt5yDbhMMh2 X-Received: by 2002:a17:906:3bd2:b0:731:3f03:1697 with SMTP id v18-20020a1709063bd200b007313f031697mr18328098ejf.289.1661883812438; Tue, 30 Aug 2022 11:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661883812; cv=none; d=google.com; s=arc-20160816; b=YL40j5oIL2BNe2Z3VC1WxlQg5osbQjFRLNAIYpk83NDGcICotY/pQukHW8aiGGxOmN OdnD7CwyMl17N+Vl9evLOObex+VLOtOET/9ssue7FAG85ZCGErAgrvk/Fz6Aaof0bHAh CF3jjVuRRd76M0aVRlRc3VTRuGHZG2T6tUiWbxT4LRvJE78gzTSQWY5uO9NuzaZa2Eoz X518gQsYwmzL9BXkOtxbejgbb8E5BYj4kHe24IlrV0hEIlLTeOUl1nKMV4MhJTPdrKnP a500fAkxLUGeZe4CewgGB4jtlHmP8/9AU3n7LT1vLMeKAwtBAr4XMY2mXIfAVW1UcOHz 2j8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2aJgRzTFR1OHvh0T2KZjO/E0jVl9cCIAHA9gW4tQGr4=; b=FbrpNtN9tBljIg04XxXooO/TrgxtfcjhajVexeWCHkWrRE6tcD0FKHYHwETpDN7771 NUXmOswGTHgdKxzvojuwAU/4Mi1DzWLfwOMRG22MbL7mPjz6PLoBijMh0EKYK7PpjSpC gQYlNeKhdWjO5UzQm30olg9nJM5CkCcY6mxf41ePA6KA3xdVT5U1bcAIF/6Baym6zD+3 UoDyuzLyOnin8YJLX1ykZrQawzDJ92hWejhafuEsW4J4Ybe8MPXXJkf1c/JhwQJYnBJA xJKJvJjVmoZ6jnXHMuR64IGJYD5+Vw1A5Ub0Ki0Efjjhqbx7l4+GwH9LkO2YlEQO/YbZ QPrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OC8IVAxh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a05640251d200b00448bdddd581si2531410edd.489.2022.08.30.11.23.06; Tue, 30 Aug 2022 11:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OC8IVAxh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbiH3RW7 (ORCPT + 99 others); Tue, 30 Aug 2022 13:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiH3RWV (ORCPT ); Tue, 30 Aug 2022 13:22:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C893BE1A9A; Tue, 30 Aug 2022 10:20:40 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E10996177A; Tue, 30 Aug 2022 17:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03172C433C1; Tue, 30 Aug 2022 17:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661880039; bh=g+P08BfSsgdySgNRNWUPK6wH+vVCcn/SW9pXz0emGpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OC8IVAxhsX8VT8xRBdeSFG1STEoO+rFiTq2UYdzRUTVoq2pqGj+H7xxMUx61IsOIY SLXTi8P6zwrluUJwmDgHZVEmnlWAExygR3PQVbeskHE104GWX+Axi0yZZoX5yAKmX6 Vru3HjO+50s0RWspL2tdlOJpaVM4uF8pL9V/8BNaG3OYMmIUsBzXynGXdXFi/S4bMt z6ZxdtoTqx1ah5jR+51LBvBrLmdQAPZVQZpf9di4VyKhDaHLvyNPWKpVY9AAPqJfpa SVok9aTxQu5ndDbNXx8jbrHfUXpw9dCePVuerC9khf50hnJTvbaqqBt7F39TkYNNhC 4RZFCHqUxYhqg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: lily , "David S . Miller" , Sasha Levin , edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, asml.silence@gmail.com, imagedong@tencent.com, luiz.von.dentz@intel.com, vasily.averin@linux.dev, jk@codeconstruct.com.au, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 25/33] net/core/skbuff: Check the return value of skb_copy_bits() Date: Tue, 30 Aug 2022 13:18:16 -0400 Message-Id: <20220830171825.580603-25-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220830171825.580603-1-sashal@kernel.org> References: <20220830171825.580603-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 5b3559cb1d827..c4a1cd9861857 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4179,9 +4179,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.35.1