lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <1386323897-2354-6-git-send-email-wenqing.lz@taobao.com> Date: Fri, 6 Dec 2013 17:57:52 +0800 From: Zheng Liu <gnehzuil.liu@...il.com> To: linux-ext4@...r.kernel.org Cc: Theodore Ts'o <tytso@....edu>, "Darrick J. Wong" <darrick.wong@...cle.com>, Zheng Liu <wenqing.lz@...bao.com> Subject: [PATCH v3 05/30] libext2fs: fix block leak when releasing xattr block From: "Darrick J. Wong" <darrick.wong@...cle.com> If in the process of writing EAs to an inode we discover that we no longer need the EA block, use the helper function to decrement the block's usage count and release it, instead of (brokenly) open-coding it. Also we need to decrement i_blocks when freeing the EA block. Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com> --- lib/ext2fs/ext_attr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index a8a8c93..81f60ca 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -315,6 +315,9 @@ errcode_t ext2fs_free_ext_attr(ext2_filsys fs, ext2_ino_t ino, ext2fs_file_acl_block_set(fs, (struct ext2_inode *)inode, 0); if (header->h_refcount == 0) ext2fs_block_alloc_stats2(fs, blk, -1); + err = ext2fs_iblk_sub_blocks(fs, (struct ext2_inode *)inode, 1); + if (err) + goto out2; /* Write inode? */ if (inode == &i) { @@ -553,13 +556,9 @@ skip_ea_block: blk = ext2fs_file_acl_block(handle->fs, (struct ext2_inode *)inode); if (!block_buf && blk) { /* xattrs shrunk, free the block */ - ext2fs_file_acl_block_set(handle->fs, - (struct ext2_inode *)inode, 0); - err = ext2fs_iblk_sub_blocks(handle->fs, - (struct ext2_inode *)inode, 1); + err = ext2fs_free_ext_attr(handle->fs, handle->ino, inode); if (err) goto out; - ext2fs_block_alloc_stats2(handle->fs, blk, -1); } /* Write the inode */ -- 1.7.9.7 -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists