mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
nvme: fix a crash in nvme_mpath_add_disk
[ Upstream commit72d447113b] For private namespaces ns->head_disk is NULL, so add a NULL check before updating the BDI capabilities. Fixes:b2ce4d9069("nvme-multipath: set bdi capabilities once") Reported-by: Avinash M N <Avinash.M.N@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c64141c68f
commit
cd62eeb315
@@ -673,10 +673,11 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)
|
||||
}
|
||||
|
||||
if (bdi_cap_stable_pages_required(ns->queue->backing_dev_info)) {
|
||||
struct backing_dev_info *info =
|
||||
ns->head->disk->queue->backing_dev_info;
|
||||
struct gendisk *disk = ns->head->disk;
|
||||
|
||||
info->capabilities |= BDI_CAP_STABLE_WRITES;
|
||||
if (disk)
|
||||
disk->queue->backing_dev_info->capabilities |=
|
||||
BDI_CAP_STABLE_WRITES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user