lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211126104708.7899-1-linmq006@gmail.com>
Date:   Fri, 26 Nov 2021 10:47:08 +0000
From:   Miaoqian Lin <linmq006@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     linmq006@...il.com, Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] tracing: Fix possible memory leak in __create_synth_event

Before goto err, call argv_free to handle argv in order to prevent
memory leak.

Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
 kernel/trace/trace_events_synth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 22db3ce95e74..fe2e37564c9b 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -1261,6 +1261,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
 			 */
 			if (cmd_version > 1 && n_fields_this_loop >= 1) {
 				synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));
+				argv_free(argv);
 				ret = -EINVAL;
 				goto err;
 			}
@@ -1268,6 +1269,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
 			fields[n_fields++] = field;
 			if (n_fields == SYNTH_FIELDS_MAX) {
 				synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);
+				argv_free(argv);
 				ret = -EINVAL;
 				goto err;
 			}
@@ -1277,6 +1279,7 @@ static int __create_synth_event(const char *name, const char *raw_fields)
 
 		if (consumed < argc) {
 			synth_err(SYNTH_ERR_INVALID_CMD, 0);
+			argv_free(argv);
 			ret = -EINVAL;
 			goto err;
 		}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ