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

From: Ethan Ferguson
Date: Wed Oct 01 2025 - 12:34:32 EST


Hi,

On 9/28/25 06:28, Yuezhang.Mo@xxxxxxxx wrote:
> 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
Apologies that I missed that, I would be more than happy to submit a fixed patch for this,
but I checked the dev branch of the exfat tree and noticed some lines were added to fix this
problem in my commit. If true, this is fine by me, and I will sign off on it, but I just
want to make sure that's true, because if so then I don't think another patch by me is needed.

Thank you!