Reported verification errors to fsnotify through recently added fserror
interface.

Reviewed-by: Darrick J. Wong <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Acked-by: Eric Biggers <[email protected]>
Signed-off-by: Andrey Albershteyn <[email protected]>
---
 fs/verity/verify.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index 4004a1d42875..db8c350234bb 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -9,6 +9,7 @@
 
 #include <linux/bio.h>
 #include <linux/export.h>
+#include <linux/fserror.h>
 
 #define FS_VERITY_MAX_PENDING_BLOCKS 2
 
@@ -205,6 +206,8 @@ static bool verify_data_block(struct fsverity_info *vi,
                if (memchr_inv(dblock->data, 0, params->block_size)) {
                        fsverity_err(inode,
                                     "FILE CORRUPTED!  Data past EOF is not 
zeroed");
+                       fserror_report_data_lost(inode, data_pos,
+                                                params->block_size, GFP_NOFS);
                        return false;
                }
                return true;
@@ -312,6 +315,7 @@ static bool verify_data_block(struct fsverity_info *vi,
                data_pos, level - 1, params->hash_alg->name, hsize, want_hash,
                params->hash_alg->name, hsize,
                level == 0 ? dblock->real_hash : real_hash);
+       fserror_report_data_lost(inode, data_pos, params->block_size, GFP_NOFS);
 error:
        for (; level > 0; level--) {
                kunmap_local(hblocks[level - 1].addr);
-- 
2.51.2



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to