fs: quota: fix array-index-out-of-bounds bug by passing correct argument to vfs_clean...
authorAnant Thazhemadam <anant.thazhemadam@gmail.com>
Tue, 8 Dec 2020 19:43:38 +0000 (01:13 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Dec 2020 15:02:45 +0000 (16:02 +0100)
commitf5d4e47871c879d720c7b1855249f8955de243de
tree3390c4c1c2a0848825a4abb675a461ae391734b6
parente196311e0d696be7b3703ae4bd7f1c8f0eb5e57e
fs: quota: fix array-index-out-of-bounds bug by passing correct argument to vfs_cleanup_quota_inode()

commit e51d68e76d604c6d5d1eb13ae1d6da7f6c8c0dfc upstream.

When dquot_resume() was last updated, the argument that got passed
to vfs_cleanup_quota_inode was incorrectly set.

If type = -1 and dquot_load_quota_sb() returns a negative value,
then vfs_cleanup_quota_inode() gets called with -1 passed as an
argument, and this leads to an array-index-out-of-bounds bug.

Fix this issue by correctly passing the arguments.

Fixes: ae45f07d47cc ("quota: Simplify dquot_resume()")
Link: https://lore.kernel.org/r/20201208194338.7064-1-anant.thazhemadam@gmail.com
Reported-by: syzbot+2643e825238d7aabb37f@syzkaller.appspotmail.com
Tested-by: syzbot+2643e825238d7aabb37f@syzkaller.appspotmail.com
CC: stable@vger.kernel.org
Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/quota/dquot.c