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>] [day] [month] [year] [list]
Message-ID: <20220307080856.39536-1-wangjie125@huawei.com>
Date:   Mon, 7 Mar 2022 16:08:56 +0800
From:   Jie Wang <wangjie125@...wei.com>
To:     <mkubecek@...e.cz>, <davem@...emloft.net>, <kuba@...nel.org>,
        <wangjie125@...wei.com>
CC:     <netdev@...r.kernel.org>, <huangguangbin2@...wei.com>,
        <lipeng321@...wei.com>, <shenjian15@...wei.com>,
        <moyufeng@...wei.com>, <linyunsheng@...wei.com>,
        <salil.mehta@...wei.com>, <chenhao288@...ilicon.com>
Subject: [PATCH] ethtool: add the memory free operation after send_ioctl call fails

The memory is not freed after send_ioctl fails in function do_gtunable and
do_stunable. This will cause memory leaks.

So this patch adds memory free operation after send_ioctl call fails.

Fixes: b717ed22d984 ("ethtool: add support for get/set ethtool_tunable")
Signed-off-by: Jie Wang <wangjie125@...wei.com>
---
 ethtool.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 5d718a2..0fbb96b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5097,6 +5097,7 @@ static int do_stunable(struct cmd_context *ctx)
 		ret = send_ioctl(ctx, tuna);
 		if (ret) {
 			perror(tunable_strings[tuna->id]);
+			free(tuna);
 			return ret;
 		}
 		free(tuna);
@@ -5174,6 +5175,7 @@ static int do_gtunable(struct cmd_context *ctx)
 			ret = send_ioctl(ctx, tuna);
 			if (ret) {
 				fprintf(stderr, "%s: Cannot get tunable\n", ts);
+				free(tuna);
 				return ret;
 			}
 			print_tunable(tuna);
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ