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 <Warns@xxxxxxxxxxxx> 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 <warns@xxxxxxxxxxxx> Cc: Eugene Teo <eugeneteo@xxxxxxxxx> Cc: Harvey Harrison <harvey.harrison@xxxxxxxxx> Cc: Richard Russon <rich@xxxxxxxxxxx> Reported-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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 Warns@xxxxxxxxxxxx are fs-partitions-efic-corrupted-guid-partition-tables-can-cause-kernel-oops.patch fs-partitions-ldmc-fix-buffer-overflow-again.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html