Commit 6b54dae2 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] knfsd: lockd: fix refount on nsm

If nlm_lookup_host finds what it is looking for it exits with an extra
reference on the matching 'nsm' structure.

So don't actually count the reference until we are (fairly) sure it is going
to be used.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b66285ce
...@@ -103,8 +103,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin, ...@@ -103,8 +103,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
continue; continue;
/* See if we have an NSM handle for this client */ /* See if we have an NSM handle for this client */
if (!nsm && (nsm = host->h_nsmhandle) != 0) if (!nsm)
atomic_inc(&nsm->sm_count); nsm = host->h_nsmhandle;
if (host->h_proto != proto) if (host->h_proto != proto)
continue; continue;
...@@ -120,6 +120,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin, ...@@ -120,6 +120,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
nlm_get_host(host); nlm_get_host(host);
goto out; goto out;
} }
if (nsm)
atomic_inc(&nsm->sm_count);
host = NULL; host = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment