1. 28 2月, 2023 4 次提交
  2. 22 2月, 2023 1 次提交
  3. 08 2月, 2023 2 次提交
  4. 31 1月, 2023 1 次提交
  5. 18 1月, 2023 6 次提交
  6. 11 1月, 2023 1 次提交
    • A
      USB: core: Prevent nested device-reset calls · e253b825
      Alan Stern 提交于
      mainline inclusion
      from mainline-v6.0-rc4
      commit 9c6d7788
      category: bugfix
      bugzilla: https://gitee.com/src-openeuler/kernel/issues/I675RE
      CVE: CVE-2022-4662
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9c6d778800b921bde3bff3cff5003d1650f942d1
      
      --------------------------------
      
      Automatic kernel fuzzing revealed a recursive locking violation in
      usb-storage:
      
      ============================================
      WARNING: possible recursive locking detected
      5.18.0 #3 Not tainted
      --------------------------------------------
      kworker/1:3/1205 is trying to acquire lock:
      ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      
      but task is already holding lock:
      ffff888018638db8 (&us_interface_key[i]){+.+.}-{3:3}, at:
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      
      ...
      
      stack backtrace:
      CPU: 1 PID: 1205 Comm: kworker/1:3 Not tainted 5.18.0 #3
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.13.0-1ubuntu1.1 04/01/2014
      Workqueue: usb_hub_wq hub_event
      Call Trace:
      <TASK>
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
      print_deadlock_bug kernel/locking/lockdep.c:2988 [inline]
      check_deadlock kernel/locking/lockdep.c:3031 [inline]
      validate_chain kernel/locking/lockdep.c:3816 [inline]
      __lock_acquire.cold+0x152/0x3ca kernel/locking/lockdep.c:5053
      lock_acquire kernel/locking/lockdep.c:5665 [inline]
      lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5630
      __mutex_lock_common kernel/locking/mutex.c:603 [inline]
      __mutex_lock+0x14f/0x1610 kernel/locking/mutex.c:747
      usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
      usb_reset_device+0x37d/0x9a0 drivers/usb/core/hub.c:6109
      r871xu_dev_remove+0x21a/0x270 drivers/staging/rtl8712/usb_intf.c:622
      usb_unbind_interface+0x1bd/0x890 drivers/usb/core/driver.c:458
      device_remove drivers/base/dd.c:545 [inline]
      device_remove+0x11f/0x170 drivers/base/dd.c:537
      __device_release_driver drivers/base/dd.c:1222 [inline]
      device_release_driver_internal+0x1a7/0x2f0 drivers/base/dd.c:1248
      usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627
      usb_forced_unbind_intf+0x4d/0xa0 drivers/usb/core/driver.c:1118
      usb_reset_device+0x39b/0x9a0 drivers/usb/core/hub.c:6114
      
      This turned out not to be an error in usb-storage but rather a nested
      device reset attempt.  That is, as the rtl8712 driver was being
      unbound from a composite device in preparation for an unrelated USB
      reset (that driver does not have pre_reset or post_reset callbacks),
      its ->remove routine called usb_reset_device() -- thus nesting one
      reset call within another.
      
      Performing a reset as part of disconnect processing is a questionable
      practice at best.  However, the bug report points out that the USB
      core does not have any protection against nested resets.  Adding a
      reset_in_progress flag and testing it will prevent such errors in the
      future.
      
      Link: https://lore.kernel.org/all/CAB7eexKUpvX-JNiLzhXBDWgfg2T9e9_0Tw4HQ6keN==voRbP0g@mail.gmail.com/
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: NRondreis <linhaoguo86@gmail.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/YwkflDxvg0KWqyZK@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYuyao Lin <linyuyao1@huawei.com>
      Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
      e253b825
  7. 04 1月, 2023 3 次提交
  8. 13 12月, 2022 5 次提交
  9. 12 12月, 2022 2 次提交
    • Y
      blk-mq: don't access request_wrapper if request is not allocated from block layer · 9981c33d
      Yu Kuai 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I65K8D
      CVE: NA
      
      --------------------------------
      
      request_wrapper is used to fix kabi broken for request, it's only for
      internal use. This patch make sure out-of-tree drivers won't access
      request_wrapper if request is not managed by block layer.
      Signed-off-by: NYu Kuai <yukuai3@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      9981c33d
    • Y
      blk-mq: fix kabi broken due to request_wrapper · 31c285dd
      Yu Kuai 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I65K8D
      CVE: NA
      
      --------------------------------
      
      Before commit f60df4a0 ("blk-mq: fix kabi broken in struct
      request"), drivers will got cmd address right after request, however,
      after this commit, drivers will got cmd address after request_wrapper
      instead, which is bigger than request and will cause compatibility
      issues.
      
      Fix the problem by placing request_wrapper behind cmd, so that the
      cmd address for drivers will stay the same.
      
      Before commit:		|request|cmd|
      After commit:		|request|request_wrapper|cmd|
      With this patch:	|request|cmd|request_wrapper|
      
      Performance test: arm64 Kunpeng-920 96 core
      
      1) null_blk setup:
      modprobe null_blk nr_devices=0 &&
          udevadm settle &&
          cd /sys/kernel/config/nullb &&
          mkdir nullb0 &&
          cd nullb0 &&
          echo 0 > completion_nsec &&
          echo 512 > blocksize &&
          echo 0 > home_node &&
          echo 0 > irqmode &&
          echo 1024 > size &&
          echo 0 > memory_backed &&
          echo 2 > queue_mode &&
      	echo 4096 > hw_queue_depth &&
      	echo 96 > submit_queues &&
          echo 1 > power
      
      2) fio test script:
      [global]
      ioengine=libaio
      direct=1
      numjobs=96
      iodepth=32
      bs=4k
      rw=randwrite
      allow_mounted_write=0
      time_based
      runtime=60
      group_reporting=1
      ioscheduler=none
      cpus_allowed_policy=split
      cpus_allowed=0-95
      
      [test]
      filename=/dev/nullb0
      
      3) iops test result:
      
      without this patch:	23.9M
      with this patch:	24.1M
      
      Fixes: f60df4a0 ("blk-mq: fix kabi broken in struct request")
      Signed-off-by: NYu Kuai <yukuai3@huawei.com>
      Reviewed-by: NHou Tao <houtao1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      31c285dd
  10. 07 12月, 2022 14 次提交
  11. 29 11月, 2022 1 次提交
    • H
      PCI: Add quirk for LS7A to avoid reboot failure · 57fe34d8
      Huacai Chen 提交于
      LoongArch inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I5OHOB
      
      --------------------------------
      
      cc27b735 ("PCI/portdrv: Turn off PCIe services during shutdown")
      causes poweroff/reboot failure on systems with LS7A chipset. We found
      that if we remove "pci_command &= ~PCI_COMMAND_MASTER" in do_pci_disable
      _device(), it can work well. The hardware engineer says that the root
      cause is that CPU is still accessing PCIe devices while poweroff/reboot,
      and if we disable the Bus Master Bit at this time, the PCIe controller
      doesn't forward requests to downstream devices, and also does not send
      TIMEOUT to CPU, which causes CPU wait forever (hardware deadlock). This
      behavior is a PCIe protocol violation (Bus Master should not be involved
      in CPU MMIO transactions), and it will be fixed in new revisions of
      hardware (add timeout mechanism for CPU read request, whether or not Bus
      Master bit is cleared).
      
      On some x86 platforms, radeon/amdgpu devices can cause similar problems
      [1][2]. Once before I wanted to make a single patch to solve "all of
      these problems" together, but it seems unreasonable because maybe they
      are not exactly the same problem. So, this patch add a new function
      pcie_portdrv_shutdown(), a slight modified copy of pcie_portdrv_remove()
      dedicated for the shutdown path, and then add a quirk just for LS7A to
      avoid clearing Bus Master bit in pcie_portdrv_shutdown(). Leave other
      platforms behave as before.
      
      [1] https://bugs.freedesktop.org/show_bug.cgi?id=97980
      [2] https://bugs.freedesktop.org/show_bug.cgi?id=98638Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
      57fe34d8