Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C47B5606A31A for ; Tue, 1 Dec 2026 00:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=NAxqWyFH Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 831A3402E3; Tue, 1 Dec 2026 01:59:30 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTPS id 5975C402B8 for ; Tue, 1 Dec 2026 01:59:29 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-cd61cef87f1so5376249a12.0 for ; Mon, 30 Nov 2026 16:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796086768; x=1796691568; darn=dpdk.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=G8qVvJat+Toeyvuy2fVzxFtOeSry6Dg9SgjNV11yUNA=; b=NAxqWyFHLE2imnODnV2hK12K7zJWoMEAWZXRj+motmVnDfM1aIcJjBV57j9mOSQB3U +jn/+SaI0RZi84u2e14W4kNRSVNthp+w001EVQcsbV9w4xU0JezSg7psdzYRjKSNcRaI 6vmmUxLCKq6Cq0xrvEvoSJkQ09/+zxPIfBgJbb+42W66fQm4QG6eKkf2f7FvqGzOIfin YDw6oPJatCDZxFeJHuhDVQaLlcaY8OCBpFIhUL8wTwHKkRscINcatSwM9YSgMzzyCwYR 644MPGTZRi2X6fwOSxodHhvKboQEk/MiItU2uIOmait9PLwltJqVHm0alA80tT12h/Px 0k6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796086768; x=1796691568; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=G8qVvJat+Toeyvuy2fVzxFtOeSry6Dg9SgjNV11yUNA=; b=1OFl6sFNfCE2dWOGALo09noFxsMg2TVUlT3sqKhSUyF/Yozf6BXGh32vkKCYdbI5Bh QAaVcWLkcLtR3L+GxEUYWd8H135FEKdyPGe5dk3GTi5fOyClUgUXbBH1bzR4tVee4rr2 sQ3zb/AUIVanNcwtrpdxzeFJyiTRS8Rcc4nfcz0QVSiefWxxORrzt0bKqvv8ZnqpXJVo IF3lK/9pLN2GAs5gY+qZLT0EyjibyiUYTsmoPPXbtVYqlwVkBclUBSE+Ba19+CNkFlwM N0zOuJaIiTAxZj3cFqZXXG8tIQFagZI+L9hFyRvO1WH7wH6hA6FP7pR6HsMnKS3kW6W9 SZbA== X-Gm-Message-State: APuU4Z+L7CjeIwsO/SBF4EgGa5IUdkkknDkFukXjWYg6YqRcFSjFm0o2 +VJH5FQP00ecT9YZZhqm/asihMfvNt5JTmCXj2OmqgRPTxVKIr252zbe59ULcb0eZqw= X-Gm-Gg: AZFdTZcuu+1yB503ucRdAFe6BAJmxXBaBfRtvgfB/pswmAxgxtnSUdKSV41fl+5Aj5x xPbBEL3/TyzyTrg3caW87/WCf6mla4OUHpg2T0752KymA9kMH/lSHKPXJyywX2t9Zh+fHzcurN6 9aFz39GTHSo6p6eW1qLySHpzFUEDrdyRLfZ1gPj4NzVmtLpaE25OWwRZnMNw19Je+JrnxMq1MRr JivF5akWffWVs5N0bxJw2dU3QGeWe09ahb+yuuzJGC+XmgDspJPUhcn4B2DXYJM2uooOXtUZdCr d1ph/GQ43yHE1SmAM3/WuTg/kQRg8psHvEWmDQ3rzwkTnwv8Au8c1Kn3wwl8dkBCuASB9Mhbr61 aIQElqXPLu+e339lajlLAKq4Cc01yq0Sy+wPHfJGIHcNPsN08EkzqiRjMUzTA+Ilrs8w75V0+Qv UWkBY/L0lQt2jLESfeYFoQjAr0a3t6UmrINLyR8/vp035hQJ6DDs9VjOMn1beX9FH0O351w2cm4 ddYSdU5ezw93QJtDpDMBtmT70SGusZZbphgpg3Xdli59QlebFSrQP/t3h6grgJbllH7yX6sb9m3 tEswnm4CAkV68AyAj55zZvS2aGZLnjlOk/se3WgAHt3eXSTkNIweERZ8Hn+3kR+izkVbNpw= X-Received: by 2002:a17:90b:3f10:b0:3ac:af8b:6f3 with SMTP id 98e67ed59e1d1-3b41cb0caa7mr29664311a91.52.1796086767687; Mon, 30 Nov 2026 16:59:27 -0800 (PST) Received: from phoenix.local (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5210be133sm23227572a91.11.2026.11.30.16.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 16:59:27 -0800 (PST) Date: Mon, 30 Nov 2026 16:26:47 -0800 From: Stephen Hemminger To: Junlong Wang Cc: dev@dpdk.org, stable@dpdk.org Subject: Re: [PATCH v1 1/2] net/zxdh: bound resource table reply length before copying Message-ID: <20261130162647.44ee737a@phoenix.local> In-Reply-To: <20261128040458.3967016-2-wang.junlong1@zte.com.cn> References: <20261128040458.3967016-1-wang.junlong1@zte.com.cn> <20261128040458.3967016-2-wang.junlong1@zte.com.cn> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Sat, 28 Nov 2026 12:04:57 +0800 Junlong Wang 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.