Skip to contentSkip to conversation

+ mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done.patch added to -mm tree

PATCH [email protected] 1 participant 1 message May 28, 2013

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
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 <[email protected]>
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.

Cc Al Viro <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Rik van Riel <[email protected]>

---

 mm/nommu.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/nommu.c renamed from mm/nommu.c~mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done +4 -0
diff -puN mm/nommu.c~mm-nommuc-add-additional-check-for-vread-just-like-vwrite-has-done 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 [email protected] 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