Skip to contentSkip to conversation

fs/backing_file: fix wrong argument in callback

PATCH In review Amir Goldstein 2 participants 2 messages Nov 26, 2024

Subsystems (2)
lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 fs/backing_file: fix wrong argument in callback

Commit 48b50624aec4 ("backing-file: clean up the API") unintentionally changed the argument in the ->accessed() callback from the user file to the backing file.

Fixes 48b50624aec4 ("backing-file: clean up the API")
Reported-by [email protected]
---
 fs/backing-file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/backing-file.c +2 -1
index 526ddb4d6f76..cbdad8b68474 100644
@@ -327,6 +327,7 @@ int backing_file_mmap(struct file *file, struct vm_area_struct *vma,
 		      struct backing_file_ctx *ctx)
 {
 	const struct cred *old_cred;
+	struct file *user_file = vma->vm_file;
 	int ret;
 
 	if (WARN_ON_ONCE(!(file->f_mode & FMODE_BACKING)))
@@ -342,7 +343,7 @@ int backing_file_mmap(struct file *file, struct vm_area_struct *vma,
 	revert_creds_light(old_cred);
 
 	if (ctx->accessed)
-		ctx->accessed(vma->vm_file);
+		ctx->accessed(user_file);
 
 	return ret;
 }
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Amir Goldstein

Commit 48b50624aec4 ("backing-file: clean up the API") unintentionally changed the argument in the ->accessed() callback from the user file to the backing file.

Fixes 48b50624aec4 ("backing-file: clean up the API")
Reported-by [email protected]

Thanks for fixing.

Miklos