From patchwork Thu Jul 20 14:42:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanjun Gong X-Patchwork-Id: 13320613 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE7CD18AEE for ; Thu, 20 Jul 2023 14:42:41 +0000 (UTC) Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA85C10FC for ; Thu, 20 Jul 2023 07:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=js28PmkET15b+FASZN NNdJu6bVH/EojA7Q2F3nFxq30=; b=StxiDmFHYFUS/xaGswQBZMNlIYOqc9CvTS 9/y+PeD4d/ab+Ich+6KaIQozcr57NimYZQDteabcJsZ6DJ9JrvT+RnkmhTXWVLF9 BWNrrdWIpWPZJZu01V2dFf9v+ZzWxXE9vawW+gVGflbSuMd4kQUSi5PAhb5oCaVH wSoicMemM= Received: from localhost.localdomain (unknown [202.112.113.212]) by zwqz-smtp-mta-g4-4 (Coremail) with SMTP id _____wBX7trCR7lk_1JhAw--.16248S4; Thu, 20 Jul 2023 22:42:15 +0800 (CST) From: Yuanjun Gong To: Chris Snook , "David S . Miller" , Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org Cc: Yuanjun Gong Subject: [PATCH 1/1] ethernet: atheros: fix return value check in atl1c_tso_csum() Date: Thu, 20 Jul 2023 22:42:08 +0800 Message-Id: <20230720144208.39170-1-ruc_gongyuanjun@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wBX7trCR7lk_1JhAw--.16248S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtw1DtFWrWr45GFykZw47urg_yoWDZrcEgw 1fX3Z7Ca1DGr1Yyr47tr45WrWj9rZrXF97Aay8KFW3uw4DC348ZFnYkF93AryUCr4UJr9I kwnxCayUAa4Y9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRtKsjUUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: 5uxfsw5rqj53pdqm30i6rwjhhfrp/1tbiJwiy5V5vE2EsGQAAsO X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,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 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-Patchwork-Delegate: kuba@kernel.org in atl1c_tso_csum, it should check the return value of pskb_trim(), and return an error code if an unexpected value is returned by pskb_trim(). Signed-off-by: Yuanjun Gong Reviewed-by: Simon Horman --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 4a288799633f..940c5d1ff9cf 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -2094,8 +2094,11 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter, real_len = (((unsigned char *)ip_hdr(skb) - skb->data) + ntohs(ip_hdr(skb)->tot_len)); - if (real_len < skb->len) - pskb_trim(skb, real_len); + if (real_len < skb->len) { + err = pskb_trim(skb, real_len); + if (err) + return err; + } hdr_len = skb_tcp_all_headers(skb); if (unlikely(skb->len == hdr_len)) {