Skip to contentSkip to conversation

+ kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Oct 10, 2013 kexec

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.patch added to -mm tree
To: [email protected]
From: [email protected]
Date: Thu, 10 Oct 2013 15:50:17 -0700

The patch titled
Subject: kernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()
has been added to the -mm tree. Its filename is
kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.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: kernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()

vsnprintf() may let 'r' larger than sizeof(buf), in this case, if 'r' is also less than "vmcoreinfo_max_size - vmcoreinfo_size" (left size of destination buffer), next memcpy() will read the unexpected addresses.

---

 kernel/kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kexec.c renamed from kernel/kexec.c~kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str +1 -1
diff -puN kernel/kexec.c~kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str kernel/kexec.c
@@ -1533,7 +1533,7 @@ void vmcoreinfo_append_str(const char *f
 	size_t r;
 
 	va_start(args, fmt);
-	r = vsnprintf(buf, sizeof(buf), fmt, args);
+	r = vscnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 
 	r = min(r, vmcoreinfo_max_size - vmcoreinfo_size);

_

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

origin.patch
sh64-kernel-use-usp-instead-of-fn.patch
sh64-kernel-remove-useless-variable-regs.patch mm-readaheadc-return-the-value-which-force_page_cache_readahead-returns.patch mm-mempolicy-make-mpol_to_str-robust-and-always-succeed.patch kernel-delayacctc-remove-redundant-checking-in-__delayacct_add_tsk.patch kernel-kexecc-use-vscnprintf-instead-of-vsnprintf-in-vmcoreinfo_append_str.patch kernel-sysctlc-check-return-value-after-call-proc_put_char-in-__do_proc_doulongvec_minmax.patch kernel-taskstatsc-add-nla_nest_cancel-for-failure-processing-between-nla_nest_start-and-nla_nest_end.patch kernel-taskstatsc-return-enomem-when-alloc-memory-fails-in-add_del_listener.patch kernel-panicc-reduce-1-byte-usage-for-print-tainted-buffer.patch
linux-next.patch
kernel-sysctl_binaryc-use-scnprintf-instead-of-snprintf.patch