The patch titled kmemleak: protect the seq start/next/stop sequence by rcu_read_lock() has been added to the -mm tree. Its filename is kmemleak-protect-the-seq-start-next-stop-sequence-by-rcu_read_lock.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: kmemleak: protect the seq start/next/stop sequence by rcu_read_lock() From: Catalin Marinas <catalin.marinas@xxxxxxx> Objects passed to kmemleak_seq_next() have an incremented reference count (hence not freed) but they may point via object_list.next to other freed objects. To avoid this, the whole start/next/stop sequence must be protected by rcu_read_lock(). Addresses http://bugzilla.kernel.org/show_bug.cgi?id=13761 Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx> Reported-by: Marton Nemeth <nm127@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kmemleak.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff -puN mm/kmemleak.c~kmemleak-protect-the-seq-start-next-stop-sequence-by-rcu_read_lock mm/kmemleak.c --- a/mm/kmemleak.c~kmemleak-protect-the-seq-start-next-stop-sequence-by-rcu_read_lock +++ a/mm/kmemleak.c @@ -1217,7 +1217,6 @@ static void *kmemleak_seq_start(struct s } object = NULL; out: - rcu_read_unlock(); return object; } @@ -1233,13 +1232,11 @@ static void *kmemleak_seq_next(struct se ++(*pos); - rcu_read_lock(); list_for_each_continue_rcu(n, &object_list) { next_obj = list_entry(n, struct kmemleak_object, object_list); if (get_object(next_obj)) break; } - rcu_read_unlock(); put_object(prev_obj); return next_obj; @@ -1255,6 +1252,7 @@ static void kmemleak_seq_stop(struct seq * kmemleak_seq_start may return ERR_PTR if the scan_mutex * waiting was interrupted, so only release it if !IS_ERR. */ + rcu_read_unlock(); mutex_unlock(&scan_mutex); if (v) put_object(v); _ Patches currently in -mm which might be from catalin.marinas@xxxxxxx are origin.patch fs-ramfs-file-nommuc-needs-include-linux-schedh.patch linux-next.patch kmemleak-protect-the-seq-start-next-stop-sequence-by-rcu_read_lock.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html