From 109f842edae5297ad9c9ec3c8d88e2c74c9b0ca0 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sat, 8 Oct 2016 18:34:26 +0200 Subject: ext2fs: Fix potential block leak. * ext2fs/xattr.c (ext2_set_xattr): We allocate a block, but only register it as the inodes acl block on success. Make sure to deallocate the block otherwise. --- ext2fs/xattr.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext2fs') diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c index c5771fe0..13668845 100644 --- a/ext2fs/xattr.c +++ b/ext2fs/xattr.c @@ -867,6 +867,10 @@ ext2_set_xattr (struct node *np, const char *name, const char *value, cleanup: if (block) disk_cache_block_deref (block); + if (ei->i_file_acl == 0 && blkno != 0) + /* We allocated a block, but for some reason we did not register + it. */ + ext2_free_blocks (blkno, 1); dino_deref (ei); return err; -- cgit v1.2.3