* [PATCH] scsi: target: sbp: Fix memory leak in sbp_management_request_logout()
@ 2022-05-26 1:38 Jianglei Nie
0 siblings, 0 replies; only message in thread
From: Jianglei Nie @ 2022-05-26 1:38 UTC (permalink / raw)
To: bootc, martin.petersen
Cc: linux-scsi, target-devel, linux1394-devel, linux-kernel, Jianglei Nie
When req->node_addr != login->sess->node_id, sbp_management_request
_logout() returns without releasing the login, which may lead to a
potential memory leak.
We can fix it by calling sbp_login_release() before the function returns.
Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
---
drivers/target/sbp/sbp_target.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 504670994fb4..76f3ec58a24b 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -575,6 +575,7 @@ static void sbp_management_request_logout(
req->status.status = cpu_to_be32(
STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) |
STATUS_BLOCK_SBP_STATUS(SBP_STATUS_ACCESS_DENIED));
+ sbp_login_release(login, true);
return;
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-26 1:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 1:38 [PATCH] scsi: target: sbp: Fix memory leak in sbp_management_request_logout() Jianglei Nie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).