nvme-fabrics: ignore invalid fast_io_fail_tmo values
authorMaurizio Lombardi <mlombard@redhat.com>
Fri, 12 Nov 2021 14:16:12 +0000 (15:16 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 23 Nov 2021 16:22:41 +0000 (17:22 +0100)
Valid fast_io_fail_tmo values are integers >= 0 or -1 (disabled).
Prevent userspace from setting arbitrary negative values.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fabrics.c

index c5a2b71..282d541 100644 (file)
@@ -698,6 +698,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
                        if (token >= 0)
                                pr_warn("I/O fail on reconnect controller after %d sec\n",
                                        token);
+                       else
+                               token = -1;
+
                        opts->fast_io_fail_tmo = token;
                        break;
                case NVMF_OPT_HOSTNQN: