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: <87wmydrhfa.fsf@suse.de>
Date:   Wed, 02 Aug 2023 09:12:57 +0100
From:   Luís Henriques <lhenriques@...e.de>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     Theodore Ts'o <tytso@....edu>,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: fix memory leak in ext4_fname_setup_filename()
 error path

Eric Biggers <ebiggers@...nel.org> writes:

> On Tue, Aug 01, 2023 at 03:41:36PM +0100, Luís Henriques wrote:
>> If casefolding the filename fails, we'll be leaking fscrypt_buf name.
>> Make sure we free it in the error path.
>> 
>> Signed-off-by: Luís Henriques <lhenriques@...e.de>
>> ---
>>  fs/ext4/crypto.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
>> index e20ac0654b3f..9e4503b051c4 100644
>> --- a/fs/ext4/crypto.c
>> +++ b/fs/ext4/crypto.c
>> @@ -33,6 +33,8 @@ int ext4_fname_setup_filename(struct inode *dir, const struct qstr *iname,
>>  
>>  #if IS_ENABLED(CONFIG_UNICODE)
>>  	err = ext4_fname_setup_ci_filename(dir, iname, fname);
>> +	if (err)
>> +		fscrypt_free_filename(&name);
>>  #endif
>>  	return err;
>>  }
>
> Doesn't ext4_fname_prepare_lookup() have the same bug?

Doh! I looked into that function too and then completely forgot about it.
It may also call fscrypt_setup_filename(), so it has to do the free in the
error path as well.  I'll send out v2 to include that fix too.

> Also, please include a Fixes tag.

Ok, makes sense.  Thanks!

Cheers,
-- 
Luís

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ