1. 24 Sep, 2019 6 commits
    • zhengbin's avatar
      fuse: fix memleak in cuse_channel_open · 9ad09b19
      zhengbin authored
      If cuse_send_init fails, need to fuse_conn_put cc->fc.
      
      cuse_channel_open->fuse_conn_init->refcount_set(&fc->count, 1)
                       ->fuse_dev_alloc->fuse_conn_get
                       ->fuse_dev_free->fuse_conn_put
      
      Fixes: cc080e9e ("fuse: introduce per-instance fuse_dev structure")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarzhengbin <zhengbin13@huawei.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      9ad09b19
    • Tejun Heo's avatar
      fuse: fix beyond-end-of-page access in fuse_parse_cache() · e5854b1c
      Tejun Heo authored
      With DEBUG_PAGEALLOC on, the following triggers.
      
        BUG: unable to handle page fault for address: ffff88859367c000
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 3001067 P4D 3001067 PUD 406d3a8067 PMD 406d30c067 PTE 800ffffa6c983060
        Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
        CPU: 38 PID: 3110657 Comm: python2.7
        RIP: 0010:fuse_readdir+0x88f/0xe7a [fuse]
        Code: 49 8b 4d 08 49 39 4e 60 0f 84 44 04 00 00 48 8b 43 08 43 8d 1c 3c 4d 01 7e 68 49 89 dc 48 03 5c 24 38 49 89 46 60 8b 44 24 30 <8b> 4b 10 44 29 e0 48 89 ca 48 83 c1 1f 48 83 e1 f8 83 f8 17 49 89
        RSP: 0018:ffffc90035edbde0 EFLAGS: 00010286
        RAX: 0000000000001000 RBX: ffff88859367bff0 RCX: 0000000000000000
        RDX: 0000000000000000 RSI: ffff88859367bfed RDI: 0000000000920907
        RBP: ffffc90035edbe90 R08: 000000000000014b R09: 0000000000000004
        R10: ffff88859367b000 R11: 0000000000000000 R12: 0000000000000ff0
        R13: ffffc90035edbee0 R14: ffff889fb8546180 R15: 0000000000000020
        FS:  00007f80b5f4a740(0000) GS:ffff889fffa00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: ffff88859367c000 CR3: 0000001c170c2001 CR4: 00000000003606e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         iterate_dir+0x122/0x180
         __x64_sys_getdents+0xa6/0x140
         do_syscall_64+0x42/0x100
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      It's in fuse_parse_cache().  %rbx (ffff88859367bff0) is fuse_dirent
      pointer - addr + offset.  FUSE_DIRENT_SIZE() is trying to dereference
      namelen off of it but that derefs into the next page which is disabled
      by pagealloc debug causing a PF.
      
      This is caused by dirent->namelen being accessed before ensuring that
      there's enough bytes in the page for the dirent.  Fix it by pushing
      down reclen calculation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: 5d7bc7e8 ("fuse: allow using readdir cache")
      Cc: stable@vger.kernel.org # v4.20+
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      e5854b1c
    • Arnd Bergmann's avatar
      fuse: unexport fuse_put_request · 0ed40593
      Arnd Bergmann authored
      This function has been made static, which now causes a compile-time
      warning:
      
      WARNING: "fuse_put_request" [vmlinux] is a static EXPORT_SYMBOL_GPL
      
      Remove the unneeded export.
      
      Fixes: 66abc359 ("fuse: unexport request ops")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      0ed40593
    • Khazhismel Kumykov's avatar
      fuse: kmemcg account fs data · dc69e98c
      Khazhismel Kumykov authored
      account per-file, dentry, and inode data
      
      blockdev/superblock and temporary per-request data was left alone, as
      this usually isn't accounted
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarKhazhismel Kumykov <khazhy@google.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      dc69e98c
    • Khazhismel Kumykov's avatar
      fuse: on 64-bit store time in d_fsdata directly · 30c6a23d
      Khazhismel Kumykov authored
      Implements the optimization noted in commit f75fdf22 ("fuse: don't
      use ->d_time"), as the additional memory can be significant.  (In
      particular, on SLAB configurations this 8-byte alloc becomes 32 bytes).
      Per-dentry, this can consume significant memory.
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarKhazhismel Kumykov <khazhy@google.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      30c6a23d
    • Vasily Averin's avatar
      fuse: fix missing unlock_page in fuse_writepage() · d5880c7a
      Vasily Averin authored
      unlock_page() was missing in case of an already in-flight write against the
      same page.
      Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Fixes: ff17be08 ("fuse: writepage: skip already in flight")
      Cc: <stable@vger.kernel.org> # v3.13
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      d5880c7a
  2. 12 Sep, 2019 13 commits
  3. 10 Sep, 2019 21 commits