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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Nov 2017 14:18:37 +0100
From:   Jan Kara <jack@...e.cz>
To:     Chao Yu <yuchao0@...wei.com>
Cc:     jack@...e.com, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, chao@...nel.org
Subject: Re: [PATCH] quota: propagate error from __dquot_initialize

On Fri 17-11-17 10:07:53, Chao Yu wrote:
> In commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()"),
> we have propagated error from __dquot_initialize to caller, but we forgot
> to handle such error in add_dquot_ref(), so, currently, during quota
> accounting information initialization flow, if we failed for some of
> inodes, we just ignore such error, and do account for others, which is
> not a good implementation.
> 
> In this patch, we choose to let user be aware of such error, so after
> turning on quota successfully, we can make sure all inodes disk usage
> can be accounted, which will be more reasonable.

Thanks for the patch! One comment below:

> @@ -2371,10 +2377,18 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
>  	dqopt->flags |= dquot_state_flag(flags, type);
>  	spin_unlock(&dq_state_lock);
>  
> -	add_dquot_ref(sb, type);
> +	error = add_dquot_ref(sb, type);
> +	if (error)
> +		goto out_dquot_flags;
>  
>  	return 0;
> -
> +out_dquot_flags:
> +	spin_lock(&dq_data_lock);
> +	dqopt->info[type].dqi_flags &= ~DQF_SYS_FILE;
> +	spin_unlock(&dq_data_lock);
> +	spin_lock(&dq_state_lock);
> +	dqopt->flags &= ~(dquot_state_flag(flags, type));
> +	spin_unlock(&dq_state_lock);
>  out_file_init:
>  	dqopt->files[type] = NULL;
>  	iput(inode);

This bail out path is not correct. You have to go through full quota off at
this point (dquot_disable() function) as some inodes had already quotas
initialized and can be using them...

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ