diff mbox

NFS: using freed variable in debug code

Message ID 20110608064300.GE3846@shale.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter June 8, 2011, 6:43 a.m. UTC
"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>

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);