Re: [PATCH] nbd: fix uaf in nbd_open
- To: Li Lingfeng <lilingfeng@huaweicloud.com>
- Cc: josef@toxicpanda.com, linux-kernel@vger.kernel.org, hch@lst.de, linux-block@vger.kernel.org, nbd@other.debian.org, axboe@kernel.dk, chaitanya.kulkarni@wdc.com, yukuai1@huaweicloud.com, houtao1@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com, lilingfeng3@huawei.com
- Subject: Re: [PATCH] nbd: fix uaf in nbd_open
- From: Christoph Hellwig <hch@lst.de>
- Date: Fri, 3 Nov 2023 09:12:51 +0100
- Message-id: <[🔎] 20231103081251.GB16854@lst.de>
- In-reply-to: <20231103101334.1750094-1-lilingfeng@huaweicloud.com>
- References: <20231103101334.1750094-1-lilingfeng@huaweicloud.com>
On Fri, Nov 03, 2023 at 06:13:34PM +0800, Li Lingfeng wrote:
> From: Li Lingfeng <lilingfeng3@huawei.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.
I don't think this is the right fix. nbd needs to move to ->free_disk
to free it's private data.
Reply to: