1. 17 8月, 2019 6 次提交
    • E
      ext4: fix reserved cluster accounting at page invalidation time · 9d4fad52
      Eric Whitney 提交于
      commit f456767d3391e9f7d9d25a2e7241d75676dc19da upstream.
      
      Add new code to count canceled pending cluster reservations on bigalloc
      file systems and to reduce the cluster reservation count on all file
      systems using delayed allocation.  This replaces old code in
      ext4_da_page_release_reservations that was incorrect.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      9d4fad52
    • E
      ext4: adjust reserved cluster count when removing extents · 8962ca9b
      Eric Whitney 提交于
      commit 9fe671496b6c286f9033aedfc1718d67721da0ae upstream.
      
      Modify ext4_ext_remove_space() and the code it calls to correct the
      reserved cluster count for pending reservations (delayed allocated
      clusters shared with allocated blocks) when a block range is removed
      from the extent tree.  Pending reservations may be found for the clusters
      at the ends of written or unwritten extents when a block range is removed.
      If a physical cluster at the end of an extent is freed, it's necessary
      to increment the reserved cluster count to maintain correct accounting
      if the corresponding logical cluster is shared with at least one
      delayed and unwritten extent as found in the extents status tree.
      
      Add a new function, ext4_rereserve_cluster(), to reapply a reservation
      on a delayed allocated cluster sharing blocks with a freed allocated
      cluster.  To avoid ENOSPC on reservation, a flag is applied to
      ext4_free_blocks() to briefly defer updating the freeclusters counter
      when an allocated cluster is freed.  This prevents another thread
      from allocating the freed block before the reservation can be reapplied.
      
      Redefine the partial cluster object as a struct to carry more state
      information and to clarify the code using it.
      
      Adjust the conditional code structure in ext4_ext_remove_space to
      reduce the indentation level in the main body of the code to improve
      readability.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      8962ca9b
    • E
      ext4: reduce reserved cluster count by number of allocated clusters · 51b2c187
      Eric Whitney 提交于
      commit b6bf9171ef5c37b66d446378ba63af5339a56a97 upstream.
      
      Ext4 does not always reduce the reserved cluster count by the number
      of clusters allocated when mapping a delayed extent.  It sometimes
      adds back one or more clusters after allocation if delalloc blocks
      adjacent to the range allocated by ext4_ext_map_blocks() share the
      clusters newly allocated for that range.  However, this overcounts
      the number of clusters needed to satisfy future mapping requests
      (holding one or more reservations for clusters that have already been
      allocated) and premature ENOSPC and quota failures, etc., result.
      
      Ext4 also does not reduce the reserved cluster count when allocating
      clusters for non-delayed allocated writes that have previously been
      reserved for delayed writes.  This also results in overcounts.
      
      To make it possible to handle reserved cluster accounting for
      fallocated regions in the same manner as used for other non-delayed
      writes, do the reserved cluster accounting for them at the time of
      allocation.  In the current code, this is only done later when a
      delayed extent sharing the fallocated region is finally mapped.
      
      Address comment correcting handling of unsigned long long constant
      from Jan Kara's review of RFC version of this patch.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      51b2c187
    • E
      ext4: fix reserved cluster accounting at delayed write time · e986893f
      Eric Whitney 提交于
      commit 0b02f4c0d6d9e2c611dfbdd4317193e9dca740e6 upstream.
      
      The code in ext4_da_map_blocks sometimes reserves space for more
      delayed allocated clusters than it should, resulting in premature
      ENOSPC, exceeded quota, and inaccurate free space reporting.
      
      Fix this by checking for written and unwritten blocks shared in the
      same cluster with the newly delayed allocated block.  A cluster
      reservation should not be made for a cluster for which physical space
      has already been allocated.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      e986893f
    • E
      ext4: add new pending reservation mechanism · e0a71b08
      Eric Whitney 提交于
      commit 1dc0aa46e74a3366e12f426b7caaca477853e9c3 upstream.
      
      Add new pending reservation mechanism to help manage reserved cluster
      accounting.  Its primary function is to avoid the need to read extents
      from the disk when invalidating pages as a result of a truncate, punch
      hole, or collapse range operation.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      e0a71b08
    • E
      ext4: generalize extents status tree search functions · af4cc672
      Eric Whitney 提交于
      commit ad431025aecda85d3ebef5e4a3aca5c1c681d0c7 upstream.
      
      Ext4 contains a few functions that are used to search for delayed
      extents or blocks in the extents status tree.  Rather than duplicate
      code to add new functions to search for extents with different status
      values, such as written or a combination of delayed and unwritten,
      generalize the existing code to search for caller-specified extents
      status values.  Also, move this code into extents_status.c where it
      is better associated with the data structures it operates upon, and
      where it can be more readily used to implement new extents status tree
      functions that might want a broader scope for i_es_lock.
      
      Three missing static specifiers in RFC version of patch reported and
      fixed by Fengguang Wu <fengguang.wu@intel.com>.
      Signed-off-by: NEric Whitney <enwlinux@gmail.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
      af4cc672
  2. 16 8月, 2019 34 次提交
    • G
      Linux 4.19.67 · a5aa8058
      Greg Kroah-Hartman 提交于
      a5aa8058
    • L
      iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support · ac295111
      Luca Coelho 提交于
      commit f5a47fae6aa3eb06f100e701d2342ee56b857bee upstream.
      
      We erroneously added a check for FW API version 41 before sending
      GEO_TX_POWER_LIMIT, but this was already implemented in version 38.
      Additionally, it was cherry-picked to older versions, namely 17, 26
      and 29, so check for those as well.
      
      Cc: stable@vger.kernel.org
      Fixes: eca1e56ceedd ("iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT to old firmwares")
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac295111
    • L
      iwlwifi: mvm: don't send GEO_TX_POWER_LIMIT on version < 41 · 6a81677a
      Luca Coelho 提交于
      commit 39bd984c203e86f3109b49c2a2e20677c4d3ab65 upstream.
      
      Firmware versions before 41 don't support the GEO_TX_POWER_LIMIT
      command, and sending it to the firmware will cause a firmware crash.
      We allow this via debugfs, so we need to return an error value in case
      it's not supported.
      
      This had already been fixed during init, when we send the command if
      the ACPI WGDS table is present.  Fix it also for the other,
      userspace-triggered case.
      
      Cc: stable@vger.kernel.org
      Fixes: 7fe90e0e ("iwlwifi: mvm: refactor geo init")
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a81677a
    • E
      iwlwifi: mvm: fix an out-of-bound access · 80bac45e
      Emmanuel Grumbach 提交于
      commit ba3224db78034435e9ff0247277cce7c7bb1756c upstream.
      
      The index for the elements of the ACPI object we dereference
      was static. This means that if we called the function twice
      we wouldn't start from 3 again, but rather from the latest
      index we reached in the previous call.
      This was dutifully reported by KASAN.
      
      Fix this.
      
      Cc: stable@vger.kernel.org
      Fixes: 69964905 ("iwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table")
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80bac45e
    • E
      iwlwifi: don't unmap as page memory that was mapped as single · 7626b510
      Emmanuel Grumbach 提交于
      commit 87e7e25aee6b59fef740856f4e86d4b60496c9e1 upstream.
      
      In order to remember how to unmap a memory (as single or
      as page), we maintain a bit per Transmit Buffer (TBs) in
      the meta data (structure iwl_cmd_meta).
      We maintain a bitmap: 1 bit per TB.
      If the TB is set, we will free the memory as a page.
      This bitmap was never cleared. Fix this.
      
      Cc: stable@vger.kernel.org
      Fixes: 3cd1980b ("iwlwifi: pcie: introduce new tfd and tb formats")
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7626b510
    • B
      mwifiex: fix 802.11n/WPA detection · b38c56b7
      Brian Norris 提交于
      commit df612421fe2566654047769c6852ffae1a31df16 upstream.
      
      Commit 63d7ef36103d ("mwifiex: Don't abort on small, spec-compliant
      vendor IEs") adjusted the ieee_types_vendor_header struct, which
      inadvertently messed up the offsets used in
      mwifiex_is_wpa_oui_present(). Add that offset back in, mirroring
      mwifiex_is_rsn_oui_present().
      
      As it stands, commit 63d7ef36103d breaks compatibility with WPA (not
      WPA2) 802.11n networks, since we hit the "info: Disable 11n if AES is
      not supported by AP" case in mwifiex_is_network_compatible().
      
      Fixes: 63d7ef36103d ("mwifiex: Don't abort on small, spec-compliant vendor IEs")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b38c56b7
    • W
      KVM: Fix leak vCPU's VMCS value into other pCPU · 2bc73d91
      Wanpeng Li 提交于
      commit 17e433b54393a6269acbcb792da97791fe1592d8 upstream.
      
      After commit d73eb57b80b (KVM: Boost vCPUs that are delivering interrupts), a
      five years old bug is exposed. Running ebizzy benchmark in three 80 vCPUs VMs
      on one 80 pCPUs Skylake server, a lot of rcu_sched stall warning splatting
      in the VMs after stress testing:
      
       INFO: rcu_sched detected stalls on CPUs/tasks: { 4 41 57 62 77} (detected by 15, t=60004 jiffies, g=899, c=898, q=15073)
       Call Trace:
         flush_tlb_mm_range+0x68/0x140
         tlb_flush_mmu.part.75+0x37/0xe0
         tlb_finish_mmu+0x55/0x60
         zap_page_range+0x142/0x190
         SyS_madvise+0x3cd/0x9c0
         system_call_fastpath+0x1c/0x21
      
      swait_active() sustains to be true before finish_swait() is called in
      kvm_vcpu_block(), voluntarily preempted vCPUs are taken into account
      by kvm_vcpu_on_spin() loop greatly increases the probability condition
      kvm_arch_vcpu_runnable(vcpu) is checked and can be true, when APICv
      is enabled the yield-candidate vCPU's VMCS RVI field leaks(by
      vmx_sync_pir_to_irr()) into spinning-on-a-taken-lock vCPU's current
      VMCS.
      
      This patch fixes it by checking conservatively a subset of events.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Marc Zyngier <Marc.Zyngier@arm.com>
      Cc: stable@vger.kernel.org
      Fixes: 98f4a146 (KVM: add kvm_arch_vcpu_runnable() test to kvm_vcpu_on_spin() loop)
      Signed-off-by: NWanpeng Li <wanpengli@tencent.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bc73d91
    • T
      NFSv4: Fix an Oops in nfs4_do_setattr · d1489f0b
      Trond Myklebust 提交于
      commit 09a54f0ebfe263bc27c90bbd80187b9a93283887 upstream.
      
      If the user specifies an open mode of 3, then we don't have a NFSv4 state
      attached to the context, and so we Oops when we try to dereference it.
      Reported-by: NOlga Kornievskaia <aglo@umich.edu>
      Fixes: 29b59f94 ("NFSv4: change nfs4_do_setattr to take...")
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Cc: stable@vger.kernel.org # v4.10: 991eedb1: NFSv4: Only pass the...
      Cc: stable@vger.kernel.org # v4.10+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1489f0b
    • S
      smb3: send CAP_DFS capability during session setup · 898c19f1
      Steve French 提交于
      commit 8d33096a460d5b9bd13300f01615df5bb454db10 upstream.
      
      We had a report of a server which did not do a DFS referral
      because the session setup Capabilities field was set to 0
      (unlike negotiate protocol where we set CAP_DFS).  Better to
      send it session setup in the capabilities as well (this also
      more closely matches Windows client behavior).
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      898c19f1
    • P
      SMB3: Fix deadlock in validate negotiate hits reconnect · 50831f1a
      Pavel Shilovsky 提交于
      commit e99c63e4d86d3a94818693147b469fa70de6f945 upstream.
      
      Currently we skip SMB2_TREE_CONNECT command when checking during
      reconnect because Tree Connect happens when establishing
      an SMB session. For SMB 3.0 protocol version the code also calls
      validate negotiate which results in SMB2_IOCL command being sent
      over the wire. This may deadlock on trying to acquire a mutex when
      checking for reconnect. Fix this by skipping SMB2_IOCL command
      when doing the reconnect check.
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      50831f1a
    • V
      dax: dax_layout_busy_page() should not unmap cow pages · 2afa6c13
      Vivek Goyal 提交于
      commit d75996dd022b6d83bd14af59b2775b1aa639e4b9 upstream.
      
      Vivek:
      
          "As of now dax_layout_busy_page() calls unmap_mapping_range() with last
           argument as 1, which says even unmap cow pages. I am wondering who needs
           to get rid of cow pages as well.
      
           I noticed one interesting side affect of this. I mount xfs with -o dax and
           mmaped a file with MAP_PRIVATE and wrote some data to a page which created
           cow page. Then I called fallocate() on that file to zero a page of file.
           fallocate() called dax_layout_busy_page() which unmapped cow pages as well
           and then I tried to read back the data I wrote and what I get is old
           data from persistent memory. I lost the data I had written. This
           read basically resulted in new fault and read back the data from
           persistent memory.
      
           This sounds wrong. Are there any users which need to unmap cow pages
           as well? If not, I am proposing changing it to not unmap cow pages.
      
           I noticed this while while writing virtio_fs code where when I tried
           to reclaim a memory range and that corrupted the executable and I
           was running from virtio-fs and program got segment violation."
      
      Dan:
      
          "In fact the unmap_mapping_range() in this path is only to synchronize
           against get_user_pages_fast() and force it to call back into the
           filesystem to re-establish the mapping. COW pages should be left
           untouched by dax_layout_busy_page()."
      
      Cc: <stable@vger.kernel.org>
      Fixes: 5fac7408 ("mm, fs, dax: handle layout changes to pinned dax mappings")
      Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
      Link: https://lore.kernel.org/r/20190802192956.GA3032@redhat.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2afa6c13
    • B
      mac80211: don't WARN on short WMM parameters from AP · a566750c
      Brian Norris 提交于
      commit 05aaa5c97dce4c10a9e7eae2f1569a684e0c5ced upstream.
      
      In a very similar spirit to commit c470bdc1 ("mac80211: don't WARN
      on bad WMM parameters from buggy APs"), an AP may not transmit a
      fully-formed WMM IE. For example, it may miss or repeat an Access
      Category. The above loop won't catch that and will instead leave one of
      the four ACs zeroed out. This triggers the following warning in
      drv_conf_tx()
      
        wlan0: invalid CW_min/CW_max: 0/0
      
      and it may leave one of the hardware queues unconfigured. If we detect
      such a case, let's just print a warning and fall back to the defaults.
      
      Tested with a hacked version of hostapd, intentionally corrupting the
      IEs in hostapd_eid_wmm().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NBrian Norris <briannorris@chromium.org>
      Link: https://lore.kernel.org/r/20190726224758.210953-1-briannorris@chromium.orgSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a566750c
    • T
      ALSA: hda - Workaround for crackled sound on AMD controller (1022:1457) · af9d64f8
      Takashi Iwai 提交于
      commit c02f77d32d2c45cfb1b2bb99eabd8a78f5ecc7db upstream.
      
      A long-time problem on the recent AMD chip (X370, X470, B450, etc with
      PCI ID 1022:1457) with Realtek codecs is the crackled or distorted
      sound for capture streams, as well as occasional playback hiccups.
      After lengthy debugging sessions, the workarounds we've found are like
      the following:
      
      - Set up the proper driver caps for this controller, similar as the
        other AMD controller.
      
      - Correct the DMA position reporting with the fixed FIFO size, which
        is similar like as workaround used for VIA chip set.
      
      - Even after the position correction, PulseAudio still shows
        mysterious stalls of playback streams when a capture is triggered in
        timer-scheduled mode.  Since we have no clear way to eliminate the
        stall, pass the BATCH PCM flag for PA to suppress the tsched mode as
        a temporary workaround.
      
      This patch implements the workarounds.  For the driver caps, it
      defines a new preset, AXZ_DCAPS_PRESET_AMD_SB.  It enables the FIFO-
      corrected position reporting (corresponding to the new position_fix=6)
      and enforces the SNDRV_PCM_INFO_BATCH flag.
      
      Note that the current implementation is merely a workaround.
      Hopefully we'll find a better alternative in future, especially about
      removing the BATCH flag hack again.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195303
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af9d64f8
    • T
      ALSA: hda - Don't override global PCM hw info flag · 06f0bcac
      Takashi Iwai 提交于
      commit c1c6c877b0c79fd7e05c931435aa42211eaeebaf upstream.
      
      The commit bfcba288 ("ALSA - hda: Add support for link audio time
      reporting") introduced the conditional PCM hw info setup, but it
      overwrites the global azx_pcm_hw object.  This will cause a problem if
      any other HD-audio controller, as it'll inherit the same bit flag
      although another controller doesn't support that feature.
      
      Fix the bug by setting the PCM hw info flag locally.
      
      Fixes: bfcba288 ("ALSA - hda: Add support for link audio time reporting")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06f0bcac
    • W
      ALSA: hiface: fix multiple memory leak bugs · 1c286e4e
      Wenwen Wang 提交于
      commit 3d92aa45fbfd7319e3a19f4ec59fd32b3862b723 upstream.
      
      In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later
      on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i]'. In
      hiface_pcm_init_urb(), 'rt->out_urbs[i].buffer' is allocated through
      kzalloc().  However, if hiface_pcm_init_urb() fails, both 'rt' and
      'rt->out_urbs[i].buffer' are not deallocated, leading to memory leak bugs.
      Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails.
      
      To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'.
      
      Fixes: a91c3fb2 ("Add M2Tech hiFace USB-SPDIF driver")
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c286e4e
    • W
      ALSA: firewire: fix a memory leak bug · bc972b6b
      Wenwen Wang 提交于
      commit 1be3c1fae6c1e1f5bb982b255d2034034454527a upstream.
      
      In iso_packets_buffer_init(), 'b->packets' is allocated through
      kmalloc_array(). Then, the aligned packet size is checked. If it is
      larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
      However, the allocated 'b->packets' is not deallocated on this path,
      leading to a memory leak.
      
      To fix the above issue, free 'b->packets' before returning the error code.
      
      Fixes: 31ef9134 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # v2.6.39+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc972b6b
    • S
      drm/i915: Fix wrong escape clock divisor init for GLK · edc38856
      Stanislav Lisovskiy 提交于
      commit 73a0ff0b30af79bf0303d557eb82f1d1945bb6ee upstream.
      
      According to Bspec clock divisor registers in GeminiLake
      should be initialized by shifting 1(<<) to amount of correspondent
      divisor. While i915 was writing all this time that value as is.
      
      Surprisingly that it by accident worked, until we met some issues
      with Microtech Etab.
      
      v2: Added Fixes tag and cc
      v3: Added stable to cc as well.
      Signed-off-by: NStanislav Lisovskiy <stanislav.lisovskiy@intel.com>
      Reviewed-by: NVandita Kulkarni <vandita.kulkarni@intel.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108826
      Fixes: bcc65700 ("drm/i915/glk: Program txesc clock divider for GLK")
      Cc: Deepak M <m.deepak@intel.com>
      Cc: Madhav Chauhan <madhav.chauhan@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: intel-gfx@lists.freedesktop.org
      Cc: stable@vger.kernel.org
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190712081938.14185-1-stanislav.lisovskiy@intel.com
      (cherry picked from commit ce52ad5dd52cfaf3398058384e0ff94134bbd89c)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edc38856
    • G
      hwmon: (nct7802) Fix wrong detection of in4 presence · a7302720
      Guenter Roeck 提交于
      commit 38ada2f406a9b81fb1249c5c9227fa657e7d5671 upstream.
      
      The code to detect if in4 is present is wrong; if in4 is not present,
      the in4_input sysfs attribute is still present.
      
      In detail:
      
      - Ihen RTD3_MD=11 (VSEN3 present), everything is as expected (no bug).
      - If we have RTD3_MD!=11 (no VSEN3), we unexpectedly have a in4_input
        file under /sys and the "sensors" command displays in4_input.
        But as expected, we have no in4_min, in4_max, in4_alarm, in4_beep.
      
      Fix is_visible function to detect and report in4_input visibility
      as expected.
      Reported-by: NGilles Buloz <Gilles.Buloz@kontron.com>
      Cc: Gilles Buloz <Gilles.Buloz@kontron.com>
      Cc: stable@vger.kernel.org
      Fixes: 3434f378 ("hwmon: Driver for Nuvoton NCT7802Y")
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a7302720
    • T
      can: peak_usb: pcan_usb_fd: Fix info-leaks to USB devices · 9ce1b3eb
      Tomas Bortoli 提交于
      commit 30a8beeb3042f49d0537b7050fd21b490166a3d9 upstream.
      
      Uninitialized Kernel memory can leak to USB devices.
      
      Fix by using kzalloc() instead of kmalloc() on the affected buffers.
      Signed-off-by: NTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+513e4d0985298538bf9b@syzkaller.appspotmail.com
      Fixes: 0a25e1f4 ("can: peak_usb: add support for PEAK new CANFD USB adapters")
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ce1b3eb
    • T
      can: peak_usb: pcan_usb_pro: Fix info-leaks to USB devices · cab569a4
      Tomas Bortoli 提交于
      commit ead16e53c2f0ed946d82d4037c630e2f60f4ab69 upstream.
      
      Uninitialized Kernel memory can leak to USB devices.
      
      Fix by using kzalloc() instead of kmalloc() on the affected buffers.
      Signed-off-by: NTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+d6a5a1a3657b596ef132@syzkaller.appspotmail.com
      Fixes: f14e2243 ("net: can: peak_usb: Do not do dma on the stack")
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cab569a4
    • W
      ALSA: usb-audio: fix a memory leak bug · d4d904e4
      Wenwen Wang 提交于
      commit a67060201b746a308b1674f66bf289c9faef6d09 upstream.
      
      In snd_usb_get_audioformat_uac3(), a structure for channel maps 'chmap' is
      allocated through kzalloc() before the execution goto 'found_clock'.
      However, this structure is not deallocated if the memory allocation for
      'pd' fails, leading to a memory leak bug.
      
      To fix the above issue, free 'fp->chmap' before returning NULL.
      
      Fixes: 7edf3b5e ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4d904e4
    • N
      x86/purgatory: Do not use __builtin_memcpy and __builtin_memset · e0d262a5
      Nick Desaulniers 提交于
      commit 4ce97317f41d38584fb93578e922fcd19e535f5b upstream.
      
      Implementing memcpy and memset in terms of __builtin_memcpy and
      __builtin_memset is problematic.
      
      GCC at -O2 will replace calls to the builtins with calls to memcpy and
      memset (but will generate an inline implementation at -Os).  Clang will
      replace the builtins with these calls regardless of optimization level.
      $ llvm-objdump -dr arch/x86/purgatory/string.o | tail
      
      0000000000000339 memcpy:
           339: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax
                      000000000000033b:  R_X86_64_64  memcpy
           343: ff e0                         jmpq    *%rax
      
      0000000000000345 memset:
           345: 48 b8 00 00 00 00 00 00 00 00 movabsq $0, %rax
                      0000000000000347:  R_X86_64_64  memset
           34f: ff e0
      
      Such code results in infinite recursion at runtime. This is observed
      when doing kexec.
      
      Instead, reuse an implementation from arch/x86/boot/compressed/string.c.
      This requires to implement a stub function for warn(). Also, Clang may
      lower memcmp's that compare against 0 to bcmp's, so add a small definition,
      too. See also: commit 5f074f3e192f ("lib/string.c: implement a basic bcmp")
      
      Fixes: 8fc5b4d4 ("purgatory: core purgatory functionality")
      Reported-by: NVaibhav Rustagi <vaibhavrustagi@google.com>
      Debugged-by: NVaibhav Rustagi <vaibhavrustagi@google.com>
      Debugged-by: NManoj Gupta <manojgupta@google.com>
      Suggested-by: NAlistair Delva <adelva@google.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NVaibhav Rustagi <vaibhavrustagi@google.com>
      Cc: stable@vger.kernel.org
      Link: https://bugs.chromium.org/p/chromium/issues/detail?id=984056
      Link: https://lkml.kernel.org/r/20190807221539.94583-1-ndesaulniers@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0d262a5
    • R
      HID: sony: Fix race condition between rumble and device remove. · 11829307
      Roderick Colenbrander 提交于
      commit e0f6974a54d3f7f1b5fdf5a593bd43ce9206ec04 upstream.
      
      Valve reported a kernel crash on Ubuntu 18.04 when disconnecting a DS4
      gamepad while rumble is enabled. This issue is reproducible with a
      frequency of 1 in 3 times in the game Borderlands 2 when using an
      automatic weapon, which triggers many rumble operations.
      
      We found the issue to be a race condition between sony_remove and the
      final device destruction by the HID / input system. The problem was
      that sony_remove didn't clean some of its work_item state in
      "struct sony_sc". After sony_remove work, the corresponding evdev
      node was around for sufficient time for applications to still queue
      rumble work after "sony_remove".
      
      On pre-4.19 kernels the race condition caused a kernel crash due to a
      NULL-pointer dereference as "sc->output_report_dmabuf" got freed during
      sony_remove. On newer kernels this crash doesn't happen due the buffer
      now being allocated using devm_kzalloc. However we can still queue work,
      while the driver is an undefined state.
      
      This patch fixes the described problem, by guarding the work_item
      "state_worker" with an initialized variable, which we are setting back
      to 0 on cleanup.
      Signed-off-by: NRoderick Colenbrander <roderick.colenbrander@sony.com>
      CC: stable@vger.kernel.org
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11829307
    • H
      s390/dma: provide proper ARCH_ZONE_DMA_BITS value · 5c4689cb
      Halil Pasic 提交于
      [ Upstream commit 1a2dcff881059dedc14fafc8a442664c8dbd60f1 ]
      
      On s390 ZONE_DMA is up to 2G, i.e. ARCH_ZONE_DMA_BITS should be 31 bits.
      The current value is 24 and makes __dma_direct_alloc_pages() take a
      wrong turn first (but __dma_direct_alloc_pages() recovers then).
      
      Let's correct ARCH_ZONE_DMA_BITS value and avoid wrong turns.
      Signed-off-by: NHalil Pasic <pasic@linux.ibm.com>
      Reported-by: NPetr Tesarik <ptesarik@suse.cz>
      Fixes: c61e9637 ("dma-direct: add support for allocation from ZONE_DMA and ZONE_DMA32")
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5c4689cb
    • L
      perf/core: Fix creating kernel counters for PMUs that override event->cpu · d7681739
      Leonard Crestez 提交于
      [ Upstream commit 4ce54af8b33d3e21ca935fc1b89b58cbba956051 ]
      
      Some hardware PMU drivers will override perf_event.cpu inside their
      event_init callback. This causes a lockdep splat when initialized through
      the kernel API:
      
       WARNING: CPU: 0 PID: 250 at kernel/events/core.c:2917 ctx_sched_out+0x78/0x208
       pc : ctx_sched_out+0x78/0x208
       Call trace:
        ctx_sched_out+0x78/0x208
        __perf_install_in_context+0x160/0x248
        remote_function+0x58/0x68
        generic_exec_single+0x100/0x180
        smp_call_function_single+0x174/0x1b8
        perf_install_in_context+0x178/0x188
        perf_event_create_kernel_counter+0x118/0x160
      
      Fix this by calling perf_install_in_context with event->cpu, just like
      perf_event_open
      Signed-off-by: NLeonard Crestez <leonard.crestez@nxp.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Frank Li <Frank.li@nxp.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lkml.kernel.org/r/c4ebe0503623066896d7046def4d6b1e06e0eb2e.1563972056.git.leonard.crestez@nxp.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d7681739
    • P
      tty/ldsem, locking/rwsem: Add missing ACQUIRE to read_failed sleep loop · 06dc9214
      Peter Zijlstra 提交于
      [ Upstream commit 952041a8639a7a3a73a2b6573cb8aa8518bc39f8 ]
      
      While reviewing rwsem down_slowpath, Will noticed ldsem had a copy of
      a bug we just found for rwsem.
      
        X = 0;
      
        CPU0			CPU1
      
        rwsem_down_read()
          for (;;) {
            set_current_state(TASK_UNINTERRUPTIBLE);
      
                              X = 1;
                              rwsem_up_write();
                                rwsem_mark_wake()
                                  atomic_long_add(adjustment, &sem->count);
                                  smp_store_release(&waiter->task, NULL);
      
            if (!waiter.task)
              break;
      
            ...
          }
      
        r = X;
      
      Allows 'r == 0'.
      Reported-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWill Deacon <will@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 4898e640 ("tty: Add timed, writer-prioritized rw semaphore")
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      06dc9214
    • W
      test_firmware: fix a memory leak bug · 0ba69e96
      Wenwen Wang 提交于
      [ Upstream commit d4fddac5a51c378c5d3e68658816c37132611e1f ]
      
      In test_firmware_init(), the buffer pointed to by the global pointer
      'test_fw_config' is allocated through kzalloc(). Then, the buffer is
      initialized in __test_firmware_config_init(). In the case that the
      initialization fails, the following execution in test_firmware_init() needs
      to be terminated with an error code returned to indicate this failure.
      However, the allocated buffer is not freed on this execution path, leading
      to a memory leak bug.
      
      To fix the above issue, free the allocated buffer before returning from
      test_firmware_init().
      Signed-off-by: NWenwen Wang <wenwen@cs.uga.edu>
      Link: https://lore.kernel.org/r/1563084696-6865-1-git-send-email-wang6495@umn.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0ba69e96
    • H
      scsi: scsi_dh_alua: always use a 2 second delay before retrying RTPG · cdd92ebe
      Hannes Reinecke 提交于
      [ Upstream commit 20122994e38aef0ae50555884d287adde6641c94 ]
      
      Retrying immediately after we've received a 'transitioning' sense code is
      pretty much pointless, we should always use a delay before retrying.  So
      ensure the default delay is applied before retrying.
      Signed-off-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NZhangguanghui <zhang.guanghui@h3c.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      cdd92ebe
    • T
      scsi: ibmvfc: fix WARN_ON during event pool release · b620c6d5
      Tyrel Datwyler 提交于
      [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ]
      
      While removing an ibmvfc client adapter a WARN_ON like the following
      WARN_ON is seen in the kernel log:
      
      WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541
      ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc]
      CPU: 6 PID: 5421 Comm: rmmod Tainted: G            E     4.17.0-rc1-next-20180419-autotest #1
      NIP:  d00000000290328c LR: d00000000290325c CTR: c00000000036ee20
      REGS: c000000288d1b7e0 TRAP: 0700   Tainted: G            E      (4.17.0-rc1-next-20180419-autotest)
      MSR:  800000010282b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]>  CR: 44008828  XER: 20000000
      CFAR: c00000000036e408 SOFTE: 1
      GPR00: d00000000290325c c000000288d1ba60 d000000002917900 c000000289d75448
      GPR04: 0000000000000071 c0000000ff870000 0000000018040000 0000000000000001
      GPR08: 0000000000000000 c00000000156e838 0000000000000001 d00000000290c640
      GPR12: c00000000036ee20 c00000001ec4dc00 0000000000000000 0000000000000000
      GPR16: 0000000000000000 0000000000000000 00000100276901e0 0000000010020598
      GPR20: 0000000010020550 0000000010020538 0000000010020578 00000000100205b0
      GPR24: 0000000000000000 0000000000000000 0000000010020590 5deadbeef0000100
      GPR28: 5deadbeef0000200 d000000002910b00 0000000000000071 c0000002822f87d8
      NIP [d00000000290328c] ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc]
      LR [d00000000290325c] ibmvfc_free_event_pool+0xfc/0x1f0 [ibmvfc]
      Call Trace:
      [c000000288d1ba60] [d00000000290325c] ibmvfc_free_event_pool+0xfc/0x1f0 [ibmvfc] (unreliable)
      [c000000288d1baf0] [d000000002909390] ibmvfc_abort_task_set+0x7b0/0x8b0 [ibmvfc]
      [c000000288d1bb70] [c0000000000d8c68] vio_bus_remove+0x68/0x100
      [c000000288d1bbb0] [c0000000007da7c4] device_release_driver_internal+0x1f4/0x2d0
      [c000000288d1bc00] [c0000000007da95c] driver_detach+0x7c/0x100
      [c000000288d1bc40] [c0000000007d8af4] bus_remove_driver+0x84/0x140
      [c000000288d1bcb0] [c0000000007db6ac] driver_unregister+0x4c/0xa0
      [c000000288d1bd20] [c0000000000d6e7c] vio_unregister_driver+0x2c/0x50
      [c000000288d1bd50] [d00000000290ba0c] cleanup_module+0x24/0x15e0 [ibmvfc]
      [c000000288d1bd70] [c0000000001dadb0] sys_delete_module+0x220/0x2d0
      [c000000288d1be30] [c00000000000b284] system_call+0x58/0x6c
      Instruction dump:
      e8410018 e87f0068 809f0078 e8bf0080 e8df0088 2fa30000 419e008c e9230200
      2fa90000 419e0080 894d098a 794a07e0 <0b0a0000> e9290008 2fa90000 419e0028
      
      This is tripped as a result of irqs being disabled during the call to
      dma_free_coherent() by ibmvfc_free_event_pool(). At this point in the code path
      we have quiesced the adapter and its overly paranoid anyways to be holding the
      host lock.
      Reported-by: NAbdul Haleem <abdhalee@linux.vnet.ibm.com>
      Signed-off-by: NTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b620c6d5
    • J
      scsi: megaraid_sas: fix panic on loading firmware crashdump · f254faed
      Junxiao Bi 提交于
      [ Upstream commit 3b5f307ef3cb5022bfe3c8ca5b8f2114d5bf6c29 ]
      
      While loading fw crashdump in function fw_crash_buffer_show(), left bytes
      in one dma chunk was not checked, if copying size over it, overflow access
      will cause kernel panic.
      Signed-off-by: NJunxiao Bi <junxiao.bi@oracle.com>
      Acked-by: NSumit Saxena <sumit.saxena@broadcom.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      f254faed
    • A
      ARM: dts: bcm: bcm47094: add missing #cells for mdio-bus-mux · bb41940c
      Arnd Bergmann 提交于
      [ Upstream commit 3a9d2569e45cb02769cda26fee4a02126867c934 ]
      
      The mdio-bus-mux has no #address-cells/#size-cells property,
      which causes a few dtc warnings:
      
      arch/arm/boot/dts/bcm47094-linksys-panamera.dts:129.4-18: Warning (reg_format): /mdio-bus-mux/mdio@200:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
      arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
      arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
      arch/arm/boot/dts/bcm47094-linksys-panamera.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
      arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #address-cells value
      arch/arm/boot/dts/bcm47094-linksys-panamera.dts:128.22-132.5: Warning (avoid_default_addr_size): /mdio-bus-mux/mdio@200: Relying on default #size-cells value
      
      Add the normal cell numbers.
      
      Link: https://lore.kernel.org/r/20190722145618.1155492-1-arnd@arndb.de
      Fixes: 2bebdfcd ("ARM: dts: BCM5301X: Add support for Linksys EA9500")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      bb41940c
    • A
      ARM: davinci: fix sleep.S build error on ARMv4 · 19e7df3e
      Arnd Bergmann 提交于
      [ Upstream commit d64b212ea960db4276a1d8372bd98cb861dfcbb0 ]
      
      When building a multiplatform kernel that includes armv4 support,
      the default target CPU does not support the blx instruction,
      which leads to a build failure:
      
      arch/arm/mach-davinci/sleep.S: Assembler messages:
      arch/arm/mach-davinci/sleep.S:56: Error: selected processor does not support `blx ip' in ARM mode
      
      Add a .arch statement in the sources to make this file build.
      
      Link: https://lore.kernel.org/r/20190722145211.1154785-1-arnd@arndb.deAcked-by: NSekhar Nori <nsekhar@ti.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      19e7df3e
    • M
      nvme: fix multipath crash when ANA is deactivated · bdce5621
      Marta Rybczynska 提交于
      [ Upstream commit 66b20ac0a1a10769d059d6903202f53494e3d902 ]
      
      Fix a crash with multipath activated. It happends when ANA log
      page is larger than MDTS and because of that ANA is disabled.
      The driver then tries to access unallocated buffer when connecting
      to a nvme target. The signature is as follows:
      
      [  300.433586] nvme nvme0: ANA log page size (8208) larger than MDTS (8192).
      [  300.435387] nvme nvme0: disabling ANA support.
      [  300.437835] nvme nvme0: creating 4 I/O queues.
      [  300.459132] nvme nvme0: new ctrl: NQN "nqn.0.0.0", addr 10.91.0.1:8009
      [  300.464609] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      [  300.466342] #PF error: [normal kernel read fault]
      [  300.467385] PGD 0 P4D 0
      [  300.467987] Oops: 0000 [#1] SMP PTI
      [  300.468787] CPU: 3 PID: 50 Comm: kworker/u8:1 Not tainted 5.0.20kalray+ #4
      [  300.470264] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
      [  300.471532] Workqueue: nvme-wq nvme_scan_work [nvme_core]
      [  300.472724] RIP: 0010:nvme_parse_ana_log+0x21/0x140 [nvme_core]
      [  300.474038] Code: 45 01 d2 d8 48 98 c3 66 90 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55 53 48 89 fb 48 83 ec 08 48 8b af 20 0a 00 00 48 89 34 24 <66> 83 7d 08 00 0f 84 c6 00 00 00 44 8b 7d 14 49 89 d5 8b 55 10 48
      [  300.477374] RSP: 0018:ffffa50e80fd7cb8 EFLAGS: 00010296
      [  300.478334] RAX: 0000000000000001 RBX: ffff9130f1872258 RCX: 0000000000000000
      [  300.479784] RDX: ffffffffc06c4c30 RSI: ffff9130edad4280 RDI: ffff9130f1872258
      [  300.481488] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000044
      [  300.483203] R10: 0000000000000220 R11: 0000000000000040 R12: ffff9130f18722c0
      [  300.484928] R13: ffff9130f18722d0 R14: ffff9130edad4280 R15: ffff9130f18722c0
      [  300.486626] FS:  0000000000000000(0000) GS:ffff9130f7b80000(0000) knlGS:0000000000000000
      [  300.488538] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  300.489907] CR2: 0000000000000008 CR3: 00000002365e6000 CR4: 00000000000006e0
      [  300.491612] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  300.493303] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  300.494991] Call Trace:
      [  300.495645]  nvme_mpath_add_disk+0x5c/0xb0 [nvme_core]
      [  300.496880]  nvme_validate_ns+0x2ef/0x550 [nvme_core]
      [  300.498105]  ? nvme_identify_ctrl.isra.45+0x6a/0xb0 [nvme_core]
      [  300.499539]  nvme_scan_work+0x2b4/0x370 [nvme_core]
      [  300.500717]  ? __switch_to_asm+0x35/0x70
      [  300.501663]  process_one_work+0x171/0x380
      [  300.502340]  worker_thread+0x49/0x3f0
      [  300.503079]  kthread+0xf8/0x130
      [  300.503795]  ? max_active_store+0x80/0x80
      [  300.504690]  ? kthread_bind+0x10/0x10
      [  300.505502]  ret_from_fork+0x35/0x40
      [  300.506280] Modules linked in: nvme_tcp nvme_rdma rdma_cm iw_cm ib_cm ib_core nvme_fabrics nvme_core xt_physdev ip6table_raw ip6table_mangle ip6table_filter ip6_tables xt_comment iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xt_CHECKSUM iptable_mangle iptable_filter veth ebtable_filter ebtable_nat ebtables iptable_raw vxlan ip6_udp_tunnel udp_tunnel sunrpc joydev pcspkr virtio_balloon br_netfilter bridge stp llc ip_tables xfs libcrc32c ata_generic pata_acpi virtio_net virtio_console net_failover virtio_blk failover ata_piix serio_raw libata virtio_pci virtio_ring virtio
      [  300.514984] CR2: 0000000000000008
      [  300.515569] ---[ end trace faa2eefad7e7f218 ]---
      [  300.516354] RIP: 0010:nvme_parse_ana_log+0x21/0x140 [nvme_core]
      [  300.517330] Code: 45 01 d2 d8 48 98 c3 66 90 0f 1f 44 00 00 41 57 41 56 41 55 41 54 55 53 48 89 fb 48 83 ec 08 48 8b af 20 0a 00 00 48 89 34 24 <66> 83 7d 08 00 0f 84 c6 00 00 00 44 8b 7d 14 49 89 d5 8b 55 10 48
      [  300.520353] RSP: 0018:ffffa50e80fd7cb8 EFLAGS: 00010296
      [  300.521229] RAX: 0000000000000001 RBX: ffff9130f1872258 RCX: 0000000000000000
      [  300.522399] RDX: ffffffffc06c4c30 RSI: ffff9130edad4280 RDI: ffff9130f1872258
      [  300.523560] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000044
      [  300.524734] R10: 0000000000000220 R11: 0000000000000040 R12: ffff9130f18722c0
      [  300.525915] R13: ffff9130f18722d0 R14: ffff9130edad4280 R15: ffff9130f18722c0
      [  300.527084] FS:  0000000000000000(0000) GS:ffff9130f7b80000(0000) knlGS:0000000000000000
      [  300.528396] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  300.529440] CR2: 0000000000000008 CR3: 00000002365e6000 CR4: 00000000000006e0
      [  300.530739] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  300.531989] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  300.533264] Kernel panic - not syncing: Fatal exception
      [  300.534338] Kernel Offset: 0x17c00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
      [  300.536227] ---[ end Kernel panic - not syncing: Fatal exception ]---
      
      Condition check refactoring from Christoph Hellwig.
      Signed-off-by: NMarta Rybczynska <marta.rybczynska@kalray.eu>
      Tested-by: NJean-Baptiste Riaux <jbriaux@kalray.eu>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      bdce5621
    • L
      ACPI/IORT: Fix off-by-one check in iort_dev_find_its_id() · b1689742
      Lorenzo Pieralisi 提交于
      [ Upstream commit 5a46d3f71d5e5a9f82eabc682f996f1281705ac7 ]
      
      Static analysis identified that index comparison against ITS entries in
      iort_dev_find_its_id() is off by one.
      
      Update the comparison condition and clarify the resulting error
      message.
      
      Fixes: 4bf2efd2 ("ACPI: Add new IORT functions to support MSI domain handling")
      Link: https://lore.kernel.org/linux-arm-kernel/20190613065410.GB16334@mwanda/Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b1689742