[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207212337.2351-31-sashal@kernel.org>
Date: Wed, 7 Feb 2024 16:23:17 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Daniel Wagner <dwagner@...e.de>,
Hannes Reinecke <hare@...e.de>,
Christoph Hellwig <hch@....de>,
Keith Busch <kbusch@...nel.org>,
Sasha Levin <sashal@...nel.org>,
james.smart@...adcom.com,
sagi@...mberg.me,
kch@...dia.com,
linux-nvme@...ts.infradead.org
Subject: [PATCH AUTOSEL 6.6 31/38] nvmet-fc: hold reference on hostport match
From: Daniel Wagner <dwagner@...e.de>
[ 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@...e.de>
Reviewed-by: Christoph Hellwig <hch@....de>
Signed-off-by: Daniel Wagner <dwagner@...e.de>
Signed-off-by: Keith Busch <kbusch@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/nvme/target/fc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index c9ef642313c8..64c26b703860 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1069,8 +1069,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;
--
2.43.0
Powered by blists - more mailing lists