]> git.baikalelectronics.ru Git - kernel.git/commit
mnt: Fix a memory stomp in umount
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 18 Dec 2014 16:57:19 +0000 (10:57 -0600)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 18 Dec 2014 19:22:02 +0000 (11:22 -0800)
commit04bd5d65d0e56890213ee0871b48f8b07fb7ad97
tree543f92da85da2752fb912e65a67ffe7be4ae671a
parent340da758dd1ed7c3c1145fb070291b8b898807e3
mnt: Fix a memory stomp in umount

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.

[ This happened because we don't have all the same operations for
  hlist's as we do for normal doubly-linked lists. In particular,
  list_splice() is easy on our standard doubly-linked lists, while
  hlist_splice() doesn't exist and needs both start/end entries of the
  hlist.  And commit c70f4b6315db incorrectly open-coded that missing
  hlist_splice().

  We should think about making these kinds of "mindless" conversions
  easier to get right by adding the missing hlist helpers   - Linus ]

Fixes: c70f4b6315db0f3c78d453fb561dd3078f9f57b1 switch mnt_hash to hlist
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namespace.c