diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-14 14:44:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-14 14:44:52 -0500 |
commit | 47e624c03043f544ab797ee073d958cfa57dbf51 (patch) | |
tree | 03e988d659d872903ce16c8e32facf4e4bfdd9fa | |
parent | 857c34cd094b94a82aceba23fdd9af47296404a2 (diff) | |
parent | 1e9c75fb9c47a75a9aec0cd17db5f6dc36b58e00 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull namespace fix from Eric Biederman:
"Benjamin Coddington noticed an unkillable busy loop in the kernel that
anyone who is sufficiently motivated can trigger. This bug did not
exist in earlier kernels making this bug a regression.
I have tested the change personally and confirmed that the bug exists
and that the fix works. This fix has been picked up by linux-next and
hopefully the automated testing bots and no problems have been
reported from those sources.
Ordinarily I would let something like this sit a little longer but I
am going to be away at Linux Plumbers the rest of this week and I am
afraid if I don't send the pull request now this fix will get lost"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
mnt: fix __detach_mounts infinite loop
-rw-r--r-- | fs/namespace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 74f64294a410..a7f91265ea67 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -695,9 +695,6 @@ static struct mountpoint *lookup_mountpoint(struct dentry *dentry) | |||
695 | 695 | ||
696 | hlist_for_each_entry(mp, chain, m_hash) { | 696 | hlist_for_each_entry(mp, chain, m_hash) { |
697 | if (mp->m_dentry == dentry) { | 697 | if (mp->m_dentry == dentry) { |
698 | /* might be worth a WARN_ON() */ | ||
699 | if (d_unlinked(dentry)) | ||
700 | return ERR_PTR(-ENOENT); | ||
701 | mp->m_count++; | 698 | mp->m_count++; |
702 | return mp; | 699 | return mp; |
703 | } | 700 | } |
@@ -711,6 +708,9 @@ static struct mountpoint *get_mountpoint(struct dentry *dentry) | |||
711 | int ret; | 708 | int ret; |
712 | 709 | ||
713 | if (d_mountpoint(dentry)) { | 710 | if (d_mountpoint(dentry)) { |
711 | /* might be worth a WARN_ON() */ | ||
712 | if (d_unlinked(dentry)) | ||
713 | return ERR_PTR(-ENOENT); | ||
714 | mountpoint: | 714 | mountpoint: |
715 | read_seqlock_excl(&mount_lock); | 715 | read_seqlock_excl(&mount_lock); |
716 | mp = lookup_mountpoint(dentry); | 716 | mp = lookup_mountpoint(dentry); |