]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvmet: fix invalid memory reference in nvmet_subsys_attr_qid_max_show
authorDaniel Wagner <dwagner@suse.de>
Fri, 7 Oct 2022 07:29:34 +0000 (09:29 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 19 Oct 2022 10:43:13 +0000 (12:43 +0200)
The item passed into nvmet_subsys_attr_qid_max_show is not a member of
struct nvmet_port, it is part of nvmet_subsys.  Hence, don't try to
dereference it as struct nvme_ctrl pointer.

Fixes: 65b1e6817549 ("nvmet: Expose max queues to configfs")
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20220913064203.133536-1-dwagner@suse.de
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/configfs.c

index e34a2896fedb294d8e2269414ed5d0dae8eaafc8..9443ee1d4ae3dd6c367db6a3ca7b24a1b90da15f 100644 (file)
@@ -1290,12 +1290,8 @@ static ssize_t nvmet_subsys_attr_qid_max_show(struct config_item *item,
 static ssize_t nvmet_subsys_attr_qid_max_store(struct config_item *item,
                                               const char *page, size_t cnt)
 {
-       struct nvmet_port *port = to_nvmet_port(item);
        u16 qid_max;
 
-       if (nvmet_is_port_enabled(port, __func__))
-               return -EACCES;
-
        if (sscanf(page, "%hu\n", &qid_max) != 1)
                return -EINVAL;