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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);