Skip to content
Snippets Groups Projects
  1. Mar 08, 2022
  2. Mar 02, 2022
    • Greg Kroah-Hartman's avatar
    • Miaohe Lin's avatar
      memblock: use kfree() to release kmalloced memblock regions · 78706b05
      Miaohe Lin authored
      
      commit c94afc46cae7ad41b2ad6a99368147879f4b0e56 upstream.
      
      memblock.{reserved,memory}.regions may be allocated using kmalloc() in
      memblock_double_array(). Use kfree() to release these kmalloced regions
      indicated by memblock_{reserved,memory}_in_slab.
      
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Fixes: 3010f876 ("mm: discard memblock data later")
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78706b05
    • Marc Zyngier's avatar
      gpio: tegra186: Fix chip_data type confusion · 4185b788
      Marc Zyngier authored
      
      commit d1e972ace42390de739cde87d96043dcbe502286 upstream.
      
      The tegra186 GPIO driver makes the assumption that the pointer
      returned by irq_data_get_irq_chip_data() is a pointer to a
      tegra_gpio structure. Unfortunately, it is actually a pointer
      to the inner gpio_chip structure, as mandated by the gpiolib
      infrastructure. Nice try.
      
      The saving grace is that the gpio_chip is the first member of
      tegra_gpio, so the bug has gone undetected since... forever.
      
      Fix it by performing a container_of() on the pointer. This results
      in no additional code, and makes it possible to understand how
      the whole thing works.
      
      Fixes: 5b2b135a ("gpio: Add Tegra186 support")
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Link: https://lore.kernel.org/r/20220211093904.1112679-1-maz@kernel.org
      
      
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4185b788
    • daniel.starke@siemens.com's avatar
      tty: n_gsm: fix deadlock in gsmtty_open() · bb2e0a77
      daniel.starke@siemens.com authored
      
      commit a2ab75b8e76e455af7867e3835fd9cdf386b508f upstream.
      
      In the current implementation the user may open a virtual tty which then
      could fail to establish the underlying DLCI. The function gsmtty_open()
      gets stuck in tty_port_block_til_ready() while waiting for a carrier rise.
      This happens if the remote side fails to acknowledge the link establishment
      request in time or completely. At some point gsm_dlci_close() is called
      to abort the link establishment attempt. The function tries to inform the
      associated virtual tty by performing a hangup. But the blocking loop within
      tty_port_block_til_ready() is not informed about this event.
      The patch proposed here fixes this by resetting the initialization state of
      the virtual tty to ensure the loop exits and triggering it to make
      tty_port_block_til_ready() return.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220218073123.2121-7-daniel.starke@siemens.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb2e0a77
    • daniel.starke@siemens.com's avatar
      tty: n_gsm: fix wrong tty control line for flow control · e4c8cb95
      daniel.starke@siemens.com authored
      
      commit c19d93542a6081577e6da9bf5e887979c72e80c1 upstream.
      
      tty flow control is handled via gsmtty_throttle() and gsmtty_unthrottle().
      Both functions propagate the outgoing hardware flow control state to the
      remote side via MSC (modem status command) frames. The local state is taken
      from the RTS (ready to send) flag of the tty. However, RTS gets mapped to
      DTR (data terminal ready), which is wrong.
      This patch corrects this by mapping RTS to RTS.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220218073123.2121-5-daniel.starke@siemens.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4c8cb95
    • daniel.starke@siemens.com's avatar
      tty: n_gsm: fix NULL pointer access due to DLCI release · 1f0641dd
      daniel.starke@siemens.com authored
      
      commit 96b169f05cdcc844b400695184d77e42071d14f2 upstream.
      
      The here fixed commit made the tty hangup asynchronous to avoid a circular
      locking warning. I could not reproduce this warning. Furthermore, due to
      the asynchronous hangup the function call now gets queued up while the
      underlying tty is being freed. Depending on the timing this results in a
      NULL pointer access in the global work queue scheduler. To be precise in
      process_one_work(). Therefore, the previous commit made the issue worse
      which it tried to fix.
      
      This patch fixes this by falling back to the old behavior which uses a
      blocking tty hangup call before freeing up the associated tty.
      
      Fixes: 7030082a ("tty: n_gsm: avoid recursive locking with async port hangup")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220218073123.2121-4-daniel.starke@siemens.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f0641dd
    • daniel.starke@siemens.com's avatar
      tty: n_gsm: fix proper link termination after failed open · 1e35cb9e
      daniel.starke@siemens.com authored
      
      commit e3b7468f082d106459e86e8dc6fb9bdd65553433 upstream.
      
      Trying to open a DLCI by sending a SABM frame may fail with a timeout.
      The link is closed on the initiator side without informing the responder
      about this event. The responder assumes the link is open after sending a
      UA frame to answer the SABM frame. The link gets stuck in a half open
      state.
      
      This patch fixes this by initiating the proper link termination procedure
      after link setup timeout instead of silently closing it down.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220218073123.2121-3-daniel.starke@siemens.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e35cb9e
    • daniel.starke@siemens.com's avatar
      tty: n_gsm: fix encoding of control signal octet bit DV · 90b47e61
      daniel.starke@siemens.com authored
      commit 737b0ef3be6b319d6c1fd64193d1603311969326 upstream.
      
      n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
      See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
      
      
      The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to
      the newer 27.010 here. Chapter 5.4.6.3.7 describes the encoding of the
      control signal octet used by the MSC (modem status command). The same
      encoding is also used in convergence layer type 2 as described in chapter
      5.5.2. Table 7 and 24 both require the DV (data valid) bit to be set 1 for
      outgoing control signal octets sent by the DTE (data terminal equipment),
      i.e. for the initiator side.
      Currently, the DV bit is only set if CD (carrier detect) is on, regardless
      of the side.
      
      This patch fixes this behavior by setting the DV bit on the initiator side
      unconditionally.
      
      Fixes: e1eaea46 ("tty: n_gsm line discipline")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDaniel Starke <daniel.starke@siemens.com>
      Link: https://lore.kernel.org/r/20220218073123.2121-1-daniel.starke@siemens.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90b47e61
    • Changbin Du's avatar
      riscv: fix oops caused by irqsoff latency tracer · 9e2dbc31
      Changbin Du authored
      
      commit 22e2100b1b07d6f5acc71cc1acb53f680c677d77 upstream.
      
      The trace_hardirqs_{on,off}() require the caller to setup frame pointer
      properly. This because these two functions use macro 'CALLER_ADDR1' (aka.
      __builtin_return_address(1)) to acquire caller info. If the $fp is used
      for other purpose, the code generated this macro (as below) could trigger
      memory access fault.
      
         0xffffffff8011510e <+80>:    ld      a1,-16(s0)
         0xffffffff80115112 <+84>:    ld      s2,-8(a1)  # <-- paging fault here
      
      The oops message during booting if compiled with 'irqoff' tracer enabled:
      [    0.039615][    T0] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8
      [    0.041925][    T0] Oops [#1]
      [    0.042063][    T0] Modules linked in:
      [    0.042864][    T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.0-rc1-00233-g9a20c48d1ed2 #29
      [    0.043568][    T0] Hardware name: riscv-virtio,qemu (DT)
      [    0.044343][    T0] epc : trace_hardirqs_on+0x56/0xe2
      [    0.044601][    T0]  ra : restore_all+0x12/0x6e
      [    0.044721][    T0] epc : ffffffff80126a5c ra : ffffffff80003b94 sp : ffffffff81403db0
      [    0.044801][    T0]  gp : ffffffff8163acd8 tp : ffffffff81414880 t0 : 0000000000000020
      [    0.044882][    T0]  t1 : 0098968000000000 t2 : 0000000000000000 s0 : ffffffff81403de0
      [    0.044967][    T0]  s1 : 0000000000000000 a0 : 0000000000000001 a1 : 0000000000000100
      [    0.045046][    T0]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
      [    0.045124][    T0]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000054494d45
      [    0.045210][    T0]  s2 : ffffffff80003b94 s3 : ffffffff81a8f1b0 s4 : ffffffff80e27b50
      [    0.045289][    T0]  s5 : ffffffff81414880 s6 : ffffffff8160fa00 s7 : 00000000800120e8
      [    0.045389][    T0]  s8 : 0000000080013100 s9 : 000000000000007f s10: 0000000000000000
      [    0.045474][    T0]  s11: 0000000000000000 t3 : 7fffffffffffffff t4 : 0000000000000000
      [    0.045548][    T0]  t5 : 0000000000000000 t6 : ffffffff814aa368
      [    0.045620][    T0] status: 0000000200000100 badaddr: 00000000000000f8 cause: 000000000000000d
      [    0.046402][    T0] [<ffffffff80003b94>] restore_all+0x12/0x6e
      
      This because the $fp(aka. $s0) register is not used as frame pointer in the
      assembly entry code.
      
      	resume_kernel:
      		REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
      		bnez s0, restore_all
      		REG_L s0, TASK_TI_FLAGS(tp)
                      andi s0, s0, _TIF_NEED_RESCHED
                      beqz s0, restore_all
                      call preempt_schedule_irq
                      j restore_all
      
      To fix above issue, here we add one extra level wrapper for function
      trace_hardirqs_{on,off}() so they can be safely called by low level entry
      code.
      
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Fixes: 3c469798 ("riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e2dbc31
    • Chuansheng Liu's avatar
      thermal: int340x: fix memory leak in int3400_notify() · e0989338
      Chuansheng Liu authored
      
      commit 3abea10e6a8f0e7804ed4c124bea2d15aca977c8 upstream.
      
      It is easy to hit the below memory leaks in my TigerLake platform:
      
      unreferenced object 0xffff927c8b91dbc0 (size 32):
        comm "kworker/0:2", pid 112, jiffies 4294893323 (age 83.604s)
        hex dump (first 32 bytes):
          4e 41 4d 45 3d 49 4e 54 33 34 30 30 20 54 68 65  NAME=INT3400 The
          72 6d 61 6c 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  rmal.kkkkkkkkkk.
        backtrace:
          [<ffffffff9c502c3e>] __kmalloc_track_caller+0x2fe/0x4a0
          [<ffffffff9c7b7c15>] kvasprintf+0x65/0xd0
          [<ffffffff9c7b7d6e>] kasprintf+0x4e/0x70
          [<ffffffffc04cb662>] int3400_notify+0x82/0x120 [int3400_thermal]
          [<ffffffff9c8b7358>] acpi_ev_notify_dispatch+0x54/0x71
          [<ffffffff9c88f1a7>] acpi_os_execute_deferred+0x17/0x30
          [<ffffffff9c2c2c0a>] process_one_work+0x21a/0x3f0
          [<ffffffff9c2c2e2a>] worker_thread+0x4a/0x3b0
          [<ffffffff9c2cb4dd>] kthread+0xfd/0x130
          [<ffffffff9c201c1f>] ret_from_fork+0x1f/0x30
      
      Fix it by calling kfree() accordingly.
      
      Fixes: 38e44da5 ("thermal: int3400_thermal: process "thermal table changed" event")
      Signed-off-by: default avatarChuansheng Liu <chuansheng.liu@intel.com>
      Cc: 4.14+ <stable@vger.kernel.org> # 4.14+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0989338
    • Jason Gunthorpe's avatar
      RDMA/cma: Do not change route.addr.src_addr outside state checks · 5b1cef57
      Jason Gunthorpe authored
      commit 22e9f71072fa605cbf033158db58e0790101928d upstream.
      
      If the state is not idle then resolve_prepare_src() should immediately
      fail and no change to global state should happen. However, it
      unconditionally overwrites the src_addr trying to build a temporary any
      address.
      
      For instance if the state is already RDMA_CM_LISTEN then this will corrupt
      the src_addr and would cause the test in cma_cancel_operation():
      
                 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev)
      
      Which would manifest as this trace from syzkaller:
      
        BUG: KASAN: use-after-free in __list_add_valid+0x93/0xa0 lib/list_debug.c:26
        Read of size 8 at addr ffff8881546491e0 by task syz-executor.1/32204
      
        CPU: 1 PID: 32204 Comm: syz-executor.1 Not tainted 5.12.0-rc8-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        Call Trace:
         __dump_stack lib/dump_stack.c:79 [inline]
         dump_stack+0x141/0x1d7 lib/dump_stack.c:120
         print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232
         __kasan_report mm/kasan/report.c:399 [inline]
         kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
         __list_add_valid+0x93/0xa0 lib/list_debug.c:26
         __list_add include/linux/list.h:67 [inline]
         list_add_tail include/linux/list.h:100 [inline]
         cma_listen_on_all drivers/infiniband/core/cma.c:2557 [inline]
         rdma_listen+0x787/0xe00 drivers/infiniband/core/cma.c:3751
         ucma_listen+0x16a/0x210 drivers/infiniband/core/ucma.c:1102
         ucma_write+0x259/0x350 drivers/infiniband/core/ucma.c:1732
         vfs_write+0x28e/0xa30 fs/read_write.c:603
         ksys_write+0x1ee/0x250 fs/read_write.c:658
         do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
         entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      This is indicating that an rdma_id_private was destroyed without doing
      cma_cancel_listens().
      
      Instead of trying to re-use the src_addr memory to indirectly create an
      any address derived from the dst build one explicitly on the stack and
      bind to that as any other normal flow would do. rdma_bind_addr() will copy
      it over the src_addr once it knows the state is valid.
      
      This is similar to commit bc0bdc5a ("RDMA/cma: Do not change
      route.addr.src_addr.ss_family")
      
      Link: https://lore.kernel.org/r/0-v2-e975c8fd9ef2+11e-syz_cma_srcaddr_jgg@nvidia.com
      
      
      Cc: stable@vger.kernel.org
      Fixes: 732d41c5 ("RDMA/cma: Make the locking for automatic state transition more clear")
      Reported-by: default avatar <syzbot+c94a3675a626f6333d74@syzkaller.appspotmail.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b1cef57
    • Mårten Lindahl's avatar
      driver core: Free DMA range map when device is released · 8fe4da55
      Mårten Lindahl authored
      
      commit d8f7a5484f2188e9af2d9e4e587587d724501b12 upstream.
      
      When unbinding/binding a driver with DMA mapped memory, the DMA map is
      not freed before the driver is reloaded. This leads to a memory leak
      when the DMA map is overwritten when reprobing the driver.
      
      This can be reproduced with a platform driver having a dma-range:
      
      dummy {
      	...
      	#address-cells = <0x2>;
      	#size-cells = <0x2>;
      	ranges;
      	dma-ranges = <...>;
      	...
      };
      
      and then unbinding/binding it:
      
      ~# echo soc:dummy >/sys/bus/platform/drivers/<driver>/unbind
      
      DMA map object 0xffffff800b0ae540 still being held by &pdev->dev
      
      ~# echo soc:dummy >/sys/bus/platform/drivers/<driver>/bind
      ~# echo scan > /sys/kernel/debug/kmemleak
      ~# cat /sys/kernel/debug/kmemleak
      unreferenced object 0xffffff800b0ae540 (size 64):
        comm "sh", pid 833, jiffies 4295174550 (age 2535.352s)
        hex dump (first 32 bytes):
          00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 80 00 00 00 00 00 00 00 80 00 00 00 00  ................
        backtrace:
          [<ffffffefd1694708>] create_object.isra.0+0x108/0x344
          [<ffffffefd1d1a850>] kmemleak_alloc+0x8c/0xd0
          [<ffffffefd167e2d0>] __kmalloc+0x440/0x6f0
          [<ffffffefd1a960a4>] of_dma_get_range+0x124/0x220
          [<ffffffefd1a8ce90>] of_dma_configure_id+0x40/0x2d0
          [<ffffffefd198b68c>] platform_dma_configure+0x5c/0xa4
          [<ffffffefd198846c>] really_probe+0x8c/0x514
          [<ffffffefd1988990>] __driver_probe_device+0x9c/0x19c
          [<ffffffefd1988cd8>] device_driver_attach+0x54/0xbc
          [<ffffffefd1986634>] bind_store+0xc4/0x120
          [<ffffffefd19856e0>] drv_attr_store+0x30/0x44
          [<ffffffefd173c9b0>] sysfs_kf_write+0x50/0x60
          [<ffffffefd173c1c4>] kernfs_fop_write_iter+0x124/0x1b4
          [<ffffffefd16a013c>] new_sync_write+0xdc/0x160
          [<ffffffefd16a256c>] vfs_write+0x23c/0x2a0
          [<ffffffefd16a2758>] ksys_write+0x64/0xec
      
      To prevent this we should free the dma_range_map when the device is
      released.
      
      Fixes: e0d07278 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset")
      Cc: stable <stable@vger.kernel.org>
      Suggested-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarMårten Lindahl <marten.lindahl@axis.com>
      Link: https://lore.kernel.org/r/20220216094128.4025861-1-marten.lindahl@axis.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8fe4da55
    • Hongyu Xie's avatar
      xhci: Prevent futile URB re-submissions due to incorrect return value. · 21482476
      Hongyu Xie authored
      
      commit 243a1dd7ba48c120986dd9e66fee74bcb7751034 upstream.
      
      The -ENODEV return value from xhci_check_args() is incorrectly changed
      to -EINVAL in a couple places before propagated further.
      
      xhci_check_args() returns 4 types of value, -ENODEV, -EINVAL, 1 and 0.
      xhci_urb_enqueue and xhci_check_streams_endpoint return -EINVAL if
      the return value of xhci_check_args <= 0.
      This causes problems for example r8152_submit_rx, calling usb_submit_urb
      in drivers/net/usb/r8152.c.
      r8152_submit_rx will never get -ENODEV after submiting an urb when xHC
      is halted because xhci_urb_enqueue returns -EINVAL in the very beginning.
      
      [commit message and header edit -Mathias]
      
      Fixes: 203a8661 ("xhci: Avoid NULL pointer deref when host dies.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHongyu Xie <xiehongyu1@kylinos.cn>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220215123320.1253947-3-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21482476
    • Puma Hsu's avatar
      xhci: re-initialize the HC during resume if HCE was set · 0b0a229d
      Puma Hsu authored
      
      commit 8b328f8002bcf29ef517ee4bf234e09aabec4d2e upstream.
      
      When HCE(Host Controller Error) is set, it means an internal
      error condition has been detected. Software needs to re-initialize
      the HC, so add this check in xhci resume.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPuma Hsu <pumahsu@google.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220215123320.1253947-2-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b0a229d
    • Sebastian Andrzej Siewior's avatar
      usb: dwc3: gadget: Let the interrupt handler disable bottom halves. · 328faee6
      Sebastian Andrzej Siewior authored
      commit 84918a89d6efaff075de570b55642b6f4ceeac6d upstream.
      
      The interrupt service routine registered for the gadget is a primary
      handler which mask the interrupt source and a threaded handler which
      handles the source of the interrupt. Since the threaded handler is
      voluntary threaded, the IRQ-core does not disable bottom halves before
      invoke the handler like it does for the forced-threaded handler.
      
      Due to changes in networking it became visible that a network gadget's
      completions handler may schedule a softirq which remains unprocessed.
      The gadget's completion handler is usually invoked either in hard-IRQ or
      soft-IRQ context. In this context it is enough to just raise the softirq
      because the softirq itself will be handled once that context is left.
      In the case of the voluntary threaded handler, there is nothing that
      will process pending softirqs. Which means it remain queued until
      another random interrupt (on this CPU) fires and handles it on its exit
      path or another thread locks and unlocks a lock with the bh suffix.
      Worst case is that the CPU goes idle and the NOHZ complains about
      unhandled softirqs.
      
      Disable bottom halves before acquiring the lock (and disabling
      interrupts) and enable them after dropping the lock. This ensures that
      any pending softirqs will handled right away.
      
      Link: https://lkml.kernel.org/r/c2a64979-73d1-2c22-e048-c275c9f81558@samsung.com
      
      
      Fixes: e5f68b4a ("Revert "usb: dwc3: gadget: remove unnecessary _irqsave()"")
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Link: https://lore.kernel.org/r/Yg/YPejVQH3KkRVd@linutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      328faee6
    • Hans de Goede's avatar
      usb: dwc3: pci: Fix Bay Trail phy GPIO mappings · e57bdee8
      Hans de Goede authored
      
      commit 62e3f0afe246720f7646eb1b034a6897dac34405 upstream.
      
      When the Bay Trail phy GPIO mappings where added cs and reset were swapped,
      this did not cause any issues sofar, because sofar they were always driven
      high/low at the same time.
      
      Note the new mapping has been verified both in /sys/kernel/debug/gpio
      output on Android factory images on multiple devices, as well as in
      the schematics for some devices.
      
      Fixes: 5741022c ("usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20220213130524.18748-3-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e57bdee8
    • Fabrice Gasnier's avatar
      usb: dwc2: drd: fix soft connect when gadget is unconfigured · 99b2425d
      Fabrice Gasnier authored
      
      commit 32fde84362c40961726a5c91f35ad37355ccc0c6 upstream.
      
      When the gadget driver hasn't been (yet) configured, and the cable is
      connected to a HOST, the SFTDISCON gets cleared unconditionally, so the
      HOST tries to enumerate it.
      At the host side, this can result in a stuck USB port or worse. When
      getting lucky, some dmesg can be observed at the host side:
       new high-speed USB device number ...
       device descriptor read/64, error -110
      
      Fix it in drd, by checking the enabled flag before calling
      dwc2_hsotg_core_connect(). It will be called later, once configured,
      by the normal flow:
      - udc_bind_to_driver
       - usb_gadget_connect
         - dwc2_hsotg_pullup
           - dwc2_hsotg_core_connect
      
      Fixes: 17f93402 ("usb: dwc2: override PHY input signals with usb role switch support")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@foss.st.com>
      Link: https://lore.kernel.org/r/1644999135-13478-1-git-send-email-fabrice.gasnier@foss.st.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99b2425d
    • Daniele Palmas's avatar
      USB: serial: option: add Telit LE910R1 compositions · c7866880
      Daniele Palmas authored
      
      commit cfc4442c642d568014474b6718ccf65dc7ca6099 upstream.
      
      Add support for the following Telit LE910R1 compositions:
      
      0x701a: rndis, tty, tty, tty
      0x701b: ecm, tty, tty, tty
      0x9201: tty
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Link: https://lore.kernel.org/r/20220218134552.4051-1-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>
      c7866880
    • Slark Xiao's avatar
      USB: serial: option: add support for DW5829e · 220ba174
      Slark Xiao authored
      
      commit 6ecb3f0b18b320320460a42e40d6fb603f6ded96 upstream.
      
      Dell DW5829e same as DW5821e except CAT level.
      DW5821e supports CAT16 but DW5829e supports CAT9.
      There are 2 types product of DW5829e: normal and eSIM.
      So we will add 2 PID for DW5829e.
      And for each PID, it support MBIM or RMNET.
      Let's see test evidence as below:
      
      DW5829e MBIM mode:
      T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  4 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  2
      P:  Vendor=413c ProdID=81e6 Rev=03.18
      S:  Manufacturer=Dell Inc.
      S:  Product=DW5829e Snapdragon X20 LTE
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      
      DW5829e RMNET mode:
      T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=413c ProdID=81e6 Rev=03.18
      S:  Manufacturer=Dell Inc.
      S:  Product=DW5829e Snapdragon X20 LTE
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      
      DW5829e-eSIM MBIM mode:
      T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  2
      P:  Vendor=413c ProdID=81e4 Rev=03.18
      S:  Manufacturer=Dell Inc.
      S:  Product=DW5829e-eSIM Snapdragon X20 LTE
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      I:  If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      
      DW5829e-eSIM RMNET mode:
      T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  7 Spd=5000 MxCh= 0
      D:  Ver= 3.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=413c ProdID=81e4 Rev=03.18
      S:  Manufacturer=Dell Inc.
      S:  Product=DW5829e-eSIM Snapdragon X20 LTE
      S:  SerialNumber=0123456789ABCDEF
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      
      BTW, the interface 0x6 of MBIM mode is GNSS port, which not same as NMEA
      port. So it's banned from serial option driver.
      The remaining interfaces 0x2-0x5 are: MODEM, MODEM, NMEA, DIAG.
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      Link: https://lore.kernel.org/r/20220214021401.6264-1-slark_xiao@163.com
      
      
      [ johan: drop unnecessary reservation of interface 1 ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      220ba174
    • Steven Rostedt (Google)'s avatar
      tracefs: Set the group ownership in apply_options() not parse_options() · 3a1dd56e
      Steven Rostedt (Google) authored
      commit 851e99ebeec3f4a672bb5010cf1ece095acee447 upstream.
      
      Al Viro brought it to my attention that the dentries may not be filled
      when the parse_options() is called, causing the call to set_gid() to
      possibly crash. It should only be called if parse_options() succeeds
      totally anyway.
      
      He suggested the logical place to do the update is in apply_options().
      
      Link: https://lore.kernel.org/all/20220225165219.737025658@goodmis.org/
      Link: https://lkml.kernel.org/r/20220225153426.1c4cab6b@gandalf.local.home
      
      
      
      Cc: stable@vger.kernel.org
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Fixes: 48b27b6b ("tracefs: Set all files to the same group ownership as the mount option")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a1dd56e
Loading