All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weston Andros Adamson <dros@netapp.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
	"open list:NFS, SUNRPC, AND..." <linux-nfs@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] NFS: using freed variable in debug code
Date: Wed, 08 Jun 2011 14:30:00 +0000	[thread overview]
Message-ID: <4E3994E6-9DBF-439B-808E-F134EB5DD923@netapp.com> (raw)
In-Reply-To: <20110608064300.GE3846@shale.localdomain>

Oops, good catch!

Actually, we can leave the kfree() where it is.  Using ds->ds_remotestr in the dprintk is a typo - It should be tmp_ds->ds_remotestr.

-dros

On Jun 8, 2011, at 2:43 AM, Dan Carpenter wrote:

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


WARNING: multiple messages have this Message-ID (diff)
From: Weston Andros Adamson <dros@netapp.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
	"open list:NFS, SUNRPC, AND..." <linux-nfs@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] NFS: using freed variable in debug code
Date: Wed, 8 Jun 2011 10:30:00 -0400	[thread overview]
Message-ID: <4E3994E6-9DBF-439B-808E-F134EB5DD923@netapp.com> (raw)
In-Reply-To: <20110608064300.GE3846@shale.localdomain>

Oops, good catch!

Actually, we can leave the kfree() where it is.  Using ds->ds_remotestr in the dprintk is a typo - It should be tmp_ds->ds_remotestr.

-dros

On Jun 8, 2011, at 2:43 AM, Dan Carpenter wrote:

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


  reply	other threads:[~2011-06-08 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  6:43 [patch] NFS: using freed variable in debug code Dan Carpenter
2011-06-08  6:43 ` Dan Carpenter
2011-06-08 14:30 ` Weston Andros Adamson [this message]
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=4E3994E6-9DBF-439B-808E-F134EB5DD923@netapp.com \
    --to=dros@netapp.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=error27@gmail.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.