Subject: CVE-2022-48712: ext4: fix error handling in ext4_fc_record_modified_inode()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

ext4: fix error handling in ext4_fc_record_modified_inode()

Current code does not fully takes care of krealloc() error case, which
could lead to silent memory corruption or a kernel bug.  This patch
fixes that.

Also it cleans up some duplicated error handling logic from various
functions in fast_commit.c file.

The Linux kernel CVE team has assigned CVE-2022-48712 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.10.99 with commit 62e46e0ffc02
	Fixed in 5.15.22 with commit 1b6762ecdf3c
	Fixed in 5.16.8 with commit 14aa3f49c7fc
	Fixed in 5.17 with commit cdce59a15491

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2022-48712
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	fs/ext4/fast_commit.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/62e46e0ffc02daa8fcfc02f7a932cc8a19601b19
	https://git.kernel.org/stable/c/1b6762ecdf3cf12113772427c904aa3c420a1802
	https://git.kernel.org/stable/c/14aa3f49c7fc6424763f4323bfbc3a807b0727dc
	https://git.kernel.org/stable/c/cdce59a1549190b66f8e3fe465c2b2f714b98a94