All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net, nfsv4@linux-nfs.org
Subject: [PATCH] kfree in fs/nfsd/nfs4xdr.c:savemem()
Date: Wed, 27 Dec 2006 15:18:11 +0200	[thread overview]
Message-ID: <45927293.7010903@panasas.com> (raw)

The wrong pointer is being kfree'd in savemem() when defer_free
returns with an error.

Benny

Signed-off-by: Benny Halevy <bhalevy@panasas.com>

diff -rp -U 11 a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
--- a/fs/nfsd/nfs4xdr.c 2006-12-18 19:18:45.000000000 +0200
+++ b/fs/nfsd/nfs4xdr.c 2006-12-25 09:15:58.000000000 +0200
@@ -197,23 +197,23 @@ static char *savemem(struct nfsd4_compou
        if (p == argp->tmp) {
                new = kmalloc(nbytes, GFP_KERNEL);
                if (!new) return NULL;
                p = new;
                memcpy(p, argp->tmp, nbytes);
        } else {
                if (p != argp->tmpp)
                        BUG();
                argp->tmpp = NULL;
        }
        if (defer_free(argp, kfree, p)) {
-               kfree(new);
+               kfree(p);
                return NULL;
        } else
                return (char *)p;
 }


 static int
 nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
 {
        u32 bmlen;
        DECODE_HEAD;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

             reply	other threads:[~2006-12-27 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-27 13:18 Benny Halevy [this message]
2006-12-29 22:58 ` [PATCH] kfree in fs/nfsd/nfs4xdr.c:savemem() J. Bruce Fields
2006-12-31 20:22   ` Halevy, Benny

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=45927293.7010903@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=nfs@lists.sourceforge.net \
    --cc=nfsv4@linux-nfs.org \
    --cc=trond.myklebust@fys.uio.no \
    /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.