Commit ddd3d105 authored by James Smart's avatar James Smart Committed by Christoph Hellwig

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.
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5b3356d9
...@@ -1019,7 +1019,7 @@ static void ...@@ -1019,7 +1019,7 @@ static void
nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport) nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport)
{ {
/* if LLDD not implemented, leave as NULL */ /* if LLDD not implemented, leave as NULL */
if (!hostport->hosthandle) if (!hostport || !hostport->hosthandle)
return; return;
nvmet_fc_hostport_put(hostport); nvmet_fc_hostport_put(hostport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment