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]
Date:	Mon, 26 Oct 2009 09:40:33 -0400
From:	Andy Gospodarek <andy@...yhouse.net>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Linux Netdev List <netdev@...r.kernel.org>,
	Andy Gospodarek <andy@...yhouse.net>
Subject: Re: [PATCH net-next-2.6]  net: sysfs: ethtool_ops can be NULL

On Mon, Oct 26, 2009 at 12:23:33PM +0100, Eric Dumazet wrote:
> commit d519e17e2d01a0ee9abe083019532061b4438065
> (net: export device speed and duplex via sysfs)
> made the wrong assumption that netdev->ethtool_ops was always set.
> 
> This makes possible to crash kernel and let rtnl in locked state.
> 
> modprobe dummy
> ip link set dummy0 up
> (udev runs and crash)
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> ---
>  net/core/net-sysfs.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 753c420..89de182 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -139,7 +139,9 @@ static ssize_t show_speed(struct device *dev,
>  	if (!rtnl_trylock())
>  		return restart_syscall();
>  
> -	if (netif_running(netdev) && netdev->ethtool_ops->get_settings) {
> +	if (netif_running(netdev) &&
> +	    netdev->ethtool_ops &&
> +	    netdev->ethtool_ops->get_settings) {
>  		struct ethtool_cmd cmd = { ETHTOOL_GSET };
>  
>  		if (!netdev->ethtool_ops->get_settings(netdev, &cmd))
> @@ -158,7 +160,9 @@ static ssize_t show_duplex(struct device *dev,
>  	if (!rtnl_trylock())
>  		return restart_syscall();
>  
> -	if (netif_running(netdev) && netdev->ethtool_ops->get_settings) {
> +	if (netif_running(netdev) &&
> +	    netdev->ethtool_ops &&
> +	    netdev->ethtool_ops->get_settings) {
>  		struct ethtool_cmd cmd = { ETHTOOL_GSET };
>  
>  		if (!netdev->ethtool_ops->get_settings(netdev, &cmd))

Nice catch, Eric.

Acked-by: Andy Gospodarek <andy@...yhouse.net>

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