1. 11 4月, 2017 1 次提交
  2. 07 4月, 2017 1 次提交
    • S
      Handle mismatched open calls · 38bd4906
      Sachin Prabhu 提交于
      A signal can interrupt a SendReceive call which result in incoming
      responses to the call being ignored. This is a problem for calls such as
      open which results in the successful response being ignored. This
      results in an open file resource on the server.
      
      The patch looks into responses which were cancelled after being sent and
      in case of successful open closes the open fids.
      
      For this patch, the check is only done in SendReceive2()
      
      RH-bz: 1403319
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Cc: Stable <stable@vger.kernel.org>
      38bd4906
  3. 03 3月, 2017 1 次提交
  4. 02 3月, 2017 1 次提交
  5. 02 2月, 2017 4 次提交
  6. 25 12月, 2016 1 次提交
  7. 29 11月, 2016 1 次提交
    • E
      CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix() · ae9ebe7c
      Eryu Guan 提交于
      Commit 2211d5ba ("posix_acl: xattr representation cleanups")
      removes the typedefs and the zero-length a_entries array in struct
      posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header
      and struct posix_acl_xattr_entry directly.
      
      But it failed to iterate over posix acl slots when converting posix
      acls to CIFS format, which results in several test failures in
      xfstests (generic/053 generic/105) when testing against a samba v1
      server, starting from v4.9-rc1 kernel. e.g.
      
        [root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
        --- tests/generic/105.out       2016-09-19 16:33:28.577962575 +0800
        +++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800
        @@ -1,3 +1,4 @@
         QA output created by 105
         -rw-r--r-- root
        +setfacl: subdir: Invalid argument
         -rw-r--r-- root
      
      Fix it by introducing a new "ace" var, like what
      cifs_copy_posix_acl() does, and iterating posix acl xattr entries
      over it in the for loop.
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      ae9ebe7c
  8. 13 10月, 2016 1 次提交
  9. 28 9月, 2016 2 次提交
  10. 24 4月, 2016 1 次提交
  11. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  12. 29 3月, 2016 1 次提交
  13. 29 2月, 2016 1 次提交
  14. 20 8月, 2015 1 次提交
    • C
      cifs: Fix use-after-free on mid_q_entry · 5fb4e288
      Christopher Oo 提交于
      With CIFS_DEBUG_2 enabled, additional debug information is tracked inside each
      mid_q_entry struct, however cifs_save_when_sent may use the mid_q_entry after it
      has been freed from the appropriate callback if the transport layer has very low
      latency. Holding the srv_mutex fixes this use-after-free, as cifs_save_when_sent
      is called while the srv_mutex is held while the request is sent.
      Signed-off-by: NChristopher Oo <t-chriso@microsoft.com>
      5fb4e288
  15. 28 6月, 2015 1 次提交
  16. 21 5月, 2015 1 次提交
    • D
      CIFS: remove an unneeded NULL check · 65c3b205
      Dan Carpenter 提交于
      Smatch complains because we dereference "ses->server" without checking
      some lines earlier inside the call to get_next_mid(ses->server).
      
      	fs/cifs/cifssmb.c:4921 CIFSGetDFSRefer()
      	warn: variable dereferenced before check 'ses->server' (see line 4899)
      
      There is only one caller for this function get_dfs_path() and it always
      passes a non-null "ses->server" pointer so this NULL check can be
      removed.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      65c3b205
  17. 11 5月, 2015 1 次提交
  18. 16 4月, 2015 1 次提交
  19. 11 12月, 2014 1 次提交
  20. 17 10月, 2014 1 次提交
    • S
      Remap reserved posix characters by default (part 3/3) · 2baa2682
      Steve French 提交于
      This is a bigger patch, but its size is mostly due to
      a single change for how we check for remapping illegal characters
      in file names - a lot of repeated, small changes to
      the way callers request converting file names.
      
      The final patch in the series does the following:
      
      1) changes default behavior for cifs to be more intuitive.
      Currently we do not map by default to seven reserved characters,
      ie those valid in POSIX but not in NTFS/CIFS/SMB3/Windows,
      unless a mount option (mapchars) is specified.  Change this
      to by default always map and map using the SFM maping
      (like the Mac uses) unless the server negotiates the CIFS Unix
      Extensions (like Samba does when mounting with the cifs protocol)
      when the remapping of the characters is unnecessary.  This should
      help SMB3 mounts in particular since Samba will likely be
      able to implement this mapping with its new "vfs_fruit" module
      as it will be doing for the Mac.
      2) if the user specifies the existing "mapchars" mount option then
      use the "SFU" (Microsoft Services for Unix, SUA) style mapping of
      the seven characters instead.
      3) if the user specifies "nomapposix" then disable SFM/MAC style mapping
      (so no character remapping would be used unless the user specifies
      "mapchars" on mount as well, as above).
      4) change all the places in the code that check for the superblock
      flag on the mount which is set by mapchars and passed in on all
      path based operation and change it to use a small function call
      instead to set the mapping type properly (and check for the
      mapping type in the cifs unicode functions)
      Signed-off-by: NSteve French <smfrench@gmail.com>
      2baa2682
  21. 02 8月, 2014 5 次提交
  22. 01 8月, 2014 1 次提交
  23. 17 4月, 2014 1 次提交
  24. 08 2月, 2014 2 次提交
  25. 20 1月, 2014 2 次提交
  26. 28 12月, 2013 1 次提交
  27. 16 11月, 2013 1 次提交
    • S
      setfacl removes part of ACL when setting POSIX ACLs to Samba · b1d93356
      Steve French 提交于
      setfacl over cifs mounts can remove the default ACL when setting the
      (non-default part of) the ACL and vice versa (we were leaving at 0
      rather than setting to -1 the count field for the unaffected
      half of the ACL.  For example notice the setfacl removed
      the default ACL in this sequence:
      
      steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir ; setfacl
      -m default:user:test:rwx,user:test:rwx /mnt/test-dir
      getfacl: Removing leading '/' from absolute path names
      user::rwx
      group::r-x
      other::r-x
      default:user::rwx
      default:user:test:rwx
      default:group::r-x
      default:mask::rwx
      default:other::r-x
      
      steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir
      getfacl: Removing leading '/' from absolute path names
      user::rwx
      user:test:rwx
      group::r-x
      mask::rwx
      other::r-x
      
      CC: Stable <stable@kernel.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Acked-by: NJeremy Allison <jra@samba.org>
      b1d93356
  28. 03 11月, 2013 1 次提交
    • S
      Allow setting per-file compression via CIFS protocol · c7f508a9
      Steve French 提交于
      An earlier patch allowed setting the per-file compression flag
      
      "chattr +c filename"
      
      on an smb2 or smb3 mount, and also allowed lsattr to return
      whether a file on a cifs, or smb2/smb3 mount was compressed.
      
      This patch extends the ability to set the per-file
      compression flag to the cifs protocol, which uses a somewhat
      different IOCTL mechanism than SMB2, although the payload
      (the flags stored in the compression_state) are the same.
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      c7f508a9
  29. 06 10月, 2013 1 次提交
    • S
      do not treat non-symlink reparse points as valid symlinks · c31f3307
      Steve French 提交于
      Windows 8 and later can create NFS symlinks (within reparse points)
      which we were assuming were normal NTFS symlinks and thus reporting
      corrupt paths for.  Add check for reparse points to make sure that
      they really are normal symlinks before we try to parse the pathname.
      
      We also should not be parsing other types of reparse points (DFS
      junctions etc) as if they were a  symlink so return EOPNOTSUPP
      on those.  Also fix endian errors (we were not parsing symlink
      lengths as little endian).
      
      This fixes commit d244bf2d
      which implemented follow link for non-Unix CIFS mounts
      
      CC: Stable <stable@kernel.org>
      Reviewed-by: NAndrew Bartlett <abartlet@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      c31f3307
  30. 18 9月, 2013 1 次提交
    • J
      cifs: stop trying to use virtual circuits · 9ae6cf60
      Jeff Layton 提交于
      Currently, we try to ensure that we use vcnum of 0 on the first
      established session on a connection and then try to use a different
      vcnum on each session after that.
      
      This is a little odd, since there's no real reason to use a different
      vcnum for each SMB session. I can only assume there was some confusion
      between SMB sessions and VCs. That's somewhat understandable since they
      both get created during SESSION_SETUP, but the documentation indicates
      that they are really orthogonal. The comment on max_vcs in particular
      looks quite misguided. An SMB session is already uniquely identified
      by the SMB UID value -- there's no need to again uniquely ID with a
      VC.
      
      Furthermore, a vcnum of 0 is a cue to the server that it should release
      any resources that were previously held by the client. This sounds like
      a good thing, until you consider that:
      
      a) it totally ignores the fact that other programs on the box (e.g.
      smbclient) might have connections established to the server. Using a
      vcnum of 0 causes them to get kicked off.
      
      b) it causes problems with NAT. If several clients are connected to the
      same server via the same NAT'ed address, whenever one connects to the
      server it kicks off all the others, which then reconnect and kick off
      the first one...ad nauseum.
      
      I don't see any reason to ignore the advice in "Implementing CIFS" which
      has a comprehensive treatment of virtual circuits. In there, it states
      "...and contrary to the specs the client should always use a VcNumber of
      one, never zero."
      
      Have the client just use a hardcoded vcnum of 1, and stop abusing the
      special behavior of vcnum 0.
      Reported-by: NSauron99@gmx.de <sauron99@gmx.de>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Reviewed-by: NVolker Lendecke <vl@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      9ae6cf60