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]
Message-ID: <1388686321.9947.13.camel@bwh-desktop.uk.level5networks.com>
Date:	Thu, 2 Jan 2014 18:12:01 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
CC:	<davem@...emloft.net>, Mark Rustad <mark.d.rustad@...el.com>,
	<netdev@...r.kernel.org>, <gospo@...hat.com>, <sassmann@...hat.com>
Subject: Re: [net-next 4/9] ixgbe: Check for adapter removal on register
 writes

On Thu, 2014-01-02 at 01:33 -0800, Jeff Kirsher wrote:
> From: Mark Rustad <mark.d.rustad@...el.com>
> 
> Prevent writes to an adapter that has been detected as removed
> by a previous failing read. This also fixes some include file
> ordering confusion that this patch revealed.
> 
> Signed-off-by: Mark Rustad <mark.d.rustad@...el.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
[...]
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
> @@ -135,7 +135,11 @@ void ixgbe_check_remove(struct ixgbe_hw *hw, u32 reg);
>  
>  static inline void IXGBE_WRITE_REG(struct ixgbe_hw *hw, u32 reg, u32 value)
>  {
> -	writel(value, hw->hw_addr + reg);
> +	u8 __iomem *reg_addr = hw->hw_addr;
> +
> +	if (IXGBE_REMOVED(reg_addr))
> +		return;
> +	writel(value, reg_addr + reg);
>  }
>  
>  #ifndef writeq
> @@ -145,7 +149,11 @@ static inline void IXGBE_WRITE_REG(struct ixgbe_hw *hw, u32 reg, u32 value)
>  
>  static inline void IXGBE_WRITE_REG64(struct ixgbe_hw *hw, u32 reg, u64 value)
>  {
> -	writeq(value, hw->hw_addr + reg);
> +	u8 __iomem *reg_addr = hw->hw_addr;
> +
> +	if (IXGBE_REMOVED(reg_addr))
> +		return;
> +	writeq(value, reg_addr + reg);
>  }
[...] 

These should also use ACCESS_ONCE() to read hw->hw_addr.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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