staging/lustre/libcfs: Properly handle debugfs read- and write-only files
authorOleg Drokin <green@linuxhacker.ru>
Sat, 6 Feb 2016 07:01:50 +0000 (02:01 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 01:34:58 +0000 (17:34 -0800)
commit49a76d7040b466dd92f198ded4aba3cd3569d48f
treeb822965599fb361b9dfc6c62939ea1b194c417e4
parent5ba907a949562cd4839b0170a13dda6841055e70
staging/lustre/libcfs: Properly handle debugfs read- and write-only files

It turns out that unlike procfs, debugfs does not really enforce
permissions for root (similar to regular filesystems), so we need
to ensure we are not providing ->write() method to read-only files
and ->read() method for write-only files at registration.

This fixes a couple of crashes on unexpected access.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/libcfs/module.c