From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Zhihong Wang <zhihong.wang@intel.com>,
Ilya Maximets <i.maximets@samsung.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH] vhost: fix crash if set vring num handling failed
Date: Fri, 17 Aug 2018 14:33:54 +0300 [thread overview]
Message-ID: <20180817113354.16140-1-i.maximets@samsung.com> (raw)
In-Reply-To: <CGME20180817113255eucas1p2042d22241265dafa241c2a6a2c949244@eucas1p2.samsung.com>
Allocation failures of shadow used ring and batched copy array
are not recoverable and leads to the segmentation faults like
this on the receiving/transmission path:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f913fecf0 (LWP 43625)]
in copy_desc_to_mbuf () at /lib/librte_vhost/virtio_net.c:760
760 batch_copy[vq->batch_copy_nb_elems].dst =
This could be easily reproduced in case of low memory or big
number of vhost-user ports. Fix that by propagating error to
the upper layer which will end up with disconnection.
Fixes: f689586bc060 ("vhost: shadow used ring update")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
lib/librte_vhost/vhost_user.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 9aa1ce118..4c7fd57fb 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1693,7 +1693,9 @@ vhost_user_msg_handler(int vid, int fd)
break;
case VHOST_USER_SET_VRING_NUM:
- vhost_user_set_vring_num(dev, &msg);
+ ret = vhost_user_set_vring_num(dev, &msg);
+ if (ret)
+ return -1;
break;
case VHOST_USER_SET_VRING_ADDR:
vhost_user_set_vring_addr(&dev, &msg);
--
2.17.1
next parent reply other threads:[~2018-08-17 11:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180817113255eucas1p2042d22241265dafa241c2a6a2c949244@eucas1p2.samsung.com>
2018-08-17 11:33 ` Ilya Maximets [this message]
2018-08-29 14:00 ` Ilya Maximets
2018-08-30 6:06 ` Tiwei Bie
2018-08-30 6:54 ` Ilya Maximets
2018-09-03 2:26 ` Tiwei Bie
2018-09-03 7:07 ` Ilya Maximets
[not found] ` <CGME20180903101059eucas1p2030d1e9077a03bc5d0613ba0311e1eab@eucas1p2.samsung.com>
2018-09-03 10:12 ` [dpdk-dev] [PATCH v2] vhost-user: drop connection on message handling failures Ilya Maximets
2018-09-10 13:51 ` Maxime Coquelin
2018-09-11 9:25 ` Maxime Coquelin
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=20180817113354.16140-1-i.maximets@samsung.com \
--to=i.maximets@samsung.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.com \
/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).