public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] pnfs/flexfiles: move kfree() after the deference
@ 2015-02-11 10:22 Dan Carpenter
  2015-02-11 12:55 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-02-11 10:22 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: Anna Schumaker, Tao Peng, Weston Andros Adamson, Tom Haynes,
	linux-nfs, kernel-janitors

We dereference "err" in the the debug printk so we have to move the
kfree() down a couple lines.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index 3bbb16b..e2c01f2 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -515,10 +515,10 @@ int ff_layout_encode_ds_ioerr(struct nfs4_flexfile_layout *flo,
 		*p++ = cpu_to_be32(err->opnum);
 		*count += 1;
 		list_del(&err->list);
-		kfree(err);
 		dprintk("%s: offset %llu length %llu status %d op %d count %d\n",
 			__func__, err->offset, err->length, err->status,
 			err->opnum, *count);
+		kfree(err);
 	}
 
 	return 0;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] pnfs/flexfiles: move kfree() after the deference
  2015-02-11 10:22 [patch] pnfs/flexfiles: move kfree() after the deference Dan Carpenter
@ 2015-02-11 12:55 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2015-02-11 12:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Anna Schumaker, Tao Peng, Weston Andros Adamson, Tom Haynes,
	Linux NFS Mailing List, Kernel Janitors Mailing List

Hi Dan,

On Wed, Feb 11, 2015 at 5:22 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We dereference "err" in the the debug printk so we have to move the
> kfree() down a couple lines.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> index 3bbb16b..e2c01f2 100644
> --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> @@ -515,10 +515,10 @@ int ff_layout_encode_ds_ioerr(struct nfs4_flexfile_layout *flo,
>                 *p++ = cpu_to_be32(err->opnum);
>                 *count += 1;
>                 list_del(&err->list);
> -               kfree(err);
>                 dprintk("%s: offset %llu length %llu status %d op %d count %d\n",
>                         __func__, err->offset, err->length, err->status,
>                         err->opnum, *count);
> +               kfree(err);
>         }
>
>         return 0;

I believe this is a fix for the same bug that was reported by Julia
Lawall a couple of days ago. There should be a fix for this already at
http://git.linux-nfs.org/?p=trondmy/linux-nfs.git;a=commitdiff;hH0486b4733d5bc7d9fe765b34bc6c2b72d5c12e

Cheers
  Trond
-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-11 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 10:22 [patch] pnfs/flexfiles: move kfree() after the deference Dan Carpenter
2015-02-11 12:55 ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox