03 Aug, 2020

1 commit

  • If server returns ERRBaduid but does not reset transport connection,
    we'll keep sending command with a non-valid UID for the server as long
    as transport is healthy, without actually recovering. This have been
    observed on the field.

    This patch adds ERRBaduid handling so that we set CifsNeedReconnect.

    map_and_check_smb_error() can be modified to extend use cases.

    Signed-off-by: Roberto Bergantinos Corpas
    Signed-off-by: Steve French
    Reviewed-by: Ronnie Sahlberg

    Roberto Bergantinos Corpas
     

01 Jun, 2020

1 commit

  • Use pr_fmt to standardize all logging for fs/cifs.

    Some logging output had no CIFS: specific prefix.

    Now all output has one of three prefixes:

    o CIFS:
    o CIFS: VFS:
    o Root-CIFS:

    Miscellanea:

    o Convert printks to pr_
    o Neaten macro definitions
    o Remove embedded CIFS: prefixes from formats
    o Convert "illegal" to "invalid"
    o Coalesce formats
    o Add missing '\n' format terminations
    o Consolidate multiple cifs_dbg continuations into single calls
    o More consistent use of upper case first word output logging
    o Multiline statement argument alignment and wrapping

    Signed-off-by: Joe Perches
    Signed-off-by: Steve French

    Joe Perches
     

07 Oct, 2019

1 commit

  • After 'Initial git repository build' commit,
    'mapping_table_ERRHRD' variable has not been used.

    So 'mapping_table_ERRHRD' const variable could be removed
    to mute below warning message:

    fs/cifs/netmisc.c:120:40: warning: unused variable 'mapping_table_ERRHRD' [-Wunused-const-variable]
    static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
    ^
    Signed-off-by: Austin Kim
    Signed-off-by: Steve French

    Austin Kim
     

30 Aug, 2019

1 commit

  • Fill in the appropriate limits to avoid inconsistencies
    in the vfs cached inode times when timestamps are
    outside the permitted range.

    Also fixed cnvrtDosUnixTm calculations to avoid int overflow
    while computing maximum date.

    References:

    http://cifs.com/

    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/d416ff7c-c536-406e-a951-4f04b2fd1d2b

    Signed-off-by: Deepa Dinamani
    Acked-by: Jeff Layton
    Cc: sfrench@samba.org
    Cc: linux-cifs@vger.kernel.org

    Deepa Dinamani
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

08 Aug, 2018

1 commit

  • In cifs, the timestamps are stored in memory in the cifs_fattr structure,
    which uses the deprecated 'timespec' structure. Now that the VFS code
    has moved on to 'timespec64', the next step is to change over the fattr
    as well.

    This also makes 32-bit and 64-bit systems behave the same way, and
    no longer overflow the 32-bit time_t in year 2038.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Paulo Alcantara
    Signed-off-by: Steve French

    Arnd Bergmann
     

28 May, 2018

1 commit


03 May, 2017

1 commit

  • January is month 1. There is no zero-th month. If someone passes a
    zero month then it means we read from one space before the start of the
    total_days_of_prev_months[] array.

    We may as well also be strict about days as well.

    Fixes: 1bd5bbcb6531 ("[CIFS] Legacy time handling for Win9x and OS/2 part 1")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Steve French

    Dan Carpenter
     

15 Dec, 2014

1 commit

  • Commit 2ae83bf93882d1 ("[CIFS] Fix setting time before epoch (negative
    time values)") changed "u64 t" to "s64 t", which makes do_div() complain
    about a pointer signedness mismatch:

    CC fs/cifs/netmisc.o
    In file included from ./arch/mips/include/asm/div64.h:12:0,
    from include/linux/kernel.h:124,
    from include/linux/list.h:8,
    from include/linux/wait.h:6,
    from include/linux/net.h:23,
    from fs/cifs/netmisc.c:25:
    fs/cifs/netmisc.c: In function ‘cifs_NTtimeToUnix’:
    include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
    (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
    ^
    fs/cifs/netmisc.c:941:22: note: in expansion of macro ‘do_div’
    ts.tv_nsec = (long)do_div(t, 10000000) * 100;

    Introduce a temporary "u64 abs_t" variable to fix this.

    Signed-off-by: Kevin Cernekee
    Signed-off-by: Steve French

    Kevin Cernekee
     

15 Sep, 2014

1 commit

  • xfstest generic/258 sets the time on a file to a negative value
    (before 1970) which fails since do_div can not handle negative
    numbers. In addition 'normal' division of 64 bit values does
    not build on 32 bit arch so have to workaround this by special
    casing negative values in cifs_NTtimeToUnix

    Samba server also has a bug with this (see samba bugzilla 7771)
    but it works to Windows server.

    Signed-off-by: Steve French

    Steve French
     

22 May, 2014

1 commit


12 Nov, 2013

1 commit

  • Sometimes, the server will report an error that basically indicates
    that it's running out of resources. These include these under SMB1:

    NT_STATUS_NO_MEMORY
    NT_STATUS_SECTION_TOO_BIG
    NT_STATUS_TOO_MANY_PAGING_FILES

    ...and this one under SMB2:

    STATUS_NO_MEMORY

    Currently, this gets mapped to ENOMEM by the client, but that's
    confusing as an ENOMEM error is typically an indicator that the
    client is out of memory.

    Change these errors to instead map to EREMOTEIO to indicate that
    the problem is actually server-side and not on the client.

    Reported-by: "ISHIKAWA,chiaki"
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

15 Oct, 2013

1 commit

  • Functions that walk the ntstatus_to_dos_map[] array could
    run off the end. For example, ntstatus_to_dos() loops
    while ntstatus_to_dos_map[].ntstatus is not 0. Granted,
    this is mostly theoretical, but could be used as a DOS attack
    if the error code in the SMB header is bogus.

    [Might consider adding to stable, as this patch is low risk - Steve]

    Reviewed-by: Jeff Layton
    Signed-off-by: Tim Gardner
    Signed-off-by: Steve French

    Tim Gardner
     

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
     

14 Mar, 2013

1 commit

  • NT_SHARING_VIOLATION errors are mapped to ETXTBSY which is unexpected
    for operations such as unlink where we can hit these errors.

    The patch maps the error NT_SHARING_VIOLATION to EBUSY instead. The
    patch also replaces all instances of ETXTBSY in
    cifs_rename_pending_delete() with EBUSY.

    Signed-off-by: Sachin Prabhu
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Sachin Prabhu
     

06 Dec, 2012

1 commit


27 Sep, 2012

1 commit

  • ERRnoresource is an ERRSRV level (aka server-side) error and means "No
    resources currently available for request". Currently that maps to POSIX
    -ENOBUFS. No NT errors map to it currently.

    NT_STATUS_INSUFFICIENT_RESOURCES and NT_STATUS_INSUFF_SERVER_RESOURCES
    are also similar in meaning. Currently the client maps those to
    ERRnomem, which maps to -ENOMEM in POSIX.

    All of these mappings seem to be quite wrong to me and are confusing for
    users. All of the above errors indicate problems on the server, not the
    client. Reporting -ENOMEM or -ENOBUFS implies that the client is running
    out of resources.

    This patch changes those mappings. The NT_* errors are changed to map to
    the SRV level ERRnoresource. That error is in turn changed to return
    -EREMOTEIO which is the only POSIX error I could find that conveys that
    something went wrong on the server. While we're at it, change the SMB2
    equivalent error to return the same.

    Signed-off-by: Jeff Layton
    Acked-by: Suresh Jayaraman
    Signed-off-by: Steve French

    Jeff Layton
     

25 Sep, 2012

1 commit


01 Apr, 2012

1 commit


24 Mar, 2012

1 commit


23 May, 2011

1 commit

  • Further consolidate the SendReceive code by moving the checks run over
    the packet into a separate function that all the SendReceive variants
    can call.

    We can also eliminate the check for a receive_len that's too big or too
    small. cifs_demultiplex_thread already checks that and disconnects the
    socket if that occurs, while setting the midStatus to MALFORMED. It'll
    never call this code if that's the case.

    Finally do a little cleanup. Use "goto out" on errors so that the flow
    of code in the normal case is more evident. Also switch the logErr
    variable in map_smb_to_linux_error to a bool.

    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

19 May, 2011

1 commit

  • This is the same patch as originally posted, just with some merge
    conflicts fixed up...

    Currently, the ByteCount is usually converted to host-endian on receive.
    This is confusing however, as we need to keep two sets of routines for
    accessing it, and keep track of when to use each routine. Munging
    received packets like this also limits when the signature can be
    calulated.

    Simplify the code by keeping the received ByteCount in little-endian
    format. This allows us to eliminate a set of routines for accessing it
    and we can now drop the *_le suffixes from the accessor functions since
    that's now implied.

    While we're at it, switch all of the places that read the ByteCount
    directly to use the get_bcc inline which should also clean up some
    unaligned accesses.

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

    Jeff Layton
     

17 Feb, 2011

1 commit

  • The code finds, the '%' sign in an ipv6 address and copies that to a
    buffer allocated on the stack. It then ignores that buffer, and passes
    'pct' to simple_strtoul(), which doesn't work right because we're
    comparing 'endp' against a completely different string.

    Fix it by passing the correct pointer. While we're at it, this is a
    good candidate for conversion to strict_strtoul as well.

    Cc: stable@kernel.org
    Cc: David Howells
    Reported-by: Björn JACKE
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

21 Jan, 2011

1 commit

  • It's possible that when we access the ByteCount that the alignment
    will be off. Most CPUs deal with that transparently, but there's
    usually some performance impact. Some CPUs raise an exception on
    unaligned accesses.

    Fix this by accessing the byte count using the get_unaligned and
    put_unaligned inlined functions. While we're at it, fix the types
    of some of the variables that end up getting returns from these
    functions.

    Acked-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

15 Jan, 2011

1 commit


09 Sep, 2010

1 commit

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

    Jeff Layton
     

06 Aug, 2010

1 commit

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

    David Howells
     

02 Aug, 2010

2 commits

  • Seems like a more sensible mapping than -EIO.

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

    Jeff Layton
     
  • 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
    cifs_find_tcp_session.

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

    Jeff Layton
     

21 Apr, 2010

1 commit

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

    Joe Perches
     

25 Jun, 2009

1 commit

  • This patch has CIFS look for a '%' in an IPv6 address. If one is
    present then it will try to treat that value as a numeric interface
    index suitable for stuffing into the sin6_scope_id field.

    This should allow people to mount servers on IPv6 link-local addresses.

    Signed-off-by: Jeff Layton
    Acked-by: David Holder
    Signed-off-by: Steve French

    Jeff Layton
     

15 Jun, 2009

1 commit


13 Jun, 2009

1 commit


28 May, 2009

2 commits


01 May, 2009

1 commit


13 May, 2008

1 commit


09 May, 2008

1 commit


13 Feb, 2008

1 commit


08 Feb, 2008

1 commit