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

    menuconfig: Fix memory leak introduced by jump keys feature

to the 3.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:
     menuconfig-fix-memory-leak-introduced-by-jump-keys-feature.patch
and it can be found in the queue-3.9 subdirectory.

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


>From edb749f4390b3c1604233dc7c4fb0361f472e712 Mon Sep 17 00:00:00 2001
From: Benjamin Poirier <[email protected]>
Date: Mon, 15 Apr 2013 10:13:50 -0400
Subject: menuconfig: Fix memory leak introduced by jump keys feature

From: Benjamin Poirier <[email protected]>

commit edb749f4390b3c1604233dc7c4fb0361f472e712 upstream.

Fixes the memory leak of struct jump_key allocated in get_prompt_str()

Signed-off-by: Benjamin Poirier <[email protected]>
Tested-by: "Yann E. MORIN" <[email protected]>
Reviewed-by: "Yann E. MORIN" <[email protected]>
Signed-off-by: "Yann E. MORIN" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 scripts/kconfig/list.h  |   13 +++++++++++++
 scripts/kconfig/mconf.c |    3 +++
 2 files changed, 16 insertions(+)

--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -51,6 +51,19 @@ struct list_head {
             pos = list_entry(pos->member.next, typeof(*pos), member))
 
 /**
+ * list_for_each_entry_safe - iterate over list of given type safe against 
removal of list entry
+ * @pos:       the type * to use as a loop cursor.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member)                 \
+       for (pos = list_entry((head)->next, typeof(*pos), member),      \
+               n = list_entry(pos->member.next, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
  * list_empty - tests whether a list is empty
  * @head: the list to test.
  */
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -389,6 +389,7 @@ again:
                        .targets = targets,
                        .keys = keys,
                };
+               struct jump_key *pos, *tmp;
 
                res = get_relations_str(sym_arr, &head);
                dres = show_textbox_ext(_("Search Results"), (char *)
@@ -402,6 +403,8 @@ again:
                                again = true;
                        }
                str_free(&res);
+               list_for_each_entry_safe(pos, tmp, &head, entries)
+                       free(pos);
        } while (again);
        free(sym_arr);
        str_free(&title);


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

queue-3.9/menuconfig-fix-memory-leak-introduced-by-jump-keys-feature.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