[an error occurred while processing this directive]
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: <20211015233028.2167651-6-mcgrof@kernel.org>
Date:   Fri, 15 Oct 2021 16:30:24 -0700
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     axboe@...nel.dk, jejb@...ux.ibm.com, martin.petersen@...cle.com,
        agk@...hat.com, snitzer@...hat.com, colyli@...e.de,
        kent.overstreet@...il.com, boris.ostrovsky@...cle.com,
        jgross@...e.com, sstabellini@...nel.org, roger.pau@...rix.com,
        geert@...ux-m68k.org, ulf.hansson@...aro.org, tj@...nel.org,
        hare@...e.de, jdike@...toit.com, richard@....at,
        anton.ivanov@...bridgegreys.com, johannes.berg@...el.com,
        krisman@...labora.com, chris.obbard@...labora.com,
        thehajime@...il.com, zhuyifei1999@...il.com, haris.iqbal@...os.com,
        jinpu.wang@...os.com, miquel.raynal@...tlin.com, vigneshr@...com,
        linux-mtd@...ts.infradead.org
Cc:     linux-scsi@...r.kernel.org, dm-devel@...hat.com,
        linux-bcache@...r.kernel.org, xen-devel@...ts.xenproject.org,
        linux-m68k@...ts.linux-m68k.org, linux-um@...ts.infradead.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 5/9] xen-blkfront: add error handling support for add_disk()

We never checked for errors on device_add_disk() as this function
returned void. Now that this is fixed, use the shiny new error
handling. The function xlvbd_alloc_gendisk() typically does the
unwinding on error on allocating the disk and creating the tag,
but since all that error handling was stuffed inside
xlvbd_alloc_gendisk() we must repeat the tag free'ing as well.

We set the info->rq to NULL to ensure blkif_free() doesn't crash
on blk_mq_stop_hw_queues() on device_add_disk() error as the queue
will be long gone by then.

Reviewed-by: Juergen Gross <jgross@...e.com>
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
 drivers/block/xen-blkfront.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index df0deb927760..8e3983e456f3 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2386,7 +2386,13 @@ static void blkfront_connect(struct blkfront_info *info)
 	for_each_rinfo(info, rinfo, i)
 		kick_pending_request_queues(rinfo);
 
-	device_add_disk(&info->xbdev->dev, info->gd, NULL);
+	err = device_add_disk(&info->xbdev->dev, info->gd, NULL);
+	if (err) {
+		blk_cleanup_disk(info->gd);
+		blk_mq_free_tag_set(&info->tag_set);
+		info->rq = NULL;
+		goto fail;
+	}
 
 	info->is_ready = 1;
 	return;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ