Skip to contentSkip to conversation

Patch "staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
staging-vchiq_2835_arm-fix-null-ptr-dereference-in-free_pagelist.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 974d4d03fc020af4fa4e9e72a86f0fefa37803c5 Mon Sep 17 00:00:00 2001

From: Stefan Wahren <[email protected]>
Date: Sun, 3 Sep 2017 19:06:31 +0200
Subject: staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist

From: Stefan Wahren <[email protected]>

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.

Fixes 71bad7f08641 ("staging: add bcm2708 vchiq driver")
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +4 -2
@@ -538,18 +538,20 @@ free_pagelist(PAGELIST_T *pagelist, int
 			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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/staging-vchiq_2835_arm-fix-null-ptr-dereference-in-free_pagelist.patch