patches for DPDK stable branches
 help / color / mirror / Atom feed
From: christian.ehrhardt@canonical.com
To: David Marchand <david.marchand@redhat.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: patch 'vhost: fix FD leak with inflight messages' has been queued to stable release 19.11.12
Date: Thu, 17 Mar 2022 15:17:40 +0100	[thread overview]
Message-ID: <20220317141747.1955930-2-christian.ehrhardt@canonical.com> (raw)
In-Reply-To: <20220317141747.1955930-1-christian.ehrhardt@canonical.com>

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/b7979d39ef4d6ad0d78bd66e07168401391c34fa

Thanks.

Christian Ehrhardt <christian.ehrhardt@canonical.com>

---
From b7979d39ef4d6ad0d78bd66e07168401391c34fa Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Tue, 18 Jan 2022 15:53:30 +0100
Subject: [PATCH] vhost: fix FD leak with inflight messages

[ upstream commit af74f7db384ed149fe42b21dbd7975f8a54ef227 ]

Even if unlikely, a buggy vhost-user master might attach fds to inflight
messages. Add checks like for other types of vhost-user messages.

Fixes: d87f1a1cb7b6 ("vhost: support inflight info sharing")
Cc: stable@dpdk.org
---
 lib/librte_vhost/vhost_user.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 79be132c43..af44d1e69c 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1441,6 +1441,9 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,
 	int fd, i, j;
 	void *addr;
 
+	if (validate_msg_fds(msg, 0) != 0)
+		return RTE_VHOST_MSG_RESULT_ERR;
+
 	if (msg->size != sizeof(msg->payload.inflight)) {
 		RTE_LOG(ERR, VHOST_CONFIG,
 			"invalid get_inflight_fd message size is %d\n",
@@ -1534,6 +1537,9 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,
 	void *addr;
 	int fd, i;
 
+	if (validate_msg_fds(msg, 1) != 0)
+		return RTE_VHOST_MSG_RESULT_ERR;
+
 	fd = msg->fds[0];
 	if (msg->size != sizeof(msg->payload.inflight) || fd < 0) {
 		RTE_LOG(ERR, VHOST_CONFIG,
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-17 14:33:42.001555424 +0100
+++ 0002-vhost-fix-FD-leak-with-inflight-messages.patch	2022-03-17 14:33:41.836622877 +0100
@@ -1 +1 @@
-From af74f7db384ed149fe42b21dbd7975f8a54ef227 Mon Sep 17 00:00:00 2001
+From b7979d39ef4d6ad0d78bd66e07168401391c34fa Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit af74f7db384ed149fe42b21dbd7975f8a54ef227 ]
+
@@ -11,3 +12,0 @@
-
-Signed-off-by: David Marchand <david.marchand@redhat.com>
-Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
@@ -15 +14 @@
- lib/vhost/vhost_user.c | 6 ++++++
+ lib/librte_vhost/vhost_user.c | 6 ++++++
@@ -18,6 +17,6 @@
-diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
-index 1ec4357bee..1d390677fa 100644
---- a/lib/vhost/vhost_user.c
-+++ b/lib/vhost/vhost_user.c
-@@ -1602,6 +1602,9 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,
- 	int numa_node = SOCKET_ID_ANY;
+diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
+index 79be132c43..af44d1e69c 100644
+--- a/lib/librte_vhost/vhost_user.c
++++ b/lib/librte_vhost/vhost_user.c
+@@ -1441,6 +1441,9 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev,
+ 	int fd, i, j;
@@ -26 +25 @@
-+	if (validate_msg_fds(dev, ctx, 0) != 0)
++	if (validate_msg_fds(msg, 0) != 0)
@@ -29,4 +28,5 @@
- 	if (ctx->msg.size != sizeof(ctx->msg.payload.inflight)) {
- 		VHOST_LOG_CONFIG(ERR, "(%s) invalid get_inflight_fd message size is %d\n",
- 			dev->ifname, ctx->msg.size);
-@@ -1699,6 +1702,9 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
+ 	if (msg->size != sizeof(msg->payload.inflight)) {
+ 		RTE_LOG(ERR, VHOST_CONFIG,
+ 			"invalid get_inflight_fd message size is %d\n",
+@@ -1534,6 +1537,9 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg,
+ 	void *addr;
@@ -34 +33,0 @@
- 	int numa_node = SOCKET_ID_ANY;
@@ -36 +35 @@
-+	if (validate_msg_fds(dev, ctx, 1) != 0)
++	if (validate_msg_fds(msg, 1) != 0)
@@ -39,3 +38,3 @@
- 	fd = ctx->fds[0];
- 	if (ctx->msg.size != sizeof(ctx->msg.payload.inflight) || fd < 0) {
- 		VHOST_LOG_CONFIG(ERR, "(%s) invalid set_inflight_fd message size is %d,fd is %d\n",
+ 	fd = msg->fds[0];
+ 	if (msg->size != sizeof(msg->payload.inflight) || fd < 0) {
+ 		RTE_LOG(ERR, VHOST_CONFIG,

  reply	other threads:[~2022-03-17 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 14:17 patch 'vhost: fix queue number check when setting inflight FD' " christian.ehrhardt
2022-03-17 14:17 ` christian.ehrhardt [this message]
2022-03-17 14:17 ` patch 'app/testpmd: fix show RSS RETA on Windows' " christian.ehrhardt
2022-03-17 14:17 ` patch 'examples/l3fwd: fix buffer overflow in Tx' " christian.ehrhardt
2022-03-17 14:17 ` patch 'eal/freebsd: add missing C++ include guards' " christian.ehrhardt
2022-03-17 14:17 ` patch 'compressdev: fix missing space in log macro' " christian.ehrhardt
2022-03-17 14:17 ` patch 'cryptodev: fix clang C++ include' " christian.ehrhardt
2022-03-17 14:17 ` patch 'raw/ifpga: fix build with optimization' " christian.ehrhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220317141747.1955930-2-christian.ehrhardt@canonical.com \
    --to=christian.ehrhardt@canonical.com \
    --cc=david.marchand@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).