All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: "open list:NFS, SUNRPC, AND..." <linux-nfs@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch] NFS: using freed variable in debug code
Date: Wed, 08 Jun 2011 06:43:00 +0000	[thread overview]
Message-ID: <20110608064300.GE3846@shale.localdomain> (raw)

"ds" gets dereferenced after a kfree in the debug output.  I just
moved the free down a line.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 77c171e..c63bbce 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -362,11 +362,11 @@ nfs4_pnfs_ds_add(struct list_head *dsaddrs, gfp_t gfp_flags)
 				__func__, tmp_ds->ds_remotestr, remotestr);
 		}
 		kfree(remotestr);
-		kfree(ds);
 		atomic_inc(&tmp_ds->ds_count);
 		dprintk("%s data server %s found, inc'ed ds_count to %d\n",
 			__func__, ds->ds_remotestr,
 			atomic_read(&tmp_ds->ds_count));
+		kfree(ds);
 		ds = tmp_ds;
 	}
 	spin_unlock(&nfs4_ds_cache_lock);

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: "open list:NFS, SUNRPC, AND..." <linux-nfs@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: [patch] NFS: using freed variable in debug code
Date: Wed, 8 Jun 2011 09:43:00 +0300	[thread overview]
Message-ID: <20110608064300.GE3846@shale.localdomain> (raw)

"ds" gets dereferenced after a kfree in the debug output.  I just
moved the free down a line.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 77c171e..c63bbce 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -362,11 +362,11 @@ nfs4_pnfs_ds_add(struct list_head *dsaddrs, gfp_t gfp_flags)
 				__func__, tmp_ds->ds_remotestr, remotestr);
 		}
 		kfree(remotestr);
-		kfree(ds);
 		atomic_inc(&tmp_ds->ds_count);
 		dprintk("%s data server %s found, inc'ed ds_count to %d\n",
 			__func__, ds->ds_remotestr,
 			atomic_read(&tmp_ds->ds_count));
+		kfree(ds);
 		ds = tmp_ds;
 	}
 	spin_unlock(&nfs4_ds_cache_lock);

             reply	other threads:[~2011-06-08  6:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  6:43 Dan Carpenter [this message]
2011-06-08  6:43 ` [patch] NFS: using freed variable in debug code Dan Carpenter
2011-06-08 14:30 ` Weston Andros Adamson
2011-06-08 14:30   ` Weston Andros Adamson
2011-06-09 18:07   ` [patch v2] NFS: fix debug message Dan Carpenter
2011-06-09 18:07     ` Dan Carpenter

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=20110608064300.GE3846@shale.localdomain \
    --to=error27@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=kernel-janitors@vger.kernel.org \
    --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 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.