diff options
author | Dan Robertson <dan@dlrobertson.com> | 2021-06-23 21:52:41 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-28 21:10:22 -0400 |
commit | d05005e41a62b45fc60bd9aba02bdd1bd14a9da2 (patch) | |
tree | e8e0e2f1b04fd44fba8821e5b21ef6021f599944 /fs/bcachefs/acl.c | |
parent | d909ab113d0a5902ec6c6dfc3e649d55fbfd4708 (diff) |
bcachefs: Fix bch2_acl_chmod() cleanup on error
Avoid calling kfree on the returned error pointer if
bch2_acl_from_disk fails.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Diffstat (limited to 'fs/bcachefs/acl.c')
-rw-r--r-- | fs/bcachefs/acl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c index be31d27443bc..1642518d3233 100644 --- a/fs/bcachefs/acl.c +++ b/fs/bcachefs/acl.c @@ -372,7 +372,7 @@ int bch2_acl_chmod(struct btree_trans *trans, acl = bch2_acl_from_disk(xattr_val(xattr.v), le16_to_cpu(xattr.v->x_val_len)); ret = PTR_ERR_OR_ZERO(acl); - if (ret || !acl) + if (IS_ERR_OR_NULL(acl)) goto err; ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); @@ -391,7 +391,8 @@ int bch2_acl_chmod(struct btree_trans *trans, acl = NULL; err: bch2_trans_iter_put(trans, iter); - kfree(acl); + if (!IS_ERR_OR_NULL(acl)) + kfree(acl); return ret; } |