mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>
Cc: "jack@suse.cz" <jack@suse.cz>,
	"frank.li@vivo.com" <frank.li@vivo.com>,
	"brauner@kernel.org" <brauner@kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"shardul.b@mpiricsoftware.com" <shardul.b@mpiricsoftware.com>,
	"shardulsb08@gmail.com" <shardulsb08@gmail.com>,
	"janak@mpiricsoftware.com" <janak@mpiricsoftware.com>,
	"glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"syzbot+99f6ed51479b86ac4c41@syzkaller.appspotmail.com"
	<syzbot+99f6ed51479b86ac4c41@syzkaller.appspotmail.com>
Subject: RE: [PATCH v2] hfsplus: fix s_fs_info leak on mount setup failure
Date: Wed, 11 Feb 2026 23:49:13 +0000	[thread overview]
Message-ID: <6b378df8d9a6f7ecdb448ff3b3dd3c739c4334ab.camel@ibm.com> (raw)
In-Reply-To: <20260211020331.GJ3183987@ZenIV>

On Wed, 2026-02-11 at 02:03 +0000, Al Viro wrote:
> On Fri, Feb 06, 2026 at 10:22:20PM +0000, Viacheslav Dubeyko wrote:
> 
> > I did run the xfstests for HFS+ with viro/vfs.git #untested.hfsplus. Everything
> > looks good, I don't see any new issues. Currently, around 29 test-cases fail for
> > HFS+. I see the same number of failures with applied patchset.
> > 
> > The code looks good. And I am ready to take the patchset into HFS/HFS+ tree.
> > Would you like to send the pathset for nls.h modification discussion?
> 
> FWIW, I wonder what the hell is that code doing:
>         err = -EINVAL;
>         if (!sbi->nls) {
>                 /* try utf8 first, as this is the old default behaviour */
>                 sbi->nls = load_nls("utf8");
>                 if (!sbi->nls)
>                         sbi->nls = load_nls_default();
>         }

As far as I can see, this code has been carefully moved from
hfsplus_parse_options() by this commit [1]. Also, we have logic of loading nls
in hfsplus_parse_param() [2].

It looks like redundant code to me. The whole logic looks like:
(1) try to load nls during parsing mount options;
(2) temporary load of "utf8" for hidden dir search;
(3) return previously loaded (or NULL) nls back.

Thanks,
Slava. 

>  
>         /* temporarily use utf8 to correctly find the hidden dir below */
>         nls = sbi->nls;   
>         sbi->nls = load_nls("utf8");
>         if (!sbi->nls) {
>                 pr_err("unable to load nls for utf8\n");
>                 goto out_unload_nls;
>         }
> 
> If load_nls("utf8") fails on the first call, I don't see how the second one
> might succeed.  What's the intended behaviour here?
> 
> What that code actually does is
> 	* if UTF8 isn't loadable, fail hard, no matter what
> 	* if it is loadable, use it for the duration of fill_super,
> then if we had something configured, switch back to that, otherwise
> stay with UTF8.

[1] https://lore.kernel.org/all/20240916172735.866916-6-sandeen@redhat.com/
[2] https://elixir.bootlin.com/linux/v6.19-rc5/source/fs/hfsplus/options.c#L118

      reply	other threads:[~2026-02-11 23:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-01 13:12 Shardul Bankar
2026-02-02 17:53 ` Viacheslav Dubeyko
2026-02-03  4:38   ` Al Viro
2026-02-03 23:35     ` Viacheslav Dubeyko
2026-02-04  4:19       ` Shardul Bankar
2026-02-04 17:04         ` [PATCH] hfsplus: avoid double unload_nls() on mount failure Shardul Bankar
2026-02-05 23:08           ` Viacheslav Dubeyko
2026-02-04 17:30       ` [PATCH v2] hfsplus: fix s_fs_info leak on mount setup failure Al Viro
2026-02-04 17:40         ` Al Viro
2026-02-04 17:52           ` Al Viro
2026-02-04 18:25             ` Al Viro
2026-02-04 23:04               ` Viacheslav Dubeyko
2026-02-06 22:22               ` Viacheslav Dubeyko
2026-02-11  2:03                 ` Al Viro
2026-02-11 23:49                   ` Viacheslav Dubeyko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b378df8d9a6f7ecdb448ff3b3dd3c739c4334ab.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=brauner@kernel.org \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jack@suse.cz \
    --cc=janak@mpiricsoftware.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shardul.b@mpiricsoftware.com \
    --cc=shardulsb08@gmail.com \
    --cc=slava@dubeyko.com \
    --cc=syzbot+99f6ed51479b86ac4c41@syzkaller.appspotmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®