[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200630122923.70282-1-mheyne@amazon.de>
Date: Tue, 30 Jun 2020 12:29:23 +0000
From: Maximilian Heyne <mheyne@...zon.de>
To: unlisted-recipients:; (no To-header on input)
CC: Amit Shah <aams@...zon.de>, Maximilian Heyne <mheyne@...zon.de>,
<stable@...r.kernel.org>, Keith Busch <kbusch@...nel.org>,
Jens Axboe <axboe@...com>, Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
<linux-nvme@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] nvme: validate cntlid's only for nvme >= 1.1.0
Controller ID's (cntlid) for NVMe devices were introduced in version
1.1.0 of the specification. Controllers that follow the older 1.0.0 spec
don't set this field so it doesn't make sense to validate it. On the
contrary, when using SR-IOV this check breaks VFs as they are all part
of the same NVMe subsystem.
Signed-off-by: Maximilian Heyne <mheyne@...zon.de>
Cc: <stable@...r.kernel.org> # 5.4+
---
drivers/nvme/host/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 28f4388c1337..c4a991acc949 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2773,7 +2773,8 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
put_device(&subsys->dev);
subsys = found;
- if (!nvme_validate_cntlid(subsys, ctrl, id)) {
+ if (ctrl->vs >= NVME_VS(1, 1, 0) &&
+ !nvme_validate_cntlid(subsys, ctrl, id)) {
ret = -EINVAL;
goto out_put_subsystem;
}
@@ -2883,7 +2884,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
goto out_free;
}
- if (!(ctrl->ops->flags & NVME_F_FABRICS))
+ if (!(ctrl->ops->flags & NVME_F_FABRICS) && ctrl->vs >= NVME_VS(1, 1, 0))
ctrl->cntlid = le16_to_cpu(id->cntlid);
if (!ctrl->identified) {
--
2.16.6
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
Powered by blists - more mailing lists