stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist" has been added to the 4.9-stable tree
@ 2017-10-09 12:35 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-10-09 12:35 UTC (permalink / raw)
  To: stefan.wahren, gregkh; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From 974d4d03fc020af4fa4e9e72a86f0fefa37803c5 Mon Sep 17 00:00:00 2001
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Sun, 3 Sep 2017 19:06:31 +0200
Subject: staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist

From: Stefan Wahren <stefan.wahren@i2se.com>

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>

---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -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 stefan.wahren@i2se.com are

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-09 12:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 12:35 Patch "staging: vchiq_2835_arm: Fix NULL ptr dereference in free_pagelist" has been added to the 4.9-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).