On Sat, Apr 25, 2020 at 12:01:37PM -0700, Christoph Hellwig wrote: > On Tue, Apr 21, 2020 at 07:08:26PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > Make it so that the deferred operations freezer can save inode numbers > > when we freeze the dfops chain, and turn them into pointers to incore > > inodes when we thaw the dfops chain to finish them. Next, add dfops > > item freeze and thaw functions to the BUI/BUD items so that they can > > take advantage of this new feature. This fixes a UAF bug in the > > deferred bunmapi code because xfs_bui_recover can schedule another BUI > > to continue unmapping but drops the inode pointer immediately > > afterwards. > > I'm only looking over this the first time, but why can't we just keep > inode reference around during reocvery instead of this fairly > complicated scheme to save the ino and then look it up again? > I'm also a little confused about the use after free in the first place. Doesn't xfs_bui_recover() look up the inode itself, or is the issue that xfs_bui_recover() is fine but we might get into xfs_bmap_update_finish_item() sometime later on the same inode without any reference? If the latter, similarly to Christoph I wonder if we really could/should grab a reference on the inode for the intent itself, even though that might not be necessary outside of recovery. Either way, more details about the problem being fixed in the commit log would be helpful. Brian