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: <20141001135248.GQ5182@n2100.arm.linux.org.uk>
Date:	Wed, 1 Oct 2014 14:52:48 +0100
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Will Deacon <will.deacon@....com>
Cc:	Sean Paul <seanpaul@...omium.org>,
	"lauraa@...eaurora.org" <lauraa@...eaurora.org>,
	Catalin Marinas <Catalin.Marinas@....com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"ritesh.harjani@...il.com" <ritesh.harjani@...il.com>,
	"olof@...om.net" <olof@...om.net>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] arm64: Use and error-check DMA_ERROR_CODE

On Wed, Oct 01, 2014 at 11:13:23AM +0100, Will Deacon wrote:
> Hi Sean,
> 
> On Tue, Sep 30, 2014 at 09:15:21PM +0100, Sean Paul wrote:
> > +
> > +	if (dma_handle != DMA_ERROR_CODE)
> > +		__dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
> 
> Is it legal to try and free a DMA buffer after a failed allocation? If so, I
> think we need something similar for arch/arm/.

No.

	void
	dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
	                           dma_addr_t dma_handle)

	Free a region of consistent memory you previously allocated.  dev,
	                                       ^^^^^^^^^^^^^^^^^^^^^
This implies that the allocation was successful.

	size and dma_handle must all be the same as those passed into
	dma_alloc_coherent().  cpu_addr must be the virtual address returned by
	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you want this behaviour, the proper way to do it would be to check
for a NULL cpu_addr, just like kfree() etc.

	the dma_alloc_coherent().

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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