OSDN Git Service

nvmet-fc: ensure target queue id within range.
authorJames Smart <jsmart2021@gmail.com>
Tue, 19 Sep 2017 23:33:56 +0000 (16:33 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Sep 2017 18:42:11 +0000 (12:42 -0600)
When searching for queue id's ensure they are within the expected range.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/fc.c

index 6850672..58e010b 100644 (file)
@@ -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) {