sysctl: Fix out of bounds access for empty sysctl registers
[platform/kernel/linux-rpi.git] / fs / fuse / readdir.c
index dc60347..9e6d587 100644 (file)
@@ -223,8 +223,8 @@ retry:
                spin_unlock(&fi->lock);
 
                forget_all_cached_acls(inode);
-               fuse_change_attributes(inode, &o->attr,
-                                      entry_attr_timeout(o),
+               fuse_change_attributes(inode, &o->attr, NULL,
+                                      ATTR_TIMEOUT(o),
                                       attr_version);
                /*
                 * The other branch comes via fuse_iget()
@@ -232,7 +232,7 @@ retry:
                 */
        } else {
                inode = fuse_iget(dir->i_sb, o->nodeid, o->generation,
-                                 &o->attr, entry_attr_timeout(o),
+                                 &o->attr, ATTR_TIMEOUT(o),
                                  attr_version);
                if (!inode)
                        inode = ERR_PTR(-ENOMEM);
@@ -243,8 +243,16 @@ retry:
                        dput(dentry);
                        dentry = alias;
                }
-               if (IS_ERR(dentry))
+               if (IS_ERR(dentry)) {
+                       if (!IS_ERR(inode)) {
+                               struct fuse_inode *fi = get_fuse_inode(inode);
+
+                               spin_lock(&fi->lock);
+                               fi->nlookup--;
+                               spin_unlock(&fi->lock);
+                       }
                        return PTR_ERR(dentry);
+               }
        }
        if (fc->readdirplus_auto)
                set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);