diff options
author | Christoph Hellwig <hch@lst.de> | 2017-06-26 12:39:04 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-28 08:14:13 -0600 |
commit | b1465c63449cf79295164061193cb645974da53c (patch) | |
tree | ca0142d1368221f650e199a7d1c39fc3d2ca33ae /drivers/nvme/host/fabrics.c | |
parent | 49d3d50b0d4eb0c86c1dae864586f1b26ccd1f5b (diff) | |
download | linux-b1465c63449cf79295164061193cb645974da53c.tar.bz2 |
nvme-fabrics: verify that a controller returns the correct NQN
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/host/fabrics.c')
-rw-r--r-- | drivers/nvme/host/fabrics.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 7996e95383d4..2e582a240943 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -872,6 +872,15 @@ nvmf_create_ctrl(struct device *dev, const char *buf, size_t count) goto out_unlock; } + if (strcmp(ctrl->subnqn, opts->subsysnqn)) { + dev_warn(ctrl->device, + "controller returned incorrect NQN: \"%s\".\n", + ctrl->subnqn); + mutex_unlock(&nvmf_transports_mutex); + ctrl->ops->delete_ctrl(ctrl); + return ERR_PTR(-EINVAL); + } + mutex_unlock(&nvmf_transports_mutex); return ctrl; |