From: ebiederm@xmission.com (Eric W. Biederman) Subject: [PATCH] mnt: Fix a memory stomp in umount Date: Thu, 18 Dec 2014 10:57:19 -0600 Message-ID: <87d27gkia8.fsf@x220.int.ebiederm.org> Mime-Version: 1.0 Content-Type: text/plain Cc: Linus Torvalds , To: Al Viro Return-path: Received: from out03.mta.xmission.com ([166.70.13.233]:51673 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbaLRQ7o (ORCPT ); Thu, 18 Dec 2014 11:59:44 -0500 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: While reviewing the code of umount_tree I realized that when we append to a preexisting unmounted list we do not change pprev of the former first item in the list. Which means later in namespace_unlock hlist_del_init(&mnt->mnt_hash) on the former first item of the list will stomp unmounted.first leaving it set to some random mount point which we are likely to free soon. This isn't likely to hit, but if it does I don't know how anyone could track it down. Fixes: 38129a13e6e71f666e0468e99fdd932a687b4d7e switch mnt_hash to hlist Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- Al do you want to take this one, or would you like me to make certain it makes it Linus? fs/namespace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index fe1c77145a78..6afbd7bb79f3 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1370,6 +1370,8 @@ void umount_tree(struct mount *mnt, int how) } if (last) { last->mnt_hash.next = unmounted.first; + if (unmounted.first) + unmounted.first->pprev = &last->mnt_hash.next; unmounted.first = tmp_list.first; unmounted.first->pprev = &unmounted.first; } -- 2.1.3