ext4: fix error pointer dereference in ext4_mb_load_buddy_gfp()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 10 May 2024 15:22:53 +0000 (18:22 +0300)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 May 2024 15:24:38 +0000 (11:24 -0400)
commitc6a6c9694aadc4c3ab8d89bdd44aed3eab1e43c6
tree2c08720e119b6c4b1f4983750a1fb819f098fa49
parent26770a717cac57041d9414725e3e01dd19b08dd2
ext4: fix error pointer dereference in ext4_mb_load_buddy_gfp()

This code calls folio_put() on an error pointer which will lead to a
crash.  Check for both error pointers and NULL pointers before calling
folio_put().

Fixes: 5eea586b47f0 ("ext4: convert bd_buddy_page to bd_buddy_folio")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/eaafa1d9-a61c-4af4-9f97-d3ad72c60200@moroto.mountain
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c