Avoid calling kfree on the returned error pointer if
bch2_acl_from_disk fails.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
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);
acl = NULL;
err:
bch2_trans_iter_put(trans, iter);
- kfree(acl);
+ if (!IS_ERR_OR_NULL(acl))
+ kfree(acl);
return ret;
}