Re: [PATCH] smb: client: convert DFS prefix from cache charset on reconnect
From: Paulo Alcantara
Date: Thu Nov 26 2026 - 07:15:20 EST
Fredric Cover <fredric.cover.lkernel@xxxxxxxxx> writes:
> The DFS referral cache stores paths and target strings in UTF-8
> (cache_cp), whereas cifs_sb->prepath must be encoded in the mount's
> local charset (cifs_sb->local_nls).
>
> When reconnecting a DFS link in tree_connect_dfs_target(),
> dfs_cache_get_tgt_share() returns @prefix in cache_cp, which was
> passed directly to cifs_update_super_prepath(). On mounts using a
> non-UTF-8 iocharset such as iso8859-1, this overwrites
> cifs_sb->prepath with UTF-8 bytes. Subsequent operations then
> re-encode cifs_sb->prepath to UTF-16LE using cifs_sb->local_nls,
> corrupting non-ASCII characters on the wire and causing lookups to
> fail with -ENOENT.
>
> Add dfs_cache_local_path() to convert a path from cache_cp to a
> caller-specified codepage via UTF-16, and use it in a new
> set_super_prepath_from_cache() helper called by
> tree_connect_dfs_target() so cifs_sb->prepath stays in
> cifs_sb->local_nls across reconnects.
> ...
Applied.