mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
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: Hannes Reinecke <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Daniel Wagner <[email protected]> Signed-off-by: Keith Busch <[email protected]>
This commit is contained in:
committed by
Keith Busch
parent
c5e27b1a77
commit
ca121a0f75
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user