Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-14 11:55:46 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-14 11:55:56 +0100
commit48b9214a34c5db0a9e97f6249c1f79da43d9a0f9 (patch)
treea868bfe51553db1c19e61b966b6dad0ec11cd404
parentccfb1217c4aafe77be4db637abea9a33dc4e2011 (diff)
kconfig: fix memory leak when EOF is encountered in quotation
(bsc#1051510).
-rw-r--r--patches.fixes/kconfig-fix-memory-leak-when-EOF-is-encountered-in-q.patch69
-rw-r--r--series.conf1
2 files changed, 70 insertions, 0 deletions
diff --git a/patches.fixes/kconfig-fix-memory-leak-when-EOF-is-encountered-in-q.patch b/patches.fixes/kconfig-fix-memory-leak-when-EOF-is-encountered-in-q.patch
new file mode 100644
index 0000000000..0d33c1ef00
--- /dev/null
+++ b/patches.fixes/kconfig-fix-memory-leak-when-EOF-is-encountered-in-q.patch
@@ -0,0 +1,69 @@
+From fbac5977d81cb2b2b7e37b11c459055d9585273c Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+Date: Tue, 11 Dec 2018 20:00:45 +0900
+Subject: [PATCH] kconfig: fix memory leak when EOF is encountered in quotation
+Git-commit: fbac5977d81cb2b2b7e37b11c459055d9585273c
+Patch-mainline: v5.0-rc1
+References: bsc#1051510
+
+An unterminated string literal followed by new line is passed to the
+parser (with "multi-line strings not supported" warning shown), then
+handled properly there.
+
+On the other hand, an unterminated string literal at end of file is
+never passed to the parser, then results in memory leak.
+
+[Test Code]
+
+ ----------(Kconfig begin)----------
+ source "Kconfig.inc"
+
+ config A
+ bool "a"
+ -----------(Kconfig end)-----------
+
+ --------(Kconfig.inc begin)--------
+ config B
+ bool "b\No new line at end of file
+ ---------(Kconfig.inc end)---------
+
+[Summary from Valgrind]
+
+ Before the fix:
+
+ LEAK SUMMARY:
+ definitely lost: 16 bytes in 1 blocks
+ ...
+
+ After the fix:
+
+ LEAK SUMMARY:
+ definitely lost: 0 bytes in 0 blocks
+ ...
+
+Eliminate the memory leak path by handling this case. Of course, such
+a Kconfig file is wrong already, so I will add an error message later.
+
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ scripts/kconfig/zconf.l | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
+index eeac64ccc730..c2f577d71964 100644
+--- a/scripts/kconfig/zconf.l
++++ b/scripts/kconfig/zconf.l
+@@ -221,6 +221,8 @@ n [A-Za-z0-9_-]
+ }
+ <<EOF>> {
+ BEGIN(INITIAL);
++ yylval.string = text;
++ return T_WORD_QUOTE;
+ }
+ }
+
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index dc2fd991c0..63f7c6fbdb 100644
--- a/series.conf
+++ b/series.conf
@@ -20110,6 +20110,7 @@
patches.fixes/genwqe-Fix-size-check.patch
patches.drivers/intel_th-msu-Fix-an-off-by-one-in-attribute-store.patch
patches.fixes/kconfig-fix-file-name-and-line-number-of-warn_ignore.patch
+ patches.fixes/kconfig-fix-memory-leak-when-EOF-is-encountered-in-q.patch
patches.suse/sched-fair-Fix-infinite-loop-in-update_blocked_averages-by-reverting-a9e7f6544b9c.patch
patches.fixes/seq_buf-Make-seq_buf_puts-null-terminate-the-buffer.patch
patches.drivers/soc-bcm-brcmstb-Don-t-leak-device-tree-node-referenc.patch