Skip to content
  1. May 30, 2023
    • Tudor Ambarus's avatar
      net: cdc_ncm: Deal with too low values of dwNtbOutMaxSize · 6147745d
      Tudor Ambarus authored
      commit 7e01c7f7 upstream.
      
      Currently in cdc_ncm_check_tx_max(), if dwNtbOutMaxSize is lower than
      the calculated "min" value, but greater than zero, the logic sets
      tx_max to dwNtbOutMaxSize. This is then used to allocate a new SKB in
      cdc_ncm_fill_tx_frame() where all the data is handled.
      
      For small values of dwNtbOutMaxSize the memory allocated during
      alloc_skb(dwNtbOutMaxSize, GFP_ATOMIC) will have the same size, due to
      how size is aligned at alloc time:
      	size = SKB_DATA_ALIGN(size);
              size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
      Thus we hit the same bug that we tried to squash with
      commit 2be6d4d1 ("net: cdc_ncm: Allow for dwNtbOutMaxSize to be unset or zero")
      
      Low values of dwNtbOutMaxSize do not cause an issue presently because at
      alloc_skb() time more memory (512b) is allocated than required for the
      SKB headers alone (320b), leaving some space (512b - 320b = 192b)
      for CDC data (172b).
      
      However, if more elements (for example 3 x u64 = [24b]) were added to
      one of the SKB header structs, say 'struct skb_shared_info',
      increasing its original size (320b [320b aligned]) to something larger
      (344b [384b aligned]), then suddenly the CDC data (172b) no longer
      fits in the spare SKB data area (512b - 384b = 128b).
      
      Consequently the SKB bounds checking semantics fails and panics:
      
      skbuff: skb_over_panic: text:ffffffff831f755b len:184 put:172 head:ffff88811f1c6c00 data:ffff88811f1c6c00 tail:0xb8 end:0x80 dev:<NULL>
      ------------[ cut here ]------------
      kernel BUG at net/core/skbuff.c:113!
      invalid opcode: 0000 [#1] PREEMPT SMP KASAN
      CPU: 0 PID: 57 Comm: kworker/0:2 Not tainted 5.15.106-syzkaller-00249-g19c0ed55a470 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
      Workqueue: mld mld_ifc_work
      RIP: 0010:skb_panic net/core/skbuff.c:113 [inline]
      RIP: 0010:skb_over_panic+0x14c/0x150 net/core/skbuff.c:118
      [snip]
      Call Trace:
       <TASK>
       skb_put+0x151/0x210 net/core/skbuff.c:2047
       skb_put_zero include/linux/skbuff.h:2422 [inline]
       cdc_ncm_ndp16 drivers/net/usb/cdc_ncm.c:1131 [inline]
       cdc_ncm_fill_tx_frame+0x11ab/0x3da0 drivers/net/usb/cdc_ncm.c:1308
       cdc_ncm_tx_fixup+0xa3/0x100
      
      Deal with too low values of dwNtbOutMaxSize, clamp it in the range
      [USB_CDC_NCM_NTB_MIN_OUT_SIZE, CDC_NCM_NTB_MAX_SIZE_TX]. We ensure
      enough data space is allocated to handle CDC data by making sure
      dwNtbOutMaxSize is not smaller than USB_CDC_NCM_NTB_MIN_OUT_SIZE.
      
      Fixes: 289507d3
      
       ("net: cdc_ncm: use sysfs for rx/tx aggregation tuning")
      Cc: stable@vger.kernel.org
      Reported-by: default avatar <syzbot+9f575a1f15fc0c01ed69@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?extid=b982f1059506db48409d
      Link: https://lore.kernel.org/all/20211202143437.1411410-1-lee.jones@linaro.org/
      Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@linaro.org>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230517133808.1873695-2-tudor.ambarus@linaro.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6147745d
    • Matthias Kaehlcke's avatar
      ASoC: rt5682: Disable jack detection interrupt during suspend · da1e8ada
      Matthias Kaehlcke authored
      commit 8b271370 upstream.
      
      The rt5682 driver switches its regmap to cache-only when the
      device suspends and back to regular mode on resume. When the
      jack detect interrupt fires rt5682_irq() schedules the jack
      detect work. This can result in invalid reads from the regmap
      in cache-only mode if the work runs before the device has
      resumed:
      
      [   56.245502] rt5682 9-001a: ASoC: error at soc_component_read_no_lock on rt5682.9-001a for register: [0x000000f0] -16
      
      Disable the jack detection interrupt during suspend and
      re-enable it on resume. The driver already schedules the
      jack detection work on resume, so any state change during
      suspend is still handled.
      
      This is essentially the same as commit f7d00a9b
      
       ("SoC:
      rt5682s: Disable jack detection interrupt during suspend")
      for the rt5682s.
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Link: https://lore.kernel.org/r/20230516164629.1.Ibf79e94b3442eecc0054d2b478779cc512d967fc@changeid
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da1e8ada
    • Hans de Goede's avatar
      power: supply: bq25890: Fix external_power_changed race · 72c28207
      Hans de Goede authored
      commit 029a443b upstream.
      
      bq25890_charger_external_power_changed() dereferences bq->charger,
      which gets sets in bq25890_power_supply_init() like this:
      
        bq->charger = devm_power_supply_register(bq->dev, &bq->desc, &psy_cfg);
      
      As soon as devm_power_supply_register() has called device_add()
      the external_power_changed callback can get called. So there is a window
      where bq25890_charger_external_power_changed() may get called while
      bq->charger has not been set yet leading to a NULL pointer dereference.
      
      This race hits during boot sometimes on a Lenovo Yoga Book 1 yb1-x90f
      when the cht_wcove_pwrsrc (extcon) power_supply is done with detecting
      the connected charger-type which happens to exactly hit the small window:
      
        BUG: kernel NULL pointer dereference, address: 0000000000000018
        <snip>
        RIP: 0010:__power_supply_is_supplied_by+0xb/0xb0
        <snip>
        Call Trace:
         <TASK>
         __power_supply_get_supplier_property+0x19/0x50
         class_for_each_device+0xb1/0xe0
         power_supply_get_property_from_supplier+0x2e/0x50
         bq25890_charger_external_power_changed+0x38/0x1b0 [bq25890_charger]
         __power_supply_changed_work+0x30/0x40
         class_for_each_device+0xb1/0xe0
         power_supply_changed_work+0x5f/0xe0
        <snip>
      
      Fixing this is easy. The external_power_changed callback gets passed
      the power_supply which will eventually get stored in bq->charger,
      so bq25890_charger_external_power_changed() can simply directly use
      the passed in psy argument which is always valid.
      
      Fixes: eab25b4f
      
       ("power: supply: bq25890: On the bq25892 set the IINLIM based on external charger detection")
      Cc: stable@vger.kernel.org
      Cc: Marek Vasut <marex@denx.de>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72c28207
    • Hans de Goede's avatar
      power: supply: axp288_fuel_gauge: Fix external_power_changed race · 0456b912
      Hans de Goede authored
      commit f8319774 upstream.
      
      fuel_gauge_external_power_changed() dereferences info->bat,
      which gets sets in axp288_fuel_gauge_probe() like this:
      
        info->bat = devm_power_supply_register(dev, &fuel_gauge_desc, &psy_cfg);
      
      As soon as devm_power_supply_register() has called device_add()
      the external_power_changed callback can get called. So there is a window
      where fuel_gauge_external_power_changed() may get called while
      info->bat has not been set yet leading to a NULL pointer dereference.
      
      Fixing this is easy. The external_power_changed callback gets passed
      the power_supply which will eventually get stored in info->bat,
      so fuel_gauge_external_power_changed() can simply directly use
      the passed in psy argument which is always valid.
      
      Fixes: 30abb3d0
      
       ("power: supply: axp288_fuel_gauge: Take lock before updating the valid flag")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0456b912
    • Christian Loehle's avatar
      mmc: block: ensure error propagation for non-blk · 7d5e0150
      Christian Loehle authored
      commit 003fb0a5 upstream.
      
      Requests to the mmc layer usually come through a block device IO.
      The exceptions are the ioctl interface, RPMB chardev ioctl
      and debugfs, which issue their own blk_mq requests through
      blk_execute_rq and do not query the BLK_STS error but the
      mmcblk-internal drv_op_result. This patch ensures that drv_op_result
      defaults to an error and has to be overwritten by the operation
      to be considered successful.
      
      The behavior leads to a bug where the request never propagates
      the error, e.g. by directly erroring out at mmc_blk_mq_issue_rq if
      mmc_blk_part_switch fails. The ioctl caller of the rpmb chardev then
      can never see an error (BLK_STS_IOERR, but drv_op_result is unchanged)
      and thus may assume that their call executed successfully when it did not.
      
      While always checking the blk_execute_rq return value would be
      advised, let's eliminate the error by always setting
      drv_op_result as -EIO to be overwritten on success (or other error)
      
      Fixes: 614f0388
      
       ("mmc: block: move single ioctl() commands to block requests")
      Signed-off-by: default avatarChristian Loehle <cloehle@hyperstone.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/59c17ada35664b818b7bd83752119b2d@hyperstone.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d5e0150
    • Haibo Chen's avatar
      mmc: sdhci-esdhc-imx: make "no-mmc-hs400" works · a24aec21
      Haibo Chen authored
      commit 81dce149 upstream.
      
      After commit 1ed5c3b2 ("mmc: sdhci-esdhc-imx: Propagate
      ESDHC_FLAG_HS400* only on 8bit bus"), the property "no-mmc-hs400"
      from device tree file do not work any more.
      This patch reorder the code, which can avoid the warning message
      "drop HS400 support since no 8-bit bus" and also make the property
      "no-mmc-hs400" from dts file works.
      
      Fixes: 1ed5c3b2
      
       ("mmc: sdhci-esdhc-imx: Propagate ESDHC_FLAG_HS400* only on 8bit bus")
      Signed-off-by: default avatarHaibo Chen <haibo.chen@nxp.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230504112222.3599602-1-haibo.chen@nxp.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a24aec21
    • Trond Myklebust's avatar
      SUNRPC: Don't change task->tk_status after the call to rpc_exit_task · 0d97634a
      Trond Myklebust authored
      commit d180891f upstream.
      
      Some calls to rpc_exit_task() may deliberately change the value of
      task->tk_status, for instance because it gets checked by the RPC call's
      rpc_release() callback. That makes it wrong to reset the value to
      task->tk_rpc_status.
      In particular this causes a bug where the rpc_call_done() callback tries
      to fail over a set of pNFS/flexfiles writes to a different IP address,
      but the reset of task->tk_status causes nfs_commit_release_pages() to
      immediately mark the file as having a fatal error.
      
      Fixes: 39494194
      
       ("SUNRPC: Fix races with rpc_killall_tasks()")
      Cc: stable@vger.kernel.org # 6.1.x
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d97634a
    • Bin Li's avatar
      ALSA: hda/realtek: Enable headset onLenovo M70/M90 · 40599969
      Bin Li authored
      commit 4ca110ca
      
       upstream.
      
      Lenovo M70/M90 Gen4 are equipped with ALC897, and they need
      ALC897_FIXUP_HEADSET_MIC_PIN quirk to make its headset mic work.
      The previous quirk for M70/M90 is for Gen3.
      
      Signed-off-by: default avatarBin Li <bin.li@canonical.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230524113755.1346928-1-bin.li@canonical.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40599969
    • Takashi Iwai's avatar
      ALSA: hda: Fix unhandled register update during auto-suspend period · 7d3d306f
      Takashi Iwai authored
      commit 81302b1c upstream.
      
      It's reported that the recording started right after the driver probe
      doesn't work properly, and it turned out that this is related with the
      codec auto-suspend.  Namely, after the probe phase, the usage count
      goes zero, and the auto-suspend is programmed, but the codec is kept
      still active until the auto-suspend expiration.  When an application
      (e.g. alsactl) updates the mixer values at this moment, the values are
      cached but not actually written.  Then, starting arecord thereafter
      also results in the silence because of the missing unmute.
      
      The root cause is the handling of "lazy update" mode; when a mixer
      value is updated *after* the suspend, it should update only the cache
      and exits.  At the resume, the cached value is written to the device,
      in turn.  The problem is that the current code misinterprets the state
      of auto-suspend as if it were already suspended.
      
      Although we can add the check of the actual device state after
      pm_runtime_get_if_in_use() for catching the missing state, this won't
      suffice; the second call of regmap_update_bits_check() will skip
      writing the register because the cache has been already updated by the
      first call.  So we'd need fixes in two different places.
      
      OTOH, a simpler fix is to replace pm_runtime_get_if_in_use() with
      pm_runtime_get_if_active() (with ign_usage_count=true).  This change
      implies that the driver takes the pm refcount if the device is still
      in ACTIVE state and continues the processing.  A small caveat is that
      this will leave the auto-suspend timer.  But, since the timer callback
      itself checks the device state and aborts gracefully when it's active,
      this won't be any substantial problem.
      
      Long story short: we address the missing register-write problem just
      by replacing the pm_runtime_*() call in snd_hda_keep_power_up().
      
      Fixes: fc4f000b
      
       ("ALSA: hda - Fix unexpected resume through regmap code path")
      Reported-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
      Closes: https://lore.kernel.org/r/a7478636-af11-92ab-731c-9b13c582a70d@linux.intel.com
      Suggested-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230518113520.15213-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d3d306f
    • Adam Stylinski's avatar
      ALSA: hda/ca0132: add quirk for EVGA X299 DARK · 5222e81a
      Adam Stylinski authored
      commit 7843380d
      
       upstream.
      
      This quirk is necessary for surround and other DSP effects to work
      with the onboard ca0132 based audio chipset for the EVGA X299 dark
      mainboard.
      
      Signed-off-by: default avatarAdam Stylinski <kungfujesus06@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=67071
      Link: https://lore.kernel.org/r/ZGopOe19T1QOwizS@eggsbenedict.adamsnet
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5222e81a
    • David Arcari's avatar
      platform/x86/intel/ifs: Annotate work queue on stack so object debug does not complain · 688c9af6
      David Arcari authored
      commit 3279decb upstream.
      
      Object Debug results in the following warning while attempting to load
      ifs firmware:
      
      [  220.007422] ODEBUG: object 000000003bf952db is on stack 00000000e843994b, but NOT annotated.
      [  220.007459] ------------[ cut here ]------------
      [  220.007461] WARNING: CPU: 0 PID: 11774 at lib/debugobjects.c:548 __debug_object_init.cold+0x22e/0x2d5
      [  220.137476] RIP: 0010:__debug_object_init.cold+0x22e/0x2d5
      [  220.254774] Call Trace:
      [  220.257641]  <TASK>
      [  220.265606]  scan_chunks_sanity_check+0x368/0x5f0 [intel_ifs]
      [  220.288292]  ifs_load_firmware+0x2a3/0x400 [intel_ifs]
      [  220.332793]  current_batch_store+0xea/0x160 [intel_ifs]
      [  220.357947]  kernfs_fop_write_iter+0x355/0x530
      [  220.363048]  new_sync_write+0x28e/0x4a0
      [  220.381226]  vfs_write+0x62a/0x920
      [  220.385160]  ksys_write+0xf9/0x1d0
      [  220.399421]  do_syscall_64+0x59/0x90
      [  220.440635]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [  220.566845] ---[ end trace 3a01b299db142b41 ]---
      
      Correct this by calling INIT_WORK_ONSTACK instead of INIT_WORK.
      
      Fixes: 684ec215
      
       ("platform/x86/intel/ifs: Authenticate and copy to secured memory")
      
      Signed-off-by: default avatarDavid Arcari <darcari@redhat.com>
      Cc: Jithu Joseph <jithu.joseph@intel.com>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Mark Gross <markgross@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230523105400.674152-1-darcari@redhat.com
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      688c9af6
    • Dave Hansen's avatar
      x86/mm: Avoid incomplete Global INVLPG flushes · c26b9e19
      Dave Hansen authored
      commit ce0b15d1
      
       upstream.
      
      The INVLPG instruction is used to invalidate TLB entries for a
      specified virtual address.  When PCIDs are enabled, INVLPG is supposed
      to invalidate TLB entries for the specified address for both the
      current PCID *and* Global entries.  (Note: Only kernel mappings set
      Global=1.)
      
      Unfortunately, some INVLPG implementations can leave Global
      translations unflushed when PCIDs are enabled.
      
      As a workaround, never enable PCIDs on affected processors.
      
      I expect there to eventually be microcode mitigations to replace this
      software workaround.  However, the exact version numbers where that
      will happen are not known today.  Once the version numbers are set in
      stone, the processor list can be tweaked to only disable PCIDs on
      affected processors with affected microcode.
      
      Note: if anyone wants a quick fix that doesn't require patching, just
      stick 'nopcid' on your kernel command-line.
      
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c26b9e19
    • Peter Collingbourne's avatar
      arm64: Also reset KASAN tag if page is not PG_mte_tagged · 4eb600f3
      Peter Collingbourne authored
      commit 2efbafb9 upstream.
      
      Consider the following sequence of events:
      
      1) A page in a PROT_READ|PROT_WRITE VMA is faulted.
      2) Page migration allocates a page with the KASAN allocator,
         causing it to receive a non-match-all tag, and uses it
         to replace the page faulted in 1.
      3) The program uses mprotect() to enable PROT_MTE on the page faulted in 1.
      
      As a result of step 3, we are left with a non-match-all tag for a page
      with tags accessible to userspace, which can lead to the same kind of
      tag check faults that commit e74a6846 ("arm64: Reset KASAN tag in
      copy_highpage with HW tags only") intended to fix.
      
      The general invariant that we have for pages in a VMA with VM_MTE_ALLOWED
      is that they cannot have a non-match-all tag. As a result of step 2, the
      invariant is broken. This means that the fix in the referenced commit
      was incomplete and we also need to reset the tag for pages without
      PG_mte_tagged.
      
      Fixes: e5b8d921
      
       ("arm64: mte: reset the page tag in page->flags")
      Cc: <stable@vger.kernel.org> # 5.15
      Link: https://linux-review.googlesource.com/id/I7409cdd41acbcb215c2a7417c1e50d37b875beff
      Signed-off-by: default avatarPeter Collingbourne <pcc@google.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20230420210945.2313627-1-pcc@google.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4eb600f3
    • Roberto Sassu's avatar
      ocfs2: Switch to security_inode_init_security() · 8bdf47f9
      Roberto Sassu authored
      commit de3004c8
      
       upstream.
      
      In preparation for removing security_old_inode_init_security(), switch to
      security_inode_init_security().
      
      Extend the existing ocfs2_initxattrs() to take the
      ocfs2_security_xattr_info structure from fs_info, and populate the
      name/value/len triple with the first xattr provided by LSMs.
      
      As fs_info was not used before, ocfs2_initxattrs() can now handle the case
      of replicating the behavior of security_old_inode_init_security(), i.e.
      just obtaining the xattr, in addition to setting all xattrs provided by
      LSMs.
      
      Supporting multiple xattrs is not currently supported where
      security_old_inode_init_security() was called (mknod, symlink), as it
      requires non-trivial changes that can be done at a later time. Like for
      reiserfs, even if EVM is invoked, it will not provide an xattr (if it is
      not the first to set it, its xattr will be discarded; if it is the first,
      it does not have xattrs to calculate the HMAC on).
      
      Finally, since security_inode_init_security(), unlike
      security_old_inode_init_security(), returns zero instead of -EOPNOTSUPP if
      no xattrs were provided by LSMs or if inodes are private, additionally
      check in ocfs2_init_security_get() if the xattr name is set.
      
      If not, act as if security_old_inode_init_security() returned -EOPNOTSUPP,
      and set si->enable to zero to notify to the functions following
      ocfs2_init_security_get() that no xattrs are available.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Acked-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8bdf47f9
    • Robin Chen's avatar
      drm/amd/display: hpd rx irq not working with eDP interface · 28ee628f
      Robin Chen authored
      commit eeefe7c4 upstream.
      
      [Why]
      This is the fix for the defect of commit ab144f0b
      ("drm/amd/display: Allow individual control of eDP hotplug support").
      
      [How]
      To revise the default eDP hotplug setting and use the enum to git rid
      of the magic number for different options.
      
      Fixes: ab144f0b
      
       ("drm/amd/display: Allow individual control of eDP hotplug support")
      Cc: stable@vger.kernel.org
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Reviewed-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
      Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
      Signed-off-by: default avatarRobin Chen <robin.chen@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      (cherry picked from commit eeefe7c4
      
      )
      Hand modified for missing file rename changes and symbol moves in 6.1.y.
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28ee628f
    • Steffen Bätz's avatar
      net: dsa: mv88e6xxx: Add RGMII delay to 88E6320 · 7bfd4c0e
      Steffen Bätz authored
      commit 91e87045
      
       upstream.
      
      Currently, the .port_set_rgmii_delay hook is missing for the 88E6320
      family, which causes failure to retrieve an IP address via DHCP.
      
      Add mv88e6320_port_set_rgmii_delay() that allows applying the RGMII
      delay for ports 2, 5, and 6, which are the only ports that can be used
      in RGMII mode.
      
      Tested on a custom i.MX8MN board connected to an 88E6320 switch.
      
      This change also applies safely to the 88E6321 variant.
      
      The only difference between 88E6320 versus 88E6321 is the temperature
      grade and pinout.
      
      They share exactly the same MDIO register map for ports 2, 5, and 6,
      which are the only ports that can be used in RGMII mode.
      
      Signed-off-by: default avatarSteffen Bätz <steffen@innosonix.de>
      [fabio: Improved commit log and extended it to mv88e6321_ops]
      Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20221028163158.198108-1-festevam@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7bfd4c0e
    • Hans de Goede's avatar
      platform/x86: hp-wmi: Fix cast to smaller integer type warning · 66ede2e4
      Hans de Goede authored
      commit ce95010e
      
       upstream.
      
      Fix the following compiler warning:
      
      drivers/platform/x86/hp/hp-wmi.c:551:24: warning: cast to smaller integer
         type 'enum hp_wmi_radio' from 'void *' [-Wvoid-pointer-to-enum-cast]
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20230123132824.660062-1-hdegoede@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      66ede2e4
    • Kees Cook's avatar
      skbuff: Proactively round up to kmalloc bucket size · 0dbc898f
      Kees Cook authored
      commit 12d6c1d3 upstream.
      
      Instead of discovering the kmalloc bucket size _after_ allocation, round
      up proactively so the allocation is explicitly made for the full size,
      allowing the compiler to correctly reason about the resulting size of
      the buffer through the existing __alloc_size() hint.
      
      This will allow for kernels built with CONFIG_UBSAN_BOUNDS or the
      coming dynamic bounds checking under CONFIG_FORTIFY_SOURCE to gain
      back the __alloc_size() hints that were temporarily reverted in commit
      93dd04ab
      
       ("slab: remove __alloc_size attribute from __kmalloc_track_caller")
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: netdev@vger.kernel.org
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Link: https://patchwork.kernel.org/project/netdevbpf/patch/20221021234713.you.031-kees@kernel.org/
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20221025223811.up.360-kees@kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Cc: Daniel Díaz <daniel.diaz@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0dbc898f
    • Jack Xiao's avatar
      drm/amdgpu/mes11: enable reg active poll · ac2f5739
      Jack Xiao authored
      commit a6b3b618
      
       upstream.
      
      Enable reg active poll in mes11.
      
      Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Tested-and-acked-by: default avatarEvan Quan <evan.quan@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: "Gong, Richard" <richard.gong@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac2f5739
    • Jack Xiao's avatar
      drm/amd/amdgpu: update mes11 api def · a2fe4534
      Jack Xiao authored
      commit 1e7bbdba
      
       upstream.
      
      Update the api def of mes11.
      
      Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Tested-and-acked-by: default avatarEvan Quan <evan.quan@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: "Gong, Richard" <richard.gong@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2fe4534
    • Gregory Oakes's avatar
      watchdog: sp5100_tco: Immediately trigger upon starting. · ae9e6531
      Gregory Oakes authored
      commit 4eda19cc
      
       upstream.
      
      The watchdog countdown is supposed to begin when the device file is
      opened. Instead, it would begin countdown upon the first write to or
      close of the device file. Now, the ping operation is called within the
      start operation which ensures the countdown begins. From experimenation,
      it does not appear possible to do this with a single write including
      both the start bit and the trigger bit. So, it is done as two distinct
      writes.
      
      Signed-off-by: default avatarGregory Oakes <gregory.oakes@amd.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20230316201312.17538-1-gregory.oakes@amd.com
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae9e6531
    • Jarkko Sakkinen's avatar
      tpm: Prevent hwrng from activating during resume · 7cd46930
      Jarkko Sakkinen authored
      [ Upstream commit 99d46450 ]
      
      Set TPM_CHIP_FLAG_SUSPENDED in tpm_pm_suspend() and reset in
      tpm_pm_resume(). While the flag is set, tpm_hwrng() gives back zero
      bytes. This prevents hwrng from racing during resume.
      
      Cc: stable@vger.kernel.org
      Fixes: 6e592a06
      
       ("tpm: Move Linux RNG connection to hwrng")
      Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7cd46930
    • Jarkko Sakkinen's avatar
      tpm: Re-enable TPM chip boostrapping non-tpm_tis TPM drivers · 25d38d5e
      Jarkko Sakkinen authored
      [ Upstream commit 0c8862de ]
      
      TPM chip bootstrapping was removed from tpm_chip_register(), and it
      was relocated to tpm_tis_core. This breaks all drivers which are not
      based on tpm_tis because the chip will not get properly initialized.
      
      Take the corrective steps:
      1. Rename tpm_chip_startup() as tpm_chip_bootstrap() and make it one-shot.
      2. Call tpm_chip_bootstrap() in tpm_chip_register(), which reverts the
         things  as tehy used to be.
      
      Cc: Lino Sanfilippo <l.sanfilippo@kunbus.com>
      Fixes: 548eb516
      
       ("tpm, tpm_tis: startup chip before testing for interrupts")
      Reported-by: default avatarPengfei Xu <pengfei.xu@intel.com>
      Link: https://lore.kernel.org/all/ZEjqhwHWBnxcaRV5@xpf.sh.intel.com/
      Tested-by: default avatarPengfei Xu <pengfei.xu@intel.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Stable-dep-of: 99d46450
      
       ("tpm: Prevent hwrng from activating during resume")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25d38d5e
    • Lino Sanfilippo's avatar
      tpm, tpm_tis: startup chip before testing for interrupts · e76f61a2
      Lino Sanfilippo authored
      [ Upstream commit 548eb516
      
       ]
      
      In tpm_tis_gen_interrupt() a request for a property value is sent to the
      TPM to test if interrupts are generated. However after a power cycle the
      TPM responds with TPM_RC_INITIALIZE which indicates that the TPM is not
      yet properly initialized.
      Fix this by first starting the TPM up before the request is sent. For this
      the startup implementation is removed from tpm_chip_register() and put
      into the new function tpm_chip_startup() which is called before the
      interrupts are tested.
      
      Signed-off-by: default avatarLino Sanfilippo <l.sanfilippo@kunbus.com>
      Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Stable-dep-of: 99d46450
      
       ("tpm: Prevent hwrng from activating during resume")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e76f61a2
    • Jarkko Sakkinen's avatar
      tpm_tis: Use tpm_chip_{start,stop} decoration inside tpm_tis_resume · 9953dbf6
      Jarkko Sakkinen authored
      [ Upstream commit 1398aa80
      
       ]
      
      Before sending a TPM command, CLKRUN protocol must be disabled. This is not
      done in the case of tpm1_do_selftest() call site inside tpm_tis_resume().
      
      Address this by decorating the calls with tpm_chip_{start,stop}, which
      should be always used to arm and disarm the TPM chip for transmission.
      
      Finally, move the call to the main TPM driver callback as the last step
      because it should arm the chip by itself, if it needs that type of
      functionality.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Closes: https://lore.kernel.org/linux-integrity/CS68AWILHXS4.3M36M1EKZLUMS@suppilovahvero/
      Fixes: a3fbfae8
      
       ("tpm: take TPM chip power gating out of tpm_transmit()")
      Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9953dbf6
    • Lino Sanfilippo's avatar
      tpm, tpm_tis: Only handle supported interrupts · c5a5d338
      Lino Sanfilippo authored
      [ Upstream commit e87fcf0d
      
       ]
      
      According to the TPM Interface Specification (TIS) support for "stsValid"
      and "commandReady" interrupts is only optional.
      This has to be taken into account when handling the interrupts in functions
      like wait_for_tpm_stat(). To determine the supported interrupts use the
      capability query.
      
      Also adjust wait_for_tpm_stat() to only wait for interrupt reported status
      changes. After that process all the remaining status changes by polling
      the status register.
      
      Signed-off-by: default avatarLino Sanfilippo <l.sanfilippo@kunbus.com>
      Tested-by: default avatarMichael Niewöhner <linux@mniewoehner.de>
      Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Stable-dep-of: 1398aa80
      
       ("tpm_tis: Use tpm_chip_{start,stop} decoration inside tpm_tis_resume")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5a5d338
    • Lino Sanfilippo's avatar
      tpm, tpm_tis: Avoid cache incoherency in test for interrupts · 5c4c8075
      Lino Sanfilippo authored
      [ Upstream commit 858e8b79
      
       ]
      
      The interrupt handler that sets the boolean variable irq_tested may run on
      another CPU as the thread that checks irq_tested as part of the irq test in
      tpm_tis_send().
      
      Since nothing guarantees cache coherency between CPUs for unsynchronized
      accesses to boolean variables the testing thread might not perceive the
      value change done in the interrupt handler.
      
      Avoid this issue by setting the bit TPM_TIS_IRQ_TESTED in the flags field
      of the tpm_tis_data struct and by accessing this field with the bit
      manipulating functions that provide cache coherency.
      
      Also convert all other existing sites to use the proper macros when
      accessing this bitfield.
      
      Signed-off-by: default avatarLino Sanfilippo <l.sanfilippo@kunbus.com>
      Tested-by: default avatarMichael Niewöhner <linux@mniewoehner.de>
      Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Stable-dep-of: 1398aa80
      
       ("tpm_tis: Use tpm_chip_{start,stop} decoration inside tpm_tis_resume")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5c4c8075
    • Linyu Yuan's avatar
      usb: dwc3: fix gadget mode suspend interrupt handler issue · 1ec14527
      Linyu Yuan authored
      [ Upstream commit 4e8ef34e ]
      
      When work in gadget mode, currently driver doesn't update software level
      link_state correctly as link state change event is not enabled for most
      devices, in function dwc3_gadget_suspend_interrupt(), it will only pass
      suspend event to UDC core when software level link state changes, so when
      interrupt generated in sequences of suspend -> reset -> conndone ->
      suspend, link state is not updated during reset and conndone, so second
      suspend interrupt event will not pass to UDC core.
      
      Remove link_state compare in dwc3_gadget_suspend_interrupt() and add a
      suspended flag to replace the compare function.
      
      Fixes: 799e9dc8
      
       ("usb: dwc3: gadget: conditionally disable Link State change events")
      Cc: stable <stable@kernel.org>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Signed-off-by: default avatarLinyu Yuan <quic_linyyuan@quicinc.com>
      Link: https://lore.kernel.org/r/20230512004524.31950-1-quic_linyyuan@quicinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ec14527
  2. May 25, 2023