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-next>] [day] [month] [year] [list]
Message-Id: <20231103101334.1750094-1-lilingfeng@huaweicloud.com>
Date:   Fri,  3 Nov 2023 18:13:34 +0800
From:   Li Lingfeng <lilingfeng@...weicloud.com>
To:     josef@...icpanda.com
Cc:     linux-kernel@...r.kernel.org, hch@....de,
        linux-block@...r.kernel.org, nbd@...er.debian.org, axboe@...nel.dk,
        chaitanya.kulkarni@....com, yukuai1@...weicloud.com,
        houtao1@...wei.com, yi.zhang@...wei.com, yangerkun@...wei.com,
        lilingfeng@...weicloud.com, lilingfeng3@...wei.com
Subject: [PATCH] nbd: fix uaf in nbd_open

From: Li Lingfeng <lilingfeng3@...wei.com>

Commit 4af5f2e03013 ("nbd: use blk_mq_alloc_disk and
blk_cleanup_disk") cleans up disk by blk_cleanup_disk() and it won't set
disk->private_data as NULL as before. UAF may be triggered in nbd_open()
if someone tries to open nbd device right after nbd_put() since refcount
of nbd device is zero and private_data is not NULL.

Fixes: 4af5f2e03013 ("nbd: use blk_mq_alloc_disk and blk_cleanup_disk")
Signed-off-by: Li Lingfeng <lilingfeng3@...wei.com>
---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 800f131222fc..aab93b836e84 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -250,6 +250,7 @@ static void nbd_dev_remove(struct nbd_device *nbd)
 	struct gendisk *disk = nbd->disk;
 
 	del_gendisk(disk);
+	disk->private_data = NULL;
 	put_disk(disk);
 	blk_mq_free_tag_set(&nbd->tag_set);
 
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ