From: Greg Kroah-Hartman Date: Thu, 6 Feb 2020 16:14:29 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.19.103~133 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09e9806b115e9a2b99b3bc00323221155da771f2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: lib-test_kasan.c-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch --- diff --git a/queue-4.4/lib-test_kasan.c-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch b/queue-4.4/lib-test_kasan.c-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch new file mode 100644 index 00000000000..32c9e3b3994 --- /dev/null +++ b/queue-4.4/lib-test_kasan.c-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch @@ -0,0 +1,39 @@ +From 3e21d9a501bf99aee2e5835d7f34d8c823f115b5 Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Thu, 30 Jan 2020 22:13:51 -0800 +Subject: lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() + +From: Gustavo A. R. Silva + +commit 3e21d9a501bf99aee2e5835d7f34d8c823f115b5 upstream. + +In case memory resources for _ptr2_ were allocated, release them before +return. + +Notice that in case _ptr1_ happens to be NULL, krealloc() behaves +exactly like kmalloc(). + +Addresses-Coverity-ID: 1490594 ("Resource leak") +Link: http://lkml.kernel.org/r/20200123160115.GA4202@embeddedor +Fixes: 3f15801cdc23 ("lib: add kasan test module") +Signed-off-by: Gustavo A. R. Silva +Reviewed-by: Dmitry Vyukov +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + lib/test_kasan.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/lib/test_kasan.c ++++ b/lib/test_kasan.c +@@ -93,6 +93,7 @@ static noinline void __init kmalloc_oob_ + if (!ptr1 || !ptr2) { + pr_err("Allocation failed\n"); + kfree(ptr1); ++ kfree(ptr2); + return; + } + diff --git a/queue-4.4/series b/queue-4.4/series index 8f8de036389..f465f949e68 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -14,3 +14,4 @@ usb-gadget-legacy-set-max_speed-to-super-speed.patch usb-gadget-f_ncm-use-atomic_t-to-track-in-flight-request.patch usb-gadget-f_ecm-use-atomic_t-to-track-in-flight-request.patch alsa-dummy-fix-pcm-format-loop-in-proc-output.patch +lib-test_kasan.c-fix-memory-leak-in-kmalloc_oob_krealloc_more.patch