aboutsummaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-08 18:34:26 +0200
committerRichard Braun <rbraun@sceen.net>2017-01-06 20:36:09 +0100
commit109f842edae5297ad9c9ec3c8d88e2c74c9b0ca0 (patch)
treed40e11d51087bb5a55ee03b5ac1538d8ee8584b9 /ext2fs
parent4490e9a08367c7af617358de5b85ae7ab5198278 (diff)
downloadhurd-109f842edae5297ad9c9ec3c8d88e2c74c9b0ca0.tar.gz
hurd-109f842edae5297ad9c9ec3c8d88e2c74c9b0ca0.tar.bz2
hurd-109f842edae5297ad9c9ec3c8d88e2c74c9b0ca0.zip
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.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/xattr.c4
1 files changed, 4 insertions, 0 deletions
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;