]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: fix mount failure crash on invalid iclog memory access
authorBrian Foster <bfoster@redhat.com>
Tue, 3 Dec 2019 15:53:15 +0000 (07:53 -0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:47:27 +0000 (23:47 -0500)
commit1a2c62ec14ab834a9c5b5e114ad05f1b9c70d10f
treec4db1db8d9faac1fa57dbe04ecf058e3a2451e6a
parent93362d22e65aa8622639143b8ff1d0e40c66e53b
xfs: fix mount failure crash on invalid iclog memory access

BugLink: https://bugs.launchpad.net/bugs/1860602
[ Upstream commit 798a9cada4694ca8d970259f216cec47e675bfd5 ]

syzbot (via KASAN) reports a use-after-free in the error path of
xlog_alloc_log(). Specifically, the iclog freeing loop doesn't
handle the case of a fully initialized ->l_iclog linked list.
Instead, it assumes that the list is partially constructed and NULL
terminated.

This bug manifested because there was no possible error scenario
after iclog list setup when the original code was added.  Subsequent
code and associated error conditions were added some time later,
while the original error handling code was never updated. Fix up the
error loop to terminate either on a NULL iclog or reaching the end
of the list.

Reported-by: syzbot+c732f8644185de340492@syzkaller.appspotmail.com
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/xfs/xfs_log.c