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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1432334609-3971-2-git-send-email-aparames@broadcom.com>
Date:	Fri, 22 May 2015 15:43:28 -0700
From:	Arun Parameswaran <aparames@...adcom.com>
To:	Ben Hutchings <bwh@...nel.org>
CC:	<netdev@...r.kernel.org>, <jdzheng@...adcom.com>,
	<aparames@...adcom.com>
Subject: [PATCH 1/2] ethtool: Clear the command data structure before sending requests

The 'ethtool' is not clearing the command data structure in the
do_gset() & do_sset() API's while sending commands to get/set
parametres. This used to work since the Kernel clears the
data structure (which was a bug and is being fixed).

This patch adds a 'memset' to the do_gset() & do_sset() to clear
the command data structure. This will prevent the 'ethtool' from
passing wrong parametres, for example incorrect 'phyad'.

Signed-off-by: Arun Parameswaran <aparames@...adcom.com>
Reviewed-by: JD (Jiandong) Zheng <jdzheng@...adcom.com>
---
 ethtool.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 01b13a6..668c189 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2275,6 +2275,7 @@ static int do_gset(struct cmd_context *ctx)
 
 	fprintf(stdout, "Settings for %s:\n", ctx->devname);
 
+	memset(&ecmd, 0, sizeof(struct ethtool_cmd));
 	ecmd.cmd = ETHTOOL_GSET;
 	err = send_ioctl(ctx, &ecmd);
 	if (err == 0) {
@@ -2520,6 +2521,8 @@ static int do_sset(struct cmd_context *ctx)
 	if (gset_changed) {
 		struct ethtool_cmd ecmd;
 
+		memset(&ecmd, 0, sizeof(struct ethtool_cmd));
+
 		ecmd.cmd = ETHTOOL_GSET;
 		err = send_ioctl(ctx, &ecmd);
 		if (err < 0) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ