summaryrefslogtreecommitdiff
path: root/mm/cma.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2019-08-06 18:34:01 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2019-08-06 18:34:01 +0200
commit886d08593458ade141937c7839fa206ab32f4c5c (patch)
treebce3b1d053520bf3a300e7e53a4b219d065d5c8d /mm/cma.c
parent8eb3d65a5ddc6b3afaa3466e0665c4c0cd6578b1 (diff)
parentd63f4f2588b2a87ac763de9a427816301c5b1caf (diff)
Merge 4.4.188 into android-4.4
Changes in 4.4.188 ARM: riscpc: fix DMA ARM: dts: rockchip: Mark that the rk3288 timer might stop in suspend kernel/module.c: Only return -EEXIST for modules that have finished loading MIPS: lantiq: Fix bitfield masking dmaengine: rcar-dmac: Reject zero-length slave DMA requests fs/adfs: super: fix use-after-free bug btrfs: fix minimum number of chunk errors for DUP ceph: fix improper use of smp_mb__before_atomic() scsi: zfcp: fix GCC compiler warning emitted with -Wmaybe-uninitialized ACPI: fix false-positive -Wuninitialized warning be2net: Signal that the device cannot transmit during reconfiguration x86/apic: Silence -Wtype-limits compiler warnings x86: math-emu: Hide clang warnings for 16-bit overflow mm/cma.c: fail if fixed declaration can't be honored coda: add error handling for fget coda: fix build using bare-metal toolchain uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers ipc/mqueue.c: only perform resource calculation if user valid x86/kvm: Don't call kvm_spurious_fault() from .fixup selinux: fix memory leak in policydb_init() s390/dasd: fix endless loop after read unit address configuration xen/swiotlb: fix condition for calling xen_destroy_contiguous_region() Linux 4.4.188 Change-Id: Id4d8157fe94d0c6be18731ff0612500394eafec2 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'mm/cma.c')
-rw-r--r--mm/cma.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/cma.c b/mm/cma.c
index 5ae4452656cd..65c7aa419048 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -268,6 +268,12 @@ int __init cma_declare_contiguous(phys_addr_t base,
*/
alignment = max(alignment, (phys_addr_t)PAGE_SIZE <<
max_t(unsigned long, MAX_ORDER - 1, pageblock_order));
+ if (fixed && base & (alignment - 1)) {
+ ret = -EINVAL;
+ pr_err("Region at %pa must be aligned to %pa bytes\n",
+ &base, &alignment);
+ goto err;
+ }
base = ALIGN(base, alignment);
size = ALIGN(size, alignment);
limit &= ~(alignment - 1);
@@ -298,6 +304,13 @@ int __init cma_declare_contiguous(phys_addr_t base,
if (limit == 0 || limit > memblock_end)
limit = memblock_end;
+ if (base + size > limit) {
+ ret = -EINVAL;
+ pr_err("Size (%pa) of region at %pa exceeds limit (%pa)\n",
+ &size, &base, &limit);
+ goto err;
+ }
+
/* Reserve memory */
if (fixed) {
if (memblock_is_region_reserved(base, size) ||