]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nvme: pad fake subsys NQN vid and ssvid with zeros
authorKeith Busch <keith.busch@intel.com>
Thu, 17 Jan 2019 08:31:08 +0000 (16:31 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Feb 2019 04:53:01 +0000 (04:53 +0000)
BugLink: https://bugs.launchpad.net/bugs/1811755
We need to preserve the leading zeros in the vid and ssvid when generating
a unique NQN. Truncating these may lead to naming collisions.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit 3da584f57133e51aeb84aaefae5e3d69531a1e4f)
Signed-off-by: Anthony Wong <anthony.wong@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/nvme/host/core.c

index cafa24fe30f847a9bf39f3eee278348176bfd58c..8ee81494da912d96a021e16e9456ddfab1c10379 100644 (file)
@@ -1952,7 +1952,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
 
        /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
        off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
-                       "nqn.2014.08.org.nvmexpress:%4x%4x",
+                       "nqn.2014.08.org.nvmexpress:%04x%04x",
                        le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
        memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn));
        off += sizeof(id->sn);