From 45bf77b483f2cf8e5aee5aff7d42b073977a7a1b Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 22 Aug 2004 23:01:08 -0700 Subject: [PATCH] [PATCH] nfsd: fix ip_map cache reference count leak. Fix a leak: when auth_unix_lookup sets CACHE_NEGATIVE, it should also auth_domain_put() the reference it holds in ipm->m_client, since setting CACHE_NEGATIVE prevents ip_map_put() from putting the reference itself. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- net/sunrpc/svcauth_unix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 949a33f753d91..10e21d0812ae8 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -316,7 +316,8 @@ struct auth_domain *auth_unix_lookup(struct in_addr addr) return NULL; if ((ipm->m_client->addr_changes - ipm->m_add_change) >0) { - set_bit(CACHE_NEGATIVE, &ipm->h.flags); + if (test_and_set_bit(CACHE_NEGATIVE, &ipm->h.flags) == 0) + auth_domain_put(&ipm->m_client->h); rv = NULL; } else { rv = &ipm->m_client->h; -- 2.53.0