commit c8b431a18daa5f042b8422d40908e738b9795a01
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Mon Aug 22 22:38:32 2016 +0100

    Linux 3.16.37

commit 023c4816c24771b784adc0feb4518a7569aa859e
Author: Bernhard Thaler <bernhard.thaler@wvnet.at>
Date:   Thu May 28 10:26:18 2015 +0200

    Revert "netfilter: ensure number of counters is >0 in do_replace()"
    
    commit d26e2c9ffa385dd1b646f43c1397ba12af9ed431 upstream.
    
    This partially reverts commit 1086bbe97a07 ("netfilter: ensure number of
    counters is >0 in do_replace()") in net/bridge/netfilter/ebtables.c.
    
    Setting rules with ebtables does not work any more with 1086bbe97a07 place.
    
    There is an error message and no rules set in the end.
    
    e.g.
    
    ~# ebtables -t nat -A POSTROUTING --src 12:34:56:78:9a:bc -j DROP
    Unable to update the kernel. Two possible causes:
    1. Multiple ebtables programs were executing simultaneously. The ebtables
       userspace tool doesn't by default support multiple ebtables programs
    running
    
    Reverting the ebtables part of 1086bbe97a07 makes this work again.
    
    Signed-off-by: Bernhard Thaler <bernhard.thaler@wvnet.at>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 30efc09c28d78030584885a691f6bee8c9102d33
Author: Dave Jones <davej@codemonkey.org.uk>
Date:   Tue May 19 20:55:17 2015 -0400

    netfilter: ensure number of counters is >0 in do_replace()
    
    commit 1086bbe97a074844188c6c988fa0b1a98c3ccbb9 upstream.
    
    After improving setsockopt() coverage in trinity, I started triggering
    vmalloc failures pretty reliably from this code path:
    
    warn_alloc_failed+0xe9/0x140
    __vmalloc_node_range+0x1be/0x270
    vzalloc+0x4b/0x50
    __do_replace+0x52/0x260 [ip_tables]
    do_ipt_set_ctl+0x15d/0x1d0 [ip_tables]
    nf_setsockopt+0x65/0x90
    ip_setsockopt+0x61/0xa0
    raw_setsockopt+0x16/0x60
    sock_common_setsockopt+0x14/0x20
    SyS_setsockopt+0x71/0xd0
    
    It turns out we don't validate that the num_counters field in the
    struct we pass in from userspace is initialized.
    
    The same problem also exists in ebtables, arptables, ipv6, and the
    compat variants.
    
    Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 019475d64600fad9051f7197aa9c5feed93243cc
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 15:37:59 2016 +0200

    netfilter: x_tables: introduce and use xt_copy_counters_from_user
    
    commit d7591f0c41ce3e67600a982bab6989ef0f07b3ce upstream.
    
    The three variants use same copy&pasted code, condense this into a
    helper and use that.
    
    Make sure info.name is 0-terminated.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 49b9f189fc1361af719181c2b8c945ed6af142bc
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:34 2016 +0200

    netfilter: x_tables: do compat validation via translate_table
    
    commit 09d9686047dbbe1cf4faa558d3ecc4aae2046054 upstream.
    
    This looks like refactoring, but its also a bug fix.
    
    Problem is that the compat path (32bit iptables, 64bit kernel) lacks a few
    sanity tests that are done in the normal path.
    
    For example, we do not check for underflows and the base chain policies.
    
    While its possible to also add such checks to the compat path, its more
    copy&pastry, for instance we cannot reuse check_underflow() helper as
    e->target_offset differs in the compat case.
    
    Other problem is that it makes auditing for validation errors harder; two
    places need to be checked and kept in sync.
    
    At a high level 32 bit compat works like this:
    1- initial pass over blob:
       validate match/entry offsets, bounds checking
       lookup all matches and targets
       do bookkeeping wrt. size delta of 32/64bit structures
       assign match/target.u.kernel pointer (points at kernel
       implementation, needed to access ->compatsize etc.)
    
    2- allocate memory according to the total bookkeeping size to
       contain the translated ruleset
    
    3- second pass over original blob:
       for each entry, copy the 32bit representation to the newly allocated
       memory.  This also does any special match translations (e.g.
       adjust 32bit to 64bit longs, etc).
    
    4- check if ruleset is free of loops (chase all jumps)
    
    5-first pass over translated blob:
       call the checkentry function of all matches and targets.
    
    The alternative implemented by this patch is to drop steps 3&4 from the
    compat process, the translation is changed into an intermediate step
    rather than a full 1:1 translate_table replacement.
    
    In the 2nd pass (step #3), change the 64bit ruleset back to a kernel
    representation, i.e. put() the kernel pointer and restore ->u.user.name .
    
    This gets us a 64bit ruleset that is in the format generated by a 64bit
    iptables userspace -- we can then use translate_table() to get the
    'native' sanity checks.
    
    This has two drawbacks:
    
    1. we re-validate all the match and target entry structure sizes even
    though compat translation is supposed to never generate bogus offsets.
    2. we put and then re-lookup each match and target.
    
    THe upside is that we get all sanity tests and ruleset validations
    provided by the normal path and can remove some duplicated compat code.
    
    iptables-restore time of autogenerated ruleset with 300k chains of form
    -A CHAIN0001 -m limit --limit 1/s -j CHAIN0002
    -A CHAIN0002 -m limit --limit 1/s -j CHAIN0003
    
    shows no noticeable differences in restore times:
    old:   0m30.796s
    new:   0m31.521s
    64bit: 0m25.674s
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    [bwh: Backported to 3.16: deleted code is a little different]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 452fdfcd431bf8a5f7e0246ae53bbadfc3f8ee64
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:33 2016 +0200

    netfilter: x_tables: xt_compat_match_from_user doesn't need a retval
    
    commit 0188346f21e6546498c2a0f84888797ad4063fc5 upstream.
    
    Always returned 0.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f56ef40679364d8460311260bded62a0688fa180
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:31 2016 +0200

    netfilter: ip6_tables: simplify translate_compat_table args
    
    commit 329a0807124f12fe1c8032f95d8a8eb47047fb0e upstream.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a33db92ff18158141a741aa1c5ef4d13d7e6ca2e
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:30 2016 +0200

    netfilter: ip_tables: simplify translate_compat_table args
    
    commit 7d3f843eed29222254c9feab481f55175a1afcc9 upstream.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c2fcc885cb6d1c9a10126acb324c5a61ab27164e
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:32 2016 +0200

    netfilter: arp_tables: simplify translate_compat_table args
    
    commit 8dddd32756f6fe8e4e82a63361119b7e2384e02f upstream.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    [bwh: Backported to 3.6: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f20f892ef44263407c526f707ec840603df466bd
Author: Florian Westphal <fw@strlen.de>
Date:   Wed Jun 1 02:04:44 2016 +0200

    netfilter: x_tables: don't reject valid target size on some architectures
    
    commit 7b7eba0f3515fca3296b8881d583f7c1042f5226 upstream.
    
    Quoting John Stultz:
      In updating a 32bit arm device from 4.6 to Linus' current HEAD, I
      noticed I was having some trouble with networking, and realized that
      /proc/net/ip_tables_names was suddenly empty.
      Digging through the registration process, it seems we're catching on the:
    
       if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
           target_offset + sizeof(struct xt_standard_target) != next_offset)
             return -EINVAL;
    
      Where next_offset seems to be 4 bytes larger then the
      offset + standard_target struct size.
    
    next_offset needs to be aligned via XT_ALIGN (so we can access all members
    of ip(6)t_entry struct).
    
    This problem didn't show up on i686 as it only needs 4-byte alignment for
    u64, but iptables userspace on other 32bit arches does insert extra padding.
    
    Reported-by: John Stultz <john.stultz@linaro.org>
    Tested-by: John Stultz <john.stultz@linaro.org>
    Fixes: 7ed2abddd20cf ("netfilter: x_tables: check standard target size too")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 592d29f29d4b6f38879a51d8428bb61c7d430e44
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:29 2016 +0200

    netfilter: x_tables: validate all offsets and sizes in a rule
    
    commit 13631bfc604161a9d69cd68991dff8603edd66f9 upstream.
    
    Validate that all matches (if any) add up to the beginning of
    the target and that each match covers at least the base structure size.
    
    The compat path should be able to safely re-use the function
    as the structures only differ in alignment; added a
    BUILD_BUG_ON just in case we have an arch that adds padding as well.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 35ea6762cc084057963af3833c77cf2906461b75
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:28 2016 +0200

    netfilter: x_tables: check for bogus target offset
    
    commit ce683e5f9d045e5d67d1312a42b359cb2ab2a13c upstream.
    
    We're currently asserting that targetoff + targetsize <= nextoff.
    
    Extend it to also check that targetoff is >= sizeof(xt_entry).
    Since this is generic code, add an argument pointing to the start of the
    match/target, we can then derive the base structure size from the delta.
    
    We also need the e->elems pointer in a followup change to validate matches.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 523e5f8924172c7b2f3217e832137076aebc20ee
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:27 2016 +0200

    netfilter: x_tables: check standard target size too
    
    commit 7ed2abddd20cf8f6bd27f65bd218f26fa5bf7f44 upstream.
    
    We have targets and standard targets -- the latter carries a verdict.
    
    The ip/ip6tables validation functions will access t->verdict for the
    standard targets to fetch the jump offset or verdict for chainloop
    detection, but this happens before the targets get checked/validated.
    
    Thus we also need to check for verdict presence here, else t->verdict
    can point right after a blob.
    
    Spotted with UBSAN while testing malformed blobs.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 76db4db16a83b74db2bf8136305a73dd23d5cbd0
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:26 2016 +0200

    netfilter: x_tables: add compat version of xt_check_entry_offsets
    
    commit fc1221b3a163d1386d1052184202d5dc50d302d1 upstream.
    
    32bit rulesets have different layout and alignment requirements, so once
    more integrity checks get added to xt_check_entry_offsets it will reject
    well-formed 32bit rulesets.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b58ceab2ddb76114c22da82003567a146aa02412
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:25 2016 +0200

    netfilter: x_tables: assert minimum target size
    
    commit a08e4e190b866579896c09af59b3bdca821da2cd upstream.
    
    The target size includes the size of the xt_entry_target struct.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 30a24c66372a0606e9f11bf760e432b643a36fb8
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:24 2016 +0200

    netfilter: x_tables: kill check_entry helper
    
    commit aa412ba225dd3bc36d404c28cdc3d674850d80d0 upstream.
    
    Once we add more sanity testing to xt_check_entry_offsets it
    becomes relvant if we're expecting a 32bit 'config_compat' blob
    or a normal one.
    
    Since we already have a lot of similar-named functions (check_entry,
    compat_check_entry, find_and_check_entry, etc.) and the current
    incarnation is short just fold its contents into the callers.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b39be8f1537f6a136f711ab637ffee5d866cd9c0
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:23 2016 +0200

    netfilter: x_tables: add and use xt_check_entry_offsets
    
    commit 7d35812c3214afa5b37a675113555259cfd67b98 upstream.
    
    Currently arp/ip and ip6tables each implement a short helper to check that
    the target offset is large enough to hold one xt_entry_target struct and
    that t->u.target_size fits within the current rule.
    
    Unfortunately these checks are not sufficient.
    
    To avoid adding new tests to all of ip/ip6/arptables move the current
    checks into a helper, then extend this helper in followup patches.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3d2d4415b1c3e82ee9c5adfdabc213ec1e06581a
Author: Florian Westphal <fw@strlen.de>
Date:   Fri Apr 1 14:17:21 2016 +0200

    netfilter: x_tables: don't move to non-existent next rule
    
    commit f24e230d257af1ad7476c6e81a8dc3127a74204e upstream.
    
    Ben Hawkes says:
    
     In the mark_source_chains function (net/ipv4/netfilter/ip_tables.c) it
     is possible for a user-supplied ipt_entry structure to have a large
     next_offset field. This field is not bounds checked prior to writing a
     counter value at the supplied offset.
    
    Base chains enforce absolute verdict.
    
    User defined chains are supposed to end with an unconditional return,
    xtables userspace adds them automatically.
    
    But if such return is missing we will move to non-existent next rule.
    
    Reported-by: Ben Hawkes <hawkes@google.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 72aaf646fb6b6f8f7befb44cbd5b1acd3bb5b483
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Wed Apr 27 14:36:05 2016 -0700

    misc: mic: Fix for double fetch security bug in VOP driver
    
    commit 9bf292bfca94694a721449e3fd752493856710f6 upstream.
    
    The MIC VOP driver does two successive reads from user space to read a
    variable length data structure. Kernel memory corruption can result if
    the data structure changes between the two reads. This patch disallows
    the chance of this happening.
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116651
    Reported by: Pengfei Wang <wpengfeinudt@gmail.com>
    Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.16:
     - Adjust filename, context
     - goto exit on failure]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c6287499662db0b0caee72d6453e445a2c6162af
Author: Eric Dumazet <edumazet@google.com>
Date:   Sun Jul 10 10:04:02 2016 +0200

    tcp: make challenge acks less predictable
    
    commit 75ff39ccc1bd5d3c455b6822ab09e533c551f758 upstream.
    
    Yue Cao claims that current host rate limiting of challenge ACKS
    (RFC 5961) could leak enough information to allow a patient attacker
    to hijack TCP sessions. He will soon provide details in an academic
    paper.
    
    This patch increases the default limit from 100 to 1000, and adds
    some randomization so that the attacker can no longer hijack
    sessions without spending a considerable amount of probes.
    
    Based on initial analysis and patch from Linus.
    
    Note that we also have per socket rate limiting, so it is tempting
    to remove the host limit in the future.
    
    v2: randomize the count of challenge acks per second, not the period.
    
    Fixes: 282f23c6ee34 ("tcp: implement RFC 5961 3.2")
    Reported-by: Yue Cao <ycao009@ucr.edu>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Yuchung Cheng <ycheng@google.com>
    Cc: Neal Cardwell <ncardwell@google.com>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Acked-by: Yuchung Cheng <ycheng@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16:
     - Adjust context
     - Use ACCESS_ONCE() instead of {READ,WRITE}_ONCE()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c8a3667e957a498865ec82c3d19160f1a330daef
Author: Paul Moore <paul@paul-moore.com>
Date:   Tue Jul 19 17:42:57 2016 -0400

    audit: fix a double fetch in audit_log_single_execve_arg()
    
    commit 43761473c254b45883a64441dd0bc85a42f3645c upstream.
    
    There is a double fetch problem in audit_log_single_execve_arg()
    where we first check the execve(2) argumnets for any "bad" characters
    which would require hex encoding and then re-fetch the arguments for
    logging in the audit record[1].  Of course this leaves a window of
    opportunity for an unsavory application to munge with the data.
    
    This patch reworks things by only fetching the argument data once[2]
    into a buffer where it is scanned and logged into the audit
    records(s).  In addition to fixing the double fetch, this patch
    improves on the original code in a few other ways: better handling
    of large arguments which require encoding, stricter record length
    checking, and some performance improvements (completely unverified,
    but we got rid of some strlen() calls, that's got to be a good
    thing).
    
    As part of the development of this patch, I've also created a basic
    regression test for the audit-testsuite, the test can be tracked on
    GitHub at the following link:
    
     * https://github.com/linux-audit/audit-testsuite/issues/25
    
    [1] If you pay careful attention, there is actually a triple fetch
    problem due to a strnlen_user() call at the top of the function.
    
    [2] This is a tiny white lie, we do make a call to strnlen_user()
    prior to fetching the argument data.  I don't like it, but due to the
    way the audit record is structured we really have no choice unless we
    copy the entire argument at once (which would require a rather
    wasteful allocation).  The good news is that with this patch the
    kernel no longer relies on this strnlen_user() value for anything
    beyond recording it in the log, we also update it with a trustworthy
    value whenever possible.
    
    Reported-by: Pengfei Wang <wpengfeinudt@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8229d94adedd2cad31fee2e90b1becb2fdc09b9d
Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date:   Mon Apr 25 17:54:28 2016 +0200

    s390/sclp_ctl: fix potential information leak with /dev/sclp
    
    commit 532c34b5fbf1687df63b3fcd5b2846312ac943c6 upstream.
    
    The sclp_ctl_ioctl_sccb function uses two copy_from_user calls to
    retrieve the sclp request from user space. The first copy_from_user
    fetches the length of the request which is stored in the first two
    bytes of the request. The second copy_from_user gets the complete
    sclp request, but this copies the length field a second time.
    A malicious user may have changed the length in the meantime.
    
    Reported-by: Pengfei Wang <wpengfeinudt@gmail.com>
    Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 81bba9ff4d40b43b0ff92c0d6a9852aadf333ce3
Author: Paul Mackerras <paulus@ozlabs.org>
Date:   Wed Jun 22 15:52:55 2016 +1000

    KVM: PPC: Book3S HV: Save/restore TM state in H_CEDE
    
    commit 93d17397e4e2182fdaad503e2f9da46202c0f1c3 upstream.
    
    It turns out that if the guest does a H_CEDE while the CPU is in
    a transactional state, and the H_CEDE does a nap, and the nap
    loses the architected state of the CPU (which is is allowed to do),
    then we lose the checkpointed state of the virtual CPU.  In addition,
    the transactional-memory state recorded in the MSR gets reset back
    to non-transactional, and when we try to return to the guest, we take
    a TM bad thing type of program interrupt because we are trying to
    transition from non-transactional to transactional with a hrfid
    instruction, which is not permitted.
    
    The result of the program interrupt occurring at that point is that
    the host CPU will hang in an infinite loop with interrupts disabled.
    Thus this is a denial of service vulnerability in the host which can
    be triggered by any guest (and depending on the guest kernel, it can
    potentially triggered by unprivileged userspace in the guest).
    
    This vulnerability has been assigned the ID CVE-2016-5412.
    
    To fix this, we save the TM state before napping and restore it
    on exit from the nap, when handling a H_CEDE in real mode.  The
    case where H_CEDE exits to host virtual mode is already OK (as are
    other hcalls which exit to host virtual mode) because the exit
    path saves the TM state.
    
    Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b16e5c4a51094b5fbf6e2543f8d1c260429c946d
Author: Paul Mackerras <paulus@ozlabs.org>
Date:   Wed Jun 22 14:21:59 2016 +1000

    KVM: PPC: Book3S HV: Pull out TM state save/restore into separate procedures
    
    commit f024ee098476a3e620232e4a78cfac505f121245 upstream.
    
    This moves the transactional memory state save and restore sequences
    out of the guest entry/exit paths into separate procedures.  This is
    so that these sequences can be used in going into and out of nap
    in a subsequent patch.
    
    The only code changes here are (a) saving and restore LR on the
    stack, since these new procedures get called with a bl instruction,
    (b) explicitly saving r1 into the PACA instead of assuming that
    HSTATE_HOST_R1(r13) is already set, and (c) removing an unnecessary
    and redundant setting of MSR[TM] that should have been removed by
    commit 9d4d0bdd9e0a ("KVM: PPC: Book3S HV: Add transactional memory
    support", 2013-09-24) but wasn't.
    
    Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
    [bwh: Backported to 3.16: include dots in subroutine names]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5343d1779fd944a3937dafc56f3e853a5e063a3d
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Thu Jun 2 04:11:20 2016 -0400

    rds: fix an infoleak in rds_inc_info_copy
    
    commit 4116def2337991b39919f3b448326e21c40e0dbb upstream.
    
    The last field "flags" of object "minfo" is not initialized.
    Copying this object out may leak kernel stack data.
    Assign 0 to it to avoid leak.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3d4997da790d035dc4cc61f254d4de467a1bbf90
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Thu Jun 2 04:04:56 2016 -0400

    tipc: fix an infoleak in tipc_nl_compat_link_dump
    
    commit 5d2be1422e02ccd697ccfcd45c85b4a26e6178e2 upstream.
    
    link_info.str is a char array of size 60. Memory after the NULL
    byte is not initialized. Sending the whole object out can cause
    a leak.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [carnil: Backported to 3.16 (same as bwh did for 3.2): the unpadded strcpy() is
    in tipc_node_get_links() and no nlattr is involved, so use strncpy()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ece77e42acbad777ab982f5c523df25e5e577d17
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Tue May 3 16:44:32 2016 -0400

    ALSA: timer: Fix leak in events via snd_timer_user_tinterrupt
    
    commit e4ec8cc8039a7063e24204299b462bd1383184a5 upstream.
    
    The stack object “r1” has a total size of 32 bytes. Its field
    “event” and “val” both contain 4 bytes padding. These 8 bytes
    padding bytes are sent to user without being initialized.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d5b7dbe55864c6bb1b966971f6d4ef90d5b95e46
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Tue May 3 16:44:20 2016 -0400

    ALSA: timer: Fix leak in events via snd_timer_user_ccallback
    
    commit 9a47e9cff994f37f7f0dbd9ae23740d0f64f9fe6 upstream.
    
    The stack object “r1” has a total size of 32 bytes. Its field
    “event” and “val” both contain 4 bytes padding. These 8 bytes
    padding bytes are sent to user without being initialized.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 84d8697290dd3b2c08be651651a02d30f62d91a7
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Tue May 3 16:44:07 2016 -0400

    ALSA: timer: Fix leak in SNDRV_TIMER_IOCTL_PARAMS
    
    commit cec8f96e49d9be372fdb0c3836dcf31ec71e457e upstream.
    
    The stack object “tread” has a total size of 32 bytes. Its field
    “event” and “val” both contain 4 bytes padding. These 8 bytes
    padding bytes are sent to user without being initialized.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 502c7a5b24af01f64d6812a0a382c6beebef9c55
Author: Kangjie Lu <kangjielu@gmail.com>
Date:   Tue May 3 16:32:16 2016 -0400

    USB: usbfs: fix potential infoleak in devio
    
    commit 681fef8380eb818c0b845fca5d2ab1dcbab114ee upstream.
    
    The stack object “ci” has a total size of 8 bytes. Its last 3 bytes
    are padding bytes which are not initialized and leaked to userland
    via “copy_to_user”.
    
    Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a0b5c04dfca69e9728b1c454c6f9fde9f8f38613
Author: Jann Horn <jannh@google.com>
Date:   Wed Jun 1 11:55:05 2016 +0200

    proc: prevent stacking filesystems on top
    
    commit e54ad7f1ee263ffa5a2de9c609d58dfa27b21cd9 upstream.
    
    This prevents stacking filesystems (ecryptfs and overlayfs) from using
    procfs as lower filesystem.  There is too much magic going on inside
    procfs, and there is no good reason to stack stuff on top of procfs.
    
    (For example, procfs does access checks in VFS open handlers, and
    ecryptfs by design calls open handlers from a kernel thread that doesn't
    drop privileges or so.)
    
    Signed-off-by: Jann Horn <jannh@google.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 54c202bbeb9a00042d374561c6bf2bf5d586fc11
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Fri Oct 24 00:14:39 2014 +0200

    fs: limit filesystem stacking depth
    
    commit 69c433ed2ecd2d3264efd7afec4439524b319121 upstream.
    
    Add a simple read-only counter to super_block that indicates how deep this
    is in the stack of filesystems.  Previously ecryptfs was the only stackable
    filesystem and it explicitly disallowed multiple layers of itself.
    
    Overlayfs, however, can be stacked recursively and also may be stacked
    on top of ecryptfs or vice versa.
    
    To limit the kernel stack usage we must limit the depth of the
    filesystem stack.  Initially the limit is set to 2.
    
    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    [bwh: Backported to 3.16: drop changes to overlayfs]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit bd5ab00affa19dcc491318cbb1e0891ffa49c645
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Wed Jul 16 09:37:04 2014 +0300

    ALSA: compress: fix an integer overflow check
    
    commit 6217e5ede23285ddfee10d2e4ba0cc2d4c046205 upstream.
    
    I previously added an integer overflow check here but looking at it now,
    it's still buggy.
    
    The bug happens in snd_compr_allocate_buffer().  We multiply
    ".fragments" and ".fragment_size" and that doesn't overflow but then we
    save it in an unsigned int so it truncates the high bits away and we
    allocate a smaller than expected size.
    
    Fixes: b35cc8225845 ('ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 193cd538c09810024bb295380d84208f85e98bba
Author: Hugh Dickins <hughd@google.com>
Date:   Sun Jul 10 16:46:32 2016 -0700

    tmpfs: fix regression hang in fallocate undo
    
    commit 7f556567036cb7f89aabe2f0954b08566b4efb53 upstream.
    
    The well-spotted fallocate undo fix is good in most cases, but not when
    fallocate failed on the very first page.  index 0 then passes lend -1
    to shmem_undo_range(), and that has two bad effects: (a) that it will
    undo every fallocation throughout the file, unrestricted by the current
    range; but more importantly (b) it can cause the undo to hang, because
    lend -1 is treated as truncation, which makes it keep on retrying until
    every page has gone, but those already fully instantiated will never go
    away.  Big thank you to xfstests generic/269 which demonstrates this.
    
    Fixes: b9b4bb26af01 ("tmpfs: don't undo fallocate past its last page")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [bwh: Backported to 3.16: use PAGE_CACHE_SHIFT instead of PAGE_SHIFT]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d9ce899cd99c1b22fb991a5942a1e0e504f6f498
Author: Jeff Mahoney <jeffm@suse.com>
Date:   Tue Jul 5 17:32:30 2016 -0400

    ecryptfs: don't allow mmap when the lower fs doesn't support it
    
    commit f0fe970df3838c202ef6c07a4c2b36838ef0a88b upstream.
    
    There are legitimate reasons to disallow mmap on certain files, notably
    in sysfs or procfs.  We shouldn't emulate mmap support on file systems
    that don't offer support natively.
    
    CVE-2016-1583
    
    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
    [tyhicks: clean up f_op check by using ecryptfs_file_to_lower()]
    Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 17a13e5df09a8f8d0f8a53ab441c2491324636be
Author: Jan Beulich <JBeulich@suse.com>
Date:   Fri Jul 8 06:15:07 2016 -0600

    xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7
    
    commit 6f2d9d99213514360034c6d52d2c3919290b3504 upstream.
    
    As of Xen 4.7 PV CPUID doesn't expose either of CPUID[1].ECX[7] and
    CPUID[0x80000007].EDX[7] anymore, causing the driver to fail to load on
    both Intel and AMD systems. Doing any kind of hardware capability
    checks in the driver as a prerequisite was wrong anyway: With the
    hypervisor being in charge, all such checking should be done by it. If
    ACPI data gets uploaded despite some missing capability, the hypervisor
    is free to ignore part or all of that data.
    
    Ditch the entire check_prereq() function, and do the only valid check
    (xen_initial_domain()) in the caller in its place.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6b25dcab996dbb8c2702e5bc9b8b23244470297e
Author: Jan Beulich <JBeulich@suse.com>
Date:   Thu Jul 7 01:32:04 2016 -0600

    xenbus: don't bail early from xenbus_dev_request_and_reply()
    
    commit 7469be95a487319514adce2304ad2af3553d2fc9 upstream.
    
    xenbus_dev_request_and_reply() needs to track whether a transaction is
    open.  For XS_TRANSACTION_START messages it calls transaction_start()
    and for XS_TRANSACTION_END messages it calls transaction_end().
    
    If sending an XS_TRANSACTION_START message fails or responds with an
    an error, the transaction is not open and transaction_end() must be
    called.
    
    If sending an XS_TRANSACTION_END message fails, the transaction is
    still open, but if an error response is returned the transaction is
    closed.
    
    Commit 027bd7e89906 ("xen/xenbus: Avoid synchronous wait on XenBus
    stalling shutdown/restart") introduced a regression where failed
    XS_TRANSACTION_START messages were leaving the transaction open.  This
    can cause problems with suspend (and migration) as all transactions
    must be closed before suspending.
    
    It appears that the problematic change was added accidentally, so just
    remove it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4fa1ae666d5c9e2926e0b64836c43255428c7648
Author: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date:   Mon Jul 4 14:07:16 2016 +0200

    qeth: delete napi struct when removing a qeth device
    
    commit 7831b4ff0d926e0deeaabef9db8800ed069a2757 upstream.
    
    A qeth_card contains a napi_struct linked to the net_device during
    device probing. This struct must be deleted when removing the qeth
    device, otherwise Panic on oops can occur when qeth devices are
    repeatedly removed and added.
    
    Fixes: a1c3ed4c9ca ("qeth: NAPI support for l2 and l3 discipline")
    Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
    Tested-by: Alexander Klein <ALKL@de.ibm.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cb2955d6be6202b181a3598f32013ae68cf31b53
Author: Takashi Iwai <tiwai@suse.de>
Date:   Mon Jul 4 14:02:15 2016 +0200

    ALSA: timer: Fix negative queue usage by racy accesses
    
    commit 3fa6993fef634e05d200d141a85df0b044572364 upstream.
    
    The user timer tu->qused counter may go to a negative value when
    multiple concurrent reads are performed since both the check and the
    decrement of tu->qused are done in two individual locked contexts.
    This results in bogus read outs, and the endless loop in the
    user-space side.
    
    The fix is to move the decrement of the tu->qused counter into the
    same spinlock context as the zero-check of the counter.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 54e5acf19caeb9c0c3bbee2e20cfe6b0e4501a1b
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Thu Jun 30 13:27:20 2016 -0700

    net: bcmsysport: Device stats are unsigned long
    
    commit 016eb55157166132b094e53434748cae35e18455 upstream.
    
    On 64bits kernels, device stats are 64bits wide, not 32bits.
    
    Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 60b67e2584e080c42ae23a9518738591969544e1
Author: Omar Sandoval <osandov@fb.com>
Date:   Fri Jul 1 00:39:35 2016 -0700

    block: fix use-after-free in sys_ioprio_get()
    
    commit 8ba8682107ee2ca3347354e018865d8e1967c5f4 upstream.
    
    get_task_ioprio() accesses the task->io_context without holding the task
    lock and thus can race with exit_io_context(), leading to a
    use-after-free. The reproducer below hits this within a few seconds on
    my 4-core QEMU VM:
    
    #define _GNU_SOURCE
    #include <assert.h>
    #include <unistd.h>
    #include <sys/syscall.h>
    #include <sys/wait.h>
    
    int main(int argc, char **argv)
    {
            pid_t pid, child;
            long nproc, i;
    
            /* ioprio_set(IOPRIO_WHO_PROCESS, 0, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)); */
            syscall(SYS_ioprio_set, 1, 0, 0x6000);
    
            nproc = sysconf(_SC_NPROCESSORS_ONLN);
    
            for (i = 0; i < nproc; i++) {
                    pid = fork();
                    assert(pid != -1);
                    if (pid == 0) {
                            for (;;) {
                                    pid = fork();
                                    assert(pid != -1);
                                    if (pid == 0) {
                                            _exit(0);
                                    } else {
                                            child = wait(NULL);
                                            assert(child == pid);
                                    }
                            }
                    }
    
                    pid = fork();
                    assert(pid != -1);
                    if (pid == 0) {
                            for (;;) {
                                    /* ioprio_get(IOPRIO_WHO_PGRP, 0); */
                                    syscall(SYS_ioprio_get, 2, 0);
                            }
                    }
            }
    
            for (;;) {
                    /* ioprio_get(IOPRIO_WHO_PGRP, 0); */
                    syscall(SYS_ioprio_get, 2, 0);
            }
    
            return 0;
    }
    
    This gets us KASAN dumps like this:
    
    [   35.526914] ==================================================================
    [   35.530009] BUG: KASAN: out-of-bounds in get_task_ioprio+0x7b/0x90 at addr ffff880066f34e6c
    [   35.530009] Read of size 2 by task ioprio-gpf/363
    [   35.530009] =============================================================================
    [   35.530009] BUG blkdev_ioc (Not tainted): kasan: bad access detected
    [   35.530009] -----------------------------------------------------------------------------
    
    [   35.530009] Disabling lock debugging due to kernel taint
    [   35.530009] INFO: Allocated in create_task_io_context+0x2b/0x370 age=0 cpu=0 pid=360
    [   35.530009]  ___slab_alloc+0x55d/0x5a0
    [   35.530009]  __slab_alloc.isra.20+0x2b/0x40
    [   35.530009]  kmem_cache_alloc_node+0x84/0x200
    [   35.530009]  create_task_io_context+0x2b/0x370
    [   35.530009]  get_task_io_context+0x92/0xb0
    [   35.530009]  copy_process.part.8+0x5029/0x5660
    [   35.530009]  _do_fork+0x155/0x7e0
    [   35.530009]  SyS_clone+0x19/0x20
    [   35.530009]  do_syscall_64+0x195/0x3a0
    [   35.530009]  return_from_SYSCALL_64+0x0/0x6a
    [   35.530009] INFO: Freed in put_io_context+0xe7/0x120 age=0 cpu=0 pid=1060
    [   35.530009]  __slab_free+0x27b/0x3d0
    [   35.530009]  kmem_cache_free+0x1fb/0x220
    [   35.530009]  put_io_context+0xe7/0x120
    [   35.530009]  put_io_context_active+0x238/0x380
    [   35.530009]  exit_io_context+0x66/0x80
    [   35.530009]  do_exit+0x158e/0x2b90
    [   35.530009]  do_group_exit+0xe5/0x2b0
    [   35.530009]  SyS_exit_group+0x1d/0x20
    [   35.530009]  entry_SYSCALL_64_fastpath+0x1a/0xa4
    [   35.530009] INFO: Slab 0xffffea00019bcd00 objects=20 used=4 fp=0xffff880066f34ff0 flags=0x1fffe0000004080
    [   35.530009] INFO: Object 0xffff880066f34e58 @offset=3672 fp=0x0000000000000001
    [   35.530009] ==================================================================
    
    Fix it by grabbing the task lock while we poke at the io_context.
    
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Omar Sandoval <osandov@fb.com>
    Signed-off-by: Jens Axboe <axboe@fb.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a2666756c560e1a2b97c43345b23fbda55e62b85
Author: Mohamad Haj Yahia <mohamad@mellanox.com>
Date:   Thu Jun 30 17:34:43 2016 +0300

    net/mlx5: Add timeout handle to commands with callback
    
    commit 65ee67084589c1783a74b4a4a5db38d7264ec8b5 upstream.
    
    The current implementation does not handle timeout in case of command
    with callback request, and this can lead to deadlock if the command
    doesn't get fw response.
    Add delayed callback timeout work before posting the command to fw.
    In case of real fw command completion we will cancel the delayed work.
    In case of fw command timeout the callback timeout handler will be
    called and it will simulate fw completion with timeout error.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
    Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c92dd27038776388dbf2992e03842d89a463a627
Author: Mohamad Haj Yahia <mohamad@mellanox.com>
Date:   Thu Jun 30 17:34:42 2016 +0300

    net/mlx5: Fix potential deadlock in command mode change
    
    commit 9cba4ebcf374c3772f6eb61f2d065294b2451b49 upstream.
    
    Call command completion handler in case of timeout when working in
    interrupts mode.
    Avoid flushing the commands workqueue after acquiring the semaphores to
    prevent a potential deadlock.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
    Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: the calculation of ds is more complex]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8b65deb4404ea23d987135aa24006b7fd038318e
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Jun 30 16:13:41 2016 +0200

    bonding: prevent out of bound accesses
    
    commit f87fda00b6ed232a817c655b8d179b48bde8fdbe upstream.
    
    ether_addr_equal_64bits() requires some care about its arguments,
    namely that 8 bytes might be read, even if last 2 byte values are not
    used.
    
    KASan detected a violation with null_mac_addr and lacpdu_mcast_addr
    in bond_3ad.c
    
    Same problem with mac_bcast[] and mac_v6_allmcast[] in bond_alb.c :
    Although the 8-byte alignment was there, KASan would detect out
    of bound accesses.
    
    Fixes: 815117adaf5b ("bonding: use ether_addr_equal_unaligned for bond addr compare")
    Fixes: bb54e58929f3 ("bonding: Verify RX LACPDU has proper dest mac-addr")
    Fixes: 885a136c52a8 ("bonding: use compare_ether_addr_64bits() in ALB")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Acked-by: Dmitry Vyukov <dvyukov@google.com>
    Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
    Acked-by: Ding Tianhong <dingtianhong@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16:
     - Adjust filename
     - Drop change to bond_params::ad_actor_system
     - Fix one more copy of null_mac_addr to use eth_zero_addr()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a660bccb46af756a0e9335ecfee138fc1da5cb4b
Author: Borislav Petkov <bp@suse.de>
Date:   Thu Jun 16 19:13:49 2016 +0200

    x86/amd_nb: Fix boot crash on non-AMD systems
    
    commit 1ead852dd88779eda12cb09cc894a03d9abfe1ec upstream.
    
    Fix boot crash that triggers if this driver is built into a kernel and
    run on non-AMD systems.
    
    AMD northbridges users call amd_cache_northbridges() and it returns
    a negative value to signal that we weren't able to cache/detect any
    northbridges on the system.
    
    At least, it should do so as all its callers expect it to do so. But it
    does return a negative value only when kmalloc() fails.
    
    Fix it to return -ENODEV if there are no NBs cached as otherwise, amd_nb
    users like amd64_edac, for example, which relies on it to know whether
    it should load or not, gets loaded on systems like Intel Xeons where it
    shouldn't.
    
    Reported-and-tested-by: Tony Battersby <tonyb@cybernetics.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1466097230-5333-2-git-send-email-bp@alien8.de
    Link: https://lkml.kernel.org/r/5761BEB0.9000807@cybernetics.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e2c74129979970b4528935b34aa1bcc98d65708b
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Jun 30 18:11:41 2016 +0200

    x86/power/64: Fix kernel text mapping corruption during image restoration
    
    commit 65c0554b73c920023cc8998802e508b798113b46 upstream.
    
    Logan Gunthorpe reports that hibernation stopped working reliably for
    him after commit ab76f7b4ab23 (x86/mm: Set NX on gap between __ex_table
    and rodata).
    
    That turns out to be a consequence of a long-standing issue with the
    64-bit image restoration code on x86, which is that the temporary
    page tables set up by it to avoid page tables corruption when the
    last bits of the image kernel's memory contents are copied into
    their original page frames re-use the boot kernel's text mapping,
    but that mapping may very well get corrupted just like any other
    part of the page tables.  Of course, if that happens, the final
    jump to the image kernel's entry point will go to nowhere.
    
    The exact reason why commit ab76f7b4ab23 matters here is that it
    sometimes causes a PMD of a large page to be split into PTEs
    that are allocated dynamically and get corrupted during image
    restoration as described above.
    
    To fix that issue note that the code copying the last bits of the
    image kernel's memory contents to the page frames occupied by them
    previoulsy doesn't use the kernel text mapping, because it runs from
    a special page covered by the identity mapping set up for that code
    from scratch.  Hence, the kernel text mapping is only needed before
    that code starts to run and then it will only be used just for the
    final jump to the image kernel's entry point.
    
    Accordingly, the temporary page tables set up in swsusp_arch_resume()
    on x86-64 need to contain the kernel text mapping too.  That mapping
    is only going to be used for the final jump to the image kernel, so
    it only needs to cover the image kernel's entry point, because the
    first thing the image kernel does after getting control back is to
    switch over to its own original page tables.  Moreover, the virtual
    address of the image kernel's entry point in that mapping has to be
    the same as the one mapped by the image kernel's page tables.
    
    With that in mind, modify the x86-64's arch_hibernation_header_save()
    and arch_hibernation_header_restore() routines to pass the physical
    address of the image kernel's entry point (in addition to its virtual
    address) to the boot kernel (a small piece of assembly code involved
    in passing the entry point's virtual address to the image kernel is
    not necessary any more after that, so drop it).  Update RESTORE_MAGIC
    too to reflect the image header format change.
    
    Next, in set_up_temporary_mappings(), use the physical and virtual
    addresses of the image kernel's entry point passed in the image
    header to set up a minimum kernel text mapping (using memory pages
    that won't be overwritten by the image kernel's memory contents) that
    will map those addresses to each other as appropriate.
    
    This makes the concern about the possible corruption of the original
    boot kernel text mapping go away and if the the minimum kernel text
    mapping used for the final jump marks the image kernel's entry point
    memory as executable, the jump to it is guaraneed to succeed.
    
    Fixes: ab76f7b4ab23 (x86/mm: Set NX on gap between __ex_table and rodata)
    Link: http://marc.info/?l=linux-pm&m=146372852823760&w=2
    Reported-by: Logan Gunthorpe <logang@deltatee.com>
    Reported-and-tested-by: Borislav Petkov <bp@suse.de>
    Tested-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7a8266796861f971c7653c4f342e5416bb26fd14
Author: Takashi Iwai <tiwai@suse.de>
Date:   Wed Jun 29 15:23:08 2016 +0200

    ALSA: au88x0: Fix calculation in vortex_wtdma_bufshift()
    
    commit 62db7152c924e4c060e42b34a69cd39658e8a0dc upstream.
    
    vortex_wtdma_bufshift() function does calculate the page index
    wrongly, first masking then shift, which always results in zero.
    The proper computation is to first shift, then mask.
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1f53d345e1ccc6b98b03d4ddb8d31f62abf3eece
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Jun 27 23:50:29 2016 +0300

    qlcnic: use the correct ring in qlcnic_83xx_process_rcv_ring_diag()
    
    commit 5b4d10f5e0369ed79434593b7cd8e85eebbe473f upstream.
    
    There is a static checker warning here "warn: mask and shift to zero"
    and the code sets "ring" to zero every time.  From looking at how
    QLCNIC_FETCH_RING_ID() is used in qlcnic_83xx_process_rcv_ring() the
    qlcnic_83xx_hndl() should be removed.
    
    Fixes: 4be41e92f7c6 ('qlcnic: 83xx data path routines')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3d88d87fdbce622d94d66acb1cfd81c7e4e8483f
Author: Sven Eckelmann <sven@narfation.org>
Date:   Sun Jun 26 11:16:13 2016 +0200

    batman-adv: Clean up untagged vlan when destroying via rtnl-link
    
    commit 420cb1b764f9169c5d2601b4af90e4a1702345ee upstream.
    
    The untagged vlan object is only destroyed when the interface is removed
    via the legacy sysfs interface. But it also has to be destroyed when the
    standard rtnl-link interface is used.
    
    Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Acked-by: Antonio Quartulli <a@unstable.cc>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: s/_put/_free_ref/]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6d3ce108753be2babf15497b4d071d0f9773ceb1
Author: Sven Eckelmann <sven@narfation.org>
Date:   Sun Jun 26 11:16:12 2016 +0200

    batman-adv: Fix ICMP RR ethernet access after skb_linearize
    
    commit 3b55e4422087f9f7b241031d758a0c65584e4297 upstream.
    
    The skb_linearize may reallocate the skb. This makes the calculated pointer
    for ethhdr invalid. But it the pointer is used later to fill in the RR
    field of the batadv_icmp_packet_rr packet.
    
    Instead re-evaluate eth_hdr after the skb_linearize+skb_cow to fix the
    pointer and avoid the invalid read.
    
    Fixes: da6b8c20a5b8 ("batman-adv: generalize batman-adv icmp packet handling")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 51e37ea199daca63f7d8cdde65985d65971e77b8
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Sun Jun 26 11:16:11 2016 +0200

    batman-adv: Fix double-put of vlan object
    
    commit baceced93274ff2f846eae991664f9094425ffa8 upstream.
    
    Each batadv_tt_local_entry hold a single reference to a
    batadv_softif_vlan.  In case a new entry cannot be added to the hash
    table, the error path puts the reference, but the reference will also
    now be dropped by batadv_tt_local_entry_release().
    
    Fixes: a33d970d0b54 ("batman-adv: Fix reference counting of vlan object for tt_local_entry")
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: s/_put/_free_ref/]

commit 556407758052a9b23faa0bd7ecd047e9fcdd61c8
Author: Sven Eckelmann <sven@narfation.org>
Date:   Sun Jun 26 11:16:10 2016 +0200

    batman-adv: Fix use-after-free/double-free of tt_req_node
    
    commit 9c4604a298e0a9807eaf2cd912d1ebf24d98fbeb upstream.
    
    The tt_req_node is added and removed from a list inside a spinlock. But the
    locking is sometimes removed even when the object is still referenced and
    will be used later via this reference. For example batadv_send_tt_request
    can create a new tt_req_node (including add to a list) and later
    re-acquires the lock to remove it from the list and to free it. But at this
    time another context could have already removed this tt_req_node from the
    list and freed it.
    
    CPU#0
    
        batadv_batman_skb_recv from net_device 0
        -> batadv_iv_ogm_receive
          -> batadv_iv_ogm_process
            -> batadv_iv_ogm_process_per_outif
              -> batadv_tvlv_ogm_receive
                -> batadv_tvlv_ogm_receive
                  -> batadv_tvlv_containers_process
                    -> batadv_tvlv_call_handler
                      -> batadv_tt_tvlv_ogm_handler_v1
                        -> batadv_tt_update_orig
                          -> batadv_send_tt_request
                            -> batadv_tt_req_node_new
                               spin_lock(...)
                               allocates new tt_req_node and adds it to list
                               spin_unlock(...)
                               return tt_req_node
    
    CPU#1
    
        batadv_batman_skb_recv from net_device 1
        -> batadv_recv_unicast_tvlv
          -> batadv_tvlv_containers_process
            -> batadv_tvlv_call_handler
              -> batadv_tt_tvlv_unicast_handler_v1
                -> batadv_handle_tt_response
                   spin_lock(...)
                   tt_req_node gets removed from list and is freed
                   spin_unlock(...)
    
    CPU#0
    
                          <- returned to batadv_send_tt_request
                             spin_lock(...)
                             tt_req_node gets removed from list and is freed
                             MEMORY CORRUPTION/SEGFAULT/...
                             spin_unlock(...)
    
    This can only be solved via reference counting to allow multiple contexts
    to handle the list manipulation while making sure that only the last
    context holding a reference will free the object.
    
    Fixes: a73105b8d4c7 ("batman-adv: improved client announcement mechanism")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Tested-by: Martin Weinelt <martin@darmstadt.freifunk.net>
    Tested-by: Amadeus Alfa <amadeus@chemnitz.freifunk.net>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16:
     - Adjust context
     - Use list_empty() instead of hlist_unhashed()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 43c704f59fd4770b552945bf65732e04c07e1955
Author: Simon Wunderlich <sw@simonwunderlich.de>
Date:   Sun Jun 26 11:16:09 2016 +0200

    batman-adv: replace WARN with rate limited output on non-existing VLAN
    
    commit 0b3dd7dfb81ad8af53791ea2bb64b83bac1b7d32 upstream.
    
    If a VLAN tagged frame is received and the corresponding VLAN is not
    configured on the soft interface, it will splat a WARN on every packet
    received. This is a quite annoying behaviour for some scenarios, e.g. if
    bat0 is bridged with eth0, and there are arbitrary VLAN tagged frames
    from Ethernet coming in without having any VLAN configuration on bat0.
    
    The code should probably create vlan objects on the fly and
    transparently transport these VLAN-tagged Ethernet frames, but until
    this is done, at least the WARN splat should be replaced by a rate
    limited output.
    
    Fixes: 354136bcc3c4 ("batman-adv: fix kernel crash due to missing NULL checks")
    Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cbc2dd21d0758a3b54b61d6c4b24f4b2e61237e6
Author: Sven Eckelmann <sven@narfation.org>
Date:   Tue Aug 18 13:37:01 2015 +0200

    batman-adv: Fix memory leak on tt add with invalid vlan
    
    commit fd7dec25a18f495e50d2040398fd263836ff3b28 upstream.
    
    The object tt_local is allocated with kmalloc and not initialized when the
    function batadv_tt_local_add checks for the vlan. But this function can
    only cleanup the object when the (not yet initialized) reference counter of
    the object is 1. This is unlikely and thus the object would leak when the
    vlan could not be found.
    
    Instead the uninitialized object tt_local has to be freed manually and the
    pointer has to set to NULL to avoid calling the function which would try to
    decrement the reference counter of the not existing object.
    
    CID: 1316518
    Fixes: 354136bcc3c4 ("batman-adv: fix kernel crash due to missing NULL checks")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9a95f4c4b6e2205d8edd8dadecc7c7b869ea2aa1
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Fri Jun 24 16:25:24 2016 -0700

    net: phy: Manage fixed PHY address space using IDA
    
    commit 69fc58a57e56bf5e39b48809aefffdaa1b04c945 upstream.
    
    If we have a system which uses fixed PHY devices and calls
    fixed_phy_register() then fixed_phy_unregister() we can exhaust the
    number of fixed PHYs available after a while, since we keep incrementing
    the variable phy_fixed_addr, but we never decrement it.
    
    This patch fixes that by converting the fixed PHY allocation to using
    IDA, which takes care of the allocation/dealloaction of the PHY
    addresses for us.
    
    Fixes: a75951217472 ("net: phy: extend fixed driver with fixed_phy_register()")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16:
     - Adjust filename, context
     - fixed_phy_register() returns an integer, not a pointer/error]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ceb3c22785eac084942b48e0f0bed1048f7862df
Author: Michael Neuling <mikey@neuling.org>
Date:   Tue Jun 28 13:01:04 2016 +1000

    powerpc/tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0
    
    commit 190ce8693c23eae09ba5f303a83bf2fbeb6478b1 upstream.
    
    Currently we have 2 segments that are bolted for the kernel linear
    mapping (ie 0xc000... addresses). This is 0 to 1TB and also the kernel
    stacks. Anything accessed outside of these regions may need to be
    faulted in. (In practice machines with TM always have 1T segments)
    
    If a machine has < 2TB of memory we never fault on the kernel linear
    mapping as these two segments cover all physical memory. If a machine
    has > 2TB of memory, there may be structures outside of these two
    segments that need to be faulted in. This faulting can occur when
    running as a guest as the hypervisor may remove any SLB that's not
    bolted.
    
    When we treclaim and trecheckpoint we have a window where we need to
    run with the userspace GPRs. This means that we no longer have a valid
    stack pointer in r1. For this window we therefore clear MSR RI to
    indicate that any exceptions taken at this point won't be able to be
    handled. This means that we can't take segment misses in this RI=0
    window.
    
    In this RI=0 region, we currently access the thread_struct for the
    process being context switched to or from. This thread_struct access
    may cause a segment fault since it's not guaranteed to be covered by
    the two bolted segment entries described above.
    
    We've seen this with a crash when running as a guest with > 2TB of
    memory on PowerVM:
    
      Unrecoverable exception 4100 at c00000000004f138
      Oops: Unrecoverable exception, sig: 6 [#1]
      SMP NR_CPUS=2048 NUMA pSeries
      CPU: 1280 PID: 7755 Comm: kworker/1280:1 Tainted: G                 X 4.4.13-46-default #1
      task: c000189001df4210 ti: c000189001d5c000 task.ti: c000189001d5c000
      NIP: c00000000004f138 LR: 0000000010003a24 CTR: 0000000010001b20
      REGS: c000189001d5f730 TRAP: 4100   Tainted: G                 X  (4.4.13-46-default)
      MSR: 8000000100001031 <SF,ME,IR,DR,LE>  CR: 24000048  XER: 00000000
      CFAR: c00000000004ed18 SOFTE: 0
      GPR00: ffffffffc58d7b60 c000189001d5f9b0 00000000100d7d00 000000003a738288
      GPR04: 0000000000002781 0000000000000006 0000000000000000 c0000d1f4d889620
      GPR08: 000000000000c350 00000000000008ab 00000000000008ab 00000000100d7af0
      GPR12: 00000000100d7ae8 00003ffe787e67a0 0000000000000000 0000000000000211
      GPR16: 0000000010001b20 0000000000000000 0000000000800000 00003ffe787df110
      GPR20: 0000000000000001 00000000100d1e10 0000000000000000 00003ffe787df050
      GPR24: 0000000000000003 0000000000010000 0000000000000000 00003fffe79e2e30
      GPR28: 00003fffe79e2e68 00000000003d0f00 00003ffe787e67a0 00003ffe787de680
      NIP [c00000000004f138] restore_gprs+0xd0/0x16c
      LR [0000000010003a24] 0x10003a24
      Call Trace:
      [c000189001d5f9b0] [c000189001d5f9f0] 0xc000189001d5f9f0 (unreliable)
      [c000189001d5fb90] [c00000000001583c] tm_recheckpoint+0x6c/0xa0
      [c000189001d5fbd0] [c000000000015c40] __switch_to+0x2c0/0x350
      [c000189001d5fc30] [c0000000007e647c] __schedule+0x32c/0x9c0
      [c000189001d5fcb0] [c0000000007e6b58] schedule+0x48/0xc0
      [c000189001d5fce0] [c0000000000deabc] worker_thread+0x22c/0x5b0
      [c000189001d5fd80] [c0000000000e7000] kthread+0x110/0x130
      [c000189001d5fe30] [c000000000009538] ret_from_kernel_thread+0x5c/0xa4
      Instruction dump:
      7cb103a6 7cc0e3a6 7ca222a6 78a58402 38c00800 7cc62838 08860000 7cc000a6
      38a00006 78c60022 7cc62838 0b060000 <e8c701a0> 7ccff120 e8270078 e8a70098
      ---[ end trace 602126d0a1dedd54 ]---
    
    This fixes this by copying the required data from the thread_struct to
    the stack before we clear MSR RI. Then once we clear RI, we only access
    the stack, guaranteeing there's no segment miss.
    
    We also tighten the region over which we set RI=0 on the treclaim()
    path. This may have a slight performance impact since we're adding an
    mtmsr instruction.
    
    Fixes: 090b9284d725 ("powerpc/tm: Clear MSR RI in non-recoverable TM code")
    Signed-off-by: Michael Neuling <mikey@neuling.org>
    Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5de24309271c146214207c5dc1c43e664a1679ab
Author: Brian King <brking@linux.vnet.ibm.com>
Date:   Mon Jun 27 09:09:40 2016 -0500

    ipr: Clear interrupt on croc/crocodile when running with LSI
    
    commit 54e430bbd490e18ab116afa4cd90dcc45787b3df upstream.
    
    If we fall back to using LSI on the Croc or Crocodile chip we need to
    clear the interrupt so we don't hang the system.
    
    Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9650f565c61be09e91a3785f95a6d96f5ecc979d
Author: Trond Myklebust <trond.myklebust@primarydata.com>
Date:   Sat Jun 25 19:19:28 2016 -0400

    NFS: Fix another OPEN_DOWNGRADE bug
    
    commit e547f2628327fec6afd2e03b46f113f614cca05b upstream.
    
    Olga Kornievskaia reports that the following test fails to trigger
    an OPEN_DOWNGRADE on the wire, and only triggers the final CLOSE.
    
            fd0 = open(foo, RDRW)   -- should be open on the wire for "both"
            fd1 = open(foo, RDONLY)  -- should be open on the wire for "read"
            close(fd0) -- should trigger an open_downgrade
            read(fd1)
            close(fd1)
    
    The issue is that we're missing a check for whether or not the current
    state transitioned from an O_RDWR state as opposed to having transitioned
    from a combination of O_RDONLY and O_WRONLY.
    
    Reported-by: Olga Kornievskaia <aglo@umich.edu>
    Fixes: cd9288ffaea4 ("NFSv4: Fix another bug in the close/open_downgrade code")
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 766b5ed1517d7e16213e5f45958637413394a8c4
Author: daniel <daniel@dd-wrt.com>
Date:   Fri Jun 24 12:35:18 2016 +0200

    Bridge: Fix ipv6 mc snooping if bridge has no ipv6 address
    
    commit 0888d5f3c0f183ea6177355752ada433d370ac89 upstream.
    
    The bridge is falsly dropping ipv6 mulitcast packets if there is:
     1. No ipv6 address assigned on the brigde.
     2. No external mld querier present.
     3. The internal querier enabled.
    
    When the bridge fails to build mld queries, because it has no
    ipv6 address, it slilently returns, but keeps the local querier enabled.
    This specific case causes confusing packet loss.
    
    Ipv6 multicast snooping can only work if:
     a) An external querier is present
     OR
     b) The bridge has an ipv6 address an is capable of sending own queries
    
    Otherwise it has to forward/flood the ipv6 multicast traffic,
    because snooping cannot work.
    
    This patch fixes the issue by adding a flag to the bridge struct that
    indicates that there is currently no ipv6 address assinged to the bridge
    and returns a false state for the local querier in
    __br_multicast_querier_exists().
    
    Special thanks to Linus Lüssing.
    
    Fixes: d1d81d4c3dd8 ("bridge: check return value of ipv6_dev_get_saddr()")
    Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
    Acked-by: Linus Lüssing <linus.luessing@c0d3.blue>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 93917b0558024254d5b64d0a3f02e0a86d760ec2
Author: Jouni Malinen <j@w1.fi>
Date:   Sun Jun 19 23:51:02 2016 +0300

    mac80211: Fix mesh estab_plinks counting in STA removal case
    
    commit 126e7557328a1cd576be4fca95b133a2695283ff upstream.
    
    If a user space program (e.g., wpa_supplicant) deletes a STA entry that
    is currently in NL80211_PLINK_ESTAB state, the number of established
    plinks counter was not decremented and this could result in rejecting
    new plink establishment before really hitting the real maximum plink
    limit. For !user_mpm case, this decrementation is handled by
    mesh_plink_deactive().
    
    Fix this by decrementing estab_plinks on STA deletion
    (mesh_sta_cleanup() gets called from there) so that the counter has a
    correct value and the Beacon frame advertisement in Mesh Configuration
    element shows the proper value for capability to accept additional
    peers.
    
    Signed-off-by: Jouni Malinen <j@w1.fi>
    Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
    [bwh: Backported to 3.16: plink_state field is in struct sta_info]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f61c0cf74359a500307aff1a26d081023348ab28
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Thu Jun 23 14:25:33 2016 -0700

    net: bgmac: Remove superflous netif_carrier_on()
    
    commit 3894396e64994f31c3ef5c7e6f63dded0593e567 upstream.
    
    bgmac_open() calls phy_start() to initialize the PHY state machine,
    which will set the interface's carrier state accordingly, no need to
    force that as this could be conflicting with the PHY state determined by
    PHYLIB.
    
    Fixes: dd4544f05469 ("bgmac: driver for GBit MAC core on BCMA bus")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7d28b934ac07ce397f29fc2a8c444733a1d3083b
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Thu Jun 23 14:25:32 2016 -0700

    net: bgmac: Start transmit queue in bgmac_open
    
    commit c3897f2a69e54dd113fc9abd2daf872e5b495798 upstream.
    
    The driver does not start the transmit queue in bgmac_open(). If the
    queue was stopped prior to closing then re-opening the interface, we
    would never be able to wake-up again.
    
    Fixes: dd4544f05469 ("bgmac: driver for GBit MAC core on BCMA bus")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8955783143c57bb53a0a9e377c82f1188e15db55
Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date:   Mon Jun 27 17:06:45 2016 +0200

    s390: fix test_fp_ctl inline assembly contraints
    
    commit bcf4dd5f9ee096bd1510f838dd4750c35df4e38b upstream.
    
    The test_fp_ctl function is used to test if a given value is a valid
    floating-point control. The inline assembly in test_fp_ctl uses an
    incorrect constraint for the 'orig_fpc' variable. If the compiler
    chooses the same register for 'fpc' and 'orig_fpc' the test_fp_ctl()
    function always returns true. This allows user space to trigger
    kernel oopses with invalid floating-point control values on the
    signal stack.
    
    This problem has been introduced with git commit 4725c86055f5bbdcdf
    "s390: fix save and restore of the floating-point-control register"
    
    Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 08015658fbdbfe11e6ec1d1b90bc2eaacb934a3d
Author: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Date:   Thu Jun 23 11:00:39 2016 +0300

    arc: unwind: warn only once if DW2_UNWIND is disabled
    
    commit 9bd54517ee86cb164c734f72ea95aeba4804f10b upstream.
    
    If CONFIG_ARC_DW2_UNWIND is disabled every time arc_unwind_core()
    gets called following message gets printed in debug console:
    ----------------->8---------------
    CONFIG_ARC_DW2_UNWIND needs to be enabled
    ----------------->8---------------
    
    That message makes sense if user indeed wants to see a backtrace or
    get nice function call-graphs in perf but what if user disabled
    unwinder for the purpose? Why pollute his debug console?
    
    So instead we'll warn user about possibly missing feature once and
    let him decide if that was what he or she really wanted.
    
    Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 75126cd29c7e3ca321748be507177677f884f466
Author: Vineet Gupta <vgupta@synopsys.com>
Date:   Tue Jun 28 09:42:25 2016 +0530

    ARC: unwind: ensure that .debug_frame is generated (vs. .eh_frame)
    
    commit f52e126cc7476196f44f3c313b7d9f0699a881fc upstream.
    
    With recent binutils update to support dwarf CFI pseudo-ops in gas, we
    now get .eh_frame vs. .debug_frame. Although the call frame info is
    exactly the same in both, the CIE differs, which the current kernel
    unwinder can't cope with.
    
    This broke both the kernel unwinder as well as loadable modules (latter
    because of a new unhandled relo R_ARC_32_PCREL from .rela.eh_frame in
    the module loader)
    
    The ideal solution would be to switch unwinder to .eh_frame.
    For now however we can make do by just ensureing .debug_frame is
    generated by removing -fasynchronous-unwind-tables
    
     .eh_frame    generated with -gdwarf-2 -fasynchronous-unwind-tables
     .debug_frame generated with -gdwarf-2
    
    Fixes STAR 9001058196
    
    Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit db92ce5d03426443f8e1e82279bbd306bd1b2327
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Mon Jun 27 21:06:51 2016 +0200

    ALSA: echoaudio: Fix memory allocation
    
    commit 9c6795a9b3cbb56a9fbfaf43909c5c22999ba317 upstream.
    
    'commpage_bak' is allocated with 'sizeof(struct echoaudio)' bytes.
    We then copy 'sizeof(struct comm_page)' bytes in it.
    On my system, smatch complains because one is 2960 and the other is 3072.
    
    This would result in memory corruption or a oops.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 37fd3970306b7ce35cb114cdba1d727922a651ca
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Mon Jun 27 10:23:10 2016 -0400

    USB: don't free bandwidth_mutex too early
    
    commit ab2a4bf83902c170d29ba130a8abb5f9d90559e1 upstream.
    
    The USB core contains a bug that can show up when a USB-3 host
    controller is removed.  If the primary (USB-2) hcd structure is
    released before the shared (USB-3) hcd, the core will try to do a
    double-free of the common bandwidth_mutex.
    
    The problem was described in graphical form by Chung-Geol Kim, who
    first reported it:
    
    =================================================
         At *remove USB(3.0) Storage
         sequence <1> --> <5> ((Problem Case))
    =================================================
                                      VOLD
    ------------------------------------|------------
                                     (uevent)
                                ________|_________
                               |<1>               |
                               |dwc3_otg_sm_work  |
                               |usb_put_hcd       |
                               |peer_hcd(kref=2)|
                               |__________________|
                                ________|_________
                               |<2>               |
                               |New USB BUS #2    |
                               |                  |
                               |peer_hcd(kref=1)  |
                               |                  |
                             --(Link)-bandXX_mutex|
                             | |__________________|
                             |
        ___________________  |
       |<3>                | |
       |dwc3_otg_sm_work   | |
       |usb_put_hcd        | |
       |primary_hcd(kref=1)| |
       |___________________| |
        _________|_________  |
       |<4>                | |
       |New USB BUS #1     | |
       |hcd_release        | |
       |primary_hcd(kref=0)| |
       |                   | |
       |bandXX_mutex(free) |<-
       |___________________|
                                   (( VOLD ))
                                ______|___________
                               |<5>               |
                               |      SCSI        |
                               |usb_put_hcd       |
                               |peer_hcd(kref=0)  |
                               |*hcd_release      |
                               |bandXX_mutex(free*)|<- double free
                               |__________________|
    
    =================================================
    
    This happens because hcd_release() frees the bandwidth_mutex whenever
    it sees a primary hcd being released (which is not a very good idea
    in any case), but in the course of releasing the primary hcd, it
    changes the pointers in the shared hcd in such a way that the shared
    hcd will appear to be primary when it gets released.
    
    This patch fixes the problem by changing hcd_release() so that it
    deallocates the bandwidth_mutex only when the _last_ hcd structure
    referencing it is released.  The patch also removes an unnecessary
    test, so that when an hcd is released, both the shared_hcd and
    primary_hcd pointers in the hcd's peer will be cleared.
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Reported-by: Chung-Geol Kim <chunggeol.kim@samsung.com>
    Tested-by: Chung-Geol Kim <chunggeol.kim@samsung.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.16: free only usb_hcd::bandwidth_mutex, not
     usb_hcd::address0_mutex too]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1d14b238e4c95fd45f050d81a3a4b5c2e741da98
Author: Al Viro <viro@ZenIV.linux.org.uk>
Date:   Mon Jun 20 13:14:36 2016 -0400

    make nfs_atomic_open() call d_drop() on all ->open_context() errors.
    
    commit d20cb71dbf3487f24549ede1a8e2d67579b4632e upstream.
    
    In "NFSv4: Move dentry instantiation into the NFSv4-specific atomic open code"
    unconditional d_drop() after the ->open_context() had been removed.  It had
    been correct for success cases (there ->open_context() itself had been doing
    dcache manipulations), but not for error ones.  Only one of those (ENOENT)
    got a compensatory d_drop() added in that commit, but in fact it should've
    been done for all errors.  As it is, the case of O_CREAT non-exclusive open
    on a hashed negative dentry racing with e.g. symlink creation from another
    client ended up with ->open_context() getting an error and proceeding to
    call nfs_lookup().  On a hashed dentry, which would've instantly triggered
    BUG_ON() in d_materialise_unique() (or, these days, its equivalent in
    d_splice_alias()).
    
    Tested-by: Oleg Drokin <green@linuxhacker.ru>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b7c05a9ce3efa77f1c0b088e816b549ed650785a
Author: James Morse <james.morse@arm.com>
Date:   Wed Jun 8 17:24:45 2016 +0100

    KVM: arm/arm64: Stop leaking vcpu pid references
    
    commit 591d215afcc2f94e8e2c69a63c924c044677eb31 upstream.
    
    kvm provides kvm_vcpu_uninit(), which amongst other things, releases the
    last reference to the struct pid of the task that was last running the vcpu.
    
    On arm64 built with CONFIG_DEBUG_KMEMLEAK, starting a guest with kvmtool,
    then killing it with SIGKILL results (after some considerable time) in:
    > cat /sys/kernel/debug/kmemleak
    > unreferenced object 0xffff80007d5ea080 (size 128):
    >  comm "lkvm", pid 2025, jiffies 4294942645 (age 1107.776s)
    >  hex dump (first 32 bytes):
    >    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    >    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    >  backtrace:
    >    [<ffff8000001b30ec>] create_object+0xfc/0x278
    >    [<ffff80000071da34>] kmemleak_alloc+0x34/0x70
    >    [<ffff80000019fa2c>] kmem_cache_alloc+0x16c/0x1d8
    >    [<ffff8000000d0474>] alloc_pid+0x34/0x4d0
    >    [<ffff8000000b5674>] copy_process.isra.6+0x79c/0x1338
    >    [<ffff8000000b633c>] _do_fork+0x74/0x320
    >    [<ffff8000000b66b0>] SyS_clone+0x18/0x20
    >    [<ffff800000085cb0>] el0_svc_naked+0x24/0x28
    >    [<ffffffffffffffff>] 0xffffffffffffffff
    
    On x86 kvm_vcpu_uninit() is called on the path from kvm_arch_destroy_vm(),
    on arm no equivalent call is made. Add the call to kvm_arch_vcpu_free().
    
    Signed-off-by: James Morse <james.morse@arm.com>
    Fixes: 749cf76c5a36 ("KVM: ARM: Initial skeleton to compile KVM support")
    Acked-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8c96b416de2acc010c9e7f90c9d2dde9b1418444
Author: Cyril Bur <cyrilbur@gmail.com>
Date:   Fri Jun 17 14:58:34 2016 +1000

    powerpc/tm: Always reclaim in start_thread() for exec() class syscalls
    
    commit 8e96a87c5431c256feb65bcfc5aec92d9f7839b6 upstream.
    
    Userspace can quite legitimately perform an exec() syscall with a
    suspended transaction. exec() does not return to the old process, rather
    it load a new one and starts that, the expectation therefore is that the
    new process starts not in a transaction. Currently exec() is not treated
    any differently to any other syscall which creates problems.
    
    Firstly it could allow a new process to start with a suspended
    transaction for a binary that no longer exists. This means that the
    checkpointed state won't be valid and if the suspended transaction were
    ever to be resumed and subsequently aborted (a possibility which is
    exceedingly likely as exec()ing will likely doom the transaction) the
    new process will jump to invalid state.
    
    Secondly the incorrect attempt to keep the transactional state while
    still zeroing state for the new process creates at least two TM Bad
    Things. The first triggers on the rfid to return to userspace as
    start_thread() has given the new process a 'clean' MSR but the suspend
    will still be set in the hardware MSR. The second TM Bad Thing triggers
    in __switch_to() as the processor is still transactionally suspended but
    __switch_to() wants to zero the TM sprs for the new process.
    
    This is an example of the outcome of calling exec() with a suspended
    transaction. Note the first 700 is likely the first TM bad thing
    decsribed earlier only the kernel can't report it as we've loaded
    userspace registers. c000000000009980 is the rfid in
    fast_exception_return()
    
      Bad kernel stack pointer 3fffcfa1a370 at c000000000009980
      Oops: Bad kernel stack pointer, sig: 6 [#1]
      CPU: 0 PID: 2006 Comm: tm-execed Not tainted
      NIP: c000000000009980 LR: 0000000000000000 CTR: 0000000000000000
      REGS: c00000003ffefd40 TRAP: 0700   Not tainted
      MSR: 8000000300201031 <SF,ME,IR,DR,LE,TM[SE]>  CR: 00000000  XER: 00000000
      CFAR: c0000000000098b4 SOFTE: 0
      PACATMSCRATCH: b00000010000d033
      GPR00: 0000000000000000 00003fffcfa1a370 0000000000000000 0000000000000000
      GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR12: 00003fff966611c0 0000000000000000 0000000000000000 0000000000000000
      NIP [c000000000009980] fast_exception_return+0xb0/0xb8
      LR [0000000000000000]           (null)
      Call Trace:
      Instruction dump:
      f84d0278 e9a100d8 7c7b03a6 e84101a0 7c4ff120 e8410170 7c5a03a6 e8010070
      e8410080 e8610088 e8810090 e8210078 <4c000024> 48000000 e8610178 88ed023b
    
      Kernel BUG at c000000000043e80 [verbose debug info unavailable]
      Unexpected TM Bad Thing exception at c000000000043e80 (msr 0x201033)
      Oops: Unrecoverable exception, sig: 6 [#2]
      CPU: 0 PID: 2006 Comm: tm-execed Tainted: G      D
      task: c0000000fbea6d80 ti: c00000003ffec000 task.ti: c0000000fb7ec000
      NIP: c000000000043e80 LR: c000000000015a24 CTR: 0000000000000000
      REGS: c00000003ffef7e0 TRAP: 0700   Tainted: G      D
      MSR: 8000000300201033 <SF,ME,IR,DR,RI,LE,TM[SE]>  CR: 28002828  XER: 00000000
      CFAR: c000000000015a20 SOFTE: 0
      PACATMSCRATCH: b00000010000d033
      GPR00: 0000000000000000 c00000003ffefa60 c000000000db5500 c0000000fbead000
      GPR04: 8000000300001033 2222222222222222 2222222222222222 00000000ff160000
      GPR08: 0000000000000000 800000010000d033 c0000000fb7e3ea0 c00000000fe00004
      GPR12: 0000000000002200 c00000000fe00000 0000000000000000 0000000000000000
      GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR20: 0000000000000000 0000000000000000 c0000000fbea7410 00000000ff160000
      GPR24: c0000000ffe1f600 c0000000fbea8700 c0000000fbea8700 c0000000fbead000
      GPR28: c000000000e20198 c0000000fbea6d80 c0000000fbeab680 c0000000fbea6d80
      NIP [c000000000043e80] tm_restore_sprs+0xc/0x1c
      LR [c000000000015a24] __switch_to+0x1f4/0x420
      Call Trace:
      Instruction dump:
      7c800164 4e800020 7c0022a6 f80304a8 7c0222a6 f80304b0 7c0122a6 f80304b8
      4e800020 e80304a8 7c0023a6 e80304b0 <7c0223a6> e80304b8 7c0123a6 4e800020
    
    This fixes CVE-2016-5828.
    
    Fixes: bc2a9408fa65 ("powerpc: Hook in new transactional memory code")
    Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e5dbfa75116a77d70aaf80e79733c47be4891afc
Author: Mark Brown <broonie@kernel.org>
Date:   Mon Jun 20 13:53:34 2016 +0100

    iio:ad7266: Fix probe deferral for vref
    
    commit 68b356eb3d9f5e38910fb62e22a78e2a18d544ae upstream.
    
    Currently the ad7266 driver treats any failure to get vref as though the
    regulator were not present but this means that if probe deferral is
    triggered the driver will act as though the regulator were not present.
    Instead only use the internal reference if we explicitly got -ENODEV which
    is what is returned for absent regulators.
    
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 10ac4f5e8b45df715cafad75d14fff6b8d820017
Author: Mark Brown <broonie@kernel.org>
Date:   Mon Jun 20 13:53:33 2016 +0100

    iio:ad7266: Fix support for optional regulators
    
    commit e5511c816e5ac4909bdd38e85ac344e2b9b8e984 upstream.
    
    The ad7266 driver attempts to support deciding between the use of internal
    and external power supplies by checking to see if an error is returned when
    requesting the regulator. This doesn't work with the current code since the
    driver uses a normal regulator_get() which is for non-optional supplies
    and so assumes that if a regulator is not provided by the platform then
    this is a bug in the platform integration and so substitutes a dummy
    regulator. Use regulator_get_optional() instead which indicates to the
    framework that the regulator may be absent and provides a dummy regulator
    instead.
    
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 146cd92b7663f548c18d061bff3b36c2b7bda1c9
Author: Mark Brown <broonie@kernel.org>
Date:   Mon Jun 20 13:53:32 2016 +0100

    iio:ad7266: Fix broken regulator error handling
    
    commit 6b7f4e25f3309f106a5c7ff42c8231494cf285d3 upstream.
    
    All regulator_get() variants return either a pointer to a regulator or an
    ERR_PTR() so testing for NULL makes no sense and may lead to bugs if we
    use NULL as a valid regulator. Fix this by using IS_ERR() as expected.
    
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 87efffdacfdc9b1722cc62bc92c271d03a8bb7cb
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Fri Jun 17 15:22:24 2016 +0200

    iio: accel: kxsd9: fix the usage of spi_w8r8()
    
    commit 0c1f91b98552da49d9d8eed32b3132a58d2f4598 upstream.
    
    These two spi_w8r8() calls return a value with is used by the code
    following the error check. The dubious use was caused by a cleanup
    patch.
    
    Fixes: d34dbee8ac8e ("staging:iio:accel:kxsd9 cleanup and conversion to iio_chan_spec.")
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a0e025caed0c8ba9064560975e269b2afbb2fe62
Author: Luis de Bethencourt <luisbg@osg.samsung.com>
Date:   Wed Jun 22 20:43:30 2016 +0100

    staging: iio: accel: fix error check
    
    commit ef3149eb3ddb7f9125e11c90f8330e371b55cffd upstream.
    
    sca3000_read_ctrl_reg() returns a negative number on failure, check for
    this instead of zero.
    
    Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cf53a0b9d7bc85d211574badc70d0c653101a1a9
Author: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Date:   Fri Jun 24 14:50:18 2016 -0700

    fs/nilfs2: fix potential underflow in call to crc32_le
    
    commit 63d2f95d63396059200c391ca87161897b99e74a upstream.
    
    The value `bytes' comes from the filesystem which is about to be
    mounted.  We cannot trust that the value is always in the range we
    expect it to be.
    
    Check its value before using it to calculate the length for the crc32_le
    call.  It value must be larger (or equal) sumoff + 4.
    
    This fixes a kernel bug when accidentially mounting an image file which
    had the nilfs2 magic value 0x3434 at the right offset 0x406 by chance.
    The bytes 0x01 0x00 were stored at 0x408 and were interpreted as a
    s_bytes value of 1.  This caused an underflow when substracting sumoff +
    4 (20) in the call to crc32_le.
    
      BUG: unable to handle kernel paging request at ffff88021e600000
      IP:  crc32_le+0x36/0x100
      ...
      Call Trace:
        nilfs_valid_sb.part.5+0x52/0x60 [nilfs2]
        nilfs_load_super_block+0x142/0x300 [nilfs2]
        init_nilfs+0x60/0x390 [nilfs2]
        nilfs_mount+0x302/0x520 [nilfs2]
        mount_fs+0x38/0x160
        vfs_kern_mount+0x67/0x110
        do_mount+0x269/0xe00
        SyS_mount+0x9f/0x100
        entry_SYSCALL_64_fastpath+0x16/0x71
    
    Link: http://lkml.kernel.org/r/1466778587-5184-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
    Tested-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c248b3ba3ad07a74e77f493c2b8c4963fa59ce93
Author: Anthony Romano <anthony.romano@coreos.com>
Date:   Fri Jun 24 14:48:43 2016 -0700

    tmpfs: don't undo fallocate past its last page
    
    commit b9b4bb26af017dbe930cd4df7f9b2fc3a0497bfe upstream.
    
    When fallocate is interrupted it will undo a range that extends one byte
    past its range of allocated pages.  This can corrupt an in-use page by
    zeroing out its first byte.  Instead, undo using the inclusive byte
    range.
    
    Fixes: 1635f6a74152f1d ("tmpfs: undo fallocation on failure")
    Link: http://lkml.kernel.org/r/1462713387-16724-1-git-send-email-anthony.romano@coreos.com
    Signed-off-by: Anthony Romano <anthony.romano@coreos.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Brandon Philips <brandon@ifup.co>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    [bwh: Backported to 3.16: use PAGE_CACHE_SHIFT instead of PAGE_SHIFT]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2e4378ee60049b752c9dce16f62ce6fbd11b379a
Author: Steve French <smfrench@gmail.com>
Date:   Wed Jun 22 20:12:05 2016 -0500

    Fix reconnect to not defer smb3 session reconnect long after socket reconnect
    
    commit 4fcd1813e6404dd4420c7d12fb483f9320f0bf93 upstream.
    
    Azure server blocks clients that open a socket and don't do anything on it.
    In our reconnect scenarios, we can reconnect the tcp session and
    detect the socket is available but we defer the negprot and SMB3 session
    setup and tree connect reconnection until the next i/o is requested, but
    this looks suspicous to some servers who expect SMB3 negprog and session
    setup soon after a socket is created.
    
    In the echo thread, reconnect SMB3 sessions and tree connections
    that are disconnected.  A later patch will replay persistent (and
    resilient) handle opens.
    
    Signed-off-by: Steve French <steve.french@primarydata.com>
    Acked-by: Pavel Shilovsky <pshilovsky@samba.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 24ae40c98daa6519d3c900788f7076490cf56f59
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Wed Jun 22 19:43:35 2016 +0100

    nfsd: check permissions when setting ACLs
    
    commit 999653786df6954a31044528ac3f7a5dadca08f4 upstream.
    
    Use set_posix_acl, which includes proper permission checks, instead of
    calling ->set_acl directly.  Without this anyone may be able to grant
    themselves permissions to a file by setting the ACL.
    
    Lock the inode to make the new checks atomic with respect to set_acl.
    (Also, nfsd was the only caller of set_acl not locking the inode, so I
    suspect this may fix other races.)
    
    This also simplifies the code, and ensures our ACLs are checked by
    posix_acl_valid.
    
    The permission checks and the inode locking were lost with commit
    4ac7249e, which changed nfsd to use the set_acl inode operation directly
    instead of going through xattr handlers.
    
    Reported-by: David Sinquin <david@sinquin.eu>
    [agreunba@redhat.com: use set_posix_acl]
    Fixes: 4ac7249e
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
    [carnil: backport for 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8e31c40b13640f7990ae0038ae4e7a6685998e3a
Author: Andreas Gruenbacher <agruenba@redhat.com>
Date:   Wed Jun 22 23:57:25 2016 +0200

    posix_acl: Add set_posix_acl
    
    commit 485e71e8fb6356c08c7fc6bcce4bf02c9a9a663f upstream.
    
    Factor out part of posix_acl_xattr_set into a common function that takes
    a posix_acl, which nfsd can also call.
    
    The prototype already exists in include/linux/posix_acl.h.
    
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
    [carnil: backport to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9e3f375ddf4d75f61c600d81266bff45c0de8027
Author: Takashi Iwai <tiwai@suse.de>
Date:   Fri Jun 24 15:15:26 2016 +0200

    ALSA: dummy: Fix a use-after-free at closing
    
    commit d5dbbe6569481bf12dcbe3e12cff72c5f78d272c upstream.
    
    syzkaller fuzzer spotted a potential use-after-free case in snd-dummy
    driver when hrtimer is used as backend:
    > ==================================================================
    > BUG: KASAN: use-after-free in rb_erase+0x1b17/0x2010 at addr ffff88005e5b6f68
    >  Read of size 8 by task syz-executor/8984
    > =============================================================================
    > BUG kmalloc-192 (Not tainted): kasan: bad access detected
    > -----------------------------------------------------------------------------
    >
    > Disabling lock debugging due to kernel taint
    > INFO: Allocated in 0xbbbbbbbbbbbbbbbb age=18446705582212484632
    > ....
    > [<      none      >] dummy_hrtimer_create+0x49/0x1a0 sound/drivers/dummy.c:464
    > ....
    > INFO: Freed in 0xfffd8e09 age=18446705496313138713 cpu=2164287125 pid=-1
    > [<      none      >] dummy_hrtimer_free+0x68/0x80 sound/drivers/dummy.c:481
    > ....
    > Call Trace:
    >  [<ffffffff8179e59e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:333
    >  [<     inline     >] rb_set_parent include/linux/rbtree_augmented.h:111
    >  [<     inline     >] __rb_erase_augmented include/linux/rbtree_augmented.h:218
    >  [<ffffffff82ca5787>] rb_erase+0x1b17/0x2010 lib/rbtree.c:427
    >  [<ffffffff82cb02e8>] timerqueue_del+0x78/0x170 lib/timerqueue.c:86
    >  [<ffffffff814d0c80>] __remove_hrtimer+0x90/0x220 kernel/time/hrtimer.c:903
    >  [<     inline     >] remove_hrtimer kernel/time/hrtimer.c:945
    >  [<ffffffff814d23da>] hrtimer_try_to_cancel+0x22a/0x570 kernel/time/hrtimer.c:1046
    >  [<ffffffff814d2742>] hrtimer_cancel+0x22/0x40 kernel/time/hrtimer.c:1066
    >  [<ffffffff85420531>] dummy_hrtimer_stop+0x91/0xb0 sound/drivers/dummy.c:417
    >  [<ffffffff854228bf>] dummy_pcm_trigger+0x17f/0x1e0 sound/drivers/dummy.c:507
    >  [<ffffffff85392170>] snd_pcm_do_stop+0x160/0x1b0 sound/core/pcm_native.c:1106
    >  [<ffffffff85391b26>] snd_pcm_action_single+0x76/0x120 sound/core/pcm_native.c:956
    >  [<ffffffff85391e01>] snd_pcm_action+0x231/0x290 sound/core/pcm_native.c:974
    >  [<     inline     >] snd_pcm_stop sound/core/pcm_native.c:1139
    >  [<ffffffff8539754d>] snd_pcm_drop+0x12d/0x1d0 sound/core/pcm_native.c:1784
    >  [<ffffffff8539d3be>] snd_pcm_common_ioctl1+0xfae/0x2150 sound/core/pcm_native.c:2805
    >  [<ffffffff8539ee91>] snd_pcm_capture_ioctl1+0x2a1/0x5e0 sound/core/pcm_native.c:2976
    >  [<ffffffff8539f2ec>] snd_pcm_kernel_ioctl+0x11c/0x160 sound/core/pcm_native.c:3020
    >  [<ffffffff853d9a44>] snd_pcm_oss_sync+0x3a4/0xa30 sound/core/oss/pcm_oss.c:1693
    >  [<ffffffff853da27d>] snd_pcm_oss_release+0x1ad/0x280 sound/core/oss/pcm_oss.c:2483
    >  .....
    
    A workaround is to call hrtimer_cancel() in dummy_hrtimer_sync() which
    is called certainly before other blocking ops.
    
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Tested-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4ef3e38d4e0726ec7f63f8d9c6b4c3aa1cbeec7b
Author: Scott Bauer <sbauer@plzdonthack.me>
Date:   Thu Jun 23 08:59:47 2016 -0600

    HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands
    
    commit 93a2001bdfd5376c3dc2158653034c20392d15c5 upstream.
    
    This patch validates the num_values parameter from userland during the
    HIDIOCGUSAGES and HIDIOCSUSAGES commands. Previously, if the report id was set
    to HID_REPORT_ID_UNKNOWN, we would fail to validate the num_values parameter
    leading to a heap overflow.
    
    Signed-off-by: Scott Bauer <sbauer@plzdonthack.me>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 44b522de8d3e3579bee0b95ebaef3de0265658de
Author: Jerome Marchand <jmarchan@redhat.com>
Date:   Thu May 26 11:52:25 2016 +0200

    cifs: dynamic allocation of ntlmssp blob
    
    commit b8da344b74c822e966c6d19d6b2321efe82c5d97 upstream.
    
    In sess_auth_rawntlmssp_authenticate(), the ntlmssp blob is allocated
    statically and its size is an "empirical" 5*sizeof(struct
    _AUTHENTICATE_MESSAGE) (320B on x86_64). I don't know where this value
    comes from or if it was ever appropriate, but it is currently
    insufficient: the user and domain name in UTF16 could take 1kB by
    themselves. Because of that, build_ntlmssp_auth_blob() might corrupt
    memory (out-of-bounds write). The size of ntlmssp_blob in
    SMB2_sess_setup() is too small too (sizeof(struct _NEGOTIATE_MESSAGE)
    + 500).
    
    This patch allocates the blob dynamically in
    build_ntlmssp_auth_blob().
    
    Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
    Signed-off-by: Steve French <smfrench@gmail.com>
    [bwh: Backported to 3.16: adjust context, indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 30622d3dbf69f757fcca2d63678e5cfbd5af9113
Author: Jerome Marchand <jmarchan@redhat.com>
Date:   Thu May 26 11:52:24 2016 +0200

    cifs: use CIFS_MAX_DOMAINNAME_LEN when converting the domain name
    
    commit 202d772ba02b1deb8835a631cd8255943d1906a0 upstream.
    
    Currently in build_ntlmssp_auth_blob(), when converting the domain
    name to UTF16, CIFS_MAX_USERNAME_LEN limit is used. It should be
    CIFS_MAX_DOMAINNAME_LEN. This patch fixes this.
    
    Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
    Signed-off-by: Steve French <smfrench@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b2c8a9874f1f251c0ce302e5d3e76a6142083550
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Tue Jun 21 16:09:00 2016 -0700

    Input: elantech - add more IC body types to the list
    
    commit 226ba707744a51acb4244724e09caacb1d96aed9 upstream.
    
    The touchpad in HP Pavilion 14-ab057ca reports it's version as 12 and
    according to Elan both 11 and 12 are valid IC types and should be
    identified as hw_version 4.
    
    Reported-by: Patrick Lessard <Patrick.Lessard@cogeco.com>
    Tested-by: Patrick Lessard <Patrick.Lessard@cogeco.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9a20812eff5c824de84f66d574ee239e233892f1
Author: Ping Cheng <pinglinux@gmail.com>
Date:   Thu Jun 23 10:54:17 2016 -0700

    Input: wacom_w8001 - w8001_MAX_LENGTH should be 13
    
    commit 12afb34400eb2b301f06b2aa3535497d14faee59 upstream.
    
    Somehow the patch that added two-finger touch support forgot to update
    W8001_MAX_LENGTH from 11 to 13.
    
    Signed-off-by: Ping Cheng <pingc@wacom.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit bce7f377e37ae6732df2c83b0078d2d81b3c2fe1
Author: Dotan Barak <dotanb@dev.mellanox.co.il>
Date:   Wed Jun 22 17:27:31 2016 +0300

    IB/mlx4: Fix memory leak if QP creation failed
    
    commit 5b420d9cf7382c6e1512e96e02d18842d272049c upstream.
    
    When RC, UC, or RAW QPs are created, a qp object is allocated (kzalloc).
    If at a later point (in procedure create_qp_common) the qp creation fails,
    this qp object must be freed.
    
    Fixes: 1ffeb2eb8be99 ("IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support")
    Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
    Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0ac1d5582bd18d086902adca2e925f632fe17d53
Author: Yishai Hadas <yishaih@mellanox.com>
Date:   Wed Jun 22 17:27:30 2016 +0300

    IB/mlx4: Verify port number in flow steering create flow
    
    commit 5533c18ab02b17a7f2ac11908e2d97d4b421617d upstream.
    
    In procedure mlx4_ib_create_flow, passing an invalid port number
    will cause an out-of-bounds array access. Data passed to this procedure
    can come from user-space.  Therefore, need to validate port number
    before proceeding onwards.
    
    Note that we check against the number of physical ports declared at
    the verbs (ib core) level; When bonding is active, the verbs level
    sees one physical port, even though the low-level driver sees two ports.
    
    Fixes: f77c0162a339 ("IB/mlx4: Add receive flow steering support")
    Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
    Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
    Reviewed-by: Moni Shoua <monis@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16:
     - Adjust context
     - Function returns an integer, not a pointer/error]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b2761c510de9dc09a6254b80d9ef6ebba39c4935
Author: Yishai Hadas <yishaih@mellanox.com>
Date:   Wed Jun 22 17:27:29 2016 +0300

    IB/mlx4: Fix error flow when sending mads under SRIOV
    
    commit a6100603a4a87fc436199362bdb81cb849faaf6e upstream.
    
    Fix mad send error flow to prevent double freeing address handles,
    and leaking tx_ring entries when SRIOV is active.
    
    If ib_mad_post_send fails, the address handle pointer in the tx_ring entry
    must be set to NULL (or there will be a double-free) and tx_tail must be
    incremented (or there will be a leak of tx_ring entries).
    The tx_ring is handled the same way in the send-completion handler.
    
    Fixes: 37bfc7c1e83f ("IB/mlx4: SR-IOV multiplex and demultiplex MADs")
    Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
    Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7787e63f7a6e3c99566c8bf0ede5cd749eb953a8
Author: Yishai Hadas <yishaih@mellanox.com>
Date:   Wed Jun 22 17:27:28 2016 +0300

    IB/mlx4: Fix the SQ size of an RC QP
    
    commit f2940e2c76bb554a7fbdd28ca5b90904117a9e96 upstream.
    
    When calculating the required size of an RC QP send queue, leave
    enough space for masked atomic operations, which require more space than
    "regular" atomic operation.
    
    Fixes: 6fa8f719844b ("IB/mlx4: Add support for masked atomic operations")
    Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
    Reviewed-by: Jack Morgenstein <jackm@mellanox.co.il>
    Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 972fb25e0b214289f85acf46675eefda2e574cf4
Author: Eli Cohen <eli@mellanox.com>
Date:   Wed Jun 22 17:27:26 2016 +0300

    IB/mlx5: Fix post send fence logic
    
    commit c9b254955b9f8814966f5dabd34c39d0e0a2b437 upstream.
    
    If the caller specified IB_SEND_FENCE in the send flags of the work
    request and no previous work request stated that the successive one
    should be fenced, the work request would be executed without a fence.
    This could result in RDMA read or atomic operations failure due to a MR
    being invalidated. Fix this by adding the mlx5 enumeration for fencing
    RDMA/atomic operations and fix the logic to apply this.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
    Signed-off-by: Eli Cohen <eli@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0993de3256271f11b8a4bb48e29bfdc842cf7d98
Author: Andrey Grodzovsky <andrey2805@gmail.com>
Date:   Tue Jun 21 14:26:36 2016 -0400

    xen/pciback: Fix conf_space read/write overlap check.
    
    commit 02ef871ecac290919ea0c783d05da7eedeffc10e upstream.
    
    Current overlap check is evaluating to false a case where a filter
    field is fully contained (proper subset) of a r/w request.  This
    change applies classical overlap check instead to include all the
    scenarios.
    
    More specifically, for (Hilscher GmbH CIFX 50E-DP(M/S)) device driver
    the logic is such that the entire confspace is read and written in 4
    byte chunks. In this case as an example, CACHE_LINE_SIZE,
    LATENCY_TIMER and PCI_BIST are arriving together in one call to
    xen_pcibk_config_write() with offset == 0xc and size == 4.  With the
    exsisting overlap check the LATENCY_TIMER field (offset == 0xd, length
    == 1) is fully contained in the write request and hence is excluded
    from write, which is incorrect.
    
    Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Jan Beulich <JBeulich@suse.com>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c47cdc38adea0c9b67a20c017c87f9e946ddb874
Author: Oliver Hartkopp <socketcan@hartkopp.net>
Date:   Tue Jun 21 15:45:47 2016 +0200

    can: fix oops caused by wrong rtnl dellink usage
    
    commit 25e1ed6e64f52a692ba3191c4fde650aab3ecc07 upstream.
    
    For 'real' hardware CAN devices the netlink interface is used to set CAN
    specific communication parameters. Real CAN hardware can not be created nor
    removed with the ip tool ...
    
    This patch adds a private dellink function for the CAN device driver interface
    that does just nothing.
    
    It's a follow up to commit 993e6f2fd ("can: fix oops caused by wrong rtnl
    newlink usage") but for dellink.
    
    Reported-by: ajneu <ajneu1@gmail.com>
    Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0f423b986097ebfe10fcdd2cfc5a2547426e5b81
Author: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Date:   Wed Jun 22 21:55:01 2016 +0530

    powerpc/bpf/jit: Disable classic BPF JIT on ppc64le
    
    commit 844e3be47693f92a108cb1fb3b0606bf25e9c7a6 upstream.
    
    Classic BPF JIT was never ported completely to work on little endian
    powerpc. However, it can be enabled and will crash the system when used.
    As such, disable use of BPF JIT on ppc64le.
    
    Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
    Reported-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
    Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Acked-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    [bwh: Backported to 3.16: config symbol is BPF_JIT and also depends on PPC64]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 59fc8797830db17c5a96a5804f15dd0fc4b6b6c0
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Thu Jun 16 23:26:15 2016 +0200

    UBIFS: Implement ->migratepage()
    
    commit 4ac1c17b2044a1b4b2fbed74451947e905fc2992 upstream.
    
    During page migrations UBIFS might get confused
    and the following assert triggers:
    [  213.480000] UBIFS assert failed in ubifs_set_page_dirty at 1451 (pid 436)
    [  213.490000] CPU: 0 PID: 436 Comm: drm-stress-test Not tainted 4.4.4-00176-geaa802524636-dirty #1008
    [  213.490000] Hardware name: Allwinner sun4i/sun5i Families
    [  213.490000] [<c0015e70>] (unwind_backtrace) from [<c0012cdc>] (show_stack+0x10/0x14)
    [  213.490000] [<c0012cdc>] (show_stack) from [<c02ad834>] (dump_stack+0x8c/0xa0)
    [  213.490000] [<c02ad834>] (dump_stack) from [<c0236ee8>] (ubifs_set_page_dirty+0x44/0x50)
    [  213.490000] [<c0236ee8>] (ubifs_set_page_dirty) from [<c00fa0bc>] (try_to_unmap_one+0x10c/0x3a8)
    [  213.490000] [<c00fa0bc>] (try_to_unmap_one) from [<c00fadb4>] (rmap_walk+0xb4/0x290)
    [  213.490000] [<c00fadb4>] (rmap_walk) from [<c00fb1bc>] (try_to_unmap+0x64/0x80)
    [  213.490000] [<c00fb1bc>] (try_to_unmap) from [<c010dc28>] (migrate_pages+0x328/0x7a0)
    [  213.490000] [<c010dc28>] (migrate_pages) from [<c00d0cb0>] (alloc_contig_range+0x168/0x2f4)
    [  213.490000] [<c00d0cb0>] (alloc_contig_range) from [<c010ec00>] (cma_alloc+0x170/0x2c0)
    [  213.490000] [<c010ec00>] (cma_alloc) from [<c001a958>] (__alloc_from_contiguous+0x38/0xd8)
    [  213.490000] [<c001a958>] (__alloc_from_contiguous) from [<c001ad44>] (__dma_alloc+0x23c/0x274)
    [  213.490000] [<c001ad44>] (__dma_alloc) from [<c001ae08>] (arm_dma_alloc+0x54/0x5c)
    [  213.490000] [<c001ae08>] (arm_dma_alloc) from [<c035cecc>] (drm_gem_cma_create+0xb8/0xf0)
    [  213.490000] [<c035cecc>] (drm_gem_cma_create) from [<c035cf20>] (drm_gem_cma_create_with_handle+0x1c/0xe8)
    [  213.490000] [<c035cf20>] (drm_gem_cma_create_with_handle) from [<c035d088>] (drm_gem_cma_dumb_create+0x3c/0x48)
    [  213.490000] [<c035d088>] (drm_gem_cma_dumb_create) from [<c0341ed8>] (drm_ioctl+0x12c/0x444)
    [  213.490000] [<c0341ed8>] (drm_ioctl) from [<c0121adc>] (do_vfs_ioctl+0x3f4/0x614)
    [  213.490000] [<c0121adc>] (do_vfs_ioctl) from [<c0121d30>] (SyS_ioctl+0x34/0x5c)
    [  213.490000] [<c0121d30>] (SyS_ioctl) from [<c000f2c0>] (ret_fast_syscall+0x0/0x34)
    
    UBIFS is using PagePrivate() which can have different meanings across
    filesystems. Therefore the generic page migration code cannot handle this
    case correctly.
    We have to implement our own migration function which basically does a
    plain copy but also duplicates the page private flag.
    UBIFS is not a block device filesystem and cannot use buffer_migrate_page().
    
    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    [rw: Massaged changelog, build fixes, etc...]
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Acked-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fb577ae57848da5ec02d7fee73342fd913012efc
Author: Richard Weinberger <richard@nod.at>
Date:   Thu Jun 16 23:26:14 2016 +0200

    mm: Export migrate_page_move_mapping and migrate_page_copy
    
    commit 1118dce773d84f39ebd51a9fe7261f9169cb056e upstream.
    
    Export these symbols such that UBIFS can implement
    ->migratepage.
    
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Acked-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e66d5f6e1b8e2c474a96c27b4b7744517d96151c
Author: Richard Weinberger <richard@nod.at>
Date:   Tue Jun 21 00:31:50 2016 +0200

    ubi: Make recover_peb power cut aware
    
    commit 972228d87445dc46c0a01f5f3de673ac017626f7 upstream.
    
    recover_peb() was never power cut aware,
    if a power cut happened right after writing the VID header
    upon next attach UBI would blindly use the new partial written
    PEB and all data from the old PEB is lost.
    
    In order to make recover_peb() power cut aware, write the new
    VID with a proper crc and copy_flag set such that the UBI attach
    process will detect whether the new PEB is completely written
    or not.
    We cannot directly use ubi_eba_atomic_leb_change() since we'd
    have to unlock the LEB which is facing a write error.
    
    Reported-by: Jörg Pfähler <pfaehler@isse.de>
    Reviewed-by: Jörg Pfähler <pfaehler@isse.de>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    [bwh: Backported to 3.16: no need to unlock ubi->fm_eba_sem on error]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit da0b96a9a53d9631b4f824178e2df3c475c7d8e2
Author: Kamal Heib <kamalh@mellanox.com>
Date:   Tue Jun 21 14:20:02 2016 +0300

    net/mlx4_en: Fix the return value of a failure in VLAN VID add/kill
    
    commit 93c098af09455ea7bdc6f0f6b08f6ac14fa06cf4 upstream.
    
    Modify mlx4_en_vlan_rx_[add/kill]_vid to return error value in case of
    failure.
    
    Fixes: 8e586137e6b6 ('net: make vlan ndo_vlan_rx_[add/kill]_vid return error value')
    Signed-off-by: Kamal Heib <kamalh@mellanox.com>
    Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5ae048dd5b0be1c7a2998e90c4b862e5ebcd38ef
Author: Tony Lindgren <tony@atomide.com>
Date:   Tue May 31 14:17:06 2016 -0700

    pinctrl: single: Fix missing flush of posted write for a wakeirq
    
    commit 0ac3c0a4025f41748a083bdd4970cb3ede802b15 upstream.
    
    With many repeated suspend resume cycles, the pin specific wakeirq
    may not always work on omaps. This is because the write to enable the
    pin interrupt may not have reached the device over the interconnect
    before suspend happens.
    
    Let's fix the issue with a flush of posted write with a readback.
    
    Reported-by: Nishanth Menon <nm@ti.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c8793561f75a27eedc5928fe8b55e49ddb871eed
Author: Shaokun Zhang <zhangshaokun@hisilicon.com>
Date:   Tue Jun 21 15:32:57 2016 +0800

    arm64: mm: remove page_mapping check in __sync_icache_dcache
    
    commit 20c27a4270c775d7ed661491af8ac03264d60fc6 upstream.
    
    __sync_icache_dcache unconditionally skips the cache maintenance for
    anonymous pages, under the assumption that flushing is only required in
    the presence of D-side aliases [see 7249b79f6b4cc ("arm64: Do not flush
    the D-cache for anonymous pages")].
    
    Unfortunately, this breaks migration of anonymous pages holding
    self-modifying code, where userspace cannot be reasonably expected to
    reissue maintenance instructions in response to a migration.
    
    This patch fixes the problem by removing the broken page_mapping(page)
    check from the cache syncing code, otherwise we may end up fetching and
    executing stale instructions from the PoU.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e035653f8d0340ac0cc1f3a0ff2568bc37b37b47
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Fri Jun 17 16:10:42 2016 -0400

    tracing: Handle NULL formats in hold_module_trace_bprintk_format()
    
    commit 70c8217acd4383e069fe1898bbad36ea4fcdbdcc upstream.
    
    If a task uses a non constant string for the format parameter in
    trace_printk(), then the trace_printk_fmt variable is set to NULL. This
    variable is then saved in the __trace_printk_fmt section.
    
    The function hold_module_trace_bprintk_format() checks to see if duplicate
    formats are used by modules, and reuses them if so (saves them to the list
    if it is new). But this function calls lookup_format() that does a strcmp()
    to the value (which is now NULL) and can cause a kernel oops.
    
    This wasn't an issue till 3debb0a9ddb ("tracing: Fix trace_printk() to print
    when not using bprintk()") which added "__used" to the trace_printk_fmt
    variable, and before that, the kernel simply optimized it out (no NULL value
    was saved).
    
    The fix is simply to handle the NULL pointer in lookup_format() and have the
    caller ignore the value if it was NULL.
    
    Link: http://lkml.kernel.org/r/1464769870-18344-1-git-send-email-zhengjun.xing@intel.com
    
    Reported-by: xingzhen <zhengjun.xing@intel.com>
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Fixes: 3debb0a9ddb ("tracing: Fix trace_printk() to print when not using bprintk()")
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 758f020d4c3611523f4cc616cb248805b139b06c
Author: Wolfgang Grandegger <wg@grandegger.com>
Date:   Mon Jun 13 15:44:19 2016 +0200

    can: at91_can: RX queue could get stuck at high bus load
    
    commit 43200a4480cbbe660309621817f54cbb93907108 upstream.
    
    At high bus load it could happen that "at91_poll()" enters with all RX
    message boxes filled up. If then at the end the "quota" is exceeded as
    well, "rx_next" will not be reset to the first RX mailbox and hence the
    interrupts remain disabled.
    
    Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
    Tested-by: Amr Bekhit <amrbekhit@gmail.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2283ea0ed9d4be2b08e539c704ca35ba1dca6886
Author: Thor Thayer <tthayer@opensource.altera.com>
Date:   Thu Jun 16 11:10:19 2016 -0500

    can: c_can: Update D_CAN TX and RX functions to 32 bit - fix Altera Cyclone access
    
    commit 427460c83cdf55069eee49799a0caef7dde8df69 upstream.
    
    When testing CAN write floods on Altera's CycloneV, the first 2 bytes
    are sometimes 0x00, 0x00 or corrupted instead of the values sent. Also
    observed bytes 4 & 5 were corrupted in some cases.
    
    The D_CAN Data registers are 32 bits and changing from 16 bit writes to
    32 bit writes fixes the problem.
    
    Testing performed on Altera CycloneV (D_CAN).  Requesting tests on other
    C_CAN & D_CAN platforms.
    
    Reported-by: Richard Andrysek <richard.andrysek@gomtec.de>
    Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f3ce5ab4904628fbe9d659b43db4bb6b609bb887
Author: Pali Rohár <pali.rohar@gmail.com>
Date:   Sat Jun 18 00:54:45 2016 +0200

    hwmon: (dell-smm) Restrict fan control and serial number to CAP_SYS_ADMIN by default
    
    commit 7613663cc186f8f3c50279390ddc60286758001c upstream.
    
    For security reasons ordinary user must not be able to control fan speed
    via /proc/i8k by default. Some malicious software running under "nobody"
    user could be able to turn fan off and cause HW problems. So this patch
    changes default value of "restricted" parameter to 1.
    
    Also restrict reading of DMI_PRODUCT_SERIAL from /proc/i8k via "restricted"
    parameter. It is because non root user cannot read DMI_PRODUCT_SERIAL from
    sysfs file /sys/class/dmi/id/product_serial.
    
    Old non secure behaviour of file /proc/i8k can be achieved by loading this
    module with "restricted" parameter set to 0.
    
    Note that this patch has effects only for kernels compiled with CONFIG_I8K
    and only for file /proc/i8k. Hwmon interface provided by this driver was
    not changed and root access for setting fan speed was needed also before.
    
    Reported-by: Mario Limonciello <Mario_Limonciello@dell.com>
    Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    [bwh: Backported to 3.16: adjust filename, context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2c29e73a070be7ab1632d96ed592e97f23b6b3ec
Author: William Breathitt Gray <vilhelm.gray@gmail.com>
Date:   Wed May 11 17:01:40 2016 -0400

    isa: Call isa_bus_init before dependent ISA bus drivers register
    
    commit 32a5a0c047343b11f581f663a2309cf43d13466f upstream.
    
    The isa_bus_init function must be called before drivers which utilize
    the ISA bus driver are registered. A race condition for initilization
    exists if device_initcall is used (the isa_bus_init callback is placed
    in the same initcall level as dependent drivers which use module_init).
    This patch ensures that isa_bus_init is called first by utilizing
    postcore_initcall in favor of device_initcall.
    
    Fixes: a5117ba7da37 ("[PATCH] Driver model: add ISA bus")
    Cc: Rene Herman <rene.herman@keyaccess.nl>
    Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d1ae996d55c94cf9587140948ce942aee10ead1d
Author: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date:   Wed Jun 8 17:28:29 2016 -0600

    IB/mlx4: Properly initialize GRH TClass and FlowLabel in AHs
    
    commit 8c5122e45a10a9262f872b53f151a592e870f905 upstream.
    
    When this code was reworked for IBoE support the order of assignments
    for the sl_tclass_flowlabel got flipped around resulting in
    TClass & FlowLabel being permanently set to 0 in the packet headers.
    
    This breaks IB routers that rely on these headers, but only affects
    kernel users - libmlx4 does this properly for user space.
    
    Fixes: fa417f7b520e ("IB/mlx4: Add support for IBoE")
    Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 91c854934664bf4d713b12f663de77397840d5bd
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Jun 16 15:48:57 2016 +0100

    KEYS: potential uninitialized variable
    
    commit 38327424b40bcebe2de92d07312c89360ac9229a upstream.
    
    If __key_link_begin() failed then "edit" would be uninitialized.  I've
    added a check to fix that.
    
    This allows a random user to crash the kernel, though it's quite
    difficult to achieve.  There are three ways it can be done as the user
    would have to cause an error to occur in __key_link():
    
     (1) Cause the kernel to run out of memory.  In practice, this is difficult
         to achieve without ENOMEM cropping up elsewhere and aborting the
         attempt.
    
     (2) Revoke the destination keyring between the keyring ID being looked up
         and it being tested for revocation.  In practice, this is difficult to
         time correctly because the KEYCTL_REJECT function can only be used
         from the request-key upcall process.  Further, users can only make use
         of what's in /sbin/request-key.conf, though this does including a
         rejection debugging test - which means that the destination keyring
         has to be the caller's session keyring in practice.
    
     (3) Have just enough key quota available to create a key, a new session
         keyring for the upcall and a link in the session keyring, but not then
         sufficient quota to create a link in the nominated destination keyring
         so that it fails with EDQUOT.
    
    The bug can be triggered using option (3) above using something like the
    following:
    
            echo 80 >/proc/sys/kernel/keys/root_maxbytes
            keyctl request2 user debug:fred negate @t
    
    The above sets the quota to something much lower (80) to make the bug
    easier to trigger, but this is dependent on the system.  Note also that
    the name of the keyring created contains a random number that may be
    between 1 and 10 characters in size, so may throw the test off by
    changing the amount of quota used.
    
    Assuming the failure occurs, something like the following will be seen:
    
            kfree_debugcheck: out of range ptr 6b6b6b6b6b6b6b68h
            ------------[ cut here ]------------
            kernel BUG at ../mm/slab.c:2821!
            ...
            RIP: 0010:[<ffffffff811600f9>] kfree_debugcheck+0x20/0x25
            RSP: 0018:ffff8804014a7de8  EFLAGS: 00010092
            RAX: 0000000000000034 RBX: 6b6b6b6b6b6b6b68 RCX: 0000000000000000
            RDX: 0000000000040001 RSI: 00000000000000f6 RDI: 0000000000000300
            RBP: ffff8804014a7df0 R08: 0000000000000001 R09: 0000000000000000
            R10: ffff8804014a7e68 R11: 0000000000000054 R12: 0000000000000202
            R13: ffffffff81318a66 R14: 0000000000000000 R15: 0000000000000001
            ...
            Call Trace:
              kfree+0xde/0x1bc
              assoc_array_cancel_edit+0x1f/0x36
              __key_link_end+0x55/0x63
              key_reject_and_link+0x124/0x155
              keyctl_reject_key+0xb6/0xe0
              keyctl_negate_key+0x10/0x12
              SyS_keyctl+0x9f/0xe7
              do_syscall_64+0x63/0x13a
              entry_SYSCALL64_slow_path+0x25/0x25
    
    Fixes: f70e2e06196a ('KEYS: Do preallocation for __key_link()')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cd6d0e3b309819d3c9d4e93056d0bb370ef7faa3
Author: Ocquidant, Sebastien <sebastienocquidant@eaton.com>
Date:   Wed Jun 15 13:47:35 2016 +0200

    memory: omap-gpmc: Fix omap gpmc EXTRADELAY timing
    
    commit 8f50b8e57442d28e41bb736c173d8a2490549a82 upstream.
    
    In the omap gpmc driver it can be noticed that GPMC_CONFIG4_OEEXTRADELAY
    is overwritten by the WEEXTRADELAY value from the device tree and
    GPMC_CONFIG4_WEEXTRADELAY is not updated by the value from the device
    tree.
    
    As a consequence, the memory accesses cannot be configured properly when
    the extra delay are needed for OE and WE.
    
    Fix the update of GPMC_CONFIG4_WEEXTRADELAY with the value from the
    device tree file and prevents GPMC_CONFIG4_OEXTRADELAY
    being overwritten by the WEXTRADELAY value from the device tree.
    
    Signed-off-by: Ocquidant, Sebastien <sebastienocquidant@eaton.com>
    Signed-off-by: Roger Quadros <rogerq@ti.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7128c2018ee31a6c40e3097b00c4cddfffa37839
Author: Xiubo Li <lixiubo@cmss.chinamobile.com>
Date:   Wed Jun 15 18:00:33 2016 +0800

    kvm: Fix irq route entries exceeding KVM_MAX_IRQ_ROUTES
    
    commit caf1ff26e1aa178133df68ac3d40815fed2187d9 upstream.
    
    These days, we experienced one guest crash with 8 cores and 3 disks,
    with qemu error logs as bellow:
    
    qemu-system-x86_64: /build/qemu-2.0.0/kvm-all.c:984:
    kvm_irqchip_commit_routes: Assertion `ret == 0' failed.
    
    And then we found one patch(bdf026317d) in qemu tree, which said
    could fix this bug.
    
    Execute the following script will reproduce the BUG quickly:
    
    irq_affinity.sh
    ========================================================================
    
    vda_irq_num=25
    vdb_irq_num=27
    while [ 1 ]
    do
        for irq in {1,2,4,8,10,20,40,80}
            do
                echo $irq > /proc/irq/$vda_irq_num/smp_affinity
                echo $irq > /proc/irq/$vdb_irq_num/smp_affinity
                dd if=/dev/vda of=/dev/zero bs=4K count=100 iflag=direct
                dd if=/dev/vdb of=/dev/zero bs=4K count=100 iflag=direct
            done
    done
    ========================================================================
    
    The following qemu log is added in the qemu code and is displayed when
    this bug reproduced:
    
    kvm_irqchip_commit_routes: max gsi: 1008, nr_allocated_irq_routes: 1024,
    irq_routes->nr: 1024, gsi_count: 1024.
    
    That's to say when irq_routes->nr == 1024, there are 1024 routing entries,
    but in the kernel code when routes->nr >= 1024, will just return -EINVAL;
    
    The nr is the number of the routing entries which is in of
    [1 ~ KVM_MAX_IRQ_ROUTES], not the index in [0 ~ KVM_MAX_IRQ_ROUTES - 1].
    
    This patch fix the BUG above.
    
    Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
    Signed-off-by: Wei Tang <tangwei@cmss.chinamobile.com>
    Signed-off-by: Zhang Zhuoyu <zhangzhuoyu@cmss.chinamobile.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7940e38ee47367bc058bb7e038c9857c08f207b4
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Fri Jun 10 10:54:32 2016 +0200

    base: make module_create_drivers_dir race-free
    
    commit 7e1b1fc4dabd6ec8e28baa0708866e13fa93c9b3 upstream.
    
    Modules which register drivers via standard path (driver_register) in
    parallel can cause a warning:
    WARNING: CPU: 2 PID: 3492 at ../fs/sysfs/dir.c:31 sysfs_warn_dup+0x62/0x80
    sysfs: cannot create duplicate filename '/module/saa7146/drivers'
    Modules linked in: hexium_gemini(+) mxb(+) ...
    ...
    Call Trace:
    ...
     [<ffffffff812e63a2>] sysfs_warn_dup+0x62/0x80
     [<ffffffff812e6487>] sysfs_create_dir_ns+0x77/0x90
     [<ffffffff8140f2c4>] kobject_add_internal+0xb4/0x340
     [<ffffffff8140f5b8>] kobject_add+0x68/0xb0
     [<ffffffff8140f631>] kobject_create_and_add+0x31/0x70
     [<ffffffff8157a703>] module_add_driver+0xc3/0xd0
     [<ffffffff8155e5d4>] bus_add_driver+0x154/0x280
     [<ffffffff815604c0>] driver_register+0x60/0xe0
     [<ffffffff8145bed0>] __pci_register_driver+0x60/0x70
     [<ffffffffa0273e14>] saa7146_register_extension+0x64/0x90 [saa7146]
     [<ffffffffa0033011>] hexium_init_module+0x11/0x1000 [hexium_gemini]
    ...
    
    As can be (mostly) seen, driver_register causes this call sequence:
      -> bus_add_driver
        -> module_add_driver
          -> module_create_drivers_dir
    The last one creates "drivers" directory in /sys/module/<...>. When
    this is done in parallel, the directory is attempted to be created
    twice at the same time.
    
    This can be easily reproduced by loading mxb and hexium_gemini in
    parallel:
    while :; do
      modprobe mxb &
      modprobe hexium_gemini
      wait
      rmmod mxb hexium_gemini saa7146_vv saa7146
    done
    
    saa7146 calls pci_register_driver for both mxb and hexium_gemini,
    which means /sys/module/saa7146/drivers is to be created for both of
    them.
    
    Fix this by a new mutex in module_create_drivers_dir which makes the
    test-and-create "drivers" dir atomic.
    
    I inverted the condition and removed 'return' to avoid multiple
    unlocks or a goto.
    
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Fixes: fe480a2675ed (Modules: only add drivers/ direcory if needed)
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5b12e395b079e5bf495d54f916ed586ab403d182
Author: Lyude <cpaul@redhat.com>
Date:   Tue Jun 14 11:04:09 2016 -0400

    drm/i915/ilk: Don't disable SSC source if it's in use
    
    commit 476490a945e1f0f6bd58e303058d2d8ca93a974c upstream.
    
    Thanks to Ville Syrjälä for pointing me towards the cause of this issue.
    
    Unfortunately one of the sideaffects of having the refclk for a DPLL set
    to SSC is that as long as it's set to SSC, the GPU will prevent us from
    powering down any of the pipes or transcoders using it. A couple of
    BIOSes enable SSC in both PCH_DREF_CONTROL and in the DPLL
    configurations. This causes issues on the first modeset, since we don't
    expect SSC to be left on and as a result, can't successfully power down
    the pipes or the transcoders using it. Here's an example from this Dell
    OptiPlex 990:
    
    [drm:intel_modeset_init] SSC enabled by BIOS, overriding VBT which says disabled
    [drm:intel_modeset_init] 2 display pipes available.
    [drm:intel_update_cdclk] Current CD clock rate: 400000 kHz
    [drm:intel_update_max_cdclk] Max CD clock rate: 400000 kHz
    [drm:intel_update_max_cdclk] Max dotclock rate: 360000 kHz
    vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
    [drm:intel_crt_reset] crt adpa set to 0xf40000
    [drm:intel_dp_init_connector] Adding DP connector on port C
    [drm:intel_dp_aux_init] registering DPDDC-C bus for card0-DP-1
    [drm:ironlake_init_pch_refclk] has_panel 0 has_lvds 0 has_ck505 0
    [drm:ironlake_init_pch_refclk] Disabling SSC entirely
    … later we try committing the first modeset …
    [drm:intel_dump_pipe_config] [CRTC:26][modeset] config ffff88041b02e800 for pipe A
    [drm:intel_dump_pipe_config] cpu_transcoder: A
    …
    [drm:intel_dump_pipe_config] dpll_hw_state: dpll: 0xc4016001, dpll_md: 0x0, fp0: 0x20e08, fp1: 0x30d07
    [drm:intel_dump_pipe_config] planes on this crtc
    [drm:intel_dump_pipe_config] STANDARD PLANE:23 plane: 0.0 idx: 0 enabled
    [drm:intel_dump_pipe_config]     FB:42, fb = 800x600 format = 0x34325258
    [drm:intel_dump_pipe_config]     scaler:0 src (0, 0) 800x600 dst (0, 0) 800x600
    [drm:intel_dump_pipe_config] CURSOR PLANE:25 plane: 0.1 idx: 1 disabled, scaler_id = 0
    [drm:intel_dump_pipe_config] STANDARD PLANE:27 plane: 0.1 idx: 2 disabled, scaler_id = 0
    [drm:intel_get_shared_dpll] CRTC:26 allocated PCH DPLL A
    [drm:intel_get_shared_dpll] using PCH DPLL A for pipe A
    [drm:ilk_audio_codec_disable] Disable audio codec on port C, pipe A
    [drm:intel_disable_pipe] disabling pipe A
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 130 at drivers/gpu/drm/i915/intel_display.c:1146 intel_disable_pipe+0x297/0x2d0 [i915]
    pipe_off wait timed out
    …
    ---[ end trace 94fc8aa03ae139e8 ]---
    [drm:intel_dp_link_down]
    [drm:ironlake_crtc_disable [i915]] *ERROR* failed to disable transcoder A
    
    Later modesets succeed since they reset the DPLL's configuration anyway,
    but this is enough to get stuck with a big fat warning in dmesg.
    
    A better solution would be to add refcounts for the SSC source, but for
    now leaving the source clock on should suffice.
    
    Changes since v4:
     - Fix calculation of final for systems with LVDS panels (fixes BUG() on
       CI test suite)
    Changes since v3:
     - Move temp variable into loop
     - Move checks for using_ssc_source to after we've figured out has_ck505
     - Add using_ssc_source to debug output
    Changes since v2:
     - Fix debug output for when we disable the CPU source
    Changes since v1:
     - Leave the SSC source clock on instead of just shutting it off on all
       of the DPLL configurations.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Lyude <cpaul@redhat.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1465916649-10228-1-git-send-email-cpaul@redhat.com
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 69b7dca1a9ddba87befd0de15c053438615647dd
Author: Eric Dumazet <edumazet@google.com>
Date:   Sun Jun 12 20:01:25 2016 -0700

    net_sched: fix pfifo_head_drop behavior vs backlog
    
    commit 6c0d54f1897d229748d4f41ef919078db6db2123 upstream.
    
    When the qdisc is full, we drop a packet at the head of the queue,
    queue the current skb and return NET_XMIT_CN
    
    Now we track backlog on upper qdiscs, we need to call
    qdisc_tree_reduce_backlog(), even if the qlen did not change.
    
    Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: WANG Cong <xiyou.wangcong@gmail.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1cba75a4b41a4d86d7aae72eb0dffef14a06d8cc
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Jun 20 15:00:43 2016 -0700

    netem: fix a use after free
    
    commit 21de12ee5568fd1aec47890c72967abf791ac80a upstream.
    
    If the packet was dropped by lower qdisc, then we must not
    access it later.
    
    Save qdisc_pkt_len(skb) in a temp variable.
    
    Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: WANG Cong <xiyou.wangcong@gmail.com>
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: not using qdisc_qstats_drop()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a64474e6897969ebfbf002c263e3def29cd686d2
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Thu Feb 25 14:55:01 2016 -0800

    net_sched: update hierarchical backlog too
    
    commit 2ccccf5fb43ff62b2b96cc58d95fc0b3596516e4 upstream.
    
    When the bottom qdisc decides to, for example, drop some packet,
    it calls qdisc_tree_decrease_qlen() to update the queue length
    for all its ancestors, we need to update the backlog too to
    keep the stats on root qdisc accurate.
    
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f2610da0605227b7fc4d6ffd499fa3c7ef16644e
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Thu Feb 25 14:55:00 2016 -0800

    net_sched: introduce qdisc_replace() helper
    
    commit 86a7996cc8a078793670d82ed97d5a99bb4e8496 upstream.
    
    Remove nearly duplicated code and prepare for the following patch.
    
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4fecee0b8e513a4b3a05a3c07f5f1f487e1f361b
Author: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date:   Sat Jun 11 20:32:06 2016 +0200

    ipv6: fix endianness error in icmpv6_err
    
    commit dcb94b88c09ce82a80e188d49bcffdc83ba215a6 upstream.
    
    IPv6 ping socket error handler doesn't correctly convert the new 32 bit
    mtu to host endianness before using.
    
    Cc: Lorenzo Colitti <lorenzo@google.com>
    Fixes: 6d0bfe22611602f ("net: ipv6: Add IPv6 support to the ping socket.")
    Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
    Acked-by: Lorenzo Colitti <lorenzo@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9812d874c01abc2ff86667132623d698f6f7a537
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Jun 9 15:20:05 2016 +0300

    kernel/sysrq, watchdog, sched/core: Reset watchdog on all CPUs while processing sysrq-w
    
    commit 57675cb976eff977aefb428e68e4e0236d48a9ff upstream.
    
    Lengthy output of sysrq-w may take a lot of time on slow serial console.
    
    Currently we reset NMI-watchdog on the current CPU to avoid spurious
    lockup messages. Sometimes this doesn't work since softlockup watchdog
    might trigger on another CPU which is waiting for an IPI to proceed.
    We reset softlockup watchdogs on all CPUs, but we do this only after
    listing all tasks, and this may be too late on a busy system.
    
    So, reset watchdogs CPUs earlier, in for_each_process_thread() loop.
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1465474805-14641-1-git-send-email-aryabinin@virtuozzo.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3e1f42c309c40f68771c573350a4b5880769ae71
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Sat Jun 11 23:06:53 2016 +0900

    kprobes/x86: Clear TF bit in fault on single-stepping
    
    commit dcfc47248d3f7d28df6f531e6426b933de94370d upstream.
    
    Fix kprobe_fault_handler() to clear the TF (trap flag) bit of
    the flags register in the case of a fault fixup on single-stepping.
    
    If we put a kprobe on the instruction which caused a
    page fault (e.g. actual mov instructions in copy_user_*),
    that fault happens on the single-stepping buffer. In this
    case, kprobes resets running instance so that the CPU can
    retry execution on the original ip address.
    
    However, current code forgets to reset the TF bit. Since this
    fault happens with TF bit set for enabling single-stepping,
    when it retries, it causes a debug exception and kprobes
    can not handle it because it already reset itself.
    
    On the most of x86-64 platform, it can be easily reproduced
    by using kprobe tracer. E.g.
    
      # cd /sys/kernel/debug/tracing
      # echo p copy_user_enhanced_fast_string+5 > kprobe_events
      # echo 1 > events/kprobes/enable
    
    And you'll see a kernel panic on do_debug(), since the debug
    trap is not handled by kprobes.
    
    To fix this problem, we just need to clear the TF bit when
    resetting running kprobe.
    
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
    Acked-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: systemtap@sourceware.org
    Link: http://lkml.kernel.org/r/20160611140648.25885.37482.stgit@devbox
    [ Updated the comments. ]
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8ea923f57d00e6b366781a1c98a2f0b1b1b5f5f3
Author: Michal Suchanek <hramrach@gmail.com>
Date:   Mon Jun 13 17:46:49 2016 +0000

    spi: sunxi: fix transfer timeout
    
    commit 719bd6542044efd9b338a53dba1bef45f40ca169 upstream.
    
    The trasfer timeout is fixed at 1000 ms. Reading a 4Mbyte flash over
    1MHz SPI bus takes way longer than that. Calculate the timeout from the
    actual time the transfer is supposed to take and multiply by 2 for good
    measure.
    
    Signed-off-by: Michal Suchanek <hramrach@gmail.com>
    Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4d9a4481db247c5cad8b50175d7cba4e070ef400
Author: Michal Suchanek <hramrach@gmail.com>
Date:   Mon Jun 13 17:46:49 2016 +0000

    spi: sun4i: fix FIFO limit
    
    commit 6d9fe44bd73d567d04d3a68a2d2fa521ab9532f2 upstream.
    
    When testing SPI without DMA I noticed that filling the FIFO on the
    spi controller causes timeout.
    
    Always leave room for one byte in the FIFO.
    
    Signed-off-by: Michal Suchanek <hramrach@gmail.com>
    Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b3f933acc4d242222c626a8e4daf998f9b17cea6
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Jun 13 15:37:34 2016 -0400

    drm/radeon: fix asic initialization for virtualized environments
    
    commit 05082b8bbd1a0ffc74235449c4b8930a8c240f85 upstream.
    
    When executing in a PCI passthrough based virtuzliation environment, the
    hypervisor will usually attempt to send a PCIe bus reset signal to the
    ASIC when the VM reboots. In this scenario, the card is not correctly
    initialized, but we still consider it to be posted. Therefore, in a
    passthrough based environemnt we should always post the card to guarantee
    it is in a good state for driver initialization.
    
    Ported from amdgpu commit:
    amdgpu: fix asic initialization for virtualized environments
    
    Cc: Andres Rodriguez <andres.rodriguez@amd.com>
    Cc: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f852203aec3c94e178f05c14108e0cb1cbe14871
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Wed Jun 8 14:56:39 2016 +0200

    crypto: ux500 - memmove the right size
    
    commit 19ced623db2fe91604d69f7d86b03144c5107739 upstream.
    
    The hash buffer is really HASH_BLOCK_SIZE bytes, someone
    must have thought that memmove takes n*u32 words by mistake.
    Tests work as good/bad as before after this patch.
    
    Cc: Joakim Bech <joakim.bech@linaro.org>
    Reported-by: David Binderman <linuxdev.baldrick@gmail.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9919761a5db2b0477f3f3a8746ac4ec582540b02
Author: Steve Capper <steve.capper@arm.com>
Date:   Tue Jun 7 17:58:06 2016 +0100

    ARM: 8579/1: mm: Fix definition of pmd_mknotpresent
    
    commit 56530f5d2ddc9b9fade7ef8db9cb886e9dc689b5 upstream.
    
    Currently pmd_mknotpresent will use a zero entry to respresent an
    invalidated pmd.
    
    Unfortunately this definition clashes with pmd_none, thus it is
    possible for a race condition to occur if zap_pmd_range sees pmd_none
    whilst __split_huge_pmd_locked is running too with pmdp_invalidate
    just called.
    
    This patch fixes the race condition by modifying pmd_mknotpresent to
    create non-zero faulting entries (as is done in other architectures),
    removing the ambiguity with pmd_none.
    
    [catalin.marinas@arm.com: using L_PMD_SECT_VALID instead of PMD_TYPE_SECT]
    
    Fixes: 8d9625070073 ("ARM: mm: Transparent huge page support for LPAE systems.")
    Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Acked-by: Will Deacon <will.deacon@arm.com>
    Cc: Russell King <linux@armlinux.org.uk>
    Signed-off-by: Steve Capper <steve.capper@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    [bwh: Backported to 3.16: also convert from a macro to a function, as done
     earlier upstream]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9ad40548364a11604a1a82ac22a903e3127d56cd
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Jun 7 17:57:54 2016 +0100

    ARM: 8578/1: mm: ensure pmd_present only checks the valid bit
    
    commit 624531886987f0f1b5d01fb598034d039198e090 upstream.
    
    In a subsequent patch, pmd_mknotpresent will clear the valid bit of the
    pmd entry, resulting in a not-present entry from the hardware's
    perspective. Unfortunately, pmd_present simply checks for a non-zero pmd
    value and will therefore continue to return true even after a
    pmd_mknotpresent operation. Since pmd_mknotpresent is only used for
    managing huge entries, this is only an issue for the 3-level case.
    
    This patch fixes the 3-level pmd_present implementation to take into
    account the valid bit. For bisectability, the change is made before the
    fix to pmd_mknotpresent.
    
    [catalin.marinas@arm.com: comment update regarding pmd_mknotpresent patch]
    
    Fixes: 8d9625070073 ("ARM: mm: Transparent huge page support for LPAE systems.")
    Cc: Russell King <linux@armlinux.org.uk>
    Cc: Steve Capper <Steve.Capper@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 926358013aae75fa2886cd74866f2e3e2574bff9
Author: Wei Fang <fangwei1@huawei.com>
Date:   Tue Jun 7 14:53:56 2016 +0800

    scsi: fix race between simultaneous decrements of ->host_failed
    
    commit 72d8c36ec364c82bf1bf0c64dfa1041cfaf139f7 upstream.
    
    sas_ata_strategy_handler() adds the works of the ata error handler to
    system_unbound_wq. This workqueue asynchronously runs work items, so the
    ata error handler will be performed concurrently on different CPUs. In
    this case, ->host_failed will be decreased simultaneously in
    scsi_eh_finish_cmd() on different CPUs, and become abnormal.
    
    It will lead to permanently inequality between ->host_failed and
    ->host_busy, and scsi error handler thread won't start running. IO
    errors after that won't be handled.
    
    Since all scmds must have been handled in the strategy handler, just
    remove the decrement in scsi_eh_finish_cmd() and zero ->host_busy after
    the strategy handler to fix this race.
    
    Fixes: 50824d6c5657 ("[SCSI] libsas: async ata-eh")
    Signed-off-by: Wei Fang <fangwei1@huawei.com>
    Reviewed-by: James Bottomley <jejb@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6947850e72d7021e24707adcd69186d05d73e762
Author: Crestez Dan Leonard <leonard.crestez@intel.com>
Date:   Tue May 3 15:27:09 2016 +0300

    iio: Fix error handling in iio_trigger_attach_poll_func
    
    commit 99543823357966ac938d9a310947e731b67338e6 upstream.
    
    When attaching a pollfunc iio_trigger_attach_poll_func will allocate a
    virtual irq and call the driver's set_trigger_state function. Fix error
    handling to undo previous steps if any fails.
    
    In particular this fixes handling errors from a driver's
    set_trigger_state function. When using triggered buffers a failure to
    enable the trigger used to make the buffer unusable.
    
    Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 63df59d71cb96c6dd747e9f813e31b77606f4494
Author: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Date:   Tue May 31 10:05:27 2016 -0500

    usb: musb: Stop bulk endpoint while queue is rotated
    
    commit 7b2c17f829545df27a910e8d82e133c21c9a8c9c upstream.
    
    Ensure that the endpoint is stopped by clearing REQPKT before
    clearing DATAERR_NAKTIMEOUT before rotating the queue on the
    dedicated bulk endpoint.
    This addresses an issue where a race could result in the endpoint
    receiving data before it was reprogrammed resulting in a warning
    about such data from musb_rx_reinit before it was thrown away.
    The data thrown away was a valid packet that had been correctly
    ACKed which meant the host and device got out of sync.
    
    Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ee4b99b85e3d3abb49f1a94a155c9a0692944376
Author: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Date:   Tue May 31 10:05:26 2016 -0500

    usb: musb: Ensure rx reinit occurs for shared_fifo endpoints
    
    commit f3eec0cf784e0d6c47822ca6b66df3d5812af7e6 upstream.
    
    shared_fifo endpoints would only get a previous tx state cleared
    out, the rx state was only cleared for non shared_fifo endpoints
    Change this so that the rx state is cleared for all endpoints.
    This addresses an issue that resulted in rx packets being dropped
    silently.
    
    Signed-off-by: Andrew Goodbody <andrew.goodbody@cambrionix.com>
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 84e406e77eef403008908c30ca695e7102e3a359
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Wed Jun 1 21:01:29 2016 +0200

    USB: xhci: Add broken streams quirk for Frescologic device id 1009
    
    commit d95815ba6a0f287213118c136e64d8c56daeaeab upstream.
    
    I got one of these cards for testing uas with, it seems that with streams
    it dma-s all over the place, corrupting memory. On my first tests it
    managed to dma over the BIOS of the motherboard somehow and completely
    bricked it.
    
    Tests on another motherboard show that it does work with streams disabled.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fdf24ae20dda46afb6c8c2489433324b7dfe0ade
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu May 19 17:12:20 2016 +0200

    usb: quirks: Add no-lpm quirk for Acer C120 LED Projector
    
    commit 32cb0b37098f4beeff5ad9e325f11b42a6ede56c upstream.
    
    The Acer C120 LED Projector is a USB-3 connected pico projector which
    takes both its power and video data from USB-3.
    
    In combination with some hubs this device does not play well with
    lpm, so disable lpm for it.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 19e81287bf30c872dfe1892dc5d4e7f68f638443
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu May 19 17:12:19 2016 +0200

    usb: quirks: Fix sorting
    
    commit 81099f97bd31e25ff2719a435b1860fc3876122f upstream.
    
    Properly sort all the entries by vendor id.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 45f8b0825cfa51fde5f20ea5b5802105dcee8511
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Mon Aug 1 21:12:27 2016 +0100

    USB: quirks: Fix entries on wrong list in 3.16.y
    
    Commits ddbe1fca0bcb ("USB: Add device quirk for ASUS T100 Base
    Station keyboard") and e5dff0e80463 ("USB: Add OTG PET device to TPL")
    were wrongly backported to 3.16.y.  The original commits added to
    usb_quirk_list but the backported versions added to
    usb_interface_quirk_list.
    
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 56c989e694312277b786a75424586c90a800891b
Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date:   Wed Jun 1 18:09:09 2016 +0300

    usb: xhci-plat: properly handle probe deferral for devm_clk_get()
    
    commit de95c40d5beaa47f6dc8fe9ac4159b4672b51523 upstream.
    
    On some platforms, the clocks might be registered by a platform
    driver. When this is the case, the clock platform driver may very well
    be probed after xhci-plat, in which case the first probe() invocation
    of xhci-plat will receive -EPROBE_DEFER as the return value of
    devm_clk_get().
    
    The current code handles that as a normal error, and simply assumes
    that this means that the system doesn't have a clock for the XHCI
    controller, and continues probing without calling
    clk_prepare_enable(). Unfortunately, this doesn't work on systems
    where the XHCI controller does have a clock, but that clock is
    provided by another platform driver. In order to fix this situation,
    we handle the -EPROBE_DEFER error condition specially, and abort the
    XHCI controller probe(). It will be retried later automatically, the
    clock will be available, devm_clk_get() will succeed, and the probe()
    will continue with the clock prepared and enabled as expected.
    
    In practice, such issue is seen on the ARM64 Marvell 7K/8K platform,
    where the clocks are registered by a platform driver.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.16: correct error label here is unmap_registers]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a557272e807708efcdb13ba4d9a42527cf461b52
Author: Oliver Neukum <oneukum@suse.com>
Date:   Tue May 31 14:48:15 2016 +0200

    HID: elo: kill not flush the work
    
    commit ed596a4a88bd161f868ccba078557ee7ede8a6ef upstream.
    
    Flushing a work that reschedules itself is not a sensible operation. It needs
    to be killed. Failure to do so leads to a kernel panic in the timer code.
    
    Signed-off-by: Oliver Neukum <ONeukum@suse.com>
    Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f2fd7720aacd702811dd6f863e801a76e97a8722
Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date:   Sun May 8 23:20:59 2016 +0200

    usb: gadget: avoid exposing kernel stack
    
    commit ffeee83aa0461992e8a99a59db2df31933e60362 upstream.
    
    Function in_rq_cur copies random bytes from the stack.
    Zero the memory instead.
    
    Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
    Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit af361f444281aeddd08e24fc93e5849306b13c56
Author: Bin Liu <b-liu@ti.com>
Date:   Thu May 26 11:43:45 2016 -0500

    usb: gadget: fix spinlock dead lock in gadgetfs
    
    commit d246dcb2331c5783743720e6510892eb1d2801d9 upstream.
    
    [   40.467381] =============================================
    [   40.473013] [ INFO: possible recursive locking detected ]
    [   40.478651] 4.6.0-08691-g7f3db9a #37 Not tainted
    [   40.483466] ---------------------------------------------
    [   40.489098] usb/733 is trying to acquire lock:
    [   40.493734]  (&(&dev->lock)->rlock){-.....}, at: [<bf129288>] ep0_complete+0x18/0xdc [gadgetfs]
    [   40.502882]
    [   40.502882] but task is already holding lock:
    [   40.508967]  (&(&dev->lock)->rlock){-.....}, at: [<bf12a420>] ep0_read+0x20/0x5e0 [gadgetfs]
    [   40.517811]
    [   40.517811] other info that might help us debug this:
    [   40.524623]  Possible unsafe locking scenario:
    [   40.524623]
    [   40.530798]        CPU0
    [   40.533346]        ----
    [   40.535894]   lock(&(&dev->lock)->rlock);
    [   40.540088]   lock(&(&dev->lock)->rlock);
    [   40.544284]
    [   40.544284]  *** DEADLOCK ***
    [   40.544284]
    [   40.550461]  May be due to missing lock nesting notation
    [   40.550461]
    [   40.557544] 2 locks held by usb/733:
    [   40.561271]  #0:  (&f->f_pos_lock){+.+.+.}, at: [<c02a6114>] __fdget_pos+0x40/0x48
    [   40.569219]  #1:  (&(&dev->lock)->rlock){-.....}, at: [<bf12a420>] ep0_read+0x20/0x5e0 [gadgetfs]
    [   40.578523]
    [   40.578523] stack backtrace:
    [   40.583075] CPU: 0 PID: 733 Comm: usb Not tainted 4.6.0-08691-g7f3db9a #37
    [   40.590246] Hardware name: Generic AM33XX (Flattened Device Tree)
    [   40.596625] [<c010ffbc>] (unwind_backtrace) from [<c010c1bc>] (show_stack+0x10/0x14)
    [   40.604718] [<c010c1bc>] (show_stack) from [<c04207fc>] (dump_stack+0xb0/0xe4)
    [   40.612267] [<c04207fc>] (dump_stack) from [<c01886ec>] (__lock_acquire+0xf68/0x1994)
    [   40.620440] [<c01886ec>] (__lock_acquire) from [<c0189528>] (lock_acquire+0xd8/0x238)
    [   40.628621] [<c0189528>] (lock_acquire) from [<c06ad6b4>] (_raw_spin_lock_irqsave+0x38/0x4c)
    [   40.637440] [<c06ad6b4>] (_raw_spin_lock_irqsave) from [<bf129288>] (ep0_complete+0x18/0xdc [gadgetfs])
    [   40.647339] [<bf129288>] (ep0_complete [gadgetfs]) from [<bf10a728>] (musb_g_giveback+0x118/0x1b0 [musb_hdrc])
    [   40.657842] [<bf10a728>] (musb_g_giveback [musb_hdrc]) from [<bf108768>] (musb_g_ep0_queue+0x16c/0x188 [musb_hdrc])
    [   40.668772] [<bf108768>] (musb_g_ep0_queue [musb_hdrc]) from [<bf12a944>] (ep0_read+0x544/0x5e0 [gadgetfs])
    [   40.678963] [<bf12a944>] (ep0_read [gadgetfs]) from [<c0284470>] (__vfs_read+0x20/0x110)
    [   40.687414] [<c0284470>] (__vfs_read) from [<c0285324>] (vfs_read+0x88/0x114)
    [   40.694864] [<c0285324>] (vfs_read) from [<c0286150>] (SyS_read+0x44/0x9c)
    [   40.702051] [<c0286150>] (SyS_read) from [<c0107820>] (ret_fast_syscall+0x0/0x1c)
    
    This is caused by the spinlock bug in ep0_read().
    Fix the two other deadlock sources in gadgetfs_setup() too.
    
    Signed-off-by: Bin Liu <b-liu@ti.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 128ef503589c3a97784a474a6a789c756f497b4f
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Sat May 28 07:48:10 2016 +0300

    usb: f_fs: off by one bug in _ffs_func_bind()
    
    commit 0015f9156092d07b3ec06d37d014328419d5832e upstream.
    
    This loop is supposed to set all the .num[] values to -1 but it's off by
    one so it skips the first element and sets one element past the end of
    the array.
    
    I've cleaned up the loop a little as well.
    
    Fixes: ddf8abd25994 ('USB: f_fs: the FunctionFS driver')
    Acked-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    [bwh: Backported to 3.16:
     - Adjust filename, context
     - Add definition of i variable]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c4a6d3b31a35aa8ac5c25b80a6898b537721f211
Author: Steinar H. Gunderson <sesse@google.com>
Date:   Tue May 24 20:13:15 2016 +0200

    usb: dwc3: exynos: Fix deferred probing storm.
    
    commit 4879efb34f7d49235fac334d76d9c6a77a021413 upstream.
    
    dwc3-exynos has two problems during init if the regulators are slow
    to come up (for instance if the I2C bus driver is not on the initramfs)
    and return probe deferral. First, every time this happens, the driver
    leaks the USB phys created; they need to be deallocated on error.
    
    Second, since the phy devices are created before the regulators fail,
    this means that there's a new device to re-trigger deferred probing,
    which causes it to essentially go into a busy loop of re-probing the
    device until the regulators come up.
    
    Move the phy creation to after the regulators have succeeded, and also
    fix cleanup on failure. On my ODROID XU4 system (with Debian's initramfs
    which doesn't contain the I2C driver), this reduces the number of probe
    attempts (for each of the two controllers) from more than 2000 to eight.
    
    Signed-off-by: Steinar H. Gunderson <sesse@google.com>
    Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Reviewed-by: Vivek Gautam <gautam.vivek@samsung.com>
    Fixes: d720f057fda4 ("usb: dwc3: exynos: add nop transceiver support")
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f9660d5d7c22b7b5658a7f781d2150f81ce5e6e2
Author: Gregor Boirie <gregor.boirie@parrot.com>
Date:   Tue Apr 19 11:18:33 2016 +0200

    iio:st_pressure: fix sampling gains (bring inline with ABI)
    
    commit d43a41152f8e9e4c0d19850884d1fada076dee10 upstream.
    
    Temperature channels report scaled samples in Celsius although expected as
    milli degree Celsius in Documentation/ABI/testing/sysfs-bus-iio.
    Gains are not implemented at all for LPS001WP pressure and temperature
    channels.
    
    This patch ensures that proper offsets and scales are exposed to userpace
    for both pressure and temperature channels.
    Also fix a NULL pointer exception when userspace reads content of sysfs
    scale attribute when gains are not defined.
    
    Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    [bwh: Backported to 3.16:
     - Adjust context
     - In st_press_read_raw() use pdata instead of press_data]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b428cc797cb1d61805ae09ececcdcc8065d584ed
Author: Matt Ranostay <mranostay@gmail.com>
Date:   Sat May 21 20:01:03 2016 -0700

    iio: proximity: as3935: fix buffer stack trashing
    
    commit 37b1ba2c68cfbe37f5f45bb91bcfaf2b016ae6a1 upstream.
    
    Buffer wasn't of a valid size to allow the timestamp, and correct padding.
    This patchset also moves the buffer off the stack, and onto the heap.
    
    Cc: george.mccollister@gmail.com
    Signed-off-by: Matt Ranostay <mranostay@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3593f8c7113ae320adbbf003b550d1dac405cf9e
Author: Matt Ranostay <mranostay@gmail.com>
Date:   Sat May 21 20:01:02 2016 -0700

    iio: proximity: as3935: remove triggered buffer processing
    
    commit 7d0643634ea567969bf3f3ed6193a9d6fc75653b upstream.
    
    Triggered buffers shouldn't return processed data, and the respective
    conversion was overflowing the defined .realbits for the channel.
    
    Cc: george.mccollister@gmail.com
    Signed-off-by: Matt Ranostay <mranostay@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b72c1d07bc687d097b192b9d259ab467b28bace5
Author: Matt Ranostay <mranostay@gmail.com>
Date:   Sat May 21 20:01:01 2016 -0700

    iio: proximity: as3935: correct IIO_CHAN_INFO_RAW output
    
    commit 5138806f16c74c7cb8ac3e408a859c79eb7c9567 upstream.
    
    IIO_CHAN_INFO_RAW was returning processed data which was incorrect.
    This also adds the IIO_CHAN_INFO_SCALE value to convert to a processed value.
    
    Signed-off-by: Matt Ranostay <mranostay@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3f328647ca8f7255a8d5ca202133f25966fdf200
Author: Roger Quadros <rogerq@ti.com>
Date:   Mon May 9 11:28:37 2016 +0300

    mfd: omap-usb-tll: Fix scheduling while atomic BUG
    
    commit b49b927f16acee626c56a1af4ab4cb062f75b5df upstream.
    
    We shouldn't be calling clk_prepare_enable()/clk_prepare_disable()
    in an atomic context.
    
    Fixes the following issue:
    
    [    5.830970] ehci-omap: OMAP-EHCI Host Controller driver
    [    5.830974] driver_register 'ehci-omap'
    [    5.895849] driver_register 'wl1271_sdio'
    [    5.896870] BUG: scheduling while atomic: udevd/994/0x00000002
    [    5.896876] 4 locks held by udevd/994:
    [    5.896904]  #0:  (&dev->mutex){......}, at: [<c049597c>] __driver_attach+0x60/0xac
    [    5.896923]  #1:  (&dev->mutex){......}, at: [<c049598c>] __driver_attach+0x70/0xac
    [    5.896946]  #2:  (tll_lock){+.+...}, at: [<c04c2630>] omap_tll_enable+0x2c/0xd0
    [    5.896966]  #3:  (prepare_lock){+.+...}, at: [<c05ce9c8>] clk_prepare_lock+0x48/0xe0
    [    5.897042] Modules linked in: wlcore_sdio(+) ehci_omap(+) dwc3_omap snd_soc_ts3a225e leds_is31fl319x bq27xxx_battery_i2c tsc2007 bq27xxx_battery bq2429x_charger ina2xx tca8418_keypad as5013 leds_tca6507 twl6040_vibra gpio_twl6040 bmp085_i2c(+) palmas_gpadc usb3503 palmas_pwrbutton bmg160_i2c(+) bmp085 bma150(+) bmg160_core bmp280 input_polldev snd_soc_omap_mcbsp snd_soc_omap_mcpdm snd_soc_omap snd_pcm_dmaengine
    [    5.897048] Preemption disabled at:[<  (null)>]   (null)
    [    5.897051]
    [    5.897059] CPU: 0 PID: 994 Comm: udevd Not tainted 4.6.0-rc5-letux+ #233
    [    5.897062] Hardware name: Generic OMAP5 (Flattened Device Tree)
    [    5.897076] [<c010e714>] (unwind_backtrace) from [<c010af34>] (show_stack+0x10/0x14)
    [    5.897087] [<c010af34>] (show_stack) from [<c040aa7c>] (dump_stack+0x88/0xc0)
    [    5.897099] [<c040aa7c>] (dump_stack) from [<c020c558>] (__schedule_bug+0xac/0xd0)
    [    5.897111] [<c020c558>] (__schedule_bug) from [<c06f3d44>] (__schedule+0x88/0x7e4)
    [    5.897120] [<c06f3d44>] (__schedule) from [<c06f46d8>] (schedule+0x9c/0xc0)
    [    5.897129] [<c06f46d8>] (schedule) from [<c06f4904>] (schedule_preempt_disabled+0x14/0x20)
    [    5.897140] [<c06f4904>] (schedule_preempt_disabled) from [<c06f64e4>] (mutex_lock_nested+0x258/0x43c)
    [    5.897150] [<c06f64e4>] (mutex_lock_nested) from [<c05ce9c8>] (clk_prepare_lock+0x48/0xe0)
    [    5.897160] [<c05ce9c8>] (clk_prepare_lock) from [<c05d0e7c>] (clk_prepare+0x10/0x28)
    [    5.897169] [<c05d0e7c>] (clk_prepare) from [<c04c2668>] (omap_tll_enable+0x64/0xd0)
    [    5.897180] [<c04c2668>] (omap_tll_enable) from [<c04c1728>] (usbhs_runtime_resume+0x18/0x17c)
    [    5.897192] [<c04c1728>] (usbhs_runtime_resume) from [<c049d404>] (pm_generic_runtime_resume+0x2c/0x40)
    [    5.897202] [<c049d404>] (pm_generic_runtime_resume) from [<c049f180>] (__rpm_callback+0x38/0x68)
    [    5.897210] [<c049f180>] (__rpm_callback) from [<c049f220>] (rpm_callback+0x70/0x88)
    [    5.897218] [<c049f220>] (rpm_callback) from [<c04a0a00>] (rpm_resume+0x4ec/0x7ec)
    [    5.897227] [<c04a0a00>] (rpm_resume) from [<c04a0f48>] (__pm_runtime_resume+0x4c/0x64)
    [    5.897236] [<c04a0f48>] (__pm_runtime_resume) from [<c04958dc>] (driver_probe_device+0x30/0x70)
    [    5.897246] [<c04958dc>] (driver_probe_device) from [<c04959a4>] (__driver_attach+0x88/0xac)
    [    5.897256] [<c04959a4>] (__driver_attach) from [<c04940f8>] (bus_for_each_dev+0x50/0x84)
    [    5.897267] [<c04940f8>] (bus_for_each_dev) from [<c0494e40>] (bus_add_driver+0xcc/0x1e4)
    [    5.897276] [<c0494e40>] (bus_add_driver) from [<c0496914>] (driver_register+0xac/0xf4)
    [    5.897286] [<c0496914>] (driver_register) from [<c01018e0>] (do_one_initcall+0x100/0x1b8)
    [    5.897296] [<c01018e0>] (do_one_initcall) from [<c01c7a54>] (do_init_module+0x58/0x1c0)
    [    5.897304] [<c01c7a54>] (do_init_module) from [<c01c8a3c>] (SyS_finit_module+0x88/0x90)
    [    5.897313] [<c01c8a3c>] (SyS_finit_module) from [<c0107120>] (ret_fast_syscall+0x0/0x1c)
    [    5.912697] ------------[ cut here ]------------
    [    5.912711] WARNING: CPU: 0 PID: 994 at kernel/sched/core.c:2996 _raw_spin_unlock+0x28/0x58
    [    5.912717] DEBUG_LOCKS_WARN_ON(val > preempt_count())
    
    Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
    Tested-by: H. Nikolaus Schaller <hns@goldelico.com>
    Signed-off-by: Roger Quadros <rogerq@ti.com>
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6159e41053168b15cdfc076cd1a3ce669329b35e
Author: Catalin Vasile <cata.vasile@nxp.com>
Date:   Fri May 6 16:18:53 2016 +0300

    crypto: caam - fix caam_jr_alloc() ret code
    
    commit e930c765ca5c6b039cd22ebfb4504ea7b5dab43d upstream.
    
    caam_jr_alloc() used to return NULL if a JR device could not be
    allocated for a session. In turn, every user of this function used
    IS_ERR() function to verify if anything went wrong, which does NOT look
    for NULL values. This made the kernel crash if the sanity check failed,
    because the driver continued to think it had allocated a valid JR dev
    instance to the session and at some point it tries to do a caam_jr_free()
    on a NULL JR dev pointer.
    This patch is a fix for this issue.
    
    Signed-off-by: Catalin Vasile <cata.vasile@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit af136ceb462e5179d74e0e9ad535cfd14a261c6c
Author: Andy Lutomirski <luto@kernel.org>
Date:   Tue May 24 15:13:02 2016 -0700

    uvc: Forward compat ioctls to their handlers directly
    
    commit a44323e2a8f342848bb77e8e04fcd85fcb91b3b4 upstream.
    
    The current code goes through a lot of indirection just to call a
    known handler.  Simplify it: just call the handlers directly.
    
    Signed-off-by: Andy Lutomirski <luto@kernel.org>
    [bwh: Backported to 3.16: old code forwarded to uvc_v4l2_ioctl()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 833d12b2594a93bf7ed85b32bcf170766d8b7f29
Author: Majd Dibbiny <majd@mellanox.com>
Date:   Fri Jun 10 00:07:29 2016 +0300

    net/mlx5: Fix masking of reserved bits in XRCD number
    
    commit 9cd3411c42c5d5ba55d6e745edfe7df53c1ffa41 upstream.
    
    Mask the reserved bits when reading the number of newly
    created XRCD.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
    Signed-off-by: Majd Dibbiny <majd@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 74e4b89b661fc6cc10f81cf127eb4de9631ee6d0
Author: Majd Dibbiny <majd@mellanox.com>
Date:   Fri Jun 10 00:07:28 2016 +0300

    net/mlx5: Fix the size of modify QP mailbox
    
    commit 418f8399a8bedf376ec13eb01088f04a76ebdd6f upstream.
    
    Add 16 reserved bytes at the end of mlx5_modify_qp_mbox_in to
    match the hardware spec definition.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
    Signed-off-by: Majd Dibbiny <majd@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1a7af12ae0d7926a4a27225d6a0817761929cb2c
Author: Ben Dooks <ben.dooks@codethink.co.uk>
Date:   Tue Jun 7 17:22:17 2016 +0100

    gpio: bcm-kona: fix bcm_kona_gpio_reset() warnings
    
    commit b66b2a0adf0e48973b582e055758b9907a7eee7c upstream.
    
    The bcm_kona_gpio_reset() calls bcm_kona_gpio_write_lock_regs()
    with what looks like the wrong parameter. The write_lock_regs
    function takes a pointer to the registers, not the bcm_kona_gpio
    structure.
    
    Fix the warning, and probably bug by changing the function to
    pass reg_base instead of kona_gpio, fixing the following warning:
    
    drivers/gpio/gpio-bcm-kona.c:550:47: warning: incorrect type in argument 1
      (different address spaces)
      expected void [noderef] <asn:2>*reg_base
      got struct bcm_kona_gpio *kona_gpio
      warning: incorrect type in argument 1 (different address spaces)
      expected void [noderef] <asn:2>*reg_base
      got struct bcm_kona_gpio *kona_gpio
    
    Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
    Acked-by: Ray Jui <ray.jui@broadcom.com>
    Reviewed-by: Markus Mayer <mmayer@broadcom.com>
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cb3a638b68024004b4ee6b3d74d1d0057577781b
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Tue Jun 7 21:26:55 2016 -0400

    fix d_walk()/non-delayed __d_free() race
    
    commit 3d56c25e3bb0726a5c5e16fc2d9e38f8ed763085 upstream.
    
    Ascend-to-parent logics in d_walk() depends on all encountered child
    dentries not getting freed without an RCU delay.  Unfortunately, in
    quite a few cases it is not true, with hard-to-hit oopsable race as
    the result.
    
    Fortunately, the fix is simiple; right now the rule is "if it ever
    been hashed, freeing must be delayed" and changing it to "if it
    ever had a parent, freeing must be delayed" closes that hole and
    covers all cases the old rule used to cover.  Moreover, pipes and
    sockets remain _not_ covered, so we do not introduce RCU delay in
    the cases which are the reason for having that delay conditional
    in the first place.
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    [bwh: Backported to 3.16:
     - Adjust context
     - Also set the flag in __d_materialise_dentry())]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit bd68778931b0e87a216702aedbfeb5c00f430061
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Tue Jun 7 17:38:53 2016 -0700

    cpufreq: intel_pstate: Fix ->set_policy() interface for no_turbo
    
    commit 983e600e88835f0321d1a0ea06f52d48b7b5a544 upstream.
    
    When turbo is disabled, the ->set_policy() interface is broken.
    
    For example, when turbo is disabled and cpuinfo.max = 2900000 (full
    max turbo frequency), setting the limits results in frequency less
    than the requested one:
    Set 1000000 KHz results in 0700000 KHz
    Set 1500000 KHz results in 1100000 KHz
    Set 2000000 KHz results in  1500000 KHz
    
    This is because the limits->max_perf fraction is calculated using
    the max turbo frequency as the reference, but when the max P-State is
    capped in intel_pstate_get_min_max(), the reference is not the max
    turbo P-State. This results in reducing max P-State.
    
    One option is to always use max turbo as reference for calculating
    limits. But this will not be correct. By definition the intel_pstate
    sysfs limits, shows percentage of available performance. So when
    BIOS has disabled turbo, the available performance is max non turbo.
    So the max_perf_pct should still show 100%.
    
    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    [ rjw : Subject & changelog, rewrite in fewer lines of code ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [bwh: Backported to 3.16:
     - limits is a perf_limits structure, not a pointer to it
     - Adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 45d20e9f61cefb6389be8d16547ddd55b63fb55b
Author: Wolfram Sang <wsa@the-dreams.de>
Date:   Mon Jun 6 18:48:38 2016 +0200

    of: fix autoloading due to broken modalias with no 'compatible'
    
    commit b3c0a4dab7e35a9b6d69c0415641d2280fdefb2b upstream.
    
    Because of an improper dereference, a stray 'C' character was output to
    the modalias when no 'compatible' was specified. This is the case for
    some old PowerMac drivers which only set the 'name' property. Fix it to
    let them match again.
    
    Reported-by: Mathieu Malaterre <malat@debian.org>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Tested-by: Mathieu Malaterre <malat@debian.org>
    Cc: Philipp Zabel <p.zabel@pengutronix.de>
    Cc: Andreas Schwab <schwab@linux-m68k.org>
    Fixes: 6543becf26fff6 ("mod/file2alias: make modalias generation safe for cross compiling")
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 08a1ae3896142e4caf87b2a33faf1f84690e2807
Author: Yuchung Cheng <ycheng@google.com>
Date:   Mon Jun 6 15:07:18 2016 -0700

    tcp: record TLP and ER timer stats in v6 stats
    
    commit ce3cf4ec0305919fc69a972f6c2b2efd35d36abc upstream.
    
    The v6 tcp stats scan do not provide TLP and ER timer information
    correctly like the v4 version . This patch fixes that.
    
    Fixes: 6ba8a3b19e76 ("tcp: Tail loss probe (TLP)")
    Fixes: eed530b6c676 ("tcp: early retransmit")
    Signed-off-by: Yuchung Cheng <ycheng@google.com>
    Signed-off-by: Neal Cardwell <ncardwell@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ff73fbed27f34c1dfadfb8517a7cda1801a95d46
Author: H. Peter Anvin <hpa@zytor.com>
Date:   Tue Apr 5 17:01:33 2016 -0700

    x86, build: copy ldlinux.c32 to image.iso
    
    commit 9c77679cadb118c0aa99e6f88533d91765a131ba upstream.
    
    For newer versions of Syslinux, we need ldlinux.c32 in addition to
    isolinux.bin to reside on the boot disk, so if the latter is found,
    copy it, too, to the isoimage tree.
    
    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5c2a47732007c44544ce3cc8abed90a21ba74b79
Author: Erez Shitrit <erezsh@mellanox.com>
Date:   Sat Jun 4 15:15:19 2016 +0300

    IB/IPoIB: Don't update neigh validity for unresolved entries
    
    commit 61c78eea9516a921799c17b4c20558e2aa780fd3 upstream.
    
    ipoib_neigh_get unconditionally updates the "alive" variable member on
    any packet send.  This prevents the neighbor garbage collection from
    cleaning out a dead neighbor entry if we are still queueing packets
    for it.  If the queue for this neighbor is full, then don't update the
    alive timestamp.  That way the neighbor can time out even if packets
    are still being queued as long as none of them are being sent.
    
    Fixes: b63b70d87741 ("IPoIB: Use a private hash table for path lookup in xmit path")
    Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d35494c744fd0f03cab01be0fe4a753f1eb96a09
Author: Noa Osherovich <noaos@mellanox.com>
Date:   Sat Jun 4 15:15:32 2016 +0300

    IB/mlx5: Fix returned values of query QP
    
    commit 0540d8148d419bf769e5aa99c77027febd8922f0 upstream.
    
    Some variables were not initialized properly: max_recv_wr,
    max_recv_sge, max_send_wr, qp_context and max_inline_data.
    
    Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB...')
    Signed-off-by: Noa Osherovich <noaos@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 200c038b305ab31eff7ff73e85ea337729dfab73
Author: Noa Osherovich <noaos@mellanox.com>
Date:   Sat Jun 4 15:15:29 2016 +0300

    IB/mlx5: Return PORT_ERR in Active to Initializing tranisition
    
    commit 2788cf3bd90af3791c3195c52391bcf34fa67b40 upstream.
    
    FW port-change events are fired on Active <-> non Active port state
    transitions only.
    When the port state changes from Active to Initializing (Active ->
    Down -> Initializing), a single event is fired.
    The HCA transitions from Down to Initializing unless prevented from
    doing so, hence the driver should also propagate events when the port
    state is Initializing to consumers so they'll be aware that the port
    is no longer Active and act accordingly.
    
    Fixes: e126ba97dba9e ('mlx5: Add driver for Mellanox Connect-IB...')
    Signed-off-by: Noa Osherovich <noaos@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a1eb208b72348f6b9fa6bb54e7c5d6aa2dabc436
Author: Erez Shitrit <erezsh@mellanox.com>
Date:   Sat Jun 4 15:15:20 2016 +0300

    IB/IPoIB: Fix race between ipoib_remove_one to sysfs functions
    
    commit 198b12f77084244d310888dd5d643083cb5c2aa1 upstream.
    
    In ipoib_remove_one the driver holds the rtnl_lock and tries to do some
    operation like dev_change_flags or unregister_netdev, while sysfs
    callback like ipoib_vlan_delete holds sysfs mutex and tries to hold the
    rtnl_lock via rtnl_trylock() and restart_syscall() if the lock is not
    free, meanwhile ipoib_remove_one tries to get the sysfs lock in order to
    free its sysfs directory, and we will get  a->b, b->a deadlock.
    
        Trace like the following:
    
            schedule+0x37/0x80
            schedule_preempt_disabled+0xe/0x10
            __mutex_lock_slowpath+0xb5/0x120
            mutex_lock+0x23/0x40
            rtnl_lock+0x15/0x20
            netdev_run_todo+0x17c/0x320
            rtnl_unlock+0xe/0x10
            ipoib_vlan_delete+0x11b/0x1b0 [ib_ipoib]
            delete_child+0x54/0x80 [ib_ipoib]
            dev_attr_store+0x18/0x30
            sysfs_kf_write+0x37/0x40
            mutex_lock+0x16/0x40
            SyS_write+0x55/0xc0
            entry_SYSCALL_64_fastpath+0x16/0x75
        And
            schedule+0x37/0x80
            __kernfs_remove+0x1a8/0x260
            ? wake_atomic_t_function+0x60/0x60
            kernfs_remove+0x25/0x40
            sysfs_remove_dir+0x50/0x80
            kobject_del+0x18/0x50
            device_del+0x19f/0x260
            netdev_unregister_kobject+0x6a/0x80
            rollback_registered_many+0x1fd/0x340
            rollback_registered+0x3c/0x70
            unregister_netdevice_queue+0x55/0xc0
            unregister_netdev+0x20/0x30
            ipoib_remove_one+0x114/0x1b0 [ib_ipoib]
            ib_unregister_client+0x4a/0x170 [ib_core]
            ? find_module_all+0x71/0xa0
            ipoib_cleanup_module+0x10/0x94 [ib_ipoib]
            SyS_delete_module+0x1b5/0x210
            entry_SYSCALL_64_fastpath+0x16/0x75
    
    The fix is by checking the flag IPOIB_FLAG_INTF_ON_DESTROY in order to
    get out from the sysfs function.
    
    Fixes: 862096a8bbf8 ("IB/ipoib: Add more rtnl_link_ops callbacks")
    Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")
    Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 01add3c7776b24a23bd0c8a34e458a9e98b8a464
Author: Eric W. Biederman <ebiederm@xmission.com>
Date:   Fri May 27 14:50:05 2016 -0500

    mnt: fs_fully_visible test the proper mount for MNT_LOCKED
    
    commit d71ed6c930ac7d8f88f3cef6624a7e826392d61f upstream.
    
    MNT_LOCKED implies on a child mount implies the child is locked to the
    parent.  So while looping through the children the children should be
    tested (not their parent).
    
    Typically an unshare of a mount namespace locks all mounts together
    making both the parent and the slave as locked but there are a few
    corner cases where other things work.
    
    Fixes: ceeb0e5d39fc ("vfs: Ignore unlocked mounts in fs_fully_visible")
    Reported-by: Seth Forshee <seth.forshee@canonical.com>
    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3393778da387031644385f643c0c163d25b0cd33
Author: Gavin Shan <gwshan@linux.vnet.ibm.com>
Date:   Thu May 26 09:56:07 2016 +1000

    powerpc/pseries: Fix PCI config address for DDW
    
    commit 8a934efe94347eee843aeea65bdec8077a79e259 upstream.
    
    In commit 8445a87f7092 "powerpc/iommu: Remove the dependency on EEH
    struct in DDW mechanism", the PE address was replaced with the PCI
    config address in order to remove dependency on EEH. According to PAPR
    spec, firmware (pHyp or QEMU) should accept "xxBBSSxx" format PCI config
    address, not "xxxxBBSS" provided by the patch. Note that "BB" is PCI bus
    number and "SS" is the combination of slot and function number.
    
    This fixes the PCI address passed to DDW RTAS calls.
    
    Fixes: 8445a87f7092 ("powerpc/iommu: Remove the dependency on EEH struct in DDW mechanism")
    Reported-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
    Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
    Tested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e3d00f2477da0e51078d6b6e8956165b05187662
Author: Helge Deller <deller@gmx.de>
Date:   Sat Jun 4 17:21:33 2016 +0200

    parisc: Fix pagefault crash in unaligned __get_user() call
    
    commit 8b78f260887df532da529f225c49195d18fef36b upstream.
    
    One of the debian buildd servers had this crash in the syslog without
    any other information:
    
     Unaligned handler failed, ret = -2
     clock_adjtime (pid 22578): Unaligned data reference (code 28)
     CPU: 1 PID: 22578 Comm: clock_adjtime Tainted: G  E  4.5.0-2-parisc64-smp #1 Debian 4.5.4-1
     task: 000000007d9960f8 ti: 00000001bde7c000 task.ti: 00000001bde7c000
    
          YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
     PSW: 00001000000001001111100000001111 Tainted: G            E
     r00-03  000000ff0804f80f 00000001bde7c2b0 00000000402d2be8 00000001bde7c2b0
     r04-07  00000000409e1fd0 00000000fa6f7fff 00000001bde7c148 00000000fa6f7fff
     r08-11  0000000000000000 00000000ffffffff 00000000fac9bb7b 000000000002b4d4
     r12-15  000000000015241c 000000000015242c 000000000000002d 00000000fac9bb7b
     r16-19  0000000000028800 0000000000000001 0000000000000070 00000001bde7c218
     r20-23  0000000000000000 00000001bde7c210 0000000000000002 0000000000000000
     r24-27  0000000000000000 0000000000000000 00000001bde7c148 00000000409e1fd0
     r28-31  0000000000000001 00000001bde7c320 00000001bde7c350 00000001bde7c218
     sr00-03  0000000001200000 0000000001200000 0000000000000000 0000000001200000
     sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000
    
     IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000402d2e84 00000000402d2e88
      IIR: 0ca0d089    ISR: 0000000001200000  IOR: 00000000fa6f7fff
      CPU:        1   CR30: 00000001bde7c000 CR31: ffffffffffffffff
      ORIG_R28: 00000002369fe628
      IAOQ[0]: compat_get_timex+0x2dc/0x3c0
      IAOQ[1]: compat_get_timex+0x2e0/0x3c0
      RP(r2): compat_get_timex+0x40/0x3c0
     Backtrace:
      [<00000000402d4608>] compat_SyS_clock_adjtime+0x40/0xc0
      [<0000000040205024>] syscall_exit+0x0/0x14
    
    This means the userspace program clock_adjtime called the clock_adjtime()
    syscall and then crashed inside the compat_get_timex() function.
    Syscalls should never crash programs, but instead return EFAULT.
    
    The IIR register contains the executed instruction, which disassebles
    into "ldw 0(sr3,r5),r9".
    This load-word instruction is part of __get_user() which tried to read the word
    at %r5/IOR (0xfa6f7fff). This means the unaligned handler jumped in.  The
    unaligned handler is able to emulate all ldw instructions, but it fails if it
    fails to read the source e.g. because of page fault.
    
    The following program reproduces the problem:
    
    #define _GNU_SOURCE
    #include <unistd.h>
    #include <sys/syscall.h>
    #include <sys/mman.h>
    
    int main(void) {
            /* allocate 8k */
            char *ptr = mmap(NULL, 2*4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
            /* free second half (upper 4k) and make it invalid. */
            munmap(ptr+4096, 4096);
            /* syscall where first int is unaligned and clobbers into invalid memory region */
            /* syscall should return EFAULT */
            return syscall(__NR_clock_adjtime, 0, ptr+4095);
    }
    
    To fix this issue we simply need to check if the faulting instruction address
    is in the exception fixup table when the unaligned handler failed. If it
    is, call the fixup routine instead of crashing.
    
    While looking at the unaligned handler I found another issue as well: The
    target register should not be modified if the handler was unsuccessful.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7be35571c522df6f1a405ef0291e6e9bcb7fbed8
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date:   Sat May 28 23:02:50 2016 +0300

    of: irq: fix of_irq_get[_byname]() kernel-doc
    
    commit 3993546646baf1dab5f5c4f7d9bb58f2046fd1c1 upstream.
    
    The kernel-doc for the of_irq_get[_byname]()  is clearly inadequate in
    describing the return values -- of_irq_get_byname() is documented better
    than of_irq_get() but it  still doesn't mention that 0 is returned iff
    irq_create_of_mapping() fails (it doesn't return an error code in this
    case). Document all possible return value variants, making the writing
    of the word "IRQ" consistent, while at it...
    
    Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
    Fixes: ad69674e73a1 ("of/irq: do irq resolution in platform_get_irq_byname()")
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9f762712d11c3ceab0d41dc4c1601c1326f9d105
Author: AceLan Kao <acelan.kao@canonical.com>
Date:   Fri Jun 3 14:45:25 2016 +0800

    ALSA: hda - Fix headset mic detection problem for Dell machine
    
    commit f90d83b301701026b2e4c437a3613f377f63290e upstream.
    
    Add the pin configuration value of this machine into the pin_quirk
    table to make DELL1_MIC_NO_PRESENCE apply to this machine.
    
    Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1aff04fa964247a54255da0871404f51b041e70f
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Wed Jun 1 14:09:23 2016 +0200

    KVM: x86: fix OOPS after invalid KVM_SET_DEBUGREGS
    
    commit d14bdb553f9196169f003058ae1cdabe514470e6 upstream.
    
    MOV to DR6 or DR7 causes a #GP if an attempt is made to write a 1 to
    any of bits 63:32.  However, this is not detected at KVM_SET_DEBUGREGS
    time, and the next KVM_RUN oopses:
    
       general protection fault: 0000 [#1] SMP
       CPU: 2 PID: 14987 Comm: a.out Not tainted 4.4.9-300.fc23.x86_64 #1
       Hardware name: LENOVO 2325F51/2325F51, BIOS G2ET32WW (1.12 ) 05/30/2012
       [...]
       Call Trace:
        [<ffffffffa072c93d>] kvm_arch_vcpu_ioctl_run+0x141d/0x14e0 [kvm]
        [<ffffffffa071405d>] kvm_vcpu_ioctl+0x33d/0x620 [kvm]
        [<ffffffff81241648>] do_vfs_ioctl+0x298/0x480
        [<ffffffff812418a9>] SyS_ioctl+0x79/0x90
        [<ffffffff817a0f2e>] entry_SYSCALL_64_fastpath+0x12/0x71
       Code: 55 83 ff 07 48 89 e5 77 27 89 ff ff 24 fd 90 87 80 81 0f 23 fe 5d c3 0f 23 c6 5d c3 0f 23 ce 5d c3 0f 23 d6 5d c3 0f 23 de 5d c3 <0f> 23 f6 5d c3 0f 0b 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00
       RIP  [<ffffffff810639eb>] native_set_debugreg+0x2b/0x40
        RSP <ffff88005836bd50>
    
    Testcase (beautified/reduced from syzkaller output):
    
        #include <unistd.h>
        #include <sys/syscall.h>
        #include <string.h>
        #include <stdint.h>
        #include <linux/kvm.h>
        #include <fcntl.h>
        #include <sys/ioctl.h>
    
        long r[8];
    
        int main()
        {
            struct kvm_debugregs dr = { 0 };
    
            r[2] = open("/dev/kvm", O_RDONLY);
            r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
            r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
    
            memcpy(&dr,
                   "\x5d\x6a\x6b\xe8\x57\x3b\x4b\x7e\xcf\x0d\xa1\x72"
                   "\xa3\x4a\x29\x0c\xfc\x6d\x44\x00\xa7\x52\xc7\xd8"
                   "\x00\xdb\x89\x9d\x78\xb5\x54\x6b\x6b\x13\x1c\xe9"
                   "\x5e\xd3\x0e\x40\x6f\xb4\x66\xf7\x5b\xe3\x36\xcb",
                   48);
            r[7] = ioctl(r[4], KVM_SET_DEBUGREGS, &dr);
            r[6] = ioctl(r[4], KVM_RUN, 0);
        }
    
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 45ebfe5310371818aa1e65f31ea487e9217889fd
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Wed Jun 1 14:09:21 2016 +0200

    KVM: irqfd: fix NULL pointer dereference in kvm_irq_map_gsi
    
    commit c622a3c21ede892e370b56e1ceb9eb28f8bbda6b upstream.
    
    Found by syzkaller:
    
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000120
        IP: [<ffffffffa0797202>] kvm_irq_map_gsi+0x12/0x90 [kvm]
        PGD 6f80b067 PUD b6535067 PMD 0
        Oops: 0000 [#1] SMP
        CPU: 3 PID: 4988 Comm: a.out Not tainted 4.4.9-300.fc23.x86_64 #1
        [...]
        Call Trace:
         [<ffffffffa0795f62>] irqfd_update+0x32/0xc0 [kvm]
         [<ffffffffa0796c7c>] kvm_irqfd+0x3dc/0x5b0 [kvm]
         [<ffffffffa07943f4>] kvm_vm_ioctl+0x164/0x6f0 [kvm]
         [<ffffffff81241648>] do_vfs_ioctl+0x298/0x480
         [<ffffffff812418a9>] SyS_ioctl+0x79/0x90
         [<ffffffff817a1062>] tracesys_phase2+0x84/0x89
        Code: b5 71 a7 e0 5b 41 5c 41 5d 5d f3 c3 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 8b 8f 10 2e 00 00 31 c0 48 89 e5 <39> 91 20 01 00 00 76 6a 48 63 d2 48 8b 94 d1 28 01 00 00 48 85
        RIP  [<ffffffffa0797202>] kvm_irq_map_gsi+0x12/0x90 [kvm]
         RSP <ffff8800926cbca8>
        CR2: 0000000000000120
    
    Testcase:
    
        #include <unistd.h>
        #include <sys/syscall.h>
        #include <string.h>
        #include <stdint.h>
        #include <linux/kvm.h>
        #include <fcntl.h>
        #include <sys/ioctl.h>
    
        long r[26];
    
        int main()
        {
            memset(r, -1, sizeof(r));
            r[2] = open("/dev/kvm", 0);
            r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
    
            struct kvm_irqfd ifd;
            ifd.fd = syscall(SYS_eventfd2, 5, 0);
            ifd.gsi = 3;
            ifd.flags = 2;
            ifd.resamplefd = ifd.fd;
            r[25] = ioctl(r[3], KVM_IRQFD, &ifd);
            return 0;
        }
    
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit eb4518af956cd7ab0cea569474d2546b9a9a9643
Author: Russell King <rmk+kernel@armlinux.org.uk>
Date:   Mon May 30 23:14:56 2016 +0100

    ARM: fix PTRACE_SETVFPREGS on SMP systems
    
    commit e2dfb4b880146bfd4b6aa8e138c0205407cebbaf upstream.
    
    PTRACE_SETVFPREGS fails to properly mark the VFP register set to be
    reloaded, because it undoes one of the effects of vfp_flush_hwstate().
    
    Specifically vfp_flush_hwstate() sets thread->vfpstate.hard.cpu to
    an invalid CPU number, but vfp_set() overwrites this with the original
    CPU number, thereby rendering the hardware state as apparently "valid",
    even though the software state is more recent.
    
    Fix this by reverting the previous change.
    
    Fixes: 8130b9d7b9d8 ("ARM: 7308/1: vfp: flush thread hwstate before copying ptrace registers")
    Acked-by: Will Deacon <will.deacon@arm.com>
    Tested-by: Simon Marchi <simon.marchi@ericsson.com>
    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5723f5db02576bc1831e2d895f320087e5edaddc
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Thu Jun 2 12:23:31 2016 +1000

    drm/nouveau/fbcon: fix out-of-bounds memory accesses
    
    commit f045f459d925138fe7d6193a8c86406bda7e49da upstream.
    
    Reported by KASAN.
    
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a981d533e1b5348b7575a06229599d2be664590e
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Jun 2 01:57:50 2016 +0200

    ACPI / processor: Avoid reserving IO regions too early
    
    commit 86314751c7945fa0c67f459beeda2e7c610ca429 upstream.
    
    Roland Dreier reports that one of his systems cannot boot because of
    the changes made by commit ac212b6980d8 (ACPI / processor: Use common
    hotplug infrastructure).
    
    The problematic part of it is the request_region() call in
    acpi_processor_get_info() that used to run at module init time before
    the above commit and now it runs much earlier.  Unfortunately, the
    region(s) reserved by it fall into a range the PCI subsystem attempts
    to reserve for AHCI IO BARs.  As a result, the PCI reservation fails
    and AHCI doesn't work, while previously the PCI reservation would
    be made before acpi_processor_get_info() and it would succeed.
    
    That request_region() call, however, was overlooked by commit
    ac212b6980d8, as it is not necessary for the enumeration of the
    processors.  It only is needed when the ACPI processor driver
    actually attempts to handle them which doesn't happen before
    loading the ACPI processor driver module.  Therefore that call
    should have been moved from acpi_processor_get_info() into that
    module.
    
    Address the problem by moving the request_region() call in question
    out of acpi_processor_get_info() and use the observation that the
    region reserved by it is only needed if the FADT-based CPU
    throttling method is going to be used, which means that it should
    be sufficient to invoke it from acpi_processor_get_throttling_fadt().
    
    Fixes: ac212b6980d8 (ACPI / processor: Use common hotplug infrastructure)
    Reported-by: Roland Dreier <roland@purestorage.com>
    Tested-by: Roland Dreier <roland@purestorage.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6417833cee28a1b55804608e12d32da03b9e394b
Author: Ewan D. Milne <emilne@redhat.com>
Date:   Tue May 31 09:42:29 2016 -0400

    scsi: Add QEMU CD-ROM to VPD Inquiry Blacklist
    
    commit fbd83006e3e536fcb103228d2422ea63129ccb03 upstream.
    
    Linux fails to boot as a guest with a QEMU CD-ROM:
    
    [    4.439488] ata2.00: ATAPI: QEMU CD-ROM, 0.8.2, max UDMA/100
    [    4.443649] ata2.00: configured for MWDMA2
    [    4.450267] scsi 1:0:0:0: CD-ROM            QEMU     QEMU CD-ROM      0.8. PQ: 0 ANSI: 5
    [    4.464317] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
    [    4.464319] ata2.00: BMDMA stat 0x5
    [    4.464339] ata2.00: cmd a0/01:00:00:00:01/00:00:00:00:00/a0 tag 0 dma 16640 in
    [    4.464339]          Inquiry 12 01 00 00 ff 00res 48/20:02:00:24:00/00:00:00:00:00/a0 Emask 0x2 (HSM violation)
    [    4.464341] ata2.00: status: { DRDY DRQ }
    [    4.465864] ata2: soft resetting link
    [    4.625971] ata2.00: configured for MWDMA2
    [    4.628290] ata2: EH complete
    [    4.646670] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
    [    4.646671] ata2.00: BMDMA stat 0x5
    [    4.646683] ata2.00: cmd a0/01:00:00:00:01/00:00:00:00:00/a0 tag 0 dma 16640 in
    [    4.646683]          Inquiry 12 01 00 00 ff 00res 48/20:02:00:24:00/00:00:00:00:00/a0 Emask 0x2 (HSM violation)
    [    4.646685] ata2.00: status: { DRDY DRQ }
    [    4.648193] ata2: soft resetting link
    
    ...
    
    Fix this by suppressing VPD inquiry for this device.
    
    Signed-off-by: Ewan D. Milne <emilne@redhat.com>
    Reported-by: Jan Stancek <jstancek@redhat.com>
    Tested-by: Jan Stancek <jstancek@redhat.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6a80e575825df68f82520f99f047e08d3c1efa53
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Tue May 31 15:55:03 2016 +0100

    arm64: Provide "model name" in /proc/cpuinfo for PER_LINUX32 tasks
    
    commit e47b020a323d1b2a7b1e9aac86e99eae19463630 upstream.
    
    This patch brings the PER_LINUX32 /proc/cpuinfo format more in line with
    the 32-bit ARM one by providing an additional line:
    
    model name      : ARMv8 Processor rev X (v8l)
    
    Acked-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    [bwh: Backported to 3.16:
     - Adjust filename, context
     - Open-code MIDR_REVISION()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6f99b1f1f81f9a7f86da24b28d1767111379a9c9
Author: Bob Copeland <me@bobcopeland.com>
Date:   Sun May 15 13:19:16 2016 -0400

    mac80211: mesh: flush mesh paths unconditionally
    
    commit fe7a7c57629e8dcbc0e297363a9b2366d67a6dc5 upstream.
    
    Currently, the mesh paths associated with a nexthop station are cleaned
    up in the following code path:
    
        __sta_info_destroy_part1
        synchronize_net()
        __sta_info_destroy_part2
         -> cleanup_single_sta
           -> mesh_sta_cleanup
             -> mesh_plink_deactivate
               -> mesh_path_flush_by_nexthop
    
    However, there are a couple of problems here:
    
    1) the paths aren't flushed at all if the MPM is running in userspace
       (e.g. when using wpa_supplicant or authsae)
    
    2) there is no synchronize_rcu between removing the path and readers
       accessing the nexthop, which means the following race is possible:
    
    CPU0                            CPU1
    ~~~~                            ~~~~
                                    sta_info_destroy_part1()
                                    synchronize_net()
    rcu_read_lock()
    mesh_nexthop_resolve()
      mpath = mesh_path_lookup()
                                    [...] -> mesh_path_flush_by_nexthop()
      sta = rcu_dereference(
        mpath->next_hop)
                                    kfree(sta)
      access sta <-- CRASH
    
    Fix both of these by unconditionally flushing paths before destroying
    the sta, and by adding a synchronize_net() after path flush to ensure
    no active readers can still dereference the sta.
    
    Fixes this crash:
    
    [  348.529295] BUG: unable to handle kernel paging request at 00020040
    [  348.530014] IP: [<f929245d>] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211]
    [  348.530014] *pde = 00000000
    [  348.530014] Oops: 0000 [#1] PREEMPT
    [  348.530014] Modules linked in: drbg ansi_cprng ctr ccm ppp_generic slhc ipt_MASQUERADE nf_nat_masquerade_ipv4 8021q ]
    [  348.530014] CPU: 0 PID: 20597 Comm: wget Tainted: G           O 4.6.0-rc5-wt=V1 #1
    [  348.530014] Hardware name: To Be Filled By O.E.M./To be filled by O.E.M., BIOS 080016  11/07/2014
    [  348.530014] task: f64fa280 ti: f4f9c000 task.ti: f4f9c000
    [  348.530014] EIP: 0060:[<f929245d>] EFLAGS: 00010246 CPU: 0
    [  348.530014] EIP is at ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211]
    [  348.530014] EAX: f4ce63e0 EBX: 00000088 ECX: f3788416 EDX: 00020008
    [  348.530014] ESI: 00000000 EDI: 00000088 EBP: f6409a4c ESP: f6409a40
    [  348.530014]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
    [  348.530014] CR0: 80050033 CR2: 00020040 CR3: 33190000 CR4: 00000690
    [  348.530014] Stack:
    [  348.530014]  00000000 f4ce63e0 f5f9bd80 f6409a64 f9291d80 0000ce67 f5d51e00 f4ce63e0
    [  348.530014]  f3788416 f6409a80 f9291dc1 f4ce8320 f4ce63e0 f5d51e00 f4ce63e0 f4ce8320
    [  348.530014]  f6409a98 f9277f6f 00000000 00000000 0000007c 00000000 f6409b2c f9278dd1
    [  348.530014] Call Trace:
    [  348.530014]  [<f9291d80>] mesh_nexthop_lookup+0xbb/0xc8 [mac80211]
    [  348.530014]  [<f9291dc1>] mesh_nexthop_resolve+0x34/0xd8 [mac80211]
    [  348.530014]  [<f9277f6f>] ieee80211_xmit+0x92/0xc1 [mac80211]
    [  348.530014]  [<f9278dd1>] __ieee80211_subif_start_xmit+0x807/0x83c [mac80211]
    [  348.530014]  [<c04df012>] ? sch_direct_xmit+0xd7/0x1b3
    [  348.530014]  [<c022a8c6>] ? __local_bh_enable_ip+0x5d/0x7b
    [  348.530014]  [<f956870c>] ? nf_nat_ipv4_out+0x4c/0xd0 [nf_nat_ipv4]
    [  348.530014]  [<f957e036>] ? iptable_nat_ipv4_fn+0xf/0xf [iptable_nat]
    [  348.530014]  [<c04c6f45>] ? netif_skb_features+0x14d/0x30a
    [  348.530014]  [<f9278e10>] ieee80211_subif_start_xmit+0xa/0xe [mac80211]
    [  348.530014]  [<c04c769c>] dev_hard_start_xmit+0x1f8/0x267
    [  348.530014]  [<c04c7261>] ?  validate_xmit_skb.isra.120.part.121+0x10/0x253
    [  348.530014]  [<c04defc6>] sch_direct_xmit+0x8b/0x1b3
    [  348.530014]  [<c04c7a9c>] __dev_queue_xmit+0x2c8/0x513
    [  348.530014]  [<c04c7cfb>] dev_queue_xmit+0xa/0xc
    [  348.530014]  [<f91bfc7a>] batadv_send_skb_packet+0xd6/0xec [batman_adv]
    [  348.530014]  [<f91bfdc4>] batadv_send_unicast_skb+0x15/0x4a [batman_adv]
    [  348.530014]  [<f91b5938>] batadv_dat_send_data+0x27e/0x310 [batman_adv]
    [  348.530014]  [<f91c30b5>] ? batadv_tt_global_hash_find.isra.11+0x8/0xa [batman_adv]
    [  348.530014]  [<f91b63f3>] batadv_dat_snoop_outgoing_arp_request+0x208/0x23d [batman_adv]
    [  348.530014]  [<f91c0cd9>] batadv_interface_tx+0x206/0x385 [batman_adv]
    [  348.530014]  [<c04c769c>] dev_hard_start_xmit+0x1f8/0x267
    [  348.530014]  [<c04c7261>] ?  validate_xmit_skb.isra.120.part.121+0x10/0x253
    [  348.530014]  [<c04defc6>] sch_direct_xmit+0x8b/0x1b3
    [  348.530014]  [<c04c7a9c>] __dev_queue_xmit+0x2c8/0x513
    [  348.530014]  [<f80cbd2a>] ? igb_xmit_frame+0x57/0x72 [igb]
    [  348.530014]  [<c04c7cfb>] dev_queue_xmit+0xa/0xc
    [  348.530014]  [<f843a326>] br_dev_queue_push_xmit+0xeb/0xfb [bridge]
    [  348.530014]  [<f843a35f>] br_forward_finish+0x29/0x74 [bridge]
    [  348.530014]  [<f843a23b>] ? deliver_clone+0x3b/0x3b [bridge]
    [  348.530014]  [<f843a714>] __br_forward+0x89/0xe7 [bridge]
    [  348.530014]  [<f843a336>] ? br_dev_queue_push_xmit+0xfb/0xfb [bridge]
    [  348.530014]  [<f843a234>] deliver_clone+0x34/0x3b [bridge]
    [  348.530014]  [<f843a68b>] ? br_flood+0x95/0x95 [bridge]
    [  348.530014]  [<f843a66d>] br_flood+0x77/0x95 [bridge]
    [  348.530014]  [<f843a809>] br_flood_forward+0x13/0x1a [bridge]
    [  348.530014]  [<f843a68b>] ? br_flood+0x95/0x95 [bridge]
    [  348.530014]  [<f843b877>] br_handle_frame_finish+0x392/0x3db [bridge]
    [  348.530014]  [<c04e9b2b>] ? nf_iterate+0x2b/0x6b
    [  348.530014]  [<f843baa6>] br_handle_frame+0x1e6/0x240 [bridge]
    [  348.530014]  [<f843b4e5>] ? br_handle_local_finish+0x6a/0x6a [bridge]
    [  348.530014]  [<c04c4ba0>] __netif_receive_skb_core+0x43a/0x66b
    [  348.530014]  [<f843b8c0>] ? br_handle_frame_finish+0x3db/0x3db [bridge]
    [  348.530014]  [<c023cea4>] ? resched_curr+0x19/0x37
    [  348.530014]  [<c0240707>] ? check_preempt_wakeup+0xbf/0xfe
    [  348.530014]  [<c0255dec>] ? ktime_get_with_offset+0x5c/0xfc
    [  348.530014]  [<c04c4fc1>] __netif_receive_skb+0x47/0x55
    [  348.530014]  [<c04c57ba>] netif_receive_skb_internal+0x40/0x5a
    [  348.530014]  [<c04c61ef>] napi_gro_receive+0x3a/0x94
    [  348.530014]  [<f80ce8d5>] igb_poll+0x6fd/0x9ad [igb]
    [  348.530014]  [<c0242bd8>] ? swake_up_locked+0x14/0x26
    [  348.530014]  [<c04c5d29>] net_rx_action+0xde/0x250
    [  348.530014]  [<c022a743>] __do_softirq+0x8a/0x163
    [  348.530014]  [<c022a6b9>] ? __hrtimer_tasklet_trampoline+0x19/0x19
    [  348.530014]  [<c021100f>] do_softirq_own_stack+0x26/0x2c
    [  348.530014]  <IRQ>
    [  348.530014]  [<c022a957>] irq_exit+0x31/0x6f
    [  348.530014]  [<c0210eb2>] do_IRQ+0x8d/0xa0
    [  348.530014]  [<c058152c>] common_interrupt+0x2c/0x40
    [  348.530014] Code: e7 8c 00 66 81 ff 88 00 75 12 85 d2 75 0e b2 c3 b8 83 e9 29 f9 e8 a7 5f f9 c6 eb 74 66 81 e3 8c 005
    [  348.530014] EIP: [<f929245d>] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211] SS:ESP 0068:f6409a40
    [  348.530014] CR2: 0000000000020040
    [  348.530014] ---[ end trace 48556ac26779732e ]---
    [  348.530014] Kernel panic - not syncing: Fatal exception in interrupt
    [  348.530014] Kernel Offset: disabled
    
    Reported-by: Fred Veldini <fred.veldini@gmail.com>
    Tested-by: Fred Veldini <fred.veldini@gmail.com>
    Signed-off-by: Bob Copeland <me@bobcopeland.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 582acc757fb6910e590c26c30f6a6b6584e3106d
Author: Martin Willi <martin@strongswan.org>
Date:   Fri May 13 12:41:48 2016 +0200

    mac80211_hwsim: Add missing check for HWSIM_ATTR_SIGNAL
    
    commit 62397da50bb20a6b812c949ef465d7e69fe54bb6 upstream.
    
    A wmediumd that does not send this attribute causes a NULL pointer
    dereference, as the attribute is accessed even if it does not exist.
    
    The attribute was required but never checked ever since userspace frame
    forwarding has been introduced. The issue gets more problematic once we
    allow wmediumd registration from user namespaces.
    
    Fixes: 7882513bacb1 ("mac80211_hwsim driver support userspace frame tx/rx")
    Signed-off-by: Martin Willi <martin@strongswan.org>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b8cf81f350e38b0df00779be85a1352731a69103
Author: Thomas Huth <thuth@redhat.com>
Date:   Thu May 12 13:29:11 2016 +0200

    powerpc: Use privileged SPR number for MMCR2
    
    commit 8dd75ccb571f3c92c48014b3dabd3d51a115ab41 upstream.
    
    We are already using the privileged versions of MMCR0, MMCR1
    and MMCRA in the kernel, so for MMCR2, we should better use
    the privileged versions, too, to be consistent.
    
    Fixes: 240686c13687 ("powerpc: Initialise PMU related regs on Power8")
    Suggested-by: Paul Mackerras <paulus@ozlabs.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Acked-by: Paul Mackerras <paulus@ozlabs.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e4e785b2cae9edb71f5bd944f4ade8b4d9b03eb3
Author: Thomas Huth <thuth@redhat.com>
Date:   Thu May 12 13:26:44 2016 +0200

    powerpc: Fix definition of SIAR and SDAR registers
    
    commit d23fac2b27d94aeb7b65536a50d32bfdc21fe01e upstream.
    
    The SIAR and SDAR registers are available twice, one time as SPRs
    780 / 781 (unprivileged, but read-only), and one time as the SPRs
    796 / 797 (privileged, but read and write). The Linux kernel code
    currently uses the unprivileged  SPRs - while this is OK for reading,
    writing to that register of course does not work.
    Since the KVM code tries to write to this register, too (see the mtspr
    in book3s_hv_rmhandlers.S), the contents of this register sometimes get
    lost for the guests, e.g. during migration of a VM.
    To fix this issue, simply switch to the privileged SPR numbers instead.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Acked-by: Paul Mackerras <paulus@ozlabs.org>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 062e414cf46ddbf73a80898a5fb3fa78bca9e2f9
Author: Russell Currey <ruscur@russell.cc>
Date:   Thu Apr 7 16:28:26 2016 +1000

    powerpc/pseries/eeh: Handle RTAS delay requests in configure_bridge
    
    commit 871e178e0f2c4fa788f694721a10b4758d494ce1 upstream.
    
    In the "ibm,configure-pe" and "ibm,configure-bridge" RTAS calls, the
    spec states that values of 9900-9905 can be returned, indicating that
    software should delay for 10^x (where x is the last digit, i.e. 990x)
    milliseconds and attempt the call again. Currently, the kernel doesn't
    know about this, and respecting it fixes some PCI failures when the
    hypervisor is busy.
    
    The delay is capped at 0.2 seconds.
    
    Signed-off-by: Russell Currey <ruscur@russell.cc>
    Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 18fc60a67ac8e0fd2e68a34e5704e7208dd09f37
Author: Mikulas Patocka <mikulas@twibright.com>
Date:   Tue May 24 22:49:18 2016 +0200

    hpfs: implement the show_options method
    
    commit 037369b872940cd923835a0a589763180c4a36bc upstream.
    
    The HPFS filesystem used generic_show_options to produce string that is
    displayed in /proc/mounts.  However, there is a problem that the options
    may disappear after remount.  If we mount the filesystem with option1
    and then remount it with option2, /proc/mounts should show both option1
    and option2, however it only shows option2 because the whole option
    string is replaced with replace_mount_options in hpfs_remount_fs.
    
    To fix this bug, implement the hpfs_show_options function that prints
    options that are currently selected.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 54cc04f93133d2abe60aa7841d50344ea6210999
Author: Mikulas Patocka <mikulas@twibright.com>
Date:   Tue May 24 22:47:00 2016 +0200

    hpfs: fix remount failure when there are no options changed
    
    commit 44d51706b4685f965cd32acde3fe0fcc1e6198e8 upstream.
    
    Commit ce657611baf9 ("hpfs: kstrdup() out of memory handling") checks if
    the kstrdup function returns NULL due to out-of-memory condition.
    
    However, if we are remounting a filesystem with no change to
    filesystem-specific options, the parameter data is NULL.  In this case,
    kstrdup returns NULL (because it was passed NULL parameter), although no
    out of memory condition exists.  The mount syscall then fails with
    ENOMEM.
    
    This patch fixes the bug.  We fail with ENOMEM only if data is non-NULL.
    
    The patch also changes the call to replace_mount_options - if we didn't
    pass any filesystem-specific options, we don't call
    replace_mount_options (thus we don't erase existing reported options).
    
    Fixes: ce657611baf9 ("hpfs: kstrdup() out of memory handling")
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e626e730dd4b2caf5013c8520802f755c8afab80
Author: Paul Burton <paul.burton@imgtec.com>
Date:   Fri Jul 11 16:44:33 2014 +0100

    MIPS: fix read_msa_* & write_msa_* functions on non-MSA toolchains
    
    commit 70dff4d90aab40326d1d06a331e2b07eae99d067 upstream.
    
    Commit d96cc3d1ec5d "MIPS: Add microMIPS MSA support." attempted to use
    the value of a macro within an inline asm statement but instead emitted
    a comment leading to the cfcmsa & ctcmsa instructions being omitted. Fix
    that by passing CFC_MSA_INSN & CTC_MSA_INSN as arguments to the asm
    statements.
    
    Signed-off-by: Paul Burton <paul.burton@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/7305/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f94f50dcc052e6896246ab4c37459a25748a3dd5
Author: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Date:   Fri May 27 16:36:36 2016 -0700

    Input: pwm-beeper - fix - scheduling while atomic
    
    commit f49cf3b8b4c841457244c461c66186a719e13bcc upstream.
    
    Pwm config may sleep so defer it using a worker.
    
    On a Freescale i.MX53 based board we ran into "BUG: scheduling while
    atomic" because input_inject_event locks interrupts, but
    imx_pwm_config_v2 sleeps.
    
    Tested on Freescale i.MX53 SoC with 4.6.0.
    
    Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9f1a4630a70635720abf55ed8cde09094eaa5d62
Author: Olivier Sobrie <olivier@sobrie.be>
Date:   Thu Mar 12 14:47:13 2015 -0700

    Input: pwm-beeper - remove useless call to pwm_config()
    
    commit d1b12075ffa808dce33dd46b7ad035bebf8da215 upstream.
    
    Calling pwm_config() with a period equal to zero always results in
    error (-EINVAL) and pwm chip config method is never called.
    
    Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 90342f48ba9cc9cfa37962d44ce9834678c3e8d6
Author: Cameron Gutman <aicommander@gmail.com>
Date:   Fri May 27 16:23:50 2016 -0700

    Input: xpad - prevent spurious input from wired Xbox 360 controllers
    
    commit 1ff5fa3c6732f08e01ae12f12286d4728c9e4d86 upstream.
    
    After initially connecting a wired Xbox 360 controller or sending it
    a command to change LEDs, a status/response packet is interpreted as
    controller input. This causes the state of buttons represented in
    byte 2 of the controller data packet to be incorrect until the next
    valid input packet. Wireless Xbox 360 controllers are not affected.
    
    Writing a new value to the LED device while holding the Start button
    and running jstest is sufficient to reproduce this bug. An event will
    come through with the Start button released.
    
    Xboxdrv also won't attempt to read controller input from a packet
    where byte 0 is non-zero. It also checks that byte 1 is 0x14, but
    that value differs between wired and wireless controllers and this
    code is shared by both. I think just checking byte 0 is enough to
    eliminate unwanted packets.
    
    The following are some examples of 3-byte status packets I saw:
    01 03 02
    02 03 00
    03 03 03
    08 03 00
    
    Signed-off-by: Cameron Gutman <aicommander@gmail.com>
    Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a86f55da2b8dc301d14a64b18f43c93ef97066f0
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Thu May 26 15:16:25 2016 -0700

    dma-debug: avoid spinlock recursion when disabling dma-debug
    
    commit 3017cd63f26fc655d56875aaf497153ba60e9edf upstream.
    
    With netconsole (at least) the pr_err("...  disablingn") call can
    recurse back into the dma-debug code, where it'll try to grab
    free_entries_lock again.  Avoid the problem by doing the printk after
    dropping the lock.
    
    Link: http://lkml.kernel.org/r/1463678421-18683-1-git-send-email-ville.syrjala@linux.intel.com
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 78d246457999e955c7d27f991401a17e975d63d6
Author: Edward Cree <ecree@solarflare.com>
Date:   Tue May 24 18:53:36 2016 +0100

    sfc: on MC reset, clear PIO buffer linkage in TXQs
    
    commit c0795bf64cba4d1b796fdc5b74b33772841ed1bb upstream.
    
    Otherwise, if we fail to allocate new PIO buffers, our TXQs will try to
    use the old ones, which aren't there any more.
    
    Fixes: 183233bec810 "sfc: Allocate and link PIO buffers; map them with write-combining"
    Signed-off-by: Edward Cree <ecree@solarflare.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 01a997dacfae778f89f67c5faff3d7cc357ec208
Author: Tom Lendacky <thomas.lendacky@amd.com>
Date:   Fri May 20 17:33:03 2016 -0500

    crypto: ccp - Fix AES XTS error for request sizes above 4096
    
    commit ab6a11a7c8ef47f996974dd3c648c2c0b1a36ab1 upstream.
    
    The ccp-crypto module for AES XTS support has a bug that can allow requests
    greater than 4096 bytes in size to be passed to the CCP hardware. The CCP
    hardware does not support request sizes larger than 4096, resulting in
    incorrect output. The request should actually be handled by the fallback
    mechanism instantiated by the ccp-crypto module.
    
    Add a check to insure the request size is less than or equal to the maximum
    supported size and use the fallback mechanism if it is not.
    
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8830df6bc907750251087021c9c1a50d49f3a4a7
Author: Hui Wang <hui.wang@canonical.com>
Date:   Wed May 25 12:12:32 2016 +0800

    ALSA: hda - Fix headset mic detection problem for one Dell machine
    
    commit 86c72d1ce91d804e4fa8d90b316a89597dd220f1 upstream.
    
    Add the pin configuration value of this machine into the pin_quirk
    table to make DELL1_MIC_NO_PRESENCE apply to this machine.
    
    Signed-off-by: Hui Wang <hui.wang@canonical.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8814245219b343ec73a4681cb018f0d166c71f54
Author: Honggang Li <honli@redhat.com>
Date:   Mon May 23 08:32:09 2016 +0800

    RDMA/cxgb3: device driver frees DMA memory with different size
    
    commit 0de4cbb3dddca35ecd06b95918f38439c9c6401f upstream.
    
    [  598.852037] ------------[ cut here ]------------
    [  598.856698] WARNING: at lib/dma-debug.c:887 check_unmap+0xf8/0x920()
    [  598.863079] cxgb3 0000:01:00.0: DMA-API: device driver frees DMA memory with different size [device address=0x0000000003310000] [map size=17 bytes] [unmap size=16 bytes]
    [  598.878265] Modules linked in: xprtrdma ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp scsi_tgt ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_sa ib_mad kvm_amd kvm ipmi_devintf ipmi_ssif dcdbas pcspkr ipmi_si sg ipmi_msghandler acpi_power_meter amd64_edac_mod shpchp edac_core sp5100_tco k10temp edac_mce_amd i2c_piix4 acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic crct10dif_common ata_generic iw_cxgb3 pata_acpi ib_core ib_addr mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm pata_atiixp drm ahci libahci serio_raw i2c_core cxgb3 libata bnx2 mdio dm_mirror dm_region_hash dm_log dm_mod
    [  598.946822] CPU: 3 PID: 11820 Comm: cmtime Not tainted 3.10.0-327.el7.x86_64.debug #1
    [  598.954681] Hardware name: Dell Inc. PowerEdge R415/0GXH08, BIOS 2.0.2 10/22/2012
    [  598.962193]  ffff8808077479a8 000000000381a432 ffff880807747960 ffffffff81700918
    [  598.969663]  ffff880807747998 ffffffff8108b6c0 ffff880807747a80 ffff8808063f55c0
    [  598.977132]  ffffffff833ca850 0000000000000282 ffff88080b1bb800 ffff880807747a00
    [  598.984602] Call Trace:
    [  598.987062]  [<ffffffff81700918>] dump_stack+0x19/0x1b
    [  598.992224]  [<ffffffff8108b6c0>] warn_slowpath_common+0x70/0xb0
    [  598.998254]  [<ffffffff8108b75c>] warn_slowpath_fmt+0x5c/0x80
    [  599.004033]  [<ffffffff813903b8>] check_unmap+0xf8/0x920
    [  599.009369]  [<ffffffff81025959>] ? sched_clock+0x9/0x10
    [  599.014702]  [<ffffffff81390cee>] debug_dma_free_coherent+0x7e/0xa0
    [  599.021008]  [<ffffffffa01ece2c>] cxio_destroy_cq+0xcc/0x160 [iw_cxgb3]
    [  599.027654]  [<ffffffffa01e8da0>] iwch_destroy_cq+0xf0/0x140 [iw_cxgb3]
    [  599.034307]  [<ffffffffa01c4bfe>] ib_destroy_cq+0x1e/0x30 [ib_core]
    [  599.040601]  [<ffffffffa04ff2d2>] ib_uverbs_close+0x302/0x4d0 [ib_uverbs]
    [  599.047417]  [<ffffffff812335a2>] __fput+0x102/0x310
    [  599.052401]  [<ffffffff8123388e>] ____fput+0xe/0x10
    [  599.057297]  [<ffffffff810bbde4>] task_work_run+0xb4/0xe0
    [  599.062719]  [<ffffffff81092a84>] do_exit+0x304/0xc60
    [  599.067789]  [<ffffffff81025905>] ? native_sched_clock+0x35/0x80
    [  599.073820]  [<ffffffff81025959>] ? sched_clock+0x9/0x10
    [  599.079153]  [<ffffffff8170a49c>] ? _raw_spin_unlock_irq+0x2c/0x50
    [  599.085358]  [<ffffffff8109346c>] do_group_exit+0x4c/0xc0
    [  599.090779]  [<ffffffff810a8661>] get_signal_to_deliver+0x2e1/0x960
    [  599.097071]  [<ffffffff8101c497>] do_signal+0x57/0x6e0
    [  599.102229]  [<ffffffff81714bd1>] ? sysret_signal+0x5/0x4e
    [  599.107738]  [<ffffffff8101cb7f>] do_notify_resume+0x5f/0xb0
    [  599.113418]  [<ffffffff81714e7d>] int_signal+0x12/0x17
    [  599.118576] ---[ end trace 1e4653102e7e7019 ]---
    [  599.123211] Mapped at:
    [  599.125577]  [<ffffffff8138ed8b>] debug_dma_alloc_coherent+0x2b/0x80
    [  599.131968]  [<ffffffffa01ec862>] cxio_create_cq+0xf2/0x1f0 [iw_cxgb3]
    [  599.139920]  [<ffffffffa01e9c05>] iwch_create_cq+0x105/0x4e0 [iw_cxgb3]
    [  599.147895]  [<ffffffffa0500584>] create_cq.constprop.14+0x184/0x2e0 [ib_uverbs]
    [  599.156649]  [<ffffffffa05027fb>] ib_uverbs_create_cq+0x10b/0x140 [ib_uverbs]
    
    Fixes: b955150ea784 ('RDMA/cxgb3: When a user QP is marked in error, also mark the CQs in error')
    Signed-off-by: Honggang Li <honli@redhat.com>
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
    Reviewed-by: Steve Wise <swise@opengridcomputing.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ec4dac52d2b563c0803c9dc67ed9c5442a24e48a
Author: Richard Weinberger <richard@nod.at>
Date:   Tue Apr 26 16:39:48 2016 +0200

    UBI: Fix static volume checks when Fastmap is used
    
    commit 1900149c835ab5b48bea31a823ea5e5a401fb560 upstream.
    
    Ezequiel reported that he's facing UBI going into read-only
    mode after power cut. It turned out that this behavior happens
    only when updating a static volume is interrupted and Fastmap is
    used.
    
    A possible trace can look like:
    ubi0 warning: ubi_io_read_vid_hdr [ubi]: no VID header found at PEB 2323, only 0xFF bytes
    ubi0 warning: ubi_eba_read_leb [ubi]: switch to read-only mode
    CPU: 0 PID: 833 Comm: ubiupdatevol Not tainted 4.6.0-rc2-ARCH #4
    Hardware name: SAMSUNG ELECTRONICS CO., LTD. 300E4C/300E5C/300E7C/NP300E5C-AD8AR, BIOS P04RAP 10/15/2012
    0000000000000286 00000000eba949bd ffff8800c45a7b38 ffffffff8140d841
    ffff8801964be000 ffff88018eaa4800 ffff8800c45a7bb8 ffffffffa003abf6
    ffffffff850e2ac0 8000000000000163 ffff8801850e2ac0 ffff8801850e2ac0
    Call Trace:
    [<ffffffff8140d841>] dump_stack+0x63/0x82
    [<ffffffffa003abf6>] ubi_eba_read_leb+0x486/0x4a0 [ubi]
    [<ffffffffa00453b3>] ubi_check_volume+0x83/0xf0 [ubi]
    [<ffffffffa0039d97>] ubi_open_volume+0x177/0x350 [ubi]
    [<ffffffffa00375d8>] vol_cdev_open+0x58/0xb0 [ubi]
    [<ffffffff8124b08e>] chrdev_open+0xae/0x1d0
    [<ffffffff81243bcf>] do_dentry_open+0x1ff/0x300
    [<ffffffff8124afe0>] ? cdev_put+0x30/0x30
    [<ffffffff81244d36>] vfs_open+0x56/0x60
    [<ffffffff812545f4>] path_openat+0x4f4/0x1190
    [<ffffffff81256621>] do_filp_open+0x91/0x100
    [<ffffffff81263547>] ? __alloc_fd+0xc7/0x190
    [<ffffffff812450df>] do_sys_open+0x13f/0x210
    [<ffffffff812451ce>] SyS_open+0x1e/0x20
    [<ffffffff81a99e32>] entry_SYSCALL_64_fastpath+0x1a/0xa4
    
    UBI checks static volumes for data consistency and reads the
    whole volume upon first open. If the volume is found erroneous
    users of UBI cannot read from it, but another volume update is
    possible to fix it. The check is performed by running
    ubi_eba_read_leb() on every allocated LEB of the volume.
    For static volumes ubi_eba_read_leb() computes the checksum of all
    data stored in a LEB. To verify the computed checksum it has to read
    the LEB's volume header which stores the original checksum.
    If the volume header is not found UBI treats this as fatal internal
    error and switches to RO mode. If the UBI device was attached via a
    full scan the assumption is correct, the volume header has to be
    present as it had to be there while scanning to get known as mapped.
    If the attach operation happened via Fastmap the assumption is no
    longer correct. When attaching via Fastmap UBI learns the mapping
    table from Fastmap's snapshot of the system state and not via a full
    scan. It can happen that a LEB got unmapped after a Fastmap was
    written to the flash. Then UBI can learn the LEB still as mapped and
    accessing it returns only 0xFF bytes. As UBI is not a FTL it is
    allowed to have mappings to empty PEBs, it assumes that the layer
    above takes care of LEB accounting and referencing.
    UBIFS does so using the LEB property tree (LPT).
    For static volumes UBI blindly assumes that all LEBs are present and
    therefore special actions have to be taken.
    
    The described situation can happen when updating a static volume is
    interrupted, either by a user or a power cut.
    The volume update code first unmaps all LEBs of a volume and then
    writes LEB by LEB. If the sequence of operations is interrupted UBI
    detects this either by the absence of LEBs, no volume header present
    at scan time, or corrupted payload, detected via checksum.
    In the Fastmap case the former method won't trigger as no scan
    happened and UBI automatically thinks all LEBs are present.
    Only by reading data from a LEB it detects that the volume header is
    missing and incorrectly treats this as fatal error.
    To deal with the situation ubi_eba_read_leb() from now on checks
    whether we attached via Fastmap and handles the absence of a
    volume header like a data corruption error.
    This way interrupted static volume updates will correctly get detected
    also when Fastmap is used.
    
    Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
    Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit cc729411973d318ddfe7fc3b5ca477446a2ec948
Author: Brian Norris <computersforpeace@gmail.com>
Date:   Mon Feb 23 13:07:22 2015 -0800

    UBI: fix missing brace control flow
    
    commit b388e6a7a6ba988998ddd83919ae8d3debf1a13d upstream.
    
    commit 0e707ae79ba3 ("UBI: do propagate positive error codes up") seems
    to have produced an unintended change in the control flow here.
    
    Completely untested, but it looks obvious.
    
    Caught by Coverity, which didn't like the indentation. CID 1271184.
    
    Signed-off-by: Brian Norris <computersforpeace@gmail.com>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 7eef294044f89c8f7900095dc617755f7459a81e
Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Date:   Tue Nov 25 11:34:02 2014 +0200

    UBI: do propagate positive error codes up
    
    commit 0e707ae79ba357d60b8a36025ec8968e5020d827 upstream.
    
    UBI uses positive function return codes internally, and should not propagate
    them up, except in the place this path fixes. Here is the original bug report
    from Dan Carpenter:
    
    The problem is really in ubi_eba_read_leb().
    
    drivers/mtd/ubi/eba.c
       412                  err = ubi_io_read_vid_hdr(ubi, pnum, vid_hdr, 1);
       413                  if (err && err != UBI_IO_BITFLIPS) {
       414                          if (err > 0) {
       415                                  /*
       416                                   * The header is either absent or corrupted.
       417                                   * The former case means there is a bug -
       418                                   * switch to read-only mode just in case.
       419                                   * The latter case means a real corruption - we
       420                                   * may try to recover data. FIXME: but this is
       421                                   * not implemented.
       422                                   */
       423                                  if (err == UBI_IO_BAD_HDR_EBADMSG ||
       424                                      err == UBI_IO_BAD_HDR) {
       425                                          ubi_warn("corrupted VID header at PEB %d, LEB %d:%d",
       426                                                   pnum, vol_id, lnum);
       427                                          err = -EBADMSG;
       428                                  } else
       429                                          ubi_ro_mode(ubi);
    
    On this path we return UBI_IO_FF and UBI_IO_FF_BITFLIPS and it
    eventually gets passed to ERR_PTR().  We probably dereference the bad
    pointer and oops.  At that point we've gone read only so it was already
    a bad situation...
    
       430                          }
       431                          goto out_free;
       432                  } else if (err == UBI_IO_BITFLIPS)
       433                          scrub = 1;
       434
    
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit be1c1b538fe58f8aa20dfbfdd9d07ff64ae909b7
Author: Ross Lagerwall <ross.lagerwall@citrix.com>
Date:   Tue May 10 16:11:00 2016 +0100

    xen/events: Don't move disabled irqs
    
    commit f0f393877c71ad227d36705d61d1e4062bc29cf5 upstream.
    
    Commit ff1e22e7a638 ("xen/events: Mask a moving irq") open-coded
    irq_move_irq() but left out checking if the IRQ is disabled. This broke
    resuming from suspend since it tries to move a (disabled) irq without
    holding the IRQ's desc->lock. Fix it by adding in a check for disabled
    IRQs.
    
    The resulting stacktrace was:
    kernel BUG at /build/linux-UbQGH5/linux-4.4.0/kernel/irq/migration.c:31!
    invalid opcode: 0000 [#1] SMP
    Modules linked in: xenfs xen_privcmd ...
    CPU: 0 PID: 9 Comm: migration/0 Not tainted 4.4.0-22-generic #39-Ubuntu
    Hardware name: Xen HVM domU, BIOS 4.6.1-xs125180 05/04/2016
    task: ffff88003d75ee00 ti: ffff88003d7bc000 task.ti: ffff88003d7bc000
    RIP: 0010:[<ffffffff810e26e2>]  [<ffffffff810e26e2>] irq_move_masked_irq+0xd2/0xe0
    RSP: 0018:ffff88003d7bfc50  EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ffff88003d40ba00 RCX: 0000000000000001
    RDX: 0000000000000001 RSI: 0000000000000100 RDI: ffff88003d40bad8
    RBP: ffff88003d7bfc68 R08: 0000000000000000 R09: ffff88003d000000
    R10: 0000000000000000 R11: 000000000000023c R12: ffff88003d40bad0
    R13: ffffffff81f3a4a0 R14: 0000000000000010 R15: 00000000ffffffff
    FS:  0000000000000000(0000) GS:ffff88003da00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007fd4264de624 CR3: 0000000037922000 CR4: 00000000003406f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Stack:
     ffff88003d40ba38 0000000000000024 0000000000000000 ffff88003d7bfca0
     ffffffff814c8d92 00000010813ef89d 00000000805ea732 0000000000000009
     0000000000000024 ffff88003cc39b80 ffff88003d7bfce0 ffffffff814c8f66
    Call Trace:
     [<ffffffff814c8d92>] eoi_pirq+0xb2/0xf0
     [<ffffffff814c8f66>] __startup_pirq+0xe6/0x150
     [<ffffffff814ca659>] xen_irq_resume+0x319/0x360
     [<ffffffff814c7e75>] xen_suspend+0xb5/0x180
     [<ffffffff81120155>] multi_cpu_stop+0xb5/0xe0
     [<ffffffff811200a0>] ? cpu_stop_queue_work+0x80/0x80
     [<ffffffff811203d0>] cpu_stopper_thread+0xb0/0x140
     [<ffffffff810a94e6>] ? finish_task_switch+0x76/0x220
     [<ffffffff810ca731>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
     [<ffffffff810a3935>] smpboot_thread_fn+0x105/0x160
     [<ffffffff810a3830>] ? sort_range+0x30/0x30
     [<ffffffff810a0588>] kthread+0xd8/0xf0
     [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
     [<ffffffff8182568f>] ret_from_fork+0x3f/0x70
     [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Signed-off-by: David Vrabel <david.vrabel@citrix.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b515996e930f00d7c4c73f8fe04c51fdf22133fc
Author: Oleg Nesterov <oleg@redhat.com>
Date:   Mon May 23 16:23:50 2016 -0700

    wait/ptrace: assume __WALL if the child is traced
    
    commit bf959931ddb88c4e4366e96dd22e68fa0db9527c upstream.
    
    The following program (simplified version of generated by syzkaller)
    
            #include <pthread.h>
            #include <unistd.h>
            #include <sys/ptrace.h>
            #include <stdio.h>
            #include <signal.h>
    
            void *thread_func(void *arg)
            {
                    ptrace(PTRACE_TRACEME, 0,0,0);
                    return 0;
            }
    
            int main(void)
            {
                    pthread_t thread;
    
                    if (fork())
                            return 0;
    
                    while (getppid() != 1)
                            ;
    
                    pthread_create(&thread, NULL, thread_func, NULL);
                    pthread_join(thread, NULL);
                    return 0;
            }
    
    creates an unreapable zombie if /sbin/init doesn't use __WALL.
    
    This is not a kernel bug, at least in a sense that everything works as
    expected: debugger should reap a traced sub-thread before it can reap the
    leader, but without __WALL/__WCLONE do_wait() ignores sub-threads.
    
    Unfortunately, it seems that /sbin/init in most (all?) distributions
    doesn't use it and we have to change the kernel to avoid the problem.
    Note also that most init's use sys_waitid() which doesn't allow __WALL, so
    the necessary user-space fix is not that trivial.
    
    This patch just adds the "ptrace" check into eligible_child().  To some
    degree this matches the "tsk->ptrace" in exit_notify(), ->exit_signal is
    mostly ignored when the tracee reports to debugger.  Or WSTOPPED, the
    tracer doesn't need to set this flag to wait for the stopped tracee.
    
    This obviously means the user-visible change: __WCLONE and __WALL no
    longer have any meaning for debugger.  And I can only hope that this won't
    break something, but at least strace/gdb won't suffer.
    
    We could make a more conservative change.  Say, we can take __WCLONE into
    account, or !thread_group_leader().  But it would be nice to not
    complicate these historical/confusing checks.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Reported-by: Dmitry Vyukov <dvyukov@google.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
    Cc: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
    Cc: Pedro Alves <palves@redhat.com>
    Cc: Roland McGrath <roland@hack.frob.com>
    Cc: <syzkaller@googlegroups.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d3399a5f04a91299369de0408ae753cbac6701a7
Author: Tomáš Trnka <ttrnka@mail.muni.cz>
Date:   Fri May 20 16:41:10 2016 +0200

    sunrpc: fix stripping of padded MIC tokens
    
    commit c0cb8bf3a8e4bd82e640862cdd8891400405cb89 upstream.
    
    The length of the GSS MIC token need not be a multiple of four bytes.
    It is then padded by XDR to a multiple of 4 B, but unwrap_integ_data()
    would previously only trim mic.len + 4 B. The remaining up to three
    bytes would then trigger a check in nfs4svc_decode_compoundargs(),
    leading to a "garbage args" error and mount failure:
    
    nfs4svc_decode_compoundargs: compound not properly padded!
    nfsd: failed to decode arguments!
    
    This would prevent older clients using the pre-RFC 4121 MIC format
    (37-byte MIC including a 9-byte OID) from mounting exports from v3.9+
    servers using krb5i.
    
    The trimming was introduced by commit 4c190e2f913f ("sunrpc: trim off
    trailing checksum before returning decrypted or integrity authenticated
    buffer").
    
    Fixes: 4c190e2f913f "unrpc: trim off trailing checksum..."
    Signed-off-by: Tomáš Trnka <ttrnka@mail.muni.cz>
    Acked-by: Jeff Layton <jlayton@poochiereds.net>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a888f891c2f77bf9564aba0d74a7a7ddc9435d73
Author: Matt Gumbel <matthew.k.gumbel@intel.com>
Date:   Fri May 20 10:33:46 2016 +0300

    mmc: longer timeout for long read time quirk
    
    commit 32ecd320db39bcb007679ed42f283740641b81ea upstream.
    
    008GE0 Toshiba mmc in some Intel Baytrail tablets responds to
    MMC_SEND_EXT_CSD in 450-600ms.
    
    This patch will...
    
    () Increase the long read time quirk timeout from 300ms to 600ms. Original
       author of that quirk says 300ms was only a guess and that the number
       may need to be raised in the future.
    
    () Add this specific MMC to the quirk
    
    Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1a4f083e09e1472df4e5e7c7915eb00e6948fe83
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Fri May 13 17:55:17 2016 +0300

    drm/i915: Don't leave old junk in ilk active watermarks on readout
    
    commit 7045c3689f148a0c95f42bae8ef3eb2829ac7de9 upstream.
    
    When we read out the watermark state from the hardware we're supposed to
    transfer that into the active watermarks, but currently we fail to any
    part of the active watermarks that isn't explicitly written. Let's clear
    it all upfront.
    
    Looks like this has been like this since the beginning, when I added the
    readout. No idea why I didn't clear it up.
    
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Fixes: 243e6a44b9ca ("drm/i915: Init HSW watermark tracking in intel_modeset_setup_hw_state()")
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/1463151318-14719-2-git-send-email-ville.syrjala@linux.intel.com
    (cherry picked from commit 15606534bf0a65d8a74a90fd57b8712d147dbca6)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1e429fd390a0245f8fce047c8413b40fe90688dc
Author: James Bottomley <James.Bottomley@HansenPartnership.com>
Date:   Fri May 13 12:04:06 2016 -0700

    scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands
    
    commit a621bac3044ed6f7ec5fa0326491b2d4838bfa93 upstream.
    
    When SCSI was written, all commands coming from the filesystem
    (REQ_TYPE_FS commands) had data.  This meant that our signal for needing
    to complete the command was the number of bytes completed being equal to
    the number of bytes in the request.  Unfortunately, with the advent of
    flush barriers, we can now get zero length REQ_TYPE_FS commands, which
    confuse this logic because they satisfy the condition every time.  This
    means they never get retried even for retryable conditions, like UNIT
    ATTENTION because we complete them early assuming they're done.  Fix
    this by special casing the early completion condition to recognise zero
    length commands with errors and let them drop through to the retry code.
    
    Reported-by: Sebastian Parschauer <s.parschauer@gmx.de>
    Signed-off-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
    Tested-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c56ec947ccea7ee9270a8ee8b40f45f1810a3720
Author: Jason Wang <jasowang@redhat.com>
Date:   Thu May 19 13:36:51 2016 +0800

    tuntap: correctly wake up process during uninit
    
    commit addf8fc4acb1cf79492ac64966f07178793cb3d7 upstream.
    
    We used to check dev->reg_state against NETREG_REGISTERED after each
    time we are woke up. But after commit 9e641bdcfa4e ("net-tun:
    restructure tun_do_read for better sleep/wakeup efficiency"), it uses
    skb_recv_datagram() which does not check dev->reg_state. This will
    result if we delete a tun/tap device after a process is blocked in the
    reading. The device will wait for the reference count which was held
    by that process for ever.
    
    Fixes this by using RCV_SHUTDOWN which will be checked during
    sk_recv_datagram() before trying to wake up the process during uninit.
    
    Fixes: 9e641bdcfa4e ("net-tun: restructure tun_do_read for better
    sleep/wakeup efficiency")
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Xi Wang <xii@google.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ccac349834cc168be606c63900b5a09840fd7b89
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Fri May 20 23:09:49 2016 +0200

    PM / sleep: Handle failures in device_suspend_late() consistently
    
    commit 3a17fb329da68cb00558721aff876a80bba2fdb9 upstream.
    
    Grygorii Strashko reports:
    
     The PM runtime will be left disabled for the device if its
     .suspend_late() callback fails and async suspend is not allowed
     for this device. In this case device will not be added in
     dpm_late_early_list and dpm_resume_early() will ignore this
     device, as result PM runtime will be disabled for it forever
     (side effect: after 8 subsequent failures for the same device
     the PM runtime will be reenabled due to disable_depth overflow).
    
    To fix this problem, add devices to dpm_late_early_list regardless
    of whether or not device_suspend_late() returns errors for them.
    
    That will ensure failures in there to be handled consistently for
    all devices regardless of their async suspend/resume status.
    
    Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
    Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 285d720c9845f52168affde139246b204f07d4b8
Author: Ricky Liang <jcliang@chromium.org>
Date:   Fri May 20 10:58:59 2016 -0700

    Input: uinput - handle compat ioctl for UI_SET_PHYS
    
    commit affa80bd97f7ca282d1faa91667b3ee9e4c590e6 upstream.
    
    When running a 32-bit userspace on a 64-bit kernel, the UI_SET_PHYS
    ioctl needs to be treated with special care, as it has the pointer
    size encoded in the command.
    
    Signed-off-by: Ricky Liang <jcliang@chromium.org>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 07cad668f0c30224f797b97028b623e37875611d
Author: Sachin Prabhu <sprabhu@redhat.com>
Date:   Tue May 17 18:20:13 2016 -0500

    cifs: Create dedicated keyring for spnego operations
    
    commit b74cb9a80268be5c80cf4c87c74debf0ff2129ac upstream.
    
    The session key is the default keyring set for request_key operations.
    This session key is revoked when the user owning the session logs out.
    Any long running daemon processes started by this session ends up with
    revoked session keyring which prevents these processes from using the
    request_key mechanism from obtaining the krb5 keys.
    
    The problem has been reported by a large number of autofs users. The
    problem is also seen with multiuser mounts where the share may be used
    by processes run by a user who has since logged out. A reproducer using
    automount is available on the Red Hat bz.
    
    The patch creates a new keyring which is used to cache cifs spnego
    upcalls.
    
    Red Hat bz: 1267754
    
    Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
    Reported-by: Scott Mayhew <smayhew@redhat.com>
    Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
    Signed-off-by: Steve French <smfrench@gmail.com>
    [bwh: Backported to 3.16: keyring_alloc() doesn't take a restrict_link param]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4990219c14c3a2a809b9da8f7b9d57c1dea2561b
Author: xypron.glpk@gmx.de <xypron.glpk@gmx.de>
Date:   Tue May 17 22:28:54 2016 +0200

    net: ehea: avoid null pointer dereference
    
    commit 1740c29a46b30a2f157afc473156f157e599d4c2 upstream.
    
    ehea_get_port may return NULL. Do not dereference NULL value.
    
    Fixes: 8c4877a4128e ("ehea: Use the standard logging functions")
    Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
    Acked-by: Thadeu Lima de Souza Cascardo <cascardo@debian.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 99e2057a42aeb3f3556ed7dace9edf0b85262e1f
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed May 18 16:55:56 2016 +0200

    crypto: public_key: select CRYPTO_AKCIPHER
    
    commit bad6a185b4d6f81d0ed2b6e4c16307969f160b95 upstream.
    
    In some rare randconfig builds, we can end up with
    ASYMMETRIC_PUBLIC_KEY_SUBTYPE enabled but CRYPTO_AKCIPHER disabled,
    which fails to link because of the reference to crypto_alloc_akcipher:
    
    crypto/built-in.o: In function `public_key_verify_signature':
    :(.text+0x110e4): undefined reference to `crypto_alloc_akcipher'
    
    This adds a Kconfig 'select' statement to ensure the dependency
    is always there.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 64ecbb0f2886f91fb82680a564a75166c3cf3a22
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed May 18 13:54:23 2016 +1000

    xfs: skip stale inodes in xfs_iflush_cluster
    
    commit 7d3aa7fe970791f1a674b14572a411accf2f4d4e upstream.
    
    We don't write back stale inodes so we should skip them in
    xfs_iflush_cluster, too.
    
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Dave Chinner <david@fromorbit.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e8f01c0f0061a2dc9f30667ab767691fb8c4bfd3
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed May 18 13:54:22 2016 +1000

    xfs: fix inode validity check in xfs_iflush_cluster
    
    commit 51b07f30a71c27405259a0248206ed4e22adbee2 upstream.
    
    Some careless idiot(*) wrote crap code in commit 1a3e8f3 ("xfs:
    convert inode cache lookups to use RCU locking") back in late 2010,
    and so xfs_iflush_cluster checks the wrong inode for whether it is
    still valid under RCU protection. Fix it to lock and check the
    correct inode.
    
    (*) Careless-idiot: Dave Chinner <dchinner@redhat.com>
    
    Discovered-by: Brain Foster <bfoster@redhat.com>
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Dave Chinner <david@fromorbit.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit aed982743f5c1705db5a0c1ffa2aa68747208b9c
Author: Dave Chinner <dchinner@redhat.com>
Date:   Wed May 18 13:53:42 2016 +1000

    xfs: xfs_iflush_cluster fails to abort on error
    
    commit b1438f477934f5a4d5a44df26f3079a7575d5946 upstream.
    
    When a failure due to an inode buffer occurs, the error handling
    fails to abort the inode writeback correctly. This can result in the
    inode being reclaimed whilst still in the AIL, leading to
    use-after-free situations as well as filesystems that cannot be
    unmounted as the inode log items left in the AIL never get removed.
    
    Fix this by ensuring fatal errors from xfs_imap_to_bp() result in
    the inode flush being aborted correctly.
    
    Reported-by: Shyam Kaushik <shyam@zadarastorage.com>
    Diagnosed-by: Shyam Kaushik <shyam@zadarastorage.com>
    Tested-by: Shyam Kaushik <shyam@zadarastorage.com>
    Signed-off-by: Dave Chinner <dchinner@redhat.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Dave Chinner <david@fromorbit.com>
    [bwh: Backported to 3.16: as Dave pointed out, error codes are positive
     here so compare with positive EAGAIN]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4729224a3397630a930f1442baf2ca0631c734d1
Author: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Date:   Tue Feb 16 10:47:07 2016 +0100

    batman-adv: Fix integer overflow in batadv_iv_ogm_calc_tq
    
    commit d285f52cc0f23564fd61976d43fd5b991b4828f6 upstream.
    
    The undefined behavior sanatizer detected an signed integer overflow in a
    setup with near perfect link quality
    
        UBSAN: Undefined behaviour in net/batman-adv/bat_iv_ogm.c:1246:25
        signed integer overflow:
        8713350 * 255 cannot be represented in type 'int'
    
    The problems happens because the calculation of mixed unsigned and signed
    integers resulted in an integer multiplication.
    
          batadv_ogm_packet::tq (u8 255)
        * tq_own (u8 255)
        * tq_asym_penalty (int 134; max 255)
        * tq_iface_penalty (int 255; max 255)
    
    The tq_iface_penalty, tq_asym_penalty and inv_asym_penalty can just be
    changed to unsigned int because they are not expected to become negative.
    
    Fixes: c039876892e3 ("batman-adv: add WiFi penalty")
    Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: Antonio Quartulli <a@unstable.cc>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4a8b24ed1050b81e7fda527cbf4a0f645cadbcbb
Author: Sven Eckelmann <sven@narfation.org>
Date:   Mon Feb 22 22:56:33 2016 +0100

    batman-adv: Fix unexpected free of bcast_own on add_if error
    
    commit f7dcdf5fdbe8fec7670d8f65a5db595c98e0ecab upstream.
    
    The function batadv_iv_ogm_orig_add_if allocates new buffers for bcast_own
    and bcast_own_sum. It is expected that these buffers are unchanged in case
    either bcast_own or bcast_own_sum couldn't be resized.
    
    But the error handling of this function frees the already resized buffer
    for bcast_own when the allocation of the new bcast_own_sum buffer failed.
    This will lead to an invalid memory access when some code will try to
    access bcast_own.
    
    Instead the resized new bcast_own buffer has to be kept. This will not lead
    to problems because the size of the buffer was only increased and therefore
    no user of the buffer will try to access bytes outside of the new buffer.
    
    Fixes: d0015fdd3d2c ("batman-adv: provide orig_node routing API")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: Antonio Quartulli <a@unstable.cc>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fd966aaf45bba66a7b2b365550b44734d50e63cb
Author: Florian Westphal <fw@strlen.de>
Date:   Tue May 10 23:17:59 2016 +0200

    batman-adv: fix skb deref after free
    
    commit 63d443efe8be2c1d02b30d7e4edeb9aa085352b3 upstream.
    
    batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len.
    
    Fixes: 953324776d6d ("batman-adv: network coding - buffer unicast packets before forward")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Reviewed-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
    Signed-off-by: Antonio Quartulli <a@unstable.cc>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 188e5f79a281cfc1bd508e6fefded456bd8dce53
Author: Daniel Lezcano <daniel.lezcano@linaro.org>
Date:   Tue May 17 16:54:00 2016 +0200

    cpuidle: Fix cpuidle_state_is_coupled() argument in cpuidle_enter()
    
    commit e7387da52028b072489c45efeb7a916c0205ebd2 upstream.
    
    Commit 0b89e9aa2856 (cpuidle: delay enabling interrupts until all
    coupled CPUs leave idle) rightfully fixed a regression by letting
    the coupled idle state framework to handle local interrupt enabling
    when the CPU is exiting an idle state.
    
    The current code checks if the idle state is coupled and, if so, it
    will let the coupled code to enable interrupts. This way, it can
    decrement the ready-count before handling the interrupt. This
    mechanism prevents the other CPUs from waiting for a CPU which is
    handling interrupts.
    
    But the check is done against the state index returned by the back
    end driver's ->enter functions which could be different from the
    initial index passed as parameter to the cpuidle_enter_state()
    function.
    
     entered_state = target_state->enter(dev, drv, index);
    
     [ ... ]
    
     if (!cpuidle_state_is_coupled(drv, entered_state))
            local_irq_enable();
    
     [ ... ]
    
    If the 'index' is referring to a coupled idle state but the
    'entered_state' is *not* coupled, then the interrupts are enabled
    again. All CPUs blocked on the sync barrier may busy loop longer
    if the CPU has interrupts to handle before decrementing the
    ready-count. That's consuming more energy than saving.
    
    Fixes: 0b89e9aa2856 (cpuidle: delay enabling interrupts until all coupled CPUs leave idle)
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    [ rjw: Subject & changelog ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b3f2cf10c8711b9acbf6effcf4164b2f6cb32fc8
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 2 14:40:31 2016 -0400

    sunrpc: Update RPCBIND_MAXNETIDLEN
    
    commit 4b9c7f9db9a003f5c342184dc4401c1b7f2efb39 upstream.
    
    Commit 176e21ee2ec8 ("SUNRPC: Support for RPC over AF_LOCAL
    transports") added a 5-character netid, but did not bump
    RPCBIND_MAXNETIDLEN from 4 to 5.
    
    Fixes: 176e21ee2ec8 ("SUNRPC: Support for RPC over AF_LOCAL ...")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 496bc4a1907f520e4afc0f631b18c90f7faafa9b
Author: Steve French <smfrench@gmail.com>
Date:   Thu May 12 21:20:36 2016 -0500

    remove directory incorrectly tries to set delete on close on non-empty directories
    
    commit 897fba1172d637d344f009d700f7eb8a1fa262f1 upstream.
    
    Wrong return code was being returned on SMB3 rmdir of
    non-empty directory.
    
    For SMB3 (unlike for cifs), we attempt to delete a directory by
    set of delete on close flag on the open. Windows clients set
    this flag via a set info (SET_FILE_DISPOSITION to set this flag)
    which properly checks if the directory is empty.
    
    With this patch on smb3 mounts we correctly return
     "DIRECTORY NOT EMPTY"
    on attempts to remove a non-empty directory.
    
    Signed-off-by: Steve French <steve.french@primarydata.com>
    Acked-by: Sachin Prabhu <sprabhu@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d1c774241e28b4281f49c1cb9e66d0206c4a0f30
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue May 3 10:52:30 2016 +0200

    fs/cifs: correctly to anonymous authentication for the NTLM(v2) authentication
    
    commit 1a967d6c9b39c226be1b45f13acd4d8a5ab3dc44 upstream.
    
    Only server which map unknown users to guest will allow
    access using a non-null NTLMv2_Response.
    
    For Samba it's the "map to guest = bad user" option.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Steve French <smfrench@gmail.com>
    [bwh: Backported to 3.16:adjust context, indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2432f27fc1fdc0912461954d3ad16aa06326cc71
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue May 3 10:52:30 2016 +0200

    fs/cifs: correctly to anonymous authentication for the NTLM(v1) authentication
    
    commit 777f69b8d26bf35ade4a76b08f203c11e048365d upstream.
    
    Only server which map unknown users to guest will allow
    access using a non-null NTChallengeResponse.
    
    For Samba it's the "map to guest = bad user" option.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Steve French <smfrench@gmail.com>
    [bwh: Backported to 3.16: adjust context, indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 63e707b09e0369adbad17b567bc872d55e6b9d92
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue May 3 10:52:30 2016 +0200

    fs/cifs: correctly to anonymous authentication for the LANMAN authentication
    
    commit fa8f3a354bb775ec586e4475bcb07f7dece97e0c upstream.
    
    Only server which map unknown users to guest will allow
    access using a non-null LMChallengeResponse.
    
    For Samba it's the "map to guest = bad user" option.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Steve French <smfrench@gmail.com>
    [bwh: Backported to 3.16: adjust context, indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c764ef67817f036efbcaa3f9956db68a5467ae3f
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue May 3 10:52:30 2016 +0200

    fs/cifs: correctly to anonymous authentication via NTLMSSP
    
    commit cfda35d98298131bf38fbad3ce4cd5ecb3cf18db upstream.
    
    See [MS-NLMP] 3.2.5.1.2 Server Receives an AUTHENTICATE_MESSAGE from the Client:
    
       ...
       Set NullSession to FALSE
       If (AUTHENTICATE_MESSAGE.UserNameLen == 0 AND
          AUTHENTICATE_MESSAGE.NtChallengeResponse.Length == 0 AND
          (AUTHENTICATE_MESSAGE.LmChallengeResponse == Z(1)
           OR
           AUTHENTICATE_MESSAGE.LmChallengeResponse.Length == 0))
           -- Special case: client requested anonymous authentication
           Set NullSession to TRUE
       ...
    
    Only server which map unknown users to guest will allow
    access using a non-null NTChallengeResponse.
    
    For Samba it's the "map to guest = bad user" option.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913
    
    Signed-off-by: Stefan Metzmacher <metze@samba.org>
    Signed-off-by: Steve French <smfrench@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a6ff2d56d7494ffb4cfa39f1960546ade6bca638
Author: Lyude <cpaul@redhat.com>
Date:   Thu May 12 10:56:59 2016 -0400

    drm/fb_helper: Fix references to dev->mode_config.num_connector
    
    commit 255f0e7c418ad95a4baeda017ae6182ba9b3c423 upstream.
    
    During boot, MST hotplugs are generally expected (even if no physical
    hotplugging occurs) and result in DRM's connector topology changing.
    This means that using num_connector from the current mode configuration
    can lead to the number of connectors changing under us. This can lead to
    some nasty scenarios in fbcon:
    
    - We allocate an array to the size of dev->mode_config.num_connectors.
    - MST hotplug occurs, dev->mode_config.num_connectors gets incremented.
    - We try to loop through each element in the array using the new value
      of dev->mode_config.num_connectors, and end up going out of bounds
      since dev->mode_config.num_connectors is now larger then the array we
      allocated.
    
    fb_helper->connector_count however, will always remain consistent while
    we do a modeset in fb_helper.
    
    Note: This is just polish for 4.7, Dave Airlie's drm_connector
    refcounting fixed these bugs for real. But it's good enough duct-tape
    for stable kernel backporting, since backporting the refcounting
    changes is way too invasive.
    
    Signed-off-by: Lyude <cpaul@redhat.com>
    [danvet: Clarify why we need this. Also remove the now unused "dev"
    local variable to appease gcc.]
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1463065021-18280-3-git-send-email-cpaul@redhat.com
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 08cc973b6c7960e796ea5a440b19fa93971145a1
Author: Lyude <cpaul@redhat.com>
Date:   Thu May 12 10:56:58 2016 -0400

    drm/i915/fbdev: Fix num_connector references in intel_fb_initial_config()
    
    commit 14a3842a1d5945067d1dd0788f314e14d5b18e5b upstream.
    
    During boot time, MST devices usually send a ton of hotplug events
    irregardless of whether or not any physical hotplugs actually occurred.
    Hotplugs mean connectors being created/destroyed, and the number of DRM
    connectors changing under us. This isn't a problem if we use
    fb_helper->connector_count since we only set it once in the code,
    however if we use num_connector from struct drm_mode_config we risk it's
    value changing under us. On top of that, there's even a chance that
    dev->mode_config.num_connector != fb_helper->connector_count. If the
    number of connectors happens to increase under us, we'll end up using
    the wrong array size for memcpy and start writing beyond the actual
    length of the array, occasionally resulting in kernel panics.
    
    Note: This is just polish for 4.7, Dave Airlie's drm_connector
    refcounting fixed these bugs for real. But it's good enough duct-tape
    for stable kernel backporting, since backporting the refcounting
    changes is way too invasive.
    
    Signed-off-by: Lyude <cpaul@redhat.com>
    [danvet: Clarify why we need this.]
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1463065021-18280-2-git-send-email-cpaul@redhat.com
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9df3747090869da0f231384791ef475994e38060
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon May 16 15:01:11 2016 +0200

    sched/preempt: Fix preempt_count manipulations
    
    commit 2e636d5e66c35dfcbaf617aa8fa963f6847478fe upstream.
    
    Vikram reported that his ARM64 compiler managed to 'optimize' away the
    preempt_count manipulations in code like:
    
            preempt_enable_no_resched();
            put_user();
            preempt_disable();
    
    Irrespective of that fact that that is horrible code that should be
    fixed for many reasons, it does highlight a deficiency in the generic
    preempt_count manipulators. As it is never right to combine/elide
    preempt_count manipulations like this.
    
    Therefore sprinkle some volatile in the two generic accessors to
    ensure the compiler is aware of the fact that the preempt_count is
    observed outside of the regular program-order view and thus cannot be
    optimized away like this.
    
    x86; the only arch not using the generic code is not affected as we
    do all this in asm in order to use the segment base per-cpu stuff.
    
    Reported-by: Vikram Mulukutla <markivx@codeaurora.org>
    Tested-by: Vikram Mulukutla <markivx@codeaurora.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Fixes: a787870924db ("sched, arch: Create asm/preempt.h")
    Link: http://lkml.kernel.org/r/20160516131751.GH3205@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    [bwh: Backported to 3.16: use ACCESS_ONCE() instead of READ_ONCE()]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ed8ab6b2bb3f3714dad70216b94e1bb8bc8df223
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Mon May 16 17:28:16 2016 +0800

    netlink: Fix dump skb leak/double free
    
    commit 92964c79b357efd980812c4de5c1fd2ec8bb5520 upstream.
    
    When we free cb->skb after a dump, we do it after releasing the
    lock.  This means that a new dump could have started in the time
    being and we'll end up freeing their skb instead of ours.
    
    This patch saves the skb and module before we unlock so we free
    the right memory.
    
    Fixes: 16b304f3404f ("netlink: Eliminate kmalloc in netlink dump operation.")
    Reported-by: Baozeng Ding <sploving1@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 36265cadf588c080a6bb0ce1d7d377430264569e
Author: Prarit Bhargava <prarit@redhat.com>
Date:   Wed May 11 12:27:16 2016 -0400

    PCI: Disable all BAR sizing for devices with non-compliant BARs
    
    commit ad67b437f187ea818b2860524d10f878fadfdd99 upstream.
    
    b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant
    BARs") disabled BAR sizing for BARs 0-5 of devices that don't comply with
    the PCI spec.  But it didn't do anything for expansion ROM BARs, so we
    still try to size them, resulting in warnings like this on Broadwell-EP:
    
      pci 0000:ff:12.0: BAR 6: failed to assign [mem size 0x00000001 pref]
    
    Move the non-compliant BAR check from __pci_read_base() up to
    pci_read_bases() so it applies to the expansion ROM BAR as well as
    to BARs 0-5.
    
    Note that direct callers of __pci_read_base(), like sriov_init(), will now
    bypass this check.  We haven't had reports of devices with broken SR-IOV
    BARs yet.
    
    [bhelgaas: changelog]
    Fixes: b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant BARs")
    Signed-off-by: Prarit Bhargava <prarit@redhat.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: Thomas Gleixner <tglx@linutronix.de>
    CC: Ingo Molnar <mingo@redhat.com>
    CC: "H. Peter Anvin" <hpa@zytor.com>
    CC: Andi Kleen <ak@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 27d4396a3a7059468933ae039ee5fc1c0e445891
Author: Prarit Bhargava <prarit@redhat.com>
Date:   Wed May 11 12:27:15 2016 -0400

    x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs
    
    commit da77b67195de1c65bef4908fa29967c4d0af2da2 upstream.
    
    Commit b894157145e4 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having
    non-compliant BARs") marked Home Agent 0 & PCU has having non-compliant
    BARs.  Home Agent 1 also has non-compliant BARs.
    
    Mark Home Agent 1 as having non-compliant BARs so the PCI core doesn't
    touch them.
    
    The problem with these devices is documented in the Xeon v4 specification
    update:
    
      BDF2          PCI BARs in the Home Agent Will Return Non-Zero Values
                    During Enumeration
    
      Problem:      During system initialization the Operating System may access
                    the standard PCI BARs (Base Address Registers).  Due to
                    this erratum, accesses to the Home Agent BAR registers (Bus
                    1; Device 18; Function 0,4; Offsets (0x14-0x24) will return
                    non-zero values.
    
      Implication:  The operating system may issue a warning.  Intel has not
                    observed any functional failures due to this erratum.
    
    Link: http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html
    Fixes: b894157145e4 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs")
    Signed-off-by: Prarit Bhargava <prarit@redhat.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: Thomas Gleixner <tglx@linutronix.de>
    CC: Ingo Molnar <mingo@redhat.com>
    CC: "H. Peter Anvin" <hpa@zytor.com>
    CC: Andi Kleen <ak@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c4fe39b5bb94fe8128a5236534cb52623767554c
Author: Tariq Toukan <tariqt@mellanox.com>
Date:   Sun May 15 10:21:26 2016 +0300

    net/mlx4_core: Fix access to uninitialized index
    
    commit 2bb07e155bb3e0c722c806723f737cf8020961ef upstream.
    
    Prevent using uninitialized or negative index when handling
    steering entries.
    
    Fixes: b12d93d63c32 ('mlx4: Add support for promiscuous mode in the new steering model.')
    Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
    Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 66003d803e3df727cfbe578f8d0a2b952ecbacdc
Author: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Date:   Mon May 16 09:54:47 2016 -0600

    blk-mq: fix undefined behaviour in order_to_size()
    
    commit b3a834b1596ac668df206aa2bb1f191c31f5f5e4 upstream.
    
    When this_order variable in blk_mq_init_rq_map() becomes zero
    the code incorrectly decrements the variable and passes the result
    to order_to_size() helper causing undefined behaviour:
    
     UBSAN: Undefined behaviour in block/blk-mq.c:1459:27
     shift exponent 4294967295 is too large for 32-bit type 'unsigned int'
     CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc6-00072-g33656a1 #22
    
    Fix the code by checking this_order variable for not having the zero
    value first.
    
    Reported-by: Meelis Roos <mroos@linux.ee>
    Fixes: 320ae51feed5 ("blk-mq: new multi-queue block IO queueing mechanism")
    Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Signed-off-by: Jens Axboe <axboe@fb.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c47ae034bb55f6fee5c8121403a454130e8eca95
Author: Adrian Hunter <adrian.hunter@intel.com>
Date:   Thu May 5 08:12:28 2016 +0300

    mmc: mmc: Fix partition switch timeout for some eMMCs
    
    commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.
    
    Some eMMCs set the partition switch timeout too low.
    
    Now typically eMMCs are considered a critical component (e.g. because
    they store the root file system) and consequently are expected to be
    reliable.  Thus we can neglect the use case where eMMCs can't switch
    reliably and we might want a lower timeout to facilitate speedy
    recovery.
    
    Although we could employ a quirk for the cards that are affected (if
    we could identify them all), as described above, there is little
    benefit to having a low timeout, so instead simply set a minimum
    timeout.
    
    The minimum is set to 300ms somewhat arbitrarily - the examples that
    have been seen had a timeout of 10ms but were sometimes taking 60-70ms.
    
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8e009bc2465ba4bc9fc06a1a50a88449f3d87f78
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu May 5 16:18:02 2016 +0300

    i40e: fix an uninitialized variable bug
    
    commit 1c306f7f62a38ee5f05f0ee994dfe82d654cf47c upstream.
    
    We removed this initialization but it is required.  Let's put it back.
    
    Fixes: 895106a577c4 ('i40e: trivial fixes')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit da71e66f13f8b7609d184fee5285126329451d87
Author: Mark Bloch <markb@mellanox.com>
Date:   Fri May 6 22:45:26 2016 +0300

    IB/core: Fix a potential array overrun in CMA and SA agent
    
    commit 2fa2d4fb1166d1ef35f0aacac6165d53ab1b89c7 upstream.
    
    Fix array overrun when going over callback table.
    In declaration of callback table, the max size isn't provided and
    in registration phase, it is provided.
    
    There is potential scenario where a new operation is added
    and it is not supported by current client. The acceptance of
    such operation by ib_netlink will cause to array overrun.
    
    Fixes: 809d5fc9bf65 ("infiniband: pass rdma_cm module to netlink_dump_start")
    Fixes: b493d91d333e ("iwcm: common code for port mapper")
    Fixes: 2ca546b92a02 ("IB/sa: Route SA pathrecord query through netlink")
    Signed-off-by: Mark Bloch <markb@mellanox.com>
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16:
     - Only cma.c needs to be fixed
     - Adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6c1082d470161f6bb2af86449530e8f97c102858
Author: Mark Bloch <markb@mellanox.com>
Date:   Fri May 6 22:45:24 2016 +0300

    IB/IWPM: Fix a potential skb leak
    
    commit 5ed935e861a4cbf2158ad3386d6d26edd60d2658 upstream.
    
    In case ibnl_put_msg fails in send_nlmsg_done,
    the function returns with -ENOMEM without freeing.
    
    This patch fixes this behavior.
    
    Fixes: 30dc5e63d6a5 ("RDMA/core: Add support for iWARP Port Mapper user space service")
    Signed-off-by: Mark Bloch <markb@mellanox.com>
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Reviewed-by: Steve Wise <swise@opengridcomputing.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 026d4750460c9d2c93234066d403822353e6f778
Author: Hariprasad S <hariprasad@chelsio.com>
Date:   Fri May 6 22:18:09 2016 +0530

    RDMA/iw_cxgb4: Always wake up waiter in c4iw_peer_abort_intr()
    
    commit 093108cb3640844cfdabb0f506fa6b592b64272d upstream.
    
    Currently c4iw_peer_abort_intr() does not wake up the waiter if the
    endpoint state indicates we're using MPAv2 and we're currently trying to
    connect. This was introduced with commit 7c0a33d61187a ("RDMA/cxgb4:
    Don't wakeup threads for MPAv2")
    
    However, this original fix is flawed because it introduces a race that
    can cause a deadlock of the iwarp stack.  Here is the race:
    
    ->local side sets up an active offload connection.
    
    ->local side sends MPA_START request.
    
    ->peer sends MPA_START response.
    
    ->local side ingress cpl thread begins processing the MPA_START response,
    but before it changes the state from MPA_REQ_SENT to FPDU_MODE:
    
    ->peer sends a RST which results in a ABORT_REQ_RSS.  This triggers
    peer_abort_intr() which sees the state in MPA_REQ_SENT and since mpa_rev
    is 2, it will avoid waking up the endpoint with -ECONNRESET, assuming the
    stack will re-attempt the connection using MPAv1.
    
    ->Meanwhile, the cpl thread moves the state to FPDU_MODE and calls
    c4iw_modify_rc_qp() which calls rdma_init() which sends a RI_WR/INIT WR
    to firmware.  But since HW sent an abort, FW correctly drops the RI_WR/INIT
    WR.
    
    ->So the cpl thread is stuck waiting for a reply and cannot process the
    ABORT_REQ_RSS cpl sitting in its input queue. Thus everything comes to a
    halt because no more ingress cpls are processed by the stack...
    
    The correct fix for the issue is to always do the wake up in
    c4iw_abort_intr() but reinitialize the wait object in c4iw_reconnect().
    
    Fixes: 7c0a33d61187a ("RDMA/cxgb4: Don't wakeup threads for MPAv2")
    Signed-off-by: Steve Wise <swise@opengridcomputing.com>
    Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e5e2cbc7f25c06266bba5072adab68cc64f71401
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Fri May 13 09:34:12 2016 -0400

    ring-buffer: Prevent overflow of size in ring_buffer_resize()
    
    commit 59643d1535eb220668692a5359de22545af579f6 upstream.
    
    If the size passed to ring_buffer_resize() is greater than MAX_LONG - BUF_PAGE_SIZE
    then the DIV_ROUND_UP() will return zero.
    
    Here's the details:
    
      # echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb
    
    tracing_entries_write() processes this and converts kb to bytes.
    
     18014398509481980 << 10 = 18446744073709547520
    
    and this is passed to ring_buffer_resize() as unsigned long size.
    
     size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
    
    Where DIV_ROUND_UP(a, b) is (a + b - 1)/b
    
    BUF_PAGE_SIZE is 4080 and here
    
     18446744073709547520 + 4080 - 1 = 18446744073709551599
    
    where 18446744073709551599 is still smaller than 2^64
    
     2^64 - 18446744073709551599 = 17
    
    But now 18446744073709551599 / 4080 = 4521260802379792
    
    and size = size * 4080 = 18446744073709551360
    
    This is checked to make sure its still greater than 2 * 4080,
    which it is.
    
    Then we convert to the number of buffer pages needed.
    
     nr_page = DIV_ROUND_UP(size, BUF_PAGE_SIZE)
    
    but this time size is 18446744073709551360 and
    
     2^64 - (18446744073709551360 + 4080 - 1) = -3823
    
    Thus it overflows and the resulting number is less than 4080, which makes
    
      3823 / 4080 = 0
    
    an nr_pages is set to this. As we already checked against the minimum that
    nr_pages may be, this causes the logic to fail as well, and we crash the
    kernel.
    
    There's no reason to have the two DIV_ROUND_UP() (that's just result of
    historical code changes), clean up the code and fix this bug.
    
    Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic")
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit ad7365e6587861a865968667b06e5d7747a2a019
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Thu May 12 11:01:24 2016 -0400

    ring-buffer: Use long for nr_pages to avoid overflow failures
    
    commit 9b94a8fba501f38368aef6ac1b30e7335252a220 upstream.
    
    The size variable to change the ring buffer in ftrace is a long. The
    nr_pages used to update the ring buffer based on the size is int. On 64 bit
    machines this can cause an overflow problem.
    
    For example, the following will cause the ring buffer to crash:
    
     # cd /sys/kernel/debug/tracing
     # echo 10 > buffer_size_kb
     # echo 8556384240 > buffer_size_kb
    
    Then you get the warning of:
    
     WARNING: CPU: 1 PID: 318 at kernel/trace/ring_buffer.c:1527 rb_update_pages+0x22f/0x260
    
    Which is:
    
      RB_WARN_ON(cpu_buffer, nr_removed);
    
    Note each ring buffer page holds 4080 bytes.
    
    This is because:
    
     1) 10 causes the ring buffer to have 3 pages.
        (10kb requires 3 * 4080 pages to hold)
    
     2) (2^31 / 2^10  + 1) * 4080 = 8556384240
        The value written into buffer_size_kb is shifted by 10 and then passed
        to ring_buffer_resize(). 8556384240 * 2^10 = 8761737461760
    
     3) The size passed to ring_buffer_resize() is then divided by BUF_PAGE_SIZE
        which is 4080. 8761737461760 / 4080 = 2147484672
    
     4) nr_pages is subtracted from the current nr_pages (3) and we get:
        2147484669. This value is saved in a signed integer nr_pages_to_update
    
     5) 2147484669 is greater than 2^31 but smaller than 2^32, a signed int
        turns into the value of -2147482627
    
     6) As the value is a negative number, in update_pages_handler() it is
        negated and passed to rb_remove_pages() and 2147482627 pages will
        be removed, which is much larger than 3 and it causes the warning
        because not all the pages asked to be removed were removed.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=118001
    
    Fixes: 7a8e76a3829f1 ("tracing: unified trace buffer")
    Reported-by: Hao Qin <QEver.cn@gmail.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 193f0270474b3cfe9309d1986645f95631b9e415
Author: Paul Burton <paul.burton@imgtec.com>
Date:   Thu Apr 21 14:04:55 2016 +0100

    MIPS: math-emu: Fix jalr emulation when rd == $0
    
    commit ab4a92e66741b35ca12f8497896bafbe579c28a1 upstream.
    
    When emulating a jalr instruction with rd == $0, the code in
    isBranchInstr was incorrectly writing to GPR $0 which should actually
    always remain zeroed. This would lead to any further instructions
    emulated which use $0 operating on a bogus value until the task is next
    context switched, at which point the value of $0 in the task context
    would be restored to the correct zero by a store in SAVE_SOME. Fix this
    by not writing to rd if it is $0.
    
    Fixes: 102cedc32a6e ("MIPS: microMIPS: Floating point support.")
    Signed-off-by: Paul Burton <paul.burton@imgtec.com>
    Cc: Maciej W. Rozycki <macro@imgtec.com>
    Cc: James Hogan <james.hogan@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13160/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f93675ec914d29fdaefb7f6d6bda82359937239d
Author: Lars Persson <lars.persson@axis.com>
Date:   Thu Feb 26 14:16:03 2015 +0100

    MIPS: Fix race condition in lazy cache flushing.
    
    commit 4d46a67a3eb827ccf1125959936fd51ba318dabc upstream.
    
    The lazy cache flushing implemented in the MIPS kernel suffers from a
    race condition that is exposed by do_set_pte() in mm/memory.c.
    
    A pre-condition is a file-system that writes to the page from the CPU
    in its readpage method and then calls flush_dcache_page(). One example
    is ubifs. Another pre-condition is that the dcache flush is postponed
    in __flush_dcache_page().
    
    Upon a page fault for an executable mapping not existing in the
    page-cache, the following will happen:
    1. Write to the page
    2. flush_dcache_page
    3. flush_icache_page
    4. set_pte_at
    5. update_mmu_cache (commits the flush of a dcache-dirty page)
    
    Between steps 4 and 5 another thread can hit the same page and it will
    encounter a valid pte. Because the data still is in the L1 dcache the CPU
    will fetch stale data from L2 into the icache and execute garbage.
    
    This fix moves the commit of the cache flush to step 3 to close the
    race window. It also reduces the amount of flushes on non-executable
    mappings because we never enter __flush_dcache_page() for non-aliasing
    CPUs.
    
    Regressions can occur in drivers that mistakenly relies on the
    flush_dcache_page() in get_user_pages() for DMA operations.
    
    [ralf@linux-mips.org: Folded in patch 9346 to fix highmem issue.]
    
    Signed-off-by: Lars Persson <larper@axis.com>
    Cc: linux-mips@linux-mips.org
    Cc: paul.burton@imgtec.com
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/9346/
    Patchwork: https://patchwork.linux-mips.org/patch/9738/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3e0363f5f8b9c708c040d9346d25291e19d17057
Author: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Date:   Mon Apr 11 16:17:23 2016 -0300

    powerpc/iommu: Remove the dependency on EEH struct in DDW mechanism
    
    commit 8445a87f7092bc8336ea1305be9306f26b846d93 upstream.
    
    Commit 39baadbf36ce ("powerpc/eeh: Remove eeh information from pci_dn")
    changed the pci_dn struct by removing its EEH-related members.
    As part of this clean-up, DDW mechanism was modified to read the device
    configuration address from eeh_dev struct.
    
    As a consequence, now if we disable EEH mechanism on kernel command-line
    for example, the DDW mechanism will fail, generating a kernel oops by
    dereferencing a NULL pointer (which turns to be the eeh_dev pointer).
    
    This patch just changes the configuration address calculation on DDW
    functions to a manual calculation based on pci_dn members instead of
    using eeh_dev-based address.
    
    No functional changes were made. This was tested on pSeries, both
    in PHyp and qemu guest.
    
    Fixes: 39baadbf36ce ("powerpc/eeh: Remove eeh information from pci_dn")
    Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
    Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 36e9dca0cde69c374fdb44d54df3230e2b9f685d
Author: Vik Heyndrickx <vik.heyndrickx@veribox.net>
Date:   Thu Apr 28 20:46:28 2016 +0200

    sched/loadavg: Fix loadavg artifacts on fully idle and on fully loaded systems
    
    commit 20878232c52329f92423d27a60e48b6a6389e0dd upstream.
    
    Systems show a minimal load average of 0.00, 0.01, 0.05 even when they
    have no load at all.
    
    Uptime and /proc/loadavg on all systems with kernels released during the
    last five years up until kernel version 4.6-rc5, show a 5- and 15-minute
    minimum loadavg of 0.01 and 0.05 respectively. This should be 0.00 on
    idle systems, but the way the kernel calculates this value prevents it
    from getting lower than the mentioned values.
    
    Likewise but not as obviously noticeable, a fully loaded system with no
    processes waiting, shows a maximum 1/5/15 loadavg of 1.00, 0.99, 0.95
    (multiplied by number of cores).
    
    Once the (old) load becomes 93 or higher, it mathematically can never
    get lower than 93, even when the active (load) remains 0 forever.
    This results in the strange 0.00, 0.01, 0.05 uptime values on idle
    systems.  Note: 93/2048 = 0.0454..., which rounds up to 0.05.
    
    It is not correct to add a 0.5 rounding (=1024/2048) here, since the
    result from this function is fed back into the next iteration again,
    so the result of that +0.5 rounding value then gets multiplied by
    (2048-2037), and then rounded again, so there is a virtual "ghost"
    load created, next to the old and active load terms.
    
    By changing the way the internally kept value is rounded, that internal
    value equivalent now can reach 0.00 on idle, and 1.00 on full load. Upon
    increasing load, the internally kept load value is rounded up, when the
    load is decreasing, the load value is rounded down.
    
    The modified code was tested on nohz=off and nohz kernels. It was tested
    on vanilla kernel 4.6-rc5 and on centos 7.1 kernel 3.10.0-327. It was
    tested on single, dual, and octal cores system. It was tested on virtual
    hosts and bare hardware. No unwanted effects have been observed, and the
    problems that the patch intended to fix were indeed gone.
    
    Tested-by: Damien Wyart <damien.wyart@free.fr>
    Signed-off-by: Vik Heyndrickx <vik.heyndrickx@veribox.net>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Doug Smythies <dsmythies@telus.net>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Fixes: 0f004f5a696a ("sched: Cure more NO_HZ load average woes")
    Link: http://lkml.kernel.org/r/e8d32bff-d544-7748-72b5-3c86cc71f09f@veribox.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1f38be9e20c23d79648225211331fa291f0ea6ff
Author: wang yanqing <udknight@gmail.com>
Date:   Tue May 3 00:38:36 2016 +0800

    rtlwifi: Fix logic error in enter/exit power-save mode
    
    commit 873ffe154ae074c46ed2d72dbd9a2a99f06f55b4 upstream.
    
    In commit a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and
    rtl_lps_enter() to use work queue"), the tests for enter/exit
    power-save mode were inverted. With this change applied, the
    wifi connection becomes much more stable.
    
    Fixes: a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue")
    Signed-off-by: Wang YanQing <udknight@gmail.com>
    Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    [bwh: Backported to 3.16:
     - We only set a flag here to be used later, but it was also set the wrong way
     - Adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e9c95ab5e76f8385f30ae210493e9429a2d48ce8
Author: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Date:   Thu Apr 28 15:01:10 2016 +0530

    perf tools: Fix perf regs mask generation
    
    commit f47822078dece7189cad0a5f472f148e5e916736 upstream.
    
    On some architectures (powerpc in particular), the number of registers
    exceeds what can be represented in an integer bitmask. Ensure we
    generate the proper bitmask on such platforms.
    
    Fixes: 71ad0f5e4 ("perf tools: Support for DWARF CFI unwinding on post processing")
    Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 481f0e6cd0f9ea1f634f2a3ab7edbc3037dd7dd7
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri May 6 16:47:12 2016 +1000

    powerpc/mm/hash64: Fix subpage protection with 4K HPTE config
    
    commit aac55d7573c5d46ed9a62818d5d3e69dd2060105 upstream.
    
    With Linux page size of 64K and hardware only supporting 4K HPTE, if we
    use subpage protection, we always fail for the subpage 0 as shown
    below (using the selftest subpage_prot test):
    
      520175565:  (4520111850): Failed at 0x3fffad4b0000 (p=13,sp=0,w=0), want=fault, got=pass !
      4520890210: (4520826495): Failed at 0x3fffad5b0000 (p=29,sp=0,w=0), want=fault, got=pass !
      4521574251: (4521510536): Failed at 0x3fffad6b0000 (p=45,sp=0,w=0), want=fault, got=pass !
      4522258324: (4522194609): Failed at 0x3fffad7b0000 (p=61,sp=0,w=0), want=fault, got=pass !
    
    This is because hash preload wrongly inserts the HPTE entry for subpage
    0 without looking at the subpage protection information.
    
    Fix it by teaching should_hash_preload() not to preload if we have
    subpage protection configured for that range.
    
    It appears this has been broken since it was introduced in 2008.
    
    Fixes: fa28237cfcc5 ("[POWERPC] Provide a way to protect 4k subpages when using 64k pages")
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    [mpe: Rework into should_hash_preload() to avoid build fails w/SLICES=n]
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 0ec2d36ec3623d0c58b77e81d79605edc7fded55
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Fri May 6 16:46:00 2016 +1000

    powerpc/mm/hash64: Factor out hash preload psize check
    
    commit 8bbc9b7b001eaab8abf7e9e24edf1bb285c8d825 upstream.
    
    Currently we have a check in hash_preload() against the psize, which is
    only included when CONFIG_PPC_MM_SLICES is enabled. We want to expand
    this check in a subsequent patch, so factor it out to allow that. As a
    bonus it removes the #ifdef in the C code.
    
    Unfortunately we can't put this in the existing CONFIG_PPC_MM_SLICES
    block because it would require a forward declaration.
    
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 282247a847e0015c526cbae89fb02ec1ec01d97d
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 10 23:30:01 2016 +0200

    kbuild: move -Wunused-const-variable to W=1 warning level
    
    commit c9c6837d39311b0cc14cdbe7c18e815ab44aefb1 upstream.
    
    gcc-6 started warning by default about variables that are not
    used anywhere and that are marked 'const', generating many
    false positives in an allmodconfig build, e.g.:
    
    arch/arm/mach-davinci/board-da830-evm.c:282:20: warning: 'da830_evm_emif25_pins' defined but not used [-Wunused-const-variable=]
    arch/arm/plat-omap/dmtimer.c:958:34: warning: 'omap_timer_match' defined but not used [-Wunused-const-variable=]
    drivers/bluetooth/hci_bcm.c:625:39: warning: 'acpi_bcm_default_gpios' defined but not used [-Wunused-const-variable=]
    drivers/char/hw_random/omap-rng.c:92:18: warning: 'reg_map_omap4' defined but not used [-Wunused-const-variable=]
    drivers/devfreq/exynos/exynos5_bus.c:381:32: warning: 'exynos5_busfreq_int_pm' defined but not used [-Wunused-const-variable=]
    drivers/dma/mv_xor.c:1139:34: warning: 'mv_xor_dt_ids' defined but not used [-Wunused-const-variable=]
    
    This is similar to the existing -Wunused-but-set-variable warning
    that was added in an earlier release and that we disable by default
    now and only enable when W=1 is set, so it makes sense to do
    the same here. Once we have eliminated the majority of the
    warnings for both, we can put them back into the default list.
    
    We probably want this in backport kernels as well, to allow building
    them with gcc-6 without introducing extra warnings.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Olof Johansson <olof@lixom.net>
    Acked-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Michal Marek <mmarek@suse.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4ab708b7f74c9dee3c0555fcc3429aff72ecda9c
Author: Julien Grall <julien.grall@arm.com>
Date:   Tue May 10 15:40:31 2016 +0100

    arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
    
    commit f228b494e56d949be8d8ea09d4f973d1979201bf upstream.
    
    The loop that browses the array compat_hwcap_str will stop when a NULL
    is encountered, however NULL is missing at the end of array. This will
    lead to overrun until a NULL is found somewhere in the following memory.
    In reality, this works out because the compat_hwcap2_str array tends to
    follow immediately in memory, and that *is* terminated correctly.
    Furthermore, the unsigned int compat_elf_hwcap is checked before
    printing each capability, so we end up doing the right thing because
    the size of the two arrays is less than 32. Still, this is an obvious
    mistake and should be fixed.
    
    Note for backporting: commit 12d11817eaafa414 ("arm64: Move
    /proc/cpuinfo handling code") moved this code in v4.4. Prior to that
    commit, the same change should be made in arch/arm64/kernel/setup.c.
    
    Fixes: 44b82b7700d0 "arm64: Fix up /proc/cpuinfo"
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e30364e00b5b83889deb635dcc51339da6d1da7a
Author: Will Deacon <will.deacon@arm.com>
Date:   Tue Apr 26 12:00:00 2016 +0100

    irqchip/gic: Ensure ordering between read of INTACK and shared data
    
    commit f86c4fbd930ff6fecf3d8a1c313182bd0f49f496 upstream.
    
    When an IPI is generated by a CPU, the pattern looks roughly like:
    
      <write shared data>
      smp_wmb();
      <write to GIC to signal SGI>
    
    On the receiving CPU we rely on the fact that, once we've taken the
    interrupt, then the freshly written shared data must be visible to us.
    Put another way, the CPU isn't going to speculate taking an interrupt.
    
    Unfortunately, this assumption turns out to be broken.
    
    Consider that CPUx wants to send an IPI to CPUy, which will cause CPUy
    to read some shared_data. Before CPUx has done anything, a random
    peripheral raises an IRQ to the GIC and the IRQ line on CPUy is raised.
    CPUy then takes the IRQ and starts executing the entry code, heading
    towards gic_handle_irq. Furthermore, let's assume that a bunch of the
    previous interrupts handled by CPUy were SGIs, so the branch predictor
    kicks in and speculates that irqnr will be <16 and we're likely to
    head into handle_IPI. The prefetcher then grabs a speculative copy of
    shared_data which contains a stale value.
    
    Meanwhile, CPUx gets round to updating shared_data and asking the GIC
    to send an SGI to CPUy. Internally, the GIC decides that the SGI is
    more important than the peripheral interrupt (which hasn't yet been
    ACKed) but doesn't need to do anything to CPUy, because the IRQ line
    is already raised.
    
    CPUy then reads the ACK register on the GIC, sees the SGI value which
    confirms the branch prediction and we end up with a stale shared_data
    value.
    
    This patch fixes the problem by adding an smp_rmb() to the IPI entry
    code in gic_handle_irq. As it turns out, the combination of a control
    dependency and an ISB instruction from the EOI in the GICv3 driver is
    enough to provide the ordering we need, so we add a comment there
    justifying the absence of an explicit smp_rmb().
    
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    [bwh: Backported to 3.16: drop changes to irq-gic-v3]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 62582a66d5d3f436cfae65052f6c2a97f5a23c2b
Author: Heiko Carstens <heiko.carstens@de.ibm.com>
Date:   Tue May 10 12:10:22 2016 +0200

    s390/vmem: fix identity mapping
    
    commit c34a69059d7876e0793eb410deedfb08ccb22b02 upstream.
    
    The identity mapping is suboptimal for the last 2GB frame. The mapping
    will be established with a mix of 4KB and 1MB mappings instead of a
    single 2GB mapping.
    
    This happens because of a off-by-one bug introduced with
    commit 50be63450728 ("s390/mm: Convert bootmem to memblock").
    
    Currently the identity mapping looks like this:
    
    0x0000000080000000-0x0000000180000000        4G PUD RW
    0x0000000180000000-0x00000001fff00000     2047M PMD RW
    0x00000001fff00000-0x0000000200000000        1M PTE RW
    
    With the bug fixed it looks like this:
    
    0x0000000080000000-0x0000000200000000        6G PUD RW
    
    Fixes: 50be63450728 ("s390/mm: Convert bootmem to memblock")
    Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fe5f901ac8ac850f261e1923bfa272ccbc9f53ec
Author: Mans Rullgard <mans@mansr.com>
Date:   Tue Apr 26 12:03:02 2016 +0300

    ata: sata_dwc_460ex: remove incorrect locking
    
    commit 55e610cdd28c0ad3dce0652030c0296d549673f3 upstream.
    
    This lock is already taken in ata_scsi_queuecmd() a few levels up the
    call stack so attempting to take it here is an error.  Moreover, it is
    pointless in the first place since it only protects a single, atomic
    assignment.
    
    Enabling lock debugging gives the following output:
    
    =============================================
    [ INFO: possible recursive locking detected ]
    4.4.0-rc5+ #189 Not tainted
    ---------------------------------------------
    kworker/u2:3/37 is trying to acquire lock:
     (&(&host->lock)->rlock){-.-...}, at: [<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
    
    but task is already holding lock:
     (&(&host->lock)->rlock){-.-...}, at: [<902761ac>] ata_scsi_queuecmd+0x2c/0x330
    
    other info that might help us debug this:
     Possible unsafe locking scenario:
    
           CPU0
           ----
      lock(&(&host->lock)->rlock);
      lock(&(&host->lock)->rlock);
    
     *** DEADLOCK ***
     May be due to missing lock nesting notation
    
    4 locks held by kworker/u2:3/37:
     #0:  ("events_unbound"){.+.+.+}, at: [<9003a0a4>] process_one_work+0x12c/0x430
     #1:  ((&entry->work)){+.+.+.}, at: [<9003a0a4>] process_one_work+0x12c/0x430
     #2:  (&bdev->bd_mutex){+.+.+.}, at: [<9011fd54>] __blkdev_get+0x50/0x380
     #3:  (&(&host->lock)->rlock){-.-...}, at: [<902761ac>] ata_scsi_queuecmd+0x2c/0x330
    
    stack backtrace:
    CPU: 0 PID: 37 Comm: kworker/u2:3 Not tainted 4.4.0-rc5+ #189
    Workqueue: events_unbound async_run_entry_fn
    Stack : 90b38e30 00000021 00000003 9b2a6040 00000000 9005f3f0 904fc8dc 00000025
            906b96e4 00000000 90528648 9b3336c4 904fc8dc 9009bf18 00000002 00000004
            00000000 00000000 9b3336c4 9b3336e4 904fc8dc 9003d074 00000000 90500000
            9005e738 00000000 00000000 00000000 00000000 00000000 00000000 00000000
            6e657665 755f7374 756f626e 0000646e 00000000 00000000 9b00ca00 9b025000
              ...
    Call Trace:
    [<90009d6c>] show_stack+0x88/0xa4
    [<90057744>] __lock_acquire+0x1ce8/0x2154
    [<900583e4>] lock_acquire+0x64/0x8c
    [<9045ff10>] _raw_spin_lock_irqsave+0x54/0x78
    [<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
    [<90283484>] sata_dwc_qc_issue+0x1a8/0x24c
    [<9026b39c>] ata_qc_issue+0x1f0/0x410
    [<90273c6c>] ata_scsi_translate+0xb4/0x200
    [<90276234>] ata_scsi_queuecmd+0xb4/0x330
    [<9025800c>] scsi_dispatch_cmd+0xd0/0x128
    [<90259934>] scsi_request_fn+0x58c/0x638
    [<901a3e50>] __blk_run_queue+0x40/0x5c
    [<901a83d4>] blk_queue_bio+0x27c/0x28c
    [<901a5914>] generic_make_request+0xf0/0x188
    [<901a5a54>] submit_bio+0xa8/0x194
    [<9011adcc>] submit_bh_wbc.isra.23+0x15c/0x17c
    [<9011c908>] block_read_full_page+0x3e4/0x428
    [<9009e2e0>] do_read_cache_page+0xac/0x210
    [<9009fd90>] read_cache_page+0x18/0x24
    [<901bbd18>] read_dev_sector+0x38/0xb0
    [<901bd174>] msdos_partition+0xb4/0x5c0
    [<901bcb8c>] check_partition+0x140/0x274
    [<901bba60>] rescan_partitions+0xa0/0x2b0
    [<9011ff68>] __blkdev_get+0x264/0x380
    [<901201ac>] blkdev_get+0x128/0x36c
    [<901b9378>] add_disk+0x3c0/0x4bc
    [<90268268>] sd_probe_async+0x100/0x224
    [<90043a44>] async_run_entry_fn+0x50/0x124
    [<9003a11c>] process_one_work+0x1a4/0x430
    [<9003a4f4>] worker_thread+0x14c/0x4fc
    [<900408f4>] kthread+0xd0/0xe8
    [<90004338>] ret_from_kernel_thread+0x14/0x1c
    
    Fixes: 62936009f35a ("[libata] Add 460EX on-chip SATA driver, sata_dwc_460ex")
    Tested-by: Christian Lamparter <chunkeey@googlemail.com>
    Signed-off-by: Mans Rullgard <mans@mansr.com>
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3c3e6b5e2b26652fe00abd086f46dd4c61172981
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Mon Apr 25 17:35:30 2016 +0200

    gcov: disable tree-loop-im to reduce stack usage
    
    commit c87bf431448b404a6ef5fbabd74c0e3e42157a7f upstream.
    
    Enabling CONFIG_GCOV_PROFILE_ALL produces us a lot of warnings like
    
    lib/lz4/lz4hc_compress.c: In function 'lz4_compresshcctx':
    lib/lz4/lz4hc_compress.c:514:1: warning: the frame size of 1504 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    
    After some investigation, I found that this behavior started with gcc-4.9,
    and opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69702.
    A suggested workaround for it is to use the -fno-tree-loop-im
    flag that turns off one of the optimization stages in gcc, so the
    code runs a little slower but does not use excessive amounts
    of stack.
    
    We could make this conditional on the gcc version, but I could not
    find an easy way to do this in Kbuild and the benefit would be
    fairly small, given that most of the gcc version in production are
    affected now.
    
    I'm marking this for 'stable' backports because it addresses a bug
    with code generation in gcc that exists in all kernel versions
    with the affected gcc releases.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
    Signed-off-by: Michal Marek <mmarek@suse.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9b1f40aabc0acd54f7bb9e1a463bb1439c7b3bb6
Author: James Hogan <james.hogan@imgtec.com>
Date:   Fri Apr 22 10:38:46 2016 +0100

    MIPS: KVM: Fix timer IRQ race when writing CP0_Compare
    
    commit b45bacd2d048f405c7760e5cc9b60dd67708734f upstream.
    
    Writing CP0_Compare clears the timer interrupt pending bit
    (CP0_Cause.TI), but this wasn't being done atomically. If a timer
    interrupt raced with the write of the guest CP0_Compare, the timer
    interrupt could end up being pending even though the new CP0_Compare is
    nowhere near CP0_Count.
    
    We were already updating the hrtimer expiry with
    kvm_mips_update_hrtimer(), which used both kvm_mips_freeze_hrtimer() and
    kvm_mips_resume_hrtimer(). Close the race window by expanding out
    kvm_mips_update_hrtimer(), and clearing CP0_Cause.TI and setting
    CP0_Compare between the freeze and resume. Since the pending timer
    interrupt should not be cleared when CP0_Compare is written via the KVM
    user API, an ack argument is added to distinguish the source of the
    write.
    
    Fixes: e30492bbe95a ("MIPS: KVM: Rewrite count/compare timer emulation")
    Signed-off-by: James Hogan <james.hogan@imgtec.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: "Radim Krčmář" <rkrcmar@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [bwh: Backported to 3.16: adjust filenames]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 75b5b632f4cb234c54ec6b8740390f8c9372ebc7
Author: James Hogan <james.hogan@imgtec.com>
Date:   Fri Apr 22 10:38:45 2016 +0100

    MIPS: KVM: Fix timer IRQ race when freezing timer
    
    commit 4355c44f063d3de4f072d796604c7f4ba4085cc3 upstream.
    
    There's a particularly narrow and subtle race condition when the
    software emulated guest timer is frozen which can allow a guest timer
    interrupt to be missed.
    
    This happens due to the hrtimer expiry being inexact, so very
    occasionally the freeze time will be after the moment when the emulated
    CP0_Count transitions to the same value as CP0_Compare (so an IRQ should
    be generated), but before the moment when the hrtimer is due to expire
    (so no IRQ is generated). The IRQ won't be generated when the timer is
    resumed either, since the resume CP0_Count will already match CP0_Compare.
    
    With VZ guests in particular this is far more likely to happen, since
    the soft timer may be frozen frequently in order to restore the timer
    state to the hardware guest timer. This happens after 5-10 hours of
    guest soak testing, resulting in an overflow in guest kernel timekeeping
    calculations, hanging the guest. A more focussed test case to
    intentionally hit the race (with the help of a new hypcall to cause the
    timer state to migrated between hardware & software) hits the condition
    fairly reliably within around 30 seconds.
    
    Instead of relying purely on the inexact hrtimer expiry to determine
    whether an IRQ should be generated, read the guest CP0_Compare and
    directly check whether the freeze time is before or after it. Only if
    CP0_Count is on or after CP0_Compare do we check the hrtimer expiry to
    determine whether the last IRQ has already been generated (which will
    have pushed back the expiry by one timer period).
    
    Fixes: e30492bbe95a ("MIPS: KVM: Rewrite count/compare timer emulation")
    Signed-off-by: James Hogan <james.hogan@imgtec.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: "Radim Krčmář" <rkrcmar@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [bwh: Backported to 3.16: adjust filename]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 715d7e59afed7adc409ed74d639f8a0bcd2c4b91
Author: Johan Hovold <johan@kernel.org>
Date:   Sun May 8 20:08:02 2016 +0200

    USB: serial: quatech2: fix use-after-free in probe error path
    
    commit 028c49f5e02a257c94129cd815f7c8485f51d4ef upstream.
    
    The interface read URB is submitted in attach, but was only unlinked by
    the driver at disconnect.
    
    In case of a late probe error (e.g. due to failed minor allocation),
    disconnect is never called and we would end up with active URBs for an
    unbound interface. This in turn could lead to deallocated memory being
    dereferenced in the completion callback.
    
    Fixes: f7a33e608d9a ("USB: serial: add quatech2 usb to serial driver")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f7336d69bb05341ff3dcf366cfdfc4cbd3770eda
Author: Johan Hovold <johan@kernel.org>
Date:   Sun May 8 20:08:01 2016 +0200

    USB: serial: mxuport: fix use-after-free in probe error path
    
    commit 9e45284984096314994777f27e1446dfbfd2f0d7 upstream.
    
    The interface read and event URBs are submitted in attach, but were
    never explicitly unlinked by the driver. Instead the URBs would have
    been killed by usb-serial core on disconnect.
    
    In case of a late probe error (e.g. due to failed minor allocation),
    disconnect is never called and we could end up with active URBs for an
    unbound interface. This in turn could lead to deallocated memory being
    dereferenced in the completion callbacks.
    
    Fixes: ee467a1f2066 ("USB: serial: add Moxa UPORT 12XX/14XX/16XX
    driver")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d0d86631d0070f62cc9b9d2dd1516819649bf6f4
Author: Johan Hovold <johan@kernel.org>
Date:   Sun May 8 20:07:58 2016 +0200

    USB: serial: keyspan: fix use-after-free in probe error path
    
    commit 35be1a71d70775e7bd7e45fa6d2897342ff4c9d2 upstream.
    
    The interface instat and indat URBs were submitted in attach, but never
    unlinked in release before deallocating the corresponding transfer
    buffers.
    
    In the case of a late probe error (e.g. due to failed minor allocation),
    disconnect would not have been called before release, causing the
    buffers to be freed while the URBs are still in use. We'd also end up
    with active URBs for an unbound interface.
    
    Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
    release")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5533ca0b4d5453c3639cb906485d370612b5a1e4
Author: Johan Hovold <johan@kernel.org>
Date:   Sun May 8 20:07:57 2016 +0200

    USB: serial: io_edgeport: fix memory leaks in probe error path
    
    commit c8d62957d450cc1a22ce3242908709fe367ddc8e upstream.
    
    URBs and buffers allocated in attach for Epic devices would never be
    deallocated in case of a later probe error (e.g. failure to allocate
    minor numbers) as disconnect is then never called.
    
    Fix by moving deallocation to release and making sure that the
    URBs are first unlinked.
    
    Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
    release")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6702ecbd1f46f22c00ac3f63c2a5cd5831e148ca
Author: Johan Hovold <johan@kernel.org>
Date:   Sun May 8 20:07:56 2016 +0200

    USB: serial: io_edgeport: fix memory leaks in attach error path
    
    commit c5c0c55598cefc826d6cfb0a417eeaee3631715c upstream.
    
    Private data, URBs and buffers allocated for Epic devices during
    attach were never released on errors (e.g. missing endpoints).
    
    Fixes: 6e8cf7751f9f ("USB: add EPIC support to the io_edgeport driver")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c68ac8bfdea4f9a25a203c5fd02cf27bf1cfd262
Author: Joshua Kinard <kumba@gentoo.org>
Date:   Mon Sep 7 06:42:30 2015 -0400

    MIPS: Adjust set_pte() SMP fix to handle R10000_LLSC_WAR
    
    commit 128639395b2ceacc6a56a0141d0261012bfe04d3 upstream.
    
    Update the recent changes to set_pte() that were added in 46011e6ea392
    to handle R10000_LLSC_WAR, and format the assembly to match other areas
    of the MIPS tree using the same WAR.
    
    This also incorporates a patch recently sent in my Markos Chandras,
    "Remove local LL/SC preprocessor variants", so that patch doesn't need
    to be applied if this one is accepted.
    
    Signed-off-by: Joshua Kinard <kumba@gentoo.org>
    Fixes: 46011e6ea392 ("MIPS: Make set_pte() SMP safe.)
    Cc: David Daney <david.daney@cavium.com>
    Cc: Linux/MIPS <linux-mips@linux-mips.org>
    Patchwork: https://patchwork.linux-mips.org/patch/11103/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    [bwh: Backported to 3.2:
     - Use {LL,SC}_INSN not __{LL,SC}
     - Use literal arch=r4000 instead of MIPS_ISA_ARCH_LEVEL since R6 is not
       supported]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit de1165ffe885611fc0fa538fe34187c332046621
Author: James Hogan <james.hogan@imgtec.com>
Date:   Fri Dec 4 22:25:02 2015 +0000

    MIPS: Avoid using unwind_stack() with usermode
    
    commit 81a76d7119f63c359750e4adeff922a31ad1135f upstream.
    
    When showing backtraces in response to traps, for example crashes and
    address errors (usually unaligned accesses) when they are set in debugfs
    to be reported, unwind_stack will be used if the PC was in the kernel
    text address range. However since EVA it is possible for user and kernel
    address ranges to overlap, and even without EVA userland can still
    trigger an address error by jumping to a KSeg0 address.
    
    Adjust the check to also ensure that it was running in kernel mode. I
    don't believe any harm can come of this problem, since unwind_stack() is
    sufficiently defensive, however it is only meant for unwinding kernel
    code, so to be correct it should use the raw backtracing instead.
    
    Signed-off-by: James Hogan <james.hogan@imgtec.com>
    Reviewed-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/11701/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    (cherry picked from commit d2941a975ac745c607dfb590e92bb30bc352dad9)
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 5071c7683a63d968c5ee6a8ab7e48c852bb10bca
Author: James Hogan <james.hogan@imgtec.com>
Date:   Fri Dec 4 22:25:01 2015 +0000

    MIPS: Don't unwind to user mode with EVA
    
    commit a816b306c62195b7c43c92cb13330821a96bdc27 upstream.
    
    When unwinding through IRQs and exceptions, the unwinding only continues
    if the PC is a kernel text address, however since EVA it is possible for
    user and kernel address ranges to overlap, potentially allowing
    unwinding to continue to user mode if the user PC happens to be in the
    kernel text address range.
    
    Adjust the check to also ensure that the register state from before the
    exception is actually running in kernel mode, i.e. !user_mode(regs).
    
    I don't believe any harm can come of this problem, since the PC is only
    output, the stack pointer is checked to ensure it resides within the
    task's stack page before it is dereferenced in search of the return
    address, and the return address register is similarly only output (if
    the PC is in a leaf function or the beginning of a non-leaf function).
    
    However unwind_stack() is only meant for unwinding kernel code, so to be
    correct the unwind should stop there.
    
    Signed-off-by: James Hogan <james.hogan@imgtec.com>
    Reviewed-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/11700/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9048155b6cdac0174c310853ab8f3d3647f8b69e
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Fri Jan 29 21:17:26 2016 -0800

    MIPS: BMIPS: Fix PRID_IMP_BMIPS5000 masking for BMIPS5200
    
    commit cbbda6e7c9c3e4532bd70a73ff9d5e6655c894dc upstream.
    
    BMIPS5000 have a PrID value of 0x5A00 and BMIPS5200 have a PrID value of
    0x5B00, which, masked with 0x5A00, returns 0x5A00. Update all conditionals on
    the PrID to cover both variants since we are going to need this to enable
    BMIPS5200 SMP. The existing check, masking with 0xFF00 would not cover
    BMIPS5200 at all.
    
    Fixes: 68e6a78373a6d ("MIPS: BMIPS: Add PRId for BMIPS5200 (Whirlwind)")
    Fixes: 6465460c92a85 ("MIPS: BMIPS: change compile time checks to runtime checks")
    Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
    Cc: john@phrozen.org
    Cc: cernekee@gmail.com
    Cc: jogo@openwrt.org
    Cc: jaedon.shin@gmail.com
    Cc: jfraser@broadcom.com
    Cc: pgynther@google.com
    Cc: dragan.stancevic@gmail.com
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/12279/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b08e6475eedecda4cb925db0a15d05847495e54f
Author: James Hogan <james.hogan@imgtec.com>
Date:   Mon Feb 8 18:43:49 2016 +0000

    MIPS: Fix siginfo.h to use strict posix types
    
    commit 5daebc477da4dfeb31ae193d83084def58fd2697 upstream.
    
    Commit 85efde6f4e0d ("make exported headers use strict posix types")
    changed the asm-generic siginfo.h to use the __kernel_* types, and
    commit 3a471cbc081b ("remove __KERNEL_STRICT_NAMES") make the internal
    types accessible only to the kernel, but the MIPS implementation hasn't
    been updated to match.
    
    Switch to proper types now so that the exported asm/siginfo.h won't
    produce quite so many compiler errors when included alone by a user
    program.
    
    Signed-off-by: James Hogan <james.hogan@imgtec.com>
    Cc: Christopher Ferris <cferris@google.com>
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/12477/
    Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 32cc9cbdd974a24119853f1332e75d5ff1cf7424
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Fri May 6 09:27:16 2016 +0200

    ARM: dts: exynos: Add interrupt line to MAX8997 PMIC on exynos4210-trats
    
    commit 330d12764e15f6e3e94ff34cda29db96d2589c24 upstream.
    
    MAX8997 PMIC requires interrupt and fails probing without it.
    
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Fixes: d105f0b1215d ("ARM: dts: Add basic dts file for Samsung Trats board")
    [k.kozlowski: Write commit message, add CC-stable]
    Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    [bwh: Backported to 3.16: adjust indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 4dae62273856f4d31b0d157a66c15cacdcb926e4
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Thu May 5 10:44:02 2016 +0100

    arm64: Ensure pmd_present() returns false after pmd_mknotpresent()
    
    commit 5bb1cc0ff9a6b68871970737e6c4c16919928d8b upstream.
    
    Currently, pmd_present() only checks for a non-zero value, returning
    true even after pmd_mknotpresent() (which only clears the type bits).
    This patch converts pmd_present() to using pte_present(), similar to the
    other pmd_*() checks. As a side effect, it will return true for
    PROT_NONE mappings, though they are not yet used by the kernel with
    transparent huge pages.
    
    For consistency, also change pmd_mknotpresent() to only clear the
    PMD_SECT_VALID bit, even though the PMD_TABLE_BIT is already 0 for block
    mappings (no functional change). The unused PMD_SECT_PROT_NONE
    definition is removed as transparent huge pages use the pte page prot
    values.
    
    Fixes: 9c7e535fcc17 ("arm64: mm: Route pmd thp functions through pte equivalents")
    Reviewed-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c27d67c8d49860cb70bb9b3c016733e9f780d289
Author: Jan Kara <jack@suse.cz>
Date:   Thu May 5 11:10:15 2016 -0400

    ext4: fix oops on corrupted filesystem
    
    commit 74177f55b70e2f2be770dd28684dd6d17106a4ba upstream.
    
    When filesystem is corrupted in the right way, it can happen
    ext4_mark_iloc_dirty() in ext4_orphan_add() returns error and we
    subsequently remove inode from the in-memory orphan list. However this
    deletion is done with list_del(&EXT4_I(inode)->i_orphan) and thus we
    leave i_orphan list_head with a stale content. Later we can look at this
    content causing list corruption, oops, or other issues. The reported
    trace looked like:
    
    WARNING: CPU: 0 PID: 46 at lib/list_debug.c:53 __list_del_entry+0x6b/0x100()
    list_del corruption, 0000000061c1d6e0->next is LIST_POISON1
    0000000000100100)
    CPU: 0 PID: 46 Comm: ext4.exe Not tainted 4.1.0-rc4+ #250
    Stack:
     60462947 62219960 602ede24 62219960
     602ede24 603ca293 622198f0 602f02eb
     62219950 6002c12c 62219900 601b4d6b
    Call Trace:
     [<6005769c>] ? vprintk_emit+0x2dc/0x5c0
     [<602ede24>] ? printk+0x0/0x94
     [<600190bc>] show_stack+0xdc/0x1a0
     [<602ede24>] ? printk+0x0/0x94
     [<602ede24>] ? printk+0x0/0x94
     [<602f02eb>] dump_stack+0x2a/0x2c
     [<6002c12c>] warn_slowpath_common+0x9c/0xf0
     [<601b4d6b>] ? __list_del_entry+0x6b/0x100
     [<6002c254>] warn_slowpath_fmt+0x94/0xa0
     [<602f4d09>] ? __mutex_lock_slowpath+0x239/0x3a0
     [<6002c1c0>] ? warn_slowpath_fmt+0x0/0xa0
     [<60023ebf>] ? set_signals+0x3f/0x50
     [<600a205a>] ? kmem_cache_free+0x10a/0x180
     [<602f4e88>] ? mutex_lock+0x18/0x30
     [<601b4d6b>] __list_del_entry+0x6b/0x100
     [<601177ec>] ext4_orphan_del+0x22c/0x2f0
     [<6012f27c>] ? __ext4_journal_start_sb+0x2c/0xa0
     [<6010b973>] ? ext4_truncate+0x383/0x390
     [<6010bc8b>] ext4_write_begin+0x30b/0x4b0
     [<6001bb50>] ? copy_from_user+0x0/0xb0
     [<601aa840>] ? iov_iter_fault_in_readable+0xa0/0xc0
     [<60072c4f>] generic_perform_write+0xaf/0x1e0
     [<600c4166>] ? file_update_time+0x46/0x110
     [<60072f0f>] __generic_file_write_iter+0x18f/0x1b0
     [<6010030f>] ext4_file_write_iter+0x15f/0x470
     [<60094e10>] ? unlink_file_vma+0x0/0x70
     [<6009b180>] ? unlink_anon_vmas+0x0/0x260
     [<6008f169>] ? free_pgtables+0xb9/0x100
     [<600a6030>] __vfs_write+0xb0/0x130
     [<600a61d5>] vfs_write+0xa5/0x170
     [<600a63d6>] SyS_write+0x56/0xe0
     [<6029fcb0>] ? __libc_waitpid+0x0/0xa0
     [<6001b698>] handle_syscall+0x68/0x90
     [<6002633d>] userspace+0x4fd/0x600
     [<6002274f>] ? save_registers+0x1f/0x40
     [<60028bd7>] ? arch_prctl+0x177/0x1b0
     [<60017bd5>] fork_handler+0x85/0x90
    
    Fix the problem by using list_del_init() as we always should with
    i_orphan list.
    
    Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 37d5d109db8aea4a5cdb3b11abf6aaf0f5d05d86
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu May 5 16:23:04 2016 +0300

    ACPI / sysfs: fix error code in get_status()
    
    commit f18ebc211e259d4f591e39e74b2aa2de226c9a1d upstream.
    
    The problem with ornamental, do-nothing gotos is that they lead to
    "forgot to set the error code" bugs.  We should be returning -EINVAL
    here but we don't.  It leads to an uninitalized variable in
    counter_show():
    
        drivers/acpi/sysfs.c:603 counter_show()
        error: uninitialized symbol 'status'.
    
    Fixes: 1c8fce27e275 (ACPI: introduce drivers/acpi/sysfs.c)
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit efabb40853ad5b423ead04e2be9a33cfb37edc82
Author: Sai Gurrappadi <sgurrappadi@nvidia.com>
Date:   Fri Apr 29 14:44:37 2016 -0700

    cpufreq: Fix GOV_LIMITS handling for the userspace governor
    
    commit e43e94c1eda76dabd686ddf6f7825f54d747b310 upstream.
    
    Currently, the userspace governor only updates frequency on GOV_LIMITS
    if policy->cur falls outside policy->{min/max}. However, it is also
    necessary to update current frequency on GOV_LIMITS to match the user
    requested value if it can be achieved within the new policy->{max/min}.
    
    This was previously the behaviour in the governor until commit d1922f0
    ("cpufreq: Simplify userspace governor") which incorrectly assumed that
    policy->cur == user requested frequency via scaling_setspeed. This won't
    be true if the user requested frequency falls outside policy->{min/max}.
    Ex: a temporary thermal cap throttled the user requested frequency.
    
    Fix this by storing the user requested frequency in a seperate variable.
    The governor will then try to achieve this request on every GOV_LIMITS
    change.
    
    Fixes: d1922f02562f (cpufreq: Simplify userspace governor)
    Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit dfba23e28a55079aa004838ae9a1729ef05cf5c4
Author: Lei Liu <lei35151@163.com>
Date:   Wed May 4 16:34:22 2016 +0800

    USB: serial: option: add even more ZTE device ids
    
    commit 74d2a91aec97ab832790c9398d320413ad185321 upstream.
    
    Add even more ZTE device ids.
    
    Signed-off-by: lei liu <liu.lei78@zte.com.cn>
    [johan: rebase and replace commit message ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9ec00b81628c52f7c3f5d28e079038ebb21ac206
Author: lei liu <liu.lei78@zte.com.cn>
Date:   Tue May 3 14:44:19 2016 -0700

    USB: serial: option: add more ZTE device ids
    
    commit f0d09463c59c2d764a6c6d492cbe6d2c77f27153 upstream.
    
    More ZTE device ids.
    
    Signed-off-by: lei liu <liu.lei78@zte.com.cn>
    [properly sort them - gregkh]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 360b065e77e84b083eb20fbce57d22205827e90f
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Tue May 3 17:05:54 2016 +0200

    tty: vt, return error when con_startup fails
    
    commit 6798df4c5fe0a7e6d2065cf79649a794e5ba7114 upstream.
    
    When csw->con_startup() fails in do_register_con_driver, we return no
    error (i.e. 0). This was changed back in 2006 by commit 3e795de763.
    Before that we used to return -ENODEV.
    
    So fix the return value to be -ENODEV in that case again.
    
    Fixes: 3e795de763 ("VT binding: Add binding/unbinding support for the VT console")
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Reported-by: "Dan Carpenter" <dan.carpenter@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 096eb844e733d132601f5cb5e220eea2854df034
Author: Andreas Werner <andreas.werner@men.de>
Date:   Tue May 3 12:42:00 2016 +0200

    mcb: Fixed bar number assignment for the gdd
    
    commit f75564d343010b025301d9548f2304f48eb25f01 upstream.
    
    The bar number is found in reg2 within the gdd. Therefore
    we need to change the assigment from reg1 to reg2 which
    is the correct location.
    
    Signed-off-by: Andreas Werner <andreas.werner@men.de>
    Fixes: '3764e82e5' drivers: Introduce MEN Chameleon Bus
    Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 249dc9948ca6e5994eb6b0a80a04f10bed0ae903
Author: Schemmel Hans-Christoph <Hans-Christoph.Schemmel@gemalto.com>
Date:   Fri Apr 29 08:51:06 2016 +0000

    USB: serial: option: add support for Cinterion PH8 and AHxx
    
    commit 444f94e9e625f6ec6bbe2cb232a6451c637f35a3 upstream.
    
    Added support for Gemalto's Cinterion PH8 and AHxx products
    with 2 RmNet Interfaces and products with 1 RmNet + 1 USB Audio interface.
    
    In addition some minor renaming and formatting.
    
    Signed-off-by: Hans-Christoph Schemmel <hans-christoph.schemmel@gemalto.com>
    [johan: sort current entries and trim trailing whitespace ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 84fb87cb3ee0c1208977e70b8a92b129f4ea828b
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Thu Mar 24 22:19:40 2016 +0100

    driver-core: use 'dev' argument in dev_dbg_ratelimited stub
    
    commit 1f62ff34a90471d1b735bac2c79e894afc7c59bc upstream.
    
    dev_dbg_ratelimited() is a macro that ignores its first argument when DEBUG is
    not set, which can lead to unused variable warnings:
    
    ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle':
    ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable]
    ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle':
    ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable]
    
    The macro already ensures that all its other arguments are silently
    ignored by the compiler without triggering a warning, through the
    use of the no_printk() macro, but the dev argument is not passed into
    that.
    
    This changes the definition to use the same trick as no_printk() with
    an if(0) that leads the compiler to not evaluate the side-effects but
    still see that 'dev' might not be unused.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Suggested-by: Andrew Lunn <andrew@lunn.ch>
    Fixes: 6f586e663e3b ("driver-core: Shut up dev_dbg_reatelimited() without DEBUG")
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a3fc1dcf89c543f6bc084f43b29c42d3c9cd4058
Author: Geert Uytterhoeven <geert@linux-m68k.org>
Date:   Mon Apr 11 10:40:55 2016 +0200

    char: Drop bogus dependency of DEVPORT on !M68K
    
    commit 309124e2648d668a0c23539c5078815660a4a850 upstream.
    
    According to full-history-linux commit d3794f4fa7c3edc3 ("[PATCH] M68k
    update (part 25)"), port operations are allowed on m68k if CONFIG_ISA is
    defined.
    
    However, commit 153dcc54df826d2f ("[PATCH] mem driver: fix conditional
    on isa i/o support") accidentally changed an "||" into an "&&",
    disabling it completely on m68k. This logic was retained when
    introducing the DEVPORT symbol in commit 4f911d64e04a44c4 ("Make
    /dev/port conditional on config symbol").
    
    Drop the bogus dependency on !M68K to fix this.
    
    Fixes: 153dcc54df826d2f ("[PATCH] mem driver: fix conditional on isa i/o support")
    Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Tested-by: Al Stone <ahs3@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 2554b504bfdae9a0d3a44d7a9aad521c6c7b9b8a
Author: Brian Bloniarz <brian.bloniarz@gmail.com>
Date:   Sun Mar 6 13:16:30 2016 -0800

    Fix OpenSSH pty regression on close
    
    commit 0f40fbbcc34e093255a2b2d70b6b0fb48c3f39aa upstream.
    
    OpenSSH expects the (non-blocking) read() of pty master to return
    EAGAIN only if it has received all of the slave-side output after
    it has received SIGCHLD. This used to work on pre-3.12 kernels.
    
    This fix effectively forces non-blocking read() and poll() to
    block for parallel i/o to complete for all ttys. It also unwinds
    these changes:
    
    1) f8747d4a466ab2cafe56112c51b3379f9fdb7a12
       tty: Fix pty master read() after slave closes
    
    2) 52bce7f8d4fc633c9a9d0646eef58ba6ae9a3b73
       pty, n_tty: Simplify input processing on final close
    
    3) 1a48632ffed61352a7810ce089dc5a8bcd505a60
       pty: Fix input race when closing
    
    Inspired by analysis and patch from Marc Aurele La France <tsi@tuyoix.net>
    
    Reported-by: Volth <openssh@volth.com>
    Reported-by: Marc Aurele La France <tsi@tuyoix.net>
    BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=52
    BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=2492
    Signed-off-by: Brian Bloniarz <brian.bloniarz@gmail.com>
    Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.16:
     - No need to unwind commits 2 and 3
     - Keep using tty_flush_to_ldisc() rather than adding tty_buffer_flush_work()]]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 402c92248d5cfc025152aec25e1ecf641d4d0d69
Author: Peter Hurley <peter@hurleysoftware.com>
Date:   Tue Dec 30 07:17:09 2014 -0500

    Revert "tty: Fix pty master poll() after slave closes v2"
    
    commit 2ce3c10c0c3e0d418c1a7a4c838319ba42c75388 upstream.
    
    This reverts commit c4dc304677e8d566572c4738d95c48be150c6606.
    This fix is superseded by commit 52bce7f8d4fc633c9a9d0646eef58ba6ae9a3b73,
    'pty, n_tty: Simplify input processing on final close'.
    
    The final close now waits for input processing to complete before
    destroying the pty, so poll() does not need to special case this
    condition.
    
    Cc: Francesco Ruggeri <fruggeri@arista.com>
    Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d443308d857345ebeab5ddc353cdae292be5e5df
Author: Matthias Schiffer <mschiffer@universe-factory.net>
Date:   Thu Mar 24 16:02:52 2016 +0100

    MIPS: ath79: make bootconsole wait for both THRE and TEMT
    
    commit f5b556c94c8490d42fea79d7b4ae0ecbc291e69d upstream.
    
    This makes the ath79 bootconsole behave the same way as the generic 8250
    bootconsole.
    
    Also waiting for TEMT (transmit buffer is empty) instead of just THRE
    (transmit buffer is not full) ensures that all characters have been
    transmitted before the real serial driver starts reconfiguring the serial
    controller (which would sometimes result in garbage being transmitted.)
    This change does not cause a visible performance loss.
    
    In addition, this seems to fix a hang observed in certain configurations on
    many AR7xxx/AR9xxx SoCs during autoconfig of the real serial driver.
    
    A more complete follow-up patch will disable 8250 autoconfig for ath79
    altogether (the serial controller is detected as a 16550A, which is not
    fully compatible with the ath79 serial, and the autoconfig may lead to
    undefined behavior on ath79.)
    
    Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9de12e452fcbbc14da4647ffed24205870c9f3d4
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Sat Apr 30 00:49:54 2016 -0400

    ext4: clean up error handling when orphan list is corrupted
    
    commit 7827a7f6ebfcb7f388dc47fddd48567a314701ba upstream.
    
    Instead of just printing warning messages, if the orphan list is
    corrupted, declare the file system is corrupted.  If there are any
    reserved inodes in the orphaned inode list, declare the file system
    corrupted and stop right away to avoid doing more potential damage to
    the file system.
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    [bwh: Backported to 3.16: leave error code as EIO]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 29cc7c13850b1e209a093ac6e862e48f14056f87
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Sat Apr 30 00:48:54 2016 -0400

    ext4: fix hang when processing corrupted orphaned inode list
    
    commit c9eb13a9105e2e418f72e46a2b6da3f49e696902 upstream.
    
    If the orphaned inode list contains inode #5, ext4_iget() returns a
    bad inode (since the bootloader inode should never be referenced
    directly).  Because of the bad inode, we end up processing the inode
    repeatedly and this hangs the machine.
    
    This can be reproduced via:
    
       mke2fs -t ext4 /tmp/foo.img 100
       debugfs -w -R "ssv last_orphan 5" /tmp/foo.img
       mount -o loop /tmp/foo.img /mnt
    
    (But don't do this if you are using an unpatched kernel if you care
    about the system staying functional.  :-)
    
    This bug was found by the port of American Fuzzy Lop into the kernel
    to find file system problems[1].  (Since it *only* happens if inode #5
    shows up on the orphan list --- 3, 7, 8, etc. won't do it, it's not
    surprising that AFL needed two hours before it found it.)
    
    [1] http://events.linuxfoundation.org/sites/events/files/slides/AFL%20filesystem%20fuzzing%2C%20Vault%202016_0.pdf
    
    Reported by: Vegard Nossum <vegard.nossum@oracle.com>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 139b79136f240d3de02b009495238bab52d4ccca
Author: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Date:   Mon Apr 25 23:31:57 2016 -0700

    aacraid: Fix for aac_command_thread hang
    
    commit fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7 upstream.
    
    Typically under error conditions, it is possible for aac_command_thread()
    to miss the wakeup from kthread_stop() and go back to sleep, causing it
    to hang aac_shutdown.
    
    In the observed scenario, the adapter is not functioning correctly and so
    aac_fib_send() never completes (or time-outs depending on how it was
    called). Shortly after aac_command_thread() starts it performs
    aac_fib_send(SendHostTime) which hangs. When aac_probe_one
    /aac_get_adapter_info send time outs, kthread_stop is called which breaks
    the command thread out of it's hang.
    
    The code will still go back to sleep in schedule_timeout() without
    checking kthread_should_stop() so it causes aac_probe_one to hang until
    the schedule_timeout() which is 30 minutes.
    
    Fixed by: Adding another kthread_should_stop() before schedule_timeout()
    Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit c43b7e9d5ffa69658b9166470c5c8fd364a0852f
Author: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Date:   Mon Apr 25 23:31:26 2016 -0700

    aacraid: Relinquish CPU during timeout wait
    
    commit 07beca2be24cc710461c0b131832524c9ee08910 upstream.
    
    aac_fib_send has a special function case for initial commands during
    driver initialization using wait < 0(pseudo sync mode). In this case,
    the command does not sleep but rather spins checking for timeout.This
    loop is calls cpu_relax() in an attempt to allow other processes/threads
    to use the CPU, but this function does not relinquish the CPU and so the
    command will hog the processor. This was observed in a KDUMP
    "crashkernel" and that prevented the "command thread" (which is
    responsible for completing the command from being timed out) from
    starting because it could not get the CPU.
    
    Fixed by replacing "cpu_relax()" call with "schedule()"
    Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
    Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 18b12d81c685aded6c4750067d523a5ab205c5c6
Author: Marc Zyngier <marc.zyngier@arm.com>
Date:   Thu Apr 28 16:16:31 2016 +0100

    arm/arm64: KVM: Enforce Break-Before-Make on Stage-2 page tables
    
    commit d4b9e0790aa764c0b01e18d4e8d33e93ba36d51f upstream.
    
    The ARM architecture mandates that when changing a page table entry
    from a valid entry to another valid entry, an invalid entry is first
    written, TLB invalidated, and only then the new entry being written.
    
    The current code doesn't respect this, directly writing the new
    entry and only then invalidating TLBs. Let's fix it up.
    
    Reported-by: Christoffer Dall <christoffer.dall@linaro.org>
    Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 85b0924bf36c730b3f5dd7ba6020f8ff3a0f690b
Author: Luke Dashjr <luke@dashjr.org>
Date:   Thu Oct 29 08:22:21 2015 +0000

    btrfs: bugfix: handle FS_IOC32_{GETFLAGS,SETFLAGS,GETVERSION} in btrfs_ioctl
    
    commit 4c63c2454eff996c5e27991221106eb511f7db38 upstream.
    
    32-bit ioctl uses these rather than the regular FS_IOC_* versions. They can
    be handled in btrfs using the same code. Without this, 32-bit {ch,ls}attr
    fail.
    
    Signed-off-by: Luke Dashjr <luke-jr+git@utopios.org>
    Reviewed-by: Josef Bacik <jbacik@fb.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 59ef2a4cf97c5dbccadd9696a550571679c740d6
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Tue Apr 26 09:29:26 2016 +0200

    crypto: s5p-sss - fix incorrect usage of scatterlists api
    
    commit d1497977fecb9acce05988d6322ad415ef93bb39 upstream.
    
    sg_dma_len() macro can be used only on scattelists which are mapped, so
    all calls to it before dma_map_sg() are invalid. Replace them by proper
    check for direct sg segment length read.
    
    Fixes: a49e490c7a8a ("crypto: s5p-sss - add S5PV210 advanced crypto engine support")
    Fixes: 9e4a1100a445 ("crypto: s5p-sss - Handle unaligned buffers")
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Acked-by: Vladimir Zapolskiy <vz@mleia.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    [bwh: Backported to 3.16: unaligned DMA is unsupported so there is a different
     set of calls to replace]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8e1ec948f93b6dc2ca5dbd4feff6c06c732ab774
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Mon Apr 25 15:59:50 2016 -0500

    alpha/PCI: Call iomem_is_exclusive() for IORESOURCE_MEM, but not IORESOURCE_IO
    
    commit c20e128030caf0537d5e906753eac1c28fefdb75 upstream.
    
    The alpha pci_mmap_resource() is used for both IORESOURCE_MEM and
    IORESOURCE_IO resources, but iomem_is_exclusive() is only applicable for
    IORESOURCE_MEM.
    
    Call iomem_is_exclusive() only for IORESOURCE_MEM resources, and do it
    earlier to match the generic version of pci_mmap_resource().
    
    Fixes: 10a0ef39fbd1 ("PCI/alpha: pci sysfs resources")
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6eb6abdd75722a0b35fbb87fa3c716f3c3e4722f
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Thu Apr 7 17:15:14 2016 -0700

    PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()
    
    commit ca620723d4ff9ea7ed484eab46264c3af871b9ae upstream.
    
    iomem_is_exclusive() requires a CPU physical address, but on some arches we
    supplied a PCI bus address instead.
    
    On most arches, pci_resource_to_user(res) returns "res->start", which is a
    CPU physical address.  But on microblaze, mips, powerpc, and sparc, it
    returns the PCI bus address corresponding to "res->start".
    
    The result is that pci_mmap_resource() may fail when it shouldn't (if the
    bus address happens to match an existing resource), or it may succeed when
    it should fail (if the resource is exclusive but the bus address doesn't
    match it).
    
    Call iomem_is_exclusive() with "res->start", which is always a CPU physical
    address, not the result of pci_resource_to_user().
    
    Fixes: e8de1481fd71 ("resource: allow MMIO exclusivity for device drivers")
    Suggested-by: Yinghai Lu <yinghai@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    CC: Arjan van de Ven <arjan@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fd815747d7e4a759ee64c1a775879f2d793ad001
Author: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Date:   Fri Apr 22 14:15:23 2016 +0200

    crypto: s5p-sss - Fix missed interrupts when working with 8 kB blocks
    
    commit 79152e8d085fd64484afd473ef6830b45518acba upstream.
    
    The tcrypt testing module on Exynos5422-based Odroid XU3/4 board failed on
    testing 8 kB size blocks:
    
            $ sudo modprobe tcrypt sec=1 mode=500
            testing speed of async ecb(aes) (ecb-aes-s5p) encryption
            test 0 (128 bit key, 16 byte blocks): 21971 operations in 1 seconds (351536 bytes)
            test 1 (128 bit key, 64 byte blocks): 21731 operations in 1 seconds (1390784 bytes)
            test 2 (128 bit key, 256 byte blocks): 21932 operations in 1 seconds (5614592 bytes)
            test 3 (128 bit key, 1024 byte blocks): 21685 operations in 1 seconds (22205440 bytes)
            test 4 (128 bit key, 8192 byte blocks):
    
    This was caused by a race issue of missed BRDMA_DONE ("Block cipher
    Receiving DMA") interrupt. Device starts processing the data in DMA mode
    immediately after setting length of DMA block: receiving (FCBRDMAL) or
    transmitting (FCBTDMAL). The driver sets these lengths from interrupt
    handler through s5p_set_dma_indata() function (or xxx_setdata()).
    
    However the interrupt handler was first dealing with receive buffer
    (dma-unmap old, dma-map new, set receive block length which starts the
    operation), then with transmit buffer and finally was clearing pending
    interrupts (FCINTPEND). Because of the time window between setting
    receive buffer length and clearing pending interrupts, the operation on
    receive buffer could end already and driver would miss new interrupt.
    
    User manual for Exynos5422 confirms in example code that setting DMA
    block lengths should be the last operation.
    
    The tcrypt hang could be also observed in following blocked-task dmesg:
    
    INFO: task modprobe:258 blocked for more than 120 seconds.
          Not tainted 4.6.0-rc4-next-20160419-00005-g9eac8b7b7753-dirty #42
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    modprobe        D c06b09d8     0   258    256 0x00000000
    [<c06b09d8>] (__schedule) from [<c06b0f24>] (schedule+0x40/0xac)
    [<c06b0f24>] (schedule) from [<c06b49f8>] (schedule_timeout+0x124/0x178)
    [<c06b49f8>] (schedule_timeout) from [<c06b17fc>] (wait_for_common+0xb8/0x144)
    [<c06b17fc>] (wait_for_common) from [<bf0013b8>] (test_acipher_speed+0x49c/0x740 [tcrypt])
    [<bf0013b8>] (test_acipher_speed [tcrypt]) from [<bf003e8c>] (do_test+0x2240/0x30ec [tcrypt])
    [<bf003e8c>] (do_test [tcrypt]) from [<bf008048>] (tcrypt_mod_init+0x48/0xa4 [tcrypt])
    [<bf008048>] (tcrypt_mod_init [tcrypt]) from [<c010177c>] (do_one_initcall+0x3c/0x16c)
    [<c010177c>] (do_one_initcall) from [<c0191ff0>] (do_init_module+0x5c/0x1ac)
    [<c0191ff0>] (do_init_module) from [<c0185610>] (load_module+0x1a30/0x1d08)
    [<c0185610>] (load_module) from [<c0185ab0>] (SyS_finit_module+0x8c/0x98)
    [<c0185ab0>] (SyS_finit_module) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
    
    Fixes: a49e490c7a8a ("crypto: s5p-sss - add S5PV210 advanced crypto engine support")
    Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
    Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit b274508ecc4388f00de57fc6641bf8be2b671908
Author: Jan Kara <jack@suse.cz>
Date:   Sun Apr 24 00:56:03 2016 -0400

    ext4: fix data exposure after a crash
    
    commit 06bd3c36a733ac27962fea7d6f47168841376824 upstream.
    
    Huang has reported that in his powerfail testing he is seeing stale
    block contents in some of recently allocated blocks although he mounts
    ext4 in data=ordered mode. After some investigation I have found out
    that indeed when delayed allocation is used, we don't add inode to
    transaction's list of inodes needing flushing before commit. Originally
    we were doing that but commit f3b59291a69d removed the logic with a
    flawed argument that it is not needed.
    
    The problem is that although for delayed allocated blocks we write their
    contents immediately after allocating them, there is no guarantee that
    the IO scheduler or device doesn't reorder things and thus transaction
    allocating blocks and attaching them to inode can reach stable storage
    before actual block contents. Actually whenever we attach freshly
    allocated blocks to inode using a written extent, we should add inode to
    transaction's ordered inode list to make sure we properly wait for block
    contents to be written before committing the transaction. So that is
    what we do in this patch. This also handles other cases where stale data
    exposure was possible - like filling hole via mmap in
    data=ordered,nodelalloc mode.
    
    The only exception to the above rule are extending direct IO writes where
    blkdev_direct_IO() waits for IO to complete before increasing i_size and
    thus stale data exposure is not possible. For now we don't complicate
    the code with optimizing this special case since the overhead is pretty
    low. In case this is observed to be a performance problem we can always
    handle it using a special flag to ext4_map_blocks().
    
    Fixes: f3b59291a69d0b734be1fc8be489fef2dd846d3d
    Reported-by: "HUANG Weller (CM/ESW12-CN)" <Weller.Huang@cn.bosch.com>
    Tested-by: "HUANG Weller (CM/ESW12-CN)" <Weller.Huang@cn.bosch.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    [bwh: Backported to 3.16:
     - Drop check for EXT4_GET_BLOCKS_ZERO flag
     - Adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 9cbacbadc6534f5c508ee0c20bf408b5ba246fe6
Author: Emmanouil Maroudas <emmanouil.maroudas@gmail.com>
Date:   Sat Apr 23 18:33:00 2016 +0300

    EDAC: Increment correct counter in edac_inc_ue_error()
    
    commit 993f88f1cc7f0879047ff353e824e5cc8f10adfc upstream.
    
    Fix typo in edac_inc_ue_error() to increment ue_noinfo_count instead of
    ce_noinfo_count.
    
    Signed-off-by: Emmanouil Maroudas <emmanouil.maroudas@gmail.com>
    Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Cc: linux-edac <linux-edac@vger.kernel.org>
    Fixes: 4275be635597 ("edac: Change internal representation to work with layers")
    Link: http://lkml.kernel.org/r/1461425580-5898-1-git-send-email-emmanouil.maroudas@gmail.com
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit e7a2c5bb28971fae4616baff0c013e58f381f733
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Fri Apr 8 13:10:23 2016 +0200

    PM / Runtime: Fix error path in pm_runtime_force_resume()
    
    commit 0ae3aeefabbeef26294e7a349b51f1c761d46c9f upstream.
    
    As pm_runtime_set_active() may fail because the device's parent isn't
    active, we can end up executing the ->runtime_resume() callback for the
    device when it isn't allowed.
    
    Fix this by invoking pm_runtime_set_active() before running the callback
    and let's also deal with the error code.
    
    Fixes: 37f204164dfb (PM: Add pm_runtime_suspend|resume_force functions)
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d26660661ecc7e04fb9264342eb7d6901b8c575b
Author: Hari Bathini <hbathini@linux.vnet.ibm.com>
Date:   Fri Apr 15 22:48:02 2016 +1000

    powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel
    
    commit 8ed8ab40047a570fdd8043a40c104a57248dd3fd upstream.
    
    Some of the interrupt vectors on 64-bit POWER server processors are only
    32 bytes long (8 instructions), which is not enough for the full
    first-level interrupt handler. For these we need to branch to an
    out-of-line (OOL) handler. But when we are running a relocatable kernel,
    interrupt vectors till __end_interrupts marker are copied down to real
    address 0x100. So, branching to labels (ie. OOL handlers) outside this
    section must be handled differently (see LOAD_HANDLER()), considering
    relocatable kernel, which would need at least 4 instructions.
    
    However, branching from interrupt vector means that we corrupt the
    CFAR (come-from address register) on POWER7 and later processors as
    mentioned in commit 1707dd16. So, EXCEPTION_PROLOG_0 (6 instructions)
    that contains the part up to the point where the CFAR is saved in the
    PACA should be part of the short interrupt vectors before we branch out
    to OOL handlers.
    
    But as mentioned already, there are interrupt vectors on 64-bit POWER
    server processors that are only 32 bytes long (like vectors 0x4f00,
    0x4f20, etc.), which cannot accomodate the above two cases at the same
    time owing to space constraint. Currently, in these interrupt vectors,
    we simply branch out to OOL handlers, without using LOAD_HANDLER(),
    which leaves us vulnerable when running a relocatable kernel (eg. kdump
    case). While this has been the case for sometime now and kdump is used
    widely, we were fortunate not to see any problems so far, for three
    reasons:
    
      1. In almost all cases, production kernel (relocatable) is used for
         kdump as well, which would mean that crashed kernel's OOL handler
         would be at the same place where we end up branching to, from short
         interrupt vector of kdump kernel.
      2. Also, OOL handler was unlikely the reason for crash in almost all
         the kdump scenarios, which meant we had a sane OOL handler from
         crashed kernel that we branched to.
      3. On most 64-bit POWER server processors, page size is large enough
         that marking interrupt vector code as executable (see commit
         429d2e83) leads to marking OOL handler code from crashed kernel,
         that sits right below interrupt vector code from kdump kernel, as
         executable as well.
    
    Let us fix this by moving the __end_interrupts marker down past OOL
    handlers to make sure that we also copy OOL handlers to real address
    0x100 when running a relocatable kernel.
    
    This fix has been tested successfully in kdump scenario, on an LPAR with
    4K page size by using different default/production kernel and kdump
    kernel.
    
    Also tested by manually corrupting the OOL handlers in the first kernel
    and then kdump'ing, and then causing the OOL handlers to fire - mpe.
    
    Fixes: c1fb6816fb1b ("powerpc: Add relocation on exception vector handlers")
    Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
    Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 418429fdabbba3d1e195e7e35fa631c38581f967
Author: Takashi Iwai <tiwai@suse.de>
Date:   Thu Apr 14 17:32:19 2016 +0200

    Bluetooth: vhci: Fix race at creating hci device
    
    commit c7c999cb18da88a881e10e07f0724ad0bfaff770 upstream.
    
    hci_vhci driver creates a hci device object dynamically upon each
    HCI_VENDOR_PKT write.  Although it checks the already created object
    and returns an error, it's still racy and may build multiple hci_dev
    objects concurrently when parallel writes are performed, as the device
    tracks only a single hci_dev object.
    
    This patch introduces a mutex to protect against the concurrent device
    creations.
    
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 35d7cfb3d3c5873e8e2e9de8f85642b8393cb3f1
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Thu Apr 14 11:08:08 2016 +0200

    serial: doc: Re-add paragraph documenting uart_console_write()
    
    commit d124fd3bb36ceb40438f10c897ce642386b74b72 upstream.
    
    Commit 834392a7d92677ff ("serial: doc: Un-document non-existing
    uart_write_console()") removed a paragraph about a helper function that
    seemed to never exist.
    
    Peter Hurley pointed out that the function does exist, but is called
    differently. Re-add the paragraph, with the function name corrected.
    
    Fixes: 834392a7d92677ff ("serial: doc: Un-document non-existing uart_write_console()")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 638c0993e303ae9427f89a7d00b0cea265f47989
Author: Johannes Thumshirn <jthumshirn@suse.de>
Date:   Tue Apr 5 11:50:45 2016 +0200

    Revert "scsi: fix soft lockup in scsi_remove_target() on module removal"
    
    commit 305c2e71b3d733ec065cb716c76af7d554bd5571 upstream.
    
    Now that we've done a more comprehensive fix with the intermediate
    target state we can remove the previous hack introduced with commit
    90a88d6ef88e ("scsi: fix soft lockup in scsi_remove_target() on module
    removal").
    
    Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3473e5db18c74469fd86237bbc2437f9beb6458e
Author: Johannes Thumshirn <jthumshirn@suse.de>
Date:   Tue Apr 5 11:50:44 2016 +0200

    scsi: Add intermediate STARGET_REMOVE state to scsi_target_state
    
    commit f05795d3d771f30a7bdc3a138bf714b06d42aa95 upstream.
    
    Add intermediate STARGET_REMOVE state to scsi_target_state to avoid
    running into the BUG_ON() in scsi_target_reap(). The STARGET_REMOVE
    state is only valid in the path from scsi_remove_target() to
    scsi_target_destroy() indicating this target is going to be removed.
    
    This re-fixes the problem introduced in commits bc3f02a795d3 ("[SCSI]
    scsi_remove_target: fix softlockup regression on hot remove") and
    40998193560d ("scsi: restart list search after unlock in
    scsi_remove_target") in a more comprehensive way.
    
    [mkp: Included James' fix for scsi_target_destroy()]
    
    Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
    Fixes: 40998193560dab6c3ce8d25f4fa58a23e252ef38
    Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Reviewed-by: Hannes Reinecke <hare@suse.com>
    Reviewed-by: James Bottomley <jejb@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 72877948df1bcaa19af6241cf98a3f772f3da491
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Apr 13 17:35:10 2016 +0100

    drm/i915: Prevent machine death on Ivybridge context switching
    
    commit e9135c4f08d9acb0f3da3ad2643b669dee3217c2 upstream.
    
    Two concurrent writes into the same register cacheline has the chance of
    killing the machine on Ivybridge and other gen7. This includes LRI
    emitted from the command parser.  The MI_SET_CONTEXT itself serves as
    serialising barrier and prevents the pair of register writes in the first
    packet from triggering the fault.  However, if a second switch-context
    immediately occurs then we may have two adjacent blocks of LRI to the
    same registers which may then trigger the hang. To counteract this we
    need to insert a delay after the second register write using SRM.
    
    This is easiest to reproduce with something like
    igt/gem_ctx_switch/interruptible that triggers back-to-back context
    switches (with no operations in between them in the command stream,
    which requires the execbuf operation to be interrupted after the
    MI_SET_CONTEXT) but can be observed sporadically elsewhere when running
    interruptible igt. No reports from the wild though, so it must be of low
    enough frequency that no one has correlated the random machine freezes
    with i915.ko
    
    The issue was introduced with
    commit 2c550183476dfa25641309ae9a28d30feed14379 [v3.19]
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Tue Dec 16 10:02:27 2014 +0000
    
        drm/i915: Disable PSMI sleep messages on all rings around context switches
    
    Testcase: igt/gem_ctx_switch/render-interruptible #ivb
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1460565315-7748-11-git-send-email-chris@chris-wilson.co.uk
    [bwh: Backported to 3.16:
     - Pass ring, not engine, to intel_ring_emit()
     - Register type is u32 not i915_reg_t
     - MI_STORE_REGISTER_MEM is a function-macro]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8ce5d622b5820ef61ec3a54a355f183c4486dfe7
Author: Daniel Borkmann <daniel@iogearbox.net>
Date:   Fri Apr 8 15:55:00 2016 +0200

    ipv6, token: allow for clearing the current device token
    
    commit 47e27d5e92c46a3a62d4dfd8895b1ddb8613f531 upstream.
    
    The original tokenized iid support implemented via f53adae4eae5 ("net: ipv6:
    add tokenized interface identifier support") didn't allow for clearing a
    device token as it was intended that this addressing mode was the only one
    active for globally scoped IPv6 addresses. Later we relaxed that restriction
    via 617fe29d45bd ("net: ipv6: only invalidate previously tokenized addresses"),
    and we should also allow for clearing tokens as there's no good reason why
    it shouldn't be allowed.
    
    Fixes: 617fe29d45bd ("net: ipv6: only invalidate previously tokenized addresses")
    Reported-by: Robin H. Johnson <robbat2@gentoo.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
    Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 300aecc006dba19a907b7f74d44e0713f641dc39
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Tue Mar 15 04:05:20 2016 -0300

    cx23885: uninitialized variable in cx23885_av_work_handler()
    
    commit 60587bd0680507f48ae3a7360983228fd207de8a upstream.
    
    The "handled" variable could be uninitialized if the
    interrupt_service_routine() call back hasn't been implimented or if it
    has been implemented but doesn't initialize "handled" to zero at the
    start.  For example, adv76xx_isr() only sets "handled" to true.
    
    Fixes: 44b153ca639f ('[media] m5mols: Add ISO sensitivity controls')
    
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 6d56be20f26bd3c1bcb0ddeafd7a57771290290b
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Fri Mar 11 11:11:39 2016 +0300

    mfd: lp8788-irq: Uninitialized variable in irq handler
    
    commit 22aab38e7b59fd79ce1045006be69a9abab58e5a upstream.
    
    Instead to being true/false, the "handled" is true/uninitialized.
    Presumably this doesn't cause that many problems in real life because
    normally we handle the IRQ.
    
    Fixes: eea6b7cc53aa ('mfd: Add lp8788 mfd driver')
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Acked-by: Milo Kim <milo.kim@ti.com>
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 3de7eed08b1c71a7bce23f91315fa63eb2d25cbb
Author: Suman Anna <s-anna@ti.com>
Date:   Sun Apr 10 13:20:11 2016 -0600

    ARM: OMAP2+: hwmod: fix _idle() hwmod state sanity check sequence
    
    commit c20c8f750d9f8f8617f07ee2352d3ff560e66bc2 upstream.
    
    The omap_hwmod _enable() function can return success without setting
    the hwmod state to _HWMOD_STATE_ENABLED for IPs with reset lines when
    all of the reset lines are asserted. The omap_hwmod _idle() function
    also performs a similar check, but after checking for the hwmod state
    first. This triggers the WARN when pm_runtime_get and pm_runtime_put
    are invoked on IPs with all reset lines asserted. Reverse the checks
    for hwmod state and reset lines status to fix this.
    
    Issue found during a unbind operation on a device with reset lines
    still asserted, example backtrace below
    
     ------------[ cut here ]------------
     WARNING: CPU: 1 PID: 879 at arch/arm/mach-omap2/omap_hwmod.c:2207 _idle+0x1e4/0x240()
     omap_hwmod: mmu_dsp: idle state can only be entered from enabled state
     Modules linked in:
     CPU: 1 PID: 879 Comm: sh Not tainted 4.4.0-00008-ga989d951331a #3
     Hardware name: Generic OMAP5 (Flattened Device Tree)
     [<c0018e60>] (unwind_backtrace) from [<c0014dc4>] (show_stack+0x10/0x14)
     [<c0014dc4>] (show_stack) from [<c037ac28>] (dump_stack+0x90/0xc0)
     [<c037ac28>] (dump_stack) from [<c003f420>] (warn_slowpath_common+0x78/0xb4)
     [<c003f420>] (warn_slowpath_common) from [<c003f48c>] (warn_slowpath_fmt+0x30/0x40)
     [<c003f48c>] (warn_slowpath_fmt) from [<c0028c20>] (_idle+0x1e4/0x240)
     [<c0028c20>] (_idle) from [<c0029080>] (omap_hwmod_idle+0x28/0x48)
     [<c0029080>] (omap_hwmod_idle) from [<c002a5a4>] (omap_device_idle+0x3c/0x90)
     [<c002a5a4>] (omap_device_idle) from [<c0427a90>] (__rpm_callback+0x2c/0x60)
     [<c0427a90>] (__rpm_callback) from [<c0427ae4>] (rpm_callback+0x20/0x80)
     [<c0427ae4>] (rpm_callback) from [<c0427f84>] (rpm_suspend+0x138/0x74c)
     [<c0427f84>] (rpm_suspend) from [<c0428b78>] (__pm_runtime_idle+0x78/0xa8)
     [<c0428b78>] (__pm_runtime_idle) from [<c041f514>] (__device_release_driver+0x64/0x100)
     [<c041f514>] (__device_release_driver) from [<c041f5d0>] (device_release_driver+0x20/0x2c)
     [<c041f5d0>] (device_release_driver) from [<c041d85c>] (unbind_store+0x78/0xf8)
     [<c041d85c>] (unbind_store) from [<c0206df8>] (kernfs_fop_write+0xc0/0x1c4)
     [<c0206df8>] (kernfs_fop_write) from [<c018a120>] (__vfs_write+0x20/0xdc)
     [<c018a120>] (__vfs_write) from [<c018a9cc>] (vfs_write+0x90/0x164)
     [<c018a9cc>] (vfs_write) from [<c018b1f0>] (SyS_write+0x44/0x9c)
     [<c018b1f0>] (SyS_write) from [<c0010420>] (ret_fast_syscall+0x0/0x1c)
     ---[ end trace a4182013c75a9f50 ]---
    
    While at this, fix the sequence in _shutdown() as well, though there
    is no easy reproducible scenario.
    
    Fixes: 747834ab8347 ("ARM: OMAP2+: hwmod: revise hardreset behavior")
    Signed-off-by: Suman Anna <s-anna@ti.com>
    Signed-off-by: Paul Walmsley <paul@pwsan.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit f9f848173ae6bf94fa9cedaf9a44a16f762c8654
Author: Dave Gerlach <d-gerlach@ti.com>
Date:   Tue Apr 5 14:05:38 2016 -0500

    cpuidle: Indicate when a device has been unregistered
    
    commit c998c07836f985b24361629dc98506ec7893e7a0 upstream.
    
    Currently the 'registered' member of the cpuidle_device struct is set
    to 1 during cpuidle_register_device. In this same function there are
    checks to see if the device is already registered to prevent duplicate
    calls to register the device, but this value is never set to 0 even on
    unregister of the device. Because of this, any attempt to call
    cpuidle_register_device after a call to cpuidle_unregister_device will
    fail which shouldn't be the case.
    
    To prevent this, set registered to 0 when the device is unregistered.
    
    Fixes: c878a52d3c7c (cpuidle: Check if device is already registered)
    Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
    Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 140d276c44a0fad248911db867e65488fcdd4d99
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Sat Mar 19 11:49:43 2016 +0100

    Bluetooth: vhci: purge unhandled skbs
    
    commit 13407376b255325fa817798800117a839f3aa055 upstream.
    
    The write handler allocates skbs and queues them into data->readq.
    Read side should read them, if there is any. If there is none, skbs
    should be dropped by hdev->flush. But this happens only if the device
    is HCI_UP, i.e. hdev->power_on work was triggered already. When it was
    not, skbs stay allocated in the queue when /dev/vhci is closed. So
    purge the queue in ->release.
    
    Program to reproduce:
            #include <err.h>
            #include <fcntl.h>
            #include <stdio.h>
            #include <unistd.h>
    
            #include <sys/stat.h>
            #include <sys/types.h>
            #include <sys/uio.h>
    
            int main()
            {
                    char buf[] = { 0xff, 0 };
                    struct iovec iov = {
                            .iov_base = buf,
                            .iov_len = sizeof(buf),
                    };
                    int fd;
    
                    while (1) {
                            fd = open("/dev/vhci", O_RDWR);
                            if (fd < 0)
                                    err(1, "open");
    
                            usleep(50);
    
                            if (writev(fd, &iov, 1) < 0)
                                    err(1, "writev");
    
                            usleep(50);
    
                            close(fd);
                    }
    
                    return 0;
            }
    
    Result:
    kmemleak: 4609 new suspected memory leaks
    unreferenced object 0xffff88059f4d5440 (size 232):
      comm "vhci", pid 1084, jiffies 4294912542 (age 37569.296s)
      hex dump (first 32 bytes):
        20 f0 23 87 05 88 ff ff 20 f0 23 87 05 88 ff ff   .#..... .#.....
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      backtrace:
    ...
        [<ffffffff81ece010>] __alloc_skb+0x0/0x5a0
        [<ffffffffa021886c>] vhci_create_device+0x5c/0x580 [hci_vhci]
        [<ffffffffa0219436>] vhci_write+0x306/0x4c8 [hci_vhci]
    
    Fixes: 23424c0d31 (Bluetooth: Add support creating virtual AMP controllers)
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit fe7ecd1a1a0f9ef40fba0333562a154fdcbab364
Author: Jiri Slaby <jslaby@suse.cz>
Date:   Sat Mar 19 11:05:18 2016 +0100

    Bluetooth: vhci: fix open_timeout vs. hdev race
    
    commit 373a32c848ae3a1c03618517cce85f9211a6facf upstream.
    
    Both vhci_get_user and vhci_release race with open_timeout work. They
    both contain cancel_delayed_work_sync, but do not test whether the
    work actually created hdev or not. Since the work can be in progress
    and _sync will wait for finishing it, we can have data->hdev allocated
    when cancel_delayed_work_sync returns. But the call sites do 'if
    (data->hdev)' *before* cancel_delayed_work_sync.
    
    As a result:
    * vhci_get_user allocates a second hdev and puts it into
      data->hdev. The former is leaked.
    * vhci_release does not release data->hdev properly as it thinks there
      is none.
    
    Fix both cases by moving the actual test *after* the call to
    cancel_delayed_work_sync.
    
    This can be hit by this program:
            #include <err.h>
            #include <fcntl.h>
            #include <stdio.h>
            #include <stdlib.h>
            #include <time.h>
            #include <unistd.h>
    
            #include <sys/stat.h>
            #include <sys/types.h>
    
            int main(int argc, char **argv)
            {
                    int fd;
    
                    srand(time(NULL));
    
                    while (1) {
                            const int delta = (rand() % 200 - 100) * 100;
    
                            fd = open("/dev/vhci", O_RDWR);
                            if (fd < 0)
                                    err(1, "open");
    
                            usleep(1000000 + delta);
    
                            close(fd);
                    }
    
                    return 0;
            }
    
    And the result is:
    BUG: KASAN: use-after-free in skb_queue_tail+0x13e/0x150 at addr ffff88006b0c1228
    Read of size 8 by task kworker/u13:1/32068
    =============================================================================
    BUG kmalloc-192 (Tainted: G            E     ): kasan: bad access detected
    -----------------------------------------------------------------------------
    
    Disabling lock debugging due to kernel taint
    INFO: Allocated in vhci_open+0x50/0x330 [hci_vhci] age=260 cpu=3 pid=32040
    ...
            kmem_cache_alloc_trace+0x150/0x190
            vhci_open+0x50/0x330 [hci_vhci]
            misc_open+0x35b/0x4e0
            chrdev_open+0x23b/0x510
    ...
    INFO: Freed in vhci_release+0xa4/0xd0 [hci_vhci] age=9 cpu=2 pid=32040
    ...
            __slab_free+0x204/0x310
            vhci_release+0xa4/0xd0 [hci_vhci]
    ...
    INFO: Slab 0xffffea0001ac3000 objects=16 used=13 fp=0xffff88006b0c1e00 flags=0x5fffff80004080
    INFO: Object 0xffff88006b0c1200 @offset=4608 fp=0xffff88006b0c0600
    Bytes b4 ffff88006b0c11f0: 09 df 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
    Object ffff88006b0c1200: 00 06 0c 6b 00 88 ff ff 00 00 00 00 00 00 00 00  ...k............
    Object ffff88006b0c1210: 10 12 0c 6b 00 88 ff ff 10 12 0c 6b 00 88 ff ff  ...k.......k....
    Object ffff88006b0c1220: c0 46 c2 6b 00 88 ff ff c0 46 c2 6b 00 88 ff ff  .F.k.....F.k....
    Object ffff88006b0c1230: 01 00 00 00 01 00 00 00 e0 ff ff ff 0f 00 00 00  ................
    Object ffff88006b0c1240: 40 12 0c 6b 00 88 ff ff 40 12 0c 6b 00 88 ff ff  @..k....@..k....
    Object ffff88006b0c1250: 50 0d 6e a0 ff ff ff ff 00 02 00 00 00 00 ad de  P.n.............
    Object ffff88006b0c1260: 00 00 00 00 00 00 00 00 ab 62 02 00 01 00 00 00  .........b......
    Object ffff88006b0c1270: 90 b9 19 81 ff ff ff ff 38 12 0c 6b 00 88 ff ff  ........8..k....
    Object ffff88006b0c1280: 03 00 20 00 ff ff ff ff ff ff ff ff 00 00 00 00  .. .............
    Object ffff88006b0c1290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    Object ffff88006b0c12a0: 00 00 00 00 00 00 00 00 00 80 cd 3d 00 88 ff ff  ...........=....
    Object ffff88006b0c12b0: 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00  . ..............
    Redzone ffff88006b0c12c0: bb bb bb bb bb bb bb bb                          ........
    Padding ffff88006b0c13f8: 00 00 00 00 00 00 00 00                          ........
    CPU: 3 PID: 32068 Comm: kworker/u13:1 Tainted: G    B       E      4.4.6-0-default #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20151112_172657-sheep25 04/01/2014
    Workqueue: hci0 hci_cmd_work [bluetooth]
     00000000ffffffff ffffffff81926cfa ffff88006be37c68 ffff88006bc27180
     ffff88006b0c1200 ffff88006b0c1234 ffffffff81577993 ffffffff82489320
     ffff88006bc24240 0000000000000046 ffff88006a100000 000000026e51eb80
    Call Trace:
    ...
     [<ffffffff81ec8ebe>] ? skb_queue_tail+0x13e/0x150
     [<ffffffffa06e027c>] ? vhci_send_frame+0xac/0x100 [hci_vhci]
     [<ffffffffa0c61268>] ? hci_send_frame+0x188/0x320 [bluetooth]
     [<ffffffffa0c61515>] ? hci_cmd_work+0x115/0x310 [bluetooth]
     [<ffffffff811a1375>] ? process_one_work+0x815/0x1340
     [<ffffffff811a1f85>] ? worker_thread+0xe5/0x11f0
     [<ffffffff811a1ea0>] ? process_one_work+0x1340/0x1340
     [<ffffffff811b3c68>] ? kthread+0x1c8/0x230
    ...
    Memory state around the buggy address:
     ffff88006b0c1100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
     ffff88006b0c1180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    >ffff88006b0c1200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                      ^
     ffff88006b0c1280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
     ffff88006b0c1300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    
    Fixes: 23424c0d31 (Bluetooth: Add support creating virtual AMP controllers)
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 37154c757249a531ff23ab2158693ba474e33fcc
Author: Itai Handler <itai_handler@hotmail.com>
Date:   Tue Nov 3 00:20:56 2015 +0200

    drm/gma500: Fix possible out of bounds read
    
    commit 7ccca1d5bf69fdd1d3c5fcf84faf1659a6e0ad11 upstream.
    
    Fix possible out of bounds read, by adding missing comma.
    The code may read pass the end of the dsi_errors array
    when the most significant bit (bit #31) in the intr_stat register
    is set.
    This bug has been detected using CppCheck (static analysis tool).
    
    Signed-off-by: Itai Handler <itai_handler@hotmail.com>
    Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 1e31630b58544c55c090615c9fe198d69e2a1254
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Wed Apr 6 07:05:41 2016 +1000

    xfs: disallow rw remount on fs with unknown ro-compat features
    
    commit d0a58e833931234c44e515b5b8bede32bd4e6eed upstream.
    
    Today, a kernel which refuses to mount a filesystem read-write
    due to unknown ro-compat features can still transition to read-write
    via the remount path.  The old kernel is most likely none the wiser,
    because it's unaware of the new feature, and isn't using it.  However,
    writing to the filesystem may well corrupt metadata related to that
    new feature, and moving to a newer kernel which understand the feature
    will have problems.
    
    Right now the only ro-compat feature we have is the free inode btree,
    which showed up in v3.16.  It would be good to push this back to
    all the active stable kernels, I think, so that if anyone is using
    newer mkfs (which enables the finobt feature) with older kernel
    releases, they'll be protected.
    
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: Bill O'Donnell <billodo@redhat.com>
    Reviewed-by: Dave Chinner <dchinner@redhat.com>
    Signed-off-by: Dave Chinner <david@fromorbit.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8825fd036bbdb1406dea4749171b20d9bcbf8880
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Thu Mar 17 14:12:31 2016 -0600

    iommu/vt-d: Improve fault handler error messages
    
    commit a0fe14d7dcf5db2f101b4fe8689ecabb255ab7d3 upstream.
    
    Remove new line in error logs, avoid duplicate and explicit pr_fmt.
    
    Suggested-by: Joe Perches <joe@perches.com>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Fixes: 0ac2491f57af ('x86, dmar: move page fault handling code to dmar.c')
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d387f590636218d548256f73e1dc7c8d90112eef
Author: Alex Williamson <alex.williamson@redhat.com>
Date:   Thu Mar 17 14:12:25 2016 -0600

    iommu/vt-d: Ratelimit fault handler
    
    commit c43fce4eebae257ca413733690e2076757282093 upstream.
    
    Fault rates can easily overwhelm the console and make the system
    unresponsive.  Ratelimit to allow an opportunity for maintenance.
    
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Fixes: 0ac2491f57af ('x86, dmar: move page fault handling code to dmar.c')
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit a0f2f75487b26323307915085d019dcb87a565aa
Author: Joseph Salisbury <joseph.salisbury@canonical.com>
Date:   Mon Mar 14 14:51:48 2016 -0400

    ath5k: Change led pin configuration for compaq c700 laptop
    
    commit 7b9bc799a445aea95f64f15e0083cb19b5789abe upstream.
    
    BugLink: http://bugs.launchpad.net/bugs/972604
    
    Commit 09c9bae26b0d3c9472cb6ae45010460a2cee8b8d ("ath5k: add led pin
    configuration for compaq c700 laptop") added a pin configuration for the Compaq
    c700 laptop.  However, the polarity of the led pin is reversed.  It should be
    red for wifi off and blue for wifi on, but it is the opposite.  This bug was
    reported in the following bug report:
    http://pad.lv/972604
    
    Fixes: 09c9bae26b0d3c9472cb6ae45010460a2cee8b8d ("ath5k: add led pin configuration for compaq c700 laptop")
    Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
    Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d5b2f304a7e8841b2254eb17a065d05df58e0dfe
Author: Geert Uytterhoeven <geert+renesas@glider.be>
Date:   Mon Mar 14 16:16:09 2016 +0100

    serial: doc: Un-document non-existing uart_write_console()
    
    commit 834392a7d92677ff2bdc1c709b1171ee585b55c9 upstream.
    
    uart_write_console() never existed, not even when the "new
    uart_write_console function" was documented.
    
    Fixes: 67ab7f596b6adbae ("[SERIAL] Update serial driver documentation")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 66888ef981ea004bbef19cf2eab4025d291ca1fe
Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date:   Mon Mar 28 10:38:31 2016 +0200

    ARM: dts: kirkwood: add kirkwood-nsa320.dtb to Makefile
    
    commit 9ec423ed62b8278412400fae6c064edb6ce1bb51 upstream.
    
    Commit be3d7d023b87 ("ARM: kirkwood: Add DTS file for NSA320")
    created the new file kirkwood-nsa320.dts but did not
    add it to the Makefile.
    
    Fixes: be3d7d023b87 ("ARM: kirkwood: Add DTS file for NSA320")
    Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
    Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit d97a975966215faa29d7359c4f17a93dbbd59b35
Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date:   Mon Mar 28 10:03:48 2016 +0200

    ARM: dts: kirkwood: add kirkwood-ds112.dtb to Makefile
    
    commit fc5c796e12511a7c027b5a4438719dde2f796208 upstream.
    
    Commit 2d0a7addbd10 ("ARM: Kirkwood: Add support for many Synology
    NAS devices") created the new file kirkwood-ds112.dts but did not
    add it to the Makefile.
    
    Fixes: 2d0a7addbd10 ("ARM: Kirkwood: Add support for many Synology NAS devices")
    Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
    Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

commit 8faf24bd061ce1e0198dd369f138364719bf8e25
Author: Andrew F. Davis <afd@ti.com>
Date:   Wed Mar 23 09:26:33 2016 -0500

    regmap: cache: Fix typo in cache_bypass parameter description
    
    commit 267c85860308d36bc163c5573308cd024f659d7c upstream.
    
    Setting the flag 'cache_bypass' will bypass the cache not the hardware.
    Fix this comment here.
    
    Fixes: 0eef6b0415f5 ("regmap: Fix doc comment")
    Signed-off-by: Andrew F. Davis <afd@ti.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>