Subject: CVE-2021-47600: dm btree remove: fix use after free in rebalance_children()

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

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

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

dm btree remove: fix use after free in rebalance_children()

Move dm_tm_unlock() after dm_tm_dec().

The Linux kernel CVE team has assigned CVE-2021-47600 to this issue.

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

	Fixed in 4.4.296 with commit a48f6a2bf337
	Fixed in 4.9.294 with commit 66ea642af6fd
	Fixed in 4.14.259 with commit b03abd0aa09c
	Fixed in 4.19.222 with commit 293f957be5e3
	Fixed in 5.4.168 with commit 501ecd90efdc
	Fixed in 5.10.88 with commit 0e21e6cd5eeb
	Fixed in 5.15.11 with commit 607beb420b3f
	Fixed in 5.16 with commit 1b8d2789dad0

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-2021-47600
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:
	drivers/md/persistent-data/dm-btree-remove.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/a48f6a2bf33734ec5669ee03067dfb6c5b4818d6
	https://git.kernel.org/stable/c/66ea642af6fd4eacb5d0271a922130fcf8700424
	https://git.kernel.org/stable/c/b03abd0aa09c05099f537cb05b8460c4298f0861
	https://git.kernel.org/stable/c/293f957be5e39720778fb1851ced7f5fba6d51c3
	https://git.kernel.org/stable/c/501ecd90efdc9b2edc6c28852ecd098a4adf8f00
	https://git.kernel.org/stable/c/0e21e6cd5eebfc929ac5fa3b97ca2d4ace3cb6a3
	https://git.kernel.org/stable/c/607beb420b3fe23b948a9bf447d993521a02fbbb
	https://git.kernel.org/stable/c/1b8d2789dad0005fd5e7d35dab26a8e1203fb6da