diff options
author | Dan Robertson <dan@dlrobertson.com> | 2021-06-23 21:52:41 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-07-06 13:03:52 -0400 |
commit | dbdf23d46ac3877acc423af571d459975e01dbef (patch) | |
tree | 15ec8218d7f3ba4dd79ab800654b9534488955e0 | |
parent | 664f9847bec525d396d62d2db094ca9020289ae0 (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>
-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 74cb188f74c6..5408a9225fe5 100644 --- a/fs/bcachefs/acl.c +++ b/fs/bcachefs/acl.c @@ -370,7 +370,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); @@ -389,7 +389,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; } |