]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ocfs2: incorrect check for debugfs returns
authorChengyu Song <csong84@gatech.edu>
Tue, 7 Apr 2015 23:43:55 +0000 (09:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 7 Apr 2015 23:43:55 +0000 (09:43 +1000)
commit09d583ba9a1122b1776b85b1ecf0f889ccd631af
tree038b332de9ffb3aedaf43054fe98d7059e6fe88f
parent0bde4425410fdb13e87d04cd214037f4a845912b
ocfs2: incorrect check for debugfs returns

debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
is not configured, so the return value should be checked against
ERROR_VALUE as well, otherwise the later dereference of the dentry pointer
would crash the kernel.

This patch tries to solve this problem by fixing certain checks. However,
I have that found other call sites are protected by #ifdef CONFIG_DEBUG_FS.
In current implementation, if CONFIG_DEBUG_FS is defined, then the above
two functions will never return any ERROR_VALUE. So another possibility
to fix this is to surround all the buggy checks/functions with the same
#ifdef CONFIG_DEBUG_FS. But I'm not sure if this would break any functionality,
as only OCFS2_FS_STATS declares dependency on DEBUG_FS.

Signed-off-by: Chengyu Song <csong84@gatech.edu>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/dlmglue.c
fs/ocfs2/super.c