From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 2C5E2FEB; Fri, 17 Aug 2018 13:32:57 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180817113256euoutp01f27acab12dfdacc87fa199476e8e9bbd~LqLEida9C0857108571euoutp01q; Fri, 17 Aug 2018 11:32:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180817113256euoutp01f27acab12dfdacc87fa199476e8e9bbd~LqLEida9C0857108571euoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534505576; bh=vbGAAvy2/dHXUsczNq1lDI+eWfDujLrk97dHfZA17Sg=; h=From:To:Cc:Subject:Date:References:From; b=eyVWkoNUUeTyfyCVmqzhSKsyHtyFcy1YNJXPncvIR5/5WU6RyY9j2bznxpvFeJQC8 ifuSrZ3SfwRRFsxxq57zYRI2AP8PYzKOZMa3+aYFZEt4ObKkWReqFnvn5nMTRD1d/q NLYx242RerEiojQwQo2M6v1XtMYPl4AZaeka+JK4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180817113256eucas1p1827306a2e5a9a495283475f7b99b08f0~LqLEG3BE_2066320663eucas1p1Y; Fri, 17 Aug 2018 11:32:56 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 90.98.04806.862B67B5; Fri, 17 Aug 2018 12:32:56 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180817113255eucas1p2042d22241265dafa241c2a6a2c949244~LqLDd32Eb2998029980eucas1p2Z; Fri, 17 Aug 2018 11:32:55 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-a3-5b76b268fc07 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7F.B4.04128.762B67B5; Fri, 17 Aug 2018 12:32:55 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PDL00533S2RIV40@eusync3.samsung.com>; Fri, 17 Aug 2018 12:32:55 +0100 (BST) From: Ilya Maximets To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Ilya Maximets , stable@dpdk.org Date: Fri, 17 Aug 2018 14:33:54 +0300 Message-id: <20180817113354.16140-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRmVeSWpSXmKPExsWy7djP87oZm8qiDbousli8+7SdyeJK+092 i2Ode1gs/nX8YbfY2vCfyWLzxUlMDmwevxYsZfVYvOclk8f7fVfZPPq2rGIMYInisklJzcks Sy3St0vgypjadY25YANXxYeLL1gaGM9xdDFyckgImEisvPGNvYuRi0NIYAWjxIzzR6Ccz4wS BybfYIKpevWhnw0isYxR4tg2mJZmJokXm94yglSxCehInFp9BMwWERCQ+Ny5GKyDWWAro8SP 6R+YQRLCAk4Su7tnsoLYLAKqEjsn7WHpYuTg4BWwllg4oxJim7zE6g0HmEF6JQQeskpcWrWO HSLhIrF1WjczhC0s8er4Fqi4jMTlyd0sEHa9xP2Wl4wQzR2MEtMP/YP6wV5iy+tzYA3MAnwS k7ZNZwZZLCHAK9HRJgRR4iHxav1TNhBbSCBWYtbth0wTGCUWMDKsYhRPLS3OTU8tNs5LLdcr TswtLs1L10vOz93ECIyr0/+Of93BuO9P0iFGAQ5GJR7eCWtLo4VYE8uKK3MPMUpwMCuJ8EYu L4sW4k1JrKxKLcqPLyrNSS0+xCjNwaIkzsunlRYtJJCeWJKanZpakFoEk2Xi4JRqYLS+qn8k eznrHsGNVszpxsXKHkmrpjfV5d9c+/VgzY0EzS9CL0pn6WWsP1ny9vXEwlsfVjYI7QjedNnU b53dXi7mnbd/1RQ0iVpd7Hx53kmBubalf7WBtSXjsas/p8tcYJe7dfhEsIRVuGieTUDlTdN9 f2WZpSa2LniUxlxx8ffObe68fNqln5VYijMSDbWYi4oTAUxAQOynAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t/xq7rpm8qiDRa8FbN492k7k8WV9p/s Fsc697BY/Ov4w26xteE/k8Xmi5OYHNg8fi1YyuqxeM9LJo/3+66yefRtWcUYwBLFZZOSmpNZ llqkb5fAlTG16xpzwQauig8XX7A0MJ7j6GLk5JAQMJF49aGfrYuRi0NIYAmjxNpdV1ggnFYm iRf3JrGAVLEJ6EicWn2EEcQWERCQ+Ny5GKyDWWAro8SrJU/ZQBLCAk4Su7tnsoLYLAKqEjsn 7QFq5uDgFbCWWDijEmKbvMTqDQeYJzByLWBkWMUoklpanJueW2ykV5yYW1yal66XnJ+7iRHo +23Hfm7Zwdj1LvgQowAHoxIP74S1pdFCrIllxZW5hxglOJiVRHgjl5dFC/GmJFZWpRblxxeV 5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamA8mVVdsObvq3qpL4ZZPMKHfhoI RHtw/FyetiVO9c1P27uHb5XFKd1K9ZbMUdizakGLp2t84eYvf90ULQV/NKd374vI3OdaEDFF Msf2Y6jtxfu1rp/rfaxK/u7mVH2csOz9hpLTfpvlem4oP5y4NMBhfZ9p0eU/BxK+M7T+T24o aZ297f56bWslluKMREMt5qLiRAC5JLdD+QEAAA== X-CMS-MailID: 20180817113255eucas1p2042d22241265dafa241c2a6a2c949244 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180817113255eucas1p2042d22241265dafa241c2a6a2c949244 References: Subject: [dpdk-dev] [PATCH] vhost: fix crash if set vring num handling failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 11:32:58 -0000 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 --- 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