From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 730B0A0553
	for <public@inbox.dpdk.org>; Mon, 17 Feb 2020 18:46:54 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 6DE791DA12;
	Mon, 17 Feb 2020 18:46:54 +0100 (CET)
Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com
 [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 5D7A51DAB6
 for <stable@dpdk.org>; Mon, 17 Feb 2020 18:46:51 +0100 (CET)
Received: by mail-wr1-f66.google.com with SMTP id w12so20792414wrt.2
 for <stable@dpdk.org>; Mon, 17 Feb 2020 09:46:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=NVA/qqfGArHW9m2+kqBACQ2XSAwHL/O/8OiF4oxjR6M=;
 b=cLp9CeV2M9CUFtdUtxiUpTPnezKykSeIQCQiBXnm4GNvttLWOw4jG+4XGqhNjw81d6
 5JSRxmB4JLzal5R9kLV2gUGyWYS3CN6aSc2tJh2Zb+F21MFRLMf+C8vaP4Hg4XS8lSvF
 iD4OmCaHYMSdSO5PMclo+wqey9eblsDU865w9V4uDWdVd/HTd9QFD+myYlU/KlVJ7TtI
 XAfhCRDQRlbcRqo95DAX9NsJAedHbU9N8EROyzgqFEuh2Yjjwj9anaioRxTNMHthUgBn
 rioEQnfbdoIQlDd7UcnNklE62wdfNMXRF/JKondXMuofdaYaG2AciAZ7ozkBRnWv9tAe
 mELQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=NVA/qqfGArHW9m2+kqBACQ2XSAwHL/O/8OiF4oxjR6M=;
 b=SGvm9PsIy6BD+0ogfCm9wnPC4Mo4UR+Z1SUWnHu/qlDK77GWiiOg2zQjDRuC3T5rpP
 gr934rISB0pPw+/8HfL3G4gYeVPhVmcf6r+ZpVlGGftz4zxTGjSQlzCf6r3Ii7dmGw9l
 o7qj0Jfg5ZOHX3iRgxD9DkQSKTlLqQLsstJd3GzeWbmGCRSPsw0ORF7gUxMveNEni7jO
 Mf7pgC67nJmtTstXQ11X7mks2pyBMm47D0EFGttVtHMK+6WrnQCiBeJI2bbUUGwjqDbn
 zcqrdQBvQ/NH2Vp97hVeA1vmhd9ImtoTNdWMHTiw5+iljGQphk5ApUHLwLS4kAW3BbrS
 AtAg==
X-Gm-Message-State: APjAAAXCUYpIOuveZ5k24CVVQAVKDehHpe0GZ9xo1ZCXXREIzo2XYHiE
 RK5s7dieaWBjtlnv6glSSoo=
X-Google-Smtp-Source: APXvYqwdl7RPjGp5IAGfXgygqB/HWY9nP6VrZtwg6aK9i0Kxk+nUF0UfYtJUL7OGDuoRnDy6HmlSJQ==
X-Received: by 2002:a05:6000:10c:: with SMTP id
 o12mr23753870wrx.106.1581961611151; 
 Mon, 17 Feb 2020 09:46:51 -0800 (PST)
Received: from localhost (userh634.uk.uudial.com. [194.69.103.7])
 by smtp.gmail.com with ESMTPSA id w22sm172343wmk.34.2020.02.17.09.46.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Feb 2020 09:46:50 -0800 (PST)
From: luca.boccassi@gmail.com
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Ilja Van Sprundel <ivansprundel@ioactive.com>,
 Tiwei Bie <tiwei.bie@intel.com>, dpdk stable <stable@dpdk.org>
Date: Mon, 17 Feb 2020 17:45:29 +0000
Message-Id: <20200217174546.25334-37-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200217174546.25334-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-190-luca.boccassi@gmail.com>
 <20200217174546.25334-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'vhost: check message header size read' has
	been queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/19/20. 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.

Thanks.

Luca Boccassi

---
>From 86ad179c5b1de7c352d65d6bd4e14294a26ba10b Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Wed, 5 Feb 2020 16:05:29 +0100
Subject: [PATCH] vhost: check message header size read

[ upstream commit 966f89d998a20eddb45666f06dd42a3c3fc94574 ]

This patch adds a check to ensure the read size of
the Vhost-user message header is not smaller than
the expected size.

In case of unexpected read size, report an error
and close file descriptors passed with the message,
if any.

Fixes: 8f972312b8f4 ("vhost: support vhost-user")

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/vhost_user.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 4312e5e536..d224932dda 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2456,8 +2456,13 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
 
 	ret = read_fd_message(sockfd, (char *)msg, VHOST_USER_HDR_SIZE,
 		msg->fds, VHOST_MEMORY_MAX_NREGIONS, &msg->fd_num);
-	if (ret <= 0)
+	if (ret <= 0) {
 		return ret;
+	} else if (ret != VHOST_USER_HDR_SIZE) {
+		RTE_LOG(ERR, VHOST_CONFIG, "Unexpected header size read\n");
+		close_msg_fds(msg);
+		return -1;
+	}
 
 	if (msg->size) {
 		if (msg->size > sizeof(msg->payload)) {
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-17 17:00:16.348690930 +0000
+++ 0037-vhost-check-message-header-size-read.patch	2020-02-17 17:00:15.355951135 +0000
@@ -1,8 +1,10 @@
-From 966f89d998a20eddb45666f06dd42a3c3fc94574 Mon Sep 17 00:00:00 2001
+From 86ad179c5b1de7c352d65d6bd4e14294a26ba10b Mon Sep 17 00:00:00 2001
 From: Maxime Coquelin <maxime.coquelin@redhat.com>
 Date: Wed, 5 Feb 2020 16:05:29 +0100
 Subject: [PATCH] vhost: check message header size read
 
+[ upstream commit 966f89d998a20eddb45666f06dd42a3c3fc94574 ]
+
 This patch adds a check to ensure the read size of
 the Vhost-user message header is not smaller than
 the expected size.
@@ -12,7 +14,6 @@
 if any.
 
 Fixes: 8f972312b8f4 ("vhost: support vhost-user")
-Cc: stable@dpdk.org
 
 Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
 Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
@@ -22,7 +23,7 @@
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
-index 9f14ea6676..91482ccd67 100644
+index 4312e5e536..d224932dda 100644
 --- a/lib/librte_vhost/vhost_user.c
 +++ b/lib/librte_vhost/vhost_user.c
 @@ -2456,8 +2456,13 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg)
@@ -33,7 +34,7 @@
 +	if (ret <= 0) {
  		return ret;
 +	} else if (ret != VHOST_USER_HDR_SIZE) {
-+		VHOST_LOG_CONFIG(ERR, "Unexpected header size read\n");
++		RTE_LOG(ERR, VHOST_CONFIG, "Unexpected header size read\n");
 +		close_msg_fds(msg);
 +		return -1;
 +	}