mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
UBI: fix error path in __wl_get_peb
In case of an error (if there are not free PEB's for example), __wl_get_peb will return a negative value. In order to prevent access violation we need to test the returned value prior to using it later on. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Reviewed-by: Dolev Raviv <draviv@codeaurora.org> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
This commit is contained in:
parent
fcdd57c890
commit
87ed89d21e
1 changed files with 3 additions and 0 deletions
|
@ -684,6 +684,9 @@ int ubi_wl_get_peb(struct ubi_device *ubi)
|
|||
peb = __wl_get_peb(ubi);
|
||||
spin_unlock(&ubi->wl_lock);
|
||||
|
||||
if (peb < 0)
|
||||
return peb;
|
||||
|
||||
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
|
||||
ubi->peb_size - ubi->vid_hdr_aloffset);
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in a new issue