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

    of/selftest: Fix off-by-one error in removal path

to the 3.17-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:
     of-selftest-fix-off-by-one-error-in-removal-path.patch
and it can be found in the queue-3.17 subdirectory.

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


>From c1a2086e2d8c4eb4e8630ba752e911ec180dec67 Mon Sep 17 00:00:00 2001
From: Grant Likely <[email protected]>
Date: Wed, 19 Nov 2014 16:22:32 +0000
Subject: of/selftest: Fix off-by-one error in removal path

From: Grant Likely <[email protected]>

commit c1a2086e2d8c4eb4e8630ba752e911ec180dec67 upstream.

The removal path for selftest data has an off by one error that causes
the code to dereference beyond the end of the nodes[] array on the first
pass through. The old code only worked by chance on a lot of platforms,
but the bug was recently exposed on aarch64.

The fix is simple. Decrement the node count before dereferencing, not
after.

Reported-by: Kevin Hilman <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Gaurav Minocha <[email protected]>

---
 drivers/of/selftest.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -799,7 +799,7 @@ static void selftest_data_remove(void)
                return;
        }
 
-       while (last_node_index >= 0) {
+       while (last_node_index-- > 0) {
                if (nodes[last_node_index]) {
                        np = 
of_find_node_by_path(nodes[last_node_index]->full_name);
                        if (strcmp(np->full_name, "/aliases") != 0) {
@@ -812,7 +812,6 @@ static void selftest_data_remove(void)
                                }
                        }
                }
-               last_node_index--;
        }
 }
 


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

queue-3.17/of-base-fix-powerpc-address-parsing-hack.patch
queue-3.17/of-selftest-fix-off-by-one-error-in-removal-path.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to