diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-14 18:24:53 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-14 18:24:53 +0000 |
| commit | e015e1103ae8e8746c79e726012b98ff678c977d (patch) | |
| tree | 945c25867c6df1061021f910de5c5606a57fe42c | |
| parent | cf5708957b8dab8d273dec4cf5de4797f9bc3879 (diff) | |
util/nvmutil: check inode during post-verify
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index a10758c7..637f6a45 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -1601,6 +1601,7 @@ check_written_part(size_t p) u8 *mem_offset; off_t file_offset; u8 *buf_restore; + struct stat st; if (!part_modified[p]) return; @@ -1613,6 +1614,12 @@ check_written_part(size_t p) memset(pad, 0xff, sizeof(pad)); + if (fstat(gbe_fd, &st) == -1) + err(errno, "%s: fstat (post-write)", fname); + + if (st.st_dev != gbe_dev || st.st_ino != gbe_ino) + err(EIO, "%s: file changed during write", fname); + r = rw_gbe_file_exact(gbe_fd, pad, gbe_rw_size, file_offset, IO_PREAD); |
