From: Wei Fang <wei.fang@nxp.com>
To: Simon Horman <horms@kernel.org>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: RE: [PATCH v3 net] net: enetc: fix VSI mailbox timeout handling and DMA lifecycle
Date: Fri, 1 May 2026 01:16:19 +0000 [thread overview]
Message-ID: <DBBPR04MB7500C307D75153F1BF27406B88322@DBBPR04MB7500.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20260430170922.1729686-1-horms@kernel.org>
> > @@ -259,6 +282,7 @@ static void enetc_vf_remove(struct pci_dev *pdev)
> > {
> > struct enetc_si *si = pci_get_drvdata(pdev);
> > struct enetc_ndev_priv *priv;
> > + struct enetc_msg_swbd msg;
> >
> > priv = netdev_priv(si->ndev);
> > unregister_netdev(si->ndev);
> > @@ -270,7 +294,9 @@ static void enetc_vf_remove(struct pci_dev *pdev)
> >
> > free_netdev(si->ndev);
> >
> > + msg = si->msg;
> > enetc_pci_remove(pdev);
> > + enetc_msg_dma_free(&pdev->dev, &msg);
>
> Is it possible for the mailbox to still be busy here?
>
> The commit addresses the use-after-free in the send path by checking the
> mailbox busy status before freeing the previous buffer. However, during driver
> teardown, enetc_msg_dma_free() is called unconditionally.
>
> If a prior message sent via enetc_msg_vsi_send() times out and the hardware is
> still accessing the buffer, and then the driver is unbound, could this cause the
> hardware to read from freed DMA memory?
>
> Should the teardown path wait for the mailbox to become idle or ensure the
> hardware is safely reset before freeing the buffer?
>
enetc_msg_dma_free() is called after enetc_pci_remove(), enetc_pci_remove()
will disable the device, so it is safe to free the buffer.
next prev parent reply other threads:[~2026-05-01 1:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 8:19 [PATCH v3 net] net: enetc: fix VSI mailbox timeout handling and DMA lifecycle Wei Fang
2026-04-30 17:09 ` Simon Horman
2026-05-01 1:16 ` Wei Fang [this message]
2026-05-01 1:20 ` patchwork-bot+netdevbpf
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=DBBPR04MB7500C307D75153F1BF27406B88322@DBBPR04MB7500.eurprd04.prod.outlook.com \
--to=wei.fang@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoning.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox