From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: "Claude Opus 4.6" <noreply@anthropic.com>
Subject: Re: [PATCH 04/10] fs: nfs: use net_eth_to_udp() for packet parsing
Date: Fri, 17 Apr 2026 12:10:30 +0200 [thread overview]
Message-ID: <7f0387e1-f98e-4dbf-be6b-1d97bb9d872d@pengutronix.de> (raw)
In-Reply-To: <20260402-net-eth-do-udp-v1-4-af5d9fd6beec@pengutronix.de>
On 4/2/26 8:36 AM, Sascha Hauer wrote:
> Replace net_eth_to_udp_payload() with the new consolidated
> net_eth_to_udp() helper.
>
> This also fixes a bug where the old code used the NIC-level frame
> length (which includes ethernet, IP, and UDP headers) instead of the
> UDP payload length when copying packet data.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> fs/nfs.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs.c b/fs/nfs.c
> index 0b40c56ff3..39c92e4736 100644
> --- a/fs/nfs.c
> +++ b/fs/nfs.c
> @@ -1193,13 +1193,16 @@ static int nfs_read_req(struct file_priv *priv, uint64_t offset,
>
> static void nfs_handler(void *ctx, char *p, unsigned len)
> {
> - char *pkt = net_eth_to_udp_payload(p);
> struct nfs_priv *npriv = ctx;
> + struct net_udp_pkt udp;
> struct packet *packet;
>
> - packet = xmalloc(sizeof(*packet) + len);
> - memcpy(packet->data, pkt, len);
> - packet->len = len;
> + if (net_eth_to_udp(p, len, &udp))
> + return;
> +
> + packet = xmalloc(sizeof(*packet) + udp.len);
> + memcpy(packet->data, udp.payload, udp.len);
> + packet->len = udp.len;
> packet->pos = 0;
>
> list_add_tail(&packet->list, &npriv->packets);
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-04-17 10:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 6:36 [PATCH 00/10] net: prevent buffer overflows in UDP packets Sascha Hauer
2026-04-02 6:36 ` [PATCH 01/10] net: add net_eth_to_udp() helper for validated UDP extraction Sascha Hauer
2026-04-17 10:04 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 02/10] fs: tftp: use net_eth_to_udp() for packet parsing Sascha Hauer
2026-04-17 10:05 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 03/10] net: dhcp: " Sascha Hauer
2026-04-17 10:07 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 04/10] fs: nfs: " Sascha Hauer
2026-04-17 10:10 ` Ahmad Fatoum [this message]
2026-04-02 6:36 ` [PATCH 05/10] net: dns: " Sascha Hauer
2026-04-17 10:10 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 06/10] net: sntp: " Sascha Hauer
2026-04-17 10:12 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 07/10] net: netconsole: " Sascha Hauer
2026-04-17 10:12 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 08/10] net: fastboot: " Sascha Hauer
2026-04-17 10:14 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 09/10] net: fastboot: stop using net_eth_to_udp_payload() for PACKET_SIZE Sascha Hauer
2026-04-17 10:17 ` Ahmad Fatoum
2026-04-02 6:36 ` [PATCH 10/10] net: remove unused net_eth_to_udp{hdr,_payload,len}() helpers Sascha Hauer
2026-04-17 10:17 ` Ahmad Fatoum
2026-04-17 10:21 ` [PATCH 00/10] net: prevent buffer overflows in UDP packets Ahmad Fatoum
2026-04-17 10:40 ` Sascha Hauer
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=7f0387e1-f98e-4dbf-be6b-1d97bb9d872d@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=noreply@anthropic.com \
--cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox