06 Jan, 2017

1 commit

  • commit 06deeec77a5a689cc94b21a8a91a76e42176685d upstream.

    smbencrypt() points a scatterlist to the stack, which is breaks if
    CONFIG_VMAP_STACK=y.

    Fix it by switching to crypto_cipher_encrypt_one(). The new code
    should be considerably faster as an added benefit.

    This code is nearly identical to some code that Eric Biggers
    suggested.

    Reported-by: Eric Biggers
    Signed-off-by: Andy Lutomirski
    Acked-by: Jeff Layton
    Signed-off-by: Steve French
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

27 Jan, 2016

1 commit


20 Jan, 2015

1 commit

  • When leaving a function use memzero_explicit instead of memset(0) to
    clear stack allocated buffers. memset(0) may be optimized away.

    This particular buffer is highly likely to contain sensitive data which
    we shouldn't leak (it's named 'passwd' after all).

    Signed-off-by: Giel van Schijndel
    Acked-by: Herbert Xu
    Reported-at: http://www.viva64.com/en/b/0299/
    Reported-by: Andrey Karpov
    Reported-by: Svyatoslav Razmyslov
    Signed-off-by: Steve French

    Giel van Schijndel
     

17 Oct, 2014

1 commit

  • This is a bigger patch, but its size is mostly due to
    a single change for how we check for remapping illegal characters
    in file names - a lot of repeated, small changes to
    the way callers request converting file names.

    The final patch in the series does the following:

    1) changes default behavior for cifs to be more intuitive.
    Currently we do not map by default to seven reserved characters,
    ie those valid in POSIX but not in NTFS/CIFS/SMB3/Windows,
    unless a mount option (mapchars) is specified. Change this
    to by default always map and map using the SFM maping
    (like the Mac uses) unless the server negotiates the CIFS Unix
    Extensions (like Samba does when mounting with the cifs protocol)
    when the remapping of the characters is unnecessary. This should
    help SMB3 mounts in particular since Samba will likely be
    able to implement this mapping with its new "vfs_fruit" module
    as it will be doing for the Mac.
    2) if the user specifies the existing "mapchars" mount option then
    use the "SFU" (Microsoft Services for Unix, SUA) style mapping of
    the seven characters instead.
    3) if the user specifies "nomapposix" then disable SFM/MAC style mapping
    (so no character remapping would be used unless the user specifies
    "mapchars" on mount as well, as above).
    4) change all the places in the code that check for the superblock
    flag on the mount which is set by mapchars and passed in on all
    path based operation and change it to use a small function call
    instead to set the mapping type properly (and check for the
    mapping type in the cifs unicode functions)

    Signed-off-by: Steve French

    Steve French
     

05 May, 2013

1 commit

  • 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: Joe Perches
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Joe Perches
     

24 Jul, 2012

1 commit


19 Jan, 2012

1 commit


11 Nov, 2011

1 commit

  • Fix sparse endian check warning while calling cifs_strtoUCS

    CHECK fs/cifs/smbencrypt.c
    fs/cifs/smbencrypt.c:216:37: warning: incorrect type in argument 1
    (different base types)
    fs/cifs/smbencrypt.c:216:37: expected restricted __le16 [usertype] *
    fs/cifs/smbencrypt.c:216:37: got unsigned short *

    Signed-off-by: Steve French
    Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com

    Steve French
     

30 Oct, 2011

1 commit

  • Re-posting a patch originally posted by Oskar Liljeblad after
    rebasing on 3.2.

    Modify cifs to assume that the supplied password is encoded according
    to iocharset. Before this patch passwords would be treated as
    raw 8-bit data, which made authentication with Unicode passwords impossible
    (at least passwords with characters > 0xFF).

    The previous code would as a side effect accept passwords encoded with
    ISO 8859-1, since Unicode < 0x100 basically is ISO 8859-1. Software which
    relies on that will no longer support password chars > 0x7F unless it also
    uses iocharset=iso8859-1. (mount.cifs does not care about the encoding so
    it will work as expected.)

    Signed-off-by: Oskar Liljeblad
    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Pavel Shilovsky
    Tested-by: A
    Signed-off-by: Steve French

    Shirish Pargaonkar
     

13 Oct, 2011

1 commit


26 Jul, 2011

1 commit


25 Jun, 2011

1 commit


19 May, 2011

1 commit

  • local cifs functions (repost)

    Using kernel crypto APIs for DES encryption during LM and NT hash generation
    instead of local functions within cifs.
    Source file smbdes.c is deleted sans four functions, one of which
    uses ecb des functionality provided by kernel crypto APIs.

    Remove function SMBOWFencrypt.

    Add return codes to various functions such as calc_lanman_hash,
    SMBencrypt, and SMBNTencrypt. Includes fix noticed by Dan Carpenter.

    Signed-off-by: Shirish Pargaonkar
    CC: Dan Carpenter
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     

31 Jan, 2011

1 commit

  • fs/cifs/link.c: In function ‘symlink_hash’:
    fs/cifs/link.c:58:3: warning: ‘rc’ may be used uninitialized in this
    function [-Wuninitialized]

    fs/cifs/smbencrypt.c: In function ‘mdfour’:
    fs/cifs/smbencrypt.c:61:3: warning: ‘rc’ may be used uninitialized in this
    function [-Wuninitialized]

    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

28 Jan, 2011

1 commit

  • Replaced md4 hashing function local to cifs module with kernel crypto APIs.
    As a result, md4 hashing function and its supporting functions in
    file md4.c are not needed anymore.

    Cleaned up function declarations, removed forward function declarations,
    and removed a header file that is being deleted from being included.

    Verified that sec=ntlm/i, sec=ntlmv2/i, and sec=ntlmssp/i work correctly.

    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Shirish Pargaonkar
     

26 Jan, 2011

1 commit


30 Mar, 2010

1 commit

  • …it 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: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

26 Dec, 2008

1 commit

  • cifs: have calc_lanman_hash take more granular args

    We need to use this routine to encrypt passwords associated with the
    tcon too. Don't assume that the password will be attached to the
    smb_session.

    Also, make some of the values in the lower encryption functions
    const since they aren't changed.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

29 Apr, 2008

1 commit


06 Nov, 2007

1 commit


26 Oct, 2007

1 commit


13 Jul, 2007

1 commit

  • This should be the last big batch of whitespace/formatting fixes.
    checkpatch warnings for the cifs directory are down about 90% and
    many of the remaining ones are harder to remove or make the code
    harder to read.

    Signed-off-by: Steve French

    Steve French
     

08 Jul, 2007

1 commit


29 Sep, 2006

3 commits


01 Jun, 2006

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds