From patchwork Mon Mar 28 09:57:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: qianfan X-Patchwork-Id: 1610088 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=fJlER4hq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KRp6j2zgSz9sDX for ; Mon, 28 Mar 2022 20:58:21 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E5DE883B74; Mon, 28 Mar 2022 11:58:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.b="fJlER4hq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2DC6D81DD3; Mon, 28 Mar 2022 11:58:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from m12-17.163.com (m12-17.163.com [220.181.12.17]) by phobos.denx.de (Postfix) with ESMTP id F0D76839DD for ; Mon, 28 Mar 2022 11:57:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=qianfanguijin@163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=rUq0+ZPg2azg2CNynK NCsLFmbnr433H4ZO29Y+vTPmM=; b=fJlER4hqvA/alWl1CvJPN08TF+J6wHVSc1 rnQks6mH1IgccuRD17Shd/Ead7IYboc2tiJAzu0GoORTa8UDmZFqRBZmDUqgQGLD BTLLxyzLvGCNQiZUkn/3SJiPfLmxAevOCHfib6AdG1k56bZjx3sWt3C+eqno+jr7 +RhojiE9g= Received: from localhost.localdomain (unknown [218.201.129.19]) by smtp13 (Coremail) with SMTP id EcCowAB3t6CbhkFiJoKvJA--.33244S3; Mon, 28 Mar 2022 17:57:48 +0800 (CST) From: qianfanguijin@163.com To: u-boot@lists.denx.de Cc: Joe Hershberger , Ramon Fried , Matthias Schiffer , Heinrich Schuchardt , qianfan Zhao Subject: [PATCH v2 2/2] net: eth-uclass: Fix data abort when tftp get nonexistent file via usb Date: Mon, 28 Mar 2022 17:57:45 +0800 Message-Id: <20220328095745.19516-2-qianfanguijin@163.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220328095745.19516-1-qianfanguijin@163.com> References: <20220328095745.19516-1-qianfanguijin@163.com> X-CM-TRANSID: EcCowAB3t6CbhkFiJoKvJA--.33244S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZF47uryfCw1fWryUWFW8Xrb_yoWDtFgEga n3Xr1vyr4FgF909ay8Cr47AF48uF48Wr1rWFy7tFZIkFy8A395WrZ7trZYvr1ku34jkF9x Crn8Aa4UJw1a9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRRR6wtUUUUU== X-Originating-IP: [218.201.129.19] X-CM-SenderInfo: htld0w5dqj3xxmlqqiywtou0bp/1tbiQhzR7VaEBWgHyAAAsS X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: qianfan Zhao tftp_handler do eth_halt when TFTP_ERROR, but eth_halt will remove eth device if it is an usb network. usbeth's private data will be unaccessable when usb_eth_free_pkt, touch it will trigger data abort. Next is the console messages: => tftp xxx ... Loading: * TFTP error: 'open failed: No such file or directory' (1) Not retrying... data abort pc : [<9feb6ba2>] lr : [<9feb6b9f>] Fix it. Signed-off-by: qianfan Zhao Reviewed-by: Ramon Fried --- net/eth-uclass.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/eth-uclass.c b/net/eth-uclass.c index c6eb1bc8f8..27baf52c26 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -405,6 +405,13 @@ int eth_rx(void) flags = 0; if (ret > 0) net_process_received_packet(packet, ret); + + /* ethernet maybe halted when packet_handler, check again */ + if (!eth_is_active(current)) { + ret = 0; + break; + } + if (ret >= 0 && eth_get_ops(current)->free_pkt) eth_get_ops(current)->free_pkt(current, packet, ret); if (ret <= 0)