Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: libcxgbi: Free the socket on error path in cxgbi_check_route6()
@ 2026-12-04  4:50 Haoxiang Li
  2026-12-04  5:19 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-12-04  4:50 UTC (permalink / raw)
  To: James.Bottomley, mkp, bvanassche, anish, manojmalviya, davem,
	kxie
  Cc: linux-scsi, Haoxiang Li

cxgbi_sock_create() allocates a socket and cpls. If later address
lookup fails, this memory is leaked. Free the cpl buffers and drop
the socket reference directly.

Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/scsi/cxgbi/libcxgbi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index b0bffbc38183..c77a01cdda24 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -820,8 +820,10 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
 		neigh_release(n);
 
 	ip6_rt_put(rt);
-	if (csk)
-		cxgbi_sock_closed(csk);
+	if (csk) {
+		cxgbi_sock_free_cpl_skbs(csk);
+		cxgbi_sock_put(csk);
+	}
 err_out:
 	return ERR_PTR(err);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  5:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  4:50 [PATCH] scsi: libcxgbi: Free the socket on error path in cxgbi_check_route6() Haoxiang Li
2026-12-04  5:19 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox