The "ret = bkey_err(k);" assignment was accidentally left out so the
call to bch2_btree_iter_peek_slot() is not checked for errors.

Fixes: 53306e096d91 ("bcachefs: Always check for transaction restarts")
Signed-off-by: Dan Carpenter <[email protected]>
---
 fs/bcachefs/acl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c
index 6b1579e96dfe..f3809897f00a 100644
--- a/fs/bcachefs/acl.c
+++ b/fs/bcachefs/acl.c
@@ -427,9 +427,10 @@ int bch2_acl_chmod(struct btree_trans *trans, subvol_inum 
inum,
                return bch2_err_matches(ret, ENOENT) ? 0 : ret;
 
        k = bch2_btree_iter_peek_slot(&iter);
-       xattr = bkey_s_c_to_xattr(k);
+       ret = bkey_err(k);
        if (ret)
                goto err;
+       xattr = bkey_s_c_to_xattr(k);
 
        acl = bch2_acl_from_disk(trans, xattr_val(xattr.v),
                        le16_to_cpu(xattr.v->x_val_len));
-- 
2.39.2

Reply via email to