Skip to contentSkip to conversation

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

PATCH Chengguang Xu 3 participants 3 messages Oct 10, 2019 OCFS2

lore
Share & tools
lore
#0 lore raw

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

---
 fs/ocfs2/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/file.c +2 -0
index 2e982db3e1ae..53939bf9d7d2 100644
@@ -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;
 			}
 		}
Signature · 1 line
2.20.1
Reviewed-by
#1 lore raw
Quoted 4 lines · Chengguang Xu

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

Looks good.

Quoted 25 lines
---
 fs/ocfs2/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/file.c +2 -0
index 2e982db3e1ae..53939bf9d7d2 100644
@@ -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;
 			}
 		}
Reviewed-by
#2 lore raw
Quoted 9 lines · Joseph Qi
Quoted 4 lines · Chengguang Xu

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

Looks good.

Also looks sane to me

Quoted 29 lines
Quoted 18 lines
---
  fs/ocfs2/file.c | 2 ++
  1 file changed, 2 insertions(+)
fs/ocfs2/file.c +1 -0
index 2e982db3e1ae..53939bf9d7d2 100644
@@ -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;
  			}
  		}

fs/ocfs2/file.c int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · line 1246

Quoted 7 lines
fs/ocfs2/file.c +1 -0
@@ -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
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel