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:   Thu, 05 Jan 2017 12:33:37 -0500 (EST)
From:   David Miller <davem@...emloft.net>
To:     wangyufen@...wei.com
Cc:     siva.kallam@...adcom.com, prashant@...adcom.com,
        mchan@...adcom.com, netdev@...r.kernel.org
Subject: Re: [PATCH] tg3: Avoid NULL pointer dereference in tg3_get_nstats()

From: Wang Yufen <wangyufen@...wei.com>
Date: Thu, 5 Jan 2017 22:13:21 +0800

> From: Yufen Wang <wangyufen@...wei.com>
> 
> A possible NULL pointer dereference in tg3_get_stats64 while doing
> tg3_free_consistent.
 ...
> This patch avoids the NULL pointer dereference by using !tg3_flag(tp, INIT_COMPLETE)
> instate of !tp->hw_stats.
> 
> Signed-off-by: Yufen Wang <wangyufen@...wei.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 185e9e0..012f18d 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -14148,7 +14148,7 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
>  	struct tg3 *tp = netdev_priv(dev);
>  
>  	spin_lock_bh(&tp->lock);
> -	if (!tp->hw_stats) {
> +	if (!tg3_flag(tp, INIT_COMPLETE)) {

The real issue is the manner and order in which the driver performs
initialization actions relative to netif_device_{attach,detach}().

That is what needs to be fixed here, instead of adding more and more
ad-hoc tests to the various methods which can be invoked once the
netif_device_attach() occurs.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ