public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfs: fix a use after free in xfs_end_io_direct_write
@ 2011-09-13 22:26 Christoph Hellwig
  2011-09-14 12:36 ` Alex Elder
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2011-09-13 22:26 UTC (permalink / raw)
  To: xfs

There is a window in which the ioend that we call inode_dio_wake on
in xfs_end_io_direct_write is already free.  Fix this by storing
the inode pointer in a local variable.

This is a fix for the regression introduced in 3.1-rc by
"fs: move inode_dio_done to the end_io handler".

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/xfs_aops.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_aops.c	2011-09-13 16:38:47.141089046 -0400
+++ linux-2.6/fs/xfs/xfs_aops.c	2011-09-13 16:39:09.991647077 -0400
@@ -1300,6 +1300,7 @@ xfs_end_io_direct_write(
 	bool			is_async)
 {
 	struct xfs_ioend	*ioend = iocb->private;
+	struct inode		*inode = ioend->io_inode;
 
 	/*
 	 * blockdev_direct_IO can return an error even after the I/O
@@ -1331,7 +1332,7 @@ xfs_end_io_direct_write(
 	}
 
 	/* XXX: probably should move into the real I/O completion handler */
-	inode_dio_done(ioend->io_inode);
+	inode_dio_done(inode);
 }
 
 STATIC ssize_t

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: xfs: fix a use after free in xfs_end_io_direct_write
  2011-09-13 22:26 xfs: fix a use after free in xfs_end_io_direct_write Christoph Hellwig
@ 2011-09-14 12:36 ` Alex Elder
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2011-09-14 12:36 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Tue, 2011-09-13 at 18:26 -0400, Christoph Hellwig wrote:
> There is a window in which the ioend that we call inode_dio_wake on
> in xfs_end_io_direct_write is already free.  Fix this by storing
> the inode pointer in a local variable.
> 
> This is a fix for the regression introduced in 3.1-rc by
> "fs: move inode_dio_done to the end_io handler".
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Alex Elder <aelder@sgi.com>


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2011-09-14 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 22:26 xfs: fix a use after free in xfs_end_io_direct_write Christoph Hellwig
2011-09-14 12:36 ` Alex Elder

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