LGTM 在 2024/9/24 9:41, Hongbo Li 写道:
The pointer clean points the memory allocated by kmemdup, when the return value of bch2_sb_clean_validate_late is not zero. The memory pointed by clean is leaked. So we should free it in this case.Fixes: a37ad1a3aba9 ("bcachefs: sb-clean.c") Signed-off-by: Hongbo Li <[email protected]> --- fs/bcachefs/sb-clean.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/bcachefs/sb-clean.c b/fs/bcachefs/sb-clean.c index 025848a9c4c0..005275281804 100644 --- a/fs/bcachefs/sb-clean.c +++ b/fs/bcachefs/sb-clean.c @@ -167,6 +167,7 @@ struct bch_sb_field_clean *bch2_read_superblock_clean(struct bch_fs *c)ret = bch2_sb_clean_validate_late(c, clean, READ);if (ret) { + kfree(clean); mutex_unlock(&c->sb_lock); return ERR_PTR(ret); }
