tracefs: Fix potential null dereference in default_file_open()
authorBen Hutchings <ben@decadent.org.uk>
Mon, 12 Aug 2019 00:17:32 +0000 (01:17 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 26 Sep 2019 12:19:06 +0000 (13:19 +0100)
commita5091a2cc8edf3de8b86f63d2af982ce8a316ee8
tree9164988a0d719c73ca2cfb3d31d9cfca1e12f6a7
parent5a0a657c15cec2e486a66f4ed517245b470cdd5a
tracefs: Fix potential null dereference in default_file_open()

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>
Gbp-Pq: Topic features/all/lockdown
Gbp-Pq: Name tracefs-fix-potential-null-dereference-in-default_fi.patch
fs/tracefs/inode.c