Re: [PATCH v7 1/1] exfat: Add support for FS_IOC_{GET,SET}FSLABEL

From: Yuezhang.Mo@xxxxxxxx

Date: Sun Sep 28 2025 - 06:29:19 EST


On Fri, Sep 12, 2025 11:26 Ethan Ferguson <ethan.ferguson@xxxxxxxxxx> wrote:
> +int exfat_read_volume_label(struct super_block *sb, struct exfat_uni_name *label_out)
> +{
> + int ret, i;
> + struct exfat_sb_info *sbi = EXFAT_SB(sb);
> + struct exfat_entry_set_cache es;
> + struct exfat_dentry *ep;
> +
> + mutex_lock(&sbi->s_lock);
> +
> + memset(label_out, 0, sizeof(*label_out));
> + ret = exfat_get_volume_label_dentry(sb, &es);
> + if (ret < 0) {
> + /*
> + * ENOENT signifies that a volume label dentry doesn't exist
> + * We will treat this as an empty volume label and not fail.
> + */
> + if (ret == -ENOENT)
> + ret = 0;
> +
> + goto unlock;
> + }
> +
> + ep = exfat_get_dentry_cached(&es, 0);
> + label_out->name_len = ep->dentry.volume_label.char_count;
> + if (label_out->name_len > EXFAT_VOLUME_LABEL_LEN) {
> + ret = -EIO;
> + goto unlock;
> + }
> +
> + for (i = 0; i < label_out->name_len; i++)
> + label_out->name[i] = le16_to_cpu(ep->dentry.volume_label.volume_label[i]);
> +
> +unlock:
> + mutex_unlock(&sbi->s_lock);
> + return ret;
> +}

Hi Ethan Ferguson,

This function has a buffer leak due to a missed call to
exfat_put_dentry_set(). Please fix it.

Thanks