nvme: Fix NULL dereference for pci nvme controllers
Sagi Grimberg
maintainerPATCH 1/1 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.
--- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/host/core.c +4 -0
@@ -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; }
Signature · 7 lines
2.25.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 15 lines · Sagi Grimberg
PCIe controllers do not have fabric opts, verify they exist before showing
ctrl_loss_tmoorreconnect_delayattributes.Fixes 764075fdcb2f ("nvme: expose reconnect_delay and ctrl_loss_tmo via sysfs")Reported-by Tobias Markus <[email protected]>Signed-off-by Sagi Grimberg <[email protected]>--- drivers/nvme/host/core.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj, · line 3685
Quoted 10 lines
drivers/nvme/host/core.c +4
-0@@ -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; }
And you'd already fixed up the duplicate line in the real patch.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme