|
|
6539dc |
From f8d4a51b02abd2f7bb4c5a874d8d83f4dedc7a6a Mon Sep 17 00:00:00 2001
|
|
|
6539dc |
From: Andreas Schneider <asn@samba.org>
|
|
|
6539dc |
Date: Wed, 29 Jun 2016 13:38:19 +0200
|
|
|
6539dc |
Subject: [PATCH] s3-winbind: Fix memory leak with each cached credential login
|
|
|
6539dc |
|
|
|
6539dc |
When we allow offline logon and have a lot of logins, windbind will leak
|
|
|
6539dc |
4k of memory which each log in. On systems with heavy load this can grow
|
|
|
6539dc |
quickly and the OOM killer will kill Winbind.
|
|
|
6539dc |
|
|
|
6539dc |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11999
|
|
|
6539dc |
|
|
|
6539dc |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
6539dc |
Reviewed-by: Guenther Deschner <gd@samba.org>
|
|
|
6539dc |
|
|
|
6539dc |
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
|
|
|
6539dc |
Autobuild-Date(master): Wed Jun 29 19:03:53 CEST 2016 on sn-devel-144
|
|
|
6539dc |
|
|
|
6539dc |
(cherry picked from commit 826f61960ec74deedc9d556a3b8fe04d9178dcd8)
|
|
|
6539dc |
---
|
|
|
6539dc |
source3/winbindd/winbindd_cache.c | 8 ++++++--
|
|
|
6539dc |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
6539dc |
|
|
|
6539dc |
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
|
|
|
6539dc |
index cf3ed71..5dd9f4f 100644
|
|
|
6539dc |
--- a/source3/winbindd/winbindd_cache.c
|
|
|
6539dc |
+++ b/source3/winbindd/winbindd_cache.c
|
|
|
6539dc |
@@ -3471,7 +3471,7 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const
|
|
|
6539dc |
struct winbind_cache *cache = get_cache(domain);
|
|
|
6539dc |
NTSTATUS status;
|
|
|
6539dc |
int ret;
|
|
|
6539dc |
- struct cred_list *cred, *oldest = NULL;
|
|
|
6539dc |
+ struct cred_list *cred, *next, *oldest = NULL;
|
|
|
6539dc |
|
|
|
6539dc |
if (!cache->tdb) {
|
|
|
6539dc |
return NT_STATUS_INTERNAL_DB_ERROR;
|
|
|
6539dc |
@@ -3540,7 +3540,11 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const
|
|
|
6539dc |
status = NT_STATUS_UNSUCCESSFUL;
|
|
|
6539dc |
}
|
|
|
6539dc |
done:
|
|
|
6539dc |
- SAFE_FREE(wcache_cred_list);
|
|
|
6539dc |
+ for (cred = wcache_cred_list; cred; cred = next) {
|
|
|
6539dc |
+ next = cred->next;
|
|
|
6539dc |
+ DLIST_REMOVE(wcache_cred_list, cred);
|
|
|
6539dc |
+ SAFE_FREE(cred);
|
|
|
6539dc |
+ }
|
|
|
6539dc |
SAFE_FREE(oldest);
|
|
|
6539dc |
|
|
|
6539dc |
return status;
|
|
|
6539dc |
--
|
|
|
6539dc |
2.9.0
|
|
|
6539dc |
|