Commit ca121a0f authored by Daniel Wagner's avatar Daniel Wagner Committed by Keith Busch
Browse files

nvmet-fc: hold reference on hostport match



The hostport data structure is shared between the association, this why
we keep track of the users via a refcount. So we should not decrement
the refcount on a match and free the hostport several times.

Reported by KASAN.

Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDaniel Wagner <dwagner@suse.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent c5e27b1a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1068,8 +1068,6 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
		/* new allocation not needed */
		kfree(newhost);
		newhost = match;
		/* no new allocation - release reference */
		nvmet_fc_tgtport_put(tgtport);
	} else {
		newhost->tgtport = tgtport;
		newhost->hosthandle = hosthandle;