From: Andrew Lunn <andrew@lunn.ch>
To: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: Kegl Rohit <keglrohit@gmail.com>, netdev <netdev@vger.kernel.org>
Subject: Re: net: fec: memory corruption caused by err_enet_mii_probe error path
Date: Wed, 22 Dec 2021 11:33:33 +0100 [thread overview]
Message-ID: <YcL+/V9ce46fZwyS@lunn.ch> (raw)
In-Reply-To: <DB8PR04MB679571AF60C377BB1242D26BE67D9@DB8PR04MB6795.eurprd04.prod.outlook.com>
> > err_enet_mii_probe:
> > fec_enet_free_buffers(ndev);
> > err_enet_alloc:
> > fec_enet_clk_enable(ndev, false);
> > clk_enable:
> > pm_runtime_mark_last_busy(&fep->pdev->dev);
> > pm_runtime_put_autosuspend(&fep->pdev->dev);
> > pinctrl_pm_select_sleep_state(&fep->pdev->dev);
> > return ret;
> >
> > This error path frees the DMA buffers, BUT as far I could see it does not stop
> > the DMA engines.
> > => open() fails => frees buffers => DMA still active => MAC receives network
> > packet => DMA starts => random memory corruption (use after
> > free) => random kernel panics
> A question here, why receive path still active? MAC has not
> connected to PHY when this failure happened, should not see network
> activities.
Not every system has a PHY. There are plenty of boards with the FEC
directly connected to an Ethernet switch. So packets could be flowing.
Andrew
next prev parent reply other threads:[~2021-12-22 10:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 7:06 net: fec: memory corruption caused by err_enet_mii_probe error path Kegl Rohit
2021-12-22 8:01 ` Joakim Zhang
2021-12-22 10:33 ` Andrew Lunn [this message]
2021-12-22 11:05 ` Kegl Rohit
2021-12-23 1:53 ` Joakim Zhang
2021-12-23 13:35 ` Kegl Rohit
2021-12-24 2:29 ` Joakim Zhang
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=YcL+/V9ce46fZwyS@lunn.ch \
--to=andrew@lunn.ch \
--cc=keglrohit@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=qiangqing.zhang@nxp.com \
/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.