public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Leon Ma <xindong.ma@intel.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Validate pointer when copying mount namespace.
Date: Wed, 29 Apr 2015 03:36:13 +0100	[thread overview]
Message-ID: <20150429023613.GM889@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1430272604-6701-1-git-send-email-xindong.ma@intel.com>

On Wed, Apr 29, 2015 at 09:56:43AM +0800, Leon Ma wrote:
> We encountered following panic. Validate the pointer to avoid this.

> @@ -2788,7 +2788,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
>  		q = next_mnt(q, new);
>  		if (!q)
>  			break;
> -		while (p->mnt.mnt_root != q->mnt.mnt_root)
> +		while (p && p->mnt.mnt_root != q->mnt.mnt_root)
>  			p = next_mnt(p, old);
>  	}
>  	namespace_unlock();

Details, please.  How do you reproduce that behaviour?  

I don't like that loop in its current form (it relies upon _not_ encountering
the same ->mnt_root in the parts of tree we hadn't copied), but your change
doesn't make it any better.  Seeing a reproducer would be useful in sorting
it out; in this form the patch papers over the bug rather than fixing it.

  reply	other threads:[~2015-04-29  2:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  1:56 [PATCH] Validate pointer when copying mount namespace Leon Ma
2015-04-29  2:36 ` Al Viro [this message]
2015-04-29  3:21   ` Ma, Xindong

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=20150429023613.GM889@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xindong.ma@intel.com \
    /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