1. 30 9月, 2010 7 次提交
  2. 15 9月, 2010 1 次提交
    • J
      cifs: fix potential double put of TCP session reference · 460cf341
      Jeff Layton 提交于
      cifs_get_smb_ses must be called on a server pointer on which it holds an
      active reference. It first does a search for an existing SMB session. If
      it finds one, it'll put the server reference and then try to ensure that
      the negprot is done, etc.
      
      If it encounters an error at that point then it'll return an error.
      There's a potential problem here though. When cifs_get_smb_ses returns
      an error, the caller will also put the TCP server reference leading to a
      double-put.
      
      Fix this by having cifs_get_smb_ses only put the server reference if
      it found an existing session that it could use and isn't returning an
      error.
      
      Cc: stable@kernel.org
      Reviewed-by: NSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      460cf341
  3. 09 9月, 2010 4 次提交
    • J
      cifs: prevent possible memory corruption in cifs_demultiplex_thread · 32670396
      Jeff Layton 提交于
      cifs_demultiplex_thread sets the addr.sockAddr.sin_port without any
      regard for the socket family. While it may be that the error in question
      here never occurs on an IPv6 socket, it's probably best to be safe and
      set the port properly if it ever does.
      
      Break the port setting code out of cifs_fill_sockaddr and into a new
      function, and call that from cifs_demultiplex_thread.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      32670396
    • J
      cifs: eliminate some more premature cifsd exits · 7332f2a6
      Jeff Layton 提交于
      If the tcpStatus is still CifsNew, the main cifs_demultiplex_loop can
      break out prematurely in some cases. This is wrong as we will almost
      always have other structures with pointers to the TCP_Server_Info. If
      the main loop breaks under any other condition other than tcpStatus ==
      CifsExiting, then it'll face a use-after-free situation.
      
      I don't see any reason to treat a CifsNew tcpStatus differently than
      CifsGood. I believe we'll still want to attempt to reconnect in either
      case. What should happen in those situations is that the MIDs get marked
      as MID_RETRY_NEEDED. This will make CIFSSMBNegotiate return -EAGAIN, and
      then the caller can retry the whole thing on a newly reconnected socket.
      If that fails again in the same way, the caller of cifs_get_smb_ses
      should tear down the TCP_Server_Info struct.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      7332f2a6
    • J
      cifs: prevent cifsd from exiting prematurely · 522bbe65
      Jeff Layton 提交于
      When cifs_demultiplex_thread exits, it does a number of cleanup tasks
      including freeing the TCP_Server_Info struct. Much of the existing code
      in cifs assumes that when there is a cisfSesInfo struct, that it holds a
      reference to a valid TCP_Server_Info struct.
      
      We can never allow cifsd to exit when a cifsSesInfo struct is still
      holding a reference to the server. The server pointers will then point
      to freed memory.
      
      This patch eliminates a couple of questionable conditions where it does
      this.  The idea here is to make an -EINTR return from kernel_recvmsg
      behave the same way as -ERESTARTSYS or -EAGAIN. If the task was
      signalled from cifs_put_tcp_session, then tcpStatus will be CifsExiting,
      and the kernel_recvmsg call will return quickly.
      
      There's also another condition where this can occur too -- if the
      tcpStatus is still in CifsNew, then it will also exit if the server
      closes the socket prematurely.  I think we'll probably also need to fix
      that situation, but that requires a bit more consideration.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      522bbe65
    • S
      Revert "[CIFS] Fix ntlmv2 auth with ntlmssp" · c8e56f1f
      Steve French 提交于
      This reverts commit 9fbc5908.
      
      The change to kernel crypto and fixes to ntlvm2 and ntlmssp
      series, introduced a regression.  Deferring this patch series
      to 2.6.37 after Shirish fixes it.
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      CC: Shirish Pargaonkar <shirishp@us.ibm.com>
      c8e56f1f
  4. 24 8月, 2010 1 次提交
  5. 21 8月, 2010 1 次提交
  6. 19 8月, 2010 1 次提交
  7. 06 8月, 2010 1 次提交
  8. 02 8月, 2010 11 次提交
  9. 06 5月, 2010 1 次提交
  10. 28 4月, 2010 1 次提交
  11. 27 4月, 2010 5 次提交
  12. 21 4月, 2010 1 次提交
    • J
      [CIFS] Neaten cERROR and cFYI macros, reduce text space · b6b38f70
      Joe Perches 提交于
      Neaten cERROR and cFYI macros, reduce text space
      ~2.5K
      
      Convert '__FILE__ ": " fmt' to '"%s: " fmt', __FILE__' to save text space
      Surround macros with do {} while
      Add parentheses to macros
      Make statement expression macro from macro with assign
      Remove now unnecessary parentheses from cFYI and cERROR uses
      
      defconfig with CIFS support old
      $ size fs/cifs/built-in.o
         text	   data	    bss	    dec	    hex	filename
       156012	   1760	    148	 157920	  268e0	fs/cifs/built-in.o
      
      defconfig with CIFS support old
      $ size fs/cifs/built-in.o
         text	   data	    bss	    dec	    hex	filename
       153508	   1760	    148	 155416	  25f18	fs/cifs/built-in.o
      
      allyesconfig old:
      $ size fs/cifs/built-in.o
         text	   data	    bss	    dec	    hex	filename
       309138	   3864	  74824	 387826	  5eaf2	fs/cifs/built-in.o
      
      allyesconfig new
      $ size fs/cifs/built-in.o
         text	   data	    bss	    dec	    hex	filename
       305655	   3864	  74824	 384343	  5dd57	fs/cifs/built-in.o
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      b6b38f70
  13. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  14. 25 2月, 2010 1 次提交
  15. 01 1月, 2010 1 次提交
  16. 04 12月, 2009 1 次提交
    • J
      cifs: NULL out tcon, pSesInfo, and srvTcp pointers when chasing DFS referrals · a2934c7b
      Jeff Layton 提交于
      The scenario is this:
      
      The kernel gets EREMOTE and starts chasing a DFS referral at mount time.
      The tcon reference is put, which puts the session reference too, but
      neither pointer is zeroed out.
      
      The mount gets retried (goto try_mount_again) with new mount info.
      Session setup fails fails and rc ends up being non-zero. The code then
      falls through to the end and tries to put the previously freed tcon
      pointer again.  Oops at: cifs_put_smb_ses+0x14/0xd0
      
      Fix this by moving the initialization of the rc variable and the tcon,
      pSesInfo and srvTcp pointers below the try_mount_again label. Also, add
      a FreeXid() before the goto to prevent xid "leaks".
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Reported-by: NGustavo Carvalho Homem <gustavo@angulosolido.pt>
      CC: stable <stable@kernel.org>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      a2934c7b
  17. 07 11月, 2009 1 次提交
    • J
      cifs: don't use CIFSGetSrvInodeNumber in is_path_accessible · f475f677
      Jeff Layton 提交于
      Because it's lighter weight, CIFS tries to use CIFSGetSrvInodeNumber to
      verify the accessibility of the root inode and then falls back to doing a
      full QPathInfo if that fails with -EOPNOTSUPP. I have at least a report
      of a server that returns NT_STATUS_INTERNAL_ERROR rather than something
      that translates to EOPNOTSUPP.
      
      Rather than trying to be clever with that call, just have
      is_path_accessible do a normal QPathInfo. That call is widely
      supported and it shouldn't increase the overhead significantly.
      
      Cc: Stable <stable@kernel.org>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      f475f677