All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata()
@ 2026-10-21 22:40 Eric Biggers
  2026-10-22  9:17 ` Andrey Albershteyn
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2026-10-21 22:40 UTC (permalink / raw)
  To: fsverity; +Cc: Eric Biggers

The comment in fsverity_ioctl_read_metadata(), which justifies not
checking for FMODE_READ, doesn't consider that the nonstandard access
mode 3 (ioctl-only) exists.

It's reasonable to continue to allow this ioctl in that case, since this
*is* an ioctl, and opening a file with mode 3 checks for read (and
write) access.  However, adjust the comment to not be misleading.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 fs/verity/read_metadata.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/verity/read_metadata.c b/fs/verity/read_metadata.c
index b4c0892430cde..5e81847bdb036 100644
--- a/fs/verity/read_metadata.c
+++ b/fs/verity/read_metadata.c
@@ -170,8 +170,9 @@ int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg)
 	if (!vi)
 		return -ENODATA; /* not a verity file */
 	/*
-	 * Note that we don't have to explicitly check that the file is open for
-	 * reading, since verity files can only be opened for reading.
+	 * No need to check for FMODE_READ.  Verity files can't be open for
+	 * writing, and opening with access mode 3 (ioctl-only) requires read
+	 * (and write) permission, so the opener has read permission either way.
 	 */
 
 	if (copy_from_user(&arg, uarg, sizeof(arg)))

base-commit: ccc4d9f8912a5d9f519a34c3633fe53c8f9b429e
-- 
2.56.0.218.g1ec904b173-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-22 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 22:40 [PATCH] fsverity: Update misleading comment in fsverity_ioctl_read_metadata() Eric Biggers
2026-10-22  9:17 ` Andrey Albershteyn
2026-10-22 19:59   ` Eric Biggers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.