RE: [PATCH v2] hfsplus: fix s_fs_info leak on mount setup failure

From: Viacheslav Dubeyko

Date: Wed Feb 04 2026 - 18:04:43 EST


On Wed, 2026-02-04 at 18:25 +0000, Al Viro wrote:
> On Wed, Feb 04, 2026 at 05:52:57PM +0000, Al Viro wrote:
> > On Wed, Feb 04, 2026 at 05:40:47PM +0000, Al Viro wrote:
> > > On Wed, Feb 04, 2026 at 05:30:29PM +0000, Al Viro wrote:
> > >
> > > > While we are at it, this
> > > > kfree(sbi->s_vhdr_buf);
> > > > kfree(sbi->s_backup_vhdr_buf);
> > > > might as well go into ->kill_sb(). That would result in the (untested)
> > > > delta below and IMO it's easier to follow that way...
> > >
> > > AFAICS once you've got ->s_root set, you can just return an error and
> > > be done with that - regular cleanup should take care of those parts
> > > (note that iput(NULL) is explicitly a no-op and the same goes for
> > > cancel_delayed_work_sync() on something that has never been through
> > > queue_delayed_work()).
> >
> > Scratch the last one - you'd get nls leak that way, thanks to the
> > trickery in there... Depending on how much do you dislike cleanup.h
> > stuff, there might be a way to deal with that, though...
>
> See viro/vfs.git #untested.hfsplus (I've applied leak fix to your
> #for-next, commits in question are done on top of that).
>
> It builds, but I've done no other testing on it. And nls.h bit
> needs to be discussed on fsdevel, obviously.

OK. Let me spend some time on testing and reviewing the fix.

Thanks,
Slava.