mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
nvmet-fc: hold reference on hostport match
[ Upstream commit ca121a0f7515591dba0eb5532bfa7ace4dc153ce ] 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: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b833811668
commit
67e2ddf232
@@ -1069,8 +1069,6 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
|
|||||||
/* new allocation not needed */
|
/* new allocation not needed */
|
||||||
kfree(newhost);
|
kfree(newhost);
|
||||||
newhost = match;
|
newhost = match;
|
||||||
/* no new allocation - release reference */
|
|
||||||
nvmet_fc_tgtport_put(tgtport);
|
|
||||||
} else {
|
} else {
|
||||||
newhost->tgtport = tgtport;
|
newhost->tgtport = tgtport;
|
||||||
newhost->hosthandle = hosthandle;
|
newhost->hosthandle = hosthandle;
|
||||||
|
|||||||
Reference in New Issue
Block a user