[PATCH 2/3] proc: change proc_sys_evict_inode() to check inode->i_op

From: Oleg Nesterov
Date: Sat Aug 09 2014 - 11:37:31 EST


Change proc_sys_evict_inode() to verify that this inode is really
a /proc/sys inode before using ->sysctl.

---
fs/proc/proc_sysctl.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 2fa67e7..863aaee 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -268,6 +268,10 @@ void proc_sys_evict_inode(struct inode *inode)
{
struct ctl_table_header *head;

+ if (inode->i_op != &proc_sys_inode_operations &&
+ inode->i_op != &proc_sys_dir_operations)
+ return;
+
head = PROC_I(inode)->sysctl;
if (head) {
RCU_INIT_POINTER(PROC_I(inode)->sysctl, NULL);
--
1.5.5.1