From patchwork Thu Jul 20 14:42:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanjun Gong X-Patchwork-Id: 13320614 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 C7CBA18AEE for ; Thu, 20 Jul 2023 14:42:49 +0000 (UTC) Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B30C210FC for ; Thu, 20 Jul 2023 07:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ioQe9DyoTagxEhOs7Y f02iDJzJvlB7XYdYv2uRJymqw=; b=BWEP7h5xNfv3q7eslxUBFYlhkeo66G4Qlj OvDm/ybLRmPdbPksQJv6yo1PXQBf8I2V5I5YfTDQqSwDFkRD/p64pj04t+8sLqaA JiHuQeO3Ue/LON7lJ4tLD2qsaP5OylNw6bmtzvO3Rdmp56jr4aTpYmdYAFLeUD/x AvtRsC+SM= Received: from localhost.localdomain (unknown [202.112.113.212]) by zwqz-smtp-mta-g0-1 (Coremail) with SMTP id _____wAHhlbNR7lkPwpFAw--.36146S4; Thu, 20 Jul 2023 22:42:27 +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 atl1e_tso_csum() Date: Thu, 20 Jul 2023 22:42:19 +0800 Message-Id: <20230720144219.39285-1-ruc_gongyuanjun@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wAHhlbNR7lkPwpFAw--.36146S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtw1fWw1UXr1UJr13Gw4xXrb_yoWDZrcEgw 1Iv3Z7Ga1UKr1Yyr47Gr4ru3yj9rWkXF97Cay8Kay3uwsrG348Zr1vkFn3ArW7Cr45Jr9x GrnIk3yUAa4YkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRKZ2-UUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: 5uxfsw5rqj53pdqm30i6rwjhhfrp/xtbBiBay5VaEF2kAyQAAss 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,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L4, 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 atl1e_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/atl1e/atl1e_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 5db0f3495a32..5935be190b9e 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -1641,8 +1641,11 @@ static int atl1e_tso_csum(struct atl1e_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)) {