staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist
commit 974d4d03fc020af4fa4e9e72a86f0fefa37803c5 upstream. This fixes a NULL pointer dereference on RPi 2 with multi_v7_defconfig. The function page_address() could return NULL with enabled CONFIG_HIGHMEM. So fix this by using kmap() instead. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8928c5b2d3
commit
8a056a1152
@ -538,18 +538,20 @@ free_pagelist(PAGELIST_T *pagelist, int actual)
|
||||
if (head_bytes > actual)
|
||||
head_bytes = actual;
|
||||
|
||||
memcpy((char *)page_address(pages[0]) +
|
||||
memcpy((char *)kmap(pages[0]) +
|
||||
pagelist->offset,
|
||||
fragments,
|
||||
head_bytes);
|
||||
kunmap(pages[0]);
|
||||
}
|
||||
if ((actual >= 0) && (head_bytes < actual) &&
|
||||
(tail_bytes != 0)) {
|
||||
memcpy((char *)page_address(pages[num_pages - 1]) +
|
||||
memcpy((char *)kmap(pages[num_pages - 1]) +
|
||||
((pagelist->offset + actual) &
|
||||
(PAGE_SIZE - 1) & ~(g_cache_line_size - 1)),
|
||||
fragments + g_cache_line_size,
|
||||
tail_bytes);
|
||||
kunmap(pages[num_pages - 1]);
|
||||
}
|
||||
|
||||
down(&g_free_fragments_mutex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user