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 E95E0A0C47; Mon, 26 Jul 2021 09:58:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F98940F35; Mon, 26 Jul 2021 09:58:26 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 337DF40DDA for ; Mon, 26 Jul 2021 09:58:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627286304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yQl25RQ+hI1WxX7JODumiENqsvijBCNmEQL+ZyyTpiA=; b=OSjGvHi1Oe9+gzWO4zFZh9FO6+gul+J4Fv75Txcqvc+k8huhc26NHW4czs9dIqW2ajQiSR OfnX/d1vYUjVUrG5pKzGSjeNb0YcQTIHZtAL0HKroeag9TP8zJ84+QS8DwsUFqcHgPE3ld AyW03WvBXJ6DgFqfYzaUNRb3W33xbB4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-266-Woif-Yn4NEiYj89-VUFH4Q-1; Mon, 26 Jul 2021 03:58:23 -0400 X-MC-Unique: Woif-Yn4NEiYj89-VUFH4Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2E8F101C8A9; Mon, 26 Jul 2021 07:58:21 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37C3F5C1CF; Mon, 26 Jul 2021 07:58:17 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, yinan.wang@intel.com, weix.ling@intel.com Cc: Maxime Coquelin , stable@dpdk.org Date: Mon, 26 Jul 2021 09:58:14 +0200 Message-Id: <20210726075814.287469-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH] vhost: fix crash on reconnect X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When the vhost-user frontend like Virtio-user tries to reconnect to the restarted Vhost backend, the Vhost backend segfaults when multiqueue is enabled. This is caused by VHOST_USER_GET_VRING_BASE being called for a virtqueue that has not been created before, causing a NULL pointer dereferencing. This patch adds the VHOST_USER_GET_VRING_BASE requests to the list of requests that trigger queue pair allocations. Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation") Cc: stable@dpdk.org Reported-by: Yinan Wang Signed-off-by: Maxime Coquelin --- lib/vhost/vhost_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 433f412fa8..29a4c9af60 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2796,6 +2796,7 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, break; case VHOST_USER_SET_VRING_NUM: case VHOST_USER_SET_VRING_BASE: + case VHOST_USER_GET_VRING_BASE: case VHOST_USER_SET_VRING_ENABLE: vring_idx = msg->payload.state.index; break; -- 2.31.1