From patchwork Fri Oct 28 02:09:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Changzhong X-Patchwork-Id: 12024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp559637wru; Thu, 27 Oct 2022 18:50:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YrR9zImY0Qei/F3sWSxwlKDbwk0xoG6ZlH7Z/hw+Sy3YEj1Z1KbocwHTl1OCmDZO/jy4O X-Received: by 2002:a63:ea58:0:b0:45f:ffa9:60a0 with SMTP id l24-20020a63ea58000000b0045fffa960a0mr44856517pgk.433.1666921822879; Thu, 27 Oct 2022 18:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666921822; cv=none; d=google.com; s=arc-20160816; b=LdeJyBwdxT17xfRT7h0qesH6OgmmqPmZ6i1WKeK+n6pAdXDw/L6XXyWbl5mn66UD58 L1nIpVwIdvZHvEXwxPIcQgZgun9hqr2l4BnQ3N9Iyyq1n043nCapbLwiCkzedznzT/ZI 0M8HRcDGrn6TJIU1UWeiLXbpmgzOkR0cpu4z7ldBdQQKzHqzEK8DYdCx5re61kO+NCnU /0PEsRJtpXp7npgA9Da936mh0Yatpdz7Kk7L/XKCFK9WmKcp7qhcLmlBG5mJ6Awy4k3N qtEvD3qLSeqdRsOADS7KuWMEc/Q032ZfW8453EVi6MF8Q0dl0MNJWnhPF93G+UWQCKXr ESKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=PhDkjgQ1UQ5s6IMbnxrv3zOOjxhK0CzfM/D/u8Q/rf8=; b=XHqf955dAV5aRB5HUZxwfrCfpn2rWPUW73ZkaLKGHINh+AbtC6pFIcAgPrxYfBImHg VTO/v7JUuMvDaIlzTdeRTE+SU3ReApIoXlGqfuX/OznafzvJezktJ2lqqrTE35dW/zFx niGzR4lUmKMedTq1NTENF3sMQDI5IgiJtjS0YOGCfyrOMJP4eFBZRdvMrhUYZ/h7RPw4 nJDvl22ZndALKf2EZh+a4nEjxvY0jMnGwM3bTdWnZZgtIjemPDasTOy2opVOYx7clpAc RDrag5GY2IdHFZm61pJhstP0qyZoV5uaUc5tPj4kZwNlSjxfh4H6fvjfYVJniNNbQqjN 4Asg== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn7-20020a17090b38c700b00212d06b4743si9742620pjb.34.2022.10.27.18.50.09; Thu, 27 Oct 2022 18:50:22 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235761AbiJ1Bsj (ORCPT + 99 others); Thu, 27 Oct 2022 21:48:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235168AbiJ1Bsh (ORCPT ); Thu, 27 Oct 2022 21:48:37 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D62AA342; Thu, 27 Oct 2022 18:48:36 -0700 (PDT) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mz52q1sX3zpWG9; Fri, 28 Oct 2022 09:45:07 +0800 (CST) Received: from dggpeml500006.china.huawei.com (7.185.36.76) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 28 Oct 2022 09:48:34 +0800 Received: from localhost.localdomain (10.175.112.70) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 28 Oct 2022 09:48:34 +0800 From: Zhang Changzhong To: Joakim Zhang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nimrod Andy CC: Zhang Changzhong , , Subject: [PATCH net] net: fec: fix improper use of NETDEV_TX_BUSY Date: Fri, 28 Oct 2022 10:09:11 +0800 Message-ID: <1666922951-1645-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500006.china.huawei.com (7.185.36.76) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747894217318428699?= X-GMAIL-MSGID: =?utf-8?q?1747894217318428699?= The ndo_start_xmit() method must not free skb when returning NETDEV_TX_BUSY, since caller is going to requeue freed skb. Fix it by returning NETDEV_TX_OK in case of dma_map_single() fails. Fixes: 79f339125ea3 ("net: fec: Add software TSO support") Signed-off-by: Zhang Changzhong --- drivers/net/ethernet/freescale/fec_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 28ef4d3..f623c12 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -713,7 +713,7 @@ fec_enet_txq_put_data_tso(struct fec_enet_priv_tx_q *txq, struct sk_buff *skb, dev_kfree_skb_any(skb); if (net_ratelimit()) netdev_err(ndev, "Tx DMA memory map failed\n"); - return NETDEV_TX_BUSY; + return NETDEV_TX_OK; } bdp->cbd_datlen = cpu_to_fec16(size); @@ -775,7 +775,7 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq, dev_kfree_skb_any(skb); if (net_ratelimit()) netdev_err(ndev, "Tx DMA memory map failed\n"); - return NETDEV_TX_BUSY; + return NETDEV_TX_OK; } }