nvmet-fc: fix missing check for no hostport struct
Subsystems (3)
PATCH 1/1 nvmet-fc: fix missing check for no hostport struct
A hostport port pointer is allowed to be NULL as it is not allocated if the lldd does not support the new interfaces for NVME LS request support. The hostport free routine validates the handle but forgot to validate the hostport pointer.
Validate the hostport pointer before using it to validate the handle.
--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fc.c +1 -1
@@ -1019,7 +1019,7 @@ static void nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport) {/* if LLDD not implemented, leave as NULL */ -if (!hostport->hosthandle) +if (!hostport || !hostport->hosthandle)return ;nvmet_fc_hostport_put (hostport);
Signature · 1 line
2.26.2
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 27 lines · James Smart
A hostport port pointer is allowed to be NULL as it is not allocated if the lldd does not support the new interfaces for NVME LS request support. The hostport free routine validates the handle but forgot to validate the hostport pointer.
Validate the hostport pointer before using it to validate the handle.
Signed-off-by James Smart <[email protected]>--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/target/fc.c +1
-1@@ -1019,7 +1019,7 @@ static void nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport) {/* if LLDD not implemented, leave as NULL */ -if (!hostport->hosthandle) +if (!hostport || !hostport->hosthandle)return ;nvmet_fc_hostport_put (hostport);
Quoted 5 lines
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Looks fine.
Signature · 6 lines
Himanshu Madhani Oracle Linux Engineering _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
AppliedThanks,
applied to nvme-5.10.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme