Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468575

Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
Date 2016-08-23 16:20 +0200
Message-ID <s9kIx-563-5@gated-at.bofh.it> (permalink)
References <s9kfv-4GF-5@gated-at.bofh.it> <s9kfv-4GF-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)))

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

CVE-2014-9900 fix is not upstream Luis Henriques <luis.henriques@canonical.com> - 2016-08-23 15:50 +0200
  net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Luis Henriques <luis.henriques@canonical.com> - 2016-08-23 15:50 +0200
    Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Joe Perches <joe@perches.com> - 2016-08-23 16:20 +0200
      Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Joe Perches <joe@perches.com> - 2016-08-23 17:50 +0200
    Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Eric Dumazet <eric.dumazet@gmail.com> - 2016-08-23 16:50 +0200
      Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Joe Perches <joe@perches.com> - 2016-08-23 17:30 +0200
        Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Eric Dumazet <eric.dumazet@gmail.com> - 2016-08-23 17:40 +0200
          Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-08-23 18:40 +0200
          Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Edward Cree <ecree@solarflare.com> - 2016-08-23 19:00 +0200
        Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Vegard Nossum <vegard.nossum@gmail.com> - 2016-08-23 19:20 +0200
      Re: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Ben Hutchings <ben@decadent.org.uk> - 2016-08-23 19:40 +0200
  Re: CVE-2014-9900 fix is not upstream David Miller <davem@davemloft.net> - 2016-08-23 18:50 +0200
    Re: CVE-2014-9900 fix is not upstream Ben Hutchings <ben@decadent.org.uk> - 2016-08-23 19:40 +0200
      Re: CVE-2014-9900 fix is not upstream David Miller <davem@davemloft.net> - 2016-08-23 20:30 +0200
        Re: CVE-2014-9900 fix is not upstream Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-23 22:20 +0200
          Re: CVE-2014-9900 fix is not upstream Joe Perches <joe@perches.com> - 2016-08-23 22:40 +0200
            Re: CVE-2014-9900 fix is not upstream lsorense@csclub.uwaterloo.ca (Lennart Sorensen) - 2016-08-23 23:00 +0200
              Re: CVE-2014-9900 fix is not upstream Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-23 23:30 +0200
                Re: CVE-2014-9900 fix is not upstream lsorense@csclub.uwaterloo.ca (Lennart Sorensen) - 2016-08-24 16:10 +0200
                Re: CVE-2014-9900 fix is not upstream Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-08-24 22:40 +0200

csiph-web