Message ID | 1396339273-15904-1-git-send-email-tlinder@codeaurora.org |
---|---|
State | Accepted |
Commit | 87ed89d21ede38f86be9419ca7c6dd4761764bbb |
Headers | show |
On Tue, Apr 1, 2014 at 10:01 AM, Tanya Brokhman <tlinder@codeaurora.org> wrote: > 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> > > diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c > index 02317c1..457ead3 100644 > --- a/drivers/mtd/ubi/wl.c > +++ b/drivers/mtd/ubi/wl.c > @@ -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) { Acked-by: Richard Weinberger <richard@nod.at>
On Tue, 2014-04-01 at 11:01 +0300, Tanya Brokhman wrote: > 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> Pushed to linux-ubifs.git / master, thanks!
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 02317c1..457ead3 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -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) {
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>