mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
ext4: fix possible use after free in ext4_quota_enable
The function frees qf_inode via iput but then pass qf_inode to
lockdep_set_quota_inode on the failure path. This may result in a
use-after-free bug. The patch frees df_inode only when it is never used.
Fixes: daf647d2dd
("ext4: add lockdep annotations for i_data_sem")
Cc: stable@kernel.org # 4.6
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
96f1e09745
commit
61157b24e6
1 changed files with 1 additions and 1 deletions
|
@ -5713,9 +5713,9 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
|
||||||
qf_inode->i_flags |= S_NOQUOTA;
|
qf_inode->i_flags |= S_NOQUOTA;
|
||||||
lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA);
|
lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA);
|
||||||
err = dquot_enable(qf_inode, type, format_id, flags);
|
err = dquot_enable(qf_inode, type, format_id, flags);
|
||||||
iput(qf_inode);
|
|
||||||
if (err)
|
if (err)
|
||||||
lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL);
|
lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL);
|
||||||
|
iput(qf_inode);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue