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-next>] [day] [month] [year] [list]
Date:   Sun, 3 May 2020 14:00:25 +0100
From:   Jonny Grant <jg@...k.org>
To:     linux-ext4@...r.kernel.org
Subject: /fs/ext4/namei.c ext4_find_dest_de()

Hi

I noticed that mkdir() returns EEXIST if a directory already exists. 
strerror(EEXIST) text is "File exists"

Can ext4_find_dest_de() be amended to return EISDIR if a directory 
already exists? This will make the error message clearer.

This is the line of code from ext4_find_dest_de():

if (ext4_match(dir, fname, de))
			return -EEXIST;



I propose to change to something like the following:


int ext4_match_result = ext4_match(dir, fname, de);

		nlen = EXT4_DIR_REC_LEN(de->name_len);
		rlen = ext4_rec_len_from_disk(de->rec_len, buf_size);
		if ((de->inode ? rlen - nlen : rlen) >= reclen)
			break;
		de = (struct ext4_dir_entry_2 *)((char *)de + rlen);

if (ext4_match_result)
{
     if(EXT4_FT_DIR == de->file_type)
     {
         return -EISDIR;
     }
     else
     {
	return -EEXIST;
     }
}



Let me know if this would be supported, and I can prepare a patch.

Cheers
Jonny

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ