add patch fix-reference-counting-bug-on-block-allocation
[ext4-patch-queue.git] / correct-error-value-of-function-verifying-dx-checksum
blob8a956c54cf336ed3e03e27a277c9138bd3a05348
1 ext4: correct error value of function verifying dx checksum
3 From: Daeho Jeong <daeho.jeong@samsung.com>
5 ext4_dx_csum_verify() returns the success return value in two checksum
6 verification failure cases. We need to set the return values to zero
7 as failure like ext4_dirent_csum_verify() returning zero when failing
8 to find a checksum dirent at the tail.
10 Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
13 ---
14  fs/ext4/namei.c |    4 ++--
15  1 file changed, 2 insertions(+), 2 deletions(-)
17 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
18 index 48e4b89..ec811bb 100644
19 --- a/fs/ext4/namei.c
20 +++ b/fs/ext4/namei.c
21 @@ -446,14 +446,14 @@ static int ext4_dx_csum_verify(struct inode *inode,
22         c = get_dx_countlimit(inode, dirent, &count_offset);
23         if (!c) {
24                 EXT4_ERROR_INODE(inode, "dir seems corrupt?  Run e2fsck -D.");
25 -               return 1;
26 +               return 0;
27         }
28         limit = le16_to_cpu(c->limit);
29         count = le16_to_cpu(c->count);
30         if (count_offset + (limit * sizeof(struct dx_entry)) >
31             EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
32                 warn_no_space_for_csum(inode);
33 -               return 1;
34 +               return 0;
35         }
36         t = (struct dx_tail *)(((struct dx_entry *)c) + limit);
38 -- 
39 1.7.9.5