5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: guolingxing [ Upstream commit 45a686dff6b91c3667cd8188d3a02c69f62f4d00 ] btrfs_begin_enable_verity() ignores the return value of btrfs_orphan_add() and unconditionally returns 0. If orphan insertion fails, btrfs_orphan_add() aborts the transaction, but the generic fs-verity code still proceeds with Merkle tree construction because the begin_enable_verity callback reported success. Return the error so that fs-verity stops immediately instead of continuing after the initialization failure. The transaction is already aborted by btrfs_orphan_add() and the handle is released by btrfs_end_transaction(), so no additional cleanup is needed. Fixes: 705242538ff3 ("btrfs: verity metadata orphan items") Signed-off-by: guolingxing Reviewed-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/verity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c index 4968535dfff0a..e5d7763fe6e0f 100644 --- a/fs/btrfs/verity.c +++ b/fs/btrfs/verity.c @@ -605,7 +605,7 @@ static int btrfs_begin_enable_verity(struct file *filp) set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags); btrfs_end_transaction(trans); - return 0; + return ret; } /* -- 2.53.0