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 366FBA0093 for ; Thu, 17 Mar 2022 15:17:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 017164067B; Thu, 17 Mar 2022 15:17:55 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id E88FC4067B for ; Thu, 17 Mar 2022 15:17:53 +0100 (CET) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 3D4333F0EC for ; Thu, 17 Mar 2022 14:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1647526673; bh=JQMSWYdkm2r7npPIeogAanYLl2xHDMfhPyeCRz/QxWE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CJGUvy+PP/kpH06ceHxD97F1m2NrfBhFP6uhT0fFsbvbLXaJPmcVLc+mcRKIVNo1d BrSApPyiKDbSJTsuLcmRaly+qI8QfmeuX2kBhIzR9mhQlVX1F7risyajh4fgRK2RtQ voY639p/hPvW58rz1TBuHHDui88sjAUNX3nJzLavfaWnW+NXpA/IceM5A8nesCsCVc I+YY54/53B4y7ae2pFHBVOGKFwgTKAKdJTa00E2fnssIs3wIN0NWk1znQVoRhjscZA 9RTcMPyteKOMSm5/7zyKSwh89UJk/e3ggTjFIn7rK/YKKSFpKiVMIG0GkT0DahdBzP NEhG5Knfa1OkA== Received: by mail-ej1-f69.google.com with SMTP id q22-20020a1709064cd600b006db14922f93so3007056ejt.7 for ; Thu, 17 Mar 2022 07:17:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JQMSWYdkm2r7npPIeogAanYLl2xHDMfhPyeCRz/QxWE=; b=SAGD1KR0/no7tB1ABzKftu64Puc2/+JiYtb16LeCv+owiVt8QWANGtWqCKkKuvvSGx ohiJ5MHuYg7B/yUgBT0ZEGGVZN5eWnt6DG4hsDQU37tQo7qscHbhILdXH3xzHciSG37D mZ0PbYGdoa7mOf5mUqKJ6kf0pf15ivbOPUSlr0tIxXjRayJSzwBlSLa5tYxgmznyIYzQ PNPL45sHN9Y+BKCbfOJlJuV236+dsCLSbqNpc9Y7u6n6Wh/Ix1TYFr/pzIn4arh+NQkv MeOWHCimpy7X51K//StHIz5u4WIRRpg9RN8RmJ2fxI7NM4veDPXvCL6Wxz2bRr3PVEt/ kGVg== X-Gm-Message-State: AOAM531cJqv1OVtjcrcvBy/TDZbCYtHSALYF9s0DCpln4x3LOpINJwgm 33AZLhhv+mRs43TcPxk6XDqKJD2mtSDrj5hu5J/Hc0qXKGc55TvjzP9Pl1bpYLpHOlK39S+E+Df FUIC0AZiN7VTnP25kojiJ5nrG X-Received: by 2002:a05:6402:2755:b0:418:ec91:b9b5 with SMTP id z21-20020a056402275500b00418ec91b9b5mr4664727edd.272.1647526672407; Thu, 17 Mar 2022 07:17:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKMgeA1UkoPvk5dKxiEyLXul4+LR3SRWHdhFNuDSIJ4PYs0n+L2tuSxe98+jiW0os4q4aAyA== X-Received: by 2002:a05:6402:2755:b0:418:ec91:b9b5 with SMTP id z21-20020a056402275500b00418ec91b9b5mr4664705edd.272.1647526672186; Thu, 17 Mar 2022 07:17:52 -0700 (PDT) Received: from localhost.localdomain (068-133-067-156.ip-addr.inexio.net. [156.67.133.68]) by smtp.gmail.com with ESMTPSA id h22-20020a1709062dd600b006dac66b8076sm2382541eji.95.2022.03.17.07.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 07:17:51 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Chenbo Xia Cc: Wenxiang Qian , Maxime Coquelin , dpdk stable Subject: patch 'vhost: fix queue number check when setting inflight FD' has been queued to stable release 19.11.12 Date: Thu, 17 Mar 2022 15:17:39 +0100 Message-Id: <20220317141747.1955930-1-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.35.1 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 19.11.12 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/19/22. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/aef547884b8a64c0754b4b7906ae9d7c912b8043 Thanks. Christian Ehrhardt --- >From aef547884b8a64c0754b4b7906ae9d7c912b8043 Mon Sep 17 00:00:00 2001 From: Chenbo Xia Date: Mon, 14 Feb 2022 16:32:37 +0800 Subject: [PATCH] vhost: fix queue number check when setting inflight FD [ upstream commit 6442c329b9d2ded0f44b27d2016aaba8ba5844c5 ] In function vhost_user_set_inflight_fd, queue number in inflight message is used to access virtqueue. However, queue number could be larger than VHOST_MAX_VRING and cause write OOB as this number will be used to write inflight info in virtqueue structure. This patch checks the queue number to avoid the issue and also make sure virtqueues are allocated before setting inflight information. Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information") Cc: stable@dpdk.org Reported-by: Wenxiang Qian Signed-off-by: Chenbo Xia Reviewed-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 1ee6050ac0..79be132c43 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2624,6 +2624,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, case VHOST_USER_SET_VRING_ADDR: vring_idx = msg->payload.addr.index; break; + case VHOST_USER_SET_INFLIGHT_FD: + vring_idx = msg->payload.inflight.num_queues - 1; + break; default: return 0; } -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-17 14:33:41.927799482 +0100 +++ 0001-vhost-fix-queue-number-check-when-setting-inflight-F.patch 2022-03-17 14:33:41.828622841 +0100 @@ -1 +1 @@ -From 6442c329b9d2ded0f44b27d2016aaba8ba5844c5 Mon Sep 17 00:00:00 2001 +From aef547884b8a64c0754b4b7906ae9d7c912b8043 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6442c329b9d2ded0f44b27d2016aaba8ba5844c5 ] + @@ -20 +22 @@ - lib/vhost/vhost_user.c | 3 +++ + lib/librte_vhost/vhost_user.c | 3 +++ @@ -23,5 +25,5 @@ -diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c -index 589b950458..1ec4357bee 100644 ---- a/lib/vhost/vhost_user.c -+++ b/lib/vhost/vhost_user.c -@@ -2883,6 +2883,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, +diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c +index 1ee6050ac0..79be132c43 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -2624,6 +2624,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, @@ -29 +31 @@ - vring_idx = ctx->msg.payload.addr.index; + vring_idx = msg->payload.addr.index; @@ -32 +34 @@ -+ vring_idx = ctx->msg.payload.inflight.num_queues - 1; ++ vring_idx = msg->payload.inflight.num_queues - 1;