]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/proc/proc_sysctl.c
fs: rcu-walk for path lookup
[mirror_ubuntu-bionic-kernel.git] / fs / proc / proc_sysctl.c
index b652cb00906b02927c7f4afa048d6bd83615936d..998e3a715bcc2132b2c635c534ddd935641bde9a 100644 (file)
@@ -392,20 +392,25 @@ static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd)
        return !PROC_I(dentry->d_inode)->sysctl->unregistering;
 }
 
-static int proc_sys_delete(struct dentry *dentry)
+static int proc_sys_delete(const struct dentry *dentry)
 {
        return !!PROC_I(dentry->d_inode)->sysctl->unregistering;
 }
 
-static int proc_sys_compare(struct dentry *dir, struct qstr *qstr,
-                           struct qstr *name)
+static int proc_sys_compare(const struct dentry *parent,
+               const struct inode *pinode,
+               const struct dentry *dentry, const struct inode *inode,
+               unsigned int len, const char *str, const struct qstr *name)
 {
-       struct dentry *dentry = container_of(qstr, struct dentry, d_name);
-       if (qstr->len != name->len)
+       /* Although proc doesn't have negative dentries, rcu-walk means
+        * that inode here can be NULL */
+       if (!inode)
+               return 0;
+       if (name->len != len)
                return 1;
-       if (memcmp(qstr->name, name->name, name->len))
+       if (memcmp(name->name, str, len))
                return 1;
-       return !sysctl_is_seen(PROC_I(dentry->d_inode)->sysctl);
+       return !sysctl_is_seen(PROC_I(inode)->sysctl);
 }
 
 static const struct dentry_operations proc_sys_dentry_operations = {