[ 059/150] GFS2: Get a block reservation before resizing a file

From: Greg Kroah-Hartman
Date: Tue Feb 26 2013 - 20:07:16 EST

3.8-stable review patch. If anyone has any objections, please let me know.


From: Bob Peterson <rpeterso@xxxxxxxxxx>

commit d2b47cfb26fe06002b8011707baac71a9ae8166f upstream.

This patch allocates a block reservation structure before growing
or shrinking a file. Without this structure, the grow or shink code
can reference the bad pointer.

Signed-off-by: Bob Peterson <rpeterso@xxxxxxxxxx>
Signed-off-by: Steven Whitehouse <swhiteho@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

fs/gfs2/bmap.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1286,6 +1286,10 @@ int gfs2_setattr_size(struct inode *inod


+ ret = gfs2_rs_alloc(GFS2_I(inode));
+ if (ret)
+ return ret;
oldsize = inode->i_size;
if (newsize >= oldsize)
return do_grow(inode, newsize);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/