From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDEB946364 for ; Fri, 7 Mar 2025 13:24:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A18E940E30; Fri, 7 Mar 2025 13:24:56 +0100 (CET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id 878A240E3F for ; Fri, 7 Mar 2025 13:24:55 +0100 (CET) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43bc6a6aaf7so13868845e9.2 for ; Fri, 07 Mar 2025 04:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741350295; x=1741955095; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LK4VLQoD2+whDmMxOQaVz0J9uF2Pi9Tna35ty65OqGM=; b=l3k67vD41Xak5ytkF0WJZr1EtGYREPb9j1TrzjU4scQJOxVVBOVzsVf3/DQliKD9En 8z8EaQ1EfwWOtpLiDPYTmUJSxNDcJPwIIPvEkOkX6rpeo8KSAJCurjdWBTmkbnycwGP5 07ZsTmgtYXtuEhxuEmx4VKp1+vVE9NUUDhPEYWhaY0R1IzdF/JT0cDy3YpJ/WPu+CpzL b38QNULwteMPbMEHE7PD2fLlfmyQuX6dS1LJg/w0ejs7SmBmsxjM9RLqccvDf5G2yhu+ xo8784nekYAmFh+xYkaHlwqbDYwB5lIx5FGwdDDj8M6kBOrHMVKrQ6y5bOYHi99XU+KL SzPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741350295; x=1741955095; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LK4VLQoD2+whDmMxOQaVz0J9uF2Pi9Tna35ty65OqGM=; b=JwUpRrfobp+vCJj+uKgWGGHqmhKHZb+3vmKUxLjRH8Y5On5JCqevSoa/TWjDXHX2sC 5+IYsPSCx/bM++Kzg7PWdMCWsA1XHHy98DH/cJJ9R2fChKnwtBrP3/Hv79erQl4olzJr pwpmOcFwc/2jRkf6QVOYD1pWQ+ZnrUguPlRFEduvf62uwnAwQwBfBYKraJtN3P+HAHtB /h/MvadCXE6CozBtAiOm2anaqQ6LMcaAe2lxJLmxqFnt/7hG0+lsSF2YdCYTssBkhizH 7sX7+cQH3dgQnwU4AVV/8CYaWe3bpXalTTuajvS64tFLxTZDqKpuwDf3QLx0x/q3OiS0 Eevg== X-Forwarded-Encrypted: i=1; AJvYcCUJaHyrp/PrDo7VUpb+t5MH+NNE2kV5bw9aHyIT3q4TD9QUniVPbIHRsA+KE84VFFDVL6h66FE=@dpdk.org X-Gm-Message-State: AOJu0YwryqtgdipepK6DK0TqYc5CGT3nYxzYEbgtyPejqqJTfClWoDV7 ZZDGyKmi5C1Fys3zWEOiuDSuYWYIz9k3FCkl4NdQE9euLXX/ut+v X-Gm-Gg: ASbGncvAZqcvuxiPrni0MDSJ6Yu5UAL5rUE15mnhrLC+u8k2By007LcqeKvjAQVLfNX 9IN/EJLZNV/0ezSgPOVhIxF2rTLCInZ7NISKccNNR9eWKj+kBOGkj0e3AwBm78+uTA8q0FFgxNq xae/rHg/D+n8d3gx19qacZ2Qhk6nHmh7rs6nO1nTL6XlCJdFWG3I0g4rtLMn2RWr2/qQctEdT7c 7vIXWH+l5rVcjSPxkHugn0At5RYo/bHwuYHbAnA4cee1DrqJtEtHb08UaYXh4gGD+knCUU7Tbiq skacsHxRoLZdZrsfL5vK8yA98xubS/YjVDuKjf/NLbzAMybtsNM= X-Google-Smtp-Source: AGHT+IGeh/Aiy0GnTeifW3tG81+1+ay+EUIkDAMBlfS3Pz2/RdwQXXRxDTU+0tsGqiFvg/534QLVHA== X-Received: by 2002:a05:600c:2241:b0:439:689b:99eb with SMTP id 5b1f17b1804b1-43cdceb4334mr10773265e9.7.1741350294887; Fri, 07 Mar 2025 04:24:54 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:ff31:f049:bd38:f7cf]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-43bdd8b04casm50135565e9.8.2025.03.07.04.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 04:24:54 -0800 (PST) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Maxime Coquelin , dpdk stable Subject: patch 'vhost: check descriptor chains length' has been queued to stable release 22.11.8 Date: Fri, 7 Mar 2025 12:24:09 +0000 Message-ID: <20250307122431.1415551-10-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250307122431.1415551-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-79-luca.boccassi@gmail.com> <20250307122431.1415551-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/09/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/01b199177b82c3641f3ae2571ec9ed4e0d1927b7 Thanks. Luca Boccassi --- >From 01b199177b82c3641f3ae2571ec9ed4e0d1927b7 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Mon, 23 Dec 2024 11:29:21 +0800 Subject: [PATCH] vhost: check descriptor chains length [ upstream commit e31b57e732d52f3cd8c707824f79fef8c117df95 ] The descriptor chains length must be greater than the Virtio-net header size. Otherwise, such descriptor chains sizes implies no packet data. Fixes: fe8477ebbd94 ("vhost: support async packed ring dequeue") Signed-off-by: Yunjian Wang Reviewed-by: Maxime Coquelin --- lib/vhost/virtio_net.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index f16b7c45da..ec8d03d97f 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -3586,6 +3586,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev, VHOST_ACCESS_RO) < 0)) return -1; + if (unlikely(buf_len <= dev->vhost_hlen)) { + if (!allocerr_warned) { + VHOST_LOG_DATA(dev->ifname, ERR, "Invalid buffer length.\n"); + allocerr_warned = true; + } + return -1; + } + + buf_len -= dev->vhost_hlen; + if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) { if (!allocerr_warned) { VHOST_LOG_DATA(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.\n", -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-03-07 12:23:38.393327990 +0000 +++ 0010-vhost-check-descriptor-chains-length.patch 2025-03-07 12:23:38.002838176 +0000 @@ -1 +1 @@ -From e31b57e732d52f3cd8c707824f79fef8c117df95 Mon Sep 17 00:00:00 2001 +From 01b199177b82c3641f3ae2571ec9ed4e0d1927b7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e31b57e732d52f3cd8c707824f79fef8c117df95 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 0bf49169db..0348e8dac3 100644 +index f16b7c45da..ec8d03d97f 100644 @@ -23 +24 @@ -@@ -3960,6 +3960,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev, +@@ -3586,6 +3586,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev, @@ -29 +30 @@ -+ VHOST_DATA_LOG(dev->ifname, ERR, "Invalid buffer length."); ++ VHOST_LOG_DATA(dev->ifname, ERR, "Invalid buffer length.\n"); @@ -39 +40 @@ - VHOST_DATA_LOG(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.", + VHOST_LOG_DATA(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.\n",