1. 14 6月, 2011 3 次提交
    • J
      cifs: correctly handle NULL tcon pointer in CIFSTCon · 8d1bca32
      Jeff Layton 提交于
      Long ago (in commit 00e485b0), I added some code to handle share-level
      passwords in CIFSTCon. That code ignored the fact that it's legit to
      pass in a NULL tcon pointer when connecting to the IPC$ share on the
      server.
      
      This wasn't really a problem until recently as we only called CIFSTCon
      this way when the server returned -EREMOTE. With the introduction of
      commit c1508ca2 however, it gets called this way on every mount, causing
      an oops when share-level security is in effect.
      
      Fix this by simply treating a NULL tcon pointer as if user-level
      security were in effect. I'm not aware of any servers that protect the
      IPC$ share with a specific password anyway. Also, add a comment to the
      top of CIFSTCon to ensure that we don't make the same mistake again.
      
      Cc: <stable@kernel.org>
      Reported-by: NMartijn Uffing <mp3project@sarijopen.student.utwente.nl>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      8d1bca32
    • J
      cifs: don't allow cifs_reconnect to exit with NULL socket pointer · 7fdbaa1b
      Jeff Layton 提交于
      It's possible for the following set of events to happen:
      
      cifsd calls cifs_reconnect which reconnects the socket. A userspace
      process then calls cifs_negotiate_protocol to handle the NEGOTIATE and
      gets a reply. But, while processing the reply, cifsd calls
      cifs_reconnect again.  Eventually the GlobalMid_Lock is dropped and the
      reply from the earlier NEGOTIATE completes and the tcpStatus is set to
      CifsGood. cifs_reconnect then goes through and closes the socket and sets the
      pointer to zero, but because the status is now CifsGood, the new socket
      is not created and cifs_reconnect exits with the socket pointer set to
      NULL.
      
      Fix this by only setting the tcpStatus to CifsGood if the tcpStatus is
      CifsNeedNegotiate, and by making sure that generic_ip_connect is always
      called at least once in cifs_reconnect.
      
      Note that this is not a perfect fix for this issue. It's still possible
      that the NEGOTIATE reply is handled after the socket has been closed and
      reconnected. In that case, the socket state will look correct but it no
      NEGOTIATE was performed on it be for the wrong socket. In that situation
      though the server should just shut down the socket on the next attempted
      send, rather than causing the oops that occurs today.
      
      Cc: <stable@kernel.org> # .38.x: fd88ce93: [CIFS] cifs: clarify the meaning of tcpStatus == CifsGood
      Reported-and-Tested-by: NBen Greear <greearb@candelatech.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      7fdbaa1b
    • P
      CIFS: Fix sparse error · cd51875d
      Pavel Shilovsky 提交于
      cifs_sb_master_tlink was declared as inline, but without a definition.
      Remove the declaration and move the definition up.
      Signed-off-by: NPavel Shilovsky <piastryyy@gmail.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      cd51875d
  2. 09 6月, 2011 1 次提交
  3. 06 6月, 2011 1 次提交
  4. 03 6月, 2011 1 次提交
  5. 27 5月, 2011 5 次提交
  6. 26 5月, 2011 1 次提交
    • J
      cifs: clean up wsize negotiation and allow for larger wsize · f7910cbd
      Jeff Layton 提交于
      Now that we can handle larger wsizes in writepages, fix up the
      negotiation of the wsize to allow for that. find_get_pages only seems to
      give out a max of 256 pages at a time, so that gives us a reasonable
      default of 1M for the wsize.
      
      If the server however does not support large writes via POSIX
      extensions, then we cap the wsize to (128k - PAGE_CACHE_SIZE). That
      gives us a size that goes up to the max frame size specified in RFC1001.
      
      Finally, if CAP_LARGE_WRITE_AND_X isn't set, then further cap it to the
      largest size allowed by the protocol (USHRT_MAX).
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Reviewed-and-Tested-by: NPavel Shilovsky <piastry@etersoft.ru>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      f7910cbd
  7. 24 5月, 2011 4 次提交
  8. 19 5月, 2011 10 次提交
  9. 18 5月, 2011 1 次提交
  10. 03 5月, 2011 2 次提交
  11. 29 4月, 2011 1 次提交
  12. 22 4月, 2011 1 次提交
  13. 12 4月, 2011 6 次提交
    • S
      [CIFS] Warn on requesting default security (ntlm) on mount · d9b94201
      Steve French 提交于
      Warn once if default security (ntlm) requested. We will
      update the default to the stronger security mechanism
      (ntlmv2) in 2.6.41.  Kerberos is also stronger than
      ntlm, but more servers support ntlmv2 and ntlmv2
      does not require an upcall, so ntlmv2 is a better
      default.
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      CC: Suresh Jayaraman <sjayaraman@suse.de>
      Reviewed-by: NShirish Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      d9b94201
    • S
      [CIFS] cifs: clarify the meaning of tcpStatus == CifsGood · fd88ce93
      Steve French 提交于
      When the TCP_Server_Info is first allocated and connected, tcpStatus ==
      CifsGood means that the NEGOTIATE_PROTOCOL request has completed and the
      socket is ready for other calls. cifs_reconnect however sets tcpStatus
      to CifsGood as soon as the socket is reconnected and the optional
      RFC1001 session setup is done. We have no clear way to tell the
      difference between these two states, and we need to know this in order
      to know whether we can send an echo or not.
      
      Resolve this by adding a new statusEnum value -- CifsNeedNegotiate. When
      the socket has been connected but has not yet had a NEGOTIATE_PROTOCOL
      request done, set it to this value. Once the NEGOTIATE is done,
      cifs_negotiate_protocol will set tcpStatus to CifsGood.
      
      This also fixes and cleans the logic in cifs_reconnect and
      cifs_reconnect_tcon. The old code checked for specific states when what
      it really wants to know is whether the state has actually changed from
      CifsNeedReconnect.
      Reported-and-Tested-by: NJG <jg@cms.ac>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      fd88ce93
    • J
      cifs: clean up length checks in check2ndT2 · c0c7b905
      Jeff Layton 提交于
      Thus spake David Howells:
      
      The code that follows this:
      
        	remaining = total_data_size - data_in_this_rsp;
      	if (remaining == 0)
      		return 0;
      	else if (remaining < 0) {
      
      generates better code if you drop the 'remaining' variable and compare
      the values directly.
      
      Clean it up per his recommendation...
      Reported-and-acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      c0c7b905
    • J
      cifs: always do is_path_accessible check in cifs_mount · 70945643
      Jeff Layton 提交于
      Currently, we skip doing the is_path_accessible check in cifs_mount if
      there is no prefixpath. I have a report of at least one server however
      that allows a TREE_CONNECT to a share that has a DFS referral at its
      root. The reporter in this case was using a UNC that had no prefixpath,
      so the is_path_accessible check was not triggered and the box later hit
      a BUG() because we were chasing a DFS referral on the root dentry for
      the mount.
      
      This patch fixes this by removing the check for a zero-length
      prefixpath.  That should make the is_path_accessible check be done in
      this situation and should allow the client to chase the DFS referral at
      mount time instead.
      
      Cc: stable@kernel.org
      Reported-and-Tested-by: NYogesh Sharma <ysharma@cymer.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      70945643
    • S
      Elminate sparse __CHECK_ENDIAN__ warnings on port conversion · 6da97910
      Steve French 提交于
      Ports are __be16 not unsigned short int
      
      Eliminates the remaining fixable endian warnings:
      
      ~/cifs-2.6$ make modules C=1 M=fs/cifs CF=-D__CHECK_ENDIAN__
        CHECK   fs/cifs/connect.c
      fs/cifs/connect.c:2408:23: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2408:23:    expected unsigned short *sport
      fs/cifs/connect.c:2408:23:    got restricted __be16 *<noident>
      fs/cifs/connect.c:2410:23: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2410:23:    expected unsigned short *sport
      fs/cifs/connect.c:2410:23:    got restricted __be16 *<noident>
      fs/cifs/connect.c:2416:24: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2416:24:    expected unsigned short [unsigned] [short] <noident>
      fs/cifs/connect.c:2416:24:    got restricted __be16 [usertype] <noident>
      fs/cifs/connect.c:2423:24: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2423:24:    expected unsigned short [unsigned] [short] <noident>
      fs/cifs/connect.c:2423:24:    got restricted __be16 [usertype] <noident>
      fs/cifs/connect.c:2326:23: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2326:23:    expected unsigned short [unsigned] sport
      fs/cifs/connect.c:2326:23:    got restricted __be16 [usertype] sin6_port
      fs/cifs/connect.c:2330:23: warning: incorrect type in assignment (different base types)
      fs/cifs/connect.c:2330:23:    expected unsigned short [unsigned] sport
      fs/cifs/connect.c:2330:23:    got restricted __be16 [usertype] sin_port
      fs/cifs/connect.c:2394:22: warning: restricted __be16 degrades to integer
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      6da97910
    • S
      Allow user names longer than 32 bytes · 8727c8a8
      Steve French 提交于
      We artificially limited the user name to 32 bytes, but modern servers handle
      larger.  Set the maximum length to a reasonable 256, and make the user name
      string dynamically allocated rather than a fixed size in session structure.
      Also clean up old checkpatch warning.
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      8727c8a8
  14. 31 3月, 2011 1 次提交
  15. 11 2月, 2011 1 次提交
    • J
      cifs: don't always drop malformed replies on the floor (try #3) · 71823baf
      Jeff Layton 提交于
      Slight revision to this patch...use min_t() instead of conditional
      assignment. Also, remove the FIXME comment and replace it with the
      explanation that Steve gave earlier.
      
      After receiving a packet, we currently check the header. If it's no
      good, then we toss it out and continue the loop, leaving the caller
      waiting on that response.
      
      In cases where the packet has length inconsistencies, but the MID is
      valid, this leads to unneeded delays. That's especially problematic now
      that the client waits indefinitely for responses.
      
      Instead, don't immediately discard the packet if checkSMB fails. Try to
      find a matching mid_q_entry, mark it as having a malformed response and
      issue the callback.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      71823baf
  16. 10 2月, 2011 1 次提交