summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGopal Tiwari <gtiwari@redhat.com>2021-04-14 14:16:45 +0530
committerChristoph Hellwig <hch@lst.de>2021-04-15 08:12:56 +0200
commitd6609084b0b81abc74dc9db0281cdd0e074df5d4 (patch)
tree906f915778d6faa537133a5877af207bf5b74518
parenta9e0e6bc728ebcfe9f6acdca84e5c6cafee895cf (diff)
nvme: fix NULL derefence in nvme_ctrl_fast_io_fail_tmo_show/store
Adding entry for dev_attr_fast_io_fail_tmo to avoid the kernel crash while reading and writing the fast_io_fail_tmo. Fixes: 09fbed636382 (nvme: export fast_io_fail_tmo to sysfs) Signed-off-by: Gopal Tiwari <gtiwari@redhat.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 288ac47ff5b4..40f08e6325ef 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3379,6 +3379,8 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
return 0;
if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts)
return 0;
+ if (a == &dev_attr_fast_io_fail_tmo.attr && !ctrl->opts)
+ return 0;
return a->mode;
}