commit c0007620430f97d3b92bb00df807021721790425
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Fri Oct 2 15:24:11 2015 +0200

    Linux 3.12.49

commit d5c47ccb0a2cd8761020f7a222bf6b12a4a7b2f0
Author: Paul Mackerras <paulus@ozlabs.org>
Date:   Mon Sep 28 14:38:31 2015 +1000

    powerpc/MSI: Fix race condition in tearing down MSI interrupts
    
    commit e297c939b745e420ef0b9dc989cb87bda617b399 upstream.
    
    This fixes a race which can result in the same virtual IRQ number
    being assigned to two different MSI interrupts.  The most visible
    consequence of that is usually a warning and stack trace from the
    sysfs code about an attempt to create a duplicate entry in sysfs.
    
    The race happens when one CPU (say CPU 0) is disposing of an MSI
    while another CPU (say CPU 1) is setting up an MSI.  CPU 0 calls
    (for example) pnv_teardown_msi_irqs(), which calls
    msi_bitmap_free_hwirqs() to indicate that the MSI (i.e. its
    hardware IRQ number) is no longer in use.  Then, before CPU 0 gets
    to calling irq_dispose_mapping() to free up the virtal IRQ number,
    CPU 1 comes in and calls msi_bitmap_alloc_hwirqs() to allocate an
    MSI, and gets the same hardware IRQ number that CPU 0 just freed.
    CPU 1 then calls irq_create_mapping() to get a virtual IRQ number,
    which sees that there is currently a mapping for that hardware IRQ
    number and returns the corresponding virtual IRQ number (which is
    the same virtual IRQ number that CPU 0 was using).  CPU 0 then
    calls irq_dispose_mapping() and frees that virtual IRQ number.
    Now, if another CPU comes along and calls irq_create_mapping(), it
    is likely to get the virtual IRQ number that was just freed,
    resulting in the same virtual IRQ number apparently being used for
    two different hardware interrupts.
    
    To fix this race, we just move the call to msi_bitmap_free_hwirqs()
    to after the call to irq_dispose_mapping().  Since virq_to_hw()
    doesn't work for the virtual IRQ number after irq_dispose_mapping()
    has been called, we need to call it before irq_dispose_mapping() and
    remember the result for the msi_bitmap_free_hwirqs() call.
    
    The pattern of calling msi_bitmap_free_hwirqs() before
    irq_dispose_mapping() appears in 5 places under arch/powerpc, and
    appears to have originated in commit 05af7bd2d75e ("[POWERPC] MPIC
    U3/U4 MSI backend") from 2007.
    
    Fixes: 05af7bd2d75e ("[POWERPC] MPIC U3/U4 MSI backend")
    Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit e460fa8bdc1f744a92dd20a968ac652c6cacaf89
Author: Neil Brown <neilb@suse.com>
Date:   Wed Sep 30 13:11:22 2015 +1000

    md: flush ->event_work before stopping array.
    
    commit ee5d004fd0591536a061451eba2b187092e9127c upstream.
    
    The 'event_work' worker used by dm-raid may still be running
    when the array is stopped.  This can result in an oops.
    
    So flush the workqueue on which it is run after detaching
    and before destroying the device.
    
    Reported-by: Heinz Mauelshagen <heinzm@redhat.com>
    Signed-off-by: NeilBrown <neilb@suse.com>
    Fixes: 9d09e663d550 ("dm: raid456 basic support")
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 2ca1ae468673a36d1a2dc5946995ba617f8cba96
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Sat Aug 15 20:27:13 2015 -0500

    vfs: Test for and handle paths that are unreachable from their mnt_root
    
    commit 397d425dc26da728396e66d392d5dcb8dac30c37 upstream.
    
    In rare cases a directory can be renamed out from under a bind mount.
    In those cases without special handling it becomes possible to walk up
    the directory tree to the root dentry of the filesystem and down
    from the root dentry to every other file or directory on the filesystem.
    
    Like division by zero .. from an unconnected path can not be given
    a useful semantic as there is no predicting at which path component
    the code will realize it is unconnected.  We certainly can not match
    the current behavior as the current behavior is a security hole.
    
    Therefore when encounting .. when following an unconnected path
    return -ENOENT.
    
    - Add a function path_connected to verify path->dentry is reachable
      from path->mnt.mnt_root.  AKA to validate that rename did not do
      something nasty to the bind mount.
    
      To avoid races path_connected must be called after following a path
      component to it's next path component.
    
    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit b32388c040d559d26feef31fa02b4119c76be474
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Sat Aug 15 13:36:12 2015 -0500

    dcache: Handle escaped paths in prepend_path
    
    commit cde93be45a8a90d8c264c776fab63487b5038a65 upstream.
    
    A rename can result in a dentry that by walking up d_parent
    will never reach it's mnt_root.  For lack of a better term
    I call this an escaped path.
    
    prepend_path is called by four different functions __d_path,
    d_absolute_path, d_path, and getcwd.
    
    __d_path only wants to see paths are connected to the root it passes
    in.  So __d_path needs prepend_path to return an error.
    
    d_absolute_path similarly wants to see paths that are connected to
    some root.  Escaped paths are not connected to any mnt_root so
    d_absolute_path needs prepend_path to return an error greater
    than 1.  So escaped paths will be treated like paths on lazily
    unmounted mounts.
    
    getcwd needs to prepend "(unreachable)" so getcwd also needs
    prepend_path to return an error.
    
    d_path is the interesting hold out.  d_path just wants to print
    something, and does not care about the weird cases.  Which raises
    the question what should be printed?
    
    Given that <escaped_path>/<anything> should result in -ENOENT I
    believe it is desirable for escaped paths to be printed as empty
    paths.  As there are not really any meaninful path components when
    considered from the perspective of a mount tree.
    
    So tweak prepend_path to return an empty path with an new error
    code of 3 when it encounters an escaped path.
    
    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 864c198bbd4e091577602ad42016ccc835af3b93
Author: Andy Lutomirski <luto@kernel.org>
Date:   Wed Jul 15 10:29:38 2015 -0700

    x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI detection
    
    commit 810bc075f78ff2c221536eb3008eac6a492dba2d upstream.
    
    We have a tricky bug in the nested NMI code: if we see RSP
    pointing to the NMI stack on NMI entry from kernel mode, we
    assume that we are executing a nested NMI.
    
    This isn't quite true.  A malicious userspace program can point
    RSP at the NMI stack, issue SYSCALL, and arrange for an NMI to
    happen while RSP is still pointing at the NMI stack.
    
    Fix it with a sneaky trick.  Set DF in the region of code that
    the RSP check is intended to detect.  IRET will clear DF
    atomically.
    
    ( Note: other than paravirt, there's little need for all this
      complexity. We could check RIP instead of RSP. )
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 10c99c9766cda45d7ff6cfba80d459f054308816
Author: Andy Lutomirski <luto@kernel.org>
Date:   Wed Jul 15 10:29:37 2015 -0700

    x86/nmi/64: Reorder nested NMI checks
    
    commit a27507ca2d796cfa8d907de31ad730359c8a6d06 upstream.
    
    Check the repeat_nmi .. end_repeat_nmi special case first.  The
    next patch will rework the RSP check and, as a side effect, the
    RSP check will no longer detect repeat_nmi .. end_repeat_nmi, so
    we'll need this ordering of the checks.
    
    Note: this is more subtle than it appears.  The check for
    repeat_nmi .. end_repeat_nmi jumps straight out of the NMI code
    instead of adjusting the "iret" frame to force a repeat.  This
    is necessary, because the code between repeat_nmi and
    end_repeat_nmi sets "NMI executing" and then writes to the
    "iret" frame itself.  If a nested NMI comes in and modifies the
    "iret" frame while repeat_nmi is also modifying it, we'll end up
    with garbage.  The old code got this right, as does the new
    code, but the new code is a bit more explicit.
    
    If we were to move the check right after the "NMI executing"
    check, then we'd get it wrong and have random crashes.
    
    ( Because the "NMI executing" check would jump to the code that would
      modify the "iret" frame without checking if the interrupted NMI was
      currently modifying it. )
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d2ad20321da32a57006e1ffca020e6e84b2b0e66
Author: Andy Lutomirski <luto@kernel.org>
Date:   Wed Jul 15 10:29:36 2015 -0700

    x86/nmi/64: Improve nested NMI comments
    
    commit 0b22930ebad563ae97ff3f8d7b9f12060b4c6e6b upstream.
    
    I found the nested NMI documentation to be difficult to follow.
    Improve the comments.
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 737ea8025dfb9e762e019163b8c8db45bacc7e56
Author: Wilson Kok <wkok@cumulusnetworks.com>
Date:   Tue Sep 22 21:40:22 2015 -0700

    fib_rules: fix fib rule dumps across multiple skbs
    
    [ Upstream commit 41fc014332d91ee90c32840bf161f9685b7fbf2b ]
    
    dump_rules returns skb length and not error.
    But when family == AF_UNSPEC, the caller of dump_rules
    assumes that it returns an error. Hence, when family == AF_UNSPEC,
    we continue trying to dump on -EMSGSIZE errors resulting in
    incorrect dump idx carried between skbs belonging to the same dump.
    This results in fib rule dump always only dumping rules that fit
    into the first skb.
    
    This patch fixes dump_rules to return error so that we exit correctly
    and idx is correctly maintained between skbs that are part of the
    same dump.
    
    [rd] fix for <= 3.19: fib_nl_fill_rule() returns skb->len, make the
         check 'err < 0'
    
    Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
    Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Roland Dreier <roland@purestorage.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3b27550cd346974eb3086a3932ea7bdf3c1a566b
Author: Jesse Gross <jesse@nicira.com>
Date:   Mon Sep 21 20:21:20 2015 -0700

    openvswitch: Zero flows on allocation.
    
    [ Upstream commit ae5f2fb1d51fa128a460bcfbe3c56d7ab8bf6a43 ]
    
    When support for megaflows was introduced, OVS needed to start
    installing flows with a mask applied to them. Since masking is an
    expensive operation, OVS also had an optimization that would only
    take the parts of the flow keys that were covered by a non-zero
    mask. The values stored in the remaining pieces should not matter
    because they are masked out.
    
    While this works fine for the purposes of matching (which must always
    look at the mask), serialization to netlink can be problematic. Since
    the flow and the mask are serialized separately, the uninitialized
    portions of the flow can be encoded with whatever values happen to be
    present.
    
    In terms of functionality, this has little effect since these fields
    will be masked out by definition. However, it leaks kernel memory to
    userspace, which is a potential security vulnerability. It is also
    possible that other code paths could look at the masked key and get
    uninitialized data, although this does not currently appear to be an
    issue in practice.
    
    This removes the mask optimization for flows that are being installed.
    This was always intended to be the case as the mask optimizations were
    really targetting per-packet flow operations.
    
    Fixes: 03f0d916 ("openvswitch: Mega flow implementation")
    Signed-off-by: Jesse Gross <jesse@nicira.com>
    Acked-by: Pravin B Shelar <pshelar@nicira.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 540a0bd97d4e790b9526e266c22f4c12cf732a1f
Author: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date:   Thu Sep 10 17:31:15 2015 -0300

    sctp: fix race on protocol/netns initialization
    
    [ Upstream commit 8e2d61e0aed2b7c4ecb35844fe07e0b2b762dee4 ]
    
    Consider sctp module is unloaded and is being requested because an user
    is creating a sctp socket.
    
    During initialization, sctp will add the new protocol type and then
    initialize pernet subsys:
    
            status = sctp_v4_protosw_init();
            if (status)
                    goto err_protosw_init;
    
            status = sctp_v6_protosw_init();
            if (status)
                    goto err_v6_protosw_init;
    
            status = register_pernet_subsys(&sctp_net_ops);
    
    The problem is that after those calls to sctp_v{4,6}_protosw_init(), it
    is possible for userspace to create SCTP sockets like if the module is
    already fully loaded. If that happens, one of the possible effects is
    that we will have readers for net->sctp.local_addr_list list earlier
    than expected and sctp_net_init() does not take precautions while
    dealing with that list, leading to a potential panic but not limited to
    that, as sctp_sock_init() will copy a bunch of blank/partially
    initialized values from net->sctp.
    
    The race happens like this:
    
         CPU 0                           |  CPU 1
      socket()                           |
       __sock_create                     | socket()
        inet_create                      |  __sock_create
         list_for_each_entry_rcu(        |
            answer, &inetsw[sock->type], |
            list) {                      |   inet_create
          /* no hits */                  |
         if (unlikely(err)) {            |
          ...                            |
          request_module()               |
          /* socket creation is blocked  |
           * the module is fully loaded  |
           */                            |
           sctp_init                     |
            sctp_v4_protosw_init         |
             inet_register_protosw       |
              list_add_rcu(&p->list,     |
                           last_perm);   |
                                         |  list_for_each_entry_rcu(
                                         |     answer, &inetsw[sock->type],
            sctp_v6_protosw_init         |     list) {
                                         |     /* hit, so assumes protocol
                                         |      * is already loaded
                                         |      */
                                         |  /* socket creation continues
                                         |   * before netns is initialized
                                         |   */
            register_pernet_subsys       |
    
    Simply inverting the initialization order between
    register_pernet_subsys() and sctp_v4_protosw_init() is not possible
    because register_pernet_subsys() will create a control sctp socket, so
    the protocol must be already visible by then. Deferring the socket
    creation to a work-queue is not good specially because we loose the
    ability to handle its errors.
    
    So, as suggested by Vlad, the fix is to split netns initialization in
    two moments: defaults and control socket, so that the defaults are
    already loaded by when we register the protocol, while control socket
    initialization is kept at the same moment it is today.
    
    Fixes: 4db67e808640 ("sctp: Make the address lists per network namespace")
    Signed-off-by: Vlad Yasevich <vyasevich@gmail.com>
    Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 92994a5f49d0a81c8643452d5c0a6e8b31d85a61
Author: Daniel Borkmann <daniel@iogearbox.net>
Date:   Thu Sep 10 20:05:46 2015 +0200

    netlink, mmap: transform mmap skb into full skb on taps
    
    [ Upstream commit 1853c949646005b5959c483becde86608f548f24 ]
    
    Ken-ichirou reported that running netlink in mmap mode for receive in
    combination with nlmon will throw a NULL pointer dereference in
    __kfree_skb() on nlmon_xmit(), in my case I can also trigger an "unable
    to handle kernel paging request". The problem is the skb_clone() in
    __netlink_deliver_tap_skb() for skbs that are mmaped.
    
    I.e. the cloned skb doesn't have a destructor, whereas the mmap netlink
    skb has it pointed to netlink_skb_destructor(), set in the handler
    netlink_ring_setup_skb(). There, skb->head is being set to NULL, so
    that in such cases, __kfree_skb() doesn't perform a skb_release_data()
    via skb_release_all(), where skb->head is possibly being freed through
    kfree(head) into slab allocator, although netlink mmap skb->head points
    to the mmap buffer. Similarly, the same has to be done also for large
    netlink skbs where the data area is vmalloced. Therefore, as discussed,
    make a copy for these rather rare cases for now. This fixes the issue
    on my and Ken-ichirou's test-cases.
    
    Reference: http://thread.gmane.org/gmane.linux.network/371129
    Fixes: bcbde0d449ed ("net: netlink: virtual tap device management")
    Reported-by: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Tested-by: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 2b80121a026fa8d2189120fb3b39e0eb14ef0635
Author: Richard Laing <richard.laing@alliedtelesis.co.nz>
Date:   Thu Sep 3 13:52:31 2015 +1200

    net/ipv6: Correct PIM6 mrt_lock handling
    
    [ Upstream commit 25b4a44c19c83d98e8c0807a7ede07c1f28eab8b ]
    
    In the IPv6 multicast routing code the mrt_lock was not being released
    correctly in the MFC iterator, as a result adding or deleting a MIF would
    cause a hang because the mrt_lock could not be acquired.
    
    This fix is a copy of the code for the IPv4 case and ensures that the lock
    is released correctly.
    
    Signed-off-by: Richard Laing <richard.laing@alliedtelesis.co.nz>
    Acked-by: Cong Wang <cwang@twopensource.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d3c40560a5ea3b6ef5707ce35d645c2c0b19a4f8
Author: Daniel Borkmann <daniel@iogearbox.net>
Date:   Thu Sep 3 00:29:07 2015 +0200

    ipv6: fix exthdrs offload registration in out_rt path
    
    [ Upstream commit e41b0bedba0293b9e1e8d1e8ed553104b9693656 ]
    
    We previously register IPPROTO_ROUTING offload under inet6_add_offload(),
    but in error path, we try to unregister it with inet_del_offload(). This
    doesn't seem correct, it should actually be inet6_del_offload(), also
    ipv6_exthdrs_offload_exit() from that commit seems rather incorrect (it
    also uses rthdr_offload twice), but it got removed entirely later on.
    
    Fixes: 3336288a9fea ("ipv6: Switch to using new offload infrastructure.")
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3c09b8d5a113683a58b48c85930afc8ea4c37bcf
Author: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
Date:   Mon Aug 24 23:13:42 2015 +0300

    usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared
    
    [ Upstream commit f50791ac1aca1ac1b0370d62397b43e9f831421a ]
    
    It is needed to check EVENT_NO_RUNTIME_PM bit of dev->flags in
    usbnet_stop(), but its value should be read before it is cleared
    when dev->flags is set to 0.
    
    The problem was spotted and the fix was provided by
    Oliver Neukum <oneukum@suse.de>.
    
    Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
    Acked-by: Oliver Neukum <oneukum@suse.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 48b478e1cabce50f545b71ef0229fa45d1cf1a28
Author: huaibin Wang <huaibin.wang@6wind.com>
Date:   Tue Aug 25 16:20:34 2015 +0200

    ip6_gre: release cached dst on tunnel removal
    
    [ Upstream commit d4257295ba1b389c693b79de857a96e4b7cd8ac0 ]
    
    When a tunnel is deleted, the cached dst entry should be released.
    
    This problem may prevent the removal of a netns (seen with a x-netns IPv6
    gre tunnel):
      unregister_netdevice: waiting for lo to become free. Usage count = 3
    
    CC: Dmitry Kozlov <xeb@mail.ru>
    Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
    Signed-off-by: huaibin Wang <huaibin.wang@6wind.com>
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d14ac6a4d278921f695ba6ba6e2fa09e85456eba
Author: Hin-Tak Leung <htl10@users.sourceforge.net>
Date:   Wed Sep 9 15:38:04 2015 -0700

    hfs,hfsplus: cache pages correctly between bnode_create and bnode_free
    
    commit 7cb74be6fd827e314f81df3c5889b87e4c87c569 upstream.
    
    Pages looked up by __hfs_bnode_create() (called by hfs_bnode_create() and
    hfs_bnode_find() for finding or creating pages corresponding to an inode)
    are immediately kmap()'ed and used (both read and write) and kunmap()'ed,
    and should not be page_cache_release()'ed until hfs_bnode_free().
    
    This patch fixes a problem I first saw in July 2012: merely running "du"
    on a large hfsplus-mounted directory a few times on a reasonably loaded
    system would get the hfsplus driver all confused and complaining about
    B-tree inconsistencies, and generates a "BUG: Bad page state".  Most
    recently, I can generate this problem on up-to-date Fedora 22 with shipped
    kernel 4.0.5, by running "du /" (="/" + "/home" + "/mnt" + other smaller
    mounts) and "du /mnt" simultaneously on two windows, where /mnt is a
    lightly-used QEMU VM image of the full Mac OS X 10.9:
    
    $ df -i / /home /mnt
    Filesystem                  Inodes   IUsed      IFree IUse% Mounted on
    /dev/mapper/fedora-root    3276800  551665    2725135   17% /
    /dev/mapper/fedora-home   52879360  716221   52163139    2% /home
    /dev/nbd0p2             4294967295 1387818 4293579477    1% /mnt
    
    After applying the patch, I was able to run "du /" (60+ times) and "du
    /mnt" (150+ times) continuously and simultaneously for 6+ hours.
    
    There are many reports of the hfsplus driver getting confused under load
    and generating "BUG: Bad page state" or other similar issues over the
    years.  [1]
    
    The unpatched code [2] has always been wrong since it entered the kernel
    tree.  The only reason why it gets away with it is that the
    kmap/memcpy/kunmap follow very quickly after the page_cache_release() so
    the kernel has not had a chance to reuse the memory for something else,
    most of the time.
    
    The current RW driver appears to have followed the design and development
    of the earlier read-only hfsplus driver [3], where-by version 0.1 (Dec
    2001) had a B-tree node-centric approach to
    read_cache_page()/page_cache_release() per bnode_get()/bnode_put(),
    migrating towards version 0.2 (June 2002) of caching and releasing pages
    per inode extents.  When the current RW code first entered the kernel [2]
    in 2005, there was an REF_PAGES conditional (and "//" commented out code)
    to switch between B-node centric paging to inode-centric paging.  There
    was a mistake with the direction of one of the REF_PAGES conditionals in
    __hfs_bnode_create().  In a subsequent "remove debug code" commit [4], the
    read_cache_page()/page_cache_release() per bnode_get()/bnode_put() were
    removed, but a page_cache_release() was mistakenly left in (propagating
    the "REF_PAGES <-> !REF_PAGE" mistake), and the commented-out
    page_cache_release() in bnode_release() (which should be spanned by
    !REF_PAGES) was never enabled.
    
    References:
    [1]:
    Michael Fox, Apr 2013
    http://www.spinics.net/lists/linux-fsdevel/msg63807.html
    ("hfsplus volume suddenly inaccessable after 'hfs: recoff %d too large'")
    
    Sasha Levin, Feb 2015
    http://lkml.org/lkml/2015/2/20/85 ("use after free")
    
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/740814
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1027887
    https://bugzilla.kernel.org/show_bug.cgi?id=42342
    https://bugzilla.kernel.org/show_bug.cgi?id=63841
    https://bugzilla.kernel.org/show_bug.cgi?id=78761
    
    [2]:
    http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/\
    fs/hfs/bnode.c?id=d1081202f1d0ee35ab0beb490da4b65d4bc763db
    commit d1081202f1d0ee35ab0beb490da4b65d4bc763db
    Author: Andrew Morton <akpm@osdl.org>
    Date:   Wed Feb 25 16:17:36 2004 -0800
    
        [PATCH] HFS rewrite
    
    http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/\
    fs/hfsplus/bnode.c?id=91556682e0bf004d98a529bf829d339abb98bbbd
    
    commit 91556682e0bf004d98a529bf829d339abb98bbbd
    Author: Andrew Morton <akpm@osdl.org>
    Date:   Wed Feb 25 16:17:48 2004 -0800
    
        [PATCH] HFS+ support
    
    [3]:
    http://sourceforge.net/projects/linux-hfsplus/
    
    http://sourceforge.net/projects/linux-hfsplus/files/Linux%202.4.x%20patch/hfsplus%200.1/
    http://sourceforge.net/projects/linux-hfsplus/files/Linux%202.4.x%20patch/hfsplus%200.2/
    
    http://linux-hfsplus.cvs.sourceforge.net/viewvc/linux-hfsplus/linux/\
    fs/hfsplus/bnode.c?r1=1.4&r2=1.5
    
    Date:   Thu Jun 6 09:45:14 2002 +0000
    Use buffer cache instead of page cache in bnode.c. Cache inode extents.
    
    [4]:
    http://git.kernel.org/cgit/linux/kernel/git/\
    stable/linux-stable.git/commit/?id=a5e3985fa014029eb6795664c704953720cc7f7d
    
    commit a5e3985fa014029eb6795664c704953720cc7f7d
    Author: Roman Zippel <zippel@linux-m68k.org>
    Date:   Tue Sep 6 15:18:47 2005 -0700
    
    [PATCH] hfs: remove debug code
    
    Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
    Signed-off-by: Sergei Antonov <saproj@gmail.com>
    Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
    Reported-by: Sasha Levin <sasha.levin@oracle.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
    Cc: Sougata Santra <sougata@tuxera.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8769343adcbcc35e9f02ddc82eb655e61e2b605c
Author: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Date:   Wed Jun 24 11:47:41 2015 +0300

    stmmac: troubleshoot unexpected bits in des0 & des1
    
    commit f1590670ce069eefeb93916391a67643e6ad1630 upstream.
    
    Current implementation of descriptor init procedure only takes
    care about setting/clearing ownership flag in "des0"/"des1"
    fields while it is perfectly possible to get unexpected bits
    set because of the following factors:
    
     [1] On driver probe underlying memory allocated with
         dma_alloc_coherent() might not be zeroed and so
         it will be filled with garbage.
    
     [2] During driver operation some bits could be set by SD/MMC
         controller (for example error flags etc).
    
    And unexpected and/or randomly set flags in "des0"/"des1"
    fields may lead to unpredictable behavior of GMAC DMA block.
    
    This change addresses both items above with:
    
     [1] Use of dma_zalloc_coherent() instead of simple
         dma_alloc_coherent() to make sure allocated memory is
         zeroed. That shouldn't affect performance because
         this allocation only happens once on driver probe.
    
     [2] Do explicit zeroing of both "des0" and "des1" fields
         of all buffer descriptors during initialization of
         DMA transfer.
    
    And while at it fixed identation of dma_free_coherent()
    counterpart as well.
    
    Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
    Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
    Cc: arc-linux-dev@synopsys.com
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Cc: David Miller <davem@davemloft.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 98b7c9218f63ef7ce3bf842aa22177ccbb3a7b25
Author: Noa Osherovich <noaos@mellanox.com>
Date:   Thu Jul 30 17:34:24 2015 +0300

    IB/mlx4: Use correct SL on AH query under RoCE
    
    commit 5e99b139f1b68acd65e36515ca347b03856dfb5a upstream.
    
    The mlx4 IB driver implementation for ib_query_ah used a wrong offset
    (28 instead of 29) when link type is Ethernet. Fixed to use the correct one.
    
    Fixes: fa417f7b520e ('IB/mlx4: Add support for IBoE')
    Signed-off-by: Shani Michaeli <shanim@mellanox.com>
    Signed-off-by: Noa Osherovich <noaos@mellanox.com>
    Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 36a2ea3b6de1e751a9563333a7b697098ee85195
Author: Jack Morgenstein <jackm@dev.mellanox.co.il>
Date:   Thu Jul 30 17:34:23 2015 +0300

    IB/mlx4: Forbid using sysfs to change RoCE pkeys
    
    commit 2b135db3e81301d0452e6aa107349abe67b097d6 upstream.
    
    The pkey mapping for RoCE must remain the default mapping:
    VFs:
      virtual index 0 = mapped to real index 0 (0xFFFF)
      All others indices: mapped to a real pkey index containing an
                          invalid pkey.
    PF:
      virtual index i = real index i.
    
    Don't allow users to change these mappings using files found in
    sysfs.
    
    Fixes: c1e7e466120b ('IB/mlx4: Add iov directory in sysfs under the ib device')
    Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d59a6097eb633280452bb656bd440ec83b42bc58
Author: Yishai Hadas <yishaih@mellanox.com>
Date:   Thu Aug 13 18:32:03 2015 +0300

    IB/uverbs: Fix race between ib_uverbs_open and remove_one
    
    commit 35d4a0b63dc0c6d1177d4f532a9deae958f0662c upstream.
    
    Fixes: 2a72f212263701b927559f6850446421d5906c41 ("IB/uverbs: Remove dev_table")
    
    Before this commit there was a device look-up table that was protected
    by a spin_lock used by ib_uverbs_open and by ib_uverbs_remove_one. When
    it was dropped and container_of was used instead, it enabled the race
    with remove_one as dev might be freed just after:
    dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev) but
    before the kref_get.
    
    In addition, this buggy patch added some dead code as
    container_of(x,y,z) can never be NULL and so dev can never be NULL.
    As a result the comment above ib_uverbs_open saying "the open method
    will either immediately run -ENXIO" is wrong as it can never happen.
    
    The solution follows Jason Gunthorpe suggestion from below URL:
    https://www.mail-archive.com/linux-rdma@vger.kernel.org/msg25692.html
    
    cdev will hold a kref on the parent (the containing structure,
    ib_uverbs_device) and only when that kref is released it is
    guaranteed that open will never be called again.
    
    In addition, fixes the active count scheme to use an atomic
    not a kref to prevent WARN_ON as pointed by above comment
    from Jason.
    
    Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
    Signed-off-by: Shachar Raindel <raindel@mellanox.com>
    Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 6c1375b0ef61048fb83ae9dc1cf42254faa3ac38
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Aug 26 11:00:37 2015 +0200

    IB/uverbs: reject invalid or unknown opcodes
    
    commit b632ffa7cee439ba5dce3b3bc4a5cbe2b3e20133 upstream.
    
    We have many WR opcodes that are only supported in kernel space
    and/or require optional information to be copied into the WR
    structure.  Reject all those not explicitly handled so that we
    can't pass invalid information to drivers.
    
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
    Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 9b0c3ad1848c97f83f9f752b8445ffbc1e92afa0
Author: Mike Marciniszyn <mike.marciniszyn@intel.com>
Date:   Tue Jul 21 08:36:07 2015 -0400

    IB/qib: Change lkey table allocation to support more MRs
    
    commit d6f1c17e162b2a11e708f28fa93f2f79c164b442 upstream.
    
    The lkey table is allocated with with a get_user_pages() with an
    order based on a number of index bits from a module parameter.
    
    The underlying kernel code cannot allocate that many contiguous pages.
    
    There is no reason the underlying memory needs to be physically
    contiguous.
    
    This patch:
    - switches the allocation/deallocation to vmalloc/vfree
    - caps the number of bits to 23 to insure at least 1 generation bit
      o this matches the module parameter description
    
    Reviewed-by: Vinit Agnihotri <vinit.abhay.agnihotri@intel.com>
    Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 5eb8a3fce3a02cf53b8c9c0aea7808ee9ddb3451
Author: Hin-Tak Leung <htl10@users.sourceforge.net>
Date:   Wed Sep 9 15:38:07 2015 -0700

    hfs: fix B-tree corruption after insertion at position 0
    
    commit b4cc0efea4f0bfa2477c56af406cfcf3d3e58680 upstream.
    
    Fix B-tree corruption when a new record is inserted at position 0 in the
    node in hfs_brec_insert().
    
    This is an identical change to the corresponding hfs b-tree code to Sergei
    Antonov's "hfsplus: fix B-tree corruption after insertion at position 0",
    to keep similar code paths in the hfs and hfsplus drivers in sync, where
    appropriate.
    
    Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
    Cc: Sergei Antonov <saproj@gmail.com>
    Cc: Joe Perches <joe@perches.com>
    Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
    Cc: Anton Altaparmakov <anton@tuxera.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 2081451cc4e6b0f79e82c52148392599358833e7
Author: David Vrabel <david.vrabel@citrix.com>
Date:   Fri Jan 9 18:06:12 2015 +0000

    xen/gntdev: convert priv->lock to a mutex
    
    commit 1401c00e59ea021c575f74612fe2dbba36d6a4ee upstream.
    
    Unmapping may require sleeping and we unmap while holding priv->lock, so
    convert it to a mutex.
    
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Cc: Ian Campbell <ian.campbell@citrix.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit c7af5eb41f18b5fc4629e754ff855f93ee88e301
Author: NeilBrown <neilb@suse.com>
Date:   Mon Jul 6 17:37:49 2015 +1000

    md/raid10: always set reshape_safe when initializing reshape_position.
    
    commit 299b0685e31c9f3dcc2d58ee3beca761a40b44b3 upstream.
    
    'reshape_position' tracks where in the reshape we have reached.
    'reshape_safe' tracks where in the reshape we have safely recorded
    in the metadata.
    
    These are compared to determine when to update the metadata.
    So it is important that reshape_safe is initialised properly.
    Currently it isn't.  When starting a reshape from the beginning
    it usually has the correct value by luck.  But when reducing the
    number of devices in a RAID10, it has the wrong value and this leads
    to the metadata not being updated correctly.
    This can lead to corruption if the reshape is not allowed to complete.
    
    This patch is suitable for any -stable kernel which supports RAID10
    reshape, which is 3.5 and later.
    
    Fixes: 3ea7daa5d7fd ("md/raid10: add reshape support")
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit cefcb16c7246e9f30572bbb5fc3760127c7b4e79
Author: Jialing Fu <jlfu@marvell.com>
Date:   Fri Aug 28 11:13:09 2015 +0800

    mmc: core: fix race condition in mmc_wait_data_done
    
    commit 71f8a4b81d040b3d094424197ca2f1bf811b1245 upstream.
    
    The following panic is captured in ker3.14, but the issue still exists
    in latest kernel.
    ---------------------------------------------------------------------
    [   20.738217] c0 3136 (Compiler) Unable to handle kernel NULL pointer dereference
    at virtual address 00000578
    ......
    [   20.738499] c0 3136 (Compiler) PC is at _raw_spin_lock_irqsave+0x24/0x60
    [   20.738527] c0 3136 (Compiler) LR is at _raw_spin_lock_irqsave+0x20/0x60
    [   20.740134] c0 3136 (Compiler) Call trace:
    [   20.740165] c0 3136 (Compiler) [<ffffffc0008ee900>] _raw_spin_lock_irqsave+0x24/0x60
    [   20.740200] c0 3136 (Compiler) [<ffffffc0000dd024>] __wake_up+0x1c/0x54
    [   20.740230] c0 3136 (Compiler) [<ffffffc000639414>] mmc_wait_data_done+0x28/0x34
    [   20.740262] c0 3136 (Compiler) [<ffffffc0006391a0>] mmc_request_done+0xa4/0x220
    [   20.740314] c0 3136 (Compiler) [<ffffffc000656894>] sdhci_tasklet_finish+0xac/0x264
    [   20.740352] c0 3136 (Compiler) [<ffffffc0000a2b58>] tasklet_action+0xa0/0x158
    [   20.740382] c0 3136 (Compiler) [<ffffffc0000a2078>] __do_softirq+0x10c/0x2e4
    [   20.740411] c0 3136 (Compiler) [<ffffffc0000a24bc>] irq_exit+0x8c/0xc0
    [   20.740439] c0 3136 (Compiler) [<ffffffc00008489c>] handle_IRQ+0x48/0xac
    [   20.740469] c0 3136 (Compiler) [<ffffffc000081428>] gic_handle_irq+0x38/0x7c
    ----------------------------------------------------------------------
    Because in SMP, "mrq" has race condition between below two paths:
    path1: CPU0: <tasklet context>
      static void mmc_wait_data_done(struct mmc_request *mrq)
      {
         mrq->host->context_info.is_done_rcv = true;
         //
         // If CPU0 has just finished "is_done_rcv = true" in path1, and at
         // this moment, IRQ or ICache line missing happens in CPU0.
         // What happens in CPU1 (path2)?
         //
         // If the mmcqd thread in CPU1(path2) hasn't entered to sleep mode:
         // path2 would have chance to break from wait_event_interruptible
         // in mmc_wait_for_data_req_done and continue to run for next
         // mmc_request (mmc_blk_rw_rq_prep).
         //
         // Within mmc_blk_rq_prep, mrq is cleared to 0.
         // If below line still gets host from "mrq" as the result of
         // compiler, the panic happens as we traced.
         wake_up_interruptible(&mrq->host->context_info.wait);
      }
    
    path2: CPU1: <The mmcqd thread runs mmc_queue_thread>
      static int mmc_wait_for_data_req_done(...
      {
         ...
         while (1) {
               wait_event_interruptible(context_info->wait,
                       (context_info->is_done_rcv ||
                        context_info->is_new_req));
         	   static void mmc_blk_rw_rq_prep(...
               {
               ...
               memset(brq, 0, sizeof(struct mmc_blk_request));
    
    This issue happens very coincidentally; however adding mdelay(1) in
    mmc_wait_data_done as below could duplicate it easily.
    
       static void mmc_wait_data_done(struct mmc_request *mrq)
       {
         mrq->host->context_info.is_done_rcv = true;
    +    mdelay(1);
         wake_up_interruptible(&mrq->host->context_info.wait);
        }
    
    At runtime, IRQ or ICache line missing may just happen at the same place
    of the mdelay(1).
    
    This patch gets the mmc_context_info at the beginning of function, it can
    avoid this race condition.
    
    Signed-off-by: Jialing Fu <jlfu@marvell.com>
    Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
    Fixes: 2220eedfd7ae ("mmc: fix async request mechanism ....")
    Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7e73d2c59849bc65aac2c45bcdf1e69747780828
Author: Jann Horn <jann@thejh.net>
Date:   Wed Sep 9 15:38:28 2015 -0700

    fs: if a coredump already exists, unlink and recreate with O_EXCL
    
    commit fbb1816942c04429e85dbf4c1a080accc534299e upstream.
    
    It was possible for an attacking user to trick root (or another user) into
    writing his coredumps into an attacker-readable, pre-existing file using
    rename() or link(), causing the disclosure of secret data from the victim
    process' virtual memory.  Depending on the configuration, it was also
    possible to trick root into overwriting system files with coredumps.  Fix
    that issue by never writing coredumps into existing files.
    
    Requirements for the attack:
     - The attack only applies if the victim's process has a nonzero
       RLIMIT_CORE and is dumpable.
     - The attacker can trick the victim into coredumping into an
       attacker-writable directory D, either because the core_pattern is
       relative and the victim's cwd is attacker-writable or because an
       absolute core_pattern pointing to a world-writable directory is used.
     - The attacker has one of these:
      A: on a system with protected_hardlinks=0:
         execute access to a folder containing a victim-owned,
         attacker-readable file on the same partition as D, and the
         victim-owned file will be deleted before the main part of the attack
         takes place. (In practice, there are lots of files that fulfill
         this condition, e.g. entries in Debian's /var/lib/dpkg/info/.)
         This does not apply to most Linux systems because most distros set
         protected_hardlinks=1.
      B: on a system with protected_hardlinks=1:
         execute access to a folder containing a victim-owned,
         attacker-readable and attacker-writable file on the same partition
         as D, and the victim-owned file will be deleted before the main part
         of the attack takes place.
         (This seems to be uncommon.)
      C: on any system, independent of protected_hardlinks:
         write access to a non-sticky folder containing a victim-owned,
         attacker-readable file on the same partition as D
         (This seems to be uncommon.)
    
    The basic idea is that the attacker moves the victim-owned file to where
    he expects the victim process to dump its core.  The victim process dumps
    its core into the existing file, and the attacker reads the coredump from
    it.
    
    If the attacker can't move the file because he does not have write access
    to the containing directory, he can instead link the file to a directory
    he controls, then wait for the original link to the file to be deleted
    (because the kernel checks that the link count of the corefile is 1).
    
    A less reliable variant that requires D to be non-sticky works with link()
    and does not require deletion of the original link: link() the file into
    D, but then unlink() it directly before the kernel performs the link count
    check.
    
    On systems with protected_hardlinks=0, this variant allows an attacker to
    not only gain information from coredumps, but also clobber existing,
    victim-writable files with coredumps.  (This could theoretically lead to a
    privilege escalation.)
    
    Signed-off-by: Jann Horn <jann@thejh.net>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 9ee9b7b6eddb207f959952b30e785bd3c384cae1
Author: Jaewon Kim <jaewon31.kim@samsung.com>
Date:   Tue Sep 8 15:02:21 2015 -0700

    vmscan: fix increasing nr_isolated incurred by putback unevictable pages
    
    commit c54839a722a02818677bcabe57e957f0ce4f841d upstream.
    
    reclaim_clean_pages_from_list() assumes that shrink_page_list() returns
    number of pages removed from the candidate list.  But shrink_page_list()
    puts back mlocked pages without passing it to caller and without
    counting as nr_reclaimed.  This increases nr_isolated.
    
    To fix this, this patch changes shrink_page_list() to pass unevictable
    pages back to caller.  Caller will take care those pages.
    
    Minchan said:
    
    It fixes two issues.
    
    1. With unevictable page, cma_alloc will be successful.
    
    Exactly speaking, cma_alloc of current kernel will fail due to
    unevictable pages.
    
    2. fix leaking of NR_ISOLATED counter of vmstat
    
    With it, too_many_isolated works.  Otherwise, it could make hang until
    the process get SIGKILL.
    
    Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
    Acked-by: Minchan Kim <minchan@kernel.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 768cb8d9028cc71a8b3ecc6d2de9f02db09b044f
Author: Helge Deller <deller@gmx.de>
Date:   Thu Sep 3 22:45:21 2015 +0200

    parisc: Filter out spurious interrupts in PA-RISC irq handler
    
    commit b1b4e435e4ef7de77f07bf2a42c8380b960c2d44 upstream.
    
    When detecting a serial port on newer PA-RISC machines (with iosapic) we have a
    long way to go to find the right IRQ line, registering it, then registering the
    serial port and the irq handler for the serial port. During this phase spurious
    interrupts for the serial port may happen which then crashes the kernel because
    the action handler might not have been set up yet.
    
    So, basically it's a race condition between the serial port hardware and the
    CPU which sets up the necessary fields in the irq sructs. The main reason for
    this race is, that we unmask the serial port irqs too early without having set
    up everything properly before (which isn't easily possible because we need the
    IRQ number to register the serial ports).
    
    This patch is a work-around for this problem. It adds checks to the CPU irq
    handler to verify if the IRQ action field has been initialized already. If not,
    we just skip this interrupt (which isn't critical for a serial port at bootup).
    The real fix would probably involve rewriting all PA-RISC specific IRQ code
    (for CPU, IOSAPIC, GSC and EISA) to use IRQ domains with proper parenting of
    the irq chips and proper irq enabling along this line.
    
    This bug has been in the PA-RISC port since the beginning, but the crashes
    happened very rarely with currently used hardware.  But on the latest machine
    which I bought (a C8000 workstation), which uses the fastest CPUs (4 x PA8900,
    1GHz) and which has the largest possible L1 cache size (64MB each), the kernel
    crashed at every boot because of this race. So, without this patch the machine
    would currently be unuseable.
    
    For the record, here is the flow logic:
    1. serial_init_chip() in 8250_gsc.c calls iosapic_serial_irq().
    2. iosapic_serial_irq() calls txn_alloc_irq() to find the irq.
    3. iosapic_serial_irq() calls cpu_claim_irq() to register the CPU irq
    4. cpu_claim_irq() unmasks the CPU irq (which it shouldn't!)
    5. serial_init_chip() then registers the 8250 port.
    Problems:
    - In step 4 the CPU irq shouldn't have been registered yet, but after step 5
    - If serial irq happens between 4 and 5 have finished, the kernel will crash
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a6209e19d879aa077c3e58fc8ba38a3ffb1f61da
Author: Trond Myklebust <trond.myklebust@primarydata.com>
Date:   Mon Aug 17 12:57:07 2015 -0500

    NFS: nfs_set_pgio_error sometimes misses errors
    
    commit e9ae58aeee8842a50f7e199d602a5ccb2e41a95f upstream.
    
    We should ensure that we always set the pgio_header's error field
    if a READ or WRITE RPC call returns an error. The current code depends
    on 'hdr->good_bytes' always being initialised to a large value, which
    is not always done correctly by callers.
    When this happens, applications may end up missing important errors.
    
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit d71ea882b4c5e2f23b6631f6f546b6b1756a7d93
Author: NeilBrown <neilb@suse.com>
Date:   Thu Jul 30 13:00:56 2015 +1000

    NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
    
    commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.
    
    It is unusual to combine the open flags O_RDONLY and O_EXCL, but
    it appears that libre-office does just that.
    
    [pid  3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
    [pid  3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL <unfinished ...>
    
    NFSv4 takes O_EXCL as a sign that a setattr command should be sent,
    probably to reset the timestamps.
    
    When it was an O_RDONLY open, the SETATTR command does not
    identify any actual attributes to change.
    If no delegation was provided to the open, the SETATTR uses the
    all-zeros stateid and the request is accepted (at least by the
    Linux NFS server - no harm, no foul).
    
    If a read-delegation was provided, this is used in the SETATTR
    request, and a Netapp filer will justifiably claim
    NFS4ERR_BAD_STATEID, which the Linux client takes as a sign
    to retry - indefinitely.
    
    So only treat O_EXCL specially if O_CREAT was also given.
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 50ee5ae51b870f119dc9ffd9bfd65d7d062a6a70
Author: Filipe Manana <fdmanana@suse.com>
Date:   Wed Aug 12 11:54:35 2015 +0100

    Btrfs: check if previous transaction aborted to avoid fs corruption
    
    commit 1f9b8c8fbc9a4d029760b16f477b9d15500e3a34 upstream.
    
    While we are committing a transaction, it's possible the previous one is
    still finishing its commit and therefore we wait for it to finish first.
    However we were not checking if that previous transaction ended up getting
    aborted after we waited for it to commit, so we ended up committing the
    current transaction which can lead to fs corruption because the new
    superblock can point to trees that have had one or more nodes/leafs that
    were never durably persisted.
    The following sequence diagram exemplifies how this is possible:
    
              CPU 0                                                        CPU 1
    
      transaction N starts
    
      (...)
    
      btrfs_commit_transaction(N)
    
        cur_trans->state = TRANS_STATE_COMMIT_START;
        (...)
        cur_trans->state = TRANS_STATE_COMMIT_DOING;
        (...)
    
        cur_trans->state = TRANS_STATE_UNBLOCKED;
        root->fs_info->running_transaction = NULL;
    
                                                                  btrfs_start_transaction()
                                                                     --> starts transaction N + 1
    
        btrfs_write_and_wait_transaction(trans, root);
          --> starts writing all new or COWed ebs created
              at transaction N
    
                                                                  creates some new ebs, COWs some
                                                                  existing ebs but doesn't COW or
                                                                  deletes eb X
    
                                                                  btrfs_commit_transaction(N + 1)
                                                                    (...)
                                                                    cur_trans->state = TRANS_STATE_COMMIT_START;
                                                                    (...)
                                                                    wait_for_commit(root, prev_trans);
                                                                      --> prev_trans == transaction N
    
        btrfs_write_and_wait_transaction() continues
        writing ebs
           --> fails writing eb X, we abort transaction N
               and set bit BTRFS_FS_STATE_ERROR on
               fs_info->fs_state, so no new transactions
               can start after setting that bit
    
           cleanup_transaction()
             btrfs_cleanup_one_transaction()
               wakes up task at CPU 1
    
                                                                    continues, doesn't abort because
                                                                    cur_trans->aborted (transaction N + 1)
                                                                    is zero, and no checks for bit
                                                                    BTRFS_FS_STATE_ERROR in fs_info->fs_state
                                                                    are made
    
                                                                    btrfs_write_and_wait_transaction(trans, root);
                                                                      --> succeeds, no errors during writeback
    
                                                                    write_ctree_super(trans, root, 0);
                                                                      --> succeeds
                                                                      --> we have now a superblock that points us
                                                                          to some root that uses eb X, which was
                                                                          never written to disk
    
    In this scenario future attempts to read eb X from disk results in an
    error message like "parent transid verify failed on X wanted Y found Z".
    
    So fix this by aborting the current transaction if after waiting for the
    previous transaction we verify that it was aborted.
    
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: Josef Bacik <jbacik@fb.com>
    Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
    Signed-off-by: Chris Mason <clm@fb.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 887d34e970a91c62963b81b3d2cf3878ef410d67
Author: Sakari Ailus <sakari.ailus@iki.fi>
Date:   Fri Jun 12 20:06:23 2015 -0300

    v4l: omap3isp: Fix sub-device power management code
    
    commit 9d39f05490115bf145e5ea03c0b7ec9d3d015b01 upstream.
    
    Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
    modified the media controller link setup notification API and updated the
    OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
    turning power on after setting the link instead of before. This results in
    sub-devices not being powered down in some cases when they should be. Fix
    it.
    
    Fixes: 813f5c0ac5cc [media] media: Change media device link_notify behaviour
    
    Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 152824ba7607ab70ad03aaa3668567c761fe3d90
Author: David Härdeman <david@hardeman.nu>
Date:   Tue May 19 19:03:12 2015 -0300

    rc-core: fix remove uevent generation
    
    commit a66b0c41ad277ae62a3ae6ac430a71882f899557 upstream.
    
    The input_dev is already gone when the rc device is being unregistered
    so checking for its presence only means that no remove uevent will be
    generated.
    
    Signed-off-by: David Härdeman <david@hardeman.nu>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a6a47b4077106e462d40d162e858f26d2c84d393
Author: Minfei Huang <mnfhuang@gmail.com>
Date:   Sun Jul 12 20:18:42 2015 +0800

    x86/mm: Initialize pmd_idx in page_table_range_init_count()
    
    commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream.
    
    The variable pmd_idx is not initialized for the first iteration of the
    for loop.
    
    Assign the proper value which indexes the start address.
    
    Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once'
    Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
    Cc: tony.luck@intel.com
    Cc: wangnan0@huawei.com
    Cc: david.vrabel@citrix.com
    Reviewed-by: yinghai@kernel.org
    Link: http://lkml.kernel.org/r/1436703522-29552-1-git-send-email-mhuang@redhat.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit bb64a76e58bac72537e46a8e334afaaaf26439cc
Author: Jeffery Miller <jmiller@neverware.com>
Date:   Tue Sep 1 11:23:02 2015 -0400

    Add radeon suspend/resume quirk for HP Compaq dc5750.
    
    commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.
    
    With the radeon driver loaded the HP Compaq dc5750
    Small Form Factor machine fails to resume from suspend.
    Adding a quirk similar to other devices avoids
    the problem and the system resumes properly.
    
    Signed-off-by: Jeffery Miller <jmiller@neverware.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit bdb0c2665ab9ee53a4f5d412feb002ae3b7acef0
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Date:   Tue Sep 15 12:30:08 2015 +0530

    powerpc/mm: Recompute hash value after a failed update
    
    commit 36b35d5d807b7e57aff7d08e63de8b17731ee211 upstream.
    
    If we had secondary hash flag set, we ended up modifying hash value in
    the updatepp code path. Hence with a failed updatepp we will be using
    a wrong hash value for the following hash insert. Fix this by
    recomputing hash before insert.
    
    Without this patch we can end up with using wrong slot number in linux
    pte. That can result in us missing an hash pte update or invalidate
    which can cause memory corruption or even machine check.
    
    Fixes: 6d492ecc6489 ("powerpc/THP: Add code to handle HPTE faults for hugepages")
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Reviewed-by: Paul Mackerras <paulus@samba.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 108ff5980c9b9a99f999c3e7cb8dfdf467e1a100
Author: Thomas Huth <thuth@redhat.com>
Date:   Fri Jul 17 12:46:58 2015 +0200

    powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
    
    commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.
    
    The EPOW interrupt handler uses rtas_get_sensor(), which in turn
    uses rtas_busy_delay() to wait for RTAS becoming ready in case it
    is necessary. But rtas_busy_delay() is annotated with might_sleep()
    and thus may not be used by interrupts handlers like the EPOW handler!
    This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
    enabled:
    
     BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496
     in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
     CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
     Call Trace:
     [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable)
     [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180
     [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0
     [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0
     [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450
     [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300
     [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0
     [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260
     [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80
     [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200
     [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24
     [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110
     [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180
    
    Fix this issue by introducing a new rtas_get_sensor_fast() function
    that does not use rtas_busy_delay() - and thus can only be used for
    sensors that do not cause a BUSY condition - known as "fast" sensors.
    
    The EPOW sensor is defined to be "fast" in sPAPR - mpe.
    
    Fixes: 587f83e8dd50 ("powerpc/pseries: Use rtas_get_sensor in RAS code")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 33493c71e528ef28d59d736bee868ff2132a2ccc
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri Aug 7 16:19:43 2015 +1000

    powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash
    
    commit 74b5037baa2011a2799e2c43adde7d171b072f9e upstream.
    
    The powerpc kernel can be built to have either a 4K PAGE_SIZE or a 64K
    PAGE_SIZE.
    
    However when built with a 4K PAGE_SIZE there is an additional config
    option which can be enabled, PPC_HAS_HASH_64K, which means the kernel
    also knows how to hash a 64K page even though the base PAGE_SIZE is 4K.
    
    This is used in one obscure configuration, to support 64K pages for SPU
    local store on the Cell processor when the rest of the kernel is using
    4K pages.
    
    In this configuration, pte_pagesize_index() is defined to just pass
    through its arguments to get_slice_psize(). However pte_pagesize_index()
    is called for both user and kernel addresses, whereas get_slice_psize()
    only knows how to handle user addresses.
    
    This has been broken forever, however until recently it happened to
    work. That was because in get_slice_psize() the large kernel address
    would cause the right shift of the slice mask to return zero.
    
    However in commit 7aa0727f3302 ("powerpc/mm: Increase the slice range to
    64TB"), the get_slice_psize() code was changed so that instead of a
    right shift we do an array lookup based on the address. When passed a
    kernel address this means we index way off the end of the slice array
    and return random junk.
    
    That is only fatal if we happen to hit something non-zero, but when we
    do return a non-zero value we confuse the MMU code and eventually cause
    a check stop.
    
    This fix is ugly, but simple. When we're called for a kernel address we
    return 4K, which is always correct in this configuration, otherwise we
    use the slice mask.
    
    Fixes: 7aa0727f3302 ("powerpc/mm: Increase the slice range to 64TB")
    Reported-by: Cyril Bur <cyrilbur@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit bbe162237861cb769652928cff233337730fa433
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 13 18:05:06 2015 +0200

    ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437
    
    commit a161574e200ae63a5042120e0d8c36830e81bde3 upstream.
    
    It turned out that the machine has a bass speaker, so take a correct
    fixup entry.
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 5628604539f3d1b06252cc92605ae60a9a03ef5d
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Aug 13 18:02:39 2015 +0200

    ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
    
    commit bb148bdeb0ab16fc0ae8009799471e4d7180073b upstream.
    
    According to the bug report, FSC Amilo laptops with ALC880 can detect
    the headphone jack but currently the driver disables it.  It's partly
    intentionally, as non-working jack detect was reported in the past.
    Let's enable now.
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a9e13f8b1dcd5615fdde8234b9beb3b457cc7a57
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Sep 3 22:20:00 2015 -0700

    Input: evdev - do not report errors form flush()
    
    commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.
    
    We've got bug reports showing the old systemd-logind (at least
    system-210) aborting unexpectedly, and this turned out to be because
    of an invalid error code from close() call to evdev devices.  close()
    is supposed to return only either EINTR or EBADFD, while the device
    returned ENODEV.  logind was overreacting to it and decided to kill
    itself when an unexpected error code was received.  What a tragedy.
    
    The bad error code comes from flush fops, and actually evdev_flush()
    returns ENODEV when device is disconnected or client's access to it is
    revoked. But in these cases the fact that flush did not actually happen is
    not an error, but rather normal behavior. For non-disconnected devices
    result of flush is also not that interesting as there is no potential of
    data loss and even if it fails application has no way of handling the
    error. Because of that we are better off always returning success from
    evdev_flush().
    
    Also returning EINTR from flush()/close() is discouraged (as it is not
    clear how application should handle this error), so let's stop taking
    evdev->mutex interruptibly.
    
    Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit eaebd1fba83da84665c38195ef977647adf3dc5c
Author: Marc Zyngier <marc.zyngier@arm.com>
Date:   Wed Sep 16 16:18:59 2015 +0100

    arm64: KVM: Disable virtual timer even if the guest is not using it
    
    commit c4cbba9fa078f55d9f6d081dbb4aec7cf969e7c7 upstream.
    
    When running a guest with the architected timer disabled (with QEMU and
    the kernel_irqchip=off option, for example), it is important to make
    sure the timer gets turned off. Otherwise, the guest may try to
    enable it anyway, leading to a screaming HW interrupt.
    
    The fix is to unconditionally turn off the virtual timer on guest
    exit.
    
    Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 86230818ac7bb48f7821d9c41d96a1233c4535c3
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Mar 17 12:15:02 2015 +0000

    arm64: errata: add module build workaround for erratum #843419
    
    commit df057cc7b4fa59e9b55f07ffdb6c62bf02e99a00 upstream.
    
    Cortex-A53 processors <= r0p4 are affected by erratum #843419 which can
    lead to a memory access using an incorrect address in certain sequences
    headed by an ADRP instruction.
    
    There is a linker fix to generate veneers for ADRP instructions, but
    this doesn't work for kernel modules which are built as unlinked ELF
    objects.
    
    This patch adds a new config option for the erratum which, when enabled,
    builds kernel modules with the mcmodel=large flag. This uses absolute
    addressing for all kernel symbols, thereby removing the use of ADRP as
    a PC-relative form of addressing. The ADRP relocs are removed from the
    module loader so that we fail to load any potentially affected modules.
    
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3ebb37283c93282592beba3f01e46c8f8371dee8
Author: Will Deacon <will.deacon@arm.com>
Date:   Wed Sep 2 18:49:28 2015 +0100

    arm64: head.S: initialise mdcr_el2 in el2_setup
    
    commit d10bcd473301888f957ec4b6b12aa3621be78d59 upstream.
    
    When entering the kernel at EL2, we fail to initialise the MDCR_EL2
    register which controls debug access and PMU capabilities at EL1.
    
    This patch ensures that the register is initialised so that all traps
    are disabled and all the PMU counters are available to the host. When a
    guest is scheduled, KVM takes care to configure trapping appropriately.
    
    Acked-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit cebbd84c2287bf8c0d89c589dd3042663215c76c
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Sep 15 12:07:06 2015 +0100

    arm64: compat: fix vfp save/restore across signal handlers in big-endian
    
    commit bdec97a855ef1e239f130f7a11584721c9a1bf04 upstream.
    
    When saving/restoring the VFP registers from a compat (AArch32)
    signal frame, we rely on the compat registers forming a prefix of the
    native register file and therefore make use of copy_{to,from}_user to
    transfer between the native fpsimd_state and the compat_vfp_sigframe.
    
    Unfortunately, this doesn't work so well in a big-endian environment.
    Our fpsimd save/restore code operates directly on 128-bit quantities
    (Q registers) whereas the compat_vfp_sigframe represents the registers
    as an array of 64-bit (D) registers. The architecture packs the compat D
    registers into the Q registers, with the least significant bytes holding
    the lower register. Consequently, we need to swap the 64-bit halves when
    converting between these two representations on a big-endian machine.
    
    This patch replaces the __copy_{to,from}_user invocations in our
    compat VFP signal handling code with explicit __put_user loops that
    operate on 64-bit values and swap them accordingly.
    
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 584f19f33e3deb3069fd84a81822f28048f6f3be
Author: Jeff Vander Stoep <jeffv@google.com>
Date:   Tue Aug 18 20:50:10 2015 +0100

    arm64: kconfig: Move LIST_POISON to a safe value
    
    commit bf0c4e04732479f650ff59d1ee82de761c0071f0 upstream.
    
    Move the poison pointer offset to 0xdead000000000000, a
    recognized value that is not mappable by user-space exploits.
    
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Thierry Strudel <tstrudel@google.com>
    Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit aa21b9a683aee430dd378e82e36ddd4aab0cce4e
Author: Bob Copeland <me@bobcopeland.com>
Date:   Sat Jun 13 10:16:31 2015 -0400

    mac80211: enable assoc check for mesh interfaces
    
    commit 3633ebebab2bbe88124388b7620442315c968e8f upstream.
    
    We already set a station to be associated when peering completes, both
    in user space and in the kernel.  Thus we should always have an
    associated sta before sending data frames to that station.
    
    Failure to check assoc state can cause crashes in the lower-level driver
    due to transmitting unicast data frames before driver sta structures
    (e.g. ampdu state in ath9k) are initialized.  This occurred when
    forwarding in the presence of fixed mesh paths: frames were transmitted
    to stations with whom we hadn't yet completed peering.
    
    Reported-by: Alexis Green <agreen@cococorp.com>
    Tested-by: Jesse Jones <jjones@cococorp.com>
    Signed-off-by: Bob Copeland <me@bobcopeland.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8363652f19e1bbf2c5638a9f5e0ddee91d34e195
Author: Jean Delvare <jdelvare@suse.de>
Date:   Tue Sep 1 18:07:41 2015 +0200

    tg3: Fix temperature reporting
    
    commit d3d11fe08ccc9bff174fc958722b5661f0932486 upstream.
    
    The temperature registers appear to report values in degrees Celsius
    while the hwmon API mandates values to be exposed in millidegrees
    Celsius. Do the conversion so that the values reported by "sensors"
    are correct.
    
    Fixes: aed93e0bf493 ("tg3: Add hwmon support for temperature")
    Signed-off-by: Jean Delvare <jdelvare@suse.de>
    Cc: Prashant Sreedharan <prashant@broadcom.com>
    Cc: Michael Chan <mchan@broadcom.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 79b69ca80300f6b3ea5c857a430b5af87a9e19c5
Author: Adrien Schildknecht <adrien+dev@schischi.me>
Date:   Wed Aug 19 17:33:12 2015 +0200

    rtlwifi: rtl8192cu: Add new device ID
    
    commit 1642d09fb9b128e8e538b2a4179962a34f38dff9 upstream.
    
    The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043
    
    Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
    Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 40608bef40d58dc915cdb94274f76ca029372bec
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Mon Aug 10 17:35:07 2015 -0500

    unshare: Unsharing a thread does not require unsharing a vm
    
    commit 12c641ab8270f787dfcce08b5f20ce8b65008096 upstream.
    
    In the logic in the initial commit of unshare made creating a new
    thread group for a process, contingent upon creating a new memory
    address space for that process.  That is wrong.  Two separate
    processes in different thread groups can share a memory address space
    and clone allows creation of such proceses.
    
    This is significant because it was observed that mm_users > 1 does not
    mean that a process is multi-threaded, as reading /proc/PID/maps
    temporarily increments mm_users, which allows other processes to
    (accidentally) interfere with unshare() calls.
    
    Correct the check in check_unshare_flags() to test for
    !thread_group_empty() for CLONE_THREAD, CLONE_SIGHAND, and CLONE_VM.
    For sighand->count > 1 for CLONE_SIGHAND and CLONE_VM.
    For !current_is_single_threaded instead of mm_users > 1 for CLONE_VM.
    
    By using the correct checks in unshare this removes the possibility of
    an accidental denial of service attack.
    
    Additionally using the correct checks in unshare ensures that only an
    explicit unshare(CLONE_VM) can possibly trigger the slow path of
    current_is_single_threaded().  As an explict unshare(CLONE_VM) is
    pointless it is not expected there are many applications that make
    that call.
    
    Fixes: b2e0d98705e60e45bbb3c0032c48824ad7ae0704 userns: Implement unshare of the user namespace
    Reported-by: Ricky Zhou <rickyz@chromium.org>
    Reported-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8f5ea57d547accab3226e35bdabdf68c7b6f425b
Author: Imre Deak <imre.deak@intel.com>
Date:   Thu Oct 2 16:34:31 2014 +0300

    tty/vt: don't set font mappings on vc not supporting this
    
    commit 9e326f78713a4421fe11afc2ddeac07698fac131 upstream.
    
    We can call this function for a dummy console that doesn't support
    setting the font mapping, which will result in a null ptr BUG. So check
    for this case and return error for consoles w/o font mapping support.
    
    Reference: https://bugzilla.kernel.org/show_bug.cgi?id=59321
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 83bd38426a3b1ec9116afe60e5bbee1e9fe0cf44
Author: Mikulas Patocka <mikulas@twibright.com>
Date:   Wed Sep 2 22:51:53 2015 +0200

    hpfs: update ctime and mtime on directory modification
    
    commit f49a26e7718dd30b49e3541e3e25aecf5e7294e2 upstream.
    
    Update ctime and mtime when a directory is modified. (though OS/2 doesn't
    update them anyway)
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 65181120e266d3b1bf04d1020774c3510d2f8b82
Author: Grant Likely <grant.likely@linaro.org>
Date:   Sun Jun 7 15:20:11 2015 +0100

    drivercore: Fix unregistration path of platform devices
    
    commit 7f5dcaf1fdf289767a126a0a5cc3ef39b5254b06 upstream.
    
    The unregister path of platform_device is broken. On registration, it
    will register all resources with either a parent already set, or
    type==IORESOURCE_{IO,MEM}. However, on unregister it will release
    everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
    are also cases where resources don't get registered in the first place,
    like with devices created by of_platform_populate()*.
    
    Fix the unregister path to be symmetrical with the register path by
    checking the parent pointer instead of the type field to decide which
    resources to unregister. This is safe because the upshot of the
    registration path algorithm is that registered resources have a parent
    pointer, and non-registered resources do not.
    
    * It can be argued that of_platform_populate() should be registering
      it's resources, and they argument has some merit. However, there are
      quite a few platforms that end up broken if we try to do that due to
      overlapping resources in the device tree. Until that is fixed, we need
      to solve the immediate problem.
    
    Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
    Cc: Wolfram Sang <wsa@the-dreams.de>
    Cc: Rob Herring <robh@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Signed-off-by: Grant Likely <grant.likely@linaro.org>
    Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
    Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit b92a551eedc33a64be7a237abf854d09af918be0
Author: Vignesh R <vigneshr@ti.com>
Date:   Wed Jun 3 17:21:20 2015 +0530

    ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP
    
    commit b9e23f321940d2db2c9def8ff723b8464fb86343 upstream.
    
    Legacy IPs like PWMSS, present under l4per2_7xx_clkdm, cannot support
    smart-idle when its clock domain is in HW_AUTO on DRA7 SoCs. Hence,
    program clock domain to SW_WKUP.
    
    Signed-off-by: Vignesh R <vigneshr@ti.com>
    Acked-by: Tero Kristo <t-kristo@ti.com>
    Reviewed-by: Paul Walmsley <paul@pwsan.com>
    Signed-off-by: Paul Walmsley <paul@pwsan.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 6618a3748ff595dc6474b04a4b16a16688cfef54
Author: David Daney <david.daney@cavium.com>
Date:   Wed Aug 19 13:17:47 2015 -0700

    of/address: Don't loop forever in of_find_matching_node_by_address().
    
    commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab upstream.
    
    If the internal call to of_address_to_resource() fails, we end up
    looping forever in of_find_matching_node_by_address().  This can be
    caused by a defective device tree, or calling with an incorrect
    matches argument.
    
    Fix by calling of_find_matching_node() unconditionally at the end of
    the loop.
    
    Signed-off-by: David Daney <david.daney@cavium.com>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 067f3f38c3d2a223cfc6bda8c49a9daafcf19565
Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date:   Mon Jul 20 17:27:21 2015 +0530

    auxdisplay: ks0108: fix refcount
    
    commit bab383de3b84e584b0f09227151020b2a43dc34c upstream.
    
    parport_find_base() will implicitly do parport_get_port() which
    increases the refcount. Then parport_register_device() will again
    increment the refcount. But while unloading the module we are only
    doing parport_unregister_device() decrementing the refcount only once.
    We add an parport_put_port() to neutralize the effect of
    parport_get_port().
    
    Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 1e412fe3df4d27eb150e45504d8c0795fda083cb
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Wed Jul 15 10:29:00 2015 +0900

    devres: fix devres_get()
    
    commit 64526370d11ce8868ca495723d595b61e8697fbf upstream.
    
    Currently, devres_get() passes devres_free() the pointer to devres,
    but devres_free() should be given with the pointer to resource data.
    
    Fixes: 9ac7849e35f7 ("devres: device resource management")
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Acked-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit f29cc860971a95b6581f4f8f49be94ca4baa007d
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Thu Jul 16 10:41:02 2015 +0300

    xtensa: fix kernel register spilling
    
    commit 77d6273e79e3a86552fcf10cdd31a69b46ed2ce6 upstream.
    
    call12 can't be safely used as the first call in the inline function,
    because the compiler does not extend the stack frame of the bounding
    function accordingly, which may result in corruption of local variables.
    
    If a call needs to be done, do call8 first followed by call12.
    
    For pure assembly code in _switch_to increase stack frame size of the
    bounding function.
    
    Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit cc8fd3389247a99d4609af049ee2b958a84b6df5
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Sat Jul 4 15:27:39 2015 +0300

    xtensa: fix threadptr reload on return to userspace
    
    commit 4229fb12a03e5da5882b420b0aa4a02e77447b86 upstream.
    
    Userspace return code may skip restoring THREADPTR register if there are
    no registers that need to be zeroed. This leads to spurious failures in
    libc NPTL tests.
    
    Always restore THREADPTR on return to userspace.
    
    Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 776a11696c80ae905193edf3b85ce74b6046cfbf
Author: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Date:   Wed Aug 5 12:04:19 2015 +0800

    KVM: MMU: fix validation of mmio page fault
    
    commit 6f691251c0350ac52a007c54bf3ef62e9d8cdc5e upstream.
    
    We got the bug that qemu complained with "KVM: unknown exit, hardware
    reason 31" and KVM shown these info:
    [84245.284948] EPT: Misconfiguration.
    [84245.285056] EPT: GPA: 0xfeda848
    [84245.285154] ept_misconfig_inspect_spte: spte 0x5eaef50107 level 4
    [84245.285344] ept_misconfig_inspect_spte: spte 0x5f5fadc107 level 3
    [84245.285532] ept_misconfig_inspect_spte: spte 0x5141d18107 level 2
    [84245.285723] ept_misconfig_inspect_spte: spte 0x52e40dad77 level 1
    
    This is because we got a mmio #PF and the handler see the mmio spte becomes
    normal (points to the ram page)
    
    However, this is valid after introducing fast mmio spte invalidation which
    increases the generation-number instead of zapping mmio sptes, a example
    is as follows:
    1. QEMU drops mmio region by adding a new memslot
    2. invalidate all mmio sptes
    3.
    
            VCPU 0                        VCPU 1
        access the invalid mmio spte
                                access the region originally was MMIO before
                                set the spte to the normal ram map
    
        mmio #PF
        check the spte and see it becomes normal ram mapping !!!
    
    This patch fixes the bug just by dropping the check in mmio handler, it's
    good for backport. Full check will be introduced in later patches
    
    Reported-by: Pavel Shirshov <ru.pchel@gmail.com>
    Tested-by: Pavel Shirshov <ru.pchel@gmail.com>
    Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 26db2c34a9d1bc93ede1972b34f168ee93a2dec0
Author: Don Zickus <dzickus@redhat.com>
Date:   Mon Aug 10 12:06:53 2015 -0400

    HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error
    
    commit 3af4e5a95184d6d3c1c6a065f163faa174a96a1d upstream.
    
    It was reported that after 10-20 reboots, a usb keyboard plugged
    into a docking station would not work unless it was replugged in.
    
    Using usbmon, it turns out the interrupt URBs were streaming with
    callback errors of -71 for some reason.  The hid-core.c::hid_io_error was
    supposed to retry and then reset, but the reset wasn't really happening.
    
    The check for HID_NO_BANDWIDTH was inverted.  Fix was simple.
    
    Tested by reporter and locally by me by unplugging a keyboard halfway until I
    could recreate a stream of errors but no disconnect.
    
    Signed-off-by: Don Zickus <dzickus@redhat.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 9cc6ecb5434b06640060bee61e78a6a4d267596f
Author: Andrey Ryabinin <aryabinin@odin.com>
Date:   Thu Sep 3 14:32:01 2015 +0300

    crypto: ghash-clmulni: specify context size for ghash async algorithm
    
    commit 71c6da846be478a61556717ef1ee1cea91f5d6a8 upstream.
    
    Currently context size (cra_ctxsize) doesn't specified for
    ghash_async_alg. Which means it's zero. Thus crypto_create_tfm()
    doesn't allocate needed space for ghash_async_ctx, so any
    read/write to ctx (e.g. in ghash_async_init_tfm()) is not valid.
    
    Signed-off-by: Andrey Ryabinin <aryabinin@odin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 01e34fe8efcb116223840e7ceaa42a6dca9bcf98
Author: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Date:   Sun Aug 2 23:11:52 2015 +0200

    serial: 8250: don't bind to SMSC IrCC IR port
    
    commit ffa34de03bcfbfa88d8352942bc238bb48e94e2d upstream.
    
    SMSC IrCC SIR/FIR port should not be bound to by
    (legacy) serial driver so its own driver (smsc-ircc2)
    can bind to it.
    
    Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit fc188009fa7230a2b555f6cd528218ca9272359c
Author: Peter Chen <peter.chen@freescale.com>
Date:   Mon Aug 17 10:23:03 2015 +0800

    usb: host: ehci-sys: delete useless bus_to_hcd conversion
    
    commit 0521cfd06e1ebcd575e7ae36aab068b38df23850 upstream.
    
    The ehci platform device's drvdata is the pointer of struct usb_hcd
    already, so we doesn't need to call bus_to_hcd conversion again.
    
    Signed-off-by: Peter Chen <peter.chen@freescale.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit b41a80122636dcf62d382764bbdcac53dc4bd2da
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Mon Jul 27 12:25:27 2015 +0530

    usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes
    
    commit b2fb5b1a0f50d3ebc12342c8d8dead245e9c9d4e upstream.
    
    DWC3 uses bounce buffer to handle non max packet aligned OUT transfers and
    the size of bounce buffer is 512 bytes. However if the host initiates OUT
    transfers of size more than 512 bytes (and non max packet aligned), the
    driver throws a WARN dump but still programs the TRB to receive more than
    512 bytes. This will cause bounce buffer to overflow and corrupt the
    adjacent memory locations which can be fatal.
    
    Fix it by programming the TRB to receive a maximum of DWC3_EP0_BOUNCE_SIZE
    (512) bytes.
    
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Felipe Balbi <balbi@ti.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3e155c8b91ec6c6e261cd9902449cb4eb1a3f190
Author: Matthijs Kooijman <matthijs@stdin.nl>
Date:   Tue Aug 18 10:33:56 2015 +0200

    USB: ftdi_sio: Added custom PID for CustomWare products
    
    commit 1fb8dc36384ae1140ee6ccc470de74397606a9d5 upstream.
    
    CustomWare uses the FTDI VID with custom PIDs for their ShipModul MiniPlex
    products.
    
    Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 657b9e9427d94597deb17dbb70866343fe312455
Author: Philipp Hachtmann <hachti@hachti.de>
Date:   Mon Aug 17 17:31:46 2015 +0200

    USB: symbolserial: Use usb_get_serial_port_data
    
    commit 951d3793bbfc0a441d791d820183aa3085c83ea9 upstream.
    
    The driver used usb_get_serial_data(port->serial) which compiled but resulted
    in a NULL pointer being returned (and subsequently used). I did not go deeper
    into this but I guess this is a regression.
    
    Signed-off-by: Philipp Hachtmann <hachti@hachti.de>
    Fixes: a85796ee5149 ("USB: symbolserial: move private-data allocation to
    port_probe")
    Acked-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 8c9777e56564e7caeb93e6f61f31fadeb5063a56
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Fri Jun 19 15:58:24 2015 -0500

    PCI: Fix TI816X class code quirk
    
    commit d1541dc977d376406f4584d8eb055488655c98ec upstream.
    
    In fixup_ti816x_class(), we assigned "class = PCI_CLASS_MULTIMEDIA_VIDEO".
    But PCI_CLASS_MULTIMEDIA_VIDEO is only the two-byte base class/sub-class
    and needs to be shifted to make space for the low-order interface byte.
    
    Shift PCI_CLASS_MULTIMEDIA_VIDEO to set the correct class code.
    
    Fixes: 63c4408074cb ("PCI: Add quirk for setting valid class for TI816X Endpoint")
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: Hemant Pedanekar <hemantp@ti.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a1c6aebe73fa86c171b9b14d3402aaf2abc24975
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Wed Jul 29 13:17:06 2015 +0300

    clk: versatile: off by one in clk_sp810_timerclken_of_get()
    
    commit 3294bee87091be5f179474f6c39d1d87769635e2 upstream.
    
    The ">" should be ">=" or we end up reading beyond the end of the array.
    
    Fixes: 6e973d2c4385 ('clk: vexpress: Add separate SP810 driver')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Acked-by: Pawel Moll <pawel.moll@arm.com>
    Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit e2cc7c101008e30e15f6de620dfbfe12f29f338e
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Wed Aug 5 15:38:15 2015 +0200

    iio: adis16480: Fix scale factors
    
    commit 7abad1063deb0f77d275c61f58863ec319c58c5c upstream.
    
    The different devices support by the adis16480 driver have slightly
    different scales for the gyroscope and accelerometer channels.
    
    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 2e42c785118a9ab1e7fccd5b837b2220c7398ea5
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Wed Aug 5 15:38:14 2015 +0200

    iio: Add inverse unit conversion macros
    
    commit c689a923c867eac40ed3826c1d9328edea8b6bc7 upstream.
    
    Add inverse unit conversion macro to convert from standard IIO units to
    units that might be used by some devices.
    
    Those are useful in combination with scale factors that are specified as
    IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will
    contain the maximum raw value the sensor will generate and the numerator
    the value it maps to in a specific unit. Sometimes datasheets specify those
    in different units than the standard IIO units (e.g. degree/s instead of
    rad/s) and so we need to do a unit conversion.
    
    From a mathematical point of view it does not make a difference whether we
    apply the unit conversion to the numerator or the inverse unit conversion
    to the denominator since (x / y) / z = x / (y * z). But as the denominator
    is typically a larger value and we are rounding both the numerator and
    denominator to integer values using the later method gives us a better
    precision (E.g. the relative error is smaller if we round 8000.3 to 8000
    rather than rounding 8.3 to 8).
    
    This is where in inverse unit conversion macros will be used.
    
    Marked for stable as used by some upcoming fixes.
    
    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 93401d9ff5c5f4c57bd31b89c597002ccc876dd1
Author: Jonathon Jongsma <jjongsma@redhat.com>
Date:   Thu Aug 20 14:04:32 2015 -0500

    drm/qxl: validate monitors config modes
    
    commit bd3e1c7c6de9f5f70d97cdb6c817151c0477c5e3 upstream.
    
    Due to some recent changes in
    drm_helper_probe_single_connector_modes_merge_bits(), old custom modes
    were not being pruned properly. In current kernels,
    drm_mode_validate_basic() is called to sanity-check each mode in the
    list. If the sanity-check passes, the mode's status gets set to to
    MODE_OK. In older kernels this check was not done, so old custom modes
    would still have a status of MODE_UNVERIFIED at this point, and would
    therefore be pruned later in the function.
    
    As a result of this new behavior, the list of modes for a device always
    includes every custom mode ever configured for the device, with the
    largest one listed first. Since desktop environments usually choose the
    first preferred mode when a hotplug event is emitted, this had the
    result of making it very difficult for the user to reduce the size of
    the display.
    
    The qxl driver did implement the mode_valid connector function, but it
    was empty. In order to restore the old behavior where old custom modes
    are pruned, we implement a proper mode_valid function for the qxl
    driver. This function now checks each mode against the last configured
    custom mode and the list of standard modes. If the mode doesn't match
    any of these, its status is set to MODE_BAD so that it will be pruned as
    expected.
    
    Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 3b8951936a93c86d64e955c6e1d24550b601ac86
Author: Stephen Chandler Paul <cpaul@redhat.com>
Date:   Fri Aug 21 14:16:12 2015 -0400

    DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd
    
    commit 924f92bf12bfbef3662619e3ed24a1cea7c1cbcd upstream.
    
    Most of the time this isn't an issue since hotplugging an adaptor will
    trigger a crtc mode change which in turn, causes the driver to probe
    every DisplayPort for a dpcd. However, in cases where hotplugging
    doesn't cause a mode change (specifically when one unplugs a monitor
    from a DisplayPort connector, then plugs that same monitor back in
    seconds later on the same port without any other monitors connected), we
    never probe for the dpcd before starting the initial link training. What
    happens from there looks like this:
    
    	- GPU has only one monitor connected. It's connected via
    	  DisplayPort, and does not go through an adaptor of any sort.
    
    	- User unplugs DisplayPort connector from GPU.
    
    	- Change in HPD is detected by the driver, we probe every
    	  DisplayPort for a possible connection.
    
    	- Probe the port the user originally had the monitor connected
    	  on for it's dpcd. This fails, and we clear the first (and only
    	  the first) byte of the dpcd to indicate we no longer have a
    	  dpcd for this port.
    
    	- User plugs the previously disconnected monitor back into the
    	  same DisplayPort.
    
    	- radeon_connector_hotplug() is called before everyone else,
    	  and tries to handle the link training. Since only the first
    	  byte of the dpcd is zeroed, the driver is able to complete
    	  link training but does so against the wrong dpcd, causing it
    	  to initialize the link with the wrong settings.
    
    	- Display stays blank (usually), dpcd is probed after the
    	  initial link training, and the driver prints no obvious
    	  messages to the log.
    
    In theory, since only one byte of the dpcd is chopped off (specifically,
    the byte that contains the revision information for DisplayPort), it's
    not entirely impossible that this bug may not show on certain monitors.
    For instance, the only reason this bug was visible on my ASUS PB238
    monitor was due to the fact that this monitor using the enhanced framing
    symbol sequence, the flag for which is ignored if the radeon driver
    thinks that the DisplayPort version is below 1.1.
    
    Signed-off-by: Stephen Chandler Paul <cpaul@redhat.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a246a015d49f0a6133c255cd9ce688f3342b51ae
Author: Marc Zyngier <marc.zyngier@arm.com>
Date:   Thu Aug 27 16:10:01 2015 +0100

    arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
    
    commit 126c69a0bd0e441bf6766a5d9bf20de011be9f68 upstream.
    
    When injecting a fault into a misbehaving 32bit guest, it seems
    rather idiotic to also inject a 64bit fault that is only going
    to corrupt the guest state. This leads to a situation where we
    perform an illegal exception return at EL2 causing the host
    to crash instead of killing the guest.
    
    Just fix the stupid bug that has been there from day 1.
    
    Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit a06d0b11bb14e60f08b4d6aa21a0b3101b07b8b6
Author: Horia Geant? <horia.geanta@freescale.com>
Date:   Tue Aug 11 20:19:20 2015 +0300

    crypto: caam - fix memory corruption in ahash_final_ctx
    
    commit b310c178e6d897f82abb9da3af1cd7c02b09f592 upstream.
    
    When doing pointer operation for accessing the HW S/G table,
    a value representing number of entries (and not number of bytes)
    must be used.
    
    Fixes: 045e36780f115 ("crypto: caam - ahash hmac support")
    Signed-off-by: Horia Geant? <horia.geanta@freescale.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit f71e250f45c8419f6cbdb3e9e36ee7a1138ec598
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Sun Jul 26 21:34:50 2015 -0700

    regmap: regcache-rbtree: Clean new present bits on present bitmap resize
    
    commit 8ef9724bf9718af81cfc5132253372f79c71b7e2 upstream.
    
    When inserting a new register into a block, the present bit map size is
    increased using krealloc. krealloc does not clear the additionally
    allocated memory, leaving it filled with random values. Result is that
    some registers are considered cached even though this is not the case.
    
    Fix the problem by clearing the additionally allocated memory. Also, if
    the bitmap size does not increase, do not reallocate the bitmap at all
    to reduce overhead.
    
    Fixes: 3f4ff561bc88 ("regmap: rbtree: Make cache_present bitmap per node")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit efffb6c09e475fd4b5935fed879b10d628ba27b1
Author: Bart Van Assche <bart.vanassche@sandisk.com>
Date:   Fri Jun 5 14:20:51 2015 -0700

    libfc: Fix fc_fcp_cleanup_each_cmd()
    
    commit 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 upstream.
    
    Since fc_fcp_cleanup_cmd() can sleep this function must not
    be called while holding a spinlock. This patch avoids that
    fc_fcp_cleanup_each_cmd() triggers the following bug:
    
    BUG: scheduling while atomic: sg_reset/1512/0x00000202
    1 lock held by sg_reset/1512:
     #0:  (&(&fsp->scsi_pkt_lock)->rlock){+.-...}, at: [<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
    Preemption disabled at:[<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
    Call Trace:
     [<ffffffff816c612c>] dump_stack+0x4f/0x7b
     [<ffffffff810828bc>] __schedule_bug+0x6c/0xd0
     [<ffffffff816c87aa>] __schedule+0x71a/0xa10
     [<ffffffff816c8ad2>] schedule+0x32/0x80
     [<ffffffffc0217eac>] fc_seq_set_resp+0xac/0x100 [libfc]
     [<ffffffffc0218b11>] fc_exch_done+0x41/0x60 [libfc]
     [<ffffffffc0225cff>] fc_fcp_cleanup_each_cmd.isra.21+0xcf/0x150 [libfc]
     [<ffffffffc0225f43>] fc_eh_device_reset+0x1c3/0x270 [libfc]
     [<ffffffff814a2cc9>] scsi_try_bus_device_reset+0x29/0x60
     [<ffffffff814a3908>] scsi_ioctl_reset+0x258/0x2d0
     [<ffffffff814a2650>] scsi_ioctl+0x150/0x440
     [<ffffffff814b3a9d>] sd_ioctl+0xad/0x120
     [<ffffffff8132f266>] blkdev_ioctl+0x1b6/0x810
     [<ffffffff811da608>] block_ioctl+0x38/0x40
     [<ffffffff811b4e08>] do_vfs_ioctl+0x2f8/0x530
     [<ffffffff811b50c1>] SyS_ioctl+0x81/0xa0
     [<ffffffff816cf8b2>] system_call_fastpath+0x16/0x7a
    
    Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
    Signed-off-by: Vasu Dev <vasu.dev@intel.com>
    Signed-off-by: James Bottomley <JBottomley@Odin.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 7e7ec82ecd66ed0cfd77346d8cb4676e06b881ec
Author: Davide Italiano <dccitaliano@gmail.com>
Date:   Wed Sep 16 17:36:23 2015 +0300

    ext4: move check under lock scope to close a race.
    
    commit 280227a75b56ab5d35854f3a77ef74a7ad56a203 upstream
    
    fallocate() checks that the file is extent-based and returns
    EOPNOTSUPP in case is not. Other tasks can convert from and to
    indirect and extent so it's safe to check only after grabbing
    the inode mutex.
    
    [Nikolay Borisov: Bakported to 3.12.47
     - Adjusted context
     - Add the 'out' label]
    
    Signed-off-by: Davide Italiano <dccitaliano@gmail.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Nikolay Borisov <kernel@kyup.com>
    Cc: Jan Kara <jack@suse.cz>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit bf9adcbe5206ddd199d7447f1d79729a7980dbdd
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Sep 16 10:58:09 2015 +0100

    staging: comedi: adl_pci7x3x: fix digital output on PCI-7230
    
    commit ad83dbd974feb2e2a8cc071a1d28782bd4d2c70e upstream
    
    The "adl_pci7x3x" driver replaced the "adl_pci7230" and "adl_pci7432"
    drivers in commits 8f567c373c4b ("staging: comedi: new adl_pci7x3x
    driver") and 657f77d173d3 ("staging: comedi: remove adl_pci7230 and
    adl_pci7432 drivers").  Although the new driver code agrees with the
    user manuals for the respective boards, digital outputs stopped working
    on the PCI-7230.  This has 16 digital output channels and the previous
    adl_pci7230 driver shifted the 16 bit output state left by 16 bits
    before writing to the hardware register.  The new adl_pci7x3x driver
    doesn't do that.  Fix it in `adl_pci7x3x_do_insn_bits()` by checking
    for the special case of the subdevice having only 16 channels and
    duplicating the 16 bit output state into both halves of the 32-bit
    register.  That should work both for what the board actually does and
    for what the user manual says it should do.
    
    Fixes: 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver")
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 92ca2aaa4cc43fd8bb1cd018d7183a2d68352b2e
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Sep 16 14:19:57 2015 +0100

    staging: comedi: usbduxsigma: don't clobber ao_timer in command test
    
    commit c04a1f17803e0d3eeada586ca34a6b436959bc20 upstream
    
    `devpriv->ao_timer` is used while an asynchronous command is running on
    the AO subdevice.  It also gets modified by the subdevice's `cmdtest`
    handler for checking new asynchronous commands,
    `usbduxsigma_ao_cmdtest()`, which is not correct as it's allowed to
    check new commands while an old command is still running.  Fix it by
    moving the code which sets up `devpriv->ao_timer` into the subdevice's
    `cmd` handler, `usbduxsigma_ao_cmd()`.
    
    ** This backported patch also moves the code that sets up
    `devpriv->ao_sample_count` and `devpriv->ao_continuous` from
    `usbduxsigma_ao_cmdtest()` to `usbduxsigma_ao_cmd()` for the same reason
    as above.  (This was not needed in the upstream commit.) **
    
    Note that the removed code in `usbduxsigma_ao_cmdtest()` checked that
    `devpriv->ao_timer` did not end up less that 1, but that could not
    happen due because `cmd->scan_begin_arg` or `cmd->convert_arg` had
    already been range-checked.
    
    Also note that we tested the `high_speed` variable in the old code, but
    that is currently always 0 and means that we always use "scan" timing
    (`cmd->scan_begin_src == TRIG_TIMER` and `cmd->convert_src == TRIG_NOW`)
    and never "convert" (individual sample) timing (`cmd->scan_begin_src ==
    TRIG_FOLLOW` and `cmd->convert_src == TRIG_TIMER`).  The moved code
    tests `cmd->convert_src` instead to decide whether "scan" or "convert"
    timing is being used, although currently only "scan" timing is
    supported.
    
    Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support")
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 52cfd9310ed34594ae140e1991dffab13507d5cc
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Sep 16 14:19:09 2015 +0100

    staging: comedi: usbduxsigma: don't clobber ai_timer in command test
    
    commit 423b24c37dd5794a674c74b0ed56392003a69891 upstream
    
    `devpriv->ai_timer` is used while an asynchronous command is running on
    the AI subdevice.  It also gets modified by the subdevice's `cmdtest`
    handler for checking new asynchronous commands
    (`usbduxsigma_ai_cmdtest()`), which is not correct as it's allowed to
    check new commands while an old command is still running.  Fix it by
    moving the code which sets up `devpriv->ai_timer` and
    `devpriv->ai_interval` into the subdevice's `cmd` handler,
    `usbduxsigma_ai_cmd()`.
    
    ** This backported patch also moves the code that sets up
    `devpriv->ai_sample_count` and `devpriv->ai_continuous` from
    `usbduxsigma_ai_cmdtest()` to `usbduxsigma_ai_cmd()` for the same reason
    as above. (This was not needed in the upstream commit.) **
    
    Note that the removed code in `usbduxsigma_ai_cmdtest()` checked that
    `devpriv->ai_timer` did not end up less than than 1, but that could not
    happen because `cmd->scan_begin_arg` had already been checked to be at
    least the minimum required value (at least when `cmd->scan_begin_src ==
    TRIG_TIMER`, which had also been checked to be the case).
    
    Fixes: b986be8527c7 ("staging: comedi: usbduxsigma: tidy up analog input command support)
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 416473bd80d278c958a5637f465e48a1b150b6dc
Author: Mark Rustad <mark.d.rustad@intel.com>
Date:   Mon Jul 13 11:40:07 2015 -0700

    PCI: Add VPD function 0 quirk for Intel Ethernet devices
    
    commit 7aa6ca4d39edf01f997b9e02cf6d2fdeb224f351 upstream.
    
    Set the PCI_DEV_FLAGS_VPD_REF_F0 flag on all Intel Ethernet device
    functions other than function 0, so that on multi-function devices, we will
    always read VPD from function 0 instead of from the other functions.
    
    [bhelgaas: changelog]
    Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

commit 4386f737d429451d61358f771e315ed47e2f451f
Author: Mark Rustad <mark.d.rustad@intel.com>
Date:   Mon Jul 13 11:40:02 2015 -0700

    PCI: Add dev_flags bit to access VPD through function 0
    
    commit 932c435caba8a2ce473a91753bad0173269ef334 upstream.
    
    Add a dev_flags bit, PCI_DEV_FLAGS_VPD_REF_F0, to access VPD through
    function 0 to provide VPD access on other functions.  This is for hardware
    devices that provide copies of the same VPD capability registers in
    multiple functions.  Because the kernel expects that each function has its
    own registers, both the locking and the state tracking are affected by VPD
    accesses to different functions.
    
    On such devices for example, if a VPD write is performed on function 0,
    *any* later attempt to read VPD from any other function of that device will
    hang.  This has to do with how the kernel tracks the expected value of the
    F bit per function.
    
    Concurrent accesses to different functions of the same device can not only
    hang but also corrupt both read and write VPD data.
    
    When hangs occur, typically the error message:
    
      vpd r/w failed.  This is likely a firmware bug on this device.
    
    will be seen.
    
    Never set this bit on function 0 or there will be an infinite recursion.
    
    Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>