]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
dmapool: fix overflow condition in pool_find_page()
authorRobin Murphy <robin.murphy@arm.com>
Thu, 1 Oct 2015 22:37:19 +0000 (15:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Oct 2015 01:42:35 +0000 (21:42 -0400)
commit676bd99178cd962ed24ffdad222b7069d330a969
treeca76fb3382ada58d059dae22fb60f18b7437c8d4
parent44241628bb207ec211bebd156aaf69470d90c209
dmapool: fix overflow condition in pool_find_page()

If a DMA pool lies at the very top of the dma_addr_t range (as may
happen with an IOMMU involved), the calculated end address of the pool
wraps around to zero, and page lookup always fails.

Tweak the relevant calculation to be overflow-proof.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/dmapool.c