From: Jakub Kicinski <kuba@kernel.org>
To: Abin Joseph <abin.joseph@amd.com>
Cc: <radhey.shyam.pandey@amd.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<michal.simek@amd.com>, <git@amd.com>, <netdev@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH net-next] net: xilinx: axienet: Add error handling for RX metadata pointer retrieval
Date: Wed, 27 Aug 2025 18:16:26 -0700 [thread overview]
Message-ID: <20250827181626.7d1dbc3f@kernel.org> (raw)
In-Reply-To: <20250826180549.2178147-1-abin.joseph@amd.com>
On Tue, 26 Aug 2025 23:35:49 +0530 Abin Joseph wrote:
> Subject: [PATCH net-next] net: xilinx: axienet: Add error handling for RX metadata pointer retrieval
Sounds like a fix, please repost as [PATCH net], against the
netdev/net tree.
> Add proper error checking for dmaengine_desc_get_metadata_ptr() which
> can return an error pointer and lead to potential crashes or undefined
> behaviour if the pointer retrieval fails.
>
> Properly handle the error by unmapping DMA buffer, freeing the skb and
> returning early to prevent further processing with invalid data.
>
> Fixes: 6a91b846af85 ("net: axienet: Introduce dmaengine support")
> Signed-off-by: Abin Joseph <abin.joseph@amd.com>
> ---
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 0d8a05fe541a..1729fd21d83b 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1166,8 +1166,17 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result)
> skb = skbuf_dma->skb;
> app_metadata = dmaengine_desc_get_metadata_ptr(skbuf_dma->desc, &meta_len,
> &meta_max_len);
> - dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp->max_frm_size,
> - DMA_FROM_DEVICE);
> +
> + dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp->max_frm_size, DMA_FROM_DEVICE);
80 char width is still strongly preferred, at least in networking.
So please don't unwrap this line for no apparent reason :\
> + if (IS_ERR(app_metadata)) {
--
pw-bot: cr
prev parent reply other threads:[~2025-08-28 1:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 18:05 [PATCH net-next] net: xilinx: axienet: Add error handling for RX metadata pointer retrieval Abin Joseph
2025-08-26 18:06 ` kernel test robot
2025-08-28 1:16 ` Jakub Kicinski [this message]
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=20250827181626.7d1dbc3f@kernel.org \
--to=kuba@kernel.org \
--cc=abin.joseph@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=git@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).