linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsd: only unhash DRC entries that are in the hashtable
Date: Mon, 18 Mar 2013 10:57:02 -0400	[thread overview]
Message-ID: <20130318145702.GC6350@fieldses.org> (raw)
In-Reply-To: <1363618147-24676-1-git-send-email-jlayton@redhat.com>

On Mon, Mar 18, 2013 at 10:49:07AM -0400, Jeff Layton wrote:
> It's not safe to call hlist_del() on a newly initialized hlist_node.
> That leads to a NULL pointer dereference. Only do that if the entry
> is hashed.

Thanks!  Applying for 3.9.--b.

> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/nfsd/nfscache.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
> index f5ad28e..ca05f6d 100644
> --- a/fs/nfsd/nfscache.c
> +++ b/fs/nfsd/nfscache.c
> @@ -102,7 +102,8 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
>  {
>  	if (rp->c_type == RC_REPLBUFF)
>  		kfree(rp->c_replvec.iov_base);
> -	hlist_del(&rp->c_hash);
> +	if (!hlist_unhashed(&rp->c_hash))
> +		hlist_del(&rp->c_hash);
>  	list_del(&rp->c_lru);
>  	--num_drc_entries;
>  	kmem_cache_free(drc_slab, rp);
> -- 
> 1.7.11.7
> 

      reply	other threads:[~2013-03-18 14:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 14:49 [PATCH] nfsd: only unhash DRC entries that are in the hashtable Jeff Layton
2013-03-18 14:57 ` J. Bruce Fields [this message]

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=20130318145702.GC6350@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).