1. 12 Aug, 2014 40 commits
    • Peter Boström's avatar
      vlan: Set correct source MAC address with TX VLAN offload enabled · dd61d850
      Peter Boström authored
      With TX VLAN offload enabled the source MAC address for frames sent using the
      VLAN interface is currently set to the address of the real interface. This is
      wrong since the VLAN interface may be configured with a different address.
      
      The bug was introduced in commit 2205369a
      
      
      ("vlan: Fix header ops passthru when doing TX VLAN offload.").
      
      This patch sets the source address before calling the create function of the
      real interface.
      Signed-off-by: default avatarPeter Boström <peter.bostrom@netrounds.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit dd38743b
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      dd61d850
    • Sabrina Dubroca's avatar
      ipv6: don't set DST_NOCOUNT for remotely added routes · 930b8bc0
      Sabrina Dubroca authored
      
      DST_NOCOUNT should only be used if an authorized user adds routes
      locally. In case of routes which are added on behalf of router
      advertisments this flag must not get used as it allows an unlimited
      number of routes getting added remotely.
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit c88507fb
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      930b8bc0
    • Anton Nayshtut's avatar
      ipv6: Fix exthdrs offload registration. · 2c6910b3
      Anton Nayshtut authored
      
      Without this fix, ipv6_exthdrs_offload_init doesn't register IPPROTO_DSTOPTS
      offload, but returns 0 (as the IPPROTO_ROUTING registration actually succeeds).
      
      This then causes the ipv6_gso_segment to drop IPv6 packets with IPPROTO_DSTOPTS
      header.
      
      The issue detected and the fix verified by running MS HCK Offload LSO test on
      top of QEMU Windows guests, as this test sends IPv6 packets with
      IPPROTO_DSTOPTS.
      Signed-off-by: default avatarAnton Nayshtut <anton@swortex.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit d2d273ff
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2c6910b3
    • Eric Dumazet's avatar
      net: unix: non blocking recvmsg() should not return -EINTR · b0398c1d
      Eric Dumazet authored
      Some applications didn't expect recvmsg() on a non blocking socket
      could return -EINTR. This possibility was added as a side effect
      of commit b3ca9b02 ("net: fix multithreaded signal handling in
      unix recv routines").
      
      To hit this bug, you need to be a bit unlucky, as the u->readlock
      mutex is usually held for very small periods.
      
      Fixes: b3ca9b02
      
       ("net: fix multithreaded signal handling in unix recv routines")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Rainer Weikusat <rweikusat@mobileactivedefense.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit de144391
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b0398c1d
    • Linus Lüssing's avatar
      bridge: multicast: add sanity check for query source addresses · 27aa22e0
      Linus Lüssing authored
      
      MLD queries are supposed to have an IPv6 link-local source address
      according to RFC2710, section 4 and RFC3810, section 5.1.14. This patch
      adds a sanity check to ignore such broken MLD queries.
      
      Without this check, such malformed MLD queries can result in a
      denial of service: The queries are ignored by any MLD listener
      therefore they will not respond with an MLD report. However,
      without this patch these malformed MLD queries would enable the
      snooping part in the bridge code, potentially shutting down the
      according ports towards these hosts for multicast traffic as the
      bridge did not learn about these listeners.
      Reported-by: default avatarJan Stancek <jstancek@redhat.com>
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@web.de>
      Reviewed-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 6565b9ee
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      27aa22e0
    • Daniel Borkmann's avatar
      net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk · 9b944ae6
      Daniel Borkmann authored
      While working on ec0223ec ("net: sctp: fix sctp_sf_do_5_1D_ce to
      verify if we/peer is AUTH capable"), we noticed that there's a skb
      memory leakage in the error path.
      
      Running the same reproducer as in ec0223ec and by unconditionally
      jumping to the error label (to simulate an error condition) in
      sctp_sf_do_5_1D_ce() receive path lets kmemleak detector bark about
      the unfreed chunk->auth_chunk skb clone:
      
      Unreferenced object 0xffff8800b8f3a000 (size 256):
        comm "softirq", pid 0, jiffies 4294769856 (age 110.757s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          89 ab 75 5e d4 01 58 13 00 00 00 00 00 00 00 00  ..u^..X.........
        backtrace:
          [<ffffffff816660be>] kmemleak_alloc+0x4e/0xb0
          [<ffffffff8119f328>] kmem_cache_alloc+0xc8/0x210
          [<ffffffff81566929>] skb_clone+0x49/0xb0
          [<ffffffffa0467459>] sctp_endpoint_bh_rcv+0x1d9/0x230 [sctp]
          [<ffffffffa046fdbc>] sctp_inq_push+0x4c/0x70 [sctp]
          [<ffffffffa047e8de>] sctp_rcv+0x82e/0x9a0 [sctp]
          [<ffffffff815abd38>] ip_local_deliver_finish+0xa8/0x210
          [<ffffffff815a64af>] nf_reinject+0xbf/0x180
          [<ffffffffa04b4762>] nfqnl_recv_verdict+0x1d2/0x2b0 [nfnetlink_queue]
          [<ffffffffa04aa40b>] nfnetlink_rcv_msg+0x14b/0x250 [nfnetlink]
          [<ffffffff815a3269>] netlink_rcv_skb+0xa9/0xc0
          [<ffffffffa04aa7cf>] nfnetlink_rcv+0x23f/0x408 [nfnetlink]
          [<ffffffff815a2bd8>] netlink_unicast+0x168/0x250
          [<ffffffff815a2fa1>] netlink_sendmsg+0x2e1/0x3f0
          [<ffffffff8155cc6b>] sock_sendmsg+0x8b/0xc0
          [<ffffffff8155d449>] ___sys_sendmsg+0x369/0x380
      
      What happens is that commit bbd0d598 clones the skb containing
      the AUTH chunk in sctp_endpoint_bh_rcv() when having the edge case
      that an endpoint requires COOKIE-ECHO chunks to be authenticated:
      
        ---------- INIT[RANDOM; CHUNKS; HMAC-ALGO] ---------->
        <------- INIT-ACK[RANDOM; CHUNKS; HMAC-ALGO] ---------
        ------------------ AUTH; COOKIE-ECHO ---------------->
        <-------------------- COOKIE-ACK ---------------------
      
      When we enter sctp_sf_do_5_1D_ce() and before we actually get to
      the point where we process (and subsequently free) a non-NULL
      chunk->auth_chunk, we could hit the "goto nomem_init" path from
      an error condition and thus leave the cloned skb around w/o
      freeing it.
      
      The fix is to centrally free such clones in sctp_chunk_destroy()
      handler that is invoked from sctp_chunk_free() after all refs have
      dropped; and also move both kfree_skb(chunk->auth_chunk) there,
      so that chunk->auth_chunk is either NULL (since sctp_chunkify()
      allocs new chunks through kmem_cache_zalloc()) or non-NULL with
      a valid skb pointer. chunk->skb and chunk->auth_chunk are the
      only skbs in the sctp_chunk structure that need to be handeled.
      
      While at it, we should use consume_skb() for both. It is the same
      as dev_kfree_skb() but more appropriately named as we are not
      a device but a protocol. Also, this effectively replaces the
      kfree_skb() from both invocations into consume_skb(). Functions
      are the same only that kfree_skb() assumes that the frame was
      being dropped after a failure (e.g. for tools like drop monitor),
      usage of consume_skb() seems more appropriate in function
      sctp_chunk_destroy() though.
      
      Fixes: bbd0d598
      
       ("[SCTP]: Implement the receive and verification of AUTH chunk")
      Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Cc: Vlad Yasevich <yasevich@gmail.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarVlad Yasevich <vyasevich@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit c485658b
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9b944ae6
    • Dan Williams's avatar
      ioat: fix tasklet tear down · ba554bfc
      Dan Williams authored
      Since commit 77873803 "net_dma: mark broken" we no longer pin dma
      engines active for the network-receive-offload use case.  As a result
      the ->free_chan_resources() that occurs after the driver self test no
      longer has a NET_DMA induced ->alloc_chan_resources() to back it up.  A
      late firing irq can lead to ksoftirqd spinning indefinitely due to the
      tasklet_disable() performed by ->free_chan_resources().  Only
      ->alloc_chan_resources() can clear this condition in affected kernels.
      
      This problem has been present since commit 3e037454 "I/OAT: Add
      support for MSI and MSI-X" in 2.6.24, but is now exposed. Given the
      NET_DMA use case is deprecated we can revisit moving the driver to use
      threaded irqs.  For now, just tear down the irq and tasklet properly by:
      
      1/ Disable the irq from triggering the tasklet
      
      2/ Disable the irq from re-arming
      
      3/ Flush inflight interrupts
      
      4/ Flush the timer
      
      5/ Flush inflight tasklets
      
      References:
      https://lkml.org/lkml/2014/1/27/282
      https://lkml.org/lkml/2014/2/19/672
      
      
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarMike Galbraith <bitbucket@online.de>
      Reported-by: default avatarStanislav Fomichev <stfomichev@yandex-team.ru>
      Tested-by: default avatarMike Galbraith <bitbucket@online.de>
      Tested-by: default avatarStanislav Fomichev <stfomichev@yandex-team.ru>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      
      (cherry picked from commit da87ca4d
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ba554bfc
    • Theodore Ts'o's avatar
      ext4: atomically set inode->i_flags in ext4_set_inode_flags() · 3f0fe4d9
      Theodore Ts'o authored
      
      Use cmpxchg() to atomically set i_flags instead of clearing out the
      S_IMMUTABLE, S_APPEND, etc. flags and then setting them from the
      EXT4_IMMUTABLE_FL, EXT4_APPEND_FL flags, since this opens up a race
      where an immutable file has the immutable flag cleared for a brief
      window of time.
      Reported-by: default avatarJohn Sullivan <jsrhbz@kanargh.force9.co.uk>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: stable@kernel.org
      
      (cherry picked from commit 5f16f322
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3f0fe4d9
    • Samuel Thibault's avatar
      staging: speakup: Prefix externally-visible symbols · b14eacf5
      Samuel Thibault authored
      
      This prefixes all externally-visible symbols of speakup with "spk_".
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit ca2beaf8
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b14eacf5
    • Dmitry Torokhov's avatar
      Input: mousedev - fix race when creating mixed device · f71a6b3f
      Dmitry Torokhov authored
      We should not be using static variable mousedev_mix in methods that can be
      called before that singleton gets assigned. While at it let's add open and
      close methods to mousedev structure so that we do not need to test if we
      are dealing with multiplexor or normal device and simply call appropriate
      method directly.
      
      This fixes: https://bugzilla.kernel.org/show_bug.cgi?id=71551
      
      Reported-by: default avatarGiulioDP <depasquale.giulio@gmail.com>
      Tested-by: default avatarGiulioDP <depasquale.giulio@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit e4dbedc7
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f71a6b3f
    • Artem Fetishev's avatar
      x86: fix boot on uniprocessor systems · b9f54ca6
      Artem Fetishev authored
      
      On x86 uniprocessor systems topology_physical_package_id() returns -1
      which causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized
      which leads to GPF in rapl_pmu_init().
      
      See arch/x86/kernel/cpu/perf_event_intel_rapl.c.
      
      It turns out that physical_package_id and core_id can actually be
      retreived for uniprocessor systems too.  Enabling them also fixes
      rapl_pmu code.
      Signed-off-by: default avatarArtem Fetishev <artem_fetishev@epam.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 825600c0
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b9f54ca6
    • Hans de Goede's avatar
      Input: synaptics - add manual min/max quirk for ThinkPad X240 · b7335f83
      Hans de Goede authored
      
      This extends Benjamin Tissoires manual min/max quirk table with support for
      the ThinkPad X240.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 8a0435d9
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b7335f83
    • Benjamin Tissoires's avatar
      Input: synaptics - add manual min/max quirk · 6ae13438
      Benjamin Tissoires authored
      
      The new Lenovo Haswell series (-40's) contains a new Synaptics touchpad.
      However, these new Synaptics devices report bad axis ranges.
      Under Windows, it is not a problem because the Windows driver uses RMI4
      over SMBus to talk to the device. Under Linux, we are using the PS/2
      fallback interface and it occurs the reported ranges are wrong.
      
      Of course, it would be too easy to have only one range for the whole
      series, each touchpad seems to be calibrated in a different way.
      
      We can not use SMBus to get the actual range because I suspect the firmware
      will switch into the SMBus mode and stop talking through PS/2 (this is the
      case for hybrid HID over I2C / PS/2 Synaptics touchpads).
      
      So as a temporary solution (until RMI4 land into upstream), start a new
      list of quirks with the min/max manually set.
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 421e08c4
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6ae13438
    • Thomas Petazzoni's avatar
      net: mvneta: rename MVNETA_GMAC2_PSC_ENABLE to MVNETA_GMAC2_PCS_ENABLE · 008679ef
      Thomas Petazzoni authored
      
      Bit 3 of the MVNETA_GMAC_CTRL_2 is actually used to enable the PCS,
      not the PSC: there was a typo in the name of the define, which this
      commit fixes.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit a79121d3
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      008679ef
    • Scott Wood's avatar
      i2c: cpm: Fix build by adding of_address.h and of_irq.h · a09ee307
      Scott Wood authored
      Fixes a build break due to the undeclared use of irq_of_parse_and_map()
      and of_iomap().  This build break was apparently introduced while the
      driver was unbuildable due to the bug fixed by
      62c19c9d
      
       ("i2c: Remove usage of
      orphaned symbol OF_I2C").  When 62c19c was added in v3.14-rc7,
      the driver was enabled again, breaking the powerpc mpc85xx_defconfig
      and mpc85xx_smp_defconfig.
      
      62c19c is marked for stable, so this should go there as well.
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      
      (cherry picked from commit 5f12c5ec
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a09ee307
    • Charles Keepax's avatar
      ALSA: compress: Pass through return value of open ops callback · 9d5d702d
      Charles Keepax authored
      The snd_compr_open function would always return 0 even if the compressed
      ops open function failed, obviously this is incorrect. Looks like this
      was introduced by a small typo in:
      
      commit a0830dbd
      
      
      ALSA: Add a reference counter to card instance
      
      This patch returns the value from the compressed op as it should.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit 749d3223
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9d5d702d
    • Chris Wilson's avatar
      drm/i915: Disable stolen memory when DMAR is active · 212cd14c
      Chris Wilson authored
      We have reports of heavy screen corruption if we try to use the stolen
      memory reserved by the BIOS whilst the DMA-Remapper is active. This
      quirk may be only specific to a few machines or BIOSes, but first lets
      apply the big hammer and always disable use of stolen memory when DMAR
      is active.
      
      v2 by Jani: Rebase on -fixes, only look at intel_iommu_gfx_mapped.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68535
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      
      (cherry picked from commit 0f4706d2
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      212cd14c
    • Michael Kerrisk's avatar
      ipc: Fix 2 bugs in msgrcv() MSG_COPY implementation · 003ff3dd
      Michael Kerrisk authored
      While testing and documenting the msgrcv() MSG_COPY flag that Stanislav
      Kinsbursky added in commit 4a674f34 ("ipc: introduce message queue
      copy feature" => kernel 3.8), I discovered a couple of bugs in the
      implementation.  The two bugs concern MSG_COPY interactions with other
      msgrcv() flags, namely:
      
       (A) MSG_COPY + MSG_EXCEPT
       (B) MSG_COPY + !IPC_NOWAIT
      
      The bugs are distinct (and the fix for the first one is obvious),
      however my fix for both is a single-line patch, which is why I'm
      combining them in a single mail, rather than writing two mails+patches.
      
       ===== (A) MSG_COPY + MSG_EXCEPT =====
      
      With the addition of the MSG_COPY flag, there are now two msgrcv()
      flags--MSG_COPY and MSG_EXCEPT--that modify the meaning of the 'msgtyp'
      argument in unrelated ways.  Specifying both in the same call is a
      logical error that is currently permitted, with the effect that MSG_COPY
      has priority and MSG_EXCEPT is ignored.  The call should give an error
      if both flags are specified.  The patch below implements that behavior.
      
       ===== (B) (B) MSG_COPY + !IPC_NOWAIT =====
      
      The test code that was submitted in commit 3a665531
      
       ("selftests: IPC
      message queue copy feature test") shows MSG_COPY being used in
      conjunction with IPC_NOWAIT.  In other words, if there is no message at
      the position 'msgtyp'.  return immediately with the error in ENOMSG.
      
      What was not (fully) tested is the behavior if MSG_COPY is specified
      *without* IPC_NOWAIT, and there is an odd behavior.  If the queue
      contains less than 'msgtyp' messages, then the call blocks until the
      next message is written to the queue.  At that point, the msgrcv() call
      returns a copy of the newly added message, regardless of whether that
      message is at the ordinal position 'msgtyp'.  This is clearly bogus, and
      problematic for applications that might want to make use of the MSG_COPY
      flag.
      
      I considered the following possible solutions to this problem:
      
       (1) Force the call to block until a message *does* appear at the
           position 'msgtyp'.
      
       (2) If the MSG_COPY flag is specified, the kernel should implicitly add
           IPC_NOWAIT, so that the call fails with ENOMSG for this case.
      
       (3) If the MSG_COPY flag is specified, but IPC_NOWAIT is not, generate
           an error (probably, EINVAL is the right one).
      
      I do not know if any application would really want to have the
      functionality of solution (1), especially since an application can
      determine in advance the number of messages in the queue using msgctl()
      IPC_STAT.  Obviously, this solution would be the most work to implement.
      
      Solution (2) would have the effect of silently fixing any applications
      that tried to employ broken behavior.  However, it would mean that if we
      later decided to implement solution (1), then user-space could not
      easily detect what the kernel supports (but, since I'm somewhat doubtful
      that solution (1) is needed, I'm not sure that this is much of a
      problem).
      
      Solution (3) would have the effect of informing broken applications that
      they are doing something broken.  The downside is that this would cause
      a ABI breakage for any applications that are currently employing the
      broken behavior.  However:
      
      a) Those applications are almost certainly not getting the results they
         expect.
      b) Possibly, those applications don't even exist, because MSG_COPY is
         currently hidden behind CONFIG_CHECKPOINT_RESTORE.
      
      The upside of solution (3) is that if we later decided to implement
      solution (1), user-space could determine what the kernel supports, via
      the error return.
      
      In my view, solution (3) is mildly preferable to solution (2), and
      solution (1) could still be done later if anyone really cares.  The
      patch below implements solution (3).
      
      PS.  For anyone out there still listening, it's the usual story:
      documenting an API (and the thinking about, and the testing of the API,
      that documentation entails) is the one of the single best ways of
      finding bugs in the API, as I've learned from a lot of experience.  Best
      to do that documentation before releasing the API.
      Signed-off-by: default avatarMichael Kerrisk <mtk.manpages@gmail.com>
      Acked-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
      Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
      Cc: stable@vger.kernel.org
      Cc: Serge Hallyn <serge.hallyn@canonical.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 4f87dac3
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      003ff3dd
    • Daniel J Blueman's avatar
      x86/amd/numa: Fix northbridge quirk to assign correct NUMA node · d2ec1e9a
      Daniel J Blueman authored
      
      For systems with multiple servers and routed fabric, all
      northbridges get assigned to the first server. Fix this by also
      using the node reported from the PCI bus. For single-fabric
      systems, the northbriges are on PCI bus 0 by definition, which
      are on NUMA node 0 by definition, so this is invarient on most
      systems.
      
      Tested on fam10h and fam15h single and multi-fabric systems and
      candidate for stable.
      Signed-off-by: default avatarDaniel J Blueman <daniel@numascale.com>
      Acked-by: default avatarSteffen Persvold <sp@numascale.com>
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/1394710981-3596-1-git-send-email-daniel@numascale.com
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      
      (cherry picked from commit 847d7970
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d2ec1e9a
    • Richard Weinberger's avatar
      i2c: Remove usage of orphaned symbol OF_I2C · 05b099d8
      Richard Weinberger authored
      
      The symbol is an orphan, don't depend on it anymore.
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      [wsa: enhanced commit message]
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Fixes: 687b81d0 (i2c: move OF helpers into the core)
      Cc: stable@kernel.org
      
      (cherry picked from commit 62c19c9d
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      05b099d8
    • Arnd Bergmann's avatar
      vmxnet3: fix building without CONFIG_PCI_MSI · 3d0493ad
      Arnd Bergmann authored
      Since commit d25f06ea
      
       "vmxnet3: fix netpoll race condition",
      the vmxnet3 driver fails to build when CONFIG_PCI_MSI is disabled,
      because it unconditionally references the vmxnet3_msix_rx()
      function.
      
      To fix this, use the same #ifdef in the caller that exists around
      the function definition.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Shreyas Bhatewara <sbhatewara@vmware.com>
      Cc: "VMware, Inc." <pv-drivers@vmware.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 0a8d8c44
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3d0493ad
    • Rob Clark's avatar
      drm/ttm: don't oops if no invalidate_caches() · 0f7123c7
      Rob Clark authored
      
      A few of the simpler TTM drivers (cirrus, ast, mgag200) do not implement
      this function.  Yet can end up somehow with an evicted bo:
      
        BUG: unable to handle kernel NULL pointer dereference at           (null)
        IP: [<          (null)>]           (null)
        PGD 16e761067 PUD 16e6cf067 PMD 0
        Oops: 0010 [#1] SMP
        Modules linked in: bnep bluetooth rfkill fuse ip6t_rpfilter ip6t_REJECT ipt_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw iptable_filter ip_tables sg btrfs zlib_deflate raid6_pq xor dm_queue_length iTCO_wdt iTCO_vendor_support coretemp kvm dcdbas dm_service_time microcode serio_raw pcspkr lpc_ich mfd_core i7core_edac edac_core ses enclosure ipmi_si ipmi_msghandler shpchp acpi_power_meter mperf nfsd auth_rpcgss nfs_acl lockd uinput sunrpc dm_multipath xfs libcrc32c ata_generic pata_acpi sr_mod cdrom
         sd_mod usb_storage mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit lpfc drm_kms_helper ttm crc32c_intel ata_piix bfa drm ixgbe libata i2c_core mdio crc_t10dif ptp crct10dif_common pps_core scsi_transport_fc dca scsi_tgt megaraid_sas bnx2 dm_mirror dm_region_hash dm_log dm_mod
        CPU: 16 PID: 2572 Comm: X Not tainted 3.10.0-86.el7.x86_64 #1
        Hardware name: Dell Inc. PowerEdge R810/0H235N, BIOS 0.3.0 11/14/2009
        task: ffff8801799dabc0 ti: ffff88016c884000 task.ti: ffff88016c884000
        RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
        RSP: 0018:ffff88016c885ad8  EFLAGS: 00010202
        RAX: ffffffffa04e94c0 RBX: ffff880178937a20 RCX: 0000000000000000
        RDX: 0000000000000000 RSI: 0000000000240004 RDI: ffff880178937a00
        RBP: ffff88016c885b60 R08: 00000000000171a0 R09: ffff88007cf171a0
        R10: ffffea0005842540 R11: ffffffff810487b9 R12: ffff880178937b30
        R13: ffff880178937a00 R14: ffff88016c885b78 R15: ffff880179929400
        FS:  00007f81ba2ef980(0000) GS:ffff88007cf00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000000 CR3: 000000016e763000 CR4: 00000000000007e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
        Stack:
         ffffffffa0306fae ffff8801799295c0 0000000000260004 0000000000000001
         ffff88016c885b60 ffffffffa0307669 00ff88007cf17738 ffff88017cf17700
         ffff880178937a00 ffff880100000000 ffff880100000000 0000000079929400
        Call Trace:
         [<ffffffffa0306fae>] ? ttm_bo_handle_move_mem+0x54e/0x5b0 [ttm]
         [<ffffffffa0307669>] ? ttm_bo_mem_space+0x169/0x340 [ttm]
         [<ffffffffa0307bd7>] ttm_bo_move_buffer+0x117/0x130 [ttm]
         [<ffffffff81130001>] ? perf_event_init_context+0x141/0x220
         [<ffffffffa0307cb1>] ttm_bo_validate+0xc1/0x130 [ttm]
         [<ffffffffa04e7377>] mgag200_bo_pin+0x87/0xc0 [mgag200]
         [<ffffffffa04e56c4>] mga_crtc_cursor_set+0x474/0xbb0 [mgag200]
         [<ffffffff811971d2>] ? __mem_cgroup_commit_charge+0x152/0x3b0
         [<ffffffff815c4182>] ? mutex_lock+0x12/0x2f
         [<ffffffffa0201433>] drm_mode_cursor_common+0x123/0x170 [drm]
         [<ffffffffa0205231>] drm_mode_cursor_ioctl+0x41/0x50 [drm]
         [<ffffffffa01f5ca2>] drm_ioctl+0x502/0x630 [drm]
         [<ffffffff815cbab4>] ? __do_page_fault+0x1f4/0x510
         [<ffffffff8101cb68>] ? __restore_xstate_sig+0x218/0x4f0
         [<ffffffff811b4445>] do_vfs_ioctl+0x2e5/0x4d0
         [<ffffffff8124488e>] ? file_has_perm+0x8e/0xa0
         [<ffffffff811b46b1>] SyS_ioctl+0x81/0xa0
         [<ffffffff815d05d9>] system_call_fastpath+0x16/0x1b
        Code:  Bad RIP value.
        RIP  [<          (null)>]           (null)
         RSP <ffff88016c885ad8>
        CR2: 0000000000000000
      Signed-off-by: default avatarRob Clark <rclark@redhat.com>
      Reviewed-by: default avatarJérôme Glisse <jglisse@redhat.com>
      Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 9ef7506f
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0f7123c7
    • Radim Krčmář's avatar
      KVM: SVM: fix cr8 intercept window · 6e77bf1e
      Radim Krčmář authored
      
      We always disable cr8 intercept in its handler, but only re-enable it
      if handling KVM_REQ_EVENT, so there can be a window where we do not
      intercept cr8 writes, which allows an interrupt to disrupt a higher
      priority task.
      
      Fix this by disabling intercepts in the same function that re-enables
      them when needed. This fixes BSOD in Windows 2008.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      
      (cherry picked from commit 596f3142
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6e77bf1e
    • Ales Novak's avatar
      [SCSI] storvsc: NULL pointer dereference fix · 6d71ec01
      Ales Novak authored
      
      If the initialization of storvsc fails, the storvsc_device_destroy()
      causes NULL pointer dereference.
      
      storvsc_bus_scan()
        scsi_scan_target()
          __scsi_scan_target()
            scsi_probe_and_add_lun(hostdata=NULL)
              scsi_alloc_sdev(hostdata=NULL)
      
      	  sdev->hostdata = hostdata
      
      	  now the host allocation fails
      
                __scsi_remove_device(sdev)
      
      	  calls sdev->host->hostt->slave_destroy() ==
      	  storvsc_device_destroy(sdev)
      	    access of sdev->hostdata->request_mempool
      Signed-off-by: default avatarAles Novak <alnovak@suse.cz>
      Signed-off-by: default avatarThomas Abraham <tabraham@suse.com>
      Reviewed-by: default avatarJiri Kosina <jkosina@suse.cz>
      Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      
      (cherry picked from commit b12bb60d
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6d71ec01
    • Neil Horman's avatar
      vmxnet3: fix netpoll race condition · e41a2dfa
      Neil Horman authored
      
      vmxnet3's netpoll driver is incorrectly coded.  It directly calls
      vmxnet3_do_poll, which is the driver internal napi poll routine.  As the netpoll
      controller method doesn't block real napi polls in any way, there is a potential
      for race conditions in which the netpoll controller method and the napi poll
      method run concurrently.  The result is data corruption causing panics such as this
      one recently observed:
      PID: 1371   TASK: ffff88023762caa0  CPU: 1   COMMAND: "rs:main Q:Reg"
       #0 [ffff88023abd5780] machine_kexec at ffffffff81038f3b
       #1 [ffff88023abd57e0] crash_kexec at ffffffff810c5d92
       #2 [ffff88023abd58b0] oops_end at ffffffff8152b570
       #3 [ffff88023abd58e0] die at ffffffff81010e0b
       #4 [ffff88023abd5910] do_trap at ffffffff8152add4
       #5 [ffff88023abd5970] do_invalid_op at ffffffff8100cf95
       #6 [ffff88023abd5a10] invalid_op at ffffffff8100bf9b
          [exception RIP: vmxnet3_rq_rx_complete+1968]
          RIP: ffffffffa00f1e80  RSP: ffff88023abd5ac8  RFLAGS: 00010086
          RAX: 0000000000000000  RBX: ffff88023b5dcee0  RCX: 00000000000000c0
          RDX: 0000000000000000  RSI: 00000000000005f2  RDI: ffff88023b5dcee0
          RBP: ffff88023abd5b48   R8: 0000000000000000   R9: ffff88023a3b6048
          R10: 0000000000000000  R11: 0000000000000002  R12: ffff8802398d4cd8
          R13: ffff88023af35140  R14: ffff88023b60c890  R15: 0000000000000000
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #7 [ffff88023abd5b50] vmxnet3_do_poll at ffffffffa00f204a [vmxnet3]
       #8 [ffff88023abd5b80] vmxnet3_netpoll at ffffffffa00f209c [vmxnet3]
       #9 [ffff88023abd5ba0] netpoll_poll_dev at ffffffff81472bb7
      
      The fix is to do as other drivers do, and have the poll controller call the top
      half interrupt handler, which schedules a napi poll properly to recieve frames
      
      Tested by myself, successfully.
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      CC: Shreyas Bhatewara <sbhatewara@vmware.com>
      CC: "VMware, Inc." <pv-drivers@vmware.com>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: stable@vger.kernel.org
      Reviewed-by: default avatarShreyas N Bhatewara <sbhatewara@vmware.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit d25f06ea
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e41a2dfa
    • Artem Fetishev's avatar
      fs/proc/base.c: fix GPF in /proc/$PID/map_files · 66fb2b55
      Artem Fetishev authored
      The expected logic of proc_map_files_get_link() is either to return 0
      and initialize 'path' or return an error and leave 'path' uninitialized.
      
      By the time dname_to_vma_addr() returns 0 the corresponding vma may have
      already be gone.  In this case the path is not initialized but the
      return value is still 0.  This results in 'general protection fault'
      inside d_path().
      
      Steps to reproduce:
      
        CONFIG_CHECKPOINT_RESTORE=y
      
          fd = open(...);
          while (1) {
              mmap(fd, ...);
              munmap(fd, ...);
          }
      
        ls -la /proc/$PID/map_files
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=68991
      
      Signed-off-by: default avatarArtem Fetishev <artem_fetishev@epam.com>
      Signed-off-by: default avatarAleksandr Terekhov <aleksandr_terekhov@epam.com>
      Reported-by: <wiebittewas@gmail.com>
      Acked-by: default avatarPavel Emelyanov <xemul@parallels.com>
      Acked-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
      Reviewed-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 70335abb
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      66fb2b55
    • Laura Abbott's avatar
      mm/compaction: break out of loop on !PageBuddy in isolate_freepages_block · a63da257
      Laura Abbott authored
      
      We received several reports of bad page state when freeing CMA pages
      previously allocated with alloc_contig_range:
      
          BUG: Bad page state in process Binder_A  pfn:63202
          page:d21130b0 count:0 mapcount:1 mapping:  (null) index:0x7dfbf
          page flags: 0x40080068(uptodate|lru|active|swapbacked)
      
      Based on the page state, it looks like the page was still in use.  The
      page flags do not make sense for the use case though.  Further debugging
      showed that despite alloc_contig_range returning success, at least one
      page in the range still remained in the buddy allocator.
      
      There is an issue with isolate_freepages_block.  In strict mode (which
      CMA uses), if any pages in the range cannot be isolated,
      isolate_freepages_block should return failure 0.  The current check
      keeps track of the total number of isolated pages and compares against
      the size of the range:
      
              if (strict && nr_strict_required > total_isolated)
                      total_isolated = 0;
      
      After taking the zone lock, if one of the pages in the range is not in
      the buddy allocator, we continue through the loop and do not increment
      total_isolated.  If in the last iteration of the loop we isolate more
      than one page (e.g.  last page needed is a higher order page), the check
      for total_isolated may pass and we fail to detect that a page was
      skipped.  The fix is to bail out if the loop immediately if we are in
      strict mode.  There's no benfit to continuing anyway since we need all
      pages to be isolated.  Additionally, drop the error checking based on
      nr_strict_required and just check the pfn ranges.  This matches with
      what isolate_freepages_range does.
      Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Acked-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 2af120bc
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a63da257
    • Al Viro's avatar
      ocfs2 syncs the wrong range... · 6c5f91f9
      Al Viro authored
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      
      (cherry picked from commit 1b56e989
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6c5f91f9
    • Giridhar Malavali's avatar
      [SCSI] qla2xxx: Poll during initialization for ISP25xx and ISP83xx · d2eb6bee
      Giridhar Malavali authored
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      
      (cherry picked from commit b77ed25c
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d2eb6bee
    • Lukasz Dorau's avatar
      [SCSI] isci: correct erroneous for_each_isci_host macro · a62b280e
      Lukasz Dorau authored
      In the first place, the loop 'for' in the macro 'for_each_isci_host'
      (drivers/scsi/isci/host.h:314) is incorrect, because it accesses
      the 3rd element of 2 element array. After the 2nd iteration it executes
      the instruction:
              ihost = to_pci_info(pdev)->hosts[2]
      (while the size of the 'hosts' array equals 2) and reads an
      out of range element.
      
      In the second place, this loop is incorrectly optimized by GCC v4.8
      (see http://marc.info/?l=linux-kernel&m=138998871911336&w=2
      
      ).
      As a result, on platforms with two SCU controllers,
      the loop is executed more times than it can be (for i=0,1 and 2).
      It causes kernel panic during entering the S3 state
      and the following oops after 'rmmod isci':
      
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: [<ffffffff8131360b>] __list_add+0x1b/0xc0
      Oops: 0000 [#1] SMP
      RIP: 0010:[<ffffffff8131360b>]  [<ffffffff8131360b>] __list_add+0x1b/0xc0
      Call Trace:
        [<ffffffff81661b84>] __mutex_lock_slowpath+0x114/0x1b0
        [<ffffffff81661c3f>] mutex_lock+0x1f/0x30
        [<ffffffffa03e97cb>] sas_disable_events+0x1b/0x50 [libsas]
        [<ffffffffa03e9818>] sas_unregister_ha+0x18/0x60 [libsas]
        [<ffffffffa040316e>] isci_unregister+0x1e/0x40 [isci]
        [<ffffffffa0403efd>] isci_pci_remove+0x5d/0x100 [isci]
        [<ffffffff813391cb>] pci_device_remove+0x3b/0xb0
        [<ffffffff813fbf7f>] __device_release_driver+0x7f/0xf0
        [<ffffffff813fc8f8>] driver_detach+0xa8/0xb0
        [<ffffffff813fbb8b>] bus_remove_driver+0x9b/0x120
        [<ffffffff813fcf2c>] driver_unregister+0x2c/0x50
        [<ffffffff813381f3>] pci_unregister_driver+0x23/0x80
        [<ffffffffa04152f8>] isci_exit+0x10/0x1e [isci]
        [<ffffffff810d199b>] SyS_delete_module+0x16b/0x2d0
        [<ffffffff81012a21>] ? do_notify_resume+0x61/0xa0
        [<ffffffff8166ce29>] system_call_fastpath+0x16/0x1b
      
      The loop has been corrected.
      This patch fixes kernel panic during entering the S3 state
      and the above oops.
      Signed-off-by: default avatarLukasz Dorau <lukasz.dorau@intel.com>
      Reviewed-by: default avatarMaciej Patelczyk <maciej.patelczyk@intel.com>
      Tested-by: default avatarLukasz Dorau <lukasz.dorau@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      
      (cherry picked from commit c59053a2
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a62b280e
    • Dan Williams's avatar
      [SCSI] isci: fix reset timeout handling · b8fa13ad
      Dan Williams authored
      
      Remove an erroneous BUG_ON() in the case of a hard reset timeout.  The
      reset timeout handler puts the port into the "awaiting link-up" state.
      The timeout causes the device to be disconnected and we need to be in
      the awaiting link-up state to re-connect the port.  The BUG_ON() made
      the incorrect assumption that resets never timeout and we always
      complete the reset in the "resetting" state.
      
      Testing this patch also uncovered that libata continues to attempt to
      reset the port long after the driver has torn down the context.  Once
      the driver has committed to abandoning the link it must indicate to
      libata that recovery ends by returning -ENODEV from
      ->lldd_I_T_nexus_reset().
      
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarLukasz Dorau <lukasz.dorau@intel.com>
      Reported-by: default avatarDavid Milburn <dmilburn@redhat.com>
      Reported-by: default avatarXun Ni <xun.ni@intel.com>
      Tested-by: default avatarXun Ni <xun.ni@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      
      (cherry picked from commit ddfadd77
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b8fa13ad
    • Anton Blanchard's avatar
      ibmveth: Fix endian issues with MAC addresses · f74efe30
      Anton Blanchard authored
      
      The code to load a MAC address into a u64 for passing to the
      hypervisor via a register is broken on little endian.
      
      Create a helper function called ibmveth_encode_mac_addr
      which does the right thing in both big and little endian.
      
      We were storing the MAC address in a long in struct ibmveth_adapter.
      It's never used so remove it - we don't need another place in the
      driver where we create endian issues with MAC addresses.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit d746ca95
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f74efe30
    • Anton Blanchard's avatar
      net: unix socket code abuses csum_partial · 1b85a1cc
      Anton Blanchard authored
      
      The unix socket code is using the result of csum_partial to
      hash into a lookup table:
      
      	unix_hash_fold(csum_partial(sunaddr, len, 0));
      
      csum_partial is only guaranteed to produce something that can be
      folded into a checksum, as its prototype explains:
      
       * returns a 32-bit number suitable for feeding into itself
       * or csum_tcpudp_magic
      
      The 32bit value should not be used directly.
      
      Depending on the alignment, the ppc64 csum_partial will return
      different 32bit partial checksums that will fold into the same
      16bit checksum.
      
      This difference causes the following testcase (courtesy of
      Gustavo) to sometimes fail:
      
      #include <sys/socket.h>
      #include <stdio.h>
      
      int main()
      {
      	int fd = socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0);
      
      	int i = 1;
      	setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &i, 4);
      
      	struct sockaddr addr;
      	addr.sa_family = AF_LOCAL;
      	bind(fd, &addr, 2);
      
      	listen(fd, 128);
      
      	struct sockaddr_storage ss;
      	socklen_t sslen = (socklen_t)sizeof(ss);
      	getsockname(fd, (struct sockaddr*)&ss, &sslen);
      
      	fd = socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0);
      
      	if (connect(fd, (struct sockaddr*)&ss, sslen) == -1){
      		perror(NULL);
      		return 1;
      	}
      	printf("OK\n");
      	return 0;
      }
      
      As suggested by davem, fix this by using csum_fold to fold the
      partial 32bit checksum into a 16bit checksum before using it.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 0a13404d
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1b85a1cc
    • Amitkumar Karwar's avatar
      mwifiex: copy AP's HT capability info correctly · 79497537
      Amitkumar Karwar authored
      
      While preparing association request, intersection of device's HT
      capability information and corresponding fields advertised by AP
      is used.
      
      This patch fixes an error while copying this field from AP's
      beacon.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
      Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit c99b1861
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      79497537
    • Johannes Berg's avatar
      mac80211: clear sequence/fragment number in QoS-null frames · 48cf8315
      Johannes Berg authored
      Avoid leaking data by sending uninitialized memory and setting an
      invalid (non-zero) fragment number (the sequence number is ignored
      anyway) by setting the seq_ctrl field to zero.
      
      Cc: stable@vger.kernel.org
      Fixes: 3f52b7e3 ("mac80211: mesh power save basics")
      Fixes: ce662b44
      
       ("mac80211: send (QoS) Null if no buffered frames")
      Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      
      (cherry picked from commit 864a6040
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      48cf8315
    • Linus Torvalds's avatar
      x86: fix compile error due to X86_TRAP_NMI use in asm files · e23b862b
      Linus Torvalds authored
      It's an enum, not a #define, you can't use it in asm files.
      
      Introduced in commit 5fa10196
      
       ("x86: Ignore NMIs that come in during
      early boot"), and sadly I didn't compile-test things like I should have
      before pushing out.
      
      My weak excuse is that the x86 tree generally doesn't introduce stupid
      things like this (and the ARM pull afterwards doesn't cause me to do a
      compile-test either, since I don't cross-compile).
      
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit b01d4e68
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e23b862b
    • H. Peter Anvin's avatar
      x86: Ignore NMIs that come in during early boot · ffc67bc2
      H. Peter Anvin authored
      
      Don Zickus reports:
      
      A customer generated an external NMI using their iLO to test kdump
      worked.  Unfortunately, the machine hung.  Disabling the nmi_watchdog
      made things work.
      
      I speculated the external NMI fired, caused the machine to panic (as
      expected) and the perf NMI from the watchdog came in and was latched.
      My guess was this somehow caused the hang.
      
         ----
      
      It appears that the latched NMI stays latched until the early page
      table generation on 64 bits, which causes exceptions to happen which
      end in IRET, which re-enable NMI.  Therefore, ignore NMIs that come in
      during early execution, until we have proper exception handling.
      Reported-and-tested-by: default avatarDon Zickus <dzickus@redhat.com>
      Link: http://lkml.kernel.org/r/1394221143-29713-1-git-send-email-dzickus@redhat.com
      
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Cc: <stable@vger.kernel.org> # v3.5+, older with some backport effort
      
      (cherry picked from commit 5fa10196
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ffc67bc2
    • Linus Walleij's avatar
      ARM: 7991/1: sa1100: fix compile problem on Collie · d2d15905
      Linus Walleij authored
      Due to a problem in the MFD Kconfig it was not possible to
      compile the UCB battery driver for the Collie SA1100 system,
      in turn making it impossible to compile in the battery driver.
      (See patch "mfd: include all drivers in subsystem menu".)
      
      After fixing the MFD Kconfig (separate patch) a compile error
      appears in the Collie battery driver due to the <mach/collie.h>
      implicitly requiring <mach/hardware.h> through <linux/gpio.h>
      via <mach/gpio.h> prior to commit
      40ca061b
      
       "ARM: 7841/1: sa1100: remove complex GPIO interface".
      
      Fix this up by including the required header into
      <mach/collie.h>.
      
      Cc: stable@vger.kernel.org
      Cc: Andrea Adami <andrea.adami@gmail.com>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      
      (cherry picked from commit 052450fd
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d2d15905
    • Russell King's avatar
      ARM: fix noMMU kallsyms symbol filtering · d594c453
      Russell King authored
      With noMMU, CONFIG_PAGE_OFFSET was not being set correctly.  As there's
      no MMU, PAGE_OFFSET should be equal to PHYS_OFFSET in all cases.  This
      commit makes that explicit.
      
      Since we do this, we don't need to mess around in asm/memory.h with
      ifdefs to sort this out, so let's get rid of that, and there's no point
      offering the "Memory split" option for noMMU as that's meaningless
      there.
      
      Fixes: b9b32bf7
      
       ("ARM: use linker magic for vectors and vector stubs")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      
      (cherry picked from commit 006fa259
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d594c453
    • Julius Werner's avatar
      usb: Make DELAY_INIT quirk wait 100ms between Get Configuration requests · 08712d32
      Julius Werner authored
      
      The DELAY_INIT quirk only reduces the frequency of enumeration failures
      with the Logitech HD Pro C920 and C930e webcams, but does not quite
      eliminate them. We have found that adding a delay of 100ms between the
      first and second Get Configuration request makes the device enumerate
      perfectly reliable even after several weeks of extensive testing. The
      reasons for that are anyone's guess, but since the DELAY_INIT quirk
      already delays enumeration by a whole second, wating for another 10th of
      that isn't really a big deal for the one other device that uses it, and
      it will resolve the problems with these webcams.
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit d86db25e
      
      )
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      08712d32