From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384404; b=38rUrJLxcT2yhAaiMUmYe05vSY7WVlcWehj2v/MQ/fO/P2svmU23vmeSsjZE7o1VUwtX oBALrqsxIdb4tkrPxf4YXNbIaUkKikngtJpRTL5XeqtpDd13pdK+jkQlmLjqE06L9Ymcn Qamu1AmhaPU9tRa98GTqJcpRNe1C+XI9f9WuVo0Yugcww9neAvBibkKne8uvsyz7e78hv p/KIXGqZMzvvu85l8dMuZX+e427bt1hAGs2Hi7uROwJCpa3tbUs+VGHdJxO79dKxT7T09 NXEI/GuAsE48ZulqBVVckZsQPiAJSZy1bLStzA8rlbISVgzBWEnRkMYBTsJsmctjaxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384404; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Y08durELhEGdXg3s954dOvPIcDk/n0MorNjD/zY6lCI=; b=qRvAh7BGOxQDloY8qAAxgG1Vp94FDMv/ZSVQnz/YjNvDD8M+gPEuGkDHjrgOVRt45wwj TreIf89sD/ElevV53c6F6ziRkeIxYSXSk6WwYyac3aBWkfsKwsBZn7tnPZceY+3F1EoiZ JvCXeHMYNOB15Mcs1fB0tLVxb4XzYYuDweXDxcR1GBh1jMfo/LIrkhvhwq0YqfsZkFZVm JZWxwvsdAclE8AicIrOljHiFy9Yhn8mLl8l3jCjXffp3WcvJ6EYhTC+16xaCN9H0kqY7C /dv0RM1k8lD9sLVbtZPXlSWcZ/6N7NI1h+C/FLl76N2ViXiTYKBv+lhjohTNoPSL80A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=G56VRJ3a; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B900A606A322; Fri, 4 Dec 2026 11:40:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=G56VRJ3a Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDAC1F000C2; Fri, 4 Dec 2026 11:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384404; bh=Y08durELhEGdXg3s954dOvPIcDk/n0MorNjD/zY6lCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G56VRJ3a+4NsebevAQmY8cwKBSkxQ6pEGQUKNpthApa/qg4E4LGnnD3XANnIHXNHL 3UF4J5Rss+FxW/PV6Wfg84c6BZGyfZpoQDUNhF/hoQt9vDgiXs6sX4E24Xll9mvOaY 5bi43vt1JsEMCK0lnGNAizeBEAdV3EdWWl41k99M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linfeng Sun , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 6.6 0134/1167] vhost-vdpa: initialize state before publishing cdev Date: Fri, 4 Dec 2026 18:52:41 +0900 Message-ID: <20261204100705.576799953@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linfeng Sun [ Upstream commit 4b03d1e7f13613af708441a061556de99891a516 ] Initialize the completion and as hash buckets before cdev_device_add() makes the device accessible. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Assisted-by: OpenAI-Codex:GPT-5.6 Signed-off-by: Linfeng Sun Signed-off-by: Michael S. Tsirkin Message-ID: <20261011-fix-null-pointer-in-vhost_vdpa_release-v2-1-66ba929971ce@gmail.com> Signed-off-by: Sasha Levin --- drivers/vhost/vdpa.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index ac0da85b6df81..36e0c8b314593 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1622,7 +1622,7 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa) return minor; } - atomic_set(&v->opened, 0); + atomic_set(&v->opened, 1); spin_lock_init(&v->config_lock); v->minor = minor; v->vdpa = vdpa; @@ -1646,16 +1646,17 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa) cdev_init(&v->cdev, &vhost_vdpa_fops); v->cdev.owner = THIS_MODULE; + init_completion(&v->completion); + for (i = 0; i < VHOST_VDPA_IOTLB_BUCKETS; i++) + INIT_HLIST_HEAD(&v->as[i]); r = cdev_device_add(&v->cdev, &v->dev); if (r) goto err; - init_completion(&v->completion); vdpa_set_drvdata(vdpa, v); - for (i = 0; i < VHOST_VDPA_IOTLB_BUCKETS; i++) - INIT_HLIST_HEAD(&v->as[i]); + atomic_set_release(&v->opened, 0); return 0; -- 2.53.0