Skip to content
  1. Apr 27, 2024
    • Arınç ÜNAL's avatar
      net: dsa: mt7530: fix enabling EEE on MT7531 switch on all boards · 7d51db45
      Arınç ÜNAL authored
      commit 06dfcd40 upstream.
      
      The commit 40b5d2f1 ("net: dsa: mt7530: Add support for EEE features")
      brought EEE support but did not enable EEE on MT7531 switch MACs. EEE is
      enabled on MT7531 switch MACs by pulling the LAN2LED0 pin low on the board
      (bootstrapping), unsetting the EEE_DIS bit on the trap register, or setting
      the internal EEE switch bit on the CORE_PLL_GROUP4 register. Thanks to
      SkyLake Huang (黃啟澤) from MediaTek for providing information on the
      internal EEE switch bit.
      
      There are existing boards that were not designed to pull the pin low.
      Because of that, the EEE status currently depends on the board design.
      
      The EEE_DIS bit on the trap pertains to the LAN2LED0 pin which is usually
      used to control an LED. Once the bit is unset, the pin will be low. That
      will make the active low LED turn on. The pin is controlled by the switch
      PHY. It seems that the PHY controls the pin in the way that it inverts the
      pin state. That means depending on the wiring of the LED connected to
      LAN2LED0 on the board, the LED may be on without an active link.
      
      To not cause this unwanted behaviour whilst enabling EEE on all boards, set
      the internal EEE switch bit on the CORE_PLL_GROUP4 register.
      
      My testing on MT7531 shows a certain amount of traffic loss when EEE is
      enabled. That said, I haven't come across a board that enables EEE. So
      enable EEE on the switch MACs but disable EEE advertisement on the switch
      PHYs. This way, we don't change the behaviour of the majority of the boards
      that have this switch. The mediatek-ge PHY driver already disables EEE
      advertisement on the switch PHYs but my testing shows that it is somehow
      enabled afterwards. Disabling EEE advertisement before the PHY driver
      initialises keeps it off.
      
      With this change, EEE can now be enabled using ethtool.
      
      Fixes: 40b5d2f1
      
       ("net: dsa: mt7530: Add support for EEE features")
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Tested-by: default avatarDaniel Golle <daniel@makrotopia.org>
      Reviewed-by: default avatarDaniel Golle <daniel@makrotopia.org>
      Link: https://lore.kernel.org/r/20240408-for-net-mt7530-fix-eee-for-mt7531-mt7988-v3-1-84fdef1f008b@arinc9.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d51db45
    • Arınç ÜNAL's avatar
      net: dsa: mt7530: fix improper frames on all 25MHz and 40MHz XTAL MT7530 · 41a004ff
      Arınç ÜNAL authored
      commit 5f563c31 upstream.
      
      The MT7530 switch after reset initialises with a core clock frequency that
      works with a 25MHz XTAL connected to it. For 40MHz XTAL, the core clock
      frequency must be set to 500MHz.
      
      The mt7530_pll_setup() function is responsible of setting the core clock
      frequency. Currently, it runs on MT7530 with 25MHz and 40MHz XTAL. This
      causes MT7530 switch with 25MHz XTAL to egress and ingress frames
      improperly.
      
      Introduce a check to run it only on MT7530 with 40MHz XTAL.
      
      The core clock frequency is set by writing to a switch PHY's register.
      Access to the PHY's register is done via the MDIO bus the switch is also
      on. Therefore, it works only when the switch makes switch PHYs listen on
      the MDIO bus the switch is on. This is controlled either by the state of
      the ESW_P1_LED_1 pin after reset deassertion or modifying bit 5 of the
      modifiable trap register.
      
      When ESW_P1_LED_1 is pulled high, PHY indirect access is used. That means
      accessing PHY registers via the PHY indirect access control register of the
      switch.
      
      When ESW_P1_LED_1 is pulled low, PHY direct access is used. That means
      accessing PHY registers via the MDIO bus the switch is on.
      
      For MT7530 switch with 40MHz XTAL on a board with ESW_P1_LED_1 pulled high,
      the core clock frequency won't be set to 500MHz, causing the switch to
      egress and ingress frames improperly.
      
      Run mt7530_pll_setup() after PHY direct access is set on the modifiable
      trap register.
      
      With these two changes, all MT7530 switches with 25MHz and 40MHz, and
      P1_LED_1 pulled high or low, will egress and ingress frames properly.
      
      Link: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/4a5dd143f2172ec97a2872fa29c7c4cd520f45b5/linux-mt/drivers/net/ethernet/mediatek/gsw_mt7623.c#L1039
      Fixes: b8f126a8
      
       ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Link: https://lore.kernel.org/r/20240320-for-net-mt7530-fix-25mhz-xtal-with-direct-phy-access-v1-1-d92f605f1160@arinc9.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41a004ff
    • Vladimir Oltean's avatar
      net: dsa: introduce preferred_default_local_cpu_port and use on MT7530 · d9c2f69c
      Vladimir Oltean authored
      commit b79d7c14 upstream.
      
      Since the introduction of the OF bindings, DSA has always had a policy that
      in case multiple CPU ports are present in the device tree, the numerically
      smallest one is always chosen.
      
      The MT7530 switch family, except the switch on the MT7988 SoC, has 2 CPU
      ports, 5 and 6, where port 6 is preferable on the MT7531BE switch because
      it has higher bandwidth.
      
      The MT7530 driver developers had 3 options:
      - to modify DSA when the MT7531 switch support was introduced, such as to
        prefer the better port
      - to declare both CPU ports in device trees as CPU ports, and live with the
        sub-optimal performance resulting from not preferring the better port
      - to declare just port 6 in the device tree as a CPU port
      
      Of course they chose the path of least resistance (3rd option), kicking the
      can down the road. The hardware description in the device tree is supposed
      to be stable - developers are not supposed to adopt the strategy of
      piecemeal hardware description, where the device tree is updated in
      lockstep with the features that the kernel currently supports.
      
      Now, as a result of the fact that they did that, any attempts to modify the
      device tree and describe both CPU ports as CPU ports would make DSA change
      its default selection from port 6 to 5, effectively resulting in a
      performance degradation visible to users with the MT7531BE switch as can be
      seen below.
      
      Without preferring port 6:
      
      [ ID][Role] Interval           Transfer     Bitrate         Retr
      [  5][TX-C]   0.00-20.00  sec   374 MBytes   157 Mbits/sec  734    sender
      [  5][TX-C]   0.00-20.00  sec   373 MBytes   156 Mbits/sec    receiver
      [  7][RX-C]   0.00-20.00  sec  1.81 GBytes   778 Mbits/sec    0    sender
      [  7][RX-C]   0.00-20.00  sec  1.81 GBytes   777 Mbits/sec    receiver
      
      With preferring port 6:
      
      [ ID][Role] Interval           Transfer     Bitrate         Retr
      [  5][TX-C]   0.00-20.00  sec  1.99 GBytes   856 Mbits/sec  273    sender
      [  5][TX-C]   0.00-20.00  sec  1.99 GBytes   855 Mbits/sec    receiver
      [  7][RX-C]   0.00-20.00  sec  1.72 GBytes   737 Mbits/sec   15    sender
      [  7][RX-C]   0.00-20.00  sec  1.71 GBytes   736 Mbits/sec    receiver
      
      Using one port for WAN and the other ports for LAN is a very popular use
      case which is what this test emulates.
      
      As such, this change proposes that we retroactively modify stable kernels
      (which don't support the modification of the CPU port assignments, so as to
      let user space fix the problem and restore the throughput) to keep the
      mt7530 driver preferring port 6 even with device trees where the hardware
      is more fully described.
      
      Fixes: c288575f
      
       ("net: dsa: mt7530: Add the support of MT7531 switch")
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9c2f69c
    • Arınç ÜNAL's avatar
      net: dsa: mt7530: set all CPU ports in MT7531_CPU_PMAP · 013c787d
      Arınç ÜNAL authored
      commit ff221029
      
       upstream.
      
      MT7531_CPU_PMAP represents the destination port mask for trapped-to-CPU
      frames (further restricted by PCR_MATRIX).
      
      Currently the driver sets the first CPU port as the single port in this bit
      mask, which works fine regardless of whether the device tree defines port
      5, 6 or 5+6 as CPU ports. This is because the logic coincides with DSA's
      logic of picking the first CPU port as the CPU port that all user ports are
      affine to, by default.
      
      An upcoming change would like to influence DSA's selection of the default
      CPU port to no longer be the first one, and in that case, this logic needs
      adaptation.
      
      Since there is no observed leakage or duplication of frames if all CPU
      ports are defined in this bit mask, simply include them all.
      
      Suggested-by: default avatarRussell King (Oracle) <linux@armlinux.org.uk>
      Suggested-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      013c787d
    • Jeongjun Park's avatar
      nilfs2: fix OOB in nilfs_set_de_type · 897ac530
      Jeongjun Park authored
      commit c4a7dc95 upstream.
      
      The size of the nilfs_type_by_mode array in the fs/nilfs2/dir.c file is
      defined as "S_IFMT >> S_SHIFT", but the nilfs_set_de_type() function,
      which uses this array, specifies the index to read from the array in the
      same way as "(mode & S_IFMT) >> S_SHIFT".
      
      static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode
       *inode)
      {
      	umode_t mode = inode->i_mode;
      
      	de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; // oob
      }
      
      However, when the index is determined this way, an out-of-bounds (OOB)
      error occurs by referring to an index that is 1 larger than the array size
      when the condition "mode & S_IFMT == S_IFMT" is satisfied.  Therefore, a
      patch to resize the nilfs_type_by_mode array should be applied to prevent
      OOB errors.
      
      Link: https://lkml.kernel.org/r/20240415182048.7144-1-konishi.ryusuke@gmail.com
      
      
      Reported-by: default avatar <syzbot+2e22057de05b9f3b30d8@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=2e22057de05b9f3b30d8
      Fixes: 2ba466d7
      
       ("nilfs2: directory entry operations")
      Signed-off-by: default avatarJeongjun Park <aha310510@gmail.com>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      897ac530
    • Qiang Zhang's avatar
      bootconfig: use memblock_free_late to free xbc memory to buddy · 1e7feb31
      Qiang Zhang authored
      commit 89f9a1e8 upstream.
      
      On the time to free xbc memory in xbc_exit(), memblock may has handed
      over memory to buddy allocator. So it doesn't make sense to free memory
      back to memblock. memblock_free() called by xbc_exit() even causes UAF bugs
      on architectures with CONFIG_ARCH_KEEP_MEMBLOCK disabled like x86.
      Following KASAN logs shows this case.
      
      This patch fixes the xbc memory free problem by calling memblock_free()
      in early xbc init error rewind path and calling memblock_free_late() in
      xbc exit path to free memory to buddy allocator.
      
      [    9.410890] ==================================================================
      [    9.418962] BUG: KASAN: use-after-free in memblock_isolate_range+0x12d/0x260
      [    9.426850] Read of size 8 at addr ffff88845dd30000 by task swapper/0/1
      
      [    9.435901] CPU: 9 PID: 1 Comm: swapper/0 Tainted: G     U             6.9.0-rc3-00208-g586b5dfb51b9 #5
      [    9.446403] Hardware name: Intel Corporation RPLP LP5 (CPU:RaptorLake)/RPLP LP5 (ID:13), BIOS IRPPN02.01.01.00.00.19.015.D-00000000 Dec 28 2023
      [    9.460789] Call Trace:
      [    9.463518]  <TASK>
      [    9.465859]  dump_stack_lvl+0x53/0x70
      [    9.469949]  print_report+0xce/0x610
      [    9.473944]  ? __virt_addr_valid+0xf5/0x1b0
      [    9.478619]  ? memblock_isolate_range+0x12d/0x260
      [    9.483877]  kasan_report+0xc6/0x100
      [    9.487870]  ? memblock_isolate_range+0x12d/0x260
      [    9.493125]  memblock_isolate_range+0x12d/0x260
      [    9.498187]  memblock_phys_free+0xb4/0x160
      [    9.502762]  ? __pfx_memblock_phys_free+0x10/0x10
      [    9.508021]  ? mutex_unlock+0x7e/0xd0
      [    9.512111]  ? __pfx_mutex_unlock+0x10/0x10
      [    9.516786]  ? kernel_init_freeable+0x2d4/0x430
      [    9.521850]  ? __pfx_kernel_init+0x10/0x10
      [    9.526426]  xbc_exit+0x17/0x70
      [    9.529935]  kernel_init+0x38/0x1e0
      [    9.533829]  ? _raw_spin_unlock_irq+0xd/0x30
      [    9.538601]  ret_from_fork+0x2c/0x50
      [    9.542596]  ? __pfx_kernel_init+0x10/0x10
      [    9.547170]  ret_from_fork_asm+0x1a/0x30
      [    9.551552]  </TASK>
      
      [    9.555649] The buggy address belongs to the physical page:
      [    9.561875] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x45dd30
      [    9.570821] flags: 0x200000000000000(node=0|zone=2)
      [    9.576271] page_type: 0xffffffff()
      [    9.580167] raw: 0200000000000000 ffffea0011774c48 ffffea0012ba1848 0000000000000000
      [    9.588823] raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
      [    9.597476] page dumped because: kasan: bad access detected
      
      [    9.605362] Memory state around the buggy address:
      [    9.610714]  ffff88845dd2ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    9.618786]  ffff88845dd2ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    9.626857] >ffff88845dd30000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      [    9.634930]                    ^
      [    9.638534]  ffff88845dd30080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      [    9.646605]  ffff88845dd30100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      [    9.654675] ==================================================================
      
      Link: https://lore.kernel.org/all/20240414114944.1012359-1-qiang4.zhang@linux.intel.com/
      
      Fixes: 40caa127
      
       ("init: bootconfig: Remove all bootconfig data when the init memory is removed")
      Cc: Stable@vger.kernel.org
      Signed-off-by: default avatarQiang Zhang <qiang4.zhang@intel.com>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e7feb31
    • Dave Airlie's avatar
      nouveau: fix instmem race condition around ptr stores · ad74d208
      Dave Airlie authored
      commit fff1386c upstream.
      
      Running a lot of VK CTS in parallel against nouveau, once every
      few hours you might see something like this crash.
      
      BUG: kernel NULL pointer dereference, address: 0000000000000008
      PGD 8000000114e6e067 P4D 8000000114e6e067 PUD 109046067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP PTI
      CPU: 7 PID: 53891 Comm: deqp-vk Not tainted 6.8.0-rc6+ #27
      Hardware name: Gigabyte Technology Co., Ltd. Z390 I AORUS PRO WIFI/Z390 I AORUS PRO WIFI-CF, BIOS F8 11/05/2021
      RIP: 0010:gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
      Code: c7 48 01 c8 49 89 45 58 85 d2 0f 84 95 00 00 00 41 0f b7 46 12 49 8b 7e 08 89 da 42 8d 2c f8 48 8b 47 08 41 83 c7 01 48 89 ee <48> 8b 40 08 ff d0 0f 1f 00 49 8b 7e 08 48 89 d9 48 8d 75 04 48 c1
      RSP: 0000:ffffac20c5857838 EFLAGS: 00010202
      RAX: 0000000000000000 RBX: 00000000004d8001 RCX: 0000000000000001
      RDX: 00000000004d8001 RSI: 00000000000006d8 RDI: ffffa07afe332180
      RBP: 00000000000006d8 R08: ffffac20c5857ad0 R09: 0000000000ffff10
      R10: 0000000000000001 R11: ffffa07af27e2de0 R12: 000000000000001c
      R13: ffffac20c5857ad0 R14: ffffa07a96fe9040 R15: 000000000000001c
      FS:  00007fe395eed7c0(0000) GS:ffffa07e2c980000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000008 CR3: 000000011febe001 CR4: 00000000003706f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      
      ...
      
       ? gp100_vmm_pgt_mem+0xe3/0x180 [nouveau]
       ? gp100_vmm_pgt_mem+0x37/0x180 [nouveau]
       nvkm_vmm_iter+0x351/0xa20 [nouveau]
       ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
       ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
       ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
       ? __lock_acquire+0x3ed/0x2170
       ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
       nvkm_vmm_ptes_get_map+0xc2/0x100 [nouveau]
       ? __pfx_nvkm_vmm_ref_ptes+0x10/0x10 [nouveau]
       ? __pfx_gp100_vmm_pgt_mem+0x10/0x10 [nouveau]
       nvkm_vmm_map_locked+0x224/0x3a0 [nouveau]
      
      Adding any sort of useful debug usually makes it go away, so I hand
      wrote the function in a line, and debugged the asm.
      
      Every so often pt->memory->ptrs is NULL. This ptrs ptr is set in
      the nv50_instobj_acquire called from nvkm_kmap.
      
      If Thread A and Thread B both get to nv50_instobj_acquire around
      the same time, and Thread A hits the refcount_set line, and in
      lockstep thread B succeeds at refcount_inc_not_zero, there is a
      chance the ptrs value won't have been stored since refcount_set
      is unordered. Force a memory barrier here, I picked smp_mb, since
      we want it on all CPUs and it's write followed by a read.
      
      v2: use paired smp_rmb/smp_wmb.
      
      Cc: <stable@vger.kernel.org>
      Fixes: be55287a
      
       ("drm/nouveau/imem/nv50: embed nvkm_instobj directly into nv04_instobj")
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240411011510.2546857-1-airlied@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad74d208
    • Zack Rusin's avatar
      drm/vmwgfx: Fix crtc's atomic check conditional · bcff1ed2
      Zack Rusin authored
      commit a60ccade
      
       upstream.
      
      The conditional was supposed to prevent enabling of a crtc state
      without a set primary plane. Accidently it also prevented disabling
      crtc state with a set primary plane. Neither is correct.
      
      Fix the conditional and just driver-warn when a crtc state has been
      enabled without a primary plane which will help debug broken userspace.
      
      Fixes IGT's kms_atomic_interruptible and kms_atomic_transition tests.
      
      Signed-off-by: default avatarZack Rusin <zack.rusin@broadcom.com>
      Fixes: 06ec4190
      
       ("drm/vmwgfx: Add and connect CRTC helper functions")
      Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v4.12+
      Reviewed-by: default avatarIan Forbes <ian.forbes@broadcom.com>
      Reviewed-by: default avatarMartin Krastev <martin.krastev@broadcom.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240412025511.78553-5-zack.rusin@broadcom.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bcff1ed2
    • Zack Rusin's avatar
      drm/vmwgfx: Sort primary plane formats by order of preference · 8f79b42d
      Zack Rusin authored
      commit d4c972bf
      
       upstream.
      
      The table of primary plane formats wasn't sorted at all, leading to
      applications picking our least desirable formats by defaults.
      
      Sort the primary plane formats according to our order of preference.
      
      Nice side-effect of this change is that it makes IGT's kms_atomic
      plane-invalid-params pass because the test picks the first format
      which for vmwgfx was DRM_FORMAT_XRGB1555 and uses fb's with odd sizes
      which make Pixman, which IGT depends on assert due to the fact that our
      16bpp formats aren't 32 bit aligned like Pixman requires all formats
      to be.
      
      Signed-off-by: default avatarZack Rusin <zack.rusin@broadcom.com>
      Fixes: 36cc79bc
      
       ("drm/vmwgfx: Add universal plane support")
      Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v4.12+
      Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240412025511.78553-6-zack.rusin@broadcom.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f79b42d
    • xinhui pan's avatar
      drm/amdgpu: validate the parameters of bo mapping operations more clearly · 212e3bac
      xinhui pan authored
      commit 6fef2d4c upstream.
      
      Verify the parameters of
      amdgpu_vm_bo_(map/replace_map/clearing_mappings) in one common place.
      
      Fixes: dc54d3d1
      
       ("drm/amdgpu: implement AMDGPU_VA_OP_CLEAR v2")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarVlad Stolyarov <hexed@google.com>
      Suggested-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarxinhui pan <xinhui.pan@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      212e3bac
    • Miaohe Lin's avatar
      mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled · 5ef7ba27
      Miaohe Lin authored
      commit 1983184c upstream.
      
      When I did hard offline test with hugetlb pages, below deadlock occurs:
      
      ======================================================
      WARNING: possible circular locking dependency detected
      6.8.0-11409-gf6cef5f8c37f #1 Not tainted
      ------------------------------------------------------
      bash/46904 is trying to acquire lock:
      ffffffffabe68910 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_slow_dec+0x16/0x60
      
      but task is already holding lock:
      ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #1 (pcp_batch_high_lock){+.+.}-{3:3}:
             __mutex_lock+0x6c/0x770
             page_alloc_cpu_online+0x3c/0x70
             cpuhp_invoke_callback+0x397/0x5f0
             __cpuhp_invoke_callback_range+0x71/0xe0
             _cpu_up+0xeb/0x210
             cpu_up+0x91/0xe0
             cpuhp_bringup_mask+0x49/0xb0
             bringup_nonboot_cpus+0xb7/0xe0
             smp_init+0x25/0xa0
             kernel_init_freeable+0x15f/0x3e0
             kernel_init+0x15/0x1b0
             ret_from_fork+0x2f/0x50
             ret_from_fork_asm+0x1a/0x30
      
      -> #0 (cpu_hotplug_lock){++++}-{0:0}:
             __lock_acquire+0x1298/0x1cd0
             lock_acquire+0xc0/0x2b0
             cpus_read_lock+0x2a/0xc0
             static_key_slow_dec+0x16/0x60
             __hugetlb_vmemmap_restore_folio+0x1b9/0x200
             dissolve_free_huge_page+0x211/0x260
             __page_handle_poison+0x45/0xc0
             memory_failure+0x65e/0xc70
             hard_offline_page_store+0x55/0xa0
             kernfs_fop_write_iter+0x12c/0x1d0
             vfs_write+0x387/0x550
             ksys_write+0x64/0xe0
             do_syscall_64+0xca/0x1e0
             entry_SYSCALL_64_after_hwframe+0x6d/0x75
      
      other info that might help us debug this:
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(pcp_batch_high_lock);
                                     lock(cpu_hotplug_lock);
                                     lock(pcp_batch_high_lock);
        rlock(cpu_hotplug_lock);
      
       *** DEADLOCK ***
      
      5 locks held by bash/46904:
       #0: ffff98f6c3bb23f0 (sb_writers#5){.+.+}-{0:0}, at: ksys_write+0x64/0xe0
       #1: ffff98f6c328e488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0xf8/0x1d0
       #2: ffff98ef83b31890 (kn->active#113){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x100/0x1d0
       #3: ffffffffabf9db48 (mf_mutex){+.+.}-{3:3}, at: memory_failure+0x44/0xc70
       #4: ffffffffabf92ea8 (pcp_batch_high_lock){+.+.}-{3:3}, at: zone_pcp_disable+0x16/0x40
      
      stack backtrace:
      CPU: 10 PID: 46904 Comm: bash Kdump: loaded Not tainted 6.8.0-11409-gf6cef5f8c37f #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0x68/0xa0
       check_noncircular+0x129/0x140
       __lock_acquire+0x1298/0x1cd0
       lock_acquire+0xc0/0x2b0
       cpus_read_lock+0x2a/0xc0
       static_key_slow_dec+0x16/0x60
       __hugetlb_vmemmap_restore_folio+0x1b9/0x200
       dissolve_free_huge_page+0x211/0x260
       __page_handle_poison+0x45/0xc0
       memory_failure+0x65e/0xc70
       hard_offline_page_store+0x55/0xa0
       kernfs_fop_write_iter+0x12c/0x1d0
       vfs_write+0x387/0x550
       ksys_write+0x64/0xe0
       do_syscall_64+0xca/0x1e0
       entry_SYSCALL_64_after_hwframe+0x6d/0x75
      RIP: 0033:0x7fc862314887
      Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
      RSP: 002b:00007fff19311268 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fc862314887
      RDX: 000000000000000c RSI: 000056405645fe10 RDI: 0000000000000001
      RBP: 000056405645fe10 R08: 00007fc8623d1460 R09: 000000007fffffff
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000c
      R13: 00007fc86241b780 R14: 00007fc862417600 R15: 00007fc862416a00
      
      In short, below scene breaks the lock dependency chain:
      
       memory_failure
        __page_handle_poison
         zone_pcp_disable -- lock(pcp_batch_high_lock)
         dissolve_free_huge_page
          __hugetlb_vmemmap_restore_folio
           static_key_slow_dec
            cpus_read_lock -- rlock(cpu_hotplug_lock)
      
      Fix this by calling drain_all_pages() instead.
      
      This issue won't occur until commit a6b40850 ("mm: hugetlb: replace
      hugetlb_free_vmemmap_enabled with a static_key").  As it introduced
      rlock(cpu_hotplug_lock) in dissolve_free_huge_page() code path while
      lock(pcp_batch_high_lock) is already in the __page_handle_poison().
      
      [linmiaohe@huawei.com: extend comment per Oscar]
      [akpm@linux-foundation.org: reflow block comment]
      Link: https://lkml.kernel.org/r/20240407085456.2798193-1-linmiaohe@huawei.com
      Fixes: a6b40850
      
       ("mm: hugetlb: replace hugetlb_free_vmemmap_enabled with a static_key")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Acked-by: default avatarOscar Salvador <osalvador@suse.de>
      Reviewed-by: default avatarJane Chu <jane.chu@oracle.com>
      Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ef7ba27
    • Yuntao Wang's avatar
      init/main.c: Fix potential static_command_line memory overflow · 76c2f4d4
      Yuntao Wang authored
      commit 46dad3c1 upstream.
      
      We allocate memory of size 'xlen + strlen(boot_command_line) + 1' for
      static_command_line, but the strings copied into static_command_line are
      extra_command_line and command_line, rather than extra_command_line and
      boot_command_line.
      
      When strlen(command_line) > strlen(boot_command_line), static_command_line
      will overflow.
      
      This patch just recovers strlen(command_line) which was miss-consolidated
      with strlen(boot_command_line) in the commit f5c7310a ("init/main: add
      checks for the return value of memblock_alloc*()")
      
      Link: https://lore.kernel.org/all/20240412081733.35925-2-ytcoode@gmail.com/
      
      Fixes: f5c7310a
      
       ("init/main: add checks for the return value of memblock_alloc*()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarYuntao Wang <ytcoode@gmail.com>
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76c2f4d4
    • Yaxiong Tian's avatar
      arm64: hibernate: Fix level3 translation fault in swsusp_save() · f7e71a7c
      Yaxiong Tian authored
      commit 50449ca6 upstream.
      
      On arm64 machines, swsusp_save() faults if it attempts to access
      MEMBLOCK_NOMAP memory ranges. This can be reproduced in QEMU using UEFI
      when booting with rodata=off debug_pagealloc=off and CONFIG_KFENCE=n:
      
        Unable to handle kernel paging request at virtual address ffffff8000000000
        Mem abort info:
          ESR = 0x0000000096000007
          EC = 0x25: DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
          FSC = 0x07: level 3 translation fault
        Data abort info:
          ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
          CM = 0, WnR = 0, TnD = 0, TagAccess = 0
          GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
        swapper pgtable: 4k pages, 39-bit VAs, pgdp=00000000eeb0b000
        [ffffff8000000000] pgd=180000217fff9803, p4d=180000217fff9803, pud=180000217fff9803, pmd=180000217fff8803, pte=0000000000000000
        Internal error: Oops: 0000000096000007 [#1] SMP
        Internal error: Oops: 0000000096000007 [#1] SMP
        Modules linked in: xt_multiport ipt_REJECT nf_reject_ipv4 xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_filter bpfilter rfkill at803x snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg dwmac_generic stmmac_platform snd_hda_codec stmmac joydev pcs_xpcs snd_hda_core phylink ppdev lp parport ramoops reed_solomon ip_tables x_tables nls_iso8859_1 vfat multipath linear amdgpu amdxcp drm_exec gpu_sched drm_buddy hid_generic usbhid hid radeon video drm_suballoc_helper drm_ttm_helper ttm i2c_algo_bit drm_display_helper cec drm_kms_helper drm
        CPU: 0 PID: 3663 Comm: systemd-sleep Not tainted 6.6.2+ #76
        Source Version: 4e22ed63a0a48e7a7cff9b98b7806d8d4add7dc0
        Hardware name: Greatwall GW-XXXXXX-XXX/GW-XXXXXX-XXX, BIOS KunLun BIOS V4.0 01/19/2021
        pstate: 600003c5 (nZCv DAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
        pc : swsusp_save+0x280/0x538
        lr : swsusp_save+0x280/0x538
        sp : ffffffa034a3fa40
        x29: ffffffa034a3fa40 x28: ffffff8000001000 x27: 0000000000000000
        x26: ffffff8001400000 x25: ffffffc08113e248 x24: 0000000000000000
        x23: 0000000000080000 x22: ffffffc08113e280 x21: 00000000000c69f2
        x20: ffffff8000000000 x19: ffffffc081ae2500 x18: 0000000000000000
        x17: 6666662074736420 x16: 3030303030303030 x15: 3038666666666666
        x14: 0000000000000b69 x13: ffffff9f89088530 x12: 00000000ffffffea
        x11: 00000000ffff7fff x10: 00000000ffff7fff x9 : ffffffc08193f0d0
        x8 : 00000000000bffe8 x7 : c0000000ffff7fff x6 : 0000000000000001
        x5 : ffffffa0fff09dc8 x4 : 0000000000000000 x3 : 0000000000000027
        x2 : 0000000000000000 x1 : 0000000000000000 x0 : 000000000000004e
        Call trace:
         swsusp_save+0x280/0x538
         swsusp_arch_suspend+0x148/0x190
         hibernation_snapshot+0x240/0x39c
         hibernate+0xc4/0x378
         state_store+0xf0/0x10c
         kobj_attr_store+0x14/0x24
      
      The reason is swsusp_save() -> copy_data_pages() -> page_is_saveable()
      -> kernel_page_present() assuming that a page is always present when
      can_set_direct_map() is false (all of rodata_full,
      debug_pagealloc_enabled() and arm64_kfence_can_set_direct_map() false),
      irrespective of the MEMBLOCK_NOMAP ranges. Such MEMBLOCK_NOMAP regions
      should not be saved during hibernation.
      
      This problem was introduced by changes to the pfn_valid() logic in
      commit a7d9f306 ("arm64: drop pfn_valid_within() and simplify
      pfn_valid()").
      
      Similar to other architectures, drop the !can_set_direct_map() check in
      kernel_page_present() so that page_is_savable() skips such pages.
      
      Fixes: a7d9f306
      
       ("arm64: drop pfn_valid_within() and simplify pfn_valid()")
      Cc: <stable@vger.kernel.org> # 5.14.x
      Suggested-by: default avatarMike Rapoport <rppt@kernel.org>
      Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Co-developed-by: default avatarxiongxin <xiongxin@kylinos.cn>
      Signed-off-by: default avatarxiongxin <xiongxin@kylinos.cn>
      Signed-off-by: default avatarYaxiong Tian <tianyaxiong@kylinos.cn>
      Acked-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Link: https://lore.kernel.org/r/20240417025248.386622-1-tianyaxiong@kylinos.cn
      
      
      [catalin.marinas@arm.com: rework commit message]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7e71a7c
    • Sandipan Das's avatar
      KVM: x86/pmu: Do not mask LVTPC when handling a PMI on AMD platforms · e09465ae
      Sandipan Das authored
      commit 49ff3b4a upstream.
      
      On AMD and Hygon platforms, the local APIC does not automatically set
      the mask bit of the LVTPC register when handling a PMI and there is
      no need to clear it in the kernel's PMI handler.
      
      For guests, the mask bit is currently set by kvm_apic_local_deliver()
      and unless it is cleared by the guest kernel's PMI handler, PMIs stop
      arriving and break use-cases like sampling with perf record.
      
      This does not affect non-PerfMonV2 guests because PMIs are handled in
      the guest kernel by x86_pmu_handle_irq() which always clears the LVTPC
      mask bit irrespective of the vendor.
      
      Before:
      
        $ perf record -e cycles:u true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.001 MB perf.data (1 samples) ]
      
      After:
      
        $ perf record -e cycles:u true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.002 MB perf.data (19 samples) ]
      
      Fixes: a16eb25b
      
       ("KVM: x86: Mask LVTPC when handling a PMI")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSandipan Das <sandipan.das@amd.com>
      Reviewed-by: default avatarJim Mattson <jmattson@google.com>
      [sean: use is_intel_compatible instead of !is_amd_or_hygon()]
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-ID: <20240405235603.1173076-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e09465ae
    • Sean Christopherson's avatar
      KVM: x86/pmu: Disable support for adaptive PEBS · 0fb74c00
      Sean Christopherson authored
      commit 9e985cbf upstream.
      
      Drop support for virtualizing adaptive PEBS, as KVM's implementation is
      architecturally broken without an obvious/easy path forward, and because
      exposing adaptive PEBS can leak host LBRs to the guest, i.e. can leak
      host kernel addresses to the guest.
      
      Bug #1 is that KVM doesn't account for the upper 32 bits of
      IA32_FIXED_CTR_CTRL when (re)programming fixed counters, e.g
      fixed_ctrl_field() drops the upper bits, reprogram_fixed_counters()
      stores local variables as u8s and truncates the upper bits too, etc.
      
      Bug #2 is that, because KVM _always_ sets precise_ip to a non-zero value
      for PEBS events, perf will _always_ generate an adaptive record, even if
      the guest requested a basic record.  Note, KVM will also enable adaptive
      PEBS in individual *counter*, even if adaptive PEBS isn't exposed to the
      guest, but this is benign as MSR_PEBS_DATA_CFG is guaranteed to be zero,
      i.e. the guest will only ever see Basic records.
      
      Bug #3 is in perf.  intel_pmu_disable_fixed() doesn't clear the upper
      bits either, i.e. leaves ICL_FIXED_0_ADAPTIVE set, and
      intel_pmu_enable_fixed() effectively doesn't clear ICL_FIXED_0_ADAPTIVE
      either.  I.e. perf _always_ enables ADAPTIVE counters, regardless of what
      KVM requests.
      
      Bug #4 is that adaptive PEBS *might* effectively bypass event filters set
      by the host, as "Updated Memory Access Info Group" records information
      that might be disallowed by userspace via KVM_SET_PMU_EVENT_FILTER.
      
      Bug #5 is that KVM doesn't ensure LBR MSRs hold guest values (or at least
      zeros) when entering a vCPU with adaptive PEBS, which allows the guest
      to read host LBRs, i.e. host RIPs/addresses, by enabling "LBR Entries"
      records.
      
      Disable adaptive PEBS support as an immediate fix due to the severity of
      the LBR leak in particular, and because fixing all of the bugs will be
      non-trivial, e.g. not suitable for backporting to stable kernels.
      
      Note!  This will break live migration, but trying to make KVM play nice
      with live migration would be quite complicated, wouldn't be guaranteed to
      work (i.e. KVM might still kill/confuse the guest), and it's not clear
      that there are any publicly available VMMs that support adaptive PEBS,
      let alone live migrate VMs that support adaptive PEBS, e.g. QEMU doesn't
      support PEBS in any capacity.
      
      Link: https://lore.kernel.org/all/20240306230153.786365-1-seanjc@google.com
      Link: https://lore.kernel.org/all/ZeepGjHCeSfadANM@google.com
      Fixes: c59a1f10
      
       ("KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS")
      Cc: stable@vger.kernel.org
      Cc: Like Xu <like.xu.linux@gmail.com>
      Cc: Mingwei Zhang <mizhang@google.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Zhang Xiong <xiong.y.zhang@intel.com>
      Cc: Lv Zhiyuan <zhiyuan.lv@intel.com>
      Cc: Dapeng Mi <dapeng1.mi@intel.com>
      Cc: Jim Mattson <jmattson@google.com>
      Acked-by: default avatarLike Xu <likexu@tencent.com>
      Link: https://lore.kernel.org/r/20240307005833.827147-1-seanjc@google.com
      
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0fb74c00
    • Sean Christopherson's avatar
      KVM: x86: Snapshot if a vCPU's vendor model is AMD vs. Intel compatible · e487b8ec
      Sean Christopherson authored
      commit fd706c9b
      
       upstream.
      
      Add kvm_vcpu_arch.is_amd_compatible to cache if a vCPU's vendor model is
      compatible with AMD, i.e. if the vCPU vendor is AMD or Hygon, along with
      helpers to check if a vCPU is compatible AMD vs. Intel.  To handle Intel
      vs. AMD behavior related to masking the LVTPC entry, KVM will need to
      check for vendor compatibility on every PMI injection, i.e. querying for
      AMD will soon be a moderately hot path.
      
      Note!  This subtly (or maybe not-so-subtly) makes "Intel compatible" KVM's
      default behavior, both if userspace omits (or never sets) CPUID 0x0 and if
      userspace sets a completely unknown vendor.  One could argue that KVM
      should treat such vCPUs as not being compatible with Intel *or* AMD, but
      that would add useless complexity to KVM.
      
      KVM needs to do *something* in the face of vendor specific behavior, and
      so unless KVM conjured up a magic third option, choosing to treat unknown
      vendors as neither Intel nor AMD means that checks on AMD compatibility
      would yield Intel behavior, and checks for Intel compatibility would yield
      AMD behavior.  And that's far worse as it would effectively yield random
      behavior depending on whether KVM checked for AMD vs. Intel vs. !AMD vs.
      !Intel.  And practically speaking, all x86 CPUs follow either Intel or AMD
      architecture, i.e. "supporting" an unknown third architecture adds no
      value.
      
      Deliberately don't convert any of the existing guest_cpuid_is_intel()
      checks, as the Intel side of things is messier due to some flows explicitly
      checking for exactly vendor==Intel, versus some flows assuming anything
      that isn't "AMD compatible" gets Intel behavior.  The Intel code will be
      cleaned up in the future.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-ID: <20240405235603.1173076-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e487b8ec
    • Alan Stern's avatar
      fs: sysfs: Fix reference leak in sysfs_break_active_protection() · 5d43e072
      Alan Stern authored
      commit a90bca22
      
       upstream.
      
      The sysfs_break_active_protection() routine has an obvious reference
      leak in its error path.  If the call to kernfs_find_and_get() fails then
      kn will be NULL, so the companion sysfs_unbreak_active_protection()
      routine won't get called (and would only cause an access violation by
      trying to dereference kn->parent if it was called).  As a result, the
      reference to kobj acquired at the start of the function will never be
      released.
      
      Fix the leak by adding an explicit kobject_put() call when kn is NULL.
      
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Fixes: 2afc9166
      
       ("scsi: sysfs: Introduce sysfs_{un,}break_active_protection()")
      Cc: Bart Van Assche <bvanassche@acm.org>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Link: https://lore.kernel.org/r/8a4d3f0f-c5e3-4b70-a188-0ca433f9e6f9@rowland.harvard.edu
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d43e072
    • Samuel Thibault's avatar
      speakup: Avoid crash on very long word · 89af25bd
      Samuel Thibault authored
      commit c8d2f34e
      
       upstream.
      
      In case a console is set up really large and contains a really long word
      (> 256 characters), we have to stop before the length of the word buffer.
      
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Fixes: c6e3fd22 ("Staging: add speakup to the staging directory")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240323164843.1426997-1-samuel.thibault@ens-lyon.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89af25bd
    • Alexander Usyskin's avatar
      mei: me: disable RPL-S on SPS and IGN firmwares · 7c6f9414
      Alexander Usyskin authored
      commit 0dc04112 upstream.
      
      Extend the quirk to disable MEI interface on Intel PCH Ignition (IGN)
      and SPS firmwares for RPL-S devices. These firmwares do not support
      the MEI protocol.
      
      Fixes: 3ed8c7d3
      
       ("mei: me: add raptor lake point S DID")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Link: https://lore.kernel.org/r/20240312051958.118478-1-tomas.winkler@intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c6f9414
    • Norihiko Hama's avatar
      usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error · 0588bbbd
      Norihiko Hama authored
      commit 6334b8e4
      
       upstream.
      
      When ncm function is working and then stop usb0 interface for link down,
      eth_stop() is called. At this piont, accidentally if usb transport error
      should happen in usb_ep_enable(), 'in_ep' and/or 'out_ep' may not be enabled.
      
      After that, ncm_disable() is called to disable for ncm unbind
      but gether_disconnect() is never called since 'in_ep' is not enabled.
      
      As the result, ncm object is released in ncm unbind
      but 'dev->port_usb' associated to 'ncm->port' is not NULL.
      
      And when ncm bind again to recover netdev, ncm object is reallocated
      but usb0 interface is already associated to previous released ncm object.
      
      Therefore, once usb0 interface is up and eth_start_xmit() is called,
      released ncm object is dereferrenced and it might cause use-after-free memory.
      
      [function unlink via configfs]
        usb0: eth_stop dev->port_usb=ffffff9b179c3200
        --> error happens in usb_ep_enable().
        NCM: ncm_disable: ncm=ffffff9b179c3200
        --> no gether_disconnect() since ncm->port.in_ep->enabled is false.
        NCM: ncm_unbind: ncm unbind ncm=ffffff9b179c3200
        NCM: ncm_free: ncm free ncm=ffffff9b179c3200   <-- released ncm
      
      [function link via configfs]
        NCM: ncm_alloc: ncm alloc ncm=ffffff9ac4f8a000
        NCM: ncm_bind: ncm bind ncm=ffffff9ac4f8a000
        NCM: ncm_set_alt: ncm=ffffff9ac4f8a000 alt=0
        usb0: eth_open dev->port_usb=ffffff9b179c3200  <-- previous released ncm
        usb0: eth_start dev->port_usb=ffffff9b179c3200 <--
        eth_start_xmit()
        --> dev->wrap()
        Unable to handle kernel paging request at virtual address dead00000000014f
      
      This patch addresses the issue by checking if 'ncm->netdev' is not NULL at
      ncm_disable() to call gether_disconnect() to deassociate 'dev->port_usb'.
      It's more reasonable to check 'ncm->netdev' to call gether_connect/disconnect
      rather than check 'ncm->port.in_ep->enabled' since it might not be enabled
      but the gether connection might be established.
      
      Signed-off-by: default avatarNorihiko Hama <Norihiko.Hama@alpsalpine.com>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240327023550.51214-1-Norihiko.Hama@alpsalpine.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0588bbbd
    • Kai-Heng Feng's avatar
      usb: Disable USB3 LPM at shutdown · a676b17e
      Kai-Heng Feng authored
      commit d920a2ed
      
       upstream.
      
      SanDisks USB3 storage may disapper after system reboot:
      
      usb usb2-port3: link state change
      xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
      usb usb2-port3: do warm reset, port only
      xhci_hcd 0000:00:14.0: xhci_hub_status_data: stopping usb2 port polling
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2b0, return 0x2b0
      usb usb2-port3: not warm reset yet, waiting 50ms
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2f0, return 0x2f0
      usb usb2-port3: not warm reset yet, waiting 200ms
      ...
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x6802c0, return 0x7002c0
      usb usb2-port3: not warm reset yet, waiting 200ms
      xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x4802c0
      xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x4002c0
      xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x2c0
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x2c0, return 0x2c0
      usb usb2-port3: not enabled, trying warm reset again...
      
      This is due to the USB device still cause port change event after xHCI is
      shuted down:
      
      xhci_hcd 0000:38:00.0: // Setting command ring address to 0xffffe001
      xhci_hcd 0000:38:00.0: xhci_resume: starting usb3 port polling.
      xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb4 port polling
      xhci_hcd 0000:38:00.0: xhci_hub_status_data: stopping usb3 port polling
      xhci_hcd 0000:38:00.0: hcd_pci_runtime_resume: 0
      xhci_hcd 0000:38:00.0: xhci_shutdown: stopping usb3 port polling.
      xhci_hcd 0000:38:00.0: // Halt the HC
      xhci_hcd 0000:38:00.0: xhci_shutdown completed - status = 1
      xhci_hcd 0000:00:14.0: xhci_shutdown: stopping usb1 port polling.
      xhci_hcd 0000:00:14.0: // Halt the HC
      xhci_hcd 0000:00:14.0: xhci_shutdown completed - status = 1
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
      xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1311
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x201203, return 0x100203
      xhci_hcd 0000:00:14.0: clear port3 reset change, portsc: 0x1203
      xhci_hcd 0000:00:14.0: clear port3 warm(BH) reset change, portsc: 0x1203
      xhci_hcd 0000:00:14.0: clear port3 link state change, portsc: 0x1203
      xhci_hcd 0000:00:14.0: clear port3 connect change, portsc: 0x1203
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1203, return 0x203
      usb 2-3: device not accepting address 2, error -108
      xhci_hcd 0000:00:14.0: xHCI dying or halted, can't queue_command
      xhci_hcd 0000:00:14.0: Set port 2-3 link state, portsc: 0x1203, write 0x11261
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x1263, return 0x263
      xhci_hcd 0000:00:14.0: set port reset, actual port 2-3 status  = 0x1271
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12b1, return 0x2b1
      usb usb2-port3: not reset yet, waiting 60ms
      ACPI: PM: Preparing to enter system sleep state S5
      xhci_hcd 0000:00:14.0: Get port status 2-3 read: 0x12f1, return 0x2f1
      usb usb2-port3: not reset yet, waiting 200ms
      reboot: Restarting system
      
      The port change event is caused by LPM transition, so disabling LPM at shutdown
      to make sure the device is in U0 for warmboot.
      
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240305065140.66801-1-kai.heng.feng@canonical.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a676b17e
    • Minas Harutyunyan's avatar
    • Greg Kroah-Hartman's avatar
      Revert "usb: cdc-wdm: close race between read and workqueue" · 8672ad66
      Greg Kroah-Hartman authored
      commit 1607830d upstream.
      
      This reverts commit 339f8361.
      
      It has been found to cause problems in a number of Chromebook devices,
      so revert the change until it can be brought back in a safe way.
      
      Link: https://lore.kernel.org/r/385a3519-b45d-48c5-a6fd-a3fdb6bec92f@chromium.org
      
      
      Reported-by: default avatar: Aleksander Morgado <aleksandermj@chromium.org>
      Fixes: 339f8361
      
       ("usb: cdc-wdm: close race between read and workqueue")
      Cc: stable <stable@kernel.org>
      Cc: Oliver Neukum <oneukum@suse.com>
      Cc: Bjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8672ad66
    • Daniele Palmas's avatar
      USB: serial: option: add Telit FN920C04 rmnet compositions · 4ed7c772
      Daniele Palmas authored
      commit 582ee2f9
      
       upstream.
      
      Add the following Telit FN920C04 compositions:
      
      0x10a0: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
      T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  5 Spd=480  MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10a0 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN920
      S:  SerialNumber=92c4c4d8
      C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10a4: rmnet + tty (AT) + tty (AT) + tty (diag)
      T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10a4 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN920
      S:  SerialNumber=92c4c4d8
      C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10a9: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
      T:  Bus=03 Lev=01 Prnt=03 Port=06 Cnt=01 Dev#=  9 Spd=480  MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10a9 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN920
      S:  SerialNumber=92c4c4d8
      C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ed7c772
    • Vanillan Wang's avatar
      USB: serial: option: add Rolling RW101-GL and RW135-GL support · 19f98f21
      Vanillan Wang authored
      commit 311f97a4
      
       upstream.
      
      Update the USB serial option driver support for the Rolling
      LTE modules.
      
      - VID:PID 33f8:01a2, RW101-GL for laptop debug M.2 cards(with MBIM
      interface for /Linux/Chrome OS)
      0x01a2: mbim, diag, at, pipe
      - VID:PID 33f8:01a3, RW101-GL for laptop debug M.2 cards(with MBIM
      interface for /Linux/Chrome OS)
      0x01a3: mbim, pipe
      - VID:PID 33f8:01a4, RW101-GL for laptop debug M.2 cards(with MBIM
      interface for /Linux/Chrome OS)
      0x01a4: mbim, diag, at, pipe
      - VID:PID 33f8:0104, RW101-GL for laptop debug M.2 cards(with RMNET
      interface for /Linux/Chrome OS)
      0x0104: RMNET, diag, at, pipe
      - VID:PID 33f8:0115, RW135-GL for laptop debug M.2 cards(with MBIM
      interface for /Linux/Chrome OS)
      0x0115: MBIM, diag, at, pipe
      
      Here are the outputs of usb-devices:
      T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  5 Spd=480 MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=33f8 ProdID=01a2 Rev=05.15
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=Rolling Module
      S:  SerialNumber=12345678
      C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=33f8 ProdID=01a3 Rev=05.15
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=Rolling Module
      S:  SerialNumber=12345678
      C:  #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 17 Spd=480 MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=33f8 ProdID=01a4 Rev=05.15
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=Rolling Module
      S:  SerialNumber=12345678
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=33f8 ProdID=0104 Rev=05.04
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=Rolling Module
      S:  SerialNumber=ba2eb033
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=33f8 ProdID=0115 Rev=05.15
      S:  Manufacturer=Rolling Wireless S.a.r.l.
      S:  Product=Rolling Module
      S:  SerialNumber=12345678
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarVanillan Wang <vanillanwang@163.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19f98f21
    • Jerry Meng's avatar
      USB: serial: option: support Quectel EM060K sub-models · 25a299c5
      Jerry Meng authored
      commit c840244a
      
       upstream.
      
      EM060K_129, EM060K_12a, EM060K_12b and EM0060K_12c are EM060K's sub-models,
      having the same name "Quectel EM060K-GL" and the same interface layout.
      
      MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0129 Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM060K-GL
      S:  SerialNumber=f6fa08b6
      C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarJerry Meng <jerry-meng@foxmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25a299c5
    • Coia Prant's avatar
      USB: serial: option: add Lonsung U8300/U9300 product · 9eba0750
      Coia Prant authored
      commit cf16ffa1
      
       upstream.
      
      Update the USB serial option driver to support Longsung U8300/U9300.
      
      For U8300
      
      Interface 4 is used by for QMI interface in stock firmware of U8300, the
      router which uses U8300 modem.
      Interface 5 is used by for ADB interface in stock firmware of U8300, the
      router which uses U8300 modem.
      
      Interface mapping is:
      0: unknown (Debug), 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI, 5: ADB
      
      T:  Bus=05 Lev=01 Prnt=03 Port=02 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1c9e ProdID=9b05 Rev=03.18
      S:  Manufacturer=Android
      S:  Product=Android
      C:  #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      For U9300
      
      Interface 1 is used by for ADB interface in stock firmware of U9300, the
      router which uses U9300 modem.
      Interface 4 is used by for QMI interface in stock firmware of U9300, the
      router which uses U9300 modem.
      
      Interface mapping is:
      0: ADB, 1: AT (Modem), 2: AT, 3: PPP (NDIS / Pipe), 4: QMI
      
      Note: Interface 3 of some models of the U9300 series can send AT commands.
      
      T:  Bus=05 Lev=01 Prnt=05 Port=04 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1c9e ProdID=9b3c Rev=03.18
      S:  Manufacturer=Android
      S:  Product=Android
      C:  #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      
      Tested successfully using Modem Manager on U9300.
      Tested successfully AT commands using If=1, If=2 and If=3 on U9300.
      
      Signed-off-by: default avatarCoia Prant <coiaprant@gmail.com>
      Reviewed-by: default avatarLars Melin <larsm17@gmail.com>
      [ johan: drop product defines, trim commit message ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9eba0750
    • Chuanhong Guo's avatar
      USB: serial: option: add support for Fibocom FM650/FG650 · 3e34029b
      Chuanhong Guo authored
      commit fb1f4584
      
       upstream.
      
      Fibocom FM650/FG650 are 5G modems with ECM/NCM/RNDIS/MBIM modes.
      This patch adds support to all 4 modes.
      
      In all 4 modes, the first serial port is the AT console while the other
      3 appear to be diagnostic interfaces for dumping modem logs.
      
      usb-devices output for all modes:
      
      ECM:
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0a04 Rev=04.04
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FG650 Module
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=504mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      NCM:
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0a05 Rev=04.04
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FG650 Module
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm
      E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      RNDIS:
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0a06 Rev=04.04
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FG650 Module
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
      E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      MBIM:
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0a07 Rev=04.04
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=FG650 Module
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 6 Cfg#= 1 Atr=c0 MxPwr=504mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Signed-off-by: default avatarChuanhong Guo <gch981213@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e34029b
    • bolan wang's avatar
      USB: serial: option: add Fibocom FM135-GL variants · 3c4ba8a6
      bolan wang authored
      commit 356952b1
      
       upstream.
      
      Update the USB serial option driver support for the Fibocom
      FM135-GL LTE modules.
      - VID:PID 2cb7:0115, FM135-GL for laptop debug M.2 cards(with MBIM
      interface for /Linux/Chrome OS)
      
      0x0115: mbim, diag, at, pipe
      
      Here are the outputs of usb-devices:
      T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 16 Spd=480 MxCh= 0
      D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0115 Rev=05.15
      S:  Manufacturer=Fibocom Wireless Inc.
      S:  Product=Fibocom Module
      S:  SerialNumber=12345678
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarbolan wang <bolan.wang@fibocom.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c4ba8a6
    • Uwe Kleine-König's avatar
      serial: stm32: Reset .throttled state in .startup() · 282b223c
      Uwe Kleine-König authored
      commit ea2624b5 upstream.
      
      When an UART is opened that still has .throttled set from a previous
      open, the RX interrupt is enabled but the irq handler doesn't consider
      it. This easily results in a stuck irq with the effect to occupy the CPU
      in a tight loop.
      
      So reset the throttle state in .startup() to ensure that RX irqs are
      handled.
      
      Fixes: d1ec8a2e
      
       ("serial: stm32: update throttle and unthrottle ops for dma mode")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/a784f80d3414f7db723b2ec66efc56e1ad666cbf.1713344161.git.u.kleine-koenig@pengutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      282b223c
    • Uwe Kleine-König's avatar
      serial: stm32: Return IRQ_NONE in the ISR if no handling happend · 87d15af8
      Uwe Kleine-König authored
      commit 13c78532 upstream.
      
      If there is a stuck irq that the handler doesn't address, returning
      IRQ_HANDLED unconditionally makes it impossible for the irq core to
      detect the problem and disable the irq. So only return IRQ_HANDLED if
      an event was handled.
      
      A stuck irq is still problematic, but with this change at least it only
      makes the UART nonfunctional instead of occupying the (usually only) CPU
      by 100% and so stall the whole machine.
      
      Fixes: 48a6092f
      
       ("serial: stm32-usart: Add STM32 USART Driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/5f92603d0dfd8a5b8014b2b10a902d91e0bb881f.1713344161.git.u.kleine-koenig@pengutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87d15af8
    • Finn Thain's avatar
      serial/pmac_zilog: Remove flawed mitigation for rx irq flood · bbaafbb4
      Finn Thain authored
      commit 1be32264 upstream.
      
      The mitigation was intended to stop the irq completely. That may be
      better than a hard lock-up but it turns out that you get a crash anyway
      if you're using pmac_zilog as a serial console:
      
      ttyPZ0: pmz: rx irq flood !
      BUG: spinlock recursion on CPU#0, swapper/0
      
      That's because the pr_err() call in pmz_receive_chars() results in
      pmz_console_write() attempting to lock a spinlock already locked in
      pmz_interrupt(). With CONFIG_DEBUG_SPINLOCK=y, this produces a fatal
      BUG splat. The spinlock in question is the one in struct uart_port.
      
      Even when it's not fatal, the serial port rx function ceases to work.
      Also, the iteration limit doesn't play nicely with QEMU, as can be
      seen in the bug report linked below.
      
      A web search for other reports of the error message "pmz: rx irq flood"
      didn't produce anything. So I don't think this code is needed any more.
      Remove it.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: stable@kernel.org
      Cc: linux-m68k@lists.linux-m68k.org
      Link: https://github.com/vivier/qemu-m68k/issues/44
      Link: https://lore.kernel.org/all/1078874617.9746.36.camel@gaston/
      
      
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarFinn Thain <fthain@linux-m68k.org>
      Link: https://lore.kernel.org/r/e853cf2c762f23101cd2ddec0cc0c2be0e72685f.1712568223.git.fthain@linux-m68k.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bbaafbb4
    • Emil Kronborg's avatar
      serial: mxs-auart: add spinlock around changing cts state · 2c9b943e
      Emil Kronborg authored
      commit 54c4ec5f upstream.
      
      The uart_handle_cts_change() function in serial_core expects the caller
      to hold uport->lock. For example, I have seen the below kernel splat,
      when the Bluetooth driver is loaded on an i.MX28 board.
      
          [   85.119255] ------------[ cut here ]------------
          [   85.124413] WARNING: CPU: 0 PID: 27 at /drivers/tty/serial/serial_core.c:3453 uart_handle_cts_change+0xb4/0xec
          [   85.134694] Modules linked in: hci_uart bluetooth ecdh_generic ecc wlcore_sdio configfs
          [   85.143314] CPU: 0 PID: 27 Comm: kworker/u3:0 Not tainted 6.6.3-00021-gd62a2f068f92 #1
          [   85.151396] Hardware name: Freescale MXS (Device Tree)
          [   85.156679] Workqueue: hci0 hci_power_on [bluetooth]
          (...)
          [   85.191765]  uart_handle_cts_change from mxs_auart_irq_handle+0x380/0x3f4
          [   85.198787]  mxs_auart_irq_handle from __handle_irq_event_percpu+0x88/0x210
          (...)
      
      Cc: stable@vger.kernel.org
      Fixes: 4d90bb14
      
       ("serial: core: Document and assert lock requirements for irq helpers")
      Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
      Signed-off-by: default avatarEmil Kronborg <emil.kronborg@protonmail.com>
      Link: https://lore.kernel.org/r/20240320121530.11348-1-emil.kronborg@protonmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c9b943e
    • Nikita Zhandarovich's avatar
      comedi: vmk80xx: fix incomplete endpoint checking · ac882d6b
      Nikita Zhandarovich authored
      commit d1718530 upstream.
      
      While vmk80xx does have endpoint checking implemented, some things
      can fall through the cracks. Depending on the hardware model,
      URBs can have either bulk or interrupt type, and current version
      of vmk80xx_find_usb_endpoints() function does not take that fully
      into account. While this warning does not seem to be too harmful,
      at the very least it will crash systems with 'panic_on_warn' set on
      them.
      
      Fix the issue found by Syzkaller [1] by somewhat simplifying the
      endpoint checking process with usb_find_common_endpoints() and
      ensuring that only expected endpoint types are present.
      
      This patch has not been tested on real hardware.
      
      [1] Syzkaller report:
      usb 1-1: BOGUS urb xfer, pipe 1 != type 3
      WARNING: CPU: 0 PID: 781 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
      ...
      Call Trace:
       <TASK>
       usb_start_wait_urb+0x113/0x520 drivers/usb/core/message.c:59
       vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:227 [inline]
       vmk80xx_auto_attach+0xa1c/0x1a40 drivers/comedi/drivers/vmk80xx.c:818
       comedi_auto_config+0x238/0x380 drivers/comedi/drivers.c:1067
       usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399
      ...
      
      Similar issue also found by Syzkaller:
      Link: https://syzkaller.appspot.com/bug?extid=5205eb2f17de3e01946e
      
      
      
      Reported-and-tested-by: default avatar <syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com>
      Cc: stable <stable@kernel.org>
      Fixes: 49253d54
      
       ("staging: comedi: vmk80xx: factor out usb endpoint detection")
      Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: default avatarNikita Zhandarovich <n.zhandarovich@fintech.ru>
      Link: https://lore.kernel.org/r/20240408171633.31649-1-n.zhandarovich@fintech.ru
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac882d6b
    • Gil Fine's avatar
      thunderbolt: Fix wake configurations after device unplug · 9eae1fac
      Gil Fine authored
      commit c38fa07d
      
       upstream.
      
      Currently we don't configure correctly the wake events after unplug of device
      router. What can happen is that the downstream ports of host router will be
      configured to wake on: USB4-wake and wake-on-disconnect, but not on
      wake-on-connect. This may cause the later plugged device not to wake the
      domain and fail in enumeration. Fix this by clearing downstream port's "USB4
      Port is Configured" bit, after unplug of a device router.
      
      Signed-off-by: default avatarGil Fine <gil.fine@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9eae1fac
    • Gil Fine's avatar
      thunderbolt: Avoid notify PM core about runtime PM resume · 38e10c9f
      Gil Fine authored
      commit dcd12aca
      
       upstream.
      
      Currently we notify PM core about occurred wakes after any resume. This
      is not actually needed after resume from runtime suspend. Hence, notify
      PM core about occurred wakes only after resume from system sleep. Also,
      if the wake occurred in USB4 router upstream port, we don't notify the
      PM core about it since it is not actually needed and can cause
      unexpected autowake (e.g. if /sys/power/wakeup_count is used).
      
      While there add the missing kernel-doc for tb_switch_resume().
      
      Signed-off-by: default avatarGil Fine <gil.fine@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38e10c9f
    • Carlos Llamas's avatar
      binder: check offset alignment in binder_get_object() · a6d2a8b2
      Carlos Llamas authored
      commit aaef7382 upstream.
      
      Commit 6d98eb95 ("binder: avoid potential data leakage when copying
      txn") introduced changes to how binder objects are copied. In doing so,
      it unintentionally removed an offset alignment check done through calls
      to binder_alloc_copy_from_buffer() -> check_buffer().
      
      These calls were replaced in binder_get_object() with copy_from_user(),
      so now an explicit offset alignment check is needed here. This avoids
      later complications when unwinding the objects gets harder.
      
      It is worth noting this check existed prior to commit 7a67a393
      ("binder: add function to copy binder object from buffer"), likely
      removed due to redundancy at the time.
      
      Fixes: 6d98eb95
      
       ("binder: avoid potential data leakage when copying txn")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Acked-by: default avatarTodd Kjos <tkjos@google.com>
      Link: https://lore.kernel.org/r/20240330190115.1877819-1-cmllamas@google.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a6d2a8b2
    • Ai Chao's avatar
      ALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC · d0538057
      Ai Chao authored
      commit 7ee5faad
      
       upstream.
      
      The Haier Boyue G42 with ALC269VC cannot detect the MIC of headset,
      the line out and internal speaker until
      ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS quirk applied.
      
      Signed-off-by: default avatarAi Chao <aichao@kylinos.cn>
      Cc: <stable@vger.kernel.org>
      Message-ID: <20240419082159.476879-1-aichao@kylinos.cn>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0538057
    • Eric Biggers's avatar
      x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ · 943c3e45
      Eric Biggers authored
      [ Upstream commit 9543f6e2 ]
      
      Fix cpuid_deps[] to list the correct dependencies for GFNI, VAES, and
      VPCLMULQDQ.  These features don't depend on AVX512, and there exist CPUs
      that support these features but not AVX512.  GFNI actually doesn't even
      depend on AVX.
      
      This prevents GFNI from being unnecessarily disabled if AVX is disabled
      to mitigate the GDS vulnerability.
      
      This also prevents all three features from being unnecessarily disabled
      if AVX512VL (or its dependency AVX512F) were to be disabled, but it
      looks like there isn't any case where this happens anyway.
      
      Fixes: c128dbfa
      
       ("x86/cpufeatures: Enable new SSE/AVX/AVX512 CPU features")
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Acked-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Link: https://lore.kernel.org/r/20240417060434.47101-1-ebiggers@kernel.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      943c3e45
    • Josh Poimboeuf's avatar
      x86/bugs: Fix BHI retpoline check · d17075a9
      Josh Poimboeuf authored
      [ Upstream commit 69129794 ]
      
      Confusingly, X86_FEATURE_RETPOLINE doesn't mean retpolines are enabled,
      as it also includes the original "AMD retpoline" which isn't a retpoline
      at all.
      
      Also replace cpu_feature_enabled() with boot_cpu_has() because this is
      before alternatives are patched and cpu_feature_enabled()'s fallback
      path is slower than plain old boot_cpu_has().
      
      Fixes: ec9404e4
      
       ("x86/bhi: Add BHI mitigation knob")
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lore.kernel.org/r/ad3807424a3953f0323c011a643405619f2a4927.1712944776.git.jpoimboe@kernel.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d17075a9