From: Greg Kroah-Hartman Date: Wed, 4 Jun 2014 22:58:08 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.14.6~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=028ea258c7dc63b774b097d475ca50a7fdb36f9c;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: crypto-caam-add-allocation-failure-handling-in-sprintfcat-macro.patch --- diff --git a/queue-3.4/crypto-caam-add-allocation-failure-handling-in-sprintfcat-macro.patch b/queue-3.4/crypto-caam-add-allocation-failure-handling-in-sprintfcat-macro.patch new file mode 100644 index 00000000000..ef05f83fb8c --- /dev/null +++ b/queue-3.4/crypto-caam-add-allocation-failure-handling-in-sprintfcat-macro.patch @@ -0,0 +1,40 @@ +From 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 Mon Sep 17 00:00:00 2001 +From: Horia Geanta +Date: Fri, 18 Apr 2014 13:01:42 +0300 +Subject: crypto: caam - add allocation failure handling in SPRINTFCAT macro + +From: Horia Geanta + +commit 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 upstream. + +GFP_ATOMIC memory allocation could fail. +In this case, avoid NULL pointer dereference and notify user. + +Cc: Kim Phillips +Signed-off-by: Horia Geanta +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/caam/error.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/drivers/crypto/caam/error.c ++++ b/drivers/crypto/caam/error.c +@@ -16,9 +16,13 @@ + char *tmp; \ + \ + tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \ +- sprintf(tmp, format, param); \ +- strcat(str, tmp); \ +- kfree(tmp); \ ++ if (likely(tmp)) { \ ++ sprintf(tmp, format, param); \ ++ strcat(str, tmp); \ ++ kfree(tmp); \ ++ } else { \ ++ strcat(str, "kmalloc failure in SPRINTFCAT"); \ ++ } \ + } + + static void report_jump_idx(u32 status, char *outstr) diff --git a/queue-3.4/series b/queue-3.4/series index 99394110b01..c6b68b41388 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -71,3 +71,4 @@ x86-64-modify_ldt-make-support-for-16-bit-segments-a-runtime-option.patch pci-shpchp-check-bridge-s-secondary-not-primary-bus-speed.patch acpi-blacklist-add-dmi_enable_osi_linux-quirk-for-asus-eee-pc-1015px.patch i2c-designware-mask-all-interrupts-during-i2c-controller-enable.patch +crypto-caam-add-allocation-failure-handling-in-sprintfcat-macro.patch