1. 02 2月, 2017 3 次提交
  2. 25 12月, 2016 1 次提交
  3. 15 12月, 2016 2 次提交
    • S
      cifs_get_root shouldn't use path with tree name · 374402a2
      Sachin Prabhu 提交于
      When a server returns the optional flag SMB_SHARE_IS_IN_DFS in response
      to a tree connect, cifs_build_path_to_root() will return a pathname
      which includes the hostname. This causes problems with cifs_get_root()
      which separates each component and does a lookup for each component of
      the path which in this case will incorrectly include looking up the
      hostname component as a path component.
      
      We encountered a problem with dfs shares hosted by a Netapp. When
      connecting to nodes pointed to by the DFS share. The tree connect for
      these nodes return SMB_SHARE_IS_IN_DFS resulting failures in lookup
      in cifs_get_root().
      
      RH bz: 1373153
      The patch was tested against a Netapp simulator and by a user using an
      actual Netapp server.
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Reported-by: NPierguido Lambri <plambri@redhat.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      374402a2
    • G
      Fix default behaviour for empty domains and add domainauto option · 39566443
      Germano Percossi 提交于
      With commit 2b149f11 many things have been fixed/introduced.
      However, the default behaviour for RawNTLMSSP authentication
      seems to be wrong in case the domain is not passed on the command line.
      
      The main points (see below) of the patch are:
       - It alignes behaviour with Windows clients
       - It fixes backward compatibility
       - It fixes UPN
      
      I compared this behavour with the one from a Windows 10 command line
      client. When no domains are specified on the command line, I traced
      the packets and observed that the client does send an empty
      domain to the server.
      In the linux kernel case, the empty domain is replaced by the
      primary domain communicated by the SMB server.
      This means that, if the credentials are valid against the local server
      but that server is part of a domain, then the kernel module will
      ask to authenticate against that domain and we will get LOGON failure.
      
      I compared the packet trace from the smbclient when no domain is passed
      and, in that case, a default domain from the client smb.conf is taken.
      Apparently, connection succeeds anyway, because when the domain passed
      is not valid (in my case WORKGROUP), then the local one is tried and
      authentication succeeds. I tried with any kind of invalid domain and
      the result was always a connection.
      
      So, trying to interpret what to do and picking a valid domain if none
      is passed, seems the wrong thing to do.
      To this end, a new option "domainauto" has been added in case the
      user wants a mechanism for guessing.
      
      Without this patch, backward compatibility also is broken.
      With kernel 3.10, the default auth mechanism was NTLM.
      One of our testing servers accepted NTLM and, because no
      domains are passed, authentication was local.
      
      Moving to RawNTLMSSP forced us to change our command line
      to add a fake domain to pass to prevent this mechanism to kick in.
      
      For the same reasons, UPN is broken because the domain is specified
      in the username.
      The SMB server will work out the domain from the UPN and authenticate
      against the right server.
      Without the patch, though, given the domain is empty, it gets replaced
      with another domain that could be the wrong one for the authentication.
      Signed-off-by: NGermano Percossi <germano.percossi@citrix.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      39566443
  4. 06 12月, 2016 1 次提交
    • P
      CIFS: Fix a possible memory corruption during reconnect · 53e0e11e
      Pavel Shilovsky 提交于
      We can not unlock/lock cifs_tcp_ses_lock while walking through ses
      and tcon lists because it can corrupt list iterator pointers and
      a tcon structure can be released if we don't hold an extra reference.
      Fix it by moving a reconnect process to a separate delayed work
      and acquiring a reference to every tcon that needs to be reconnected.
      Also do not send an echo request on newly established connections.
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      53e0e11e
  5. 01 12月, 2016 1 次提交
    • S
      SMB3: parsing for new snapshot timestamp mount parm · 8b217fe7
      Steve French 提交于
      New mount option "snapshot=<time>" to allow mounting an earlier
      version of the remote volume (if such a snapshot exists on
      the server).
      
      Note that eventually specifying a snapshot time of 1 will allow
      the user to mount the oldest snapshot. A subsequent patch
      add the processing for that and another for actually specifying
      the "time warp" create context on SMB2/SMB3 open.
      
      Check to make sure SMB2 negotiated, and ensure that
      we use a different tcon if mount same share twice
      but with different snaphshot times
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      8b217fe7
  6. 29 11月, 2016 1 次提交
  7. 01 11月, 2016 1 次提交
  8. 15 10月, 2016 1 次提交
  9. 13 10月, 2016 3 次提交
  10. 10 9月, 2016 2 次提交
  11. 28 7月, 2016 1 次提交
  12. 20 7月, 2016 1 次提交
    • R
      cifs: unbreak TCP session reuse · b782fcc1
      Rabin Vincent 提交于
      adfeb3e0 ("cifs: Make echo interval tunable") added a comparison of
      vol->echo_interval to server->echo_interval as a criterium to
      match_server(), but:
      
       (1) A default value is set for server->echo_interval but not for
       vol->echo_interval, meaning these can never match if the echo_interval
       option is not specified.
      
       (2) vol->echo_interval is in seconds but server->echo_interval is in
       jiffies, meaning these can never match even if the echo_interval option
       is specified.
      
      This broke TCP session reuse since match_server() can never return 1.
      Fix it.
      
      Fixes: adfeb3e0 ("cifs: Make echo interval tunable")
      Signed-off-by: NRabin Vincent <rabinv@axis.com>
      Acked-by: NSachin Prabhu <sprabhu@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      b782fcc1
  13. 25 6月, 2016 1 次提交
    • S
      Fix reconnect to not defer smb3 session reconnect long after socket reconnect · 4fcd1813
      Steve French 提交于
      Azure server blocks clients that open a socket and don't do anything on it.
      In our reconnect scenarios, we can reconnect the tcp session and
      detect the socket is available but we defer the negprot and SMB3 session
      setup and tree connect reconnection until the next i/o is requested, but
      this looks suspicous to some servers who expect SMB3 negprog and session
      setup soon after a socket is created.
      
      In the echo thread, reconnect SMB3 sessions and tree connections
      that are disconnected.  A later patch will replay persistent (and
      resilient) handle opens.
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      Acked-by: NPavel Shilovsky <pshilovsky@samba.org>
      4fcd1813
  14. 18 5月, 2016 1 次提交
    • S
      cifs: remove any preceding delimiter from prefix_path · 11e31647
      Sachin Prabhu 提交于
      We currently do not check if any delimiter exists before the prefix
      path in cifs_compose_mount_options(). Consequently when building the
      devname using cifs_build_devname() we can end up with multiple
      delimiters separating the UNC and the prefix path.
      
      An issue was reported by the customer mounting a folder within a DFS
      share from a Netapp server which uses McAfee antivirus. We have
      narrowed down the cause to the use of double backslashes in the file
      name used to open the file. This was determined to be caused because of
      additional delimiters as a result of the bug.
      
      In addition to changes in cifs_build_devname(), we also fix
      cifs_parse_devname() to ignore any preceding delimiter for the prefix
      path.
      
      The problem was originally reported on RHEL 6 in RHEL bz 1252721. This
      is the upstream version of the fix. The fix was confirmed by looking at
      the packet capture of a DFS mount.
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      11e31647
  15. 14 4月, 2016 1 次提交
  16. 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
  17. 29 3月, 2016 2 次提交
  18. 11 2月, 2016 1 次提交
  19. 15 1月, 2016 4 次提交
    • R
      cifs: fix race between call_async() and reconnect() · 820962dc
      Rabin Vincent 提交于
      cifs_call_async() queues the MID to the pending list and calls
      smb_send_rqst().  If smb_send_rqst() performs a partial send, it sets
      the tcpStatus to CifsNeedReconnect and returns an error code to
      cifs_call_async().  In this case, cifs_call_async() removes the MID
      from the list and returns to the caller.
      
      However, cifs_call_async() releases the server mutex _before_ removing
      the MID.  This means that a cifs_reconnect() can race with this function
      and manage to remove the MID from the list and delete the entry before
      cifs_call_async() calls cifs_delete_mid().  This leads to various
      crashes due to the use after free in cifs_delete_mid().
      
      Task1				Task2
      
      cifs_call_async():
       - rc = -EAGAIN
       - mutex_unlock(srv_mutex)
      
      				cifs_reconnect():
      				 - mutex_lock(srv_mutex)
      				 - mutex_unlock(srv_mutex)
      				 - list_delete(mid)
      				 - mid->callback()
      				 	cifs_writev_callback():
      				 		- mutex_lock(srv_mutex)
      						- delete(mid)
      				 		- mutex_unlock(srv_mutex)
      
       - cifs_delete_mid(mid) <---- use after free
      
      Fix this by removing the MID in cifs_call_async() before releasing the
      srv_mutex.  Also hold the srv_mutex in cifs_reconnect() until the MIDs
      are moved out of the pending list.
      Signed-off-by: NRabin Vincent <rabin.vincent@axis.com>
      Acked-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <sfrench@localhost.localdomain>
      820962dc
    • S
      Prepare for encryption support (first part). Add decryption and encryption key... · 373512ec
      Steve French 提交于
      Prepare for encryption support (first part). Add decryption and encryption key generation. Thanks to Metze for helping with this.
      Reviewed-by: NStefan Metzmacher <metze@samba.org>
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      373512ec
    • S
      cifs: Make echo interval tunable · adfeb3e0
      Steve French 提交于
      Currently the echo interval is set to 60 seconds using a macro. This
      setting determines the interval at which echo requests are sent to the
      server on an idling connection. This setting also affects the time
      required for a connection to an unresponsive server to timeout.
      
      Making this setting a tunable allows users to control the echo interval
      times as well as control the time after which the connecting to an
      unresponsive server times out.
      
      To set echo interval, pass the echo_interval=n mount option.
      
      Version four of the patch.
      v2: Change MIN and MAX timeout values
      v3: Remove incorrect comment in cifs_get_tcp_session
      v4: Fix bug in setting echo_intervalw
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Acked-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      adfeb3e0
    • A
      Print IP address of unresponsive server · 275516cd
      Arnd Hannemann 提交于
      Before this patch, only the hostname of the server
      is printed when it becomes unresponsive.
      This might not be helpful, if the IP-Address has
      changed since initial mount when the name was
      resolved (e.g. because the IPv6-Prefix changed).
      
      This patch adds the cached IP address of the unresponsive server,
      to the log message.
      Signed-off-by: NArnd Hannemann <arnd@arndnet.de>
      Signed-off-by: NSteve French <sfrench@localhost.localdomain>
      275516cd
  20. 04 11月, 2015 1 次提交
  21. 03 11月, 2015 2 次提交
  22. 21 10月, 2015 1 次提交
    • D
      KEYS: Merge the type-specific data with the payload data · 146aa8b1
      David Howells 提交于
      Merge the type-specific data with the payload data into one four-word chunk
      as it seems pointless to keep them separate.
      
      Use user_key_payload() for accessing the payloads of overloaded
      user-defined keys.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: linux-cifs@vger.kernel.org
      cc: ecryptfs@vger.kernel.org
      cc: linux-ext4@vger.kernel.org
      cc: linux-f2fs-devel@lists.sourceforge.net
      cc: linux-nfs@vger.kernel.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-ima-devel@lists.sourceforge.net
      146aa8b1
  23. 30 6月, 2015 1 次提交
  24. 28 6月, 2015 2 次提交
  25. 21 5月, 2015 1 次提交
    • F
      CIFS: Fix race condition on RFC1002_NEGATIVE_SESSION_RESPONSE · 4afe260b
      Federico Sauter 提交于
      This patch fixes a race condition that occurs when connecting
      to a NT 3.51 host without specifying a NetBIOS name.
      In that case a RFC1002_NEGATIVE_SESSION_RESPONSE is received
      and the SMB negotiation is reattempted, but under some conditions
      it leads SendReceive() to hang forever while waiting for srv_mutex.
      This, in turn, sets the calling process to an uninterruptible sleep
      state and makes it unkillable.
      
      The solution is to unlock the srv_mutex acquired in the demux
      thread *before* going to sleep (after the reconnect error) and
      before reattempting the connection.
      4afe260b
  26. 15 4月, 2015 1 次提交
  27. 01 4月, 2015 2 次提交