From: James Smart Date: Tue, 19 Sep 2017 23:33:56 +0000 (-0700) Subject: nvmet-fc: ensure target queue id within range. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c319d3a144d4b8f1ea2047fd614d2149b68f889;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nvmet-fc: ensure target queue id within range. When searching for queue id's ensure they are within the expected range. Signed-off-by: James Smart Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 6850672ad2a2..58e010bdda3e 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -783,6 +783,9 @@ nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport, u16 qid = nvmet_fc_getqueueid(connection_id); unsigned long flags; + if (qid > NVMET_NR_QUEUES) + return NULL; + spin_lock_irqsave(&tgtport->lock, flags); list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { if (association_id == assoc->association_id) {