Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] sunrpc: fix a resource leak in gss_proxy_save_rsc()
@ 2026-01-26  2:10 Haoxiang Li
  2026-01-26 16:43 ` Chuck Lever
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-01-26  2:10 UTC (permalink / raw)
  To: trondmy, anna, davem, edumazet, kuba, pabeni, horms, llfamsec,
	simo, bfields
  Cc: linux-nfs, netdev, linux-kernel, Haoxiang Li, stable

In gss_proxy_save_rsc(), if gss_import_sec_context() fails,
call gss_mech_put() to release the reources acquired by
gss_mech_get_by_OID().

Fixes: 030d794bf498 ("SUNRPC: Use gssproxy upcall for server RPCGSS authentication.")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 net/sunrpc/auth_gss/svcauth_gss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index a8ec30759a18..cdae1f23adfc 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1268,8 +1268,10 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,
 						ud->out_handle.len,
 						gm, &rsci.mechctx,
 						&expiry, GFP_KERNEL);
-		if (status)
+		if (status) {
+			gss_mech_put(gm);
 			goto out;
+		}
 
 		getboottime64(&boot);
 		expiry -= boot.tv_sec;
-- 
2.25.1


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

end of thread, other threads:[~2026-01-26 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  2:10 [PATCH] sunrpc: fix a resource leak in gss_proxy_save_rsc() Haoxiang Li
2026-01-26 16:43 ` Chuck Lever

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