1. 25 11月, 2019 1 次提交
    • P
      CIFS: Properly process SMB3 lease breaks · 9bd45408
      Pavel Shilovsky 提交于
      Currenly we doesn't assume that a server may break a lease
      from RWH to RW which causes us setting a wrong lease state
      on a file and thus mistakenly flushing data and byte-range
      locks and purging cached data on the client. This leads to
      performance degradation because subsequent IOs go directly
      to the server.
      
      Fix this by propagating new lease state and epoch values
      to the oplock break handler through cifsFileInfo structure
      and removing the use of cifsInodeInfo flags for that. It
      allows to avoid some races of several lease/oplock breaks
      using those flags in parallel.
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      9bd45408
  2. 07 11月, 2019 1 次提交
    • P
      SMB3: Fix persistent handles reconnect · d243af7a
      Pavel Shilovsky 提交于
      When the client hits a network reconnect, it re-opens every open
      file with a create context to reconnect a persistent handle. All
      create context types should be 8-bytes aligned but the padding
      was missed for that one. As a result, some servers don't allow
      us to reconnect handles and return an error. The problem occurs
      when the problematic context is not at the end of the create
      request packet. Fix this by adding a proper padding at the end
      of the reconnect persistent handle context.
      
      Cc: Stable <stable@vger.kernel.org> # 4.19.x
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      d243af7a
  3. 17 9月, 2019 1 次提交
  4. 19 7月, 2019 1 次提交
  5. 11 7月, 2019 1 次提交
  6. 08 7月, 2019 5 次提交
  7. 28 6月, 2019 1 次提交
    • R
      cifs: fix crash querying symlinks stored as reparse-points · 5de254dc
      Ronnie Sahlberg 提交于
      We never parsed/returned any data from .get_link() when the object is a windows reparse-point
      containing a symlink. This results in the VFS layer oopsing accessing an uninitialized buffer:
      
      ...
      [  171.407172] Call Trace:
      [  171.408039]  readlink_copy+0x29/0x70
      [  171.408872]  vfs_readlink+0xc1/0x1f0
      [  171.409709]  ? readlink_copy+0x70/0x70
      [  171.410565]  ? simple_attr_release+0x30/0x30
      [  171.411446]  ? getname_flags+0x105/0x2a0
      [  171.412231]  do_readlinkat+0x1b7/0x1e0
      [  171.412938]  ? __ia32_compat_sys_newfstat+0x30/0x30
      ...
      
      Fix this by adding code to handle these buffers and make sure we do return a valid buffer
      to .get_link()
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      5de254dc
  8. 08 5月, 2019 5 次提交
  9. 15 3月, 2019 1 次提交
  10. 06 3月, 2019 1 次提交
  11. 30 1月, 2019 2 次提交
  12. 04 1月, 2019 1 次提交
  13. 24 12月, 2018 1 次提交
  14. 03 11月, 2018 1 次提交
  15. 24 10月, 2018 2 次提交
  16. 24 8月, 2018 1 次提交
  17. 11 8月, 2018 1 次提交
    • S
      smb3: allow previous versions to be mounted with snapshot= mount parm · cdeaf9d0
      Steve French 提交于
      mounting with the "snapshots=" mount parm allows a read-only
      view of a previous version of a file system (see MS-SMB2
      and "timewarp" tokens, section 2.2.13.2.6) based on the timestamp
      passed in on the snapshots mount parm.
      
      Add processing to optionally send this create context.
      
      Example output:
      
      /mnt1 is mounted with "snapshots=..." and will see an earlier
      version of the directory, with three fewer files than /mnt2
      the current version of the directory.
      
      root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# cat /proc/mounts | grep cifs
      //172.22.149.186/public /mnt1 cifs
      ro,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,snapshot=131748608570000000,actimeo=1
      
      //172.22.149.186/public /mnt2 cifs
      rw,relatime,vers=default,cache=strict,username=smfrench,uid=0,noforceuid,gid=0,noforcegid,addr=172.22.149.186,file_mode=0755,dir_mode=0755,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1
      
      root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1
      EmptyDir  newerdir
      root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt1/newerdir
      
      root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2
      EmptyDir  file  newerdir  newestdir  timestamp-trace.cap
      root@Ubuntu-17-Virtual-Machine:~/cifs-2.6# ls /mnt2/newerdir
      new-file-not-in-snapshot
      
      Snapshots are extremely useful for comparing previous versions of files or directories,
      and recovering from data corruptions or mistakes.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      cdeaf9d0
  18. 10 8月, 2018 1 次提交
  19. 08 8月, 2018 2 次提交
  20. 06 7月, 2018 1 次提交
    • S
      cifs: Fix stack out-of-bounds in smb{2,3}_create_lease_buf() · 729c0c9d
      Stefano Brivio 提交于
      smb{2,3}_create_lease_buf() store a lease key in the lease
      context for later usage on a lease break.
      
      In most paths, the key is currently sourced from data that
      happens to be on the stack near local variables for oplock in
      SMB2_open() callers, e.g. from open_shroot(), whereas
      smb2_open_file() properly allocates space on its stack for it.
      
      The address of those local variables holding the oplock is then
      passed to create_lease_buf handlers via SMB2_open(), and 16
      bytes near oplock are used. This causes a stack out-of-bounds
      access as reported by KASAN on SMB2.1 and SMB3 mounts (first
      out-of-bounds access is shown here):
      
      [  111.528823] BUG: KASAN: stack-out-of-bounds in smb3_create_lease_buf+0x399/0x3b0 [cifs]
      [  111.530815] Read of size 8 at addr ffff88010829f249 by task mount.cifs/985
      [  111.532838] CPU: 3 PID: 985 Comm: mount.cifs Not tainted 4.18.0-rc3+ #91
      [  111.534656] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
      [  111.536838] Call Trace:
      [  111.537528]  dump_stack+0xc2/0x16b
      [  111.540890]  print_address_description+0x6a/0x270
      [  111.542185]  kasan_report+0x258/0x380
      [  111.544701]  smb3_create_lease_buf+0x399/0x3b0 [cifs]
      [  111.546134]  SMB2_open+0x1ef8/0x4b70 [cifs]
      [  111.575883]  open_shroot+0x339/0x550 [cifs]
      [  111.591969]  smb3_qfs_tcon+0x32c/0x1e60 [cifs]
      [  111.617405]  cifs_mount+0x4f3/0x2fc0 [cifs]
      [  111.674332]  cifs_smb3_do_mount+0x263/0xf10 [cifs]
      [  111.677915]  mount_fs+0x55/0x2b0
      [  111.679504]  vfs_kern_mount.part.22+0xaa/0x430
      [  111.684511]  do_mount+0xc40/0x2660
      [  111.698301]  ksys_mount+0x80/0xd0
      [  111.701541]  do_syscall_64+0x14e/0x4b0
      [  111.711807]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  111.713665] RIP: 0033:0x7f372385b5fa
      [  111.715311] Code: 48 8b 0d 99 78 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 66 78 2c 00 f7 d8 64 89 01 48
      [  111.720330] RSP: 002b:00007ffff27049d8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
      [  111.722601] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f372385b5fa
      [  111.724842] RDX: 000055c2ecdc73b2 RSI: 000055c2ecdc73f9 RDI: 00007ffff270580f
      [  111.727083] RBP: 00007ffff2705804 R08: 000055c2ee976060 R09: 0000000000001000
      [  111.729319] R10: 0000000000000000 R11: 0000000000000206 R12: 00007f3723f4d000
      [  111.731615] R13: 000055c2ee976060 R14: 00007f3723f4f90f R15: 0000000000000000
      
      [  111.735448] The buggy address belongs to the page:
      [  111.737420] page:ffffea000420a7c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      [  111.739890] flags: 0x17ffffc0000000()
      [  111.741750] raw: 0017ffffc0000000 0000000000000000 dead000000000200 0000000000000000
      [  111.744216] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
      [  111.746679] page dumped because: kasan: bad access detected
      
      [  111.750482] Memory state around the buggy address:
      [  111.752562]  ffff88010829f100: 00 f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00
      [  111.754991]  ffff88010829f180: 00 00 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
      [  111.757401] >ffff88010829f200: 00 00 00 00 00 f1 f1 f1 f1 01 f2 f2 f2 f2 f2 f2
      [  111.759801]                                               ^
      [  111.762034]  ffff88010829f280: f2 02 f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00
      [  111.764486]  ffff88010829f300: f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [  111.766913] ==================================================================
      
      Lease keys are however already generated and stored in fid data
      on open and create paths: pass them down to the lease context
      creation handlers and use them.
      Suggested-by: NAurélien Aptel <aaptel@suse.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Fixes: b8c32dbb ("CIFS: Request SMB2.1 leases")
      Signed-off-by: NStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      729c0c9d
  21. 15 6月, 2018 1 次提交
  22. 01 6月, 2018 3 次提交
  23. 31 5月, 2018 2 次提交
  24. 24 4月, 2018 1 次提交
  25. 13 4月, 2018 2 次提交