]> git.baikalelectronics.ru Git - kernel.git/commit
xen/grants: prevent integer overflow in gnttab_dma_alloc_pages()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 1 Sep 2022 15:35:20 +0000 (18:35 +0300)
committerJuergen Gross <jgross@suse.com>
Fri, 2 Sep 2022 09:05:19 +0000 (11:05 +0200)
commite9ea0b30ada008f4e65933f449db6894832cb242
tree58af35252ddd2604f1afa331915c34da2ab6dbac
parentfe8f65b018effbf473f53af3538d0c1878b8b329
xen/grants: prevent integer overflow in gnttab_dma_alloc_pages()

The change from kcalloc() to kvmalloc() means that arg->nr_pages
might now be large enough that the "args->nr_pages << PAGE_SHIFT" can
result in an integer overflow.

Fixes: b3f7931f5c61 ("xen/gntdev: switch from kcalloc() to kvcalloc()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/YxDROJqu/RPvR0bi@kili
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/grant-table.c