* [PATCH] tracefs: Fix potential null dereference in default_file_open()
@ 2019-08-12 0:28 Ben Hutchings
0 siblings, 0 replies; only message in thread
From: Ben Hutchings @ 2019-08-12 0:28 UTC (permalink / raw)
To: jmorris
Cc: linux-security-module, Matthew Garrett, Steven Rostedt,
Reinhard Karcher, 934304
[-- Attachment #1: Type: text/plain, Size: 856 bytes --]
The "open" operation in struct file_operations is optional, and
ftrace_event_id_fops does not set it. In default_file_open(), after
all other checks have passed, return 0 if the underlying struct
file_operations does not implement open.
Fixes: 757ff7244358 ("tracefs: Restrict tracefs when the kernel is …")
References: https://bugs.debian.org/934304
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
fs/tracefs/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 34da48036e08..761af8ce4015 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -42,6 +42,8 @@ static int default_open_file(struct inode *inode, struct file *filp)
return ret;
real_fops = dentry->d_fsdata;
+ if (!real_fops->open)
+ return 0;
return real_fops->open(inode, filp);
}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-12 0:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 0:28 [PATCH] tracefs: Fix potential null dereference in default_file_open() Ben Hutchings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).