From: OGAWA Hirofumi Subject: Re: Intentionally corrupted vfat fs causing BUG Date: Fri, 24 Oct 2014 01:45:49 +0900 Message-ID: <877fzq91ky.fsf@devron.myhome.or.jp> References: <87h9z97aoh.fsf@devron.myhome.or.jp> <8761fo7667.fsf@devron.myhome.or.jp> <543B8BC7.1040501@nod.at> <87y4sk5pul.fsf@devron.myhome.or.jp> <543B8FA7.9000106@nod.at> <87r3yc5oqt.fsf@devron.myhome.or.jp> <5443E87A.2060207@nod.at> <87oat29551.fsf@devron.myhome.or.jp> <20141023160106.GB7996@ZenIV.linux.org.uk> <20141023161606.GC7996@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain Cc: Richard Weinberger , Sami Liedes , linux-fsdevel To: Al Viro Return-path: Received: from mail.parknet.co.jp ([210.171.160.6]:44986 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754182AbaJWQpx (ORCPT ); Thu, 23 Oct 2014 12:45:53 -0400 In-Reply-To: <20141023161606.GC7996@ZenIV.linux.org.uk> (Al Viro's message of "Thu, 23 Oct 2014 17:16:06 +0100") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Al Viro writes: > On Thu, Oct 23, 2014 at 05:01:06PM +0100, Al Viro wrote: > >> Hmm... Why hadn't d_splice_alias() caught that, though? > > Aha. It's not namei_msdos.c part, it's namei_vfat.c one. And there > we don't call d_splice_alias() on the affected path... > > OK, so your check isn't enough. What we need there is this: > if (alias && alias->d_parent == dentry->d_parent && ...) > Otherwise that d_move() isn't safe at all. Hm, sounds like I'm missing something. what case has different ->d_parent on alias if prevented by my check? > Moreover, for directories we don't want to bother with that codepath > at all - d_splice_alias() will do that d_move() just fine there. d_splice_alias() calls __d_find_alias() with want_discon==1, so __d_find_alias() doesn't return dentry, and d_splice_alias() doesn't use d_move() path, right? -- OGAWA Hirofumi