The patch titled
     fs/partitions/ldm.c: fix buffer overflow again
has been added to the -mm tree.  Its filename is
     fs-partitions-ldmc-fix-buffer-overflow-again.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: fs/partitions/ldm.c: fix buffer overflow again
From: Timo Warns <[email protected]>

c340b1d640001 ("fs/partitions/ldm.c: fix oops caused by corrupted
partition table") was incomplete and incorrect.  It does not consider that
for subsequent fragments, previously allocated memory is used.

Signed-off-by: Timo Warns <[email protected]>
Cc: Eugene Teo <[email protected]>
Cc: Harvey Harrison <[email protected]>
Cc: Richard Russon <[email protected]>
Reported-by: Ben Hutchings <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 fs/partitions/ldm.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN fs/partitions/ldm.c~fs-partitions-ldmc-fix-buffer-overflow-again 
fs/partitions/ldm.c
--- a/fs/partitions/ldm.c~fs-partitions-ldmc-fix-buffer-overflow-again
+++ a/fs/partitions/ldm.c
@@ -1335,6 +1335,11 @@ static bool ldm_frag_add (const u8 *data
 
        list_add_tail (&f->list, frags);
 found:
+       if (rec >= f->num) {
+               ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num);
+               return false;
+       }
+
        if (f->map & (1 << rec)) {
                ldm_error ("Duplicate VBLK, part %d.", rec);
                f->map &= 0x7F;                 /* Mark the group as broken */
_

Patches currently in -mm which might be from [email protected] are

fs-partitions-efic-corrupted-guid-partition-tables-can-cause-kernel-oops.patch
fs-partitions-ldmc-fix-buffer-overflow-again.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to