Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aldo Ariel Panzardo" <qwe.aldo@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH net v2] net: fec: reject oversized fragments before bounce-buffer memcpy
Date: Thu, 24 Sep 2026 20:38:04 +0000	[thread overview]
Message-ID: <20260924203804.9AFF71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923203738.1583735-1-qwe.aldo@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] net: fec: build failure due to undefined label release
--

commit 07a88506b223c9e67d1b8c1a1dfa027140cd954a
Author: Aldo Ariel Panzardo <qwe.aldo@gmail.com>

net: fec: reject oversized fragments before bounce-buffer memcpy

This patch adds length checks before bounce-buffer copies in
fec_enet_txq_submit_frag_skb() and fec_enet_txq_submit_skb(). It aims to
prevent buffer overflows by jumping to the error path when the data exceeds
the bounce buffer capacity.

> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 794ec427b0ee6..861498448fe36 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
[ ... ]
> @@ -634,6 +636,8 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq,
>  	index = fec_enet_get_bd_index(bdp, &txq->bd);
>  	if (((unsigned long) bufaddr) & fep->tx_align ||
>  		fep->quirks & FEC_QUIRK_SWAP_FRAME) {
> +		if (buflen > FEC_ENET_TX_FRSIZE)
> +			goto release;

[Severity: Low]
Does the label 'release' exist in fec_enet_txq_submit_skb()? It looks like
this might cause a build failure due to an undefined label.

Additionally, if a release path is added, would we also need to ensure the
skb is freed (for example, via dev_kfree_skb_any) to avoid a memory leak?

>  		memcpy(txq->tx_bounce[index], skb->data, buflen);
>  		bufaddr = txq->tx_bounce[index];

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923203738.1583735-1-qwe.aldo@gmail.com?part=1

      parent reply	other threads:[~2026-09-24 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 20:37 [PATCH net v2] net: fec: reject oversized fragments before bounce-buffer memcpy Aldo Ariel Panzardo
2026-09-23 21:00 ` Andrew Lunn
     [not found]   ` <CAP48Hfto4qc285B3Jw7ZRuC-wGf57JOBPZOdrrAt-aDfGcas8Q@mail.gmail.com>
2026-09-24 12:40     ` Andrew Lunn
2026-09-24 15:24       ` Shenwei Wang
     [not found]       ` <CAP48HfuR9_d2KZ7ygG4fMq5ekSb2zaaiEzo_fq_mOWODN5Os6A@mail.gmail.com>
2026-10-07 12:27         ` Andrew Lunn
2026-09-24  2:15 ` Wei Fang
2026-09-24 20:38 ` sashiko-bot [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=20260924203804.9AFF71F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=qwe.aldo@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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