mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 08:26:59 +00:00
[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: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
b66285cee3
commit
6b54dae2b0
1 changed files with 4 additions and 2 deletions
|
@ -103,8 +103,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
|
|||
continue;
|
||||
|
||||
/* See if we have an NSM handle for this client */
|
||||
if (!nsm && (nsm = host->h_nsmhandle) != 0)
|
||||
atomic_inc(&nsm->sm_count);
|
||||
if (!nsm)
|
||||
nsm = host->h_nsmhandle;
|
||||
|
||||
if (host->h_proto != proto)
|
||||
continue;
|
||||
|
@ -120,6 +120,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
|
|||
nlm_get_host(host);
|
||||
goto out;
|
||||
}
|
||||
if (nsm)
|
||||
atomic_inc(&nsm->sm_count);
|
||||
|
||||
host = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue