]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
svcrpc: modifying valid sunrpc cache entries is racy
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 24 Dec 2010 19:03:38 +0000 (14:03 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 4 Jan 2011 21:47:29 +0000 (16:47 -0500)
Once a sunrpc cache entry is VALID, we should be replacing it (and
allowing any concurrent users to destroy it on last put) instead of
trying to update it in place.

Otherwise someone referencing the ip_map we're modifying here could try
to use the m_client just as we're putting the last reference.

The bug should only be seen by users of the legacy nfsd interfaces.

(Thanks to Neil for suggestion to use sunrpc_invalidate.)

Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/svcauth_unix.c

index a04ac9193d59dae6272b652c4e8b5c59faa08983..59a7c524a8b1759b83ff6e97eca4dab56f47a9e7 100644 (file)
@@ -401,8 +401,7 @@ struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr)
                return NULL;
 
        if ((ipm->m_client->addr_changes - ipm->m_add_change) >0) {
-               if (test_and_set_bit(CACHE_NEGATIVE, &ipm->h.flags) == 0)
-                       auth_domain_put(&ipm->m_client->h);
+               sunrpc_invalidate(&ipm->h, sn->ip_map_cache);
                rv = NULL;
        } else {
                rv = &ipm->m_client->h;