Skip to content

Commit

Permalink
[PATCH] knfsd: Fix two problems that can cause rmmod nfsd to die
Browse files Browse the repository at this point in the history
Both cause the 'entries' count in the export cache to be non-zero at module
removal time, so unregistering that cache fails and results in an oops.

1/ exp_pseudoroot (used for NFSv4 only) leaks a reference to an export
   entry.
2/ sunrpc_cache_update doesn't increment the entries count when it adds
   an entry.

Thanks to "david m.  richter" <[email protected]> for triggering the
problem and finding one of the bugs.

Cc: "david m. richter" <[email protected]>
Signed-off-by: Neil Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
neilbrown authored and Linus Torvalds committed May 23, 2006
1 parent e46e490 commit f2d3958
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,11 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
rv = nfserr_perm;
else if (IS_ERR(exp))
rv = nfserrno(PTR_ERR(exp));
else
else {
rv = fh_compose(fhp, exp,
fsid_key->ek_dentry, NULL);
exp_put(exp);
}
cache_put(&fsid_key->h, &svc_expkey_cache);
return rv;
}
Expand Down
1 change: 1 addition & 0 deletions net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail,
detail->update(tmp, new);
tmp->next = *head;
*head = tmp;
detail->entries++;
cache_get(tmp);
is_new = cache_fresh_locked(tmp, new->expiry_time);
cache_fresh_locked(old, 0);
Expand Down

0 comments on commit f2d3958

Please sign in to comment.