Re: [PATCH 1/2] libxfs: zero the struct xfs_mount when unmounting the filesystem

Darrick J. Wong
2020-02-25T18:31:03Z

On Tue, Feb 25, 2020 at 09:40:38AM -0800, Christoph Hellwig wrote:
> On Mon, Feb 24, 2020 at 04:11:20PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Since libxfs doesn't allocate the struct xfs_mount *, we can't just free
> > it during unmount. Zero its contents to prevent any use-after-free.
>
> I don't really this at all. Seems to be cargo-cult style programming.

Admittedly I'm not convinced it's necessary either, seeing as we control
all the callers, and none of them actually screw this up. But I defer
to the maintainer. ;)

(If anything I'm more afraid of the "libxfs_xinit_t x;" but that's a
different cleanup for another time.)

--D