mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
fsverity: report validation errors through fserror to fsnotify
Reported verification errors to fsnotify through recently added fserror interface. Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org> Link: https://patch.msgid.link/20261002223705.2175542-2-aalbersh@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
This commit is contained in:
parent
b08e4ee274
commit
1ab73b0f96
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user