15 Sep, 2010

1 commit

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

    Jeff Layton
     

09 Sep, 2010

9 commits

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

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

    Jeff Layton
     
  • This function is not used, so remove the definition and declaration.

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

    Steve French
     
  • The VFS always checks that the source and target of a rename are on the
    same vfsmount, and hence have the same superblock. So, this check is
    redundant. Remove it and simplify the error handling.

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

    Jeff Layton
     
  • This reverts commit 9fbc590860e75785bdaf8b83e48fabfe4d4f7d58.

    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: Steve French
    Acked-by: Jeff Layton
    CC: Shirish Pargaonkar

    Steve French
     
  • This reverts commit 3ec6bbcdb4e85403f2c5958876ca9492afdf4031.

    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: Steve French
    Acked-by: Jeff Layton
    CC: Shirish Pargaonkar

    Steve French
     
  • This reverts commit 2d20ca835867d93ead6ce61780d883a4b128106d.

    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: Steve French
    Acked-by: Jeff Layton
    CC: Shirish Pargaonkar

    Steve French
     
  • 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.

    This reverts commit c89e5198b26a869ce2842bad8519264f3394dee9.

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

    Steve French
     

27 Aug, 2010

1 commit

  • On 08/26/2010 01:56 AM, joe hefner wrote:
    > On a recent Fedora (13), I am seeing a mount failure message that I can not explain. I have a Windows Server 2003ýa with a share set up for access only for a specific username (say userfoo). If I try to mount it from Linux,ýusing userfoo and the correct password all is well. If I try with a bad password or with some other username (userbar), it fails with "Permission denied" as expected. If I try to mount as username = administrator, and give the correct administrator password, I would also expect "Permission denied", but I see "Cannot allocate memory" instead.

    > ýfs/cifs/netmisc.c: Mapping smb error code 5 to POSIX err -13
    > ýfs/cifs/cifssmb.c: Send error in QPathInfo = -13
    > ýCIFS VFS: cifs_read_super: get root inode failed

    Looks like the commit 0b8f18e3 assumed that cifs_get_inode_info() and
    friends fail only due to memory allocation error when the inode is NULL
    which is not the case if CIFSSMBQPathInfo() fails and returns an error.
    Fix this by propagating the actual error code back.

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

    Suresh Jayaraman
     

26 Aug, 2010

1 commit


25 Aug, 2010

1 commit

  • Eliminiate sparse warning during usage of crypto_shash_* APIs
    error: bad constant expression

    Allocate memory for shash descriptors once, so that we do not kmalloc/kfree it
    for every signature generation (shash descriptor for md5 hash).

    From ed7538619817777decc44b5660b52268077b74f3 Mon Sep 17 00:00:00 2001
    From: Shirish Pargaonkar
    Date: Tue, 24 Aug 2010 11:47:43 -0500
    Subject: [PATCH] eliminate sparse warnings during crypto_shash_* APis usage

    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    shirishpargaonkar@gmail.com
     

24 Aug, 2010

2 commits


21 Aug, 2010

1 commit

  • Make ntlmv2 as an authentication mechanism within ntlmssp
    instead of ntlmv1.
    Parse type 2 response in ntlmssp negotiation to pluck
    AV pairs and use them to calculate ntlmv2 response token.
    Also, assign domain name from the sever response in type 2
    packet of ntlmssp and use that (netbios) domain name in
    calculation of response.

    Enable cifs/smb signing using rc4 and md5.

    Changed name of the structure mac_key to session_key to reflect
    the type of key it holds.

    Use kernel crypto_shash_* APIs instead of the equivalent cifs functions.

    Signed-off-by: Shirish Pargaonkar
    Acked-by: Herbert Xu
    Signed-off-by: Steve French

    Steve French
     

20 Aug, 2010

1 commit


19 Aug, 2010

1 commit


17 Aug, 2010

2 commits


12 Aug, 2010

1 commit


11 Aug, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (96 commits)
    no need for list_for_each_entry_safe()/resetting with superblock list
    Fix sget() race with failing mount
    vfs: don't hold s_umount over close_bdev_exclusive() call
    sysv: do not mark superblock dirty on remount
    sysv: do not mark superblock dirty on mount
    btrfs: remove junk sb_dirt change
    BFS: clean up the superblock usage
    AFFS: wait for sb synchronization when needed
    AFFS: clean up dirty flag usage
    cifs: truncate fallout
    mbcache: fix shrinker function return value
    mbcache: Remove unused features
    add f_flags to struct statfs(64)
    pass a struct path to vfs_statfs
    update VFS documentation for method changes.
    All filesystems that need invalidate_inode_buffers() are doing that explicitly
    convert remaining ->clear_inode() to ->evict_inode()
    Make ->drop_inode() just return whether inode needs to be dropped
    fs/inode.c:clear_inode() is gone
    fs/inode.c:evict() doesn't care about delete vs. non-delete paths now
    ...

    Fix up trivial conflicts in fs/nilfs2/super.c

    Linus Torvalds
     

10 Aug, 2010

5 commits

  • Remove the calls to inode_newsize_ok given that we already did it as
    part of inode_change_ok in the beginning of cifs_setattr_(no)unix.

    No need to call ->truncate if cifs doesn't have one, so remove the
    explicit call in cifs_vmtruncate, and replace the calls to vmtruncate
    with truncate_setsize which is vmtruncate minus inode_newsize_ok
    and the call to ->truncate.

    Rename cifs_vmtruncate to cifs_setsize to match the new calling conventions.

    Question 1: why does cifs do the pagecache munging and i_size update twice
    for each setattr call, once opencoded in cifs_vmtruncate, and once
    using the VFS helpers?
    Question 2: what is supposed to be protected by i_lock in cifs_vmtruncate?
    Do we need it around the call to inode_change_ok?

    [AV: fixed build breakage]

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • ... and let iput_final() do the actual eviction or retention

    Signed-off-by: Al Viro

    Al Viro
     
  • Make sure we call inode_change_ok before doing any changes in ->setattr,
    and make sure to call it even if our fs wants to ignore normal UNIX
    permissions, but use the ATTR_FORCE to skip those.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • Replace inode_setattr with opencoded variants of it in all callers. This
    moves the remaining call to vmtruncate into the filesystem methods where it
    can be replaced with the proper truncate sequence.

    In a few cases it was obvious that we would never end up calling vmtruncate
    so it was left out in the opencoded variant:

    spufs: explicitly checks for ATTR_SIZE earlier
    btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier
    ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above

    In addition to that ncpfs called inode_setattr with handcrafted iattrs,
    which allowed to trim down the opencoded variant.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

08 Aug, 2010

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    [DNS RESOLVER] Minor typo correction
    DNS: Fixes for the DNS query module
    cifs: Include linux/err.h for IS_ERR and PTR_ERR
    DNS: Make AFS go to the DNS for AFSDB records for unknown cells
    DNS: Separate out CIFS DNS Resolver code
    cifs: account for new creduid=0x%x parameter in spnego upcall string
    cifs: reduce false positives with inode aliasing serverino autodisable
    CIFS: Make cifs_convert_address() take a const src pointer and a length
    cifs: show features compiled in as part of DebugData
    cifs: update README

    Fix up trivial conflicts in fs/cifs/cifsfs.c due to workqueue changes

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (55 commits)
    workqueue: mark init_workqueues() as early_initcall()
    workqueue: explain for_each_*cwq_cpu() iterators
    fscache: fix build on !CONFIG_SYSCTL
    slow-work: kill it
    gfs2: use workqueue instead of slow-work
    drm: use workqueue instead of slow-work
    cifs: use workqueue instead of slow-work
    fscache: drop references to slow-work
    fscache: convert operation to use workqueue instead of slow-work
    fscache: convert object to use workqueue instead of slow-work
    workqueue: fix how cpu number is stored in work->data
    workqueue: fix mayday_mask handling on UP
    workqueue: fix build problem on !CONFIG_SMP
    workqueue: fix locking in retry path of maybe_create_worker()
    async: use workqueue for worker pool
    workqueue: remove WQ_SINGLE_CPU and use WQ_UNBOUND instead
    workqueue: implement unbound workqueue
    workqueue: prepare for WQ_UNBOUND implementation
    libata: take advantage of cmwq and remove concurrency limitations
    workqueue: fix worker management invocation without pending works
    ...

    Fixed up conflicts in fs/cifs/* as per Tejun. Other trivial conflicts in
    include/linux/workqueue.h, kernel/trace/Kconfig and kernel/workqueue.c

    Linus Torvalds
     

06 Aug, 2010

6 commits

  • 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 "[:]". The optional
    indicates the particular DNS lookup and packaging that's required. The
    is the query to be made.

    If 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: Wang Lei
    Signed-off-by: David Howells
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Wang Lei
     
  • The commit that added the creduid=0x%x parameter failed to increase the
    buffer allocation to account for it.

    Reported-by: J. Bruce Fields
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • It turns out that not all directory inodes with dentries on the
    i_dentry list are unusable here. We only consider them unusable if they
    are still hashed or if they have a root dentry attached.

    Full disclosure -- this check is inherently racy. There's nothing that
    stops someone from slapping a new dentry onto this inode just after
    this check, or hashing an existing one that's already attached. So,
    this is really a "best effort" thing to work around misbehaving servers.

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

    Jeff Layton
     
  • 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
     
  • Fixed the nit pointed out by Jeff.

    From: Suresh Jayaraman
    Subject: [PATCH 1/2] cifs: show features compiled in as part of DebugData

    This patch adds the features that are compiled in to the CIFS debugging data
    as shown below:

    $cat /proc/fs/cifs/DebugData
    Display Internal CIFS Data Structures for Debugging
    ---------------------------------------------------
    CIFS Version 1.64
    Features: dfs fscache posix spnego xattr
    Active VFS Requests: 0
    ...

    This patch provides a definitive way to tell what features are currently
    enabled in the running kernel. This could also help debugging.

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

    Suresh Jayaraman
     
  • Update the README file to reflect that now DebugData shows all
    the features enabled.

    Signed-off-by: Suresh Jayaraman
    Cc: Jeff Layton
    --
    fs/cifs/README | 5 +++--
    1 files changed, 3 insertions(+), 2 deletions(-)
    Signed-off-by: Steve French

    Suresh Jayaraman
     

02 Aug, 2010

5 commits