Skip to content

Commit

Permalink
[PATCH] knfsd: lockd: fix refount on nsm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Oct 4, 2006
1 parent b66285c commit 6b54dae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 6b54dae

Please sign in to comment.