Re: [PATCH v2 1/2] ext4: wipe filename upon file deletion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 07, 2021 at 03:42:01PM +0000, Leah Rumancik wrote:
> Zero out filename and file type fields when file is deleted.

Why?

Also what about when a dir_entry is moved?  Wouldn't you want to make sure that
any copies don't get left around?

> 
> Signed-off-by: Leah Rumancik <leah.rumancik@xxxxxxxxx>
> ---
>  fs/ext4/namei.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 883e2a7cd4ab..0147c86de99e 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2492,6 +2492,10 @@ int ext4_generic_delete_entry(struct inode *dir,
>  			else
>  				de->inode = 0;
>  			inode_inc_iversion(dir);
> +
> +			memset(de_del->name, 0, de_del->name_len);
> +			memset(&de_del->file_type, 0, sizeof(__u8));

The second line could be written as simply 'de_del->file_type = 0'.

Also why zero these two fields in particular and not the whole dir_entry?

- Eric



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux