]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix lzo_decompress_bio() kmap leakage
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Nov 2021 19:46:47 +0000 (12:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Nov 2021 19:46:47 +0000 (12:46 -0700)
commitc06293cf36dd6e5099ea542f3eeb9c43599a6eee
treed6f1220aa79dad8d9a15362ef47ab23b34c07c0b
parent3bd488a1d5476c44f14aae8e4d32aa379d3ef4d0
btrfs: fix lzo_decompress_bio() kmap leakage

Commit 4a3a79975183 reinstated the kmap/kunmap that had been dropped in
commit 77de0f81b8fd ("btrfs: compression: drop kmap/kunmap from lzo").

However, it seems to have done so incorrectly due to the change not
reverting cleanly, and lzo_decompress_bio() ended up not having a
matching "kunmap()" to the "kmap()" that was put back.

Also, any assert that the page pointer is not NULL should be before the
kmap() of said pointer, since otherwise you'd just oops in the kmap()
before the assert would even trigger.

I noticed this when trying to verify my btrfs merge, and things not
adding up.  I'm doing this fixup before re-doing my merge, because this
commit needs to also be backported to 5.15 (after verification from the
btrfs people).

Fixes: 4a3a79975183 ("Revert 'btrfs: compression: drop kmap/kunmap from lzo'")
Cc: David Sterba <dsterba@suse.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/btrfs/lzo.c