1. 15 2月, 2014 2 次提交
    • P
      CIFS: Fix too big maxBuf size for SMB3 mounts · 2365c4ea
      Pavel Shilovsky 提交于
      SMB3 servers can respond with MaxTransactSize of more than 4M
      that can cause a memory allocation error returned from kmalloc
      in a lock codepath. Also the client doesn't support multicredit
      requests now and allows buffer sizes of 65536 bytes only. Set
      MaxTransactSize to this maximum supported value.
      
      Cc: stable@vger.kernel.org # 3.7+
      Signed-off-by: NPavel Shilovsky <piastry@etersoft.ru>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      2365c4ea
    • J
      cifs: ensure that uncached writes handle unmapped areas correctly · 5d81de8e
      Jeff Layton 提交于
      It's possible for userland to pass down an iovec via writev() that has a
      bogus user pointer in it. If that happens and we're doing an uncached
      write, then we can end up getting less bytes than we expect from the
      call to iov_iter_copy_from_user. This is CVE-2014-0069
      
      cifs_iovec_write isn't set up to handle that situation however. It'll
      blindly keep chugging through the page array and not filling those pages
      with anything useful. Worse yet, we'll later end up with a negative
      number in wdata->tailsz, which will confuse the sending routines and
      cause an oops at the very least.
      
      Fix this by having the copy phase of cifs_iovec_write stop copying data
      in this situation and send the last write as a short one. At the same
      time, we want to avoid sending a zero-length write to the server, so
      break out of the loop and set rc to -EFAULT if that happens. This also
      allows us to handle the case where no address in the iovec is valid.
      
      [Note: Marking this for stable on v3.4+ kernels, but kernels as old as
             v2.6.38 may have a similar problem and may need similar fix]
      
      Cc: <stable@vger.kernel.org> # v3.4+
      Reviewed-by: NPavel Shilovsky <piastry@etersoft.ru>
      Reported-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      5d81de8e
  2. 11 2月, 2014 1 次提交
    • S
      [CIFS] Fix cifsacl mounts over smb2 to not call cifs · 42eacf9e
      Steve French 提交于
      When mounting with smb2/smb3 (e.g. vers=2.1) and cifsacl mount option,
      it was trying to get the mode by querying the acl over the cifs
      rather than smb2 protocol.  This patch makes that protocol
      independent and makes cifsacl smb2 mounts return a more intuitive
      operation not supported error (until we add a worker function
      for smb2_get_acl).
      
      Note that a previous patch fixed getxattr/setxattr for the CIFSACL xattr
      which would unconditionally call cifs_get_acl and cifs_set_acl (even when
      mounted smb2). I made those protocol independent last week (new protocol
      version operations "get_acl" and "set_acl" but did not add an
      smb2_get_acl and smb2_set_acl yet so those now simply return EOPNOTSUPP
      which at least is better than sending cifs requests on smb2 mount)
      
      The previous patches did not fix the one remaining case though ie
      mounting with "cifsacl" when getting mode from acl would unconditionally
      end up calling "cifs_get_acl_from_fid" even for smb2 - so made that protocol
      independent but to make that protocol independent had to make sure that the callers
      were passing the protocol independent handle structure (cifs_fid) instead
      of cifs specific _u16 network file handle (ie cifs_fid instead of cifs_fid->fid)
      
      Now mount with smb2 and cifsacl mount options will return EOPNOTSUP (instead
      of timing out) and a future patch will add smb2 operations (e.g. get_smb2_acl)
      to enable this.
      Signed-off-by: NSteve French <smfrench@gmail.com>
      42eacf9e
  3. 08 2月, 2014 4 次提交
  4. 31 1月, 2014 1 次提交
  5. 27 1月, 2014 1 次提交
  6. 20 1月, 2014 12 次提交
  7. 28 12月, 2013 3 次提交
  8. 25 11月, 2013 1 次提交
    • S
      [CIFS] Do not use btrfs refcopy ioctl for SMB2 copy offload · f19e84df
      Steve French 提交于
      Change cifs.ko to using CIFS_IOCTL_COPYCHUNK instead
      of BTRFS_IOC_CLONE to avoid confusion about whether
      copy-on-write is required or optional for this operation.
      
      SMB2/SMB3 copyoffload had used the BTRFS_IOC_CLONE ioctl since
      they both speed up copy by offloading the copy rather than
      passing many read and write requests back and forth and both have
      identical syntax (passing file handles), but for SMB2/SMB3
      CopyChunk the server is not required to use copy-on-write
      to make a copy of the file (although some do), and Christoph
      has commented that since CopyChunk does not require
      copy-on-write we should not reuse BTRFS_IOC_CLONE.
      
      This patch renames the ioctl to use a cifs specific IOCTL
      CIFS_IOCTL_COPYCHUNK.  This ioctl is particularly important
      for SMB2/SMB3 since large file copy over the network otherwise
      can be very slow, and with this is often more than 100 times
      faster putting less load on server and client.
      
      Note that if a copy syscall is ever introduced, depending on
      its requirements/format it could end up using one of the other
      three methods that CIFS/SMB2/SMB3 can do for copy offload,
      but this method is particularly useful for file copy
      and broadly supported (not just by Samba server).
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Reviewed-by: NDavid Disseldorp <ddiss@samba.org>
      f19e84df
  9. 20 11月, 2013 1 次提交
  10. 19 11月, 2013 2 次提交
  11. 16 11月, 2013 3 次提交
    • S
      [CIFS] Warn if SMB3 encryption required by server · 0cbaa53c
      Steve French 提交于
      We do not support SMB3 encryption yet, warn if server responds
      that SMB3 encryption is mandatory.
      Signed-off-by: NSteve French <smfrench@gmail.com>
      0cbaa53c
    • 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
    • S
      [CIFS] Set copychunk defaults · de9f68df
      Steve French 提交于
      Patch 2 of the copy chunk series (the final patch will
      use these to handle copies of files larger than the chunk size.
      
      We set the same defaults that Windows and Samba expect for
      CopyChunk.
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NDavid Disseldorp <ddiss@samba.org>
      de9f68df
  12. 14 11月, 2013 1 次提交
    • S
      CIFS: SMB2/SMB3 Copy offload support (refcopy) phase 1 · 41c1358e
      Steve French 提交于
      This first patch adds the ability for us to do a server side copy
      (ie fast copy offloaded to the server to perform, aka refcopy)
      
      "cp --reflink"
      
      of one file to another located on the same server.  This
      is much faster than traditional copy (which requires
      reading and writing over the network and extra
      memcpys).
      
      This first version is not going to be copy
      files larger than about 1MB (to Samba) until I add
      support for multiple chunks and for autoconfiguring
      the chunksize.
      
      It includes:
      1) processing of the ioctl
      2) marshalling and sending the SMB2/SMB3 fsctl over the network
      3) simple parsing of the response
      
      It does not include yet (these will be in followon patches to come soon):
      1) support for multiple chunks
      2) support for autoconfiguring and remembering the chunksize
      3) Support for the older style copychunk which Samba 4.1 server supports
      (because this requires write permission on the target file, which
      cp does not give you, apparently per-posix).  This may require
      a distinct tool (other than cp) and other ioctl to implement.
      Reviewed-by: NPavel Shilovsky <piastry@etersoft.ru>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      41c1358e
  13. 12 11月, 2013 5 次提交
  14. 03 11月, 2013 3 次提交
    • S
      Query network adapter info at mount time for debugging · c481e9fe
      Steve French 提交于
      When CONFIG_CIFS_STATS2 enabled query adapter info for debugging
      
      It is easy now in SMB3 to query the information about the server's
      network interfaces (and at least Windows 8 and above do this, if not
      other clients) there are some useful pieces of information you can get
      including:
      
      - all of the network interfaces that the server advertises (not just
      the one you are mounting over), and with SMB3 supporting multichannel
      this helps with more than just failover (also aggregating multiple
      sockets under one mount)
      
      - whether the adapter supports RSS (useful to know if you want to
      estimate whether setting up two or more socket connections to the same
      address is going to be faster due to RSS offload in the adapter)
      
      - whether the server supports RDMA
      
      - whether the server has IPv6 interfaces (if you connected over IPv4
      but prefer IPv6 e.g.)
      
      - what the link speed is (you might want to reconnect over a higher
      speed interface if available)
      
      (Of course we could also rerequest this on every mount cheaplly to the
      same server, as Windows apparently does, so we can update the adapter
      info on new mounts, and also on every reconnect if the network
      interface drops temporarily - so we don't have to rely on info from
      the first mount to this server)
      
      It is trivial to request this information - and certainly will be useful
      when we get to the point of doing multichannel (and eventually RDMA),
      but some of this (linkspeed etc.) info may help for debugging in
      the meantime.  Enable this request when CONFIG_CIFS_STATS2 is on
      (only for smb3 mounts since it is an SMB3 or later ioctl).
      Signed-off-by: NSteve French <smfrench@gmail.com>
      c481e9fe
    • S
      Fix unused variable warning when CIFS POSIX disabled · f10d9ba4
      Steve French 提交于
      Fix unused variable warning when CONFIG_CIFS_POSIX disabled.
      
         fs/cifs/ioctl.c: In function 'cifs_ioctl':
      >> fs/cifs/ioctl.c:40:8: warning: unused variable 'ExtAttrMask' [-Wunused-variable]
           __u64 ExtAttrMask = 0;
                 ^
      Pointed out by 0-DAY kernel build testing backend
      Signed-off-by: NSteve French <smfrench@gmail.com>
      f10d9ba4
    • 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