Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp593832rwb; Thu, 1 Dec 2022 06:11:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JnRn/JRn3KTx8HK0FCwDQdN7QZtzPl9UdABzfjZhyZ+T+s4i61Khaj19nZWchPejhMZD9 X-Received: by 2002:a65:53ca:0:b0:476:dd80:fb29 with SMTP id z10-20020a6553ca000000b00476dd80fb29mr60240781pgr.619.1669903875208; Thu, 01 Dec 2022 06:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669903875; cv=none; d=google.com; s=arc-20160816; b=bJM3reR0/CuzW0YM7igdm3iRUD+Z8ev08V1e42zPiMIuTI1K2npWeR5JCfAn5UTQot SAzKfhywB9NHAwKkxIoDsqw4hSPaMdVFTjVnVKddRV1V0aa8OW8DWHLY9bCdMFNmlu0Z 1ehgnNZEPR8V8MXT/B16UscK4U9i/xSoP4YMOZm6dcrYVboTJ8f4tSlUdtw4HeiD8S8V 4AQgfKmdOj7FwSGVgSgbiiiW76E3ESTHAMt3QEiTuDXAI4iGFK8PeWCJT2jSfL84sTF+ SCnygIjwRd7YOT3SrWwxjCFS6Yj+O1VyreA3Ujh53f+CVlFSAsknxvRtK0cMzub+zutR Dm4Q== 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; bh=rMMD11Ar6CFkcFap1wNtRFVCEDknpiLBjIGiFezz2Ko=; b=SI3r8JGvNbmReuw2xgZFBZzBYLCoo11fOd7vOLzrcEffnOpMwzMMAkqc3BT2TTdEGS VO37N0VA6ikiQv7PMcGiBPOerLlV5TGznFl4MyfeOe7WDJWv++D+zMYmj6sU3MnIEi0A RvHIXP9dPsV/docNo44+4N4wDxmFHIr503mdTP4UmBXFFlKtifoXjhVCgytQTJamx7Og mqxu6NhEaXICfabGrIS9c79ZjXMZfm35xN2++lf/ZRvRZIDje74bw5cVP+QQF3+i2IdG hi8YQLaAIV/Ep0t8mmaXXQPR/TeRogtLYjNvAQN5l/xuhOU8C+dNB2zcOsTxE8DdICuX Y/0g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a170902e84f00b0018128753b25si4851389plg.271.2022.12.01.06.10.53; Thu, 01 Dec 2022 06:11:15 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbiLAOBS (ORCPT + 82 others); Thu, 1 Dec 2022 09:01:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbiLAOBP (ORCPT ); Thu, 1 Dec 2022 09:01:15 -0500 Received: from gw.red-soft.ru (red-soft.ru [188.246.186.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C641A47CA; Thu, 1 Dec 2022 06:01:13 -0800 (PST) Received: from localhost.biz (unknown [10.81.81.211]) by gw.red-soft.ru (Postfix) with ESMTPA id 198D33E42F9; Thu, 1 Dec 2022 17:01:12 +0300 (MSK) From: Artem Chernyshev To: artem.chernyshev@red-soft.ru, Kurt Kanzenbach , Vladimir Oltean Cc: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH v3 2/3] net: dsa: hellcreek: Check return value Date: Thu, 1 Dec 2022 17:00:31 +0300 Message-Id: <20221201140032.26746-2-artem.chernyshev@red-soft.ru> X-Mailer: git-send-email 2.30.3 In-Reply-To: <20221201140032.26746-1-artem.chernyshev@red-soft.ru> References: <20221201140032.26746-1-artem.chernyshev@red-soft.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 173880 [Dec 01 2022] X-KLMS-AntiSpam-Version: 5.9.59.0 X-KLMS-AntiSpam-Envelope-From: artem.chernyshev@red-soft.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Auth: dkim=none X-KLMS-AntiSpam-Info: LuaCore: 502 502 69dee8ef46717dd3cb3eeb129cb7cc8dab9e30f6, {Tracking_from_domain_doesnt_match_to}, localhost.biz:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;red-soft.ru:7.1.1;127.0.0.199:7.1.2 X-MS-Exchange-Organization-SCL: -1 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, bases: 2022/12/01 13:03:00 X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2022/12/01 11:49:00 #20632713 X-KLMS-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 Return NULL if we got unexpected value from skb_trim_rcsum() in hellcreek_rcv() Fixes: 01ef09caad66 ("net: dsa: Add tag handling for Hirschmann Hellcreek switches") Signed-off-by: Artem Chernyshev --- V1->V2 Fixes for tag_hellcreek.c and tag_sja1105.c V2->V3 Split patch in 3 separate parts net/dsa/tag_hellcreek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/dsa/tag_hellcreek.c b/net/dsa/tag_hellcreek.c index 846588c0070a..53a206d11685 100644 --- a/net/dsa/tag_hellcreek.c +++ b/net/dsa/tag_hellcreek.c @@ -49,7 +49,8 @@ static struct sk_buff *hellcreek_rcv(struct sk_buff *skb, return NULL; } - pskb_trim_rcsum(skb, skb->len - HELLCREEK_TAG_LEN); + if (pskb_trim_rcsum(skb, skb->len - HELLCREEK_TAG_LEN)) + return NULL; dsa_default_offload_fwd_mark(skb); -- 2.30.3