Skip to content
  1. Feb 04, 2021
    • Parav Pandit's avatar
      net/mlx5e: E-switch, Fix rate calculation for overflow · a6670527
      Parav Pandit authored
      [ Upstream commit 1fe3e316 ]
      
      rate_bytes_ps is a 64-bit field. It passed as 32-bit field to
      apply_police_params(). Due to this when police rate is higher
      than 4Gbps, 32-bit calculation ignores the carry. This results
      in incorrect rate configurationn the device.
      
      Fix it by performing 64-bit calculation.
      
      Fixes: fcb64c0f
      
       ("net/mlx5: E-Switch, add ingress rate support")
      Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
      Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a6670527
    • Roi Dayan's avatar
      net/mlx5: Fix memory leak on flow table creation error flow · dbc13dee
      Roi Dayan authored
      [ Upstream commit 487c6ef8 ]
      
      When we create the ft object we also init rhltable in ft->fgs_hash.
      So in error flow before kfree of ft we need to destroy that rhltable.
      
      Fixes: 693c6883
      
       ("net/mlx5: Add hash table for flow groups in flow table")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dbc13dee
    • Corinna Vinschen's avatar
      igc: fix link speed advertising · 02ef126a
      Corinna Vinschen authored
      [ Upstream commit 329a3678 ]
      
      Link speed advertising in igc has two problems:
      
      - When setting the advertisement via ethtool, the link speed is converted
        to the legacy 32 bit representation for the intel PHY code.
        This inadvertently drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT (being
        beyond bit 31).  As a result, any call to `ethtool -s ...' drops the
        2500Mbit/s link speed from the PHY settings.  Only reloading the driver
        alleviates that problem.
      
        Fix this by converting the ETHTOOL_LINK_MODE_2500baseT_Full_BIT to the
        Intel PHY ADVERTISE_2500_FULL bit explicitly.
      
      - Rather than checking the actual PHY setting, the .get_link_ksettings
        function always fills link_modes.advertising with all link speeds
        the device is capable of.
      
        Fix this by checking the PHY autoneg_advertised settings and report
        only the actually advertised speeds up to ethtool.
      
      Fixes: 8c5ad0da
      
       ("igc: Add ethtool support")
      Signed-off-by: default avatarCorinna Vinschen <vinschen@redhat.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02ef126a
    • Stefan Assmann's avatar
      i40e: acquire VSI pointer only after VF is initialized · 873d1a47
      Stefan Assmann authored
      [ Upstream commit 67a3c6b3 ]
      
      This change simplifies the VF initialization check and also minimizes
      the delay between acquiring the VSI pointer and using it. As known by
      the commit being fixed, there is a risk of the VSI pointer getting
      changed. Therefore minimize the delay between getting and using the
      pointer.
      
      Fixes: 9889707b
      
       ("i40e: Fix crash caused by stress setting of VF MAC addresses")
      Signed-off-by: default avatarStefan Assmann <sassmann@kpanic.de>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      873d1a47
    • Johannes Berg's avatar
      mac80211: pause TX while changing interface type · cf927621
      Johannes Berg authored
      [ Upstream commit 054c9939 ]
      
      syzbot reported a crash that happened when changing the interface
      type around a lot, and while it might have been easy to fix just
      the symptom there, a little deeper investigation found that really
      the reason is that we allowed packets to be transmitted while in
      the middle of changing the interface type.
      
      Disallow TX by stopping the queues while changing the type.
      
      Fixes: 34d4bc4d
      
       ("mac80211: support runtime interface type changes")
      Reported-by: default avatar <syzbot+d7a3b15976bf7de2238a@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20210122171115.b321f98f4d4f.I6997841933c17b093535c31d29355be3c0c39628@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf927621
    • Johannes Berg's avatar
      iwlwifi: pcie: reschedule in long-running memory reads · 46c67a4c
      Johannes Berg authored
      [ Upstream commit 3d372c4e
      
       ]
      
      If we spin for a long time in memory reads that (for some reason in
      hardware) take a long time, then we'll eventually get messages such
      as
      
        watchdog: BUG: soft lockup - CPU#2 stuck for 24s! [kworker/2:2:272]
      
      This is because the reading really does take a very long time, and
      we don't schedule, so we're hogging the CPU with this task, at least
      if CONFIG_PREEMPT is not set, e.g. with CONFIG_PREEMPT_VOLUNTARY=y.
      
      Previously I misinterpreted the situation and thought that this was
      only going to happen if we had interrupts disabled, and then fixed
      this (which is good anyway, however), but that didn't always help;
      looking at it again now I realized that the spin unlock will only
      reschedule if CONFIG_PREEMPT is used.
      
      In order to avoid this issue, change the code to cond_resched() if
      we've been spinning for too long here.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: 04516706
      
       ("iwlwifi: pcie: limit memory read spin time")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130253.217a9d6a6a12.If964cb582ab0aaa94e81c4ff3b279eaafda0fd3f@changeid
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      46c67a4c
    • Johannes Berg's avatar
      iwlwifi: pcie: use jiffies for memory read spin time limit · 563daf7c
      Johannes Berg authored
      [ Upstream commit 67013174
      
       ]
      
      There's no reason to use ktime_get() since we don't need any better
      precision than jiffies, and since we no longer disable interrupts
      around this code (when grabbing NIC access), jiffies will work fine.
      Use jiffies instead of ktime_get().
      
      This cleanup is preparation for the following patch "iwlwifi: pcie: reschedule
      in long-running memory reads". The code gets simpler with the weird clock use
      etc. removed before we add cond_resched().
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130253.621c948b1fad.I3ee9f4bc4e74a0c9125d42fb7c35cd80df4698a1@changeid
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      563daf7c
    • Trond Myklebust's avatar
      pNFS/NFSv4: Fix a layout segment leak in pnfs_layout_process() · f39fce91
      Trond Myklebust authored
      [ Upstream commit 814b8497 ]
      
      If the server returns a new stateid that does not match the one in our
      cache, then pnfs_layout_process() will leak the layout segments returned
      by pnfs_mark_layout_stateid_invalid().
      
      Fixes: 9888d837
      
       ("pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f39fce91
    • Ricardo Ribalda's avatar
      ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete · a3c5fec1
      Ricardo Ribalda authored
      [ Upstream commit c1c3ba1f ]
      
      If dobj->control is not initialized we end up in an OOPs during
      skl_tplg_complete:
      
      [   26.553358] BUG: kernel NULL pointer dereference, address:
      0000000000000078
      [   26.561151] #PF: supervisor read access in kernel mode
      [   26.566897] #PF: error_code(0x0000) - not-present page
      [   26.572642] PGD 0 P4D 0
      [   26.575479] Oops: 0000 [#1] PREEMPT SMP PTI
      [   26.580158] CPU: 2 PID: 2082 Comm: udevd Tainted: G         C
      5.4.81 #4
      [   26.588232] Hardware name: HP Soraka/Soraka, BIOS
      Google_Soraka.10431.106.0 12/03/2019
      [   26.597082] RIP: 0010:skl_tplg_complete+0x70/0x144 [snd_soc_skl]
      
      Fixes: 2d744ecf
      
       ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
      Tested-by: default avatarLukasz Majczak <lma@semihalf.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20210121171644.131059-1-ribalda@chromium.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a3c5fec1
    • Kamal Heib's avatar
      RDMA/cxgb4: Fix the reported max_recv_sge value · 748c2cd5
      Kamal Heib authored
      [ Upstream commit a372173b ]
      
      The max_recv_sge value is wrongly reported when calling query_qp, This is
      happening due to a typo when assigning the max_recv_sge value, the value
      of sq_max_sges was assigned instead of rq_max_sges.
      
      Fixes: 3e5c02c9
      
       ("iw_cxgb4: Support query_qp() verb")
      Link: https://lore.kernel.org/r/20210114191423.423529-1-kamalheib1@gmail.com
      Signed-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
      Reviewed-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      748c2cd5
    • Randy Dunlap's avatar
      firmware: imx: select SOC_BUS to fix firmware build · 72797bfc
      Randy Dunlap authored
      [ Upstream commit 82c08278 ]
      
      Fix build error in firmware/imx/ selecting SOC_BUS.
      
      riscv32-linux-ld: drivers/firmware/imx/imx-scu-soc.o: in function `.L9':
      imx-scu-soc.c:(.text+0x1b0): undefined reference to `soc_device_register'
      
      Fixes: edbee095
      
       ("firmware: imx: add SCU firmware driver support")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: Atish Patra <atish.patra@wdc.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Anson Huang <Anson.Huang@nxp.com>
      Cc: Daniel Baluta <daniel.baluta@nxp.com>
      Reviewed-by: default avatarDong Aisheng <aisheng.dong@nxp.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      72797bfc
    • Marco Felsch's avatar
      ARM: dts: imx6qdl-kontron-samx6i: fix i2c_lcd/cam default status · 347feca0
      Marco Felsch authored
      [ Upstream commit 70b6ff4c ]
      
      Fix typo so the gpio i2c busses are really disabled.
      
      Fixes: 21252127
      
       ("ARM: dts: imx6qdl-kontron-samx6i: add Kontron SMARC SoM Support")
      Signed-off-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      347feca0
    • Michael Walle's avatar
      arm64: dts: ls1028a: fix the offset of the reset register · f7c6e6c9
      Michael Walle authored
      [ Upstream commit 1653e3d4 ]
      
      The offset of the reset request register is 0, the absolute address is
      0x1e60000. Boards without PSCI support will fail to perform a reset:
      
      [   26.734700] reboot: Restarting system
      [   27.743259] Unable to restart system
      [   27.746845] Reboot failed -- System halted
      
      Fixes: 8897f325
      
       ("arm64: dts: Add support for NXP LS1028A SoC")
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f7c6e6c9
    • Visa Hankala's avatar
      xfrm: Fix wraparound in xfrm_policy_addr_delta() · 78fc9ef3
      Visa Hankala authored
      [ Upstream commit da64ae2d ]
      
      Use three-way comparison for address components to avoid integer
      wraparound in the result of xfrm_policy_addr_delta(). This ensures
      that the search trees are built and traversed correctly.
      
      Treat IPv4 and IPv6 similarly by returning 0 when prefixlen == 0.
      Prefix /0 has only one equivalence class.
      
      Fixes: 9cf545eb
      
       ("xfrm: policy: store inexact policies in a tree ordered by destination address")
      Signed-off-by: default avatarVisa Hankala <visa@hankala.org>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      78fc9ef3
    • Po-Hsu Lin's avatar
      selftests: xfrm: fix test return value override issue in xfrm_policy.sh · f5e7db4f
      Po-Hsu Lin authored
      [ Upstream commit f6e9ceb7 ]
      
      When running this xfrm_policy.sh test script, even with some cases
      marked as FAIL, the overall test result will still be PASS:
      
      $ sudo ./xfrm_policy.sh
      PASS: policy before exception matches
      FAIL: expected ping to .254 to fail (exceptions)
      PASS: direct policy matches (exceptions)
      PASS: policy matches (exceptions)
      FAIL: expected ping to .254 to fail (exceptions and block policies)
      PASS: direct policy matches (exceptions and block policies)
      PASS: policy matches (exceptions and block policies)
      FAIL: expected ping to .254 to fail (exceptions and block policies after hresh changes)
      PASS: direct policy matches (exceptions and block policies after hresh changes)
      PASS: policy matches (exceptions and block policies after hresh changes)
      FAIL: expected ping to .254 to fail (exceptions and block policies after hthresh change in ns3)
      PASS: direct policy matches (exceptions and block policies after hthresh change in ns3)
      PASS: policy matches (exceptions and block policies after hthresh change in ns3)
      FAIL: expected ping to .254 to fail (exceptions and block policies after htresh change to normal)
      PASS: direct policy matches (exceptions and block policies after htresh change to normal)
      PASS: policy matches (exceptions and block policies after htresh change to normal)
      PASS: policies with repeated htresh change
      $ echo $?
      0
      
      This is because the $lret in check_xfrm() is not a local variable.
      Therefore when a test failed in check_exceptions(), the non-zero $lret
      will later get reset to 0 when the next test calls check_xfrm().
      
      With this fix, the final return value will be 1. Make it easier for
      testers to spot this failure.
      
      Fixes: 39aa6928
      
       ("xfrm: policy: fix netlink/pf_key policy lookups")
      Signed-off-by: default avatarPo-Hsu Lin <po-hsu.lin@canonical.com>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f5e7db4f
    • Eyal Birger's avatar
      xfrm: fix disable_xfrm sysctl when used on xfrm interfaces · dac256de
      Eyal Birger authored
      [ Upstream commit 9f8550e4 ]
      
      The disable_xfrm flag signals that xfrm should not be performed during
      routing towards a device before reaching device xmit.
      
      For xfrm interfaces this is usually desired as they perform the outbound
      policy lookup as part of their xmit using their if_id.
      
      Before this change enabling this flag on xfrm interfaces prevented them
      from xmitting as xfrm_lookup_with_ifid() would not perform a policy lookup
      in case the original dst had the DST_NOXFRM flag.
      
      This optimization is incorrect when the lookup is done by the xfrm
      interface xmit logic.
      
      Fix by performing policy lookup when invoked by xfrmi as if_id != 0.
      
      Similarly it's unlikely for the 'no policy exists on net' check to yield
      any performance benefits when invoked from xfrmi.
      
      Fixes: f203b76d
      
       ("xfrm: Add virtual xfrm interfaces")
      Signed-off-by: default avatarEyal Birger <eyal.birger@gmail.com>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dac256de
    • Shmulik Ladkani's avatar
      xfrm: Fix oops in xfrm_replay_advance_bmp · a7edea0f
      Shmulik Ladkani authored
      [ Upstream commit 56ce7c25 ]
      
      When setting xfrm replay_window to values higher than 32, a rare
      page-fault occurs in xfrm_replay_advance_bmp:
      
        BUG: unable to handle page fault for address: ffff8af350ad7920
        #PF: supervisor write access in kernel mode
        #PF: error_code(0x0002) - not-present page
        PGD ad001067 P4D ad001067 PUD 0
        Oops: 0002 [#1] SMP PTI
        CPU: 3 PID: 30 Comm: ksoftirqd/3 Kdump: loaded Not tainted 5.4.52-050452-generic #202007160732
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
        RIP: 0010:xfrm_replay_advance_bmp+0xbb/0x130
        RSP: 0018:ffffa1304013ba40 EFLAGS: 00010206
        RAX: 000000000000010d RBX: 0000000000000002 RCX: 00000000ffffff4b
        RDX: 0000000000000018 RSI: 00000000004c234c RDI: 00000000ffb3dbff
        RBP: ffffa1304013ba50 R08: ffff8af330ad7920 R09: 0000000007fffffa
        R10: 0000000000000800 R11: 0000000000000010 R12: ffff8af29d6258c0
        R13: ffff8af28b95c700 R14: 0000000000000000 R15: ffff8af29d6258fc
        FS:  0000000000000000(0000) GS:ffff8af339ac0000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: ffff8af350ad7920 CR3: 0000000015ee4000 CR4: 00000000001406e0
        Call Trace:
         xfrm_input+0x4e5/0xa10
         xfrm4_rcv_encap+0xb5/0xe0
         xfrm4_udp_encap_rcv+0x140/0x1c0
      
      Analysis revealed offending code is when accessing:
      
      	replay_esn->bmp[nr] |= (1U << bitnr);
      
      with 'nr' being 0x07fffffa.
      
      This happened in an SMP system when reordering of packets was present;
      A packet arrived with a "too old" sequence number (outside the window,
      i.e 'diff > replay_window'), and therefore the following calculation:
      
      			bitnr = replay_esn->replay_window - (diff - pos);
      
      yields a negative result, but since bitnr is u32 we get a large unsigned
      quantity (in crash dump above: 0xffffff4b seen in ecx).
      
      This was supposed to be protected by xfrm_input()'s former call to:
      
      		if (x->repl->check(x, skb, seq)) {
      
      However, the state's spinlock x->lock is *released* after '->check()'
      is performed, and gets re-acquired before '->advance()' - which gives a
      chance for a different core to update the xfrm state, e.g. by advancing
      'replay_esn->seq' when it encounters more packets - leading to a
      'diff > replay_window' situation when original core continues to
      xfrm_replay_advance_bmp().
      
      An attempt to fix this issue was suggested in commit bcf66bf5
      ("xfrm: Perform a replay check after return from async codepaths"),
      by calling 'x->repl->recheck()' after lock is re-acquired, but fix
      applied only to asyncronous crypto algorithms.
      
      Augment the fix, by *always* calling 'recheck()' - irrespective if we're
      using async crypto.
      
      Fixes: 0ebea8ef
      
       ("[IPSEC]: Move state lock into x->type->input")
      Signed-off-by: default avatarShmulik Ladkani <shmulik.ladkani@gmail.com>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7edea0f
    • Pablo Neira Ayuso's avatar
      netfilter: nft_dynset: add timeout extension to template · deb8d5df
      Pablo Neira Ayuso authored
      commit 0c5b7a50 upstream.
      
      Otherwise, the newly create element shows no timeout when listing the
      ruleset. If the set definition does not specify a default timeout, then
      the set element only shows the expiration time, but not the timeout.
      This is a problem when restoring a stateful ruleset listing since it
      skips the timeout policy entirely.
      
      Fixes: 22fe54d5
      
       ("netfilter: nf_tables: add support for dynamic set updates")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      deb8d5df
    • Max Krummenacher's avatar
      ARM: imx: build suspend-imx6.S with arm instruction set · 347a1a20
      Max Krummenacher authored
      commit a88afa46
      
       upstream.
      
      When the kernel is configured to use the Thumb-2 instruction set
      "suspend-to-memory" fails to resume. Observed on a Colibri iMX6ULL
      (i.MX 6ULL) and Apalis iMX6 (i.MX 6Q).
      
      It looks like the CPU resumes unconditionally in ARM instruction mode
      and then chokes on the presented Thumb-2 code it should execute.
      
      Fix this by using the arm instruction set for all code in
      suspend-imx6.S.
      
      Signed-off-by: default avatarMax Krummenacher <max.krummenacher@toradex.com>
      Fixes: df595746
      
       ("ARM: imx: add suspend in ocram support for i.mx6q")
      Acked-by: default avatarOleksandr Suvorov <oleksandr.suvorov@toradex.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      347a1a20
    • Roger Pau Monne's avatar
      xen-blkfront: allow discard-* nodes to be optional · 61bdab3d
      Roger Pau Monne authored
      commit 0549cd67 upstream.
      
      This is inline with the specification described in blkif.h:
      
       * discard-granularity: should be set to the physical block size if
         node is not present.
       * discard-alignment, discard-secure: should be set to 0 if node not
         present.
      
      This was detected as QEMU would only create the discard-granularity
      node but not discard-alignment, and thus the setup done in
      blkfront_setup_discard would fail.
      
      Fix blkfront_setup_discard to not fail on missing nodes, and also fix
      blkif_set_queue_limits to set the discard granularity to the physical
      block size if none is specified in xenbus.
      
      Fixes: ed30bf31
      
       ('xen-blkfront: Handle discard requests.')
      Reported-by: default avatarArthur Borsboom <arthurborsboom@gmail.com>
      Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Tested-By: default avatarArthur Borsboom <arthurborsboom@gmail.com>
      Link: https://lore.kernel.org/r/20210119105727.95173-1-roger.pau@citrix.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61bdab3d
    • Rouven Czerwinski's avatar
      tee: optee: replace might_sleep with cond_resched · 65543408
      Rouven Czerwinski authored
      commit dcb3b06d upstream.
      
      might_sleep() is a debugging aid and triggers rescheduling only for
      certain kernel configurations. Replace with an explicit check and
      reschedule to work for all kernel configurations. Fixes the following
      trace:
      
        [  572.945146] rcu: INFO: rcu_sched self-detected stall on CPU
        [  572.949275] rcu:     0-....: (2099 ticks this GP) idle=572/1/0x40000002 softirq=7412/7412 fqs=974
        [  572.957964]  (t=2100 jiffies g=10393 q=21)
        [  572.962054] NMI backtrace for cpu 0
        [  572.965540] CPU: 0 PID: 165 Comm: xtest Not tainted 5.8.7 #1
        [  572.971188] Hardware name: STM32 (Device Tree Support)
        [  572.976354] [<c011163c>] (unwind_backtrace) from [<c010b7f8>] (show_stack+0x10/0x14)
        [  572.984080] [<c010b7f8>] (show_stack) from [<c0511e4c>] (dump_stack+0xc4/0xd8)
        [  572.991300] [<c0511e4c>] (dump_stack) from [<c0519abc>] (nmi_cpu_backtrace+0x90/0xc4)
        [  572.999130] [<c0519abc>] (nmi_cpu_backtrace) from [<c0519bdc>] (nmi_trigger_cpumask_backtrace+0xec/0x130)
        [  573.008706] [<c0519bdc>] (nmi_trigger_cpumask_backtrace) from [<c01a5184>] (rcu_dump_cpu_stacks+0xe8/0x110)
        [  573.018453] [<c01a5184>] (rcu_dump_cpu_stacks) from [<c01a4234>] (rcu_sched_clock_irq+0x7fc/0xa88)
        [  573.027416] [<c01a4234>] (rcu_sched_clock_irq) from [<c01acdd0>] (update_process_times+0x30/0x8c)
        [  573.036291] [<c01acdd0>] (update_process_times) from [<c01bfb90>] (tick_sched_timer+0x4c/0xa8)
        [  573.044905] [<c01bfb90>] (tick_sched_timer) from [<c01adcc8>] (__hrtimer_run_queues+0x174/0x358)
        [  573.053696] [<c01adcc8>] (__hrtimer_run_queues) from [<c01aea2c>] (hrtimer_interrupt+0x118/0x2bc)
        [  573.062573] [<c01aea2c>] (hrtimer_interrupt) from [<c09ad664>] (arch_timer_handler_virt+0x28/0x30)
        [  573.071536] [<c09ad664>] (arch_timer_handler_virt) from [<c0190f50>] (handle_percpu_devid_irq+0x8c/0x240)
        [  573.081109] [<c0190f50>] (handle_percpu_devid_irq) from [<c018ab8c>] (generic_handle_irq+0x34/0x44)
        [  573.090156] [<c018ab8c>] (generic_handle_irq) from [<c018b194>] (__handle_domain_irq+0x5c/0xb0)
        [  573.098857] [<c018b194>] (__handle_domain_irq) from [<c052ac50>] (gic_handle_irq+0x4c/0x90)
        [  573.107209] [<c052ac50>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/0x90)
        [  573.114682] Exception stack(0xd90dfcf8 to 0xd90dfd40)
        [  573.119732] fce0:                                                       ffff0004 00000000
        [  573.127917] fd00: 00000000 00000000 00000000 00000000 00000000 00000000 d93493cc ffff0000
        [  573.136098] fd20: d2bc39c0 be926998 d90dfd58 d90dfd48 c09f3384 c01151f0 400d0013 ffffffff
        [  573.144281] [<c0100b0c>] (__irq_svc) from [<c01151f0>] (__arm_smccc_smc+0x10/0x20)
        [  573.151854] [<c01151f0>] (__arm_smccc_smc) from [<c09f3384>] (optee_smccc_smc+0x3c/0x44)
        [  573.159948] [<c09f3384>] (optee_smccc_smc) from [<c09f4170>] (optee_do_call_with_arg+0xb8/0x154)
        [  573.168735] [<c09f4170>] (optee_do_call_with_arg) from [<c09f4638>] (optee_invoke_func+0x110/0x190)
        [  573.177786] [<c09f4638>] (optee_invoke_func) from [<c09f1ebc>] (tee_ioctl+0x10b8/0x11c0)
        [  573.185879] [<c09f1ebc>] (tee_ioctl) from [<c029f62c>] (ksys_ioctl+0xe0/0xa4c)
        [  573.193101] [<c029f62c>] (ksys_ioctl) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
        [  573.200750] Exception stack(0xd90dffa8 to 0xd90dfff0)
        [  573.205803] ffa0:                   be926bf4 be926a78 00000003 8010a403 be926908 004e3cf8
        [  573.213987] ffc0: be926bf4 be926a78 00000000 00000036 be926908 be926918 be9269b0 bffdf0f8
        [  573.222162] ffe0: b6d76fb0 be9268fc b6d66621 b6c7e0d8
      
      seen on STM32 DK2 with CONFIG_PREEMPT_NONE.
      
      Fixes: 9f02b8f6
      
       ("tee: optee: add might_sleep for RPC requests")
      Signed-off-by: default avatarRouven Czerwinski <r.czerwinski@pengutronix.de>
      Tested-by: default avatarSumit Garg <sumit.garg@linaro.org>
      [jw: added fixes tag + small adjustments in the code]
      Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65543408
    • Umesh Nerlige Ramappa's avatar
      drm/i915: Check for all subplatform bits · ad3d896e
      Umesh Nerlige Ramappa authored
      commit 8f6d08c9 upstream.
      
      Current code is checking only 2 bits in the subplatform, but actually 3
      bits are allocated for the field. Check all 3 bits.
      
      Fixes: 805446c8
      
       ("drm/i915: Introduce concept of a sub-platform")
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210121161936.746591-1-tvrtko.ursulin@linux.intel.com
      (cherry picked from commit 27b695ee1af9bb36605e67055874ec081306ac28)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad3d896e
    • Karol Herbst's avatar
      drm/nouveau/svm: fail NOUVEAU_SVM_INIT ioctl on unsupported devices · 59546420
      Karol Herbst authored
      commit dcd602cc upstream.
      
      Fixes a crash when trying to create a channel on e.g. Turing GPUs when
      NOUVEAU_SVM_INIT was called before.
      
      Fixes: eeaf06ac
      
       ("drm/nouveau/svm: initial support for shared virtual memory")
      Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      59546420
    • Lorenzo Bianconi's avatar
      mt7601u: fix rx buffer refcounting · 37ef9b59
      Lorenzo Bianconi authored
      commit d24c7905 upstream.
      
      Fix the following crash due to erroneous page refcounting:
      
      [   32.445919] BUG: Bad page state in process swapper/1  pfn:11f65a
      [   32.447409] page:00000000938f0632 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x11f65a
      [   32.449605] flags: 0x8000000000000000()
      [   32.450421] raw: 8000000000000000 ffffffff825b0148 ffffea00045ae988 0000000000000000
      [   32.451795] raw: 0000000000000000 0000000000000001 00000000ffffff7f 0000000000000000
      [   32.452999] page dumped because: nonzero mapcount
      [   32.453888] Modules linked in:
      [   32.454492] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.11.0-rc2+ #1976
      [   32.455695] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-1.fc33 04/01/2014
      [   32.457157] Call Trace:
      [   32.457636]  <IRQ>
      [   32.457993]  dump_stack+0x77/0x97
      [   32.458576]  bad_page.cold+0x65/0x96
      [   32.459198]  get_page_from_freelist+0x46a/0x11f0
      [   32.460008]  __alloc_pages_nodemask+0x10a/0x2b0
      [   32.460794]  mt7601u_rx_tasklet+0x651/0x720
      [   32.461505]  tasklet_action_common.constprop.0+0x6b/0xd0
      [   32.462343]  __do_softirq+0x152/0x46c
      [   32.462928]  asm_call_irq_on_stack+0x12/0x20
      [   32.463610]  </IRQ>
      [   32.463953]  do_softirq_own_stack+0x5b/0x70
      [   32.464582]  irq_exit_rcu+0x9f/0xe0
      [   32.465028]  common_interrupt+0xae/0x1a0
      [   32.465536]  asm_common_interrupt+0x1e/0x40
      [   32.466071] RIP: 0010:default_idle+0x18/0x20
      [   32.468981] RSP: 0018:ffffc90000077f00 EFLAGS: 00000246
      [   32.469648] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
      [   32.470550] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81aac3dd
      [   32.471463] RBP: ffff88810022ab00 R08: 0000000000000001 R09: 0000000000000001
      [   32.472335] R10: 0000000000000046 R11: 0000000000005aa0 R12: 0000000000000000
      [   32.473235] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [   32.474139]  ? default_idle_call+0x4d/0x200
      [   32.474681]  default_idle_call+0x74/0x200
      [   32.475192]  do_idle+0x1d5/0x250
      [   32.475612]  cpu_startup_entry+0x19/0x20
      [   32.476114]  secondary_startup_64_no_verify+0xb0/0xbb
      [   32.476765] Disabling lock debugging due to kernel taint
      
      Fixes: c869f77d
      
       ("add mt7601u driver")
      Co-developed-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Acked-by: default avatarJakub Kicinski <kubakici@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/62b2380c8c2091834cfad05e1059b55f945bd114.1610643952.git.lorenzo@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      37ef9b59
    • Lorenzo Bianconi's avatar
      mt7601u: fix kernel crash unplugging the device · 77771158
      Lorenzo Bianconi authored
      commit 0acb20a5 upstream.
      
      The following crash log can occur unplugging the usb dongle since,
      after the urb poison in mt7601u_free_tx_queue(), usb_submit_urb() will
      always fail resulting in a skb kfree while the skb has been already
      queued.
      
      Fix the issue enqueuing the skb only if usb_submit_urb() succeed.
      
      Hardware name: Hewlett-Packard 500-539ng/2B2C, BIOS 80.06 04/01/2015
      Workqueue: usb_hub_wq hub_event
      RIP: 0010:skb_trim+0x2c/0x30
      RSP: 0000:ffffb4c88005bba8 EFLAGS: 00010206
      RAX: 000000004ad483ee RBX: ffff9a236625dee0 RCX: 000000000000662f
      RDX: 000000000000000c RSI: 0000000000000000 RDI: ffff9a2343179300
      RBP: ffff9a2343179300 R08: 0000000000000001 R09: 0000000000000000
      R10: ffff9a23748f7840 R11: 0000000000000001 R12: ffff9a236625e4d4
      R13: ffff9a236625dee0 R14: 0000000000001080 R15: 0000000000000008
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fd410a34ef8 CR3: 00000001416ee001 CR4: 00000000001706f0
      Call Trace:
       mt7601u_tx_status+0x3e/0xa0 [mt7601u]
       mt7601u_dma_cleanup+0xca/0x110 [mt7601u]
       mt7601u_cleanup+0x22/0x30 [mt7601u]
       mt7601u_disconnect+0x22/0x60 [mt7601u]
       usb_unbind_interface+0x8a/0x270
       ? kernfs_find_ns+0x35/0xd0
       __device_release_driver+0x17a/0x230
       device_release_driver+0x24/0x30
       bus_remove_device+0xdb/0x140
       device_del+0x18b/0x430
       ? kobject_put+0x98/0x1d0
       usb_disable_device+0xc6/0x1f0
       usb_disconnect.cold+0x7e/0x20a
       hub_event+0xbf3/0x1870
       process_one_work+0x1b6/0x350
       worker_thread+0x53/0x3e0
       ? process_one_work+0x350/0x350
       kthread+0x11b/0x140
       ? __kthread_bind_mask+0x60/0x60
       ret_from_fork+0x22/0x30
      
      Fixes: 23377c20
      
       ("mt7601u: fix possible memory leak when the device is disconnected")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Acked-by: default avatarJakub Kicinski <kubakici@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/3b85219f669a63a8ced1f43686de05915a580489.1610919247.git.lorenzo@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77771158
    • Bharat Gooty's avatar
      arm64: dts: broadcom: Fix USB DMA address translation for Stingray · 2c4f52b9
      Bharat Gooty authored
      commit da8ee66f upstream.
      
      Add a non-empty dma-ranges so that DMA address translation happens.
      
      Fixes: 2013a4b6
      
       ("arm64: dts: broadcom: clear the warnings caused by empty dma-ranges")
      Signed-off-by: default avatarBharat Gooty <bharat.gooty@broadcom.com>
      Signed-off-by: default avatarRayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarRay Jui <ray.jui@broadcom.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c4f52b9
    • Andrea Righi's avatar
      leds: trigger: fix potential deadlock with libata · 6aceac24
      Andrea Righi authored
      commit 27af8e2c upstream.
      
      We have the following potential deadlock condition:
      
       ========================================================
       WARNING: possible irq lock inversion dependency detected
       5.10.0-rc2+ #25 Not tainted
       --------------------------------------------------------
       swapper/3/0 just changed the state of lock:
       ffff8880063bd618 (&host->lock){-...}-{2:2}, at: ata_bmdma_interrupt+0x27/0x200
       but this lock took another, HARDIRQ-READ-unsafe lock in the past:
        (&trig->leddev_list_lock){.+.?}-{2:2}
      
       and interrupts could create inverse lock ordering between them.
      
       other info that might help us debug this:
        Possible interrupt unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&trig->leddev_list_lock);
                                      local_irq_disable();
                                      lock(&host->lock);
                                      lock(&trig->leddev_list_lock);
         <Interrupt>
           lock(&host->lock);
      
        *** DEADLOCK ***
      
       no locks held by swapper/3/0.
      
       the shortest dependencies between 2nd lock and 1st lock:
        -> (&trig->leddev_list_lock){.+.?}-{2:2} ops: 46 {
           HARDIRQ-ON-R at:
                             lock_acquire+0x15f/0x420
                             _raw_read_lock+0x42/0x90
                             led_trigger_event+0x2b/0x70
                             rfkill_global_led_trigger_worker+0x94/0xb0
                             process_one_work+0x240/0x560
                             worker_thread+0x58/0x3d0
                             kthread+0x151/0x170
                             ret_from_fork+0x1f/0x30
           IN-SOFTIRQ-R at:
                             lock_acquire+0x15f/0x420
                             _raw_read_lock+0x42/0x90
                             led_trigger_event+0x2b/0x70
                             kbd_bh+0x9e/0xc0
                             tasklet_action_common.constprop.0+0xe9/0x100
                             tasklet_action+0x22/0x30
                             __do_softirq+0xcc/0x46d
                             run_ksoftirqd+0x3f/0x70
                             smpboot_thread_fn+0x116/0x1f0
                             kthread+0x151/0x170
                             ret_from_fork+0x1f/0x30
           SOFTIRQ-ON-R at:
                             lock_acquire+0x15f/0x420
                             _raw_read_lock+0x42/0x90
                             led_trigger_event+0x2b/0x70
                             rfkill_global_led_trigger_worker+0x94/0xb0
                             process_one_work+0x240/0x560
                             worker_thread+0x58/0x3d0
                             kthread+0x151/0x170
                             ret_from_fork+0x1f/0x30
           INITIAL READ USE at:
                                 lock_acquire+0x15f/0x420
                                 _raw_read_lock+0x42/0x90
                                 led_trigger_event+0x2b/0x70
                                 rfkill_global_led_trigger_worker+0x94/0xb0
                                 process_one_work+0x240/0x560
                                 worker_thread+0x58/0x3d0
                                 kthread+0x151/0x170
                                 ret_from_fork+0x1f/0x30
         }
         ... key      at: [<ffffffff83da4c00>] __key.0+0x0/0x10
         ... acquired at:
          _raw_read_lock+0x42/0x90
          led_trigger_blink_oneshot+0x3b/0x90
          ledtrig_disk_activity+0x3c/0xa0
          ata_qc_complete+0x26/0x450
          ata_do_link_abort+0xa3/0xe0
          ata_port_freeze+0x2e/0x40
          ata_hsm_qc_complete+0x94/0xa0
          ata_sff_hsm_move+0x177/0x7a0
          ata_sff_pio_task+0xc7/0x1b0
          process_one_work+0x240/0x560
          worker_thread+0x58/0x3d0
          kthread+0x151/0x170
          ret_from_fork+0x1f/0x30
      
       -> (&host->lock){-...}-{2:2} ops: 69 {
          IN-HARDIRQ-W at:
                           lock_acquire+0x15f/0x420
                           _raw_spin_lock_irqsave+0x52/0xa0
                           ata_bmdma_interrupt+0x27/0x200
                           __handle_irq_event_percpu+0xd5/0x2b0
                           handle_irq_event+0x57/0xb0
                           handle_edge_irq+0x8c/0x230
                           asm_call_irq_on_stack+0xf/0x20
                           common_interrupt+0x100/0x1c0
                           asm_common_interrupt+0x1e/0x40
                           native_safe_halt+0xe/0x10
                           arch_cpu_idle+0x15/0x20
                           default_idle_call+0x59/0x1c0
                           do_idle+0x22c/0x2c0
                           cpu_startup_entry+0x20/0x30
                           start_secondary+0x11d/0x150
                           secondary_startup_64_no_verify+0xa6/0xab
          INITIAL USE at:
                          lock_acquire+0x15f/0x420
                          _raw_spin_lock_irqsave+0x52/0xa0
                          ata_dev_init+0x54/0xe0
                          ata_link_init+0x8b/0xd0
                          ata_port_alloc+0x1f1/0x210
                          ata_host_alloc+0xf1/0x130
                          ata_host_alloc_pinfo+0x14/0xb0
                          ata_pci_sff_prepare_host+0x41/0xa0
                          ata_pci_bmdma_prepare_host+0x14/0x30
                          piix_init_one+0x21f/0x600
                          local_pci_probe+0x48/0x80
                          pci_device_probe+0x105/0x1c0
                          really_probe+0x221/0x490
                          driver_probe_device+0xe9/0x160
                          device_driver_attach+0xb2/0xc0
                          __driver_attach+0x91/0x150
                          bus_for_each_dev+0x81/0xc0
                          driver_attach+0x1e/0x20
                          bus_add_driver+0x138/0x1f0
                          driver_register+0x91/0xf0
                          __pci_register_driver+0x73/0x80
                          piix_init+0x1e/0x2e
                          do_one_initcall+0x5f/0x2d0
                          kernel_init_freeable+0x26f/0x2cf
                          kernel_init+0xe/0x113
                          ret_from_fork+0x1f/0x30
        }
        ... key      at: [<ffffffff83d9fdc0>] __key.6+0x0/0x10
        ... acquired at:
          __lock_acquire+0x9da/0x2370
          lock_acquire+0x15f/0x420
          _raw_spin_lock_irqsave+0x52/0xa0
          ata_bmdma_interrupt+0x27/0x200
          __handle_irq_event_percpu+0xd5/0x2b0
          handle_irq_event+0x57/0xb0
          handle_edge_irq+0x8c/0x230
          asm_call_irq_on_stack+0xf/0x20
          common_interrupt+0x100/0x1c0
          asm_common_interrupt+0x1e/0x40
          native_safe_halt+0xe/0x10
          arch_cpu_idle+0x15/0x20
          default_idle_call+0x59/0x1c0
          do_idle+0x22c/0x2c0
          cpu_startup_entry+0x20/0x30
          start_secondary+0x11d/0x150
          secondary_startup_64_no_verify+0xa6/0xab
      
      This lockdep splat is reported after:
      commit e9181886 ("locking: More accurate annotations for read_lock()")
      
      To clarify:
       - read-locks are recursive only in interrupt context (when
         in_interrupt() returns true)
       - after acquiring host->lock in CPU1, another cpu (i.e. CPU2) may call
         write_lock(&trig->leddev_list_lock) that would be blocked by CPU0
         that holds trig->leddev_list_lock in read-mode
       - when CPU1 (ata_ac_complete()) tries to read-lock
         trig->leddev_list_lock, it would be blocked by the write-lock waiter
         on CPU2 (because we are not in interrupt context, so the read-lock is
         not recursive)
       - at this point if an interrupt happens on CPU0 and
         ata_bmdma_interrupt() is executed it will try to acquire host->lock,
         that is held by CPU1, that is currently blocked by CPU2, so:
      
         * CPU0 blocked by CPU1
         * CPU1 blocked by CPU2
         * CPU2 blocked by CPU0
      
           *** DEADLOCK ***
      
      The deadlock scenario is better represented by the following schema
      (thanks to Boqun Feng <boqun.feng@gmail.com> for the schema and the
      detailed explanation of the deadlock condition):
      
       CPU 0:                          CPU 1:                        CPU 2:
       -----                           -----                         -----
       led_trigger_event():
         read_lock(&trig->leddev_list_lock);
       				<workqueue>
       				ata_hsm_qc_complete():
       				  spin_lock_irqsave(&host->lock);
       								write_lock(&trig->leddev_list_lock);
       				  ata_port_freeze():
       				    ata_do_link_abort():
       				      ata_qc_complete():
       					ledtrig_disk_activity():
       					  led_trigger_blink_oneshot():
       					    read_lock(&trig->leddev_list_lock);
       					    // ^ not in in_interrupt() context, so could get blocked by CPU 2
       <interrupt>
         ata_bmdma_interrupt():
           spin_lock_irqsave(&host->lock);
      
      Fix by using read_lock_irqsave/irqrestore() in led_trigger_event(), so
      that no interrupt can happen in between, preventing the deadlock
      condition.
      
      Apply the same change to led_trigger_blink_setup() as well, since the
      same deadlock scenario can also happen in power_supply_update_bat_leds()
      -> led_trigger_blink() -> led_trigger_blink_setup() (workqueue context),
      and potentially prevent other similar usages.
      
      Link: https://lore.kernel.org/lkml/20201101092614.GB3989@xps-13-7390/
      Fixes: eb25cb99
      
       ("leds: convert IDE trigger to common disk trigger")
      Signed-off-by: default avatarAndrea Righi <andrea.righi@canonical.com>
      Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6aceac24
    • David Woodhouse's avatar
      xen: Fix XenStore initialisation for XS_LOCAL · 2c7b4b25
      David Woodhouse authored
      commit 5f46400f upstream.
      
      In commit 3499ba81 ("xen: Fix event channel callback via INTX/GSI")
      I reworked the triggering of xenbus_probe().
      
      I tried to simplify things by taking out the workqueue based startup
      triggered from wake_waiting(); the somewhat poorly named xenbus IRQ
      handler.
      
      I missed the fact that in the XS_LOCAL case (Dom0 starting its own
      xenstored or xenstore-stubdom, which happens after the kernel is booted
      completely), that IRQ-based trigger is still actually needed.
      
      So... put it back, except more cleanly. By just spawning a xenbus_probe
      thread which waits on xb_waitq and runs the probe the first time it
      gets woken, just as the workqueue-based hack did.
      
      This is actually a nicer approach for *all* the back ends with different
      interrupt methods, and we can switch them all over to that without the
      complex conditions for when to trigger it. But not in -rc6. This is
      the minimal fix for the regression, although it's a step in the right
      direction instead of doing a partial revert and actually putting the
      workqueue back. It's also simpler than the workqueue.
      
      Fixes: 3499ba81
      
       ("xen: Fix event channel callback via INTX/GSI")
      Reported-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/4c9af052a6e0f6485d1de43f2c38b1461996db99.camel@infradead.org
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Salvatore Bonaccorso <carnil@debian.org>
      Cc: Jason Andryuk <jandryuk@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c7b4b25
    • Marc Zyngier's avatar
      KVM: Forbid the use of tagged userspace addresses for memslots · 632a7728
      Marc Zyngier authored
      commit 139bc8a6
      
       upstream.
      
      The use of a tagged address could be pretty confusing for the
      whole memslot infrastructure as well as the MMU notifiers.
      
      Forbid it altogether, as it never quite worked the first place.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRick Edgecombe <rick.p.edgecombe@intel.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      632a7728
    • Jay Zhou's avatar
      KVM: x86: get smi pending status correctly · ba668a50
      Jay Zhou authored
      commit 1f7becf1
      
       upstream.
      
      The injection process of smi has two steps:
      
          Qemu                        KVM
      Step1:
          cpu->interrupt_request &= \
              ~CPU_INTERRUPT_SMI;
          kvm_vcpu_ioctl(cpu, KVM_SMI)
      
                                      call kvm_vcpu_ioctl_smi() and
                                      kvm_make_request(KVM_REQ_SMI, vcpu);
      
      Step2:
          kvm_vcpu_ioctl(cpu, KVM_RUN, 0)
      
                                      call process_smi() if
                                      kvm_check_request(KVM_REQ_SMI, vcpu) is
                                      true, mark vcpu->arch.smi_pending = true;
      
      The vcpu->arch.smi_pending will be set true in step2, unfortunately if
      vcpu paused between step1 and step2, the kvm_run->immediate_exit will be
      set and vcpu has to exit to Qemu immediately during step2 before mark
      vcpu->arch.smi_pending true.
      During VM migration, Qemu will get the smi pending status from KVM using
      KVM_GET_VCPU_EVENTS ioctl at the downtime, then the smi pending status
      will be lost.
      
      Signed-off-by: default avatarJay Zhou <jianjay.zhou@huawei.com>
      Signed-off-by: default avatarShengen Zhuang <zhuangshengen@huawei.com>
      Message-Id: <20210118084720.1585-1-jianjay.zhou@huawei.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba668a50
    • Maxim Levitsky's avatar
      KVM: nVMX: Sync unsync'd vmcs02 state to vmcs12 on migration · ff5f6de2
      Maxim Levitsky authored
      commit d51e1d3f upstream.
      
      Even when we are outside the nested guest, some vmcs02 fields
      may not be in sync vs vmcs12.  This is intentional, even across
      nested VM-exit, because the sync can be delayed until the nested
      hypervisor performs a VMCLEAR or a VMREAD/VMWRITE that affects those
      rarely accessed fields.
      
      However, during KVM_GET_NESTED_STATE, the vmcs12 has to be up to date to
      be able to restore it.  To fix that, call copy_vmcs02_to_vmcs12_rare()
      before the vmcs12 contents are copied to userspace.
      
      Fixes: 7952d769
      
       ("KVM: nVMX: Sync rarely accessed guest fields only when needed")
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Message-Id: <20210114205449.8715-2-mlevitsk@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff5f6de2
    • Like Xu's avatar
      KVM: x86/pmu: Fix UBSAN shift-out-of-bounds warning in intel_pmu_refresh() · 2fc14caf
      Like Xu authored
      commit e61ab2a3
      
       upstream.
      
      Since we know vPMU will not work properly when (1) the guest bit_width(s)
      of the [gp|fixed] counters are greater than the host ones, or (2) guest
      requested architectural events exceeds the range supported by the host, so
      we can setup a smaller left shift value and refresh the guest cpuid entry,
      thus fixing the following UBSAN shift-out-of-bounds warning:
      
      shift exponent 197 is too large for 64-bit type 'long long unsigned int'
      
      Call Trace:
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x107/0x163 lib/dump_stack.c:120
       ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
       __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:395
       intel_pmu_refresh.cold+0x75/0x99 arch/x86/kvm/vmx/pmu_intel.c:348
       kvm_vcpu_after_set_cpuid+0x65a/0xf80 arch/x86/kvm/cpuid.c:177
       kvm_vcpu_ioctl_set_cpuid2+0x160/0x440 arch/x86/kvm/cpuid.c:308
       kvm_arch_vcpu_ioctl+0x11b6/0x2d70 arch/x86/kvm/x86.c:4709
       kvm_vcpu_ioctl+0x7b9/0xdb0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3386
       vfs_ioctl fs/ioctl.c:48 [inline]
       __do_sys_ioctl fs/ioctl.c:753 [inline]
       __se_sys_ioctl fs/ioctl.c:739 [inline]
       __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Reported-by: default avatar <syzbot+ae488dc136a4cc6ba32b@syzkaller.appspotmail.com>
      Signed-off-by: default avatarLike Xu <like.xu@linux.intel.com>
      Message-Id: <20210118025800.34620-1-like.xu@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2fc14caf
    • Like Xu's avatar
      KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[] · c547d39f
      Like Xu authored
      commit 98dd2f10 upstream.
      
      The HW_REF_CPU_CYCLES event on the fixed counter 2 is pseudo-encoded as
      0x0300 in the intel_perfmon_event_map[]. Correct its usage.
      
      Fixes: 62079d8a
      
       ("KVM: PMU: add proper support for fixed counter 2")
      Signed-off-by: default avatarLike Xu <like.xu@linux.intel.com>
      Message-Id: <20201230081916.63417-1-like.xu@linux.intel.com>
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c547d39f
    • Josef Bacik's avatar
      btrfs: fix possible free space tree corruption with online conversion · e1ae9aab
      Josef Bacik authored
      commit 2f96e402 upstream.
      
      While running btrfs/011 in a loop I would often ASSERT() while trying to
      add a new free space entry that already existed, or get an EEXIST while
      adding a new block to the extent tree, which is another indication of
      double allocation.
      
      This occurs because when we do the free space tree population, we create
      the new root and then populate the tree and commit the transaction.
      The problem is when you create a new root, the root node and commit root
      node are the same.  During this initial transaction commit we will run
      all of the delayed refs that were paused during the free space tree
      generation, and thus begin to cache block groups.  While caching block
      groups the caching thread will be reading from the main root for the
      free space tree, so as we make allocations we'll be changing the free
      space tree, which can cause us to add the same range twice which results
      in either the ASSERT(ret != -EEXIST); in __btrfs_add_free_space, or in a
      variety of different errors when running delayed refs because of a
      double allocation.
      
      Fix this by marking the fs_info as unsafe to load the free space tree,
      and fall back on the old slow method.  We could be smarter than this,
      for example caching the block group while we're populating the free
      space tree, but since this is a serious problem I've opted for the
      simplest solution.
      
      CC: stable@vger.kernel.org # 4.9+
      Fixes: a5ed9182
      
       ("Btrfs: implement the free space B-tree")
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1ae9aab
    • Claudiu Beznea's avatar
      drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[] · d30cb3d3
      Claudiu Beznea authored
      commit 68089655 upstream.
      
      of_match_node() calls __of_match_node() which loops though the entries of
      matches array. It stops when condition:
      (matches->name[0] || matches->type[0] || matches->compatible[0]) is
      false. Thus, add a null entry at the end of at91_soc_allowed_list[]
      array.
      
      Fixes: caab13b4
      
       ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs")
      Cc: stable@vger.kernel.org #4.12+
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d30cb3d3
    • Sudeep Holla's avatar
      drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs · 082dc611
      Sudeep Holla authored
      commit caab13b4
      
       upstream.
      
      Since at91_soc_init is called unconditionally from atmel_soc_device_init,
      we get the following warning on all non AT91 SoCs:
      	" AT91: Could not find identification node"
      
      Fix the same by filtering with allowed AT91 SoC list.
      
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
      Cc: stable@vger.kernel.org #4.12+
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Link: https://lore.kernel.org/r/20201211135846.1334322-1-sudeep.holla@arm.com
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      082dc611
    • Laurent Badel's avatar
      PM: hibernate: flush swap writer after marking · 53fd4e40
      Laurent Badel authored
      commit fef9c8d2 upstream.
      
      Flush the swap writer after, not before, marking the files, to ensure the
      signature is properly written.
      
      Fixes: 6f612af5
      
       ("PM / Hibernate: Group swap ops")
      Signed-off-by: default avatarLaurent Badel <laurentbadel@eaton.com>
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53fd4e40
    • Tony Krowiak's avatar
      s390/vfio-ap: No need to disable IRQ after queue reset · 7f9a267c
      Tony Krowiak authored
      commit 6c12a638
      
       upstream.
      
      The queues assigned to a matrix mediated device are currently reset when:
      
      * The VFIO_DEVICE_RESET ioctl is invoked
      * The mdev fd is closed by userspace (QEMU)
      * The mdev is removed from sysfs.
      
      Immediately after the reset of a queue, a call is made to disable
      interrupts for the queue. This is entirely unnecessary because the reset of
      a queue disables interrupts, so this will be removed.
      
      Furthermore, vfio_ap_irq_disable() does an unconditional PQAP/AQIC which
      can result in a specification exception (when the corresponding facility
      is not available), so this is actually a bugfix.
      
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      [pasic@linux.ibm.com: minor rework before merging]
      Signed-off-by: default avatarHalil Pasic <pasic@linux.ibm.com>
      Fixes: ec89b55e
      
       ("s390: ap: implement PAPQ AQIC interception in kernel")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f9a267c
    • Giacinto Cifelli's avatar
      net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family · 9077bc37
      Giacinto Cifelli authored
      commit 7e0e63d0
      
       upstream.
      
      Bus 003 Device 009: ID 1e2d:006f
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass          239 Miscellaneous Device
        bDeviceSubClass         2 ?
        bDeviceProtocol         1 Interface Association
        bMaxPacketSize0        64
        idVendor           0x1e2d
        idProduct          0x006f
        bcdDevice            0.00
        iManufacturer           3 Cinterion Wireless Modules
        iProduct                2 PLSx3
        iSerial                 4 fa3c1419
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength          303
          bNumInterfaces          9
          bConfigurationValue     1
          iConfiguration          1 Cinterion Configuration
          bmAttributes         0xe0
            Self Powered
            Remote Wakeup
          MaxPower              500mA
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         0
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          1
            CDC Union:
              bMasterInterface        0
              bSlaveInterface         1
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         2
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        2
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          3
            CDC Union:
              bMasterInterface        2
              bSlaveInterface         3
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        3
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x84  EP 4 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         4
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        4
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          5
            CDC Union:
              bMasterInterface        4
              bSlaveInterface         5
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x85  EP 5 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        5
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x86  EP 6 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x03  EP 3 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Association:
            bLength                 8
            bDescriptorType        11
            bFirstInterface         6
            bInterfaceCount         2
            bFunctionClass          2 Communications
            bFunctionSubClass       2 Abstract (modem)
            bFunctionProtocol       1 AT-commands (v.25ter)
            iFunction               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        6
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            CDC Header:
              bcdCDC               1.10
            CDC ACM:
              bmCapabilities       0x02
                line coding and serial state
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          7
            CDC Union:
              bMasterInterface        6
              bSlaveInterface         7
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x87  EP 7 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        7
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x88  EP 8 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x04  EP 4 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        8
            bAlternateSetting       0
            bNumEndpoints           3
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass    255 Vendor Specific Subclass
            bInterfaceProtocol    255 Vendor Specific Protocol
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x89  EP 9 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               5
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x8a  EP 10 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x05  EP 5 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      Device Qualifier (for other device speed):
        bLength                10
        bDescriptorType         6
        bcdUSB               2.00
        bDeviceClass          239 Miscellaneous Device
        bDeviceSubClass         2 ?
        bDeviceProtocol         1 Interface Association
        bMaxPacketSize0        64
        bNumConfigurations      1
      Device Status:     0x0000
        (Bus Powered)
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGiacinto Cifelli <gciofono@gmail.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20210120045650.10855-1-gciofono@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9077bc37
    • Johannes Berg's avatar
      wext: fix NULL-ptr-dereference with cfg80211's lack of commit() · 8aba60eb
      Johannes Berg authored
      commit 51225651
      
       upstream.
      
      Since cfg80211 doesn't implement commit, we never really cared about
      that code there (and it's configured out w/o CONFIG_WIRELESS_EXT).
      After all, since it has no commit, it shouldn't return -EIWCOMMIT to
      indicate commit is needed.
      
      However, EIWCOMMIT is actually an alias for EINPROGRESS, which _can_
      happen if e.g. we try to change the frequency but we're already in
      the process of connecting to some network, and drivers could return
      that value (or even cfg80211 itself might).
      
      This then causes us to crash because dev->wireless_handlers is NULL
      but we try to check dev->wireless_handlers->standard[0].
      
      Fix this by also checking dev->wireless_handlers. Also simplify the
      code a little bit.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatar <syzbot+444248c79e117bc99f46@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+8b2a88a09653d4084179@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20210121171621.2076e4a37d5a.I5d9c72220fe7bb133fb718751da0180a57ecba4e@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8aba60eb