Return-Path: Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] ksys_mount: check for permissions before resource allocation From: Ilya Matveychikov In-Reply-To: <20180605122829.y4vicefcfvzpqraw@twin.jikos.cz> Date: Tue, 5 Jun 2018 16:42:38 +0400 Cc: Al Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <707FB500-5592-45B8-9279-36BE74CDBBCE@gmail.com> References: <20180605112641.GN30522@ZenIV.linux.org.uk> <1E519BA2-4198-4255-BAE4-3125C59741A3@gmail.com> <20180605115340.GO30522@ZenIV.linux.org.uk> <0F38EDA5-DEC3-48A1-9375-47949C26DAE8@gmail.com> <20180605122829.y4vicefcfvzpqraw@twin.jikos.cz> To: dsterba@suse.cz Sender: linux-kernel-owner@vger.kernel.org List-ID: > On Jun 5, 2018, at 4:28 PM, David Sterba wrote: >=20 >> BTW, sys_umount() has this check in the right place - before doing = anything. >> So, why not to have the same logic for mount/umount? >=20 > What if the check is not equivalent to the one done later? may_mount > needs namespace, it will be available at umount time but not = necessarily > during mount due to the security hooks. Might be the issue, you=E2=80=99re right. I can=E2=80=99t tell it for = sure as I=E2=80=99m not so familiar with linux/fs code.