diff options
Diffstat (limited to 'drivers/infiniband/core/umem.c')
-rw-r--r-- | drivers/infiniband/core/umem.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index aec7a6aa2951..8c014b5dab4c 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -99,6 +99,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
99 | if (dmasync) | 99 | if (dmasync) |
100 | dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); | 100 | dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); |
101 | 101 | ||
102 | /* | ||
103 | * If the combination of the addr and size requested for this memory | ||
104 | * region causes an integer overflow, return error. | ||
105 | */ | ||
106 | if ((PAGE_ALIGN(addr + size) <= size) || | ||
107 | (PAGE_ALIGN(addr + size) <= addr)) | ||
108 | return ERR_PTR(-EINVAL); | ||
109 | |||
102 | if (!can_do_mlock()) | 110 | if (!can_do_mlock()) |
103 | return ERR_PTR(-EPERM); | 111 | return ERR_PTR(-EPERM); |
104 | 112 | ||