Subject: + mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done.patch added to -mm tree To: gang.chen@xxxxxxxxxxx,riel@xxxxxxxxxx,viro@xxxxxxxxxxxxxxxxxx,walken@xxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Tue, 28 May 2013 13:30:22 -0700 The patch titled Subject: mm/nommu.c: add additional check for vread() just like vwrite() has done has been added to the -mm tree. Its filename is mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done.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 *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Chen Gang <gang.chen@xxxxxxxxxxx> Subject: mm/nommu.c: add additional check for vread() just like vwrite() has done vwrite() checks for overflow. vread() should do the same thing. Since vwrite() checks the source buffer address, vread() should check the destination buffer address. Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Michel Lespinasse <walken@xxxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/nommu.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN mm/nommu.c~mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done mm/nommu.c --- a/mm/nommu.c~mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done +++ a/mm/nommu.c @@ -282,6 +282,10 @@ EXPORT_SYMBOL(vmalloc_to_pfn); long vread(char *buf, char *addr, unsigned long count) { + /* Don't allow overflow */ + if ((unsigned long) buf + count < count) + count = -(unsigned long) buf; + memcpy(buf, addr, count); return count; } _ Patches currently in -mm which might be from gang.chen@xxxxxxxxxxx are linux-next.patch kernel-audit_treec-audit_add_tree_rule-protect-rule-from-kill_rules.patch kernel-auditfilterc-fix-leak-in-audit_add_rule-error-path.patch posix-timers-correctly-get-dying-task-time-sample-in-posix_cpu_timer_schedule.patch mm-page_allocc-add-additional-checking-and-return-value-for-the-table-data.patch mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done.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