mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
ubifs: Fix memory leak in lprobs self-check
Allocate the buffer after we return early.
Otherwise memory is being leaked.
Cc: <stable@vger.kernel.org>
Fixes: 1e51764a3c
("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
2567747847
commit
eef19816ad
@ -1089,10 +1089,6 @@ static int scan_check_cb(struct ubifs_info *c,
|
||||
}
|
||||
}
|
||||
|
||||
buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
/*
|
||||
* After an unclean unmount, empty and freeable LEBs
|
||||
* may contain garbage - do not scan them.
|
||||
@ -1111,6 +1107,10 @@ static int scan_check_cb(struct ubifs_info *c,
|
||||
return LPT_SCAN_CONTINUE;
|
||||
}
|
||||
|
||||
buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
sleb = ubifs_scan(c, lnum, 0, buf, 0);
|
||||
if (IS_ERR(sleb)) {
|
||||
ret = PTR_ERR(sleb);
|
||||
|
Loading…
Reference in New Issue
Block a user