All of lore.kernel.org
 help / color / mirror / Atom feed
From: qianfanguijin@163.com
To: u-boot@lists.denx.de
Cc: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	Matthias Schiffer <matthias.schiffer@ew.tq-group.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	qianfan Zhao <qianfanguijin@163.com>
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	[thread overview]
Message-ID: <20220328095745.19516-2-qianfanguijin@163.com> (raw)
In-Reply-To: <20220328095745.19516-1-qianfanguijin@163.com>

From: qianfan Zhao <qianfanguijin@163.com>

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 <qianfanguijin@163.com>
---
 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)
-- 
2.17.1


  reply	other threads:[~2022-03-28  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  9:57 [PATCH v2 1/2] net: eth-uclass: Fix eth_halt qianfanguijin
2022-03-28  9:57 ` qianfanguijin [this message]
2022-04-01 19:23   ` [PATCH v2 2/2] net: eth-uclass: Fix data abort when tftp get nonexistent file via usb Ramon Fried
2022-04-02  2:58 [PATCH v2 1/2] net: eth-uclass: Fix eth_halt qianfanguijin
2022-04-02  2:58 ` [PATCH v2 2/2] net: eth-uclass: Fix data abort when tftp get nonexistent file via usb qianfanguijin
2022-04-14  4:39   ` Ramon Fried
2022-04-14  6:17     ` qianfan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220328095745.19516-2-qianfanguijin@163.com \
    --to=qianfanguijin@163.com \
    --cc=joe.hershberger@ni.com \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.