Skip to contentSkip to conversation

rpc.gssd: Two resource leaks

PATCH In review [email protected] 2 participants 4 messages Jul 3 – Jul 11

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rpc.gssd: Two resource leaks

From: Thiago Becker <[email protected]>

Patch 1 drops a reference to clnt_info when alloc_upcall_info fails. Patch 2 frees the thread attributes before returning from start_upcall_thread.

Both leaks were identified by claude sonnet 4.5, among some amount of false positives that were hand filtered.

Thiago Becker (2):
rpc.gssd: Decrement client referece count on error paths rpc.gssd: Call pthread_attr_destroy before returning from
start_upcall_thread

 utils/gssd/gssd_proc.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
2.54.0
#1 lore raw

PATCH 1/2 rpc.gssd: Decrement client referece count on error paths

From: Thiago Becker <[email protected]>

Assisted-by Claude:claude-sonnet-4-5
---
 utils/gssd/gssd_proc.c | 3 +++
 1 file changed, 3 insertions(+)
utils/gssd/gssd_proc.c +3 -0
index e060bee3..27b6fe4f 100644
@@ -897,6 +897,9 @@ out_srchost:
 	if (info->srchost)
 		free(info->srchost);
 out_info:
+	pthread_mutex_lock(&clp_lock);
+	clp->refcount--;
+	pthread_mutex_unlock(&clp_lock);
 	free(info);
 	info = NULL;
 	goto out;
Signature · 1 line
2.54.0
#2 lore raw

PATCH 2/2 rpc.gssd: Call pthread_attr_destroy before returning from start_upcall_thread

In reply to [email protected]

From: Thiago Becker <[email protected]>

Assisted-by Claude:claude-sonnet-4-5
---
 utils/gssd/gssd_proc.c | 1 +
 1 file changed, 1 insertion(+)
utils/gssd/gssd_proc.c +1 -0
index 27b6fe4f..d59c8a19 100644
@@ -984,6 +984,7 @@ start_upcall_thread(void (*func)(struct clnt_upcall_info *), struct clnt_upcall_
 	tinfo->timeout.tv_sec += upcall_timeout;
 	TAILQ_INSERT_TAIL(&active_thread_list, tinfo, list);
 	pthread_mutex_unlock(&active_thread_list_lock);
+	pthread_attr_destroy(&attr);
 
 	return ret;
 }
Signature · 1 line
2.54.0
#3 lore raw
In reply to [email protected]
Quoted 9 lines · On 7/3/26 12:39 PM, [email protected] wrote:

From: Thiago Becker <[email protected]>

Patch 1 drops a reference to clnt_info when alloc_upcall_info fails. Patch 2 frees the thread attributes before returning from start_upcall_thread.

Both leaks were identified by claude sonnet 4.5, among some amount of false positives that were hand filtered.

Quoted 8 lines

Thiago Becker (2):
rpc.gssd: Decrement client referece count on error paths rpc.gssd: Call pthread_attr_destroy before returning from
start_upcall_thread

  utils/gssd/gssd_proc.c | 4 ++++
  1 file changed, 4 insertions(+)

Committed... (tag: nfs-utils-2-9-2-rc5)

steved.