From patchwork Tue Nov 29 16:06:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13058718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 947E6C4167B for ; Tue, 29 Nov 2022 15:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235869AbiK2PS5 (ORCPT ); Tue, 29 Nov 2022 10:18:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235705AbiK2PSY (ORCPT ); Tue, 29 Nov 2022 10:18:24 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24A2E2EF4F; Tue, 29 Nov 2022 07:18:22 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NM5Yb6d5xzmWHl; Tue, 29 Nov 2022 23:17:39 +0800 (CST) Received: from huawei.com (10.67.175.21) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 23:18:18 +0800 From: Li Zetao To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 1/5] 9p: Fix probe failed when modprobe 9pnet_virtio Date: Wed, 30 Nov 2022 00:06:11 +0800 Message-ID: <20221129160615.3343036-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> References: <20221128021005.232105-1-lizetao1@huawei.com> <20221129160615.3343036-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.21] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When doing the following test steps, an error was found: step 1: modprobe 9pnet_virtio succeeded # modprobe 9pnet_virtio <-- OK step 2: fault injection in sysfs_create_file() # modprobe -r 9pnet_virtio <-- OK # ... FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 3790 Comm: modprobe Tainted: G W 6.1.0-rc6-00285-g6a1e40c4b995-dirty #108 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: ... should_failslab+0xa/0x20 ... sysfs_create_file_ns+0x130/0x1d0 p9_virtio_probe+0x662/0xb30 [9pnet_virtio] virtio_dev_probe+0x608/0xae0 ... 9pnet_virtio: probe of virtio3 failed with error -12 step 3: modprobe 9pnet_virtio failed # modprobe 9pnet_virtio <-- failed 9pnet_virtio: probe of virtio3 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when sysfs_create_file() fails in p9_virtio_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtio_find_single_vq() succeeded, all virtqueues should be stopped on error handling path. Fixes: ea52bf8eda98 ("9p/trans_virtio: reset virtio device on remove") Signed-off-by: Li Zetao Reviewed-by: Christian Schoenebeck --- v1 -> v2: modify the description error of the test case in step 3 and modify the fixes tag information. net/9p/trans_virtio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index e757f0601304..39933187284b 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -668,6 +668,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) out_free_tag: kfree(tag); out_free_vq: + virtio_reset_device(vdev); vdev->config->del_vqs(vdev); out_free_chan: kfree(chan); From patchwork Tue Nov 29 16:06:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13058717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B140C433FE for ; Tue, 29 Nov 2022 15:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235819AbiK2PSy (ORCPT ); Tue, 29 Nov 2022 10:18:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235463AbiK2PSZ (ORCPT ); Tue, 29 Nov 2022 10:18:25 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53D0C52895; Tue, 29 Nov 2022 07:18:23 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NM5Yc6XbdzmWL6; Tue, 29 Nov 2022 23:17:40 +0800 (CST) Received: from huawei.com (10.67.175.21) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 23:18:19 +0800 From: Li Zetao To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 2/5] virtio-mem: Fix probe failed when modprobe virtio_mem Date: Wed, 30 Nov 2022 00:06:12 +0800 Message-ID: <20221129160615.3343036-3-lizetao1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> References: <20221128021005.232105-1-lizetao1@huawei.com> <20221129160615.3343036-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.21] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When doing the following test steps, an error was found: step 1: modprobe virtio_mem succeeded # modprobe virtio_mem <-- OK step 2: fault injection in virtio_mem_init() # modprobe -r virtio_mem <-- OK # ... CPU: 0 PID: 1837 Comm: modprobe Not tainted 6.1.0-rc6-00285-g6a1e40c4b995-dirty Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: should_fail.cold+0x5/0x1f ... virtio_mem_init_hotplug+0x9ae/0xe57 [virtio_mem] virtio_mem_init.cold+0x327/0x339 [virtio_mem] virtio_mem_probe+0x48e/0x910 [virtio_mem] virtio_dev_probe+0x608/0xae0 ... virtio_mem virtio4: could not reserve device region virtio_mem: probe of virtio4 failed with error -16 step 3: modprobe virtio_mem failed # modprobe virtio_mem <-- failed virtio_mem: probe of virtio4 failed with error -16 The root cause of the problem is that the virtqueues are not stopped on the error handling path when virtio_mem_init() fails in virtio_mem_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtio_mem_init_vq() succeeded, all virtqueues should be stopped on error handling path. Fixes: 5f1f79bbc9e2 ("virtio-mem: Paravirtualized memory hotplug") Signed-off-by: Li Zetao Reviewed-by: David Hildenbrand --- v1 -> v2: modify the description error of the test case in step 3 and modify the fixes tag information. drivers/virtio/virtio_mem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index 0c2892ec6817..c7f09c2ce982 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -2793,6 +2793,7 @@ static int virtio_mem_probe(struct virtio_device *vdev) return 0; out_del_vq: + virtio_reset_device(vdev); vdev->config->del_vqs(vdev); out_free_vm: kfree(vm); From patchwork Tue Nov 29 16:06:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13058716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61DBCC46467 for ; Tue, 29 Nov 2022 15:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235082AbiK2PSt (ORCPT ); Tue, 29 Nov 2022 10:18:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235824AbiK2PSZ (ORCPT ); Tue, 29 Nov 2022 10:18:25 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E095510BF; Tue, 29 Nov 2022 07:18:23 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NM5Yb4SXdzHwGW; Tue, 29 Nov 2022 23:17:39 +0800 (CST) Received: from huawei.com (10.67.175.21) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 23:18:20 +0800 From: Li Zetao To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 3/5] virtio-input: Fix probe failed when modprobe virtio_input Date: Wed, 30 Nov 2022 00:06:13 +0800 Message-ID: <20221129160615.3343036-4-lizetao1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> References: <20221128021005.232105-1-lizetao1@huawei.com> <20221129160615.3343036-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.21] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When doing the following test steps, an error was found: step 1: modprobe virtio_input succeeded # modprobe virtio_input <-- OK step 2: fault injection in input_allocate_device() # modprobe -r virtio_input <-- OK # ... CPU: 0 PID: 4260 Comm: modprobe Tainted: G W 6.1.0-rc6-00285-g6a1e40c4b995-dirty #109 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), Call Trace: should_fail.cold+0x5/0x1f ... kmalloc_trace+0x27/0xa0 input_allocate_device+0x43/0x280 virtinput_probe+0x23b/0x1648 [virtio_input] ... virtio_input: probe of virtio5 failed with error -12 step 3: modprobe virtio_input failed # modprobe virtio_input <-- failed virtio_input: probe of virtio1 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when input_allocate_device() fails in virtinput_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtinput_init_vqs() succeeded, all virtqueues should be stopped on error handling path. Fixes: 271c865161c5 ("Add virtio-input driver.") Signed-off-by: Li Zetao --- v1 -> v2: modify the description error of the test case in step 3 and modify the fixes tag information. drivers/virtio/virtio_input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c index 3aa46703872d..f638f1cd3531 100644 --- a/drivers/virtio/virtio_input.c +++ b/drivers/virtio/virtio_input.c @@ -330,6 +330,7 @@ static int virtinput_probe(struct virtio_device *vdev) err_mt_init_slots: input_free_device(vi->idev); err_input_alloc: + virtio_reset_device(vdev); vdev->config->del_vqs(vdev); err_init_vq: kfree(vi); From patchwork Tue Nov 29 16:06:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13058719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3106DC433FE for ; Tue, 29 Nov 2022 15:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235891AbiK2PTI (ORCPT ); Tue, 29 Nov 2022 10:19:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbiK2PS1 (ORCPT ); Tue, 29 Nov 2022 10:18:27 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0493A1F629; Tue, 29 Nov 2022 07:18:24 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NM5Yg4n79z15Mgf; Tue, 29 Nov 2022 23:17:43 +0800 (CST) Received: from huawei.com (10.67.175.21) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 23:18:21 +0800 From: Li Zetao To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 4/5] virtio-blk: Fix probe failed when modprobe virtio_blk Date: Wed, 30 Nov 2022 00:06:14 +0800 Message-ID: <20221129160615.3343036-5-lizetao1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> References: <20221128021005.232105-1-lizetao1@huawei.com> <20221129160615.3343036-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.21] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When doing the following test steps, an error was found: step 1: modprobe virtio_blk succeeded # modprobe virtio_blk <-- OK step 2: fault injection in __blk_mq_alloc_disk() # modprobe -r virtio_blk <-- OK # ... CPU: 0 PID: 4578 Comm: modprobe Tainted: G W 6.1.0-rc6-00308-g644e9524388a-dirty Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), Call Trace: should_failslab+0xa/0x20 ... blk_alloc_queue+0x3a4/0x780 __blk_mq_alloc_disk+0x91/0x1f0 virtblk_probe+0x6ff/0x1f20 [virtio_blk] ... virtio_blk: probe of virtio1 failed with error -12 step 3: modprobe virtio_blk failed # modprobe virtio_blk <-- failed virtio_blk: probe of virtio1 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when __blk_mq_alloc_disk() fails in virtblk_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After init_vq() succeeded, all virtqueues should be stopped on error handling path. Signed-off-by: Li Zetao --- v1 -> v2: modify the description error. drivers/block/virtio_blk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 19da5defd734..f401546d4e85 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1157,6 +1157,7 @@ static int virtblk_probe(struct virtio_device *vdev) put_disk(vblk->disk); out_free_tags: blk_mq_free_tag_set(&vblk->tag_set); + virtio_reset_device(vdev); out_free_vq: vdev->config->del_vqs(vdev); kfree(vblk->vqs); From patchwork Tue Nov 29 16:06:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13058720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29E19C4167B for ; Tue, 29 Nov 2022 15:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235903AbiK2PTZ (ORCPT ); Tue, 29 Nov 2022 10:19:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235587AbiK2PSb (ORCPT ); Tue, 29 Nov 2022 10:18:31 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485CC10C2; Tue, 29 Nov 2022 07:18:27 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NM5Yh4Z1Wz15MyW; Tue, 29 Nov 2022 23:17:44 +0800 (CST) Received: from huawei.com (10.67.175.21) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 23:18:22 +0800 From: Li Zetao To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 5/5] drm/virtio: Fix probe failed when modprobe virtio_gpu Date: Wed, 30 Nov 2022 00:06:15 +0800 Message-ID: <20221129160615.3343036-6-lizetao1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> References: <20221128021005.232105-1-lizetao1@huawei.com> <20221129160615.3343036-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.175.21] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When doing the following test steps, an error was found: step 1: modprobe virtio_gpu succeeded # modprobe virtio_gpu <-- OK step 2: fault injection in virtio_gpu_alloc_vbufs() # modprobe -r virtio_gpu <-- OK # ... CPU: 0 PID: 1714 Comm: modprobe Not tainted 6.1.0-rc7-dirty Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: should_fail_ex.cold+0x1a/0x1f ... kmem_cache_create+0x12/0x20 virtio_gpu_alloc_vbufs+0x2f/0x90 [virtio_gpu] virtio_gpu_init.cold+0x659/0xcad [virtio_gpu] virtio_gpu_probe+0x14f/0x260 [virtio_gpu] virtio_dev_probe+0x608/0xae0 ?... kmem_cache_create_usercopy(virtio-gpu-vbufs) failed with error -12 step 3: modprobe virtio_gpu failed # modprobe virtio_gpu <-- failed failed to find virt queues virtio_gpu: probe of virtio6 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when virtio_gpu_alloc_vbufs() fails in virtio_gpu_init(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtio_find_vqs() succeeded, all virtqueues should be stopped on error handling path. Fixes: dc5698e80cf7 ("Add virtio gpu driver.") Signed-off-by: Li Zetao --- v1 -> v2: patch is new. drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index 27b7f14dae89..1a03e8e13b5b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -255,6 +255,7 @@ int virtio_gpu_init(struct virtio_device *vdev, struct drm_device *dev) err_scanouts: virtio_gpu_free_vbufs(vgdev); err_vbufs: + virtio_reset_device(vgdev->vdev); vgdev->vdev->config->del_vqs(vgdev->vdev); err_vqs: dev->dev_private = NULL;