public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mnt: Fix a memory stomp in umount
@ 2014-12-18 16:57 Eric W. Biederman
       [not found] ` <CA+55aFz6grtss0SXqOizXMOOF4sxT3FC4GC4NCiMF2Huy1vE4A@mail.gmail.com>
  2014-12-18 20:01 ` Al Viro
  0 siblings, 2 replies; 14+ messages in thread
From: Eric W. Biederman @ 2014-12-18 16:57 UTC (permalink / raw)
  To: Al Viro; +Cc: Linus Torvalds, linux-fsdevel


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" <ebiederm@xmission.com>
---

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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-01-02 21:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18 16:57 [PATCH] mnt: Fix a memory stomp in umount Eric W. Biederman
     [not found] ` <CA+55aFz6grtss0SXqOizXMOOF4sxT3FC4GC4NCiMF2Huy1vE4A@mail.gmail.com>
2014-12-18 18:41   ` Linus Torvalds
2014-12-18 19:24     ` Eric W. Biederman
2014-12-18 19:34       ` Linus Torvalds
2014-12-18 21:05       ` Al Viro
2014-12-18 21:18         ` Eric W. Biederman
2014-12-19  0:02           ` Al Viro
2014-12-19  0:03             ` Al Viro
2015-01-02 21:06             ` Eric W. Biederman
2015-01-02 21:13               ` Al Viro
2015-01-02 21:56                 ` Eric W. Biederman
2014-12-18 20:01 ` Al Viro
2014-12-18 20:15   ` Al Viro
2014-12-18 20:40     ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox