From: Christoph Hellwig Date: Mon, 26 Jun 2017 10:39:04 +0000 (+0200) Subject: nvme-fabrics: verify that a controller returns the correct NQN X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b1465c63449cf79295164061193cb645974da53c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nvme-fabrics: verify that a controller returns the correct NQN Signed-off-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Johannes Thumshirn Signed-off-by: Sagi Grimberg Signed-off-by: Jens Axboe --- 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;