From: Gopal Tiwari Date: Wed, 14 Apr 2021 08:46:45 +0000 (+0530) Subject: nvme: fix NULL derefence in nvme_ctrl_fast_io_fail_tmo_show/store X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d6609084b0b81abc74dc9db0281cdd0e074df5d4;p=linux.git 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 Reviewed-by: Keith Busch Signed-off-by: Christoph Hellwig --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 288ac47ff5b47..40f08e6325ef0 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; }