linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Luis Henriques <luis.henriques@canonical.com>,
	Avijit Kanti Das <avijitnsec@codeaurora.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	Ben Hutchings <ben@decadent.org.uk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
Date: Tue, 23 Aug 2016 07:06:24 -0700	[thread overview]
Message-ID: <1471961184.3746.92.camel@perches.com> (raw)
In-Reply-To: <1471959668-18209-2-git-send-email-luis.henriques@canonical.com>

On Tue, 2016-08-23 at 14:41 +0100, Luis Henriques wrote:
> From: Avijit Kanti Das <avijitnsec@codeaurora.org>
> 
> memset() the structure ethtool_wolinfo that has padded bytes
> but the padded bytes have not been zeroed out.

I expect there are more of these in the kernel tree.

While this patch is strictly true and the behavior is not
guaranteed by spec, what compilers do not memset then set
the specified member?  Every time I've looked, gcc does.
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
[]
> @@ -1435,11 +1435,13 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr)
>  
>  static int ethtool_get_wol(struct net_device *dev, char __user *useraddr)
>  {
> -	struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
> +	struct ethtool_wolinfo wol;
>  
>  	if (!dev->ethtool_ops->get_wol)
>  		return -EOPNOTSUPP;
>  
> +	memset(&wol, 0, sizeof(struct ethtool_wolinfo));
> +	wol.cmd = ETHTOOL_GWOL;
>  	dev->ethtool_ops->get_wol(dev, &wol);
>  
>  	if (copy_to_user(useraddr, &wol, sizeof(wol)))

  reply	other threads:[~2016-08-23 14:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 13:41 CVE-2014-9900 fix is not upstream Luis Henriques
2016-08-23 13:41 ` net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Luis Henriques
2016-08-23 14:06   ` Joe Perches [this message]
     [not found]     ` <CAOp4FwRxfE61azV78TZ7EKESQZzRU2Pfkc2GJ9j3MV7pr80qew@mail.gmail.com>
2016-08-23 15:40       ` Joe Perches
2016-08-23 14:21   ` Eric Dumazet
2016-08-23 15:05     ` Joe Perches
2016-08-23 15:36       ` Eric Dumazet
2016-08-23 16:38         ` Andrey Ryabinin
2016-08-23 16:46         ` Edward Cree
2016-08-23 17:15       ` Vegard Nossum
2016-08-23 17:33     ` Ben Hutchings
2016-08-23 16:40 ` CVE-2014-9900 fix is not upstream David Miller
2016-08-23 17:35   ` Ben Hutchings
2016-08-23 18:24     ` David Miller
2016-08-23 20:09       ` Al Viro
2016-08-23 20:34         ` Joe Perches
2016-08-23 20:49           ` Lennart Sorensen
2016-08-23 21:25             ` Al Viro
2016-08-24 14:03               ` Lennart Sorensen
2016-08-24 20:36                 ` Hannes Frederic Sowa
2016-08-25 12:40                   ` Johannes Berg
2016-08-25 12:41                     ` Johannes Berg
2016-08-25 15:14                   ` One Thousand Gnomes

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=1471961184.3746.92.camel@perches.com \
    --to=joe@perches.com \
    --cc=avijitnsec@codeaurora.org \
    --cc=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.henriques@canonical.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).