1. 24 May, 2013 1 commit
    • Jeff Layton's avatar
      cifs: fix composing of mount options for DFS referrals · d9deef0a
      Jeff Layton authored
      With the change to ignore the unc= and prefixpath= mount options, there
      is no longer any need to add them to the options string when mounting.
      By the same token, we now need to build a device name that includes the
      prefixpath when mounting.
      To make things neater, the delimiters on the devicename are changed
      to '/' since that's preferred when mounting anyway.
      v2: fix some comments and don't bother looking at whether there is
          a prepath in the ref->node_name when deciding whether to pass
          a prepath to cifs_build_devname.
      v3: rebase on top of potential buffer overrun fix for stable
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
  2. 05 May, 2013 1 commit
    • Joe Perches's avatar
      [CIFS] cifs: Rename cERROR and cFYI to cifs_dbg · f96637be
      Joe Perches authored
      It's not obvious from reading the macro names that these macros
      are for debugging.  Convert the names to a single more typical
      kernel style cifs_dbg macro.
      	cERROR(1, ...)   -> cifs_dbg(VFS, ...)
      	cFYI(1, ...)     -> cifs_dbg(FYI, ...)
      	cFYI(DBG2, ...)  -> cifs_dbg(NOISY, ...)
      Move the terminating format newline from the macro to the call site.
      Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the
      "CIFS VFS: " prefix for VFS messages.
      Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y)
      $ size fs/cifs/cifs.ko*
         text    data     bss     dec     hex filename
       265245	   2525	    132	 267902	  4167e	fs/cifs/cifs.ko.new
       268359    2525     132  271016   422a8 fs/cifs/cifs.ko.old
      Other miscellaneous changes around these conversions:
      o Miscellaneous typo fixes
      o Add terminating \n's to almost all formats and remove them
        from the macros to be more kernel style like.  A few formats
        previously had defective \n's
      o Remove unnecessary OOM messages as kmalloc() calls dump_stack
      o Coalesce formats to make grep easier,
        added missing spaces when coalescing formats
      o Use %s, __func__ instead of embedded function name
      o Removed unnecessary "cifs: " prefixes
      o Convert kzalloc with multiply to kcalloc
      o Remove unused cifswarn macro
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
  3. 03 Aug, 2011 1 commit
  4. 30 Nov, 2010 1 commit
    • Jeff Layton's avatar
      cifs: fix parsing of hostname in dfs referrals · ba038648
      Jeff Layton authored
      The DFS referral parsing code does a memchr() call to find the '\\'
      delimiter that separates the hostname in the referral UNC from the
      sharename. It then uses that value to set the length of the hostname via
      pointer subtraction.  Instead of subtracting the start of the hostname
      however, it subtracts the start of the UNC, which causes the code to
      pass in a hostname length that is 2 bytes too long.
      Regression introduced in commit 1a4240f4.
      Reported-and-Tested-by: default avatarRobbert Kouprie <robbert@exx.nl>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Cc: Wang Lei <wang840925@gmail.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
  5. 05 Aug, 2010 2 commits
    • Wang Lei's avatar
      DNS: Separate out CIFS DNS Resolver code · 1a4240f4
      Wang Lei authored
      Separate out the DNS resolver key type from the CIFS filesystem into its own
      module so that it can be made available for general use, including the AFS
      filesystem module.
      This facility makes it possible for the kernel to upcall to userspace to have
      it issue DNS requests, package up the replies and present them to the kernel
      in a useful form.  The kernel is then able to cache the DNS replies as keys
      can be retained in keyrings.
      Resolver keys are of type "dns_resolver" and have a case-insensitive
      description that is of the form "[<type>:]<domain_name>".  The optional <type>
      indicates the particular DNS lookup and packaging that's required.  The
      <domain_name> is the query to be made.
      If <type> isn't given, a basic hostname to IP address lookup is made, and the
      result is stored in the key in the form of a printable string consisting of a
      comma-separated list of IPv4 and IPv6 addresses.
      This key type is supported by userspace helpers driven from /sbin/request-key
      and configured through /etc/request-key.conf.  The cifs.upcall utility is
      invoked for UNC path server name to IP address resolution.
      The CIFS functionality is encapsulated by the dns_resolve_unc_to_ip() function,
      which is used to resolve a UNC path to an IP address for CIFS filesystem.  This
      part remains in the CIFS module for now.
      See the added Documentation/networking/dns_resolver.txt for more information.
      Signed-off-by: default avatarWang Lei <wang840925@gmail.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
    • David Howells's avatar
      CIFS: Make cifs_convert_address() take a const src pointer and a length · 67b7626a
      David Howells authored
      Make cifs_convert_address() take a const src pointer and a length so that all
      the strlen() calls in their can be cut out and to make it unnecessary to modify
      the src string.
      Also return the data length from dns_resolve_server_name_to_ip() so that a
      strlen() can be cut out of cifs_compose_mount_options() too.
      Acked-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
  6. 02 Aug, 2010 1 commit
    • Jeff Layton's avatar
      cifs: set the port in sockaddr in a more clearly defined fashion · 50d97160
      Jeff Layton authored
      This patch should replace the patch I sent a couple of weeks ago to
      set the port in cifs_convert_address.
      Currently we set this in cifs_find_tcp_session, but that's more of a
      side effect than anything. Add a new function called cifs_fill_sockaddr.
      Have it call cifs_convert_address and then set the port.
      This also allows us to skip passing in the port as a separate parm to
      Also, change cifs_convert_address take a struct sockaddr * rather than
      void * to make it clearer how this function should be called.
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
  7. 31 Jul, 2010 1 commit
  8. 22 Jul, 2010 1 commit
    • David Howells's avatar
      CIFS: Fix a malicious redirect problem in the DNS lookup code · 4c0c03ca
      David Howells authored
      Fix the security problem in the CIFS filesystem DNS lookup code in which a
      malicious redirect could be installed by a random user by simply adding a
      result record into one of their keyrings with add_key() and then invoking a
      CIFS CFS lookup [CVE-2010-2524].
      This is done by creating an internal keyring specifically for the caching of
      DNS lookups.  To enforce the use of this keyring, the module init routine
      creates a set of override credentials with the keyring installed as the thread
      keyring and instructs request_key() to only install lookup result keys in that
      The override is then applied around the call to request_key().
      This has some additional benefits when a kernel service uses this module to
      request a key:
       (1) The result keys are owned by root, not the user that caused the lookup.
       (2) The result keys don't pop up in the user's keyrings.
       (3) The result keys don't come out of the quota of the user that caused the
      The keyring can be viewed as root by doing cat /proc/keys:
      2a0ca6c3 I-----     1 perm 1f030000     0     0 keyring   .dns_resolver: 1/4
      It can then be listed with 'keyctl list' by root.
      	# keyctl list 0x2a0ca6c3
      	1 key in keyring:
      	726766307: --alswrv     0     0 dns_resolver: foo.bar.com
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-and-Tested-by: default avatarJeff Layton <jlayton@redhat.com>
      Acked-by: default avatarSteve French <smfrench@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  9. 21 Apr, 2010 1 commit
    • Joe Perches's avatar
      [CIFS] Neaten cERROR and cFYI macros, reduce text space · b6b38f70
      Joe Perches authored
      Neaten cERROR and cFYI macros, reduce text space
      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: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
  10. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      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.
      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
      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
      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
      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: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  11. 25 Jun, 2009 1 commit
  12. 13 Jun, 2009 1 commit
  13. 17 Apr, 2009 1 commit
  14. 23 Sep, 2008 1 commit
  15. 27 Aug, 2008 1 commit
  16. 21 May, 2008 1 commit
  17. 26 Apr, 2008 1 commit
  18. 10 Mar, 2008 1 commit
  19. 25 Jan, 2008 1 commit
  20. 10 Jan, 2008 1 commit