All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: "david m. richter" <richterd@citi.umich.edu>
Subject: [PATCH] knfsd: Fix two problems that can cause rmmod nfsd to die.
Date: Mon, 22 May 2006 11:19:32 +1000	[thread overview]
Message-ID: <1060522011932.2462@suse.de> (raw)
In-Reply-To: 20060522111746.2437.patches@notabene

This patch applies to -mm and current -git and should go to Linus
before 2.6.17
Thanks.
NeilBrown

### Comments for Changeset

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" <richterd@citi.umich.edu> for triggering the
problem and finding one of the bugs.

Cc: "david m. richter" <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/nfsd/export.c   |    4 +++-
 ./net/sunrpc/cache.c |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff ./fs/nfsd/export.c~current~ ./fs/nfsd/export.c
--- ./fs/nfsd/export.c~current~	2006-05-22 10:55:44.000000000 +1000
+++ ./fs/nfsd/export.c	2006-05-22 10:59:40.000000000 +1000
@@ -1066,9 +1066,11 @@ exp_pseudoroot(struct auth_domain *clp, 
 		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;
 }

diff ./net/sunrpc/cache.c~current~ ./net/sunrpc/cache.c
--- ./net/sunrpc/cache.c~current~	2006-05-22 11:02:46.000000000 +1000
+++ ./net/sunrpc/cache.c	2006-05-22 11:03:15.000000000 +1000
@@ -159,6 +159,7 @@ struct cache_head *sunrpc_cache_update(s
 		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);

           reply	other threads:[~2006-05-22  1:19 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20060522111746.2437.patches@notabene>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1060522011932.2462@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.