diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2020-08-25 00:47:25 +0200 |
---|---|---|
committer | Sagi Grimberg <sagi@grimberg.me> | 2020-08-29 01:43:57 +0200 |
commit | 7cd49f7576b0c61d6c4a2114cda08cc4d5ce0028 (patch) | |
tree | 04328e20c827376ef48ffded91e6938f4cd6f35a /drivers/nvme | |
parent | nvme-rdma: fix reset hang if controller died in the middle of a reset (diff) | |
download | linux-7cd49f7576b0c61d6c4a2114cda08cc4d5ce0028.tar.xz linux-7cd49f7576b0c61d6c4a2114cda08cc4d5ce0028.zip |
nvme: Fix NULL dereference for pci nvme controllers
PCIe controllers do not have fabric opts, verify they exist before
showing ctrl_loss_tmo or reconnect_delay attributes.
Fixes: 764075fdcb2f ("nvme: expose reconnect_delay and ctrl_loss_tmo via sysfs")
Reported-by: Tobias Markus <tobias@markus-regensburg.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 537dcd900cb5..e406c3cf55bc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3676,6 +3676,10 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj, return 0; if (a == &dev_attr_hostid.attr && !ctrl->opts) return 0; + if (a == &dev_attr_ctrl_loss_tmo.attr && !ctrl->opts) + return 0; + if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts) + return 0; return a->mode; } |