From bf94fee5c8c4f1783d4e6e0718995ebbdaf840f9 Mon Sep 17 00:00:00 2001 From: Sagi Grimberg Date: Tue, 20 Apr 2021 19:46:45 +0800 Subject: [PATCH] nvme: fix incorrect behavior when BLKROSET is called by the user mainline inclusion from mainline-5.10 commit 65c5a055b0d567b7e7639d942c0605da9cc54c5e category: bugfix bugzilla: NA CVE: NA ------------------------------------------------- The offending commit breaks BLKROSET ioctl because a device revalidation will blindly override BLKROSET setting. Hence, we remove the disk rw setting in case NVME_NS_ATTR_RO is cleared from by the controller. Fixes: 1293477f4f32 ("nvme: set gendisk read only based on nsattr") Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Wenchao Hao Reviewed-by: Miaohe Lin Signed-off-by: Yang Yingliang --- drivers/nvme/host/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 882a87abf3f0..a389a6297b49 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1682,8 +1682,6 @@ static void nvme_update_disk_info(struct gendisk *disk, if (id->nsattr & (1 << 0)) set_disk_ro(disk, true); - else - set_disk_ro(disk, false); blk_mq_unfreeze_queue(disk->queue); } -- GitLab