Skip to content

Commit 5aa1437

Browse files
author
Al Viro
committed
ext2: fix a block leak
open file, unlink it, then use ioctl(2) to make it immutable or append only. Now close it and watch the blocks *not* freed... Immutable/append-only checks belong in ->setattr(). Note: the bug is old and backport to anything prior to 737f2e9 ("ext2: convert to use the new truncate convention") will need these checks lifted into ext2_setattr(). Cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent 3819bb0 commit 5aa1437

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

fs/ext2/inode.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,21 +1264,11 @@ static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
12641264

12651265
static void ext2_truncate_blocks(struct inode *inode, loff_t offset)
12661266
{
1267-
/*
1268-
* XXX: it seems like a bug here that we don't allow
1269-
* IS_APPEND inode to have blocks-past-i_size trimmed off.
1270-
* review and fix this.
1271-
*
1272-
* Also would be nice to be able to handle IO errors and such,
1273-
* but that's probably too much to ask.
1274-
*/
12751267
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
12761268
S_ISLNK(inode->i_mode)))
12771269
return;
12781270
if (ext2_inode_is_fast_symlink(inode))
12791271
return;
1280-
if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
1281-
return;
12821272

12831273
dax_sem_down_write(EXT2_I(inode));
12841274
__ext2_truncate_blocks(inode, offset);

0 commit comments

Comments
 (0)