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: <063D6719AE5E284EB5DD2968C1650D6DD00923AE@AcuExch.aculab.com>
Date:   Thu, 12 Oct 2017 09:30:52 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Timur Tabi' <timur@...eaurora.org>,
        "David S. Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH 3/4] net: qcom/emac: enforce DMA address restrictions

From: Timur Tabi
> Sent: 11 October 2017 20:52
> The EMAC has a restriction that the upper 32 bits of the base addresses
> for the RFD and RRD rings must be the same.  The ensure that restriction,
> we allocate twice the space for the RRD and locate it at an appropriate
> address.
> 
> We also re-arrange the allocations so that invalid addresses are even
> less likely.
> 
> Signed-off-by: Timur Tabi <timur@...eaurora.org>
> ---
>  drivers/net/ethernet/qualcomm/emac/emac-mac.c | 39 ++++++++++++++++-----------
>  1 file changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-
> mac.c
> index 9cbb27263742..0f5ece5d9507 100644
> --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
> @@ -734,6 +734,11 @@ static int emac_rx_descs_alloc(struct emac_adapter *adpt)
>  	rx_q->rrd.size = rx_q->rrd.count * (adpt->rrd_size * 4);
>  	rx_q->rfd.size = rx_q->rfd.count * (adpt->rfd_size * 4);
> 
> +	/* Check if the RRD and RFD are aligned properly, and if not, adjust. */
> +	if (upper_32_bits(ring_header->dma_addr) !=
> +	    upper_32_bits(ring_header->dma_addr + ALIGN(rx_q->rrd.size, 8)))
> +		ring_header->used = ALIGN(rx_q->rrd.size, 8);
> +

Isn't the memory allocated by a single kzalloc() call?
IIRC that guarantees it doesn't cross a power or 2 boundary less than
the size.
So if you allocate any size between 4k and 8k it won't cross an odd
4k boundary (etc).

So these checks are entirely pointless.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ