mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kangjie Lu <kangjielu@gmail.com>
To: davem@davemloft.net
Cc: ben@decadent.org.uk, kan.liang@intel.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, taesoo@gatech.edu,
	csong84@gatech.edu, Kangjie Lu <kjlu@gatech.edu>
Subject: [PATCH] ethtool: fix a kernel infoleak in ethtool_get_pauseparam
Date: Wed,  1 Jun 2016 16:39:21 +0200	[thread overview]
Message-ID: <1464791961-8169-1-git-send-email-kjlu@gatech.edu> (raw)

The field autoneg of pauseparam is not initialized in some
implementations of get_pauseparam(), but the whole object is
copied to userland.

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
---
 net/core/ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f426c5a..84544bd 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1723,7 +1723,10 @@ static noinline_for_stack int ethtool_set_channels(struct net_device *dev,
 
 static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr)
 {
-	struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
+	struct ethtool_pauseparam pauseparam;
+
+	memset(&pauseparam, 0, sizeof(pauseparam));
+	pauseparam.cmd = ETHTOOL_GPAUSEPARAM;
 
 	if (!dev->ethtool_ops->get_pauseparam)
 		return -EOPNOTSUPP;
-- 
1.9.1

             reply	other threads:[~2016-06-01 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 14:39 Kangjie Lu [this message]
2016-06-01 14:57 ` Edward Cree
2016-06-01 17:14 ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464791961-8169-1-git-send-email-kjlu@gatech.edu \
    --to=kangjielu@gmail.com \
    --cc=ben@decadent.org.uk \
    --cc=csong84@gatech.edu \
    --cc=davem@davemloft.net \
    --cc=kan.liang@intel.com \
    --cc=kjlu@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=taesoo@gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®