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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 May 2019 12:11:18 +0000
From:   Igor Russkikh <Igor.Russkikh@...antia.com>
To:     Oliver Neukum <oneukum@...e.com>,
        Dmitry Bezrukov <Dmitry.Bezrukov@...antia.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/3] aqc111: fix writing to the phy on BE


On 09.05.2019 12:08, Oliver Neukum wrote:
> When writing to the phy on BE architectures an internal data structure
> was directly given, leading to it being byte swapped in the wrong
> way for the CPU in 50% of all cases. A temporary buffer must be used.
> 
> Signed-off-by: Oliver Neukum <oneukum@...e.com>
> ---
>  drivers/net/usb/aqc111.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
> index 408df2d335e3..599d560a8450 100644
> --- a/drivers/net/usb/aqc111.c
> +++ b/drivers/net/usb/aqc111.c
> @@ -320,6 +320,7 @@ static int aqc111_get_link_ksettings(struct net_device *net,
>  static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
>  {
>  	struct aqc111_data *aqc111_data = dev->driver_priv;
> +	u32 phy_on_the_wire;
>  
>  	aqc111_data->phy_cfg &= ~AQ_ADV_MASK;
>  	aqc111_data->phy_cfg |= AQ_PAUSE;
> @@ -361,7 +362,8 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
>  		}
>  	}
>  
> -	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &aqc111_data->phy_cfg);
> +	phy_on_the_wire = aqc111_data->phy_cfg;
> +	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &phy_on_the_wire);

Hi Oliver,

I see all write32_cmd and write16_cmd are using a temporary variable to do an
internal cpu_to_le32. Why this extra temporary storage is needed?

The question is actually for both 2nd and third patch.
In all the cases BE machine will store temporary bswap conversion in tmp
variable and will not actually touch actual field.

Regards,
  Igor

PS Sorry for sending this lately, had a long holiday weekend.

Powered by blists - more mailing lists