fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
[linux-block.git] / fs / proc / proc_sysctl.c
index c41ab261397df2875951db47ea38b7cbe2a5bae1..7da10e59529765200b8db1915c21807a90bde66e 100644 (file)
@@ -707,7 +707,10 @@ static bool proc_sys_link_fill_cache(struct file *file,
                                    struct ctl_table *table)
 {
        bool ret = true;
+
        head = sysctl_head_grab(head);
+       if (IS_ERR(head))
+               return false;
 
        if (S_ISLNK(table->mode)) {
                /* It is not an error if we can not follow the link ignore it */