[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230523104644.dgvmjq4xzhemlpbm@quack3>
Date: Tue, 23 May 2023 12:46:44 +0200
From: Jan Kara <jack@...e.cz>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>,
linux-ext4@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] ext4: Fix possible corruption when moving a directory
On Tue 16-05-23 21:58:36, Darrick J. Wong wrote:
> On Thu, Jan 26, 2023 at 12:22:21PM +0100, Jan Kara wrote:
> > When we are renaming a directory to a different directory, we need to
> > update '..' entry in the moved directory. However nothing prevents moved
> > directory from being modified and even converted from the inline format
> > to the normal format. When such race happens the rename code gets
> > confused and we crash. Fix the problem by locking the moved directory.
>
> Four months later, I have a question --
>
> Is it necessary for ext4_cross_rename to inode_lock_nested on both
> old.inode and new.inode? We're resetting the dotdot entries on both
> children in that case, which means that we also need to lock out inline
> data conversions, right?
Ouch, you're right. In that path we need to lock both source & target
directories since lock_two_nondirectories() call in vfs_rename() will not
lock them... I'll send a patch. Thanks for spotting this!
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists