lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517093428.670-11-xieyongji@bytedance.com>
Date:   Mon, 17 May 2021 17:34:23 +0800
From:   Xie Yongji <xieyongji@...edance.com>
To:     mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc:     amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
        kraxel@...hat.com, jean-philippe@...aro.org, ohad@...ery.com,
        bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
        miklos@...redi.hu, lucho@...kov.net, asmadeus@...ewreck.org,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: [RFC PATCH 10/15] virtio: Handle virtio_device_ready() failure

Now virtio_device_ready() will return error if we get
invalid status. Let's handle this case in virtio_dev_probe().

Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
 drivers/virtio/virtio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 4b15c00c0a0a..ff16e1cce2e7 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -263,8 +263,11 @@ static int virtio_dev_probe(struct device *_d)
 		goto err;
 
 	/* If probe didn't do it, mark device DRIVER_OK ourselves. */
-	if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK))
-		virtio_device_ready(dev);
+	if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK)) {
+		err = virtio_device_ready(dev);
+		if (err)
+			goto err_ready;
+	}
 
 	if (drv->scan)
 		drv->scan(dev);
@@ -272,6 +275,8 @@ static int virtio_dev_probe(struct device *_d)
 	virtio_config_enable(dev);
 
 	return 0;
+err_ready:
+	drv->remove(dev);
 err:
 	virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
 	return err;
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ