1. 02 4月, 2019 1 次提交
    • S
      smb3: Fix enumerating snapshots to Azure · 153322f7
      Steve French 提交于
      Some servers (see MS-SMB2 protocol specification
      section 3.3.5.15.1) expect that the FSCTL enumerate snapshots
      is done twice, with the first query having EXACTLY the minimum
      size response buffer requested (16 bytes) which refreshes
      the snapshot list (otherwise that and subsequent queries get
      an empty list returned).  So had to add code to set
      the maximum response size differently for the first snapshot
      query (which gets the size needed for the second query which
      contains the actual list of snapshots).
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org> # 4.19+
      153322f7
  2. 23 3月, 2019 2 次提交
    • S
      SMB3: Fix SMB3.1.1 guest mounts to Samba · 8c11a607
      Steve French 提交于
      Workaround problem with Samba responses to SMB3.1.1
      null user (guest) mounts.  The server doesn't set the
      expected flag in the session setup response so we have
      to do a similar check to what is done in smb3_validate_negotiate
      where we also check if the user is a null user (but not sec=krb5
      since username might not be passed in on mount for Kerberos case).
      
      Note that the commit below tightened the conditions and forced signing
      for the SMB2-TreeConnect commands as per MS-SMB2.
      However, this should only apply to normal user sessions and not for
      cases where there is no user (even if server forgets to set the flag
      in the response) since we don't have anything useful to sign with.
      This is especially important now that the more secure SMB3.1.1 protocol
      is in the default dialect list.
      
      An earlier patch ("cifs: allow guest mounts to work for smb3.11") fixed
      the guest mounts to Windows.
      
          Fixes: 6188f28b ("Tree connect for SMB3.1.1 must be signed for non-encrypted shares")
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Reviewed-by: NPaulo Alcantara <palcantara@suse.de>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      8c11a607
    • R
      cifs: allow guest mounts to work for smb3.11 · e71ab2aa
      Ronnie Sahlberg 提交于
      Fix Guest/Anonymous sessions so that they work with SMB 3.11.
      
      The commit noted below tightened the conditions and forced signing for
      the SMB2-TreeConnect commands as per MS-SMB2.
      However, this should only apply to normal user sessions and not for
      Guest/Anonumous sessions.
      
      Fixes: 6188f28b ("Tree connect for SMB3.1.1 must be signed for non-encrypted shares")
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      e71ab2aa
  3. 15 3月, 2019 3 次提交
  4. 06 3月, 2019 12 次提交
  5. 05 3月, 2019 4 次提交
  6. 31 1月, 2019 1 次提交
  7. 30 1月, 2019 3 次提交
  8. 25 1月, 2019 1 次提交
  9. 24 1月, 2019 1 次提交
    • C
      cifs: fix memory leak of an allocated cifs_ntsd structure · 73aaf920
      Colin Ian King 提交于
      The call to SMB2_queary_acl can allocate memory to pntsd and also
      return a failure via a call to SMB2_query_acl (and then query_info).
      This occurs when query_info allocates the structure and then in
      query_info the call to smb2_validate_and_copy_iov fails. Currently the
      failure just returns without kfree'ing pntsd hence causing a memory
      leak.
      
      Currently, *data is allocated if it's not already pointing to a buffer,
      so it needs to be kfree'd only if was allocated in query_info, so the
      fix adds an allocated flag to track this.  Also set *dlen to zero on
      an error just to be safe since *data is kfree'd.
      
      Also set errno to -ENOMEM if the allocation of *data fails.
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NDan Carpener <dan.carpenter@oracle.com>
      73aaf920
  10. 11 1月, 2019 2 次提交
  11. 04 1月, 2019 1 次提交
  12. 29 12月, 2018 2 次提交
  13. 24 12月, 2018 1 次提交
  14. 03 11月, 2018 2 次提交
    • S
      smb3: allow more detailed protocol info on open files for debugging · dfe33f9a
      Steve French 提交于
      In order to debug complex problems it is often helpful to
      have detailed information on the client and server view
      of the open file information.  Add the ability for root to
      view the list of smb3 open files and dump the persistent
      handle and other info so that it can be more easily
      correlated with server logs.
      
      Sample output from "cat /proc/fs/cifs/open_files"
      
       # Version:1
       # Format:
       # <tree id> <persistent fid> <flags> <count> <pid> <uid> <filename> <mid>
       0x5 0x800000378 0x8000 1 7704 0 some-file 0x14
       0xcb903c0c 0x84412e67 0x8000 1 7754 1001 rofile 0x1a6d
       0xcb903c0c 0x9526b767 0x8000 1 7720 1000 file 0x1a5b
       0xcb903c0c 0x9ce41a21 0x8000 1 7715 0 smallfile 0xd67
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      dfe33f9a
    • S
      smb3: add trace point for tree connection · f8af49dd
      Steve French 提交于
      In debugging certain scenarios, especially reconnect cases,
      it can be helpful to have a dynamic trace point for the
      result of tree connect.  See sample output below
      from a reconnect event. The new event is 'smb3_tcon'
      
                  TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
                     | |       |   ||||       |         |
                 cifsd-6071  [001] ....  2659.897923: smb3_reconnect: server=localhost current_mid=0xa
           kworker/1:1-71    [001] ....  2666.026342: smb3_cmd_done: 	sid=0x0 tid=0x0 cmd=0 mid=0
           kworker/1:1-71    [001] ....  2666.026576: smb3_cmd_err: 	sid=0xc49e1787 tid=0x0 cmd=1 mid=1 status=0xc0000016 rc=-5
           kworker/1:1-71    [001] ....  2666.031677: smb3_cmd_done: 	sid=0xc49e1787 tid=0x0 cmd=1 mid=2
           kworker/1:1-71    [001] ....  2666.031921: smb3_cmd_done: 	sid=0xc49e1787 tid=0x6e78f05f cmd=3 mid=3
           kworker/1:1-71    [001] ....  2666.031923: smb3_tcon: xid=0 sid=0xc49e1787 tid=0x0 unc_name=\\localhost\test rc=0
           kworker/1:1-71    [001] ....  2666.032097: smb3_cmd_done: 	sid=0xc49e1787 tid=0x6e78f05f cmd=11 mid=4
           kworker/1:1-71    [001] ....  2666.032265: smb3_cmd_done: 	sid=0xc49e1787 tid=0x7912332f cmd=3 mid=5
           kworker/1:1-71    [001] ....  2666.032266: smb3_tcon: xid=0 sid=0xc49e1787 tid=0x0 unc_name=\\localhost\IPC$ rc=0
           kworker/1:1-71    [001] ....  2666.032386: smb3_cmd_done: 	sid=0xc49e1787 tid=0x7912332f cmd=11 mid=6
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      f8af49dd
  15. 24 10月, 2018 4 次提交
    • R
      cifs: allow calling SMB2_xxx_free(NULL) · 32a1fb36
      Ronnie Sahlberg 提交于
      Change these free functions to allow passing NULL as the argument and
      treat it as a no-op just like free(NULL) would.
      Or, if rqst->rq_iov is NULL.
      
      The second scenario could happen for smb2_queryfs() if the call
      to SMB2_query_info_init() fails and we go to qfs_exit to clean up
      and free all resources.
      In that case we have not yet assigned rqst[2].rq_iov and thus
      the rq_iov dereference in SMB2_close_free() will cause a NULL pointer
      dereference.
      
      Fixes:  1eb9fb52 ("cifs: create SMB2_open_init()/SMB2_open_free() helpers")
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      CC: Stable <stable@vger.kernel.org>
      32a1fb36
    • S
      smb3: show number of current open files in /proc/fs/cifs/Stats · fae8044c
      Steve French 提交于
      To allow better debugging (for example applications with
      handle leaks, or complex reconnect scenarios) display the
      number of open files (on the client) and number of open
      server file handles for each tcon in /proc/fs/cifs/Stats.
      Note that open files on server is one larger than local
      due to handle caching (in this case of the root of
      the share).  In this example there are two local
      open files, and three (two file and one directory handle)
      open on the server.
      
      Sample output:
      
      $ cat /proc/fs/cifs/Stats
      Resources in use
      CIFS Session: 1
      Share (unique mount targets): 2
      SMB Request/Response Buffer: 1 Pool size: 5
      SMB Small Req/Resp Buffer: 1 Pool size: 30
      Operations (MIDs): 0
      
      0 session 0 share reconnects
      Total vfs operations: 36 maximum at one time: 2
      
      1) \\localhost\test
      SMBs: 69
      Bytes read: 27  Bytes written: 0
      Open files: 2 total (local), 3 open on server
      TreeConnects: 1 total 0 failed
      TreeDisconnects: 0 total 0 failed
      Creates: 19 total 0 failed
      Closes: 16 total 0 failed
      ...
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      fae8044c
    • R
      cifs: add IOCTL for QUERY_INFO passthrough to userspace · f5b05d62
      Ronnie Sahlberg 提交于
      This allows userspace tools to query the raw info levels for cifs files
      and process the response in userspace.
      In particular this is useful for many of those data where there is no
      corresponding native data structure in linux.
      For example querying the security descriptor for a file and extract the
      SIDs.
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      f5b05d62
    • G
      fs/cifs: fix uninitialised variable warnings · ef2298a0
      Garry McNulty 提交于
      In some error conditions, resp_buftype can be passed uninitialised to
      free_rsp_buf(), potentially resulting in a spurious debug message.
      If resp_buftype randomly had the value 1 (CIFS_SMALL_BUFFER) then this
      would log a debug message.
      The rsp pointer is initialised to NULL so there is no other side-effect.
      
      Detected by CoverityScan, CID 1438585 ("Uninitialized scalar variable")
      Detected by CoverityScan, CID 1438667 ("Uninitialized scalar variable")
      Detected by CoverityScan, CID 1438764 ("Uninitialized scalar variable")
      Signed-off-by: NGarry McNulty <garrmcnu@gmail.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      ef2298a0