]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: do not replace volume name after lookup errors
authorDaeMyung Kang <charsyam@gmail.com>
Sat, 30 May 2026 14:35:10 +0000 (23:35 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Fri, 5 Jun 2026 15:20:33 +0000 (00:20 +0900)
commit40d88020d0797f96a93edd2e8edc413c2e2d8f84
treeda7e13c808668f03d71e70945cfbf2ff0dd5bd13
parentd5803e3345dae9c6470bb61869885236276b9a35
ntfs: do not replace volume name after lookup errors

ntfs_write_volume_label() removes an existing $VOLUME_NAME attribute and
then adds the replacement. The old code only distinguished lookup success
from all other results, so any lookup error was treated like an absent
label and the add path still ran.

That is unsafe once lookup-time validation rejects corrupt $VOLUME_NAME
records with -EIO: the corrupt record would remain in place and a second
$VOLUME_NAME record could be appended next to it.

Only add the replacement after the old label was removed successfully or
after lookup returned -ENOENT. Propagate all other lookup errors, and
also stop if removing the old attribute fails.

Cc: stable@vger.kernel.org # v7.1
Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/super.c