1. 09 Sep, 2020 8 commits
    • Tom Rix's avatar
      hwmon: (applesmc) check status earlier. · bb0d6138
      Tom Rix authored
      [ Upstream commit cecf7560 ]
      
      clang static analysis reports this representative problem
      
      applesmc.c:758:10: warning: 1st function call argument is an
        uninitialized value
              left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      buffer is filled by the earlier call
      
      	ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...
      
      This problem is reported because a goto skips the status check.
      Other similar problems use data from applesmc_read_key before checking
      the status.  So move the checks to before the use.
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Reviewed-by: default avatarHenrik Rydberg <rydberg@bitmath.org>
      Link: https://lore.kernel.org/r/20200820131932.10590-1-trix@redhat.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bb0d6138
    • Krishna Manikandan's avatar
      drm/msm: add shutdown support for display platform_driver · 8bc5c9ba
      Krishna Manikandan authored
      [ Upstream commit 9d5cbf5f ]
      
      Define shutdown callback for display drm driver,
      so as to disable all the CRTCS when shutdown
      notification is received by the driver.
      
      This change will turn off the timing engine so
      that no display transactions are requested
      while mmu translations are getting disabled
      during reboot sequence.
      Signed-off-by: default avatarKrishna Manikandan <mkrishn@codeaurora.org>
      
      Changes in v2:
      	- Remove NULL check from msm_pdev_shutdown (Stephen Boyd)
      	- Change commit text to reflect when this issue
      	  was uncovered (Sai Prakash Ranjan)
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8bc5c9ba
    • John Stultz's avatar
      tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup · ee385b41
      John Stultz authored
      [ Upstream commit 975efc66 ]
      
      When booting with heavily modularized config, the serial console
      may not be able to load until after init when modules that
      satisfy needed dependencies have time to load.
      
      Unfortunately, as qcom_geni_console_setup is marked as __init,
      the function may have been freed before we get to run it,
      causing boot time crashes such as:
      
      [    6.469057] Unable to handle kernel paging request at virtual address ffffffe645d4e6cc
      [    6.481623] Mem abort info:
      [    6.484466]   ESR = 0x86000007
      [    6.487557]   EC = 0x21: IABT (current EL), IL = 32 bits
      [    6.492929]   SET = 0, FnV = 0g
      [    6.496016]   EA = 0, S1PTW = 0
      [    6.499202] swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000008151e000
      [    6.501286] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
      [    6.505977] [ffffffe645d4e6cc] pgd=000000017df9f003, p4d=000000017df9f003, pud=000000017df9f003, pmd=000000017df9c003, pte=0000000000000000
      [    6.505990] Internal error: Oops: 86000007 [#1] PREEMPT SMP
      [    6.505995] Modules linked in: zl10353 zl10039 zl10036 zd1301_demod xc5000 xc4000 ves1x93 ves1820 tuner_xc2028 tuner_simple tuner_types tua9001 tua6100 1
      [    6.506152]  isl6405
      [    6.518104] ufshcd-qcom 1d84000.ufshc: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0
      [    6.530549]  horus3a helene fc2580 fc0013 fc0012 fc0011 ec100 e4000 dvb_pll ds3000 drxk drxd drx39xyj dib9000 dib8000 dib7000p dib7000m dib3000mc dibx003
      [    6.624271] CPU: 7 PID: 148 Comm: kworker/7:2 Tainted: G        W       5.8.0-mainline-12021-g6defd37ba1cd #3455
      [    6.624273] Hardware name: Thundercomm Dragonboard 845c (DT)
      [    6.624290] Workqueue: events deferred_probe_work_func
      [    6.624296] pstate: 40c00005 (nZcv daif +PAN +UAO BTYPE=--)
      [    6.624307] pc : qcom_geni_console_setup+0x0/0x110
      [    6.624316] lr : try_enable_new_console+0xa0/0x140
      [    6.624318] sp : ffffffc010843a30
      [    6.624320] x29: ffffffc010843a30 x28: ffffffe645c3e7d0
      [    6.624325] x27: ffffff80f8022180 x26: ffffffc010843b28
      [    6.637937] x25: 0000000000000000 x24: ffffffe6462a2000
      [    6.637941] x23: ffffffe646398000 x22: 0000000000000000
      [    6.637945] x21: 0000000000000000 x20: ffffffe6462a5ce8
      [    6.637952] x19: ffffffe646398e38 x18: ffffffffffffffff
      [    6.680296] x17: 0000000000000000 x16: ffffffe64492b900
      [    6.680300] x15: ffffffe6461e9d08 x14: 69202930203d2064
      [    6.680305] x13: 7561625f65736162 x12: 202c363331203d20
      [    6.696434] x11: 0000000000000030 x10: 0101010101010101
      [    6.696438] x9 : 4d4d20746120304d x8 : 7f7f7f7f7f7f7f7f
      [    6.707249] x7 : feff4c524c787373 x6 : 0000000000008080
      [    6.707253] x5 : 0000000000000000 x4 : 8080000000000000
      [    6.707257] x3 : 0000000000000000 x2 : ffffffe645d4e6cc
      [    6.744223] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34)
      [    6.744966] x1 : fffffffefe74e174 x0 : ffffffe6462a5ce8
      [    6.753580] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34)
      [    6.761634] Call trace:
      [    6.761639]  qcom_geni_console_setup+0x0/0x110
      [    6.761645]  register_console+0x29c/0x2f8
      [    6.767981] Bluetooth: hci0: Frame reassembly failed (-84)
      [    6.775252]  uart_add_one_port+0x438/0x500
      [    6.775258]  qcom_geni_serial_probe+0x2c4/0x4a8
      [    6.775266]  platform_drv_probe+0x58/0xa8
      [    6.855359]  really_probe+0xec/0x398
      [    6.855362]  driver_probe_device+0x5c/0xb8
      [    6.855367]  __device_attach_driver+0x98/0xb8
      [    7.184945]  bus_for_each_drv+0x74/0xd8
      [    7.188825]  __device_attach+0xec/0x148
      [    7.192705]  device_initial_probe+0x24/0x30
      [    7.196937]  bus_probe_device+0x9c/0xa8
      [    7.200816]  deferred_probe_work_func+0x7c/0xb8
      [    7.205398]  process_one_work+0x20c/0x4b0
      [    7.209456]  worker_thread+0x48/0x460
      [    7.213157]  kthread+0x14c/0x158
      [    7.216432]  ret_from_fork+0x10/0x18
      [    7.220049] Code: bad PC value
      [    7.223139] ---[ end trace 73f3b21e251d5a70 ]---
      
      Thus this patch removes the __init avoiding crash in such
      configs.
      
      Cc: Andy Gross <agross@kernel.org>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: Saravana Kannan <saravanak@google.com>
      Cc: Todd Kjos <tkjos@google.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: linux-serial@vger.kernel.org
      Suggested-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Link: https://lore.kernel.org/r/20200811025044.70626-1-john.stultz@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ee385b41
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Optimize use of flush_dcache_page · e6309b81
      Bodo Stroesser authored
      commit 3c58f737 upstream.
      
      (scatter|gather)_data_area() need to flush dcache after writing data to or
      before reading data from a page in uio data area.  The two routines are
      able to handle data transfer to/from such a page in fragments and flush the
      cache after each fragment was copied by calling the wrapper
      tcmu_flush_dcache_range().
      
      That means:
      
      1) flush_dcache_page() can be called multiple times for the same page.
      
      2) Calling flush_dcache_page() indirectly using the wrapper does not make
         sense, because each call of the wrapper is for one single page only and
         the calling routine already has the correct page pointer.
      
      Change (scatter|gather)_data_area() such that, instead of calling
      tcmu_flush_dcache_range() before/after each memcpy, it now calls
      flush_dcache_page() before unmapping a page (when writing is complete for
      that page) or after mapping a page (when starting to read the page).
      
      After this change only calls to tcmu_flush_dcache_range() for addresses in
      vmalloc'ed command ring are left over.
      
      The patch was tested on ARM with kernel 4.19.118 and 5.7.2
      
      Link: https://lore.kernel.org/r/20200618131632.32748-2-bstroesser@ts.fujitsu.comTested-by: default avatarJiangYu <lnsyyj@hotmail.com>
      Tested-by: default avatarDaniel Meyerholt <dxm523@gmail.com>
      Acked-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6309b81
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Fix size in calls to tcmu_flush_dcache_range · 04414e46
      Bodo Stroesser authored
      commit 8c4e0f21 upstream.
      
      1) If remaining ring space before the end of the ring is smaller then the
         next cmd to write, tcmu writes a padding entry which fills the remaining
         space at the end of the ring.
      
         Then tcmu calls tcmu_flush_dcache_range() with the size of struct
         tcmu_cmd_entry as data length to flush.  If the space filled by the
         padding was smaller then tcmu_cmd_entry, tcmu_flush_dcache_range() is
         called for an address range reaching behind the end of the vmalloc'ed
         ring.
      
         tcmu_flush_dcache_range() in a loop calls
         flush_dcache_page(virt_to_page(start)); for every page being part of the
         range. On x86 the line is optimized out by the compiler, as
         flush_dcache_page() is empty on x86.
      
         But I assume the above can cause trouble on other architectures that
         really have a flush_dcache_page().  For paddings only the header part of
         an entry is relevant due to alignment rules the header always fits in
         the remaining space, if padding is needed.  So tcmu_flush_dcache_range()
         can safely be called with sizeof(entry->hdr) as the length here.
      
      2) After it has written a command to cmd ring, tcmu calls
         tcmu_flush_dcache_range() using the size of a struct tcmu_cmd_entry as
         data length to flush.  But if a command needs many iovecs, the real size
         of the command may be bigger then tcmu_cmd_entry, so a part of the
         written command is not flushed then.
      
      Link: https://lore.kernel.org/r/20200528193108.9085-1-bstroesser@ts.fujitsu.comAcked-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04414e46
    • Kim Phillips's avatar
      perf record/stat: Explicitly call out event modifiers in the documentation · 92d0750a
      Kim Phillips authored
      commit e48a73a3 upstream.
      
      Event modifiers are not mentioned in the perf record or perf stat
      manpages.  Add them to orient new users more effectively by pointing
      them to the perf list manpage for details.
      
      Fixes: 2055fdaf ("perf list: Document precise event sampling for AMD IBS")
      Signed-off-by: default avatarKim Phillips <kim.phillips@amd.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tony Jones <tonyj@suse.de>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200901215853.276234-1-kim.phillips@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92d0750a
    • Marc Zyngier's avatar
      HID: core: Sanitize event code and type when mapping input · a47b8511
      Marc Zyngier authored
      commit 35556bed upstream.
      
      When calling into hid_map_usage(), the passed event code is
      blindly stored as is, even if it doesn't fit in the associated bitmap.
      
      This event code can come from a variety of sources, including devices
      masquerading as input devices, only a bit more "programmable".
      
      Instead of taking the event code at face value, check that it actually
      fits the corresponding bitmap, and if it doesn't:
      - spit out a warning so that we know which device is acting up
      - NULLify the bitmap pointer so that we catch unexpected uses
      
      Code paths that can make use of untrusted inputs can now check
      that the mapping was indeed correct and bail out if not.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a47b8511
    • Marc Zyngier's avatar
      HID: core: Correctly handle ReportSize being zero · abae259f
      Marc Zyngier authored
      commit bce1305c upstream.
      
      It appears that a ReportSize value of zero is legal, even if a bit
      non-sensical. Most of the HID code seems to handle that gracefully,
      except when computing the total size in bytes. When fed as input to
      memset, this leads to some funky outcomes.
      
      Detect the corner case and correctly compute the size.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      abae259f
  2. 03 Sep, 2020 32 commits