1. 23 10月, 2021 2 次提交
  2. 21 10月, 2021 5 次提交
  3. 17 10月, 2021 2 次提交
  4. 16 10月, 2021 4 次提交
  5. 15 10月, 2021 7 次提交
  6. 14 10月, 2021 13 次提交
    • I
      mlxsw: thermal: Fix out-of-bounds memory accesses · 332fdf95
      Ido Schimmel 提交于
      Currently, mlxsw allows cooling states to be set above the maximum
      cooling state supported by the driver:
      
       # cat /sys/class/thermal/thermal_zone2/cdev0/type
       mlxsw_fan
       # cat /sys/class/thermal/thermal_zone2/cdev0/max_state
       10
       # echo 18 > /sys/class/thermal/thermal_zone2/cdev0/cur_state
       # echo $?
       0
      
      This results in out-of-bounds memory accesses when thermal state
      transition statistics are enabled (CONFIG_THERMAL_STATISTICS=y), as the
      transition table is accessed with a too large index (state) [1].
      
      According to the thermal maintainer, it is the responsibility of the
      driver to reject such operations [2].
      
      Therefore, return an error when the state to be set exceeds the maximum
      cooling state supported by the driver.
      
      To avoid dead code, as suggested by the thermal maintainer [3],
      partially revert commit a421ce08 ("mlxsw: core: Extend cooling
      device with cooling levels") that tried to interpret these invalid
      cooling states (above the maximum) in a special way. The cooling levels
      array is not removed in order to prevent the fans going below 20% PWM,
      which would cause them to get stuck at 0% PWM.
      
      [1]
      BUG: KASAN: slab-out-of-bounds in thermal_cooling_device_stats_update+0x271/0x290
      Read of size 4 at addr ffff8881052f7bf8 by task kworker/0:0/5
      
      CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.15.0-rc3-custom-45935-gce1adf704b14 #122
      Hardware name: Mellanox Technologies Ltd. "MSN2410-CB2FO"/"SA000874", BIOS 4.6.5 03/08/2016
      Workqueue: events_freezable_power_ thermal_zone_device_check
      Call Trace:
       dump_stack_lvl+0x8b/0xb3
       print_address_description.constprop.0+0x1f/0x140
       kasan_report.cold+0x7f/0x11b
       thermal_cooling_device_stats_update+0x271/0x290
       __thermal_cdev_update+0x15e/0x4e0
       thermal_cdev_update+0x9f/0xe0
       step_wise_throttle+0x770/0xee0
       thermal_zone_device_update+0x3f6/0xdf0
       process_one_work+0xa42/0x1770
       worker_thread+0x62f/0x13e0
       kthread+0x3ee/0x4e0
       ret_from_fork+0x1f/0x30
      
      Allocated by task 1:
       kasan_save_stack+0x1b/0x40
       __kasan_kmalloc+0x7c/0x90
       thermal_cooling_device_setup_sysfs+0x153/0x2c0
       __thermal_cooling_device_register.part.0+0x25b/0x9c0
       thermal_cooling_device_register+0xb3/0x100
       mlxsw_thermal_init+0x5c5/0x7e0
       __mlxsw_core_bus_device_register+0xcb3/0x19c0
       mlxsw_core_bus_device_register+0x56/0xb0
       mlxsw_pci_probe+0x54f/0x710
       local_pci_probe+0xc6/0x170
       pci_device_probe+0x2b2/0x4d0
       really_probe+0x293/0xd10
       __driver_probe_device+0x2af/0x440
       driver_probe_device+0x51/0x1e0
       __driver_attach+0x21b/0x530
       bus_for_each_dev+0x14c/0x1d0
       bus_add_driver+0x3ac/0x650
       driver_register+0x241/0x3d0
       mlxsw_sp_module_init+0xa2/0x174
       do_one_initcall+0xee/0x5f0
       kernel_init_freeable+0x45a/0x4de
       kernel_init+0x1f/0x210
       ret_from_fork+0x1f/0x30
      
      The buggy address belongs to the object at ffff8881052f7800
       which belongs to the cache kmalloc-1k of size 1024
      The buggy address is located 1016 bytes inside of
       1024-byte region [ffff8881052f7800, ffff8881052f7c00)
      The buggy address belongs to the page:
      page:0000000052355272 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1052f0
      head:0000000052355272 order:3 compound_mapcount:0 compound_pincount:0
      flags: 0x200000000010200(slab|head|node=0|zone=2)
      raw: 0200000000010200 ffffea0005034800 0000000300000003 ffff888100041dc0
      raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8881052f7a80: 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc fc
       ffff8881052f7b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff8881052f7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                                      ^
       ffff8881052f7c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff8881052f7c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      
      [2] https://lore.kernel.org/linux-pm/9aca37cb-1629-5c67-1895-1fdc45c0244e@linaro.org/
      [3] https://lore.kernel.org/linux-pm/af9857f2-578e-de3a-e62b-6baff7e69fd4@linaro.org/
      
      CC: Daniel Lezcano <daniel.lezcano@linaro.org>
      Fixes: a50c1e35 ("mlxsw: core: Implement thermal zone")
      Fixes: a421ce08 ("mlxsw: core: Extend cooling device with cooling levels")
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Tested-by: NVadim Pasternak <vadimp@nvidia.com>
      Link: https://lore.kernel.org/r/20211012174955.472928-1-idosch@idosch.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      332fdf95
    • A
      ethernet: s2io: fix setting mac address during resume · 40507e7a
      Arnd Bergmann 提交于
      After recent cleanups, gcc started warning about a suspicious
      memcpy() call during the s2io_io_resume() function:
      
      In function '__dev_addr_set',
          inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
          inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
          inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:
      arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
        182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
      include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
       4648 |         memcpy(dev->dev_addr, addr, len);
            |         ^~~~~~
      
      What apparently happened is that an old cleanup changed the calling
      conventions for s2io_set_mac_addr() from taking an ethernet address
      as a character array to taking a struct sockaddr, but one of the
      callers was not changed at the same time.
      
      Change it to instead call the low-level do_s2io_prog_unicast() function
      that still takes the old argument type.
      
      Fixes: 2fd37688 ("S2io: Added support set_mac_address driver entry point")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20211013143613.2049096-1-arnd@kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      40507e7a
    • U
      spi-mux: Fix false-positive lockdep splats · 16a8e2fb
      Uwe Kleine-König 提交于
      io_mutex is taken by spi_setup() and spi-mux's .setup() callback calls
      spi_setup() which results in a nested lock of io_mutex.
      
      add_lock is taken by spi_add_device(). The device_add() call in there
      can result in calling spi-mux's .probe() callback which registers its
      own spi controller which in turn results in spi_add_device() being
      called again.
      
      To fix this initialize the controller's locks already in
      spi_alloc_controller() to give spi_mux_probe() a chance to set the
      lockdep subclass.
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20211013133710.2679703-2-u.kleine-koenig@pengutronix.deSigned-off-by: NMark Brown <broonie@kernel.org>
      16a8e2fb
    • M
      spi: Fix deadlock when adding SPI controllers on SPI buses · 6098475d
      Mark Brown 提交于
      Currently we have a global spi_add_lock which we take when adding new
      devices so that we can check that we're not trying to reuse a chip
      select that's already controlled.  This means that if the SPI device is
      itself a SPI controller and triggers the instantiation of further SPI
      devices we trigger a deadlock as we try to register and instantiate
      those devices while in the process of doing so for the parent controller
      and hence already holding the global spi_add_lock.  Since we only care
      about concurrency within a single SPI bus move the lock to be per
      controller, avoiding the deadlock.
      
      This can be easily triggered in the case of spi-mux.
      Reported-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6098475d
    • H
      EDAC/armada-xp: Fix output of uncorrectable error counter · d9b7748f
      Hans Potsch 提交于
      The number of correctable errors is displayed as uncorrectable
      errors because the "SBE" error count is passed to both calls of
      edac_mc_handle_error().
      
      Pass the correct uncorrectable error count to the second
      edac_mc_handle_error() call when logging uncorrectable errors.
      
       [ bp: Massage commit message. ]
      
      Fixes: 7f6998a4 ("ARM: 8888/1: EDAC: Add driver for the Marvell Armada XP SDRAM and L2 cache ECC")
      Signed-off-by: NHans Potsch <hans.potsch@nokia.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20211006121332.58788-1-hans.potsch@nokia.com
      d9b7748f
    • A
      nvme: fix per-namespace chardev deletion · be5eb933
      Adam Manzanares 提交于
      Decrease reference count of chardevice during char device deletion in
      order to fix a memory leak.  Add a release callabck for the device
      associated chardev and move ida_simple_remove into the release function.
      
      Fixes: 2637baed ("nvme: introduce generic per-namespace chardev")
      Reported-by: NYi Zhang <yi.zhang@redhat.com>
      Suggested-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NAdam Manzanares <a.manzanares@samsung.com>
      Reviewed-by: NJavier González <javier@javigon.com>
      Tested-by: NYi Zhang <yi.zhang@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      be5eb933
    • W
      ata: ahci_platform: fix null-ptr-deref in ahci_platform_enable_regulators() · 776c7501
      Wang Hai 提交于
      I got a null-ptr-deref report:
      
      KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
      ...
      RIP: 0010:regulator_enable+0x84/0x260
      ...
      Call Trace:
       ahci_platform_enable_regulators+0xae/0x320
       ahci_platform_enable_resources+0x1a/0x120
       ahci_probe+0x4f/0x1b9
       platform_probe+0x10b/0x280
      ...
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      If devm_regulator_get() in ahci_platform_get_resources() fails,
      hpriv->phy_regulator will point to NULL, when enabling or disabling it,
      null-ptr-deref will occur.
      
      ahci_probe()
      	ahci_platform_get_resources()
      		devm_regulator_get(, "phy") // failed, let phy_regulator = NULL
      	ahci_platform_enable_resources()
      		ahci_platform_enable_regulators()
      			regulator_enable(hpriv->phy_regulator) // null-ptr-deref
      
      commit 962399bb ("ata: libahci_platform: Fix regulator_get_optional()
      misuse") replaces devm_regulator_get_optional() with devm_regulator_get(),
      but PHY regulator omits to delete "hpriv->phy_regulator = NULL;" like AHCI.
      Delete it like AHCI regulator to fix this bug.
      
      Fixes: commit 962399bb ("ata: libahci_platform: Fix regulator_get_optional() misuse")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NWang Hai <wanghai38@huawei.com>
      Reviewed-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      776c7501
    • N
      net: encx24j600: check error in devm_regmap_init_encx24j600 · f03dca0c
      Nanyong Sun 提交于
      devm_regmap_init may return error which caused by like out of memory,
      this will results in null pointer dereference later when reading
      or writing register:
      
      general protection fault in encx24j600_spi_probe
      KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
      CPU: 0 PID: 286 Comm: spi-encx24j600- Not tainted 5.15.0-rc2-00142-g9978db750e31-dirty #11 9c53a778c1306b1b02359f3c2bbedc0222cba652
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
      RIP: 0010:regcache_cache_bypass drivers/base/regmap/regcache.c:540
      Code: 54 41 89 f4 55 53 48 89 fb 48 83 ec 08 e8 26 94 a8 fe 48 8d bb a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 4a 03 00 00 4c 8d ab b0 00 00 00 48 8b ab a0 00
      RSP: 0018:ffffc900010476b8 EFLAGS: 00010207
      RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: 0000000000000000
      RDX: 0000000000000012 RSI: ffff888002de0000 RDI: 0000000000000094
      RBP: ffff888013c9a000 R08: 0000000000000000 R09: fffffbfff3f9cc6a
      R10: ffffc900010476e8 R11: fffffbfff3f9cc69 R12: 0000000000000001
      R13: 000000000000000a R14: ffff888013c9af54 R15: ffff888013c9ad08
      FS:  00007ffa984ab580(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055a6384136c8 CR3: 000000003bbe6003 CR4: 0000000000770ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
       encx24j600_spi_probe drivers/net/ethernet/microchip/encx24j600.c:459
       spi_probe drivers/spi/spi.c:397
       really_probe drivers/base/dd.c:517
       __driver_probe_device drivers/base/dd.c:751
       driver_probe_device drivers/base/dd.c:782
       __device_attach_driver drivers/base/dd.c:899
       bus_for_each_drv drivers/base/bus.c:427
       __device_attach drivers/base/dd.c:971
       bus_probe_device drivers/base/bus.c:487
       device_add drivers/base/core.c:3364
       __spi_add_device drivers/spi/spi.c:599
       spi_add_device drivers/spi/spi.c:641
       spi_new_device drivers/spi/spi.c:717
       new_device_store+0x18c/0x1f1 [spi_stub 4e02719357f1ff33f5a43d00630982840568e85e]
       dev_attr_store drivers/base/core.c:2074
       sysfs_kf_write fs/sysfs/file.c:139
       kernfs_fop_write_iter fs/kernfs/file.c:300
       new_sync_write fs/read_write.c:508 (discriminator 4)
       vfs_write fs/read_write.c:594
       ksys_write fs/read_write.c:648
       do_syscall_64 arch/x86/entry/common.c:50
       entry_SYSCALL_64_after_hwframe arch/x86/entry/entry_64.S:113
      
      Add error check in devm_regmap_init_encx24j600 to avoid this situation.
      
      Fixes: 04fbfce7 ("net: Microchip encx24j600 driver")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NNanyong Sun <sunnanyong@huawei.com>
      Link: https://lore.kernel.org/r/20211012125901.3623144-1-sunnanyong@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f03dca0c
    • V
      net: korina: select CRC32 · 427f974d
      Vegard Nossum 提交于
      Fix the following build/link error by adding a dependency on the CRC32
      routines:
      
        ld: drivers/net/ethernet/korina.o: in function `korina_multicast_list':
        korina.c:(.text+0x1af): undefined reference to `crc32_le'
      
      Fixes: ef11291b ("Add support the Korina (IDT RC32434) Ethernet MAC")
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NVegard Nossum <vegard.nossum@oracle.com>
      Acked-by: NFlorian fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20211012152509.21771-1-vegard.nossum@oracle.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      427f974d
    • A
      iommu/arm: fix ARM_SMMU_QCOM compilation · 0f0f80d9
      Arnd Bergmann 提交于
      My previous bugfix ended up making things worse for the QCOM IOMMU
      driver when it forgot to add the Kconfig symbol that is getting used to
      control the compilation of the SMMU implementation specific code
      for Qualcomm.
      
      Fixes: 424953cf ("qcom_scm: hide Kconfig symbol")
      Reported-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Reported-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reported-by: NJohn Stultz <john.stultz@linaro.org>
      Link: https://lore.kernel.org/lkml/20211010023350.978638-1-dmitry.baryshkov@linaro.org/Acked-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      0f0f80d9
    • L
      clk: qcom: add select QCOM_GDSC for SM6350 · 92c02ff1
      Luca Weiss 提交于
      QCOM_GDSC is needed for the gcc driver to probe.
      
      Fixes: 131abae9 ("clk: qcom: Add SM6350 GCC driver")
      Signed-off-by: NLuca Weiss <luca@z3ntu.xyz>
      Reviewed-by: NKonrad Dybcio <konrad.dybcio@somainline.org>
      Link: https://lore.kernel.org/r/20211007212444.328034-2-luca@z3ntu.xyzSigned-off-by: NStephen Boyd <sboyd@kernel.org>
      92c02ff1
    • S
      clk: qcom: gcc-sm6115: Fix offset for hlos1_vote_turing_mmu_tbu0_gdsc · e41bdd18
      Shawn Guo 提交于
      It looks that the offset 0x7d060 is a copy & paste from above
      hlos1_vote_turing_mmu_tbu1_gdsc.  Correct it to 0x7d07c as per
      downstream kernel.
      
      Fixes: cbe63bfd ("clk: qcom: Add Global Clock controller (GCC) driver for SM6115")
      Signed-off-by: NShawn Guo <shawn.guo@linaro.org>
      Link: https://lore.kernel.org/r/20210919022308.24046-1-shawn.guo@linaro.orgSigned-off-by: NStephen Boyd <sboyd@kernel.org>
      e41bdd18
    • V
      net: arc: select CRC32 · e599ee23
      Vegard Nossum 提交于
      Fix the following build/link error by adding a dependency on the CRC32
      routines:
      
        ld: drivers/net/ethernet/arc/emac_main.o: in function `arc_emac_set_rx_mode':
        emac_main.c:(.text+0xb11): undefined reference to `crc32_le'
      
      The crc32_le() call comes through the ether_crc_le() call in
      arc_emac_set_rx_mode().
      
      [v2: moved the select to ARC_EMAC_CORE; the Makefile is a bit confusing,
      but the error comes from emac_main.o, which is part of the arc_emac module,
      which in turn is enabled by CONFIG_ARC_EMAC_CORE. Note that arc_emac is
      different from emac_arc...]
      
      Fixes: 775dd682 ("arc_emac: implement promiscuous mode and multicast filtering")
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NVegard Nossum <vegard.nossum@oracle.com>
      Link: https://lore.kernel.org/r/20211012093446.1575-1-vegard.nossum@oracle.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      e599ee23
  7. 13 10月, 2021 7 次提交
    • S
      nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells · 5d388fa0
      Stephen Boyd 提交于
      If a cell has 'nbits' equal to a multiple of BITS_PER_BYTE the logic
      
       *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0);
      
      will become undefined behavior because nbits modulo BITS_PER_BYTE is 0, and we
      subtract one from that making a large number that is then shifted more than the
      number of bits that fit into an unsigned long.
      
      UBSAN reports this problem:
      
       UBSAN: shift-out-of-bounds in drivers/nvmem/core.c:1386:8
       shift exponent 64 is too large for 64-bit type 'unsigned long'
       CPU: 6 PID: 7 Comm: kworker/u16:0 Not tainted 5.15.0-rc3+ #9
       Hardware name: Google Lazor (rev3+) with KB Backlight (DT)
       Workqueue: events_unbound deferred_probe_work_func
       Call trace:
        dump_backtrace+0x0/0x170
        show_stack+0x24/0x30
        dump_stack_lvl+0x64/0x7c
        dump_stack+0x18/0x38
        ubsan_epilogue+0x10/0x54
        __ubsan_handle_shift_out_of_bounds+0x180/0x194
        __nvmem_cell_read+0x1ec/0x21c
        nvmem_cell_read+0x58/0x94
        nvmem_cell_read_variable_common+0x4c/0xb0
        nvmem_cell_read_variable_le_u32+0x40/0x100
        a6xx_gpu_init+0x170/0x2f4
        adreno_bind+0x174/0x284
        component_bind_all+0xf0/0x264
        msm_drm_bind+0x1d8/0x7a0
        try_to_bring_up_master+0x164/0x1ac
        __component_add+0xbc/0x13c
        component_add+0x20/0x2c
        dp_display_probe+0x340/0x384
        platform_probe+0xc0/0x100
        really_probe+0x110/0x304
        __driver_probe_device+0xb8/0x120
        driver_probe_device+0x4c/0xfc
        __device_attach_driver+0xb0/0x128
        bus_for_each_drv+0x90/0xdc
        __device_attach+0xc8/0x174
        device_initial_probe+0x20/0x2c
        bus_probe_device+0x40/0xa4
        deferred_probe_work_func+0x7c/0xb8
        process_one_work+0x128/0x21c
        process_scheduled_works+0x40/0x54
        worker_thread+0x1ec/0x2a8
        kthread+0x138/0x158
        ret_from_fork+0x10/0x20
      
      Fix it by making sure there are any bits to mask out.
      
      Fixes: 69aba794 ("nvmem: Add a simple NVMEM framework for consumers")
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NStephen Boyd <swboyd@chromium.org>
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20211013124511.18726-1-srinivas.kandagatla@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d388fa0
    • C
      vhost-vdpa: Fix the wrong input in config_cb · bcef9356
      Cindy Lu 提交于
      Fix the wrong input in for config_cb. In function vhost_vdpa_config_cb,
      the input cb.private was used as struct vhost_vdpa, so the input was
      wrong here, fix this issue
      
      Fixes: 776f3950 ("vhost_vdpa: Support config interrupt in vdpa")
      Signed-off-by: NCindy Lu <lulu@redhat.com>
      Link: https://lore.kernel.org/r/20210929090933.20465-1-lulu@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      bcef9356
    • M
      Revert "virtio-blk: Add validation for block size in config space" · ff631988
      Michael S. Tsirkin 提交于
      It turns out that access to config space before completing the feature
      negotiation is broken for big endian guests at least with QEMU hosts up
      to 6.1 inclusive.  This affects any device that accesses config space in
      the validate callback: at the moment that is virtio-net with
      VIRTIO_NET_F_MTU but since 82e89ea0 ("virtio-blk: Add validation for
      block size in config space") that also started affecting virtio-blk with
      VIRTIO_BLK_F_BLK_SIZE. Further, unlike VIRTIO_NET_F_MTU which is off by
      default on QEMU, VIRTIO_BLK_F_BLK_SIZE is on by default, which resulted
      in lots of people not being able to boot VMs on BE.
      
      The spec is very clear that what we are doing is legal so QEMU needs to
      be fixed, but given it's been broken for so many years and no one
      noticed, we need to give QEMU a bit more time before applying this.
      
      Further, this patch is incomplete (does not check blk size is a power
      of two) and it duplicates the logic from nbd.
      
      Revert for now, and we'll reapply a cleaner logic in the next release.
      
      Cc: stable@vger.kernel.org
      Fixes: 82e89ea0 ("virtio-blk: Add validation for block size in config space")
      Cc: Xie Yongji <xieyongji@bytedance.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      ff631988
    • W
      vhost_vdpa: unset vq irq before freeing irq · 97f854be
      Wu Zongyong 提交于
      Currently we unset vq irq after freeing irq and that will result in
      error messages:
      
        pi_update_irte: failed to update PI IRTE
        irq bypass consumer (token 000000005a07a12b) unregistration fails: -22
      
      This patch solves this.
      Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com>
      Link: https://lore.kernel.org/r/02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      97f854be
    • H
      virtio: write back F_VERSION_1 before validate · 2f9a174f
      Halil Pasic 提交于
      The virtio specification virtio-v1.1-cs01 states: "Transitional devices
      MUST detect Legacy drivers by detecting that VIRTIO_F_VERSION_1 has not
      been acknowledged by the driver."  This is exactly what QEMU as of 6.1
      has done relying solely on VIRTIO_F_VERSION_1 for detecting that.
      
      However, the specification also says: "... the driver MAY read (but MUST
      NOT write) the device-specific configuration fields to check that it can
      support the device ..." before setting FEATURES_OK.
      
      In that case, any transitional device relying solely on
      VIRTIO_F_VERSION_1 for detecting legacy drivers will return data in
      legacy format.  In particular, this implies that it is in big endian
      format for big endian guests. This naturally confuses the driver which
      expects little endian in the modern mode.
      
      It is probably a good idea to amend the spec to clarify that
      VIRTIO_F_VERSION_1 can only be relied on after the feature negotiation
      is complete. Before validate callback existed, config space was only
      read after FEATURES_OK. However, we already have two regressions, so
      let's address this here as well.
      
      The regressions affect the VIRTIO_NET_F_MTU feature of virtio-net and
      the VIRTIO_BLK_F_BLK_SIZE feature of virtio-blk for BE guests when
      virtio 1.0 is used on both sides. The latter renders virtio-blk unusable
      with DASD backing, because things simply don't work with the default.
      See Fixes tags for relevant commits.
      
      For QEMU, we can work around the issue by writing out the feature bits
      with VIRTIO_F_VERSION_1 bit set.  We (ab)use the finalize_features
      config op for this. This isn't enough to address all vhost devices since
      these do not get the features until FEATURES_OK, however it looks like
      the affected devices actually never handled the endianness for legacy
      mode correctly, so at least that's not a regression.
      
      No devices except virtio net and virtio blk seem to be affected.
      
      Long term the right thing to do is to fix the hypervisors.
      
      Cc: <stable@vger.kernel.org> #v4.11
      Signed-off-by: NHalil Pasic <pasic@linux.ibm.com>
      Fixes: 82e89ea0 ("virtio-blk: Add validation for block size in config space")
      Fixes: fe36cbe0 ("virtio_net: clear MTU when out of range")
      Reported-by: markver@us.ibm.com
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Link: https://lore.kernel.org/r/20211011053921.1198936-1-pasic@linux.ibm.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      2f9a174f
    • M
      usb: musb: dsps: Fix the probe error path · c2115b2b
      Miquel Raynal 提交于
      Commit 7c75bde3 ("usb: musb: musb_dsps: request_irq() after
      initializing musb") has inverted the calls to
      dsps_setup_optional_vbus_irq() and dsps_create_musb_pdev() without
      updating correctly the error path. dsps_create_musb_pdev() allocates and
      registers a new platform device which must be unregistered and freed
      with platform_device_unregister(), and this is missing upon
      dsps_setup_optional_vbus_irq() error.
      
      While on the master branch it seems not to trigger any issue, I observed
      a kernel crash because of a NULL pointer dereference with a v5.10.70
      stable kernel where the patch mentioned above was backported. With this
      kernel version, -EPROBE_DEFER is returned the first time
      dsps_setup_optional_vbus_irq() is called which triggers the probe to
      error out without unregistering the platform device. Unfortunately, on
      the Beagle Bone Black Wireless, the platform device still living in the
      system is being used by the USB Ethernet gadget driver, which during the
      boot phase triggers the crash.
      
      My limited knowledge of the musb world prevents me to revert this commit
      which was sent to silence a robot warning which, as far as I understand,
      does not make sense. The goal of this patch was to prevent an IRQ to
      fire before the platform device being registered. I think this cannot
      ever happen due to the fact that enabling the interrupts is done by the
      ->enable() callback of the platform musb device, and this platform
      device must be already registered in order for the core or any other
      user to use this callback.
      
      Hence, I decided to fix the error path, which might prevent future
      errors on mainline kernels while also fixing older ones.
      
      Fixes: 7c75bde3 ("usb: musb: musb_dsps: request_irq() after initializing musb")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/r/20211005221631.1529448-1-miquel.raynal@bootlin.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2115b2b
    • Z
      drm/i915: Free the returned object of acpi_evaluate_dsm() · 82a59c7f
      Zenghui Yu 提交于
      As per the comment on top of acpi_evaluate_dsm():
      
      | * Evaluate device's _DSM method with specified GUID, revision id and
      | * function number. Caller needs to free the returned object.
      
      We should free the returned object of acpi_evaluate_dsm() to avoid memory
      leakage. Otherwise the kmemleak splat will be triggered at boot time (if we
      compile kernel with CONFIG_DEBUG_TEST_DRIVER_REMOVE=y).
      
      Fixes: 8e55f99c ("drm/i915: Invoke another _DSM to enable MUX on HP Workstation laptops")
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: NZenghui Yu <yuzenghui@huawei.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210906033541.862-1-yuzenghui@huawei.com
      (cherry picked from commit 149ac2e7)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      82a59c7f