From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ram Subject: Re: [PATCH] namespace.c: fix bind mount from foreign namespace Date: Fri, 13 May 2005 10:29:16 -0700 Message-ID: <1116005355.6248.372.camel@localhost> References: <20050513170602.GI1150@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-n2Jpu51d1g8nE4H1MZTr" Cc: viro@parcelfarce.linux.theplanet.co.uk, Andrew Morton , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Return-path: Received: from e33.co.us.ibm.com ([32.97.110.131]:47024 "EHLO e33.co.us.ibm.com") by vger.kernel.org with ESMTP id S262453AbVEMR3v (ORCPT ); Fri, 13 May 2005 13:29:51 -0400 To: Miklos Szeredi In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org --=-n2Jpu51d1g8nE4H1MZTr Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 2005-05-13 at 10:17, Miklos Szeredi wrote: > > > Bind mount from a foreign namespace results in > > > > ... -EINVAL > > Wrong answer. Look again, you wrote the code, so you _should_ know ;) I guess Al agrees that bind mount from foreign namespace must be disallowed. Which means what Jamie pointed to was right. Attached the patch which fixes it. > > Miklos > - > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --=-n2Jpu51d1g8nE4H1MZTr Content-Disposition: attachment; filename=bind.patch Content-Type: text/x-patch; name=bind.patch Content-Transfer-Encoding: 7bit --- /home/linux/views/linux-2.6.12-rc4/fs/namespace.c 2005-05-06 23:22:29.000000000 -0700 +++ 2.6.12-rc4/fs/namespace.c 2005-05-13 10:17:19.000000000 -0700 @@ -633,7 +633,7 @@ static int do_loopback(struct nameidata down_write(¤t->namespace->sem); err = -EINVAL; - if (check_mnt(nd->mnt) && (!recurse || check_mnt(old_nd.mnt))) { + if (check_mnt(nd->mnt) && check_mnt(old_nd.mnt)) { err = -ENOMEM; if (recurse) mnt = copy_tree(old_nd.mnt, old_nd.dentry); --=-n2Jpu51d1g8nE4H1MZTr--