1. 08 5月, 2019 2 次提交
  2. 25 4月, 2019 1 次提交
  3. 16 4月, 2019 3 次提交
    • Z
      cifs: Fix lease buffer length error · b57a55e2
      ZhangXiaoxu 提交于
      There is a KASAN slab-out-of-bounds:
      BUG: KASAN: slab-out-of-bounds in _copy_from_iter_full+0x783/0xaa0
      Read of size 80 at addr ffff88810c35e180 by task mount.cifs/539
      
      CPU: 1 PID: 539 Comm: mount.cifs Not tainted 4.19 #10
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
                  rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014
      Call Trace:
       dump_stack+0xdd/0x12a
       print_address_description+0xa7/0x540
       kasan_report+0x1ff/0x550
       check_memory_region+0x2f1/0x310
       memcpy+0x2f/0x80
       _copy_from_iter_full+0x783/0xaa0
       tcp_sendmsg_locked+0x1840/0x4140
       tcp_sendmsg+0x37/0x60
       inet_sendmsg+0x18c/0x490
       sock_sendmsg+0xae/0x130
       smb_send_kvec+0x29c/0x520
       __smb_send_rqst+0x3ef/0xc60
       smb_send_rqst+0x25a/0x2e0
       compound_send_recv+0x9e8/0x2af0
       cifs_send_recv+0x24/0x30
       SMB2_open+0x35e/0x1620
       open_shroot+0x27b/0x490
       smb2_open_op_close+0x4e1/0x590
       smb2_query_path_info+0x2ac/0x650
       cifs_get_inode_info+0x1058/0x28f0
       cifs_root_iget+0x3bb/0xf80
       cifs_smb3_do_mount+0xe00/0x14c0
       cifs_do_mount+0x15/0x20
       mount_fs+0x5e/0x290
       vfs_kern_mount+0x88/0x460
       do_mount+0x398/0x31e0
       ksys_mount+0xc6/0x150
       __x64_sys_mount+0xea/0x190
       do_syscall_64+0x122/0x590
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      It can be reproduced by the following step:
        1. samba configured with: server max protocol = SMB2_10
        2. mount -o vers=default
      
      When parse the mount version parameter, the 'ops' and 'vals'
      was setted to smb30,  if negotiate result is smb21, just
      update the 'ops' to smb21, but the 'vals' is still smb30.
      When add lease context, the iov_base is allocated with smb21
      ops, but the iov_len is initiallited with the smb30. Because
      the iov_len is longer than iov_base, when send the message,
      copy array out of bounds.
      
      we need to keep the 'ops' and 'vals' consistent.
      
      Fixes: 9764c02f ("SMB3: Add support for multidialect negotiate (SMB2.1 and later)")
      Fixes: d5c7076b ("smb3: add smb3.1.1 to default dialect list")
      Signed-off-by: NZhangXiaoxu <zhangxiaoxu5@huawei.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      CC: Stable <stable@vger.kernel.org>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      b57a55e2
    • Z
      cifs: Fix use-after-free in SMB2_read · 088aaf17
      ZhangXiaoxu 提交于
      There is a KASAN use-after-free:
      BUG: KASAN: use-after-free in SMB2_read+0x1136/0x1190
      Read of size 8 at addr ffff8880b4e45e50 by task ln/1009
      
      Should not release the 'req' because it will use in the trace.
      
      Fixes: eccb4422 ("smb3: Add ftrace tracepoints for improved SMB3 debugging")
      Signed-off-by: NZhangXiaoxu <zhangxiaoxu5@huawei.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      CC: Stable <stable@vger.kernel.org> 4.18+
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      088aaf17
    • Z
      cifs: Fix use-after-free in SMB2_write · 6a3eb336
      ZhangXiaoxu 提交于
      There is a KASAN use-after-free:
      BUG: KASAN: use-after-free in SMB2_write+0x1342/0x1580
      Read of size 8 at addr ffff8880b6a8e450 by task ln/4196
      
      Should not release the 'req' because it will use in the trace.
      
      Fixes: eccb4422 ("smb3: Add ftrace tracepoints for improved SMB3 debugging")
      Signed-off-by: NZhangXiaoxu <zhangxiaoxu5@huawei.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      CC: Stable <stable@vger.kernel.org> 4.18+
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      6a3eb336
  4. 02 4月, 2019 2 次提交
    • S
      SMB3: Allow persistent handle timeout to be configurable on mount · ca567eb2
      Steve French 提交于
      Reconnecting after server or network failure can be improved
      (to maintain availability and protect data integrity) by allowing
      the client to choose the default persistent (or resilient)
      handle timeout in some use cases.  Today we default to 0 which lets
      the server pick the default timeout (usually 120 seconds) but this
      can be problematic for some workloads.  Add the new mount parameter
      to cifs.ko for SMB3 mounts "handletimeout" which enables the user
      to override the default handle timeout for persistent (mount
      option "persistenthandles") or resilient handles (mount option
      "resilienthandles").  Maximum allowed is 16 minutes (960000 ms).
      Units for the timeout are expressed in milliseconds. See
      section 2.2.14.2.12 and 2.2.31.3 of the MS-SMB2 protocol
      specification for more information.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      ca567eb2
    • 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
  5. 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
  6. 15 3月, 2019 3 次提交
  7. 06 3月, 2019 12 次提交
  8. 05 3月, 2019 4 次提交
  9. 31 1月, 2019 1 次提交
  10. 30 1月, 2019 3 次提交
  11. 25 1月, 2019 1 次提交
  12. 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
  13. 11 1月, 2019 2 次提交
  14. 04 1月, 2019 1 次提交
  15. 29 12月, 2018 2 次提交