[PATCH v1 1/2] net/zxdh: bound resource table reply length before copying

Stephen Hemminger stephen at networkplumber.org
Tue Dec 1 01:26:47 CET 2026


On Sat, 28 Nov 2026 12:04:57 +0800
Junlong Wang <wang.junlong1 at 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.


More information about the stable mailing list