From cf4be895f9e3c40cebc7c85ee049386b927d1ee3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 22 Mar 2026 23:28:40 +0000 Subject: WIP verify after lock Signed-off-by: Leah Rowe --- util/nvmutil/lib/file.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c index f3ef15cb..a4ce7b89 100644 --- a/util/nvmutil/lib/file.c +++ b/util/nvmutil/lib/file.c @@ -1001,11 +1001,8 @@ int secure_file(int *fd, goto err_secure_file; if (expected != NULL) { - if (st_now.st_dev != expected->st_dev || - st_now.st_ino != expected->st_ino) { - errno = ESTALE; + if (fd_verify_identity(*fd, expected, &st_now) < 0) goto err_secure_file; - } } *st = st_now; @@ -1052,6 +1049,11 @@ int secure_file(int *fd, if (do_lock) { if (lock_file(*fd, flags) == -1) goto err_secure_file; + + if (expected != NULL) { + if (fd_verify_identity(*fd, expected, &st_now) < 0) + goto err_secure_file; + } } if (fchmod(*fd, mode) == -1) -- cgit v1.2.1