Commit 31029f2f authored by Dan Robertson's avatar Dan Robertson Committed by Kent Overstreet

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: default avatarDan Robertson <dan@dlrobertson.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent e8e9607f
...@@ -372,7 +372,7 @@ int bch2_acl_chmod(struct btree_trans *trans, ...@@ -372,7 +372,7 @@ int bch2_acl_chmod(struct btree_trans *trans,
acl = bch2_acl_from_disk(xattr_val(xattr.v), acl = bch2_acl_from_disk(xattr_val(xattr.v),
le16_to_cpu(xattr.v->x_val_len)); le16_to_cpu(xattr.v->x_val_len));
ret = PTR_ERR_OR_ZERO(acl); ret = PTR_ERR_OR_ZERO(acl);
if (ret || !acl) if (IS_ERR_OR_NULL(acl))
goto err; goto err;
ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
...@@ -391,6 +391,7 @@ int bch2_acl_chmod(struct btree_trans *trans, ...@@ -391,6 +391,7 @@ int bch2_acl_chmod(struct btree_trans *trans,
acl = NULL; acl = NULL;
err: err:
bch2_trans_iter_put(trans, iter); bch2_trans_iter_put(trans, iter);
if (!IS_ERR_OR_NULL(acl))
kfree(acl); kfree(acl);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment