From: Stephen Hemminger <stephen@networkplumber.org>
To: Junlong Wang <wang.junlong1@zte.com.cn>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH v1 1/2] net/zxdh: bound resource table reply length before copying
Date: Mon, 30 Nov 2026 16:26:47 -0800 [thread overview]
Message-ID: <20261130162647.44ee737a@phoenix.local> (raw)
In-Reply-To: <20261128040458.3967016-2-wang.junlong1@zte.com.cn>
On Sat, 28 Nov 2026 12:04:57 +0800
Junlong Wang <wang.junlong1@zte.com.cn> wrote:
> zxdh_get_res_info() copies a device-supplied reply length into the
> caller's buffer without knowing that buffer's size. Both callers pass
> the address of a uint8_t local, so a reply longer than one byte
> overwrites the caller's stack. Nothing bounds the length either: it
> sits in a nested TBL reply header, which
> zxdh_bar_chan_sync_msg_send() does not look at, and a value above
> ZXDH_RSC_TBL_CONTENT_LEN_MAX also overruns recv_buf.
>
> Pass the destination capacity to the function and reject a reply that
> exceeds it or the recv_buf size, rather than truncating a malformed
> length into a wrong panel or hash id.
>
> While here, report a reply whose status byte is not the success code
> as ZXDH_BAR_MSG_ERR_REPLY and log that byte: such a reply was returned
> to the caller as success. Copy with memcpy() rather than rte_memcpy():
> the length is already checked, and the inlined body makes gcc
> -fanalyzer report a false out-of-bounds write on the caller's
> one-byte object.
>
> Fixes: 6310e3976b ("net/zxdh: get device backend infos")
Applied both to next-net and fixed commit hash to full 12 characters which
is what checkpatches wants.
next prev parent reply other threads:[~2026-12-01 0:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 4:04 [PATCH v1 0/2] net/zxdh: fix issues reported by GCC analyzer Junlong Wang
2026-11-28 4:04 ` [PATCH v1 1/2] net/zxdh: bound resource table reply length before copying Junlong Wang
2026-12-01 0:26 ` Stephen Hemminger [this message]
2026-11-28 4:04 ` [PATCH v1 2/2] net/zxdh: avoid leaking flow entry on validation Junlong Wang
2026-12-01 0:33 ` [PATCH v1 0/2] net/zxdh: fix issues reported by GCC analyzer Stephen Hemminger
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=20261130162647.44ee737a@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=wang.junlong1@zte.com.cn \
/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