linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: akpm@osdl.org, viro@parcelfarce.linux.theplanet.co.uk,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] namespace.c: fix mnt_namespace clearing
Date: Tue, 17 May 2005 02:36:55 +0100	[thread overview]
Message-ID: <20050517013655.GD32226@mail.shareable.org> (raw)
In-Reply-To: <E1DXlgJ-0005iU-00@dorka.pomaz.szeredi.hu>

Miklos Szeredi wrote:
> This patch clears mnt_namespace on unmount.
> 
> Not clearing mnt_namespace has two effects:
> 
>    1) It is possible to attach a new mount to a detached mount,
>       because check_mnt() returns true.
> 
>       This means, that when no other references to the detached mount
>       remain, it still can't be freed.  This causes a resource leak,
>       and possibly un-removable modules.
> 
>    2) If mnt_namespace is dereferenced (only in mark_mounts_for_expiry())
>       after the namspace has been freed, it can cause an Oops, memory
>       corruption, etc.
> 
> 1) has been tested before and after the patch, 2) is only speculation.

You're right - I was just thinking the same thing.  There is also
another side effect, which is ironic in the context of recent discussion:

     3) Because mnt_namespace may refer to freed memory, it may refer
        to memory that's then allocated for _another_ namespace.  So the
        check for mounting in the correct namespace which prevents
	recursive bind mounts could erronously _allow_ the recursive
	bind to succeed (though without taking the correct lock).

-- Jamie

      reply	other threads:[~2005-05-17  1:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-16 19:55 [PATCH] namespace.c: fix mnt_namespace clearing Miklos Szeredi
2005-05-17  1:36 ` Jamie Lokier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050517013655.GD32226@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).