Skip to content
  1. Dec 08, 2023
    • Greg Kroah-Hartman's avatar
      Linux 4.19.301 · 3e205b99
      Greg Kroah-Hartman authored
      
      
      Link: https://lore.kernel.org/r/20231205031517.859409664@linuxfoundation.org
      Tested-by: default avatarPavel Machek (CIP) <pavel@denx.de>
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20231205183236.587197010@linuxfoundation.org
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      v4.19.301
      3e205b99
    • Adrian Hunter's avatar
      mmc: block: Retry commands in CQE error recovery · d8b6dca8
      Adrian Hunter authored
      [ Upstream commit 8155d1fa ]
      
      It is important that MMC_CMDQ_TASK_MGMT command to discard the queue is
      successful because otherwise a subsequent reset might fail to flush the
      cache first.  Retry it and the previous STOP command.
      
      Fixes: 72a5af55
      
       ("mmc: core: Add support for handling CQE requests")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Link: https://lore.kernel.org/r/20231103084720.6886-5-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d8b6dca8
    • Zheng Yongjun's avatar
      mmc: core: convert comma to semicolon · 33805cd0
      Zheng Yongjun authored
      [ Upstream commit 6b1dc622
      
       ]
      
      Replace a comma between expression statements by a semicolon.
      
      Signed-off-by: default avatarZheng Yongjun <zhengyongjun3@huawei.com>
      Link: https://lore.kernel.org/r/20201216131737.14883-1-zhengyongjun3@huawei.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Stable-dep-of: 8155d1fa
      
       ("mmc: block: Retry commands in CQE error recovery")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      33805cd0
    • Adrian Hunter's avatar
      mmc: cqhci: Fix task clearing in CQE error recovery · 7e2d70c9
      Adrian Hunter authored
      [ Upstream commit 1de1b779 ]
      
      If a task completion notification (TCN) is received when there is no
      outstanding task, the cqhci driver issues a "spurious TCN" warning. This
      was observed to happen right after CQE error recovery.
      
      When an error interrupt is received the driver runs recovery logic.
      It halts the controller, clears all pending tasks, and then re-enables
      it. On some platforms, like Intel Jasper Lake, a stale task completion
      event was observed, regardless of the CQHCI_CLEAR_ALL_TASKS bit being set.
      
      This results in either:
      a) Spurious TC completion event for an empty slot.
      b) Corrupted data being passed up the stack, as a result of premature
         completion for a newly added task.
      
      Rather than add a quirk for affected controllers, ensure tasks are cleared
      by toggling CQHCI_ENABLE, which would happen anyway if
      cqhci_clear_all_tasks() timed out. This is simpler and should be safe and
      effective for all controllers.
      
      Fixes: a4080225
      
       ("mmc: cqhci: support for command queue enabled host")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarKornel Dulęba <korneld@chromium.org>
      Tested-by: default avatarKornel Dulęba <korneld@chromium.org>
      Co-developed-by: default avatarKornel Dulęba <korneld@chromium.org>
      Signed-off-by: default avatarKornel Dulęba <korneld@chromium.org>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Link: https://lore.kernel.org/r/20231103084720.6886-7-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7e2d70c9
    • Adrian Hunter's avatar
      mmc: cqhci: Warn of halt or task clear failure · 3e9b5ab3
      Adrian Hunter authored
      [ Upstream commit 35597bdb ]
      
      A correctly operating controller should successfully halt and clear tasks.
      Failure may result in errors elsewhere, so promote messages from debug to
      warnings.
      
      Fixes: a4080225
      
       ("mmc: cqhci: support for command queue enabled host")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Link: https://lore.kernel.org/r/20231103084720.6886-6-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e9b5ab3
    • Adrian Hunter's avatar
      mmc: cqhci: Increase recovery halt timeout · 6f9082c7
      Adrian Hunter authored
      [ Upstream commit b578d5d1 ]
      
      Failing to halt complicates the recovery. Additionally, unless the card or
      controller are stuck, which is expected to be very rare, then the halt
      should succeed, so it is better to wait. Set a large timeout.
      
      Fixes: a4080225
      
       ("mmc: cqhci: support for command queue enabled host")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Link: https://lore.kernel.org/r/20231103084720.6886-3-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6f9082c7
    • Christoph Niedermaier's avatar
      cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily · 212da1ac
      Christoph Niedermaier authored
      [ Upstream commit 2e4e0984 ]
      
      For a 900MHz i.MX6ULL CPU the 792MHz OPP is disabled. There is no
      convincing reason to disable this OPP. If a CPU can run at 900MHz,
      it should also be able to cope with 792MHz. Looking at the voltage
      level of 792MHz in [1] (page 24, table 10. "Operating Ranges") the
      current defined OPP is above the minimum. So the voltage level
      shouldn't be a problem. However in [2] (page 24, table 10.
      "Operating Ranges"), it is not mentioned that 792MHz OPP isn't
      allowed. Change it to only disable 792MHz OPP for i.MX6ULL types
      below 792 MHz.
      
      [1] https://www.nxp.com/docs/en/data-sheet/IMX6ULLIEC.pdf
      [2] https://www.nxp.com/docs/en/data-sheet/IMX6ULLCEC.pdf
      
      Fixes: 0aa9abd4
      
       ("cpufreq: imx6q: check speed grades for i.MX6ULL")
      Signed-off-by: default avatarChristoph Niedermaier <cniedermaier@dh-electronics.com>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      Reviewed-by: default avatarFabio Estevam <festevam@denx.de>
      [ Viresh: Edited subject ]
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      212da1ac
    • Christoph Niedermaier's avatar
      cpufreq: imx6q: don't warn for disabling a non-existing frequency · 46ddcc75
      Christoph Niedermaier authored
      [ Upstream commit 11a3b0ac
      
       ]
      
      It is confusing if a warning is given for disabling a non-existent
      frequency of the operating performance points (OPP). In this case
      the function dev_pm_opp_disable() returns -ENODEV. Check the return
      value and avoid the output of a warning in this case. Avoid code
      duplication by using a separate function.
      
      Signed-off-by: default avatarChristoph Niedermaier <cniedermaier@dh-electronics.com>
      [ Viresh : Updated commit subject ]
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Stable-dep-of: 2e4e0984
      
       ("cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      46ddcc75
    • Mimi Zohar's avatar
      ima: detect changes to the backing overlay file · 904f9c14
      Mimi Zohar authored
      [ Upstream commit b836c4d2 ]
      
      Commit 18b44bc5
      
       ("ovl: Always reevaluate the file signature for
      IMA") forced signature re-evaulation on every file access.
      
      Instead of always re-evaluating the file's integrity, detect a change
      to the backing file, by comparing the cached file metadata with the
      backing file's metadata.  Verifying just the i_version has not changed
      is insufficient.  In addition save and compare the i_ino and s_dev
      as well.
      
      Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Tested-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Tested-by: default avatarRaul E Rangel <rrangel@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      904f9c14
    • Konstantin Khlebnikov's avatar
      ovl: skip overlayfs superblocks at global sync · 410fb31d
      Konstantin Khlebnikov authored
      [ Upstream commit 32b1924b
      
       ]
      
      Stacked filesystems like overlayfs has no own writeback, but they have to
      forward syncfs() requests to backend for keeping data integrity.
      
      During global sync() each overlayfs instance calls method ->sync_fs() for
      backend although it itself is in global list of superblocks too.  As a
      result one syscall sync() could write one superblock several times and send
      multiple disk barriers.
      
      This patch adds flag SB_I_SKIP_SYNC into sb->sb_iflags to avoid that.
      
      Reported-by: default avatarDmitry Monakhov <dmtrmonakhov@yandex-team.ru>
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Stable-dep-of: b836c4d2
      
       ("ima: detect changes to the backing overlay file")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      410fb31d
    • Amir Goldstein's avatar
      ima: annotate iint mutex to avoid lockdep false positive warnings · 04e3ec93
      Amir Goldstein authored
      [ Upstream commit e044374a
      
       ]
      
      It is not clear that IMA should be nested at all, but as long is it
      measures files both on overlayfs and on underlying fs, we need to
      annotate the iint mutex to avoid lockdep false positives related to
      IMA + overlayfs, same as overlayfs annotates the inode mutex.
      
      Reported-and-tested-by: default avatar <syzbot+b42fe626038981fb7bfa@syzkaller.appspotmail.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04e3ec93
    • Helge Deller's avatar
      fbdev: stifb: Make the STI next font pointer a 32-bit signed offset · 4eb5dc3b
      Helge Deller authored
      [ Upstream commit 8a32aa17
      
       ]
      
      The pointer to the next STI font is actually a signed 32-bit
      offset. With this change the 64-bit kernel will correctly subract
      the (signed 32-bit) offset instead of adding a (unsigned 32-bit)
      offset. It has no effect on 32-bit kernels.
      
      This fixes the stifb driver with a 64-bit kernel on qemu.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4eb5dc3b
    • Linus Walleij's avatar
      mtd: cfi_cmdset_0001: Byte swap OTP info · e6771a83
      Linus Walleij authored
      [ Upstream commit 565fe150
      
       ]
      
      Currently the offset into the device when looking for OTP
      bits can go outside of the address of the MTD NOR devices,
      and if that memory isn't readable, bad things happen
      on the IXP4xx (added prints that illustrate the problem before
      the crash):
      
      cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x00000100
      ixp4xx_copy_from copy from 0x00000100 to 0xc880dd78
      cfi_intelext_otp_walk walk OTP on chip 0 start at reg_prot_offset 0x12000000
      ixp4xx_copy_from copy from 0x12000000 to 0xc880dd78
      8<--- cut here ---
      Unable to handle kernel paging request at virtual address db000000
      [db000000] *pgd=00000000
      (...)
      
      This happens in this case because the IXP4xx is big endian and
      the 32- and 16-bit fields in the struct cfi_intelext_otpinfo are not
      properly byteswapped. Compare to how the code in read_pri_intelext()
      byteswaps the fields in struct cfi_pri_intelext.
      
      Adding a small byte swapping loop for the OTP in read_pri_intelext()
      and the crash goes away.
      
      The problem went unnoticed for many years until I enabled
      CONFIG_MTD_OTP on the IXP4xx as well, triggering the bug.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarNicolas Pitre <nico@fluxnic.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20231020-mtd-otp-byteswap-v4-1-0d132c06aa9d@linaro.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e6771a83
    • Jean-Philippe Brucker's avatar
      mtd: cfi_cmdset_0001: Support the absence of protection registers · 542fbaaa
      Jean-Philippe Brucker authored
      [ Upstream commit b359ed51
      
       ]
      
      The flash controller implemented by the Arm Base platform behaves like
      the Intel StrataFlash J3 device, but omits several features. In
      particular it doesn't implement a protection register, so "Number of
      Protection register fields" in the Primary Vendor-Specific Extended
      Query, is 0.
      
      The Intel StrataFlash J3 datasheet only lists 1 as a valid value for
      NumProtectionFields. It describes the field as:
      
      	"Number of Protection register fields in JEDEC ID space.
      	“00h,” indicates that 256 protection bytes are available"
      
      While a value of 0 may arguably not be architecturally valid, the
      driver's current behavior is certainly wrong: if NumProtectionFields is
      0, read_pri_intelext() adds a negative value to the unsigned extra_size,
      and ends up in an infinite loop.
      
      Fix it by ignoring a NumProtectionFields of 0.
      
      Signed-off-by: default avatarJean-Philippe Brucker <jean-philippe@linaro.org>
      Tested-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Tested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
      Stable-dep-of: 565fe150
      
       ("mtd: cfi_cmdset_0001: Byte swap OTP info")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      542fbaaa
    • Heiko Carstens's avatar
      s390/cmma: fix detection of DAT pages · 1e4f431c
      Heiko Carstens authored
      [ Upstream commit 44d93045
      
       ]
      
      If the cmma no-dat feature is available the kernel page tables are walked
      to identify and mark all pages which are used for address translation (all
      region, segment, and page tables). In a subsequent loop all other pages are
      marked as "no-dat" pages with the ESSA instruction.
      
      This information is visible to the hypervisor, so that the hypervisor can
      optimize purging of guest TLB entries. The initial loop however is
      incorrect: only the first three of the four pages which belong to segment
      and region tables will be marked as being used for DAT. The last page is
      incorrectly marked as no-dat.
      
      This can result in incorrect guest TLB flushes.
      
      Fix this by simply marking all four pages.
      
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1e4f431c
    • Alexander Gordeev's avatar
      s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family · 5e2e3176
      Alexander Gordeev authored
      [ Upstream commit 3784231b
      
       ]
      
      Due to historical reasons mark_kernel_pXd() functions
      misuse the notion of physical vs virtual addresses
      difference.
      
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Stable-dep-of: 44d93045
      
       ("s390/cmma: fix detection of DAT pages")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5e2e3176
    • Steve French's avatar
      smb3: fix touch -h of symlink · c8580e0b
      Steve French authored
      [ Upstream commit 475efd98
      
       ]
      
      For example:
            touch -h -t 02011200 testfile
      where testfile is a symlink would not change the timestamp, but
            touch -t 02011200 testfile
      does work to change the timestamp of the target
      
      Suggested-by: default avatarDavid Howells <dhowells@redhat.com>
      Reported-by: default avatarMicah Veilleux <micah.veilleux@iba-group.com>
      Closes: https://bugzilla.samba.org/show_bug.cgi?id=14476
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8580e0b
    • Claudiu Beznea's avatar
      net: ravb: Start TX queues after HW initialization succeeded · cbbf7d80
      Claudiu Beznea authored
      [ Upstream commit 6f32c086 ]
      
      ravb_phy_start() may fail. If that happens, the TX queues will remain
      started. Thus, move the netif_tx_start_all_queues() after PHY is
      successfully initialized.
      
      Fixes: c156633f
      
       ("Renesas Ethernet AVB driver proper")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cbbf7d80
    • Yoshihiro Shimoda's avatar
      ravb: Fix races between ravb_tx_timeout_work() and net related ops · b655af79
      Yoshihiro Shimoda authored
      [ Upstream commit 9870257a ]
      
      Fix races between ravb_tx_timeout_work() and functions of net_device_ops
      and ethtool_ops by using rtnl_trylock() and rtnl_unlock(). Note that
      since ravb_close() is under the rtnl lock and calls cancel_work_sync(),
      ravb_tx_timeout_work() should calls rtnl_trylock(). Otherwise, a deadlock
      may happen in ravb_tx_timeout_work() like below:
      
      CPU0			CPU1
      			ravb_tx_timeout()
      			schedule_work()
      ...
      __dev_close_many()
      // Under rtnl lock
      ravb_close()
      cancel_work_sync()
      // Waiting
      			ravb_tx_timeout_work()
      			rtnl_lock()
      			// This is possible to cause a deadlock
      
      If rtnl_trylock() fails, rescheduling the work with sleep for 1 msec.
      
      Fixes: c156633f
      
       ("Renesas Ethernet AVB driver proper")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Link: https://lore.kernel.org/r/20231127122420.3706751-1-yoshihiro.shimoda.uh@renesas.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b655af79
    • Zhengchao Shao's avatar
      ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet · 6b6f5c66
      Zhengchao Shao authored
      [ Upstream commit e2b706c6 ]
      
      When I perform the following test operations:
      1.ip link add br0 type bridge
      2.brctl addif br0 eth0
      3.ip addr add 239.0.0.1/32 dev eth0
      4.ip addr add 239.0.0.1/32 dev br0
      5.ip addr add 224.0.0.1/32 dev br0
      6.while ((1))
          do
              ifconfig br0 up
              ifconfig br0 down
          done
      7.send IGMPv2 query packets to port eth0 continuously. For example,
      ./mausezahn ethX -c 0 "01 00 5e 00 00 01 00 72 19 88 aa 02 08 00 45 00 00
      1c 00 01 00 00 01 02 0e 7f c0 a8 0a b7 e0 00 00 01 11 64 ee 9b 00 00 00 00"
      
      The preceding tests may trigger the refcnt uaf issue of the mc list. The
      stack is as follows:
      	refcount_t: addition on 0; use-after-free.
      	WARNING: CPU: 21 PID: 144 at lib/refcount.c:25 refcount_warn_saturate (lib/refcount.c:25)
      	CPU: 21 PID: 144 Comm: ksoftirqd/21 Kdump: loaded Not tainted 6.7.0-rc1-next-20231117-dirty #80
      	Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
      	RIP: 0010:refcount_warn_saturate (lib/refcount.c:25)
      	RSP: 0018:ffffb68f00657910 EFLAGS: 00010286
      	RAX: 0000000000000000 RBX: ffff8a00c3bf96c0 RCX: ffff8a07b6160908
      	RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8a07b6160900
      	RBP: ffff8a00cba36862 R08: 0000000000000000 R09: 00000000ffff7fff
      	R10: ffffb68f006577c0 R11: ffffffffb0fdcdc8 R12: ffff8a00c3bf9680
      	R13: ffff8a00c3bf96f0 R14: 0000000000000000 R15: ffff8a00d8766e00
      	FS:  0000000000000000(0000) GS:ffff8a07b6140000(0000) knlGS:0000000000000000
      	CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      	CR2: 000055f10b520b28 CR3: 000000039741a000 CR4: 00000000000006f0
      	Call Trace:
      	<TASK>
      	igmp_heard_query (net/ipv4/igmp.c:1068)
      	igmp_rcv (net/ipv4/igmp.c:1132)
      	ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205)
      	ip_local_deliver_finish (net/ipv4/ip_input.c:234)
      	__netif_receive_skb_one_core (net/core/dev.c:5529)
      	netif_receive_skb_internal (net/core/dev.c:5729)
      	netif_receive_skb (net/core/dev.c:5788)
      	br_handle_frame_finish (net/bridge/br_input.c:216)
      	nf_hook_bridge_pre (net/bridge/br_input.c:294)
      	__netif_receive_skb_core (net/core/dev.c:5423)
      	__netif_receive_skb_list_core (net/core/dev.c:5606)
      	__netif_receive_skb_list (net/core/dev.c:5674)
      	netif_receive_skb_list_internal (net/core/dev.c:5764)
      	napi_gro_receive (net/core/gro.c:609)
      	e1000_clean_rx_irq (drivers/net/ethernet/intel/e1000/e1000_main.c:4467)
      	e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3805)
      	__napi_poll (net/core/dev.c:6533)
      	net_rx_action (net/core/dev.c:6735)
      	__do_softirq (kernel/softirq.c:554)
      	run_ksoftirqd (kernel/softirq.c:913)
      	smpboot_thread_fn (kernel/smpboot.c:164)
      	kthread (kernel/kthread.c:388)
      	ret_from_fork (arch/x86/kernel/process.c:153)
      	ret_from_fork_asm (arch/x86/entry/entry_64.S:250)
      	</TASK>
      
      The root causes are as follows:
      Thread A					Thread B
      ...						netif_receive_skb
      br_dev_stop					...
          br_multicast_leave_snoopers			...
              __ip_mc_dec_group			...
                  __igmp_group_dropped		igmp_rcv
                      igmp_stop_timer			    igmp_heard_query         //ref = 1
                      ip_ma_put			        igmp_mod_timer
                          refcount_dec_and_test	            igmp_start_timer //ref = 0
      			...                                     refcount_inc //ref increases from 0
      When the device receives an IGMPv2 Query message, it starts the timer
      immediately, regardless of whether the device is running. If the device is
      down and has left the multicast group, it will cause the mc list refcount
      uaf issue.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6b6f5c66
    • Max Nguyen's avatar
      Input: xpad - add HyperX Clutch Gladiate Support · be36de88
      Max Nguyen authored
      commit e28a0974
      
       upstream.
      
      Add HyperX controller support to xpad_device and xpad_table.
      
      Suggested-by: default avatarChris Toledanes <chris.toledanes@hp.com>
      Reviewed-by: default avatarCarl Ng <carl.ng@hp.com>
      Signed-off-by: default avatarMax Nguyen <maxwell.nguyen@hp.com>
      Reviewed-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
      Link: https://lore.kernel.org/r/20230906231514.4291-1-hphyperxdev@gmail.com
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be36de88
    • Jann Horn's avatar
      btrfs: send: ensure send_fd is writable · 907f8060
      Jann Horn authored
      commit 0ac1d13a upstream.
      
      kernel_write() requires the caller to ensure that the file is writable.
      Let's do that directly after looking up the ->send_fd.
      
      We don't need a separate bailout path because the "out" path already
      does fput() if ->send_filp is non-NULL.
      
      This has no security impact for two reasons:
      
       - the ioctl requires CAP_SYS_ADMIN
       - __kernel_write() bails out on read-only files - but only since 5.8,
         see commit a01ac27b
      
       ("fs: check FMODE_WRITE in __kernel_write")
      
      Reported-and-tested-by: default avatar <syzbot+12e098239d20385264d3@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=12e098239d20385264d3
      Fixes: 31db9f7c
      
       ("Btrfs: introduce BTRFS_IOC_SEND for btrfs send/receive")
      CC: stable@vger.kernel.org # 4.14+
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      907f8060
    • Filipe Manana's avatar
      btrfs: fix off-by-one when checking chunk map includes logical address · a3baa90a
      Filipe Manana authored
      commit 5fba5a57
      
       upstream.
      
      At btrfs_get_chunk_map() we get the extent map for the chunk that contains
      the given logical address stored in the 'logical' argument. Then we do
      sanity checks to verify the extent map contains the logical address. One
      of these checks verifies if the extent map covers a range with an end
      offset behind the target logical address - however this check has an
      off-by-one error since it will consider an extent map whose start offset
      plus its length matches the target logical address as inclusive, while
      the fact is that the last byte it covers is behind the target logical
      address (by 1).
      
      So fix this condition by using '<=' rather than '<' when comparing the
      extent map's "start + length" against the target logical address.
      
      CC: stable@vger.kernel.org # 4.14+
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3baa90a
    • Timothy Pearson's avatar
      powerpc: Don't clobber f0/vs0 during fp|altivec register save · e2e9ffef
      Timothy Pearson authored
      commit 5e1d824f upstream.
      
      During floating point and vector save to thread data f0/vs0 are
      clobbered by the FPSCR/VSCR store routine. This has been obvserved to
      lead to userspace register corruption and application data corruption
      with io-uring.
      
      Fix it by restoring f0/vs0 after FPSCR/VSCR store has completed for
      all the FP, altivec, VMX register save paths.
      
      Tested under QEMU in kvm mode, running on a Talos II workstation with
      dual POWER9 DD2.2 CPUs.
      
      Additional detail (mpe):
      
      Typically save_fpu() is called from __giveup_fpu() which saves the FP
      regs and also *turns off FP* in the tasks MSR, meaning the kernel will
      reload the FP regs from the thread struct before letting the task use FP
      again. So in that case save_fpu() is free to clobber f0 because the FP
      regs no longer hold live values for the task.
      
      There is another case though, which is the path via:
        sys_clone()
          ...
          copy_process()
            dup_task_struct()
              arch_dup_task_struct()
                flush_all_to_thread()
                  save_all()
      
      That path saves the FP regs but leaves them live. That's meant as an
      optimisation for a process that's using FP/VSX and then calls fork(),
      leaving the regs live means the parent process doesn't have to take a
      fault after the fork to get its FP regs back. The optimisation was added
      in commit 8792468d ("powerpc: Add the ability to save FPU without
      giving it up").
      
      That path does clobber f0, but f0 is volatile across function calls,
      and typically programs reach copy_process() from userspace via a syscall
      wrapper function. So in normal usage f0 being clobbered across a
      syscall doesn't cause visible data corruption.
      
      But there is now a new path, because io-uring can call copy_process()
      via create_io_thread() from the signal handling path. That's OK if the
      signal is handled as part of syscall return, but it's not OK if the
      signal is handled due to some other interrupt.
      
      That path is:
      
      interrupt_return_srr_user()
        interrupt_exit_user_prepare()
          interrupt_exit_user_prepare_main()
            do_notify_resume()
              get_signal()
                task_work_run()
                  create_worker_cb()
                    create_io_worker()
                      copy_process()
                        dup_task_struct()
                          arch_dup_task_struct()
                            flush_all_to_thread()
                              save_all()
                                if (tsk->thread.regs->msr & MSR_FP)
                                  save_fpu()
                                  # f0 is clobbered and potentially live in userspace
      
      Note the above discussion applies equally to save_altivec().
      
      Fixes: 8792468d
      
       ("powerpc: Add the ability to save FPU without giving it up")
      Cc: stable@vger.kernel.org # v4.6+
      Closes: https://lore.kernel.org/all/480932026.45576726.1699374859845.JavaMail.zimbra@raptorengineeringinc.com/
      Closes: https://lore.kernel.org/linuxppc-dev/480221078.47953493.1700206777956.JavaMail.zimbra@raptorengineeringinc.com/
      Tested-by: default avatarTimothy Pearson <tpearson@raptorengineering.com>
      Tested-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarTimothy Pearson <tpearson@raptorengineering.com>
      [mpe: Reword change log to describe exact path of corruption & other minor tweaks]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/1921539696.48534988.1700407082933.JavaMail.zimbra@raptorengineeringinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2e9ffef
    • Markus Weippert's avatar
      bcache: revert replacing IS_ERR_OR_NULL with IS_ERR · 042d287e
      Markus Weippert authored
      commit bb6cc253 upstream.
      
      Commit 028ddcac ("bcache: Remove unnecessary NULL point check in
      node allocations") replaced IS_ERR_OR_NULL by IS_ERR. This leads to a
      NULL pointer dereference.
      
      BUG: kernel NULL pointer dereference, address: 0000000000000080
      Call Trace:
       ? __die_body.cold+0x1a/0x1f
       ? page_fault_oops+0xd2/0x2b0
       ? exc_page_fault+0x70/0x170
       ? asm_exc_page_fault+0x22/0x30
       ? btree_node_free+0xf/0x160 [bcache]
       ? up_write+0x32/0x60
       btree_gc_coalesce+0x2aa/0x890 [bcache]
       ? bch_extent_bad+0x70/0x170 [bcache]
       btree_gc_recurse+0x130/0x390 [bcache]
       ? btree_gc_mark_node+0x72/0x230 [bcache]
       bch_btree_gc+0x5da/0x600 [bcache]
       ? cpuusage_read+0x10/0x10
       ? bch_btree_gc+0x600/0x600 [bcache]
       bch_gc_thread+0x135/0x180 [bcache]
      
      The relevant code starts with:
      
          new_nodes[0] = NULL;
      
          for (i = 0; i < nodes; i++) {
              if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key)))
                  goto out_nocoalesce;
          // ...
      out_nocoalesce:
          // ...
          for (i = 0; i < nodes; i++)
              if (!IS_ERR(new_nodes[i])) {  // IS_ERR_OR_NULL before
      028ddcac
                  btree_node_free(new_nodes[i]);  // new_nodes[0] is NULL
                  rw_unlock(true, new_nodes[i]);
              }
      
      This patch replaces IS_ERR() by IS_ERR_OR_NULL() to fix this.
      
      Fixes: 028ddcac
      
       ("bcache: Remove unnecessary NULL point check in node allocations")
      Link: https://lore.kernel.org/all/3DF4A87A-2AC1-4893-AE5F-E921478419A9@suse.de/
      Cc: stable@vger.kernel.org
      Cc: Zheng Wang <zyytlz.wz@163.com>
      Cc: Coly Li <colyli@suse.de>
      Signed-off-by: default avatarMarkus Weippert <markus@gekmihesg.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      042d287e
    • Wu Bo's avatar
      dm verity: don't perform FEC for failed readahead IO · df1b8e7b
      Wu Bo authored
      commit 0193e396 upstream.
      
      We found an issue under Android OTA scenario that many BIOs have to do
      FEC where the data under dm-verity is 100% complete and no corruption.
      
      Android OTA has many dm-block layers, from upper to lower:
      dm-verity
      dm-snapshot
      dm-origin & dm-cow
      dm-linear
      ufs
      
      DM tables have to change 2 times during Android OTA merging process.
      When doing table change, the dm-snapshot will be suspended for a while.
      During this interval, many readahead IOs are submitted to dm_verity
      from filesystem. Then the kverity works are busy doing FEC process
      which cost too much time to finish dm-verity IO. This causes needless
      delay which feels like system is hung.
      
      After adding debugging it was found that each readahead IO needed
      around 10s to finish when this situation occurred. This is due to IO
      amplification:
      
      dm-snapshot suspend
      erofs_readahead     // 300+ io is submitted
      	dm_submit_bio (dm_verity)
      		dm_submit_bio (dm_snapshot)
      		bio return EIO
      		bio got nothing, it's empty
      	verity_end_io
      	verity_verify_io
      	forloop range(0, io->n_blocks)    // each io->nblocks ~= 20
      		verity_fec_decode
      		fec_decode_rsb
      		fec_read_bufs
      		forloop range(0, v->fec->rsn) // v->fec->rsn = 253
      			new_read
      			submit_bio (dm_snapshot)
      		end loop
      	end loop
      dm-snapshot resume
      
      Readahead BIOs get nothing while dm-snapshot is suspended, so all of
      them will cause verity's FEC.
      Each readahead BIO needs to verify ~20 (io->nblocks) blocks.
      Each block needs to do FEC, and every block needs to do 253
      (v->fec->rsn) reads.
      So during the suspend interval(~200ms), 300 readahead BIOs trigger
      ~1518000 (300*20*253) IOs to dm-snapshot.
      
      As readahead IO is not required by userspace, and to fix this issue,
      it is best to pass readahead errors to upper layer to handle it.
      
      Cc: stable@vger.kernel.org
      Fixes: a739ff3f
      
       ("dm verity: add support for forward error correction")
      Signed-off-by: default avatarWu Bo <bo.wu@vivo.com>
      Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df1b8e7b
    • Mikulas Patocka's avatar
      dm-verity: align struct dm_verity_fec_io properly · ffe2d3da
      Mikulas Patocka authored
      commit 38bc1ab1
      
       upstream.
      
      dm_verity_fec_io is placed after the end of two hash digests. If the hash
      digest has unaligned length, struct dm_verity_fec_io could be unaligned.
      
      This commit fixes the placement of struct dm_verity_fec_io, so that it's
      aligned.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: a739ff3f
      
       ("dm verity: add support for forward error correction")
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffe2d3da
    • Kailang Yang's avatar
      ALSA: hda/realtek: Headset Mic VREF to 100% · 2636657e
      Kailang Yang authored
      commit baaacbff
      
       upstream.
      
      This platform need to set Mic VREF to 100%.
      
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/0916af40f08a4348a3298a9a59e6967e@realtek.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2636657e
    • Takashi Iwai's avatar
      ALSA: hda: Disable power-save on KONTRON SinglePC · a315aca9
      Takashi Iwai authored
      commit a337c355
      
       upstream.
      
      It's been reported that the runtime PM on KONTRON SinglePC (PCI SSID
      1734:1232) caused a stall of playback after a bunch of invocations.
      (FWIW, this looks like an timing issue, and the stall happens rather
      on the controller side.)
      
      As a workaround, disable the default power-save on this platform.
      
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231130151321.9813-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a315aca9
    • Adrian Hunter's avatar
      mmc: block: Do not lose cache flush during CQE error recovery · 3a60bb45
      Adrian Hunter authored
      commit 174925d3 upstream.
      
      During CQE error recovery, error-free data commands get requeued if there
      is any data left to transfer, but non-data commands are completed even
      though they have not been processed.  Requeue them instead.
      
      Note the only non-data command is cache flush, which would have resulted in
      a cache flush being lost if it was queued at the time of CQE recovery.
      
      Fixes: 1e8e55b6
      
       ("mmc: block: Add CQE support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Link: https://lore.kernel.org/r/20231103084720.6886-2-adrian.hunter@intel.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a60bb45
    • Yang Yingliang's avatar
      firewire: core: fix possible memory leak in create_units() · 77a01591
      Yang Yingliang authored
      commit 891e0eab upstream.
      
      If device_register() fails, the refcount of device is not 0, the name
      allocated in dev_set_name() is leaked. To fix this by calling put_device(),
      so that it will be freed in callback function kobject_cleanup().
      
      unreferenced object 0xffff9d99035c7a90 (size 8):
        comm "systemd-udevd", pid 168, jiffies 4294672386 (age 152.089s)
        hex dump (first 8 bytes):
          66 77 30 2e 30 00 ff ff                          fw0.0...
        backtrace:
          [<00000000e1d62bac>] __kmem_cache_alloc_node+0x1e9/0x360
          [<00000000bbeaff31>] __kmalloc_node_track_caller+0x44/0x1a0
          [<00000000491f2fb4>] kvasprintf+0x67/0xd0
          [<000000005b960ddc>] kobject_set_name_vargs+0x1e/0x90
          [<00000000427ac591>] dev_set_name+0x4e/0x70
          [<000000003b4e447d>] create_units+0xc5/0x110
      
      fw_unit_release() will be called in the error path, move fw_device_get()
      before calling device_register() to keep balanced with fw_device_put() in
      fw_unit_release().
      
      Cc: stable@vger.kernel.org
      Fixes: 1fa5ae85 ("driver core: get rid of struct device's bus_id string array")
      Fixes: a1f64819
      
       ("firewire: struct device - replace bus_id with dev_name(), dev_set_name()")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77a01591
    • Maria Yu's avatar
      pinctrl: avoid reload of p state in list iteration · 730ac157
      Maria Yu authored
      commit 4198a9b5 upstream.
      
      When in the list_for_each_entry iteration, reload of p->state->settings
      with a local setting from old_state will turn the list iteration into an
      infinite loop.
      
      The typical symptom when the issue happens, will be a printk message like:
      
        "not freeing pin xx (xxx) as part of deactivating group xxx - it is
      already used for some other setting".
      
      This is a compiler-dependent problem, one instance occurred using Clang
      version 10.0 on the arm64 architecture with linux version 4.19.
      
      Fixes: 6e5e959d
      
       ("pinctrl: API changes to support multiple states per device")
      Signed-off-by: default avatarMaria Yu <quic_aiquny@quicinc.com>
      Cc:  <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231115102824.23727-1-quic_aiquny@quicinc.com
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      730ac157
    • Johan Hovold's avatar
      USB: dwc3: qcom: fix wakeup after probe deferral · 0d297dd0
      Johan Hovold authored
      commit 41f5a097 upstream.
      
      The Qualcomm glue driver is overriding the interrupt trigger types
      defined by firmware when requesting the wakeup interrupts during probe.
      
      This can lead to a failure to map the DP/DM wakeup interrupts after a
      probe deferral as the firmware defined trigger types do not match the
      type used for the initial mapping:
      
      	irq: type mismatch, failed to map hwirq-14 for interrupt-controller@b220000!
      	irq: type mismatch, failed to map hwirq-15 for interrupt-controller@b220000!
      
      Fix this by not overriding the firmware provided trigger types when
      requesting the wakeup interrupts.
      
      Fixes: a4333c3a
      
       ("usb: dwc3: Add Qualcomm DWC3 glue driver")
      Cc: stable@vger.kernel.org      # 4.18
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Link: https://lore.kernel.org/r/20231120161607.7405-3-johan+linaro@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d297dd0
    • Ricardo Ribalda's avatar
      usb: dwc3: set the dma max_seg_size · aa836aa8
      Ricardo Ribalda authored
      commit 8bbae288 upstream.
      
      Allow devices to have dma operations beyond 4K, and avoid warnings such
      as:
      
      DMA-API: dwc3 a600000.usb: mapping sg segment longer than device claims to support [len=86016] [max=65536]
      
      Cc: stable@vger.kernel.org
      Fixes: 72246da4
      
       ("usb: Introduce DesignWare USB3 DRD Driver")
      Reported-by: default avatarZubin Mithra <zsm@chromium.org>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/20231026-dwc3-v2-1-1d4fd5c3e067@chromium.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa836aa8
    • Oliver Neukum's avatar
      USB: dwc2: write HCINT with INTMASK applied · 5c82a060
      Oliver Neukum authored
      commit 0583bc77
      
       upstream.
      
      dwc2_hc_n_intr() writes back INTMASK as read but evaluates it
      with intmask applied. In stress testing this causes spurious
      interrupts like this:
      
      [Mon Aug 14 10:51:07 2023] dwc2 3f980000.usb: dwc2_hc_chhltd_intr_dma: Channel 7 - ChHltd set, but reason is unknown
      [Mon Aug 14 10:51:07 2023] dwc2 3f980000.usb: hcint 0x00000002, intsts 0x04600001
      [Mon Aug 14 10:51:08 2023] dwc2 3f980000.usb: dwc2_hc_chhltd_intr_dma: Channel 0 - ChHltd set, but reason is unknown
      [Mon Aug 14 10:51:08 2023] dwc2 3f980000.usb: hcint 0x00000002, intsts 0x04600001
      [Mon Aug 14 10:51:08 2023] dwc2 3f980000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown
      [Mon Aug 14 10:51:08 2023] dwc2 3f980000.usb: hcint 0x00000002, intsts 0x04600001
      [Mon Aug 14 10:51:08 2023] dwc2 3f980000.usb: dwc2_update_urb_state_abn(): trimming xfer length
      
      Applying INTMASK prevents this. The issue exists in all versions of the
      driver.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Tested-by: default avatarIvan Ivanov <ivan.ivanov@suse.com>
      Tested-by: default avatarAndrea della Porta <andrea.porta@suse.com>
      Link: https://lore.kernel.org/r/20231115144514.15248-1-oneukum@suse.com
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5c82a060
    • Lech Perczak's avatar
      USB: serial: option: don't claim interface 4 for ZTE MF290 · acc25690
      Lech Perczak authored
      commit 8771127e
      
       upstream.
      
      Interface 4 is used by for QMI interface in stock firmware of MF28D, the
      router which uses MF290 modem. Free the interface up, to rebind it to
      qmi_wwan driver.
      The proper configuration is:
      
      Interface mapping is:
      0: QCDM, 1: (unknown), 2: AT (PCUI), 2: AT (Modem), 4: QMI
      
      T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=19d2 ProdID=0189 Rev= 0.00
      S:  Manufacturer=ZTE, Incorporated
      S:  Product=ZTE LTE Technologies MSM
      C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=86(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      
      Cc: Bjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarLech Perczak <lech.perczak@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>
      acc25690
    • Puliang Lu's avatar
      USB: serial: option: fix FM101R-GL defines · 94c8bd81
      Puliang Lu authored
      commit a1092619
      
       upstream.
      
      Modify the definition of the two Fibocom FM101R-GL PID macros, which had
      their PIDs switched.
      
      The correct PIDs are:
      
      - VID:PID 413C:8213, FM101R-GL ESIM are laptop M.2 cards (with
        MBIM interfaces for Linux)
      
      - VID:PID 413C:8215, FM101R-GL are laptop M.2 cards (with
        MBIM interface for Linux)
      
      0x8213: mbim, tty
      0x8215: mbim, tty
      
      Signed-off-by: default avatarPuliang Lu <puliang.lu@fibocom.com>
      Fixes: 52480e1f
      
       ("USB: serial: option: add Fibocom to DELL custom modem FM101R-GL")
      Link: https://lore.kernel.org/lkml/TYZPR02MB508845BAD7936A62A105CE5D89DFA@TYZPR02MB5088.apcprd02.prod.outlook.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>
      94c8bd81
    • Victor Fragoso's avatar
      USB: serial: option: add Fibocom L7xx modules · a52a306d
      Victor Fragoso authored
      commit e389fe8b
      
       upstream.
      
      Add support for Fibocom L716-EU module series.
      
      L716-EU is a Fibocom module based on ZTE's V3E/V3T chipset.
      
      Device creates multiple interfaces when connected to PC as follows:
       - Network Interface: ECM or RNDIS (set by FW or AT Command)
       - ttyUSB0: AT port
       - ttyUSB1: Modem port
       - ttyUSB2: AT2 port
       - ttyUSB3: Trace port for log information
       - ADB: ADB port for debugging. ("Driver=usbfs" when ADB server enabled)
      
      Here are the outputs of lsusb and usb-devices:
      $ ls /dev/ttyUSB*
      /dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2  /dev/ttyUSB3
      
      usb-devices:
      L716-EU (ECM mode):
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 51 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0001 Rev= 1.00
      S:  Manufacturer=Fibocom,Incorporated
      S:  Product=Fibocom Mobile Boardband
      S:  SerialNumber=1234567890ABCDEF
      C:* #Ifs= 7 Cfg#= 1 Atr=e0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
      E:  Ad=87(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      L716-EU (RNDIS mode):
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 49 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2cb7 ProdID=0001 Rev= 1.00
      S:  Manufacturer=Fibocom,Incorporated
      S:  Product=Fibocom Mobile Boardband
      S:  SerialNumber=1234567890ABCDEF
      C:* #Ifs= 7 Cfg#= 1 Atr=e0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=ff Driver=rndis_host
      E:  Ad=87(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=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarVictor Fragoso <victorffs@hotmail.com>
      Reviewed-by: default avatarLars Melin <larsm17@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>
      a52a306d
    • Rand Deeb's avatar
      bcache: prevent potential division by zero error · db850bcd
      Rand Deeb authored
      commit 2c7f497a
      
       upstream.
      
      In SHOW(), the variable 'n' is of type 'size_t.' While there is a
      conditional check to verify that 'n' is not equal to zero before
      executing the 'do_div' macro, concerns arise regarding potential
      division by zero error in 64-bit environments.
      
      The concern arises when 'n' is 64 bits in size, greater than zero, and
      the lower 32 bits of it are zeros. In such cases, the conditional check
      passes because 'n' is non-zero, but the 'do_div' macro casts 'n' to
      'uint32_t,' effectively truncating it to its lower 32 bits.
      Consequently, the 'n' value becomes zero.
      
      To fix this potential division by zero error and ensure precise
      division handling, this commit replaces the 'do_div' macro with
      div64_u64(). div64_u64() is designed to work with 64-bit operands,
      guaranteeing that division is performed correctly.
      
      This change enhances the robustness of the code, ensuring that division
      operations yield accurate results in all scenarios, eliminating the
      possibility of division by zero, and improving compatibility across
      different 64-bit environments.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Signed-off-by: default avatarRand Deeb <rand.sec96@gmail.com>
      Cc:  <stable@vger.kernel.org>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Link: https://lore.kernel.org/r/20231120052503.6122-5-colyli@suse.de
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db850bcd
    • Coly Li's avatar
      bcache: check return value from btree_node_alloc_replacement() · b808e631
      Coly Li authored
      commit 777967e7
      
       upstream.
      
      In btree_gc_rewrite_node(), pointer 'n' is not checked after it returns
      from btree_gc_rewrite_node(). There is potential possibility that 'n' is
      a non NULL ERR_PTR(), referencing such error code is not permitted in
      following code. Therefore a return value checking is necessary after 'n'
      is back from btree_node_alloc_replacement().
      
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Cc:  <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20231120052503.6122-3-colyli@suse.de
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b808e631