2019-10-10 08:25:56

by Chengguang Xu

[permalink] [raw]
Subject: (RESEND) [PATCH] ocfs2: Fix error handling in ocfs2_setattr()

Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL
on error case before jump to do dqput().

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/ocfs2/file.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 2e982db3e1ae..53939bf9d7d2 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1230,6 +1230,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid));
if (IS_ERR(transfer_to[USRQUOTA])) {
status = PTR_ERR(transfer_to[USRQUOTA]);
+ transfer_to[USRQUOTA] = NULL;
goto bail_unlock;
}
}
@@ -1239,6 +1240,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid));
if (IS_ERR(transfer_to[GRPQUOTA])) {
status = PTR_ERR(transfer_to[GRPQUOTA]);
+ transfer_to[GRPQUOTA] = NULL;
goto bail_unlock;
}
}
--
2.20.1




2019-10-10 08:57:27

by Joseph Qi

[permalink] [raw]
Subject: Re: (RESEND) [PATCH] ocfs2: Fix error handling in ocfs2_setattr()



On 19/10/10 16:23, Chengguang Xu wrote:
> Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL
> on error case before jump to do dqput().
>
> Signed-off-by: Chengguang Xu <[email protected]>

Looks good.

Reviewed-by: Joseph Qi <[email protected]>
> ---
> fs/ocfs2/file.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 2e982db3e1ae..53939bf9d7d2 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1230,6 +1230,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
> transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid));
> if (IS_ERR(transfer_to[USRQUOTA])) {
> status = PTR_ERR(transfer_to[USRQUOTA]);
> + transfer_to[USRQUOTA] = NULL;
> goto bail_unlock;
> }
> }
> @@ -1239,6 +1240,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
> transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid));
> if (IS_ERR(transfer_to[GRPQUOTA])) {
> status = PTR_ERR(transfer_to[GRPQUOTA]);
> + transfer_to[GRPQUOTA] = NULL;
> goto bail_unlock;
> }
> }
>

2019-10-10 10:06:32

by Changwei Ge

[permalink] [raw]
Subject: Re: [Ocfs2-devel] (RESEND) [PATCH] ocfs2: Fix error handling in ocfs2_setattr()


On 2019/10/10 4:49 下午, Joseph Qi wrote:
>
> On 19/10/10 16:23, Chengguang Xu wrote:
>> Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL
>> on error case before jump to do dqput().
>>
>> Signed-off-by: Chengguang Xu <[email protected]>
> Looks good.
>
> Reviewed-by: Joseph Qi <[email protected]>


Also looks sane to me

Reviewed-by: Changwei Ge <[email protected]>



>> ---
>> fs/ocfs2/file.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
>> index 2e982db3e1ae..53939bf9d7d2 100644
>> --- a/fs/ocfs2/file.c
>> +++ b/fs/ocfs2/file.c
>> @@ -1230,6 +1230,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
>> transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid));
>> if (IS_ERR(transfer_to[USRQUOTA])) {
>> status = PTR_ERR(transfer_to[USRQUOTA]);
>> + transfer_to[USRQUOTA] = NULL;
>> goto bail_unlock;
>> }
>> }
>> @@ -1239,6 +1240,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
>> transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid));
>> if (IS_ERR(transfer_to[GRPQUOTA])) {
>> status = PTR_ERR(transfer_to[GRPQUOTA]);
>> + transfer_to[GRPQUOTA] = NULL;
>> goto bail_unlock;
>> }
>> }
>>
> _______________________________________________
> Ocfs2-devel mailing list
> [email protected]
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel