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]
Message-ID: <550A8DF2.1010104@amd.com>
Date:	Thu, 19 Mar 2015 09:50:58 +0100
From:	Christian König <christian.koenig@....com>
To:	David Miller <davem@...emloft.net>, <alexander.deucher@....com>
CC:	<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] radeon: Do not directly dereference pointers to BIOS
 area.

In general I would say yes, but for this particular hardware it's a bit 
questionable to do so.

For radeon hardware to work correctly the CPU access to the PCIE BARs 
should work even without using the specialized IO macros/functions, 
otherwise mapping VRAM CPU accessible isn't really possible.

What's the background of the change? Some problems on a certain CPU 
platform? or just general cleanups?

Regards,
Christian.

On 19.03.2015 04:18, David Miller wrote:
> Use readb() and memcpy_fromio() accessors instead.
>
> Signed-off-by: David S. Miller <davem@...emloft.net>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index 63ccb8f..d27e4cc 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
>   
>   static bool radeon_read_bios(struct radeon_device *rdev)
>   {
> -	uint8_t __iomem *bios;
> +	uint8_t __iomem *bios, val1, val2;
>   	size_t size;
>   
>   	rdev->bios = NULL;
> @@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev)
>   		return false;
>   	}
>   
> -	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
> +	val1 = readb(&bios[0]);
> +	val2 = readb(&bios[1]);
> +
> +	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
>   		pci_unmap_rom(rdev->pdev, bios);
>   		return false;
>   	}
> -	rdev->bios = kmemdup(bios, size, GFP_KERNEL);
> +	rdev->bios = kzalloc(size, GFP_KERNEL);
>   	if (rdev->bios == NULL) {
>   		pci_unmap_rom(rdev->pdev, bios);
>   		return false;
>   	}
> +	memcpy_fromio(rdev->bios, bios, size);
>   	pci_unmap_rom(rdev->pdev, bios);
>   	return true;
>   }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ