lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4c72c670-5ec1-404d-8177-bd80fabf4695@163.com>
Date: Wed, 31 Dec 2025 09:37:45 +0800
From: Chi Zhiling <chizhiling@....com>
To: "Yuezhang.Mo@...y.com" <Yuezhang.Mo@...y.com>
Cc: "brauner@...nel.org" <brauner@...nel.org>,
 "chizhiling@...inos.cn" <chizhiling@...inos.cn>, "jack@...e.cz"
 <jack@...e.cz>, "linkinjeon@...nel.org" <linkinjeon@...nel.org>,
 "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "sj1557.seo@...sung.com" <sj1557.seo@...sung.com>,
 "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
 "willy@...radead.org" <willy@...radead.org>
Subject: Re: [PATCH v1 3/9] exfat: reuse cache to improve exfat_get_cluster

On 12/30/25 17:05, Yuezhang.Mo@...y.com wrote:
>> -             if (exfat_ent_get(sb, *dclus, &content, NULL))
>> -                     return -EIO;
>> +             if (exfat_ent_get(sb, *dclus, &content, &bh))
>> +                     goto err;
> 
> As you commented,  the buffer_head needs release if no error return.
> Here, an error was returned, buffer_head had been released.


I mean, it seems like a duplicate release in there, but in fact it's not.

When exfat_ent_get return an error, *bh is released and set to NULL. So 
the second brelse() call in exfat_get_cluster() does nothing.

~~~
int exfat_ent_get(struct super_block *sb, unsigned int loc,
                 unsigned int *content, struct buffer_head **last)
{

	...

err:
         if (last) {
                 brelse(*last);

                 /* Avoid double release */
                 *last = NULL;
         }
         return -EIO;
}
~~~

The reason using "goto err" is that I want to handle all errors in the 
same way. Although this does seem a bit strange and confusing with the 
comment in exfat_ent_get.


Thank,

> 
>>   
>>                *last_dclus = *dclus;
>>                *dclus = content;
>> @@ -299,7 +300,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
>>                                exfat_fs_error(sb,
>>                                       "invalid cluster chain (i_pos %u, last_clus 0x%08x is EOF)",
>>                                       *fclus, (*last_dclus));
>> -                             return -EIO;
>> +                             goto err;
>>                        }
>>
>>                        break;
>> @@ -309,6 +310,10 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
>>                        cache_init(&cid, *fclus, *dclus);
>>        }
>>
>> +     brelse(bh);
>>        exfat_cache_add(inode, &cid);
>>        return 0;
>> +err:
>> +     brelse(bh);
>> +     return -EIO;
>>   }
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ