Skip to content
Snippets Groups Projects
  1. Mar 03, 2025
    • Jann Horn's avatar
      partitions: mac: fix handling of bogus partition table · e42d7f4c
      Jann Horn authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 80e648042e512d5a767da251d44132553fe04ae0 upstream.
      
      Fix several issues in partition probing:
      
       - The bailout for a bad partoffset must use put_dev_sector(), since the
         preceding read_part_sector() succeeded.
       - If the partition table claims a silly sector size like 0xfff bytes
         (which results in partition table entries straddling sector boundaries),
         bail out instead of accessing out-of-bounds memory.
       - We must not assume that the partition table contains proper NUL
         termination - use strnlen() and strncmp() instead of strlen() and
         strcmp().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Link: https://lore.kernel.org/r/20250214-partition-mac-v1-1-c1c626dffbd5@google.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e42d7f4c
    • Wentao Liang's avatar
      gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock · 1f23fcd8
      Wentao Liang authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit b9644fbfbcab13da7f8b37bef7c51e5b8407d031 upstream.
      
      The stmpe_reg_read function can fail, but its return value is not checked
      in stmpe_gpio_irq_sync_unlock. This can lead to silent failures and
      incorrect behavior if the hardware access fails.
      
      This patch adds checks for the return value of stmpe_reg_read. If the
      function fails, an error message is logged and the function returns
      early to avoid further issues.
      
      Fixes: b888fb6f ("gpio: stmpe: i2c transfer are forbiden in atomic context")
      Cc: stable@vger.kernel.org # 4.16+
      Signed-off-by: default avatarWentao Liang <vulab@iscas.ac.cn>
      Link: https://lore.kernel.org/r/20250212021849.275-1-vulab@iscas.ac.cn
      
      
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f23fcd8
    • Mario Limonciello's avatar
      gpiolib: acpi: Add a quirk for Acer Nitro ANV14 · f0d3ffd7
      Mario Limonciello authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 8743d66979e494c5378563e6b5a32e913380abd8 upstream.
      
      Spurious immediate wake up events are reported on Acer Nitro ANV14. GPIO 11 is
      specified as an edge triggered input and also a wake source but this pin is
      supposed to be an output pin for an LED, so it's effectively floating.
      
      Block the interrupt from getting set up for this GPIO on this device.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDelgan <delgan.py@gmail.com>
      Tested-by: default avatarDelgan <delgan.py@gmail.com>
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3954
      
      
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Acked-by: default avatarMika Westerberg <westeri@kernel.org>
      Link: https://lore.kernel.org/r/20250211203222.761206-1-superm1@kernel.org
      
      
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0d3ffd7
    • Ivan Kokshaysky's avatar
      alpha: align stack for page fault and user unaligned trap handlers · 77afdebd
      Ivan Kokshaysky authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 3b35a171060f846b08b48646b38c30b5d57d17ff upstream.
      
      do_page_fault() and do_entUna() are special because they use
      non-standard stack frame layout. Fix them manually.
      
      Cc: stable@vger.kernel.org
      Tested-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Tested-by: default avatarMagnus Lindholm <linmag7@gmail.com>
      Tested-by: default avatarMatt Turner <mattst88@gmail.com>
      Reviewed-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Suggested-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Signed-off-by: default avatarIvan Kokshaysky <ink@unseen.parts>
      Signed-off-by: default avatarMatt Turner <mattst88@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77afdebd
    • John Keeping's avatar
      serial: 8250: Fix fifo underflow on flush · 0817b485
      John Keeping authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 9e512eaaf8f4008c44ede3dfc0fbc9d9c5118583 upstream.
      
      When flushing the serial port's buffer, uart_flush_buffer() calls
      kfifo_reset() but if there is an outstanding DMA transfer then the
      completion function will consume data from the kfifo via
      uart_xmit_advance(), underflowing and leading to ongoing DMA as the
      driver tries to transmit another 2^32 bytes.
      
      This is readily reproduced with serial-generic and amidi sending even
      short messages as closing the device on exit will wait for the fifo to
      drain and in the underflow case amidi hangs for 30 seconds on exit in
      tty_wait_until_sent().  A trace of that gives:
      
           kworker/1:1-84    [001]    51.769423: bprint:               serial8250_tx_dma: tx_size=3 fifo_len=3
                 amidi-763   [001]    51.769460: bprint:               uart_flush_buffer: resetting fifo
       irq/21-fe530000-76    [000]    51.769474: bprint:               __dma_tx_complete: tx_size=3
       irq/21-fe530000-76    [000]    51.769479: bprint:               serial8250_tx_dma: tx_size=4096 fifo_len=4294967293
       irq/21-fe530000-76    [000]    51.781295: bprint:               __dma_tx_complete: tx_size=4096
       irq/21-fe530000-76    [000]    51.781301: bprint:               serial8250_tx_dma: tx_size=4096 fifo_len=4294963197
       irq/21-fe530000-76    [000]    51.793131: bprint:               __dma_tx_complete: tx_size=4096
       irq/21-fe530000-76    [000]    51.793135: bprint:               serial8250_tx_dma: tx_size=4096 fifo_len=4294959101
       irq/21-fe530000-76    [000]    51.804949: bprint:               __dma_tx_complete: tx_size=4096
      
      Since the port lock is held in when the kfifo is reset in
      uart_flush_buffer() and in __dma_tx_complete(), adding a flush_buffer
      hook to adjust the outstanding DMA byte count is sufficient to avoid the
      kfifo underflow.
      
      Fixes: 9ee4b83e ("serial: 8250: Add support for dmaengine")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarJohn Keeping <jkeeping@inmusicbrands.com>
      Link: https://lore.kernel.org/r/20250208124148.1189191-1-jkeeping@inmusicbrands.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0817b485
    • Shakeel Butt's avatar
      cgroup: fix race between fork and cgroup.kill · 2e789b01
      Shakeel Butt authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit b69bb476dee99d564d65d418e9a20acca6f32c3f upstream.
      
      Tejun reported the following race between fork() and cgroup.kill at [1].
      
      Tejun:
        I was looking at cgroup.kill implementation and wondering whether there
        could be a race window. So, __cgroup_kill() does the following:
      
         k1. Set CGRP_KILL.
         k2. Iterate tasks and deliver SIGKILL.
         k3. Clear CGRP_KILL.
      
        The copy_process() does the following:
      
         c1. Copy a bunch of stuff.
         c2. Grab siglock.
         c3. Check fatal_signal_pending().
         c4. Commit to forking.
         c5. Release siglock.
         c6. Call cgroup_post_fork() which puts the task on the css_set and tests
             CGRP_KILL.
      
        The intention seems to be that either a forking task gets SIGKILL and
        terminates on c3 or it sees CGRP_KILL on c6 and kills the child. However, I
        don't see what guarantees that k3 can't happen before c6. ie. After a
        forking task passes c5, k2 can take place and then before the forking task
        reaches c6, k3 can happen. Then, nobody would send SIGKILL to the child.
        What am I missing?
      
      This is indeed a race. One way to fix this race is by taking
      cgroup_threadgroup_rwsem in write mode in __cgroup_kill() as the fork()
      side takes cgroup_threadgroup_rwsem in read mode from cgroup_can_fork()
      to cgroup_post_fork(). However that would be heavy handed as this adds
      one more potential stall scenario for cgroup.kill which is usually
      called under extreme situation like memory pressure.
      
      To fix this race, let's maintain a sequence number per cgroup which gets
      incremented on __cgroup_kill() call. On the fork() side, the
      cgroup_can_fork() will cache the sequence number locally and recheck it
      against the cgroup's sequence number at cgroup_post_fork() site. If the
      sequence numbers mismatch, it means __cgroup_kill() can been called and
      we should send SIGKILL to the newly created task.
      
      Reported-by: default avatarTejun Heo <tj@kernel.org>
      Closes: https://lore.kernel.org/all/Z5QHE2Qn-QZ6M-KW@slm.duckdns.org/
      
       [1]
      Fixes: 661ee628 ("cgroup: introduce cgroup.kill")
      Cc: stable@vger.kernel.org # v5.14+
      Signed-off-by: default avatarShakeel Butt <shakeel.butt@linux.dev>
      Reviewed-by: default avatarMichal Koutný <mkoutny@suse.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e789b01
    • Ard Biesheuvel's avatar
      efi: Avoid cold plugged memory for placing the kernel · 6e0fd57f
      Ard Biesheuvel authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit ba69e0750b0362870294adab09339a0c39c3beaf upstream.
      
      UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory
      regions that are 'cold plugged' at boot, i.e., hot pluggable memory that
      is available from early boot, and described as system RAM by the
      firmware.
      
      Existing loaders and EFI applications running in the boot context will
      happily use this memory for allocating data structures that cannot be
      freed or moved at runtime, and this prevents the memory from being
      unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute
      should be tested, and memory annotated as such should be avoided for
      such allocations.
      
      In the EFI stub, there are a couple of occurrences where, instead of the
      high-level AllocatePages() UEFI boot service, a low-level code sequence
      is used that traverses the EFI memory map and carves out the requested
      number of pages from a free region. This is needed, e.g., for allocating
      as low as possible, or for allocating pages at random.
      
      While AllocatePages() should presumably avoid special purpose memory and
      cold plugged regions, this manual approach needs to incorporate this
      logic itself, in order to prevent the kernel itself from ending up in a
      hot unpluggable region, preventing it from being unplugged.
      
      So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it
      where appropriate.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e0fd57f
    • Ivan Kokshaysky's avatar
      alpha: make stack 16-byte aligned (most cases) · bb7ef531
      Ivan Kokshaysky authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit 0a0f7362b0367634a2d5cb7c96226afc116f19c9 upstream.
      
      The problem is that GCC expects 16-byte alignment of the incoming stack
      since early 2004, as Maciej found out [1]:
        Having actually dug speculatively I can see that the psABI was changed in
       GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double
       improperly aligned)") back in Mar 2004, when the stack pointer alignment
       was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has
       various suspicious stack pointer adjustments, starting with SP_OFF which
       is not a whole multiple of 16.
      
      Also, as Magnus noted, "ALPHA Calling Standard" [2] required the same:
       D.3.1 Stack Alignment
        This standard requires that stacks be octaword aligned at the time a
        new procedure is invoked.
      
      However:
      - the "normal" kernel stack is always misaligned by 8 bytes, thanks to
        the odd number of 64-bit words in 'struct pt_regs', which is the very
        first thing pushed onto the kernel thread stack;
      - syscall, fault, interrupt etc. handlers may, or may not, receive aligned
        stack depending on numerous factors.
      
      Somehow we got away with it until recently, when we ended up with
      a stack corruption in kernel/smp.c:smp_call_function_single() due to
      its use of 32-byte aligned local data and the compiler doing clever
      things allocating it on the stack.
      
      This adds padding between the PAL-saved and kernel-saved registers
      so that 'struct pt_regs' have an even number of 64-bit words.
      This makes the stack properly aligned for most of the kernel
      code, except two handlers which need special threatment.
      
      Note: struct pt_regs doesn't belong in uapi/asm; this should be fixed,
      but let's put this off until later.
      
      Link: https://lore.kernel.org/rcu/alpine.DEB.2.21.2501130248010.18889@angie.orcam.me.uk/ [1]
      Link: https://bitsavers.org/pdf/dec/alpha/Alpha_Calling_Standard_Rev_2.0_19900427.pdf
      
       [2]
      
      Cc: stable@vger.kernel.org
      Tested-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Tested-by: default avatarMagnus Lindholm <linmag7@gmail.com>
      Tested-by: default avatarMatt Turner <mattst88@gmail.com>
      Reviewed-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
      Signed-off-by: default avatarIvan Kokshaysky <ink@unseen.parts>
      Signed-off-by: default avatarMatt Turner <mattst88@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb7ef531
    • Alexander Hölzl's avatar
      can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero · ce6f912f
      Alexander Hölzl authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 44de577e61ed239db09f0da9d436866bef9b77dd upstream.
      
      The J1939 standard requires the transmission of messages of length 0.
      
      For example proprietary messages are specified with a data length of 0
      to 1785. The transmission of such messages is not possible. Sending
      results in no error being returned but no corresponding can frame
      being generated.
      
      Enable the transmission of zero length J1939 messages. In order to
      facilitate this two changes are necessary:
      
      1) If the transmission of a new message is requested from user space
      the message is segmented in j1939_sk_send_loop(). Let the segmentation
      take into account zero length messages, do not terminate immediately,
      queue the corresponding skb.
      
      2) j1939_session_skb_get_by_offset() selects the next skb to transmit
      for a session. Take into account that there might be zero length skbs
      in the queue.
      
      Signed-off-by: default avatarAlexander Hölzl <alexander.hoelzl@gmx.net>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://patch.msgid.link/20250205174651.103238-1-alexander.hoelzl@gmx.net
      
      
      Fixes: 9d71dd0c ("can: add support of SAE J1939 protocol")
      Cc: stable@vger.kernel.org
      [mkl: commit message rephrased]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce6f912f
    • Krzysztof Kozlowski's avatar
      can: c_can: fix unbalanced runtime PM disable in error path · 61a1a811
      Krzysztof Kozlowski authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 257a2cd3eb578ee63d6bf90475dc4f4b16984139 upstream.
      
      Runtime PM is enabled as one of the last steps of probe(), so all
      earlier gotos to "exit_free_device" label were not correct and were
      leading to unbalanced runtime PM disable depth.
      
      Fixes: 6e2fe01d ("can: c_can: move runtime PM enable/disable to c_can_platform")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://patch.msgid.link/20250112-syscon-phandle-args-can-v1-1-314d9549906f@linaro.org
      
      
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61a1a811
    • Fedor Pchelkin's avatar
      can: ctucanfd: handle skb allocation failure · c39ecc7f
      Fedor Pchelkin authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 9bd24927e3eeb85642c7baa3b28be8bea6c2a078 upstream.
      
      If skb allocation fails, the pointer to struct can_frame is NULL. This
      is actually handled everywhere inside ctucan_err_interrupt() except for
      the only place.
      
      Add the missed NULL check.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE static
      analysis tool.
      
      Fixes: 2dcb8e87 ("can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Acked-by: default avatarPavel Pisa <pisa@cmp.felk.cvut.cz>
      Reviewed-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://patch.msgid.link/20250114152138.139580-1-pchelkin@ispras.ru
      
      
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c39ecc7f
    • Johan Hovold's avatar
      USB: serial: option: drop MeiG Smart defines · 787fcff3
      Johan Hovold authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 6aa8a63c471eb6756aabd03f880feffe6a7af6c9 upstream.
      
      Several MeiG Smart modems apparently use the same product id, making the
      defines even less useful.
      
      Drop them in favour of using comments consistently to make the id table
      slightly less unwieldy.
      
      Cc: stable@vger.kernel.org
      Acked-by: default avatarChester A. Unal <chester.a.unal@arinc9.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      787fcff3
    • Fabio Porcedda's avatar
      USB: serial: option: fix Telit Cinterion FN990A name · e556d04a
      Fabio Porcedda authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 12606fe73f33647c5e79bf666833bf0b225e649d upstream.
      
      The correct name for FN990 is FN990A so use it in order to avoid
      confusion with FN990B.
      
      Signed-off-by: default avatarFabio Porcedda <fabio.porcedda@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>
      e556d04a
    • Fabio Porcedda's avatar
      USB: serial: option: add Telit Cinterion FN990B compositions · 56939924
      Fabio Porcedda authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit c979fb5ece2dc11cc9cc3d5c66f750e210bfdee2 upstream.
      
      Add the following Telit Cinterion FN990B40 compositions:
      
      0x10d0: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
              tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
      T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 17 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10d0 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN990
      S:  SerialNumber=43b38f19
      C:  #Ifs= 9 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= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10d1: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
              tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
      T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10d1 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN990
      S:  SerialNumber=43b38f19
      C:  #Ifs=10 Cfg#= 1 Atr=e0 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=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#= 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=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8b(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=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10d2: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
              tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
      T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 18 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10d2 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN990
      S:  SerialNumber=43b38f19
      C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 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= 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=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#= 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=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8b(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=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      0x10d3: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
              tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
      T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=1bc7 ProdID=10d3 Rev=05.15
      S:  Manufacturer=Telit Cinterion
      S:  Product=FN990
      S:  SerialNumber=43b38f19
      C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
      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= 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=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#= 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=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8b(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=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFabio Porcedda <fabio.porcedda@gmail.com>
      Reviewed-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56939924
    • Chester A. Unal's avatar
      USB: serial: option: add MeiG Smart SLM828 · c3f1ae82
      Chester A. Unal authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit db79e75460fc59b19f9c89d4b068e61cee59f37d upstream.
      
      MeiG Smart SLM828 is an LTE-A CAT6 modem with the mPCIe form factor. The
      "Cls=ff(vend.) Sub=10 Prot=02" and "Cls=ff(vend.) Sub=10 Prot=03"
      interfaces respond to AT commands. Add these interfaces.
      
      The product ID the modem uses is shared across multiple modems. Therefore,
      add comments to describe which interface is used for which modem.
      
      T:  Bus=01 Lev=01 Prnt=05 Port=01 Cnt=01 Dev#=  6 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2dee ProdID=4d22 Rev=05.04
      S:  Manufacturer=MEIG
      S:  Product=LTE-A Module
      S:  SerialNumber=4da7ec42
      C:  #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=10 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=10 Prot=02 Driver=(none)
      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=10 Prot=03 Driver=(none)
      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=10 Prot=04 Driver=(none)
      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= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=88(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=05 Driver=qmi_wwan
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarChester A. Unal <chester.a.unal@arinc9.com>
      Link: https://lore.kernel.org/20250124-for-johan-meig-slm828-v2-1-6b4cd3f6344f@arinc9.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>
      c3f1ae82
    • Jann Horn's avatar
      usb: cdc-acm: Fix handling of oversized fragments · 9a86bee6
      Jann Horn authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 12e712964f41d05ae034989892de445781c46730 upstream.
      
      If we receive an initial fragment of size 8 bytes which specifies a wLength
      of 1 byte (so the reassembled message is supposed to be 9 bytes long), and
      we then receive a second fragment of size 9 bytes (which is not supposed to
      happen), we currently wrongly bypass the fragment reassembly code but still
      pass the pointer to the acm->notification_buffer to
      acm_process_notification().
      
      Make this less wrong by always going through fragment reassembly when we
      expect more fragments.
      
      Before this patch, receiving an overlong fragment could lead to `newctrl`
      in acm_process_notification() being uninitialized data (instead of data
      coming from the device).
      
      Cc: stable <stable@kernel.org>
      Fixes: ea258352 ("cdc-acm: reassemble fragmented notifications")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a86bee6
    • Jann Horn's avatar
      usb: cdc-acm: Check control transfer buffer size before access · 7197e73a
      Jann Horn authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit e563b01208f4d1f609bcab13333b6c0e24ce6a01 upstream.
      
      If the first fragment is shorter than struct usb_cdc_notification, we can't
      calculate an expected_size. Log an error and discard the notification
      instead of reading lengths from memory outside the received data, which can
      lead to memory corruption when the expected_size decreases between
      fragments, causing `expected_size - acm->nb_index` to wrap.
      
      This issue has been present since the beginning of git history; however,
      it only leads to memory corruption since commit ea258352
      ("cdc-acm: reassemble fragmented notifications").
      
      A mitigating factor is that acm_ctrl_irq() can only execute after userspace
      has opened /dev/ttyACM*; but if ModemManager is running, ModemManager will
      do that automatically depending on the USB device's vendor/product IDs and
      its other interfaces.
      
      Cc: stable <stable@kernel.org>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7197e73a
    • Marek Vasut's avatar
      USB: cdc-acm: Fill in Renesas R-Car D3 USB Download mode quirk · 5461d10c
      Marek Vasut authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 7284922f3e4fa285dff1b8bb593aa9a0b8458f30 upstream.
      
      Add Renesas R-Car D3 USB Download mode quirk and update comments
      on all the other Renesas R-Car USB Download mode quirks to discern
      them from each other. This follows R-Car Series, 3rd Generation
      reference manual Rev.2.00 chapter 19.2.8 USB download mode .
      
      Fixes: 6d853c9e ("usb: cdc-acm: Add DISABLE_ECHO for Renesas USB Download mode")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@mailbox.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20250209145708.106914-1-marek.vasut+renesas@mailbox.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5461d10c
    • Alan Stern's avatar
      USB: hub: Ignore non-compliant devices with too many configs or interfaces · 139e4e2f
      Alan Stern authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 2240fed37afbcdb5e8b627bc7ad986891100e05d upstream.
      
      Robert Morris created a test program which can cause
      usb_hub_to_struct_hub() to dereference a NULL or inappropriate
      pointer:
      
      Oops: general protection fault, probably for non-canonical address
      0xcccccccccccccccc: 0000 [#1] SMP DEBUG_PAGEALLOC PTI
      CPU: 7 UID: 0 PID: 117 Comm: kworker/7:1 Not tainted 6.13.0-rc3-00017-gf44d154d6e3d #14
      Hardware name: FreeBSD BHYVE/BHYVE, BIOS 14.0 10/17/2021
      Workqueue: usb_hub_wq hub_event
      RIP: 0010:usb_hub_adjust_deviceremovable+0x78/0x110
      ...
      Call Trace:
       <TASK>
       ? die_addr+0x31/0x80
       ? exc_general_protection+0x1b4/0x3c0
       ? asm_exc_general_protection+0x26/0x30
       ? usb_hub_adjust_deviceremovable+0x78/0x110
       hub_probe+0x7c7/0xab0
       usb_probe_interface+0x14b/0x350
       really_probe+0xd0/0x2d0
       ? __pfx___device_attach_driver+0x10/0x10
       __driver_probe_device+0x6e/0x110
       driver_probe_device+0x1a/0x90
       __device_attach_driver+0x7e/0xc0
       bus_for_each_drv+0x7f/0xd0
       __device_attach+0xaa/0x1a0
       bus_probe_device+0x8b/0xa0
       device_add+0x62e/0x810
       usb_set_configuration+0x65d/0x990
       usb_generic_driver_probe+0x4b/0x70
       usb_probe_device+0x36/0xd0
      
      The cause of this error is that the device has two interfaces, and the
      hub driver binds to interface 1 instead of interface 0, which is where
      usb_hub_to_struct_hub() looks.
      
      We can prevent the problem from occurring by refusing to accept hub
      devices that violate the USB spec by having more than one
      configuration or interface.
      
      Reported-and-tested-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Cc: stable <stable@kernel.org>
      Closes: https://lore.kernel.org/linux-usb/95564.1737394039@localhost/
      
      
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/c27f3bf4-63d8-4fb5-ac82-09e3cd19f61c@rowland.harvard.edu
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      139e4e2f
    • John Keeping's avatar
      usb: gadget: f_midi: fix MIDI Streaming descriptor lengths · 7d97bb1b
      John Keeping authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit da1668997052ed1cb00322e1f3b63702615c9429 upstream.
      
      While the MIDI jacks are configured correctly, and the MIDIStreaming
      endpoint descriptors are filled with the correct information,
      bNumEmbMIDIJack and bLength are set incorrectly in these descriptors.
      
      This does not matter when the numbers of in and out ports are equal, but
      when they differ the host will receive broken descriptors with
      uninitialized stack memory leaking into the descriptor for whichever
      value is smaller.
      
      The precise meaning of "in" and "out" in the port counts is not clearly
      defined and can be confusing.  But elsewhere the driver consistently
      uses this to match the USB meaning of IN and OUT viewed from the host,
      so that "in" ports send data to the host and "out" ports receive data
      from it.
      
      Cc: stable <stable@kernel.org>
      Fixes: c8933c3f ("USB: gadget: f_midi: allow a dynamic number of input and output ports")
      Signed-off-by: default avatarJohn Keeping <jkeeping@inmusicbrands.com>
      Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20250130195035.3883857-1-jkeeping@inmusicbrands.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7d97bb1b
    • Mathias Nyman's avatar
      USB: Add USB_QUIRK_NO_LPM quirk for sony xperia xz1 smartphone · c3288b38
      Mathias Nyman authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 159daf1258227f44b26b5d38f4aa8f37b8cca663 upstream.
      
      The fastboot tool for communicating with Android bootloaders does not
      work reliably with this device if USB 2 Link Power Management (LPM)
      is enabled.
      
      Various fastboot commands are affected, including the
      following, which usually reproduces the problem within two tries:
      
        fastboot getvar kernel
        getvar:kernel  FAILED (remote: 'GetVar Variable Not found')
      
      This issue was hidden on many systems up until commit 63a1f845
      ("xhci: stored cached port capability values in one place") as the xhci
      driver failed to detect USB 2 LPM support if USB 3 ports were listed
      before USB 2 ports in the "supported protocol capabilities".
      
      Adding the quirk resolves the issue. No drawbacks are expected since
      the device uses different USB product IDs outside of fastboot mode, and
      since fastboot commands worked before, until LPM was enabled on the
      tested system by the aforementioned commit.
      
      Based on a patch from Forest <forestix@nom.one> from which most of the
      code and commit message is taken.
      
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarForest <forestix@nom.one>
      Closes: https://lore.kernel.org/hk8umj9lv4l4qguftdq1luqtdrpa1gks5l@sonic.net
      
      
      Tested-by: default avatarForest <forestix@nom.one>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20250206151836.51742-1-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3288b38
    • Lei Huang's avatar
      USB: quirks: add USB_QUIRK_NO_LPM quirk for Teclast dist · 38ed321b
      Lei Huang authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit e169d96eecd447ff7fd7542ca5fa0911f5622054 upstream.
      
      Teclast disk used on Huawei hisi platforms doesn't work well,
      losing connectivity intermittently if LPM is enabled.
      Add quirk disable LPM to resolve the issue.
      
      Signed-off-by: default avatarLei Huang <huanglei@kylinos.cn>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20250212093829.7379-1-huanglei814@163.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38ed321b
    • Stefan Eichenberger's avatar
      usb: core: fix pipe creation for get_bMaxPacketSize0 · 42349a91
      Stefan Eichenberger authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 4aac0db5a0ebc599d4ad9bf5ebab78afa1f33e10 upstream.
      
      When usb_control_msg is used in the get_bMaxPacketSize0 function, the
      USB pipe does not include the endpoint device number. This can cause
      failures when a usb hub port is reinitialized after encountering a bad
      cable connection. As a result, the system logs the following error
      messages:
      usb usb2-port1: cannot reset (err = -32)
      usb usb2-port1: Cannot enable. Maybe the USB cable is bad?
      usb usb2-port1: attempt power cycle
      usb 2-1: new high-speed USB device number 5 using ci_hdrc
      usb 2-1: device descriptor read/8, error -71
      
      The problem began after commit 85d07c55 ("USB: core: Unite old
      scheme and new scheme descriptor reads"). There
      usb_get_device_descriptor was replaced with get_bMaxPacketSize0. Unlike
      usb_get_device_descriptor, the get_bMaxPacketSize0 function uses the
      macro usb_rcvaddr0pipe, which does not include the endpoint device
      number. usb_get_device_descriptor, on the other hand, used the macro
      usb_rcvctrlpipe, which includes the endpoint device number.
      
      By modifying the get_bMaxPacketSize0 function to use usb_rcvctrlpipe
      instead of usb_rcvaddr0pipe, the issue can be resolved. This change will
      ensure that the endpoint device number is included in the USB pipe,
      preventing reinitialization failures. If the endpoint has not set the
      device number yet, it will still work because the device number is 0 in
      udev.
      
      Cc: stable <stable@kernel.org>
      Fixes: 85d07c55 ("USB: core: Unite old scheme and new scheme descriptor reads")
      Signed-off-by: default avatarStefan Eichenberger <stefan.eichenberger@toradex.com>
      Reviewed-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20250203105840.17539-1-eichest@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42349a91
    • Huacai Chen's avatar
      USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI · 1e27bb0b
      Huacai Chen authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit e71f7f42e3c874ac3314b8f250e8416a706165af upstream.
      
      LS7A EHCI controller doesn't have extended capabilities, so the EECP
      (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
      be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
      fixed in future, now just clear the EECP field to avoid error messages
      on boot:
      
      ......
      [    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
      [    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
      [    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
      [    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
      ......
      [    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
      [    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
      [    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
      [    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
      ......
      
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarBaoqi Zhang <zhangbaoqi@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      Link: https://lore.kernel.org/r/20250202124935.480500-1-chenhuacai@loongson.cn
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e27bb0b
    • Fabrice Gasnier's avatar
      usb: dwc2: gadget: remove of_node reference upon udc_stop · 4cbb0210
      Fabrice Gasnier authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 58cd423820d5b5610977e55e4acdd06628829ede upstream.
      
      In dwc2_hsotg_udc_start(), e.g. when binding composite driver, "of_node"
      is set to hsotg->dev->of_node.
      
      It causes errors when binding the gadget driver several times, on
      stm32mp157c-ev1 board. Below error is seen:
      "pin PA10 already requested by 49000000.usb-otg; cannot claim for gadget.0"
      
      The first time, no issue is seen as when registering the driver, of_node
      isn't NULL:
      -> gadget_dev_desc_UDC_store
        -> usb_gadget_register_driver_owner
          -> driver_register
          ...
            -> really_probe -> pinctrl_bind_pins (no effect)
      
      Then dwc2_hsotg_udc_start() sets of_node.
      
      The second time (stop the gadget, reconfigure it, then start it again),
      of_node has been set, so the probing code tries to acquire pins for the
      gadget. These pins are hold by the controller, hence the error.
      
      So clear gadget.dev.of_node in udc_stop() routine to avoid the issue.
      
      Fixes: 7d7b2292 ("usb: gadget: s3c-hsotg: Propagate devicetree to gadget drivers")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@foss.st.com>
      Link: https://lore.kernel.org/r/20250124173325.2747710-1-fabrice.gasnier@foss.st.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4cbb0210
    • Guo Ren's avatar
      usb: gadget: udc: renesas_usb3: Fix compiler warning · f66f63b1
      Guo Ren authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 335a1fc1193481f8027f176649c72868172f6f8b upstream.
      
      drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':
      drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d'
      directive output may be truncated writing between 1 and 11 bytes into a
      region of size 6 [-Wformat-truncation=]
      2638 |   snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
                                          ^~~~~~~~~~~~~~~~~~~~~~~~     ^~   ^
      
      Fixes: 746bfe63 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202501201409.BIQPtkeB-lkp@intel.com/
      
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      Link: https://lore.kernel.org/r/20250122081231.47594-1-guoren@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f66f63b1
    • Elson Roy Serrao's avatar
      usb: roles: set switch registered flag early on · 113c17d0
      Elson Roy Serrao authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 634775a752a86784511018a108f3b530cc3399a7 upstream.
      
      The role switch registration and set_role() can happen in parallel as they
      are invoked independent of each other. There is a possibility that a driver
      might spend significant amount of time in usb_role_switch_register() API
      due to the presence of time intensive operations like component_add()
      which operate under common mutex. This leads to a time window after
      allocating the switch and before setting the registered flag where the set
      role notifications are dropped. Below timeline summarizes this behavior
      
      Thread1				|	Thread2
      usb_role_switch_register()	|
      	|			|
      	---> allocate switch	|
      	|			|
      	---> component_add()	|	usb_role_switch_set_role()
      	|			|	|
      	|			|	--> Drop role notifications
      	|			|	    since sw->registered
      	|			|	    flag is not set.
      	|			|
      	--->Set registered flag.|
      
      To avoid this, set the registered flag early on in the switch register
      API.
      
      Fixes: b787a3e7 ("usb: roles: don't get/set_role() when usb_role_switch is unregistered")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarElson Roy Serrao <quic_eserrao@quicinc.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Link: https://lore.kernel.org/r/20250206193950.22421-1-quic_eserrao@quicinc.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      113c17d0
    • Selvarasu Ganesan's avatar
      usb: dwc3: Fix timeout issue during controller enter/exit from halt state · 24e76da0
      Selvarasu Ganesan authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit d3a8c28426fc1fb3252753a9f1db0d691ffc21b0 upstream.
      
      There is a frequent timeout during controller enter/exit from halt state
      after toggling the run_stop bit by SW. This timeout occurs when
      performing frequent role switches between host and device, causing
      device enumeration issues due to the timeout. This issue was not present
      when USB2 suspend PHY was disabled by passing the SNPS quirks
      (snps,dis_u2_susphy_quirk and snps,dis_enblslpm_quirk) from the DTS.
      However, there is a requirement to enable USB2 suspend PHY by setting of
      GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY bits when controller starts
      in gadget or host mode results in the timeout issue.
      
      This commit addresses this timeout issue by ensuring that the bits
      GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY are cleared before starting
      the dwc3_gadget_run_stop sequence and restoring them after the
      dwc3_gadget_run_stop sequence is completed.
      
      Fixes: 72246da4 ("usb: Introduce DesignWare USB3 DRD Driver")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarSelvarasu Ganesan <selvarasu.g@samsung.com>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/20250201163903.459-1-selvarasu.g@samsung.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24e76da0
    • Sean Christopherson's avatar
      perf/x86/intel: Ensure LBRs are disabled when a CPU is starting · be26c0c8
      Sean Christopherson authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit c631a2de7ae48d50434bdc205d901423f8577c65 upstream.
      
      Explicitly clear DEBUGCTL.LBR when a CPU is starting, prior to purging the
      LBR MSRs themselves, as at least one system has been found to transfer
      control to the kernel with LBRs enabled (it's unclear whether it's a BIOS
      flaw or a CPU goof).  Because the kernel preserves the original DEBUGCTL,
      even when toggling LBRs, leaving DEBUGCTL.LBR as is results in running
      with LBRs enabled at all times.
      
      Closes: https://lore.kernel.org/all/c9d8269bff69f6359731d758e3b1135dedd7cc61.camel@redhat.com
      
      
      Reported-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20250131010721.470503-1-seanjc@google.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be26c0c8
    • Sean Christopherson's avatar
      KVM: nSVM: Enter guest mode before initializing nested NPT MMU · 28c417ad
      Sean Christopherson authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 46d6c6f3ef0eaff71c2db6d77d4e2ebb7adac34f upstream.
      
      When preparing vmcb02 for nested VMRUN (or state restore), "enter" guest
      mode prior to initializing the MMU for nested NPT so that guest_mode is
      set in the MMU's role.  KVM's model is that all L2 MMUs are tagged with
      guest_mode, as the behavior of hypervisor MMUs tends to be significantly
      different than kernel MMUs.
      
      Practically speaking, the bug is relatively benign, as KVM only directly
      queries role.guest_mode in kvm_mmu_free_guest_mode_roots() and
      kvm_mmu_page_ad_need_write_protect(), which SVM doesn't use, and in paths
      that are optimizations (mmu_page_zap_pte() and
      shadow_mmu_try_split_huge_pages()).
      
      And while the role is incorprated into shadow page usage, because nested
      NPT requires KVM to be using NPT for L1, reusing shadow pages across L1
      and L2 is impossible as L1 MMUs will always have direct=1, while L2 MMUs
      will have direct=0.
      
      Hoist the TLB processing and setting of HF_GUEST_MASK to the beginning
      of the flow instead of forcing guest_mode in the MMU, as nothing in
      nested_vmcb02_prepare_control() between the old and new locations touches
      TLB flush requests or HF_GUEST_MASK, i.e. there's no reason to present
      inconsistent vCPU state to the MMU.
      
      Fixes: 69cb8774 ("KVM: nSVM: move MMU setup to nested_prepare_vmcb_control")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarYosry Ahmed <yosry.ahmed@linux.dev>
      Reviewed-by: default avatarYosry Ahmed <yosry.ahmed@linux.dev>
      Link: https://lore.kernel.org/r/20250130010825.220346-1-seanjc@google.com
      
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28c417ad
    • Sean Christopherson's avatar
      KVM: x86: Reject Hyper-V's SEND_IPI hypercalls if local APIC isn't in-kernel · 2a9a86bc
      Sean Christopherson authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit a8de7f100bb5989d9c3627d3a223ee1c863f3b69 upstream.
      
      Advertise support for Hyper-V's SEND_IPI and SEND_IPI_EX hypercalls if and
      only if the local API is emulated/virtualized by KVM, and explicitly reject
      said hypercalls if the local APIC is emulated in userspace, i.e. don't rely
      on userspace to opt-in to KVM_CAP_HYPERV_ENFORCE_CPUID.
      
      Rejecting SEND_IPI and SEND_IPI_EX fixes a NULL-pointer dereference if
      Hyper-V enlightenments are exposed to the guest without an in-kernel local
      APIC:
      
        dump_stack+0xbe/0xfd
        __kasan_report.cold+0x34/0x84
        kasan_report+0x3a/0x50
        __apic_accept_irq+0x3a/0x5c0
        kvm_hv_send_ipi.isra.0+0x34e/0x820
        kvm_hv_hypercall+0x8d9/0x9d0
        kvm_emulate_hypercall+0x506/0x7e0
        __vmx_handle_exit+0x283/0xb60
        vmx_handle_exit+0x1d/0xd0
        vcpu_enter_guest+0x16b0/0x24c0
        vcpu_run+0xc0/0x550
        kvm_arch_vcpu_ioctl_run+0x170/0x6d0
        kvm_vcpu_ioctl+0x413/0xb20
        __se_sys_ioctl+0x111/0x160
        do_syscal1_64+0x30/0x40
        entry_SYSCALL_64_after_hwframe+0x67/0xd1
      
      Note, checking the sending vCPU is sufficient, as the per-VM irqchip_mode
      can't be modified after vCPUs are created, i.e. if one vCPU has an
      in-kernel local APIC, then all vCPUs have an in-kernel local APIC.
      
      Reported-by: default avatarDongjie Zou <zoudongjie@huawei.com>
      Fixes: 214ff83d ("KVM: x86: hyperv: implement PV IPI send hypercalls")
      Fixes: 2bc39970 ("x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Link: https://lore.kernel.org/r/20250118003454.2619573-2-seanjc@google.com
      
      
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a9a86bc
    • Jiang Liu's avatar
      drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table() · 1ea779cb
      Jiang Liu authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 1abb2648698bf10783d2236a6b4a7ca5e8021699 upstream.
      
      It malicious user provides a small pptable through sysfs and then
      a bigger pptable, it may cause buffer overflow attack in function
      smu_sys_set_pp_table().
      
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarJiang Liu <gerry@linux.alibaba.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ea779cb
    • Sven Eckelmann's avatar
      batman-adv: Drop unmanaged ELP metric worker · 7594018d
      Sven Eckelmann authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit 8c8ecc98f5c65947b0070a24bac11e12e47cc65d upstream.
      
      The ELP worker needs to calculate new metric values for all neighbors
      "reachable" over an interface. Some of the used metric sources require
      locks which might need to sleep. This sleep is incompatible with the RCU
      list iterator used for the recorded neighbors. The initial approach to work
      around of this problem was to queue another work item per neighbor and then
      run this in a new context.
      
      Even when this solved the RCU vs might_sleep() conflict, it has a major
      problems: Nothing was stopping the work item in case it is not needed
      anymore - for example because one of the related interfaces was removed or
      the batman-adv module was unloaded - resulting in potential invalid memory
      accesses.
      
      Directly canceling the metric worker also has various problems:
      
      * cancel_work_sync for a to-be-deactivated interface is called with
        rtnl_lock held. But the code in the ELP metric worker also tries to use
        rtnl_lock() - which will never return in this case. This also means that
        cancel_work_sync would never return because it is waiting for the worker
        to finish.
      * iterating over the neighbor list for the to-be-deactivated interface is
        currently done using the RCU specific methods. Which means that it is
        possible to miss items when iterating over it without the associated
        spinlock - a behaviour which is acceptable for a periodic metric check
        but not for a cleanup routine (which must "stop" all still running
        workers)
      
      The better approch is to get rid of the per interface neighbor metric
      worker and handle everything in the interface worker. The original problems
      are solved by:
      
      * creating a list of neighbors which require new metric information inside
        the RCU protected context, gathering the metric according to the new list
        outside the RCU protected context
      * only use rcu_trylock inside metric gathering code to avoid a deadlock
        when the cancel_delayed_work_sync is called in the interface removal code
        (which is called with the rtnl_lock held)
      
      Cc: stable@vger.kernel.org
      Fixes: c833484e ("batman-adv: ELP - compute the metric based on the estimated throughput")
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7594018d
    • Sven Eckelmann's avatar
      batman-adv: Ignore neighbor throughput metrics in error case · 5e5ca2f6
      Sven Eckelmann authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit e7e34ffc976aaae4f465b7898303241b81ceefc3 upstream.
      
      If a temporary error happened in the evaluation of the neighbor throughput
      information, then the invalid throughput result should not be stored in the
      throughtput EWMA.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e5ca2f6
    • Andy Strohman's avatar
      batman-adv: fix panic during interface removal · 02039d41
      Andy Strohman authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      commit ccb7276a6d26d6f8416e315b43b45e15ee7f29e2 upstream.
      
      Reference counting is used to ensure that
      batadv_hardif_neigh_node and batadv_hard_iface
      are not freed before/during
      batadv_v_elp_throughput_metric_update work is
      finished.
      
      But there isn't a guarantee that the hard if will
      remain associated with a soft interface up until
      the work is finished.
      
      This fixes a crash triggered by reboot that looks
      like this:
      
      Call trace:
       batadv_v_mesh_free+0xd0/0x4dc [batman_adv]
       batadv_v_elp_throughput_metric_update+0x1c/0xa4
       process_one_work+0x178/0x398
       worker_thread+0x2e8/0x4d0
       kthread+0xd8/0xdc
       ret_from_fork+0x10/0x20
      
      (the batadv_v_mesh_free call is misleading,
      and does not actually happen)
      
      I was able to make the issue happen more reliably
      by changing hardif_neigh->bat_v.metric_work work
      to be delayed work. This allowed me to track down
      and confirm the fix.
      
      Cc: stable@vger.kernel.org
      Fixes: c833484e ("batman-adv: ELP - compute the metric based on the estimated throughput")
      Signed-off-by: default avatarAndy Strohman <andrew@andrewstrohman.com>
      [sven@narfation.org: prevent entering batadv_v_elp_get_throughput without
       soft_iface]
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02039d41
    • Hans de Goede's avatar
      ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V · 1428a18a
      Hans de Goede authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit 6917192378c1ce17ba31df51c4e0d8b1c97a453b ]
      
      The Vexia EDU ATLA 10 tablet comes in 2 different versions with
      significantly different mainboards. The only outward difference is that
      the charging barrel on one is marked 5V and the other is marked 9V.
      
      The 5V version mostly works with the BYTCR defaults, except that it is
      missing a CHAN package in its ACPI tables and the default of using
      SSP0-AIF2 is wrong, instead SSP0-AIF1 must be used. That and its jack
      detect signal is not inverted as it usually is.
      
      Add a DMI quirk for the 5V version to fix sound not working.
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://patch.msgid.link/20250123132507.18434-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1428a18a
    • Mike Marshall's avatar
      orangefs: fix a oob in orangefs_debug_write · fdbd8147
      Mike Marshall authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ]
      
      I got a syzbot report: slab-out-of-bounds Read in
      orangefs_debug_write... several people suggested fixes,
      I tested Al Viro's suggestion and made this patch.
      
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      Reported-by: default avatar <syzbot+fc519d7875f2d9186c1f@syzkaller.appspotmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fdbd8147
    • Rik van Riel's avatar
      x86/mm/tlb: Only trim the mm_cpumask once a second · f43b46cc
      Rik van Riel authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit 6db2526c1d694c91c6e05e2f186c085e9460f202 ]
      
      Setting and clearing CPU bits in the mm_cpumask is only ever done
      by the CPU itself, from the context switch code or the TLB flush
      code.
      
      Synchronization is handled by switch_mm_irqs_off() blocking interrupts.
      
      Sending TLB flush IPIs to CPUs that are in the mm_cpumask, but no
      longer running the program causes a regression in the will-it-scale
      tlbflush2 test. This test is contrived, but a large regression here
      might cause a small regression in some real world workload.
      
      Instead of always sending IPIs to CPUs that are in the mm_cpumask,
      but no longer running the program, send these IPIs only once a second.
      
      The rest of the time we can skip over CPUs where the loaded_mm is
      different from the target mm.
      
      Reported-by: default avatarkernel test roboto <oliver.sang@intel.com>
      Signed-off-by: default avatarRik van Riel <riel@surriel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lore.kernel.org/r/20241204210316.612ee573@fangorn
      Closes: https://lore.kernel.org/oe-lkp/202411282207.6bd28eae-lkp@intel.com/
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f43b46cc
    • Koichiro Den's avatar
      selftests: gpio: gpio-sim: Fix missing chip disablements · 2e4e97dd
      Koichiro Den authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit f8524ac33cd452aef5384504b3264db6039a455e ]
      
      Since upstream commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an
      instantiated device depends on"), rmdir for an active virtual devices
      been prohibited.
      
      Update gpio-sim selftest to align with the change.
      
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Closes: https://lore.kernel.org/oe-lkp/202501221006.a1ca5dfa-lkp@intel.com
      
      
      Signed-off-by: default avatarKoichiro Den <koichiro.den@canonical.com>
      Link: https://lore.kernel.org/r/20250122043309.304621-1-koichiro.den@canonical.com
      
      
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2e4e97dd
    • Maksym Planeta's avatar
      Grab mm lock before grabbing pt lock · 4ece5b06
      Maksym Planeta authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit 6d002348789bc16e9203e9818b7a3688787e3b29 ]
      
      Function xen_pin_page calls xen_pte_lock, which in turn grab page
      table lock (ptlock). When locking, xen_pte_lock expect mm->page_table_lock
      to be held before grabbing ptlock, but this does not happen when pinning
      is caused by xen_mm_pin_all.
      
      This commit addresses lockdep warning below, which shows up when
      suspending a Xen VM.
      
      [ 3680.658422] Freezing user space processes
      [ 3680.660156] Freezing user space processes completed (elapsed 0.001 seconds)
      [ 3680.660182] OOM killer disabled.
      [ 3680.660192] Freezing remaining freezable tasks
      [ 3680.661485] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
      [ 3680.685254]
      [ 3680.685265] ==================================
      [ 3680.685269] WARNING: Nested lock was not taken
      [ 3680.685274] 6.12.0+ #16 Tainted: G        W
      [ 3680.685279] ----------------------------------
      [ 3680.685283] migration/0/19 is trying to lock:
      [ 3680.685288] ffff88800bac33c0 (ptlock_ptr(ptdesc)#2){+.+.}-{3:3}, at: xen_pin_page+0x175/0x1d0
      [ 3680.685303]
      [ 3680.685303] but this task is not holding:
      [ 3680.685308] init_mm.page_table_lock
      [ 3680.685311]
      [ 3680.685311] stack backtrace:
      [ 3680.685316] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G        W          6.12.0+ #16
      [ 3680.685324] Tainted: [W]=WARN
      [ 3680.685328] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
      [ 3680.685339] Call Trace:
      [ 3680.685344]  <TASK>
      [ 3680.685347]  dump_stack_lvl+0x77/0xb0
      [ 3680.685356]  __lock_acquire+0x917/0x2310
      [ 3680.685364]  lock_acquire+0xce/0x2c0
      [ 3680.685369]  ? xen_pin_page+0x175/0x1d0
      [ 3680.685373]  _raw_spin_lock_nest_lock+0x2f/0x70
      [ 3680.685381]  ? xen_pin_page+0x175/0x1d0
      [ 3680.685386]  xen_pin_page+0x175/0x1d0
      [ 3680.685390]  ? __pfx_xen_pin_page+0x10/0x10
      [ 3680.685394]  __xen_pgd_walk+0x233/0x2c0
      [ 3680.685401]  ? stop_one_cpu+0x91/0x100
      [ 3680.685405]  __xen_pgd_pin+0x5d/0x250
      [ 3680.685410]  xen_mm_pin_all+0x70/0xa0
      [ 3680.685415]  xen_pv_pre_suspend+0xf/0x280
      [ 3680.685420]  xen_suspend+0x57/0x1a0
      [ 3680.685428]  multi_cpu_stop+0x6b/0x120
      [ 3680.685432]  ? update_cpumasks_hier+0x7c/0xa60
      [ 3680.685439]  ? __pfx_multi_cpu_stop+0x10/0x10
      [ 3680.685443]  cpu_stopper_thread+0x8c/0x140
      [ 3680.685448]  ? smpboot_thread_fn+0x20/0x1f0
      [ 3680.685454]  ? __pfx_smpboot_thread_fn+0x10/0x10
      [ 3680.685458]  smpboot_thread_fn+0xed/0x1f0
      [ 3680.685462]  kthread+0xde/0x110
      [ 3680.685467]  ? __pfx_kthread+0x10/0x10
      [ 3680.685471]  ret_from_fork+0x2f/0x50
      [ 3680.685478]  ? __pfx_kthread+0x10/0x10
      [ 3680.685482]  ret_from_fork_asm+0x1a/0x30
      [ 3680.685489]  </TASK>
      [ 3680.685491]
      [ 3680.685491] other info that might help us debug this:
      [ 3680.685497] 1 lock held by migration/0/19:
      [ 3680.685500]  #0: ffffffff8284df38 (pgd_lock){+.+.}-{3:3}, at: xen_mm_pin_all+0x14/0xa0
      [ 3680.685512]
      [ 3680.685512] stack backtrace:
      [ 3680.685518] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G        W          6.12.0+ #16
      [ 3680.685528] Tainted: [W]=WARN
      [ 3680.685531] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
      [ 3680.685538] Call Trace:
      [ 3680.685541]  <TASK>
      [ 3680.685544]  dump_stack_lvl+0x77/0xb0
      [ 3680.685549]  __lock_acquire+0x93c/0x2310
      [ 3680.685554]  lock_acquire+0xce/0x2c0
      [ 3680.685558]  ? xen_pin_page+0x175/0x1d0
      [ 3680.685562]  _raw_spin_lock_nest_lock+0x2f/0x70
      [ 3680.685568]  ? xen_pin_page+0x175/0x1d0
      [ 3680.685572]  xen_pin_page+0x175/0x1d0
      [ 3680.685578]  ? __pfx_xen_pin_page+0x10/0x10
      [ 3680.685582]  __xen_pgd_walk+0x233/0x2c0
      [ 3680.685588]  ? stop_one_cpu+0x91/0x100
      [ 3680.685592]  __xen_pgd_pin+0x5d/0x250
      [ 3680.685596]  xen_mm_pin_all+0x70/0xa0
      [ 3680.685600]  xen_pv_pre_suspend+0xf/0x280
      [ 3680.685607]  xen_suspend+0x57/0x1a0
      [ 3680.685611]  multi_cpu_stop+0x6b/0x120
      [ 3680.685615]  ? update_cpumasks_hier+0x7c/0xa60
      [ 3680.685620]  ? __pfx_multi_cpu_stop+0x10/0x10
      [ 3680.685625]  cpu_stopper_thread+0x8c/0x140
      [ 3680.685629]  ? smpboot_thread_fn+0x20/0x1f0
      [ 3680.685634]  ? __pfx_smpboot_thread_fn+0x10/0x10
      [ 3680.685638]  smpboot_thread_fn+0xed/0x1f0
      [ 3680.685642]  kthread+0xde/0x110
      [ 3680.685645]  ? __pfx_kthread+0x10/0x10
      [ 3680.685649]  ret_from_fork+0x2f/0x50
      [ 3680.685654]  ? __pfx_kthread+0x10/0x10
      [ 3680.685657]  ret_from_fork_asm+0x1a/0x30
      [ 3680.685662]  </TASK>
      [ 3680.685267] xen:grant_table: Grant tables using version 1 layout
      [ 3680.685921] OOM killer enabled.
      [ 3680.685934] Restarting tasks ... done.
      
      Signed-off-by: default avatarMaksym Planeta <maksym@exostellar.io>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Message-ID: <20241204103516.3309112-1-maksym@exostellar.io>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4ece5b06
Loading