mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
GFS2: Get a block reservation before resizing a file
commit d2b47cfb26
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@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a56de15779
commit
496064cd2a
@ -1240,6 +1240,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
|
||||
|
||||
inode_dio_wait(inode);
|
||||
|
||||
ret = gfs2_rs_alloc(GFS2_I(inode));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
oldsize = inode->i_size;
|
||||
if (newsize >= oldsize)
|
||||
return do_grow(inode, newsize);
|
||||
|
Loading…
Reference in New Issue
Block a user