1. 14 12月, 2022 3 次提交
    • Y
      LoongArch: extable: Add `type` and `data` fields · 26bc8244
      Youling Tang 提交于
      This is a LoongArch port of commit d6e2cc56 ("arm64: extable: add
      `type` and `data` fields").
      
      Subsequent patches will add specialized handlers for fixups, in addition
      to the simple PC fixup we have today. In preparation, this patch adds a
      new `type` field to struct exception_table_entry, and uses this to
      distinguish the fixup and other cases. A `data` field is also added so
      that subsequent patches can associate data specific to each exception
      site (e.g. register numbers).
      
      Handlers are named ex_handler_*() for consistency, following the example
      of x86. At the same time, get_ex_fixup() is split out into a helper so
      that it can be used by other ex_handler_*() functions in the subsequent
      patches.
      Signed-off-by: NYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
      26bc8244
    • Y
      LoongArch: Switch to relative exception tables · 3d36f429
      Youling Tang 提交于
      Similar to other architectures such as arm64, x86, riscv and so on, use
      offsets relative to the exception table entry values rather than their
      absolute addresses for both the exception location and the fixup.
      
      However, LoongArch label difference because it will actually produce two
      relocations, a pair of R_LARCH_ADD32 and R_LARCH_SUB32. Take simple code
      below for example:
      
      $ cat test_ex_table.S
      .section .text
      1:
              nop
      .section __ex_table,"a"
              .balign 4
              .long (1b - .)
      .previous
      
      $ loongarch64-unknown-linux-gnu-gcc -c test_ex_table.S
      $ loongarch64-unknown-linux-gnu-readelf -Wr test_ex_table.o
      
      Relocation section '.rela__ex_table' at offset 0x100 contains 2 entries:
          Offset            Info             Type         Symbol's Value   Symbol's Name + Addend
      0000000000000000 0000000600000032 R_LARCH_ADD32    0000000000000000  .L1^B1 + 0
      0000000000000000 0000000500000037 R_LARCH_SUB32    0000000000000000  L0^A + 0
      
      The modpost will complain the R_LARCH_SUB32 relocation, so we need to
      patch modpost.c to skip this relocation for .rela__ex_table section.
      Signed-off-by: NYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
      3d36f429
    • Y
      LoongArch: Consolidate __ex_table construction · 508f28c6
      Youling Tang 提交于
      Consolidate all the __ex_table constuction code with a _ASM_EXTABLE or
      _asm_extable helper.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
      508f28c6
  2. 13 12月, 2022 1 次提交
  3. 12 12月, 2022 7 次提交
    • R
      Merge branches 'acpi-fan', 'acpi-pcc', 'acpi-misc' and 'pnp' · bee74dcb
      Rafael J. Wysocki 提交于
      Merge ACPI fan driver fixes, ACPI PCC driver fixes, miscellaneous ACPI
      cleanups and PNP updates for 6.2-rc1:
      
       - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface
         code (ye xingchen).
      
       - Fix the _FIF package extraction failure handling in the ACPI fan
         driver (Hanjun Guo).
      
       - Fix the PCC mailbox handling error code path (Huisong Li).
      
       - Avoid using PCC Opregions if there is no platform interrupt allocated
         for this purpose (Huisong Li).
      
       - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and
         CPPC library (ye xingchen).
      
       - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng
         Wang).
      
       - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang).
      
       - Do not disable PNP devices on suspend when they cannot be re-enabled
         on resume (Hans de Goede).
      
      * acpi-fan:
        ACPI: fan: Convert to use sysfs_emit_at() API
        ACPI: fan: Bail out if extract package failed
      
      * acpi-pcc:
        mailbox: pcc: Reset pcc_chan_count to zero in case of PCC probe failure
        ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available
      
      * acpi-misc:
        ACPI: use sysfs_emit() instead of scnprintf()
        ACPI: irq: Fix some kernel-doc issues
      
      * pnp:
        PNP: Do not disable devices on suspend when they cannot be re-enabled on resume
        PNP: fix name memory leak in pnp_alloc_dev()
      bee74dcb
    • R
      Merge branches 'acpi-apei', 'acpi-x86', 'acpi-battery' and 'acpi-pfrut' · 39f26d10
      Rafael J. Wysocki 提交于
      Make ACPI APEI updates, x86-specific ACPI updates, ACPI battery driver
      fix and ACPI PFRU/T driver fixes for 6.2-rc1:
      
       - Drop unsetting ACPI APEI driver data on remove (Uwe Kleine-König).
      
       - Use xchg_release() instead of cmpxchg() for updating new GHES cache
         slots (Ard Biesheuvel).
      
       - Clean up the ACPI APEI code (Sudeep Holla, Christophe JAILLET, Jay Lu).
      
       - Add new I2C device enumeration quirks for Medion Lifetab S10346 and
         Lenovo Yoga Tab 3 Pro (YT3-X90F) (Hans de Goede).
      
       - Make the ACPI battery driver notify user space about adding new
         battery hooks and removing the existing ones (Armin Wolf).
      
       - Modify the pfr_update and pfr_telemetry drivers to use ACPI_FREE()
         for freeing acpi_object structures to help diagnostics (Wang ShaoBo).
      
      * acpi-apei:
        ACPI: APEI: EINJ: Refactor available_error_type_show()
        ACPI: APEI: EINJ: Fix formatting errors
        ACPI: APEI: Remove a useless include
        ACPI: APEI: Silence missing prototype warnings
        apei/ghes: Use xchg_release() for updating new cache slot instead of cmpxchg()
        ACPI: APEI: Drop unsetting driver data on remove
      
      * acpi-x86:
        ACPI: x86: Add skip i2c clients quirk for Medion Lifetab S10346
        ACPI: x86: Add skip i2c clients quirk for Lenovo Yoga Tab 3 Pro (YT3-X90F)
      
      * acpi-battery:
        ACPI: battery: Call power_supply_changed() when adding hooks
      
      * acpi-pfrut:
        ACPI: pfr_update: use ACPI_FREE() to free acpi_object
        ACPI: pfr_telemetry: use ACPI_FREE() to free acpi_object
      39f26d10
    • R
      Merge branches 'acpi-pm', 'acpi-processor', 'acpi-ec' and 'acpi-video' · 6f158181
      Rafael J. Wysocki 提交于
      Make ACPI power management changes, ACPI processor driver updates, ACPI
      EC driver quirk and ACPI backlight driver updates for 6.2-rc1:
      
       - Print full name paths of ACPI power resources objects during
         enumeration (Kane Chen).
      
       - Eliminate a compiler warning regarding a missing function prototype
         in the ACPI power management code (Sudeep Holla).
      
       - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong,
         Colin Ian King, Sudeep Holla).
      
       - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC
         driver (Mia Kanashi).
      
       - Add some mew ACPI backlight handling quirks and update some existing
         ones (Hans de Goede).
      
       - Make the ACPI backlight driver prefer the native backlight control
         over vendor backlight control when possible (Hans de Goede).
      
      * acpi-pm:
        ACPI: PM: Silence missing prototype warning
        ACPI: PM: Print full name path while adding power resource
      
      * acpi-processor:
        ACPI: processor: perflib: Adjust acpi_processor_notify_smm() return value
        ACPI: processor: perflib: Rearrange acpi_processor_notify_smm()
        ACPI: processor: perflib: Rearrange unregistration routine
        ACPI: processor: perflib: Drop redundant parentheses
        ACPI: processor: perflib: Adjust white space
        ACPI: processor: idle: Drop unnecessary statements and parens
        ACPI: processor: Silence missing prototype warnings
        ACPI: processor_idle: Silence missing prototype warnings
        ACPI: processor: throttling: remove variable count
        ACPI: processor: idle: Check acpi_fetch_acpi_dev() return value
      
      * acpi-ec:
        ACPI: EC: Add quirk for the HP Pavilion Gaming 15-cx0041ur
      
      * acpi-video:
        ACPI: video: Prefer native over vendor
        ACPI: video: Simplify __acpi_video_get_backlight_type()
        ACPI: video: Add force_native quirk for Sony Vaio VPCY11S1E
        ACPI: video: Add force_vendor quirk for Sony Vaio PCG-FRV35
        ACPI: video: Change Sony Vaio VPCEH3U1E quirk to force_native
        ACPI: video: Change GIGABYTE GB-BXBT-2807 quirk to force_none
        ACPI: video: Add a few bugtracker links to DMI quirks
      6f158181
    • R
      Merge branches 'acpi-scan', 'acpi-bus', 'acpi-tables' and 'acpi-sysfs' · 45494d77
      Rafael J. Wysocki 提交于
      Merge ACPI changes related to device enumeration, device object
      managenet, operation region handling, table parsing and sysfs
      interface:
      
       - Use ZERO_PAGE(0) instead of empty_zero_page in the ACPI device
         enumeration code (Giulio Benetti).
      
       - Change the return type of the ACPI driver remove callback to void and
         update its users accordingly (Dawei Li).
      
       - Add general support for FFH address space type and implement the low-
         level part of it for ARM64 (Sudeep Holla).
      
       - Fix stale comments in the ACPI tables parsing code and make it print
         more messages related to MADT (Hanjun Guo, Huacai Chen).
      
       - Replace invocations of generic library functions with more kernel-
         specific counterparts in the ACPI sysfs interface (Christophe JAILLET,
         Xu Panda).
      
      * acpi-scan:
        ACPI: scan: substitute empty_zero_page with helper ZERO_PAGE(0)
      
      * acpi-bus:
        ACPI: FFH: Silence missing prototype warnings
        ACPI: make remove callback of ACPI driver void
        ACPI: bus: Fix the _OSC capability check for FFH OpRegion
        arm64: Add architecture specific ACPI FFH Opregion callbacks
        ACPI: Implement a generic FFH Opregion handler
      
      * acpi-tables:
        ACPI: tables: Fix the stale comments for acpi_locate_initial_tables()
        ACPI: tables: Print CORE_PIC information when MADT is parsed
      
      * acpi-sysfs:
        ACPI: sysfs: use sysfs_emit() to instead of scnprintf()
        ACPI: sysfs: Use kstrtobool() instead of strtobool()
      45494d77
    • R
      Merge branch 'acpica' · 888bc86e
      Rafael J. Wysocki 提交于
      Merge ACPICA changes, including bug fixes and cleanups as well as support
      for some recently defined data structures, for 6.2-rc1:
      
       - Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki).
       - Add support for loong_arch-specific APICs in MADT (Huacai Chen).
       - Add support for fixed PCIe wake event (Huacai Chen).
       - Add EBDA pointer sanity checks (Vit Kabele).
       - Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele).
       - Add CCEL table support to both compiler/disassembler (Kuppuswamy
         Sathyanarayanan).
       - Add a couple of new UUIDs to the known UUID list (Bob Moore).
       - Add support for FFH Opregion special context data (Sudeep Holla).
       - Improve warning message for "invalid ACPI name" (Bob Moore).
       - Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table
         (Alison Schofield).
       - Prepare IORT support for revision E.e (Robin Murphy).
       - Finish support for the CDAT table (Bob Moore).
       - Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki).
       - Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao).
       - Update the version of the ACPICA code in the kernel (Bob Moore).
      
      * acpica:
        ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage()
        ACPICA: Fix error code path in acpi_ds_call_control_method()
        ACPICA: Update version to 20221020
        ACPICA: Add utcksum.o to the acpidump Makefile
        Revert "LoongArch: Provisionally add ACPICA data structures"
        ACPICA: Finish support for the CDAT table
        ACPICA: IORT: Update for revision E.e
        ACPICA: Add CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table
        ACPICA: Improve warning message for "invalid ACPI name"
        ACPICA: Add support for FFH Opregion special context data
        ACPICA: Add a couple of new UUIDs to the known UUID list
        ACPICA: iASL: Add CCEL table to both compiler/disassembler
        ACPICA: Do not touch VGA memory when EBDA < 1ki_b
        ACPICA: Check that EBDA pointer is in valid memory
        ACPICA: Events: Support fixed PCIe wake event
        ACPICA: MADT: Add loong_arch-specific APICs support
        ACPICA: Make acpi_ex_load_op() match upstream
      888bc86e
    • L
      Linux 6.1 · 830b3c68
      Linus Torvalds 提交于
      830b3c68
    • L
      Merge tag 'iommu-fix-v6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · d92b86f6
      Linus Torvalds 提交于
      Pull iommu fix from Joerg Roedel:
      
       - Fix device mask to catch all affected devices in the recently added
         quirk for QAT devices in the Intel VT-d driver.
      
      * tag 'iommu-fix-v6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Fix buggy QAT device mask
      d92b86f6
  4. 11 12月, 2022 2 次提交
  5. 10 12月, 2022 11 次提交
    • T
      memcg: fix possible use-after-free in memcg_write_event_control() · 4a7ba45b
      Tejun Heo 提交于
      memcg_write_event_control() accesses the dentry->d_name of the specified
      control fd to route the write call.  As a cgroup interface file can't be
      renamed, it's safe to access d_name as long as the specified file is a
      regular cgroup file.  Also, as these cgroup interface files can't be
      removed before the directory, it's safe to access the parent too.
      
      Prior to 347c4a87 ("memcg: remove cgroup_event->cft"), there was a
      call to __file_cft() which verified that the specified file is a regular
      cgroupfs file before further accesses.  The cftype pointer returned from
      __file_cft() was no longer necessary and the commit inadvertently dropped
      the file type check with it allowing any file to slip through.  With the
      invarients broken, the d_name and parent accesses can now race against
      renames and removals of arbitrary files and cause use-after-free's.
      
      Fix the bug by resurrecting the file type check in __file_cft().  Now that
      cgroupfs is implemented through kernfs, checking the file operations needs
      to go through a layer of indirection.  Instead, let's check the superblock
      and dentry type.
      
      Link: https://lkml.kernel.org/r/Y5FRm/cfcKPGzWwl@slm.duckdns.org
      Fixes: 347c4a87 ("memcg: remove cgroup_event->cft")
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NJann Horn <jannh@google.com>
      Acked-by: NRoman Gushchin <roman.gushchin@linux.dev>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: <stable@vger.kernel.org>	[3.14+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      4a7ba45b
    • M
      MAINTAINERS: update Muchun Song's email · a501788a
      Muchun Song 提交于
      I'm moving to the @linux.dev account.  Map my old addresses and update it
      to my new address.
      
      Link: https://lkml.kernel.org/r/20221208115548.85244-1-songmuchun@bytedance.comSigned-off-by: NMuchun Song <songmuchun@bytedance.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      a501788a
    • J
      mm/gup: fix gup_pud_range() for dax · fcd0ccd8
      John Starks 提交于
      For dax pud, pud_huge() returns true on x86. So the function works as long
      as hugetlb is configured. However, dax doesn't depend on hugetlb.
      Commit 414fd080 ("mm/gup: fix gup_pmd_range() for dax") fixed
      devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as
      well.
      
      This fixes the below kernel panic:
      
      general protection fault, probably for non-canonical address 0x69e7c000cc478: 0000 [#1] SMP
      	< snip >
      Call Trace:
      <TASK>
      get_user_pages_fast+0x1f/0x40
      iov_iter_get_pages+0xc6/0x3b0
      ? mempool_alloc+0x5d/0x170
      bio_iov_iter_get_pages+0x82/0x4e0
      ? bvec_alloc+0x91/0xc0
      ? bio_alloc_bioset+0x19a/0x2a0
      blkdev_direct_IO+0x282/0x480
      ? __io_complete_rw_common+0xc0/0xc0
      ? filemap_range_has_page+0x82/0xc0
      generic_file_direct_write+0x9d/0x1a0
      ? inode_update_time+0x24/0x30
      __generic_file_write_iter+0xbd/0x1e0
      blkdev_write_iter+0xb4/0x150
      ? io_import_iovec+0x8d/0x340
      io_write+0xf9/0x300
      io_issue_sqe+0x3c3/0x1d30
      ? sysvec_reschedule_ipi+0x6c/0x80
      __io_queue_sqe+0x33/0x240
      ? fget+0x76/0xa0
      io_submit_sqes+0xe6a/0x18d0
      ? __fget_light+0xd1/0x100
      __x64_sys_io_uring_enter+0x199/0x880
      ? __context_tracking_enter+0x1f/0x70
      ? irqentry_exit_to_user_mode+0x24/0x30
      ? irqentry_exit+0x1d/0x30
      ? __context_tracking_exit+0xe/0x70
      do_syscall_64+0x3b/0x90
      entry_SYSCALL_64_after_hwframe+0x61/0xcb
      RIP: 0033:0x7fc97c11a7be
      	< snip >
      </TASK>
      ---[ end trace 48b2e0e67debcaeb ]---
      RIP: 0010:internal_get_user_pages_fast+0x340/0x990
      	< snip >
      Kernel panic - not syncing: Fatal exception
      Kernel Offset: disabled
      
      Link: https://lkml.kernel.org/r/1670392853-28252-1-git-send-email-ssengar@linux.microsoft.com
      Fixes: 414fd080 ("mm/gup: fix gup_pmd_range() for dax")
      Signed-off-by: NJohn Starks <jostarks@microsoft.com>
      Signed-off-by: NSaurabh Sengar <ssengar@linux.microsoft.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Yu Zhao <yuzhao@google.com>
      Cc: Jason Gunthorpe <jgg@nvidia.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Alistair Popple <apopple@nvidia.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      fcd0ccd8
    • L
      mmap: fix do_brk_flags() modifying obviously incorrect VMAs · 6c28ca64
      Liam Howlett 提交于
      Add more sanity checks to the VMA that do_brk_flags() will expand.  Ensure
      the VMA matches basic merge requirements within the function before
      calling can_vma_merge_after().
      
      Drop the duplicate checks from vm_brk_flags() since they will be enforced
      later.
      
      The old code would expand file VMAs on brk(), which is functionally
      wrong and also dangerous in terms of locking because the brk() path
      isn't designed for file VMAs and therefore doesn't lock the file
      mapping.  Checking can_vma_merge_after() ensures that new anonymous
      VMAs can't be merged into file VMAs.
      
      See https://lore.kernel.org/linux-mm/CAG48ez1tJZTOjS_FjRZhvtDA-STFmdw8PEizPDwMGFd_ui0Nrw@mail.gmail.com/
      
      Link: https://lkml.kernel.org/r/20221205192304.1957418-1-Liam.Howlett@oracle.com
      Fixes: 2e7ce7d3 ("mm/mmap: change do_brk_flags() to expand existing VMA and add do_brk_munmap()")
      Signed-off-by: NLiam R. Howlett <Liam.Howlett@oracle.com>
      Suggested-by: NJann Horn <jannh@google.com>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: SeongJae Park <sj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Yu Zhao <yuzhao@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      6c28ca64
    • D
      mm/swap: fix SWP_PFN_BITS with CONFIG_PHYS_ADDR_T_64BIT on 32bit · 630dc25e
      David Hildenbrand 提交于
      We use "unsigned long" to store a PFN in the kernel and phys_addr_t to
      store a physical address.
      
      On a 64bit system, both are 64bit wide.  However, on a 32bit system, the
      latter might be 64bit wide.  This is, for example, the case on x86 with
      PAE: phys_addr_t and PTEs are 64bit wide, while "unsigned long" only spans
      32bit.
      
      The current definition of SWP_PFN_BITS without MAX_PHYSMEM_BITS misses
      that case, and assumes that the maximum PFN is limited by an 32bit
      phys_addr_t.  This implies, that SWP_PFN_BITS will currently only be able
      to cover 4 GiB - 1 on any 32bit system with 4k page size, which is wrong.
      
      Let's rely on the number of bits in phys_addr_t instead, but make sure to
      not exceed the maximum swap offset, to not make the BUILD_BUG_ON() in
      is_pfn_swap_entry() unhappy.  Note that swp_entry_t is effectively an
      unsigned long and the maximum swap offset shares that value with the swap
      type.
      
      For example, on an 8 GiB x86 PAE system with a kernel config based on
      Debian 11.5 (-> CONFIG_FLATMEM=y, CONFIG_X86_PAE=y), we will currently
      fail removing migration entries (remove_migration_ptes()), because
      mm/page_vma_mapped.c:check_pte() will fail to identify a PFN match as
      swp_offset_pfn() wrongly masks off PFN bits.  For example,
      split_huge_page_to_list()->...->remap_page() will leave migration entries
      in place and continue to unlock the page.
      
      Later, when we stumble over these migration entries (e.g., via
      /proc/self/pagemap), pfn_swap_entry_to_page() will BUG_ON() because these
      migration entries shouldn't exist anymore and the page was unlocked.
      
      [   33.067591] kernel BUG at include/linux/swapops.h:497!
      [   33.067597] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
      [   33.067602] CPU: 3 PID: 742 Comm: cow Tainted: G            E      6.1.0-rc8+ #16
      [   33.067605] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014
      [   33.067606] EIP: pagemap_pmd_range+0x644/0x650
      [   33.067612] Code: 00 00 00 00 66 90 89 ce b9 00 f0 ff ff e9 ff fb ff ff 89 d8 31 db e8 48 c6 52 00 e9 23 fb ff ff e8 61 83 56 00 e9 b6 fe ff ff <0f> 0b bf 00 f0 ff ff e9 38 fa ff ff 3e 8d 74 26 00 55 89 e5 57 31
      [   33.067615] EAX: ee394000 EBX: 00000002 ECX: ee394000 EDX: 00000000
      [   33.067617] ESI: c1b0ded4 EDI: 00024a00 EBP: c1b0ddb4 ESP: c1b0dd68
      [   33.067619] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00010246
      [   33.067624] CR0: 80050033 CR2: b7a00000 CR3: 01bbbd20 CR4: 00350ef0
      [   33.067625] Call Trace:
      [   33.067628]  ? madvise_free_pte_range+0x720/0x720
      [   33.067632]  ? smaps_pte_range+0x4b0/0x4b0
      [   33.067634]  walk_pgd_range+0x325/0x720
      [   33.067637]  ? mt_find+0x1d6/0x3a0
      [   33.067641]  ? mt_find+0x1d6/0x3a0
      [   33.067643]  __walk_page_range+0x164/0x170
      [   33.067646]  walk_page_range+0xf9/0x170
      [   33.067648]  ? __kmem_cache_alloc_node+0x2a8/0x340
      [   33.067653]  pagemap_read+0x124/0x280
      [   33.067658]  ? default_llseek+0x101/0x160
      [   33.067662]  ? smaps_account+0x1d0/0x1d0
      [   33.067664]  vfs_read+0x90/0x290
      [   33.067667]  ? do_madvise.part.0+0x24b/0x390
      [   33.067669]  ? debug_smp_processor_id+0x12/0x20
      [   33.067673]  ksys_pread64+0x58/0x90
      [   33.067675]  __ia32_sys_ia32_pread64+0x1b/0x20
      [   33.067680]  __do_fast_syscall_32+0x4c/0xc0
      [   33.067683]  do_fast_syscall_32+0x29/0x60
      [   33.067686]  do_SYSENTER_32+0x15/0x20
      [   33.067689]  entry_SYSENTER_32+0x98/0xf1
      
      Decrease the indentation level of SWP_PFN_BITS and SWP_PFN_MASK to keep it
      readable and consistent.
      
      [david@redhat.com: rely on sizeof(phys_addr_t) and min_t() instead]
        Link: https://lkml.kernel.org/r/20221206105737.69478-1-david@redhat.com
      [david@redhat.com: use "int" for comparison, as we're only comparing numbers < 64]
        Link: https://lkml.kernel.org/r/1f157500-2676-7cef-a84e-9224ed64e540@redhat.com
      Link: https://lkml.kernel.org/r/20221205150857.167583-1-david@redhat.com
      Fixes: 0d206b5d ("mm/swap: add swp_offset_pfn() to fetch PFN from swap entry")
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NYang Shi <shy828301@gmail.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      630dc25e
    • H
      tmpfs: fix data loss from failed fallocate · 44bcabd7
      Hugh Dickins 提交于
      Fix tmpfs data loss when the fallocate system call is interrupted by a
      signal, or fails for some other reason.  The partial folio handling in
      shmem_undo_range() forgot to consider this unfalloc case, and was liable
      to erase or truncate out data which had already been committed earlier.
      
      It turns out that none of the partial folio handling there is appropriate
      for the unfalloc case, which just wants to proceed to removal of whole
      folios: which find_get_entries() provides, even when partially covered.
      
      Original patch by Rui Wang.
      
      Link: https://lore.kernel.org/linux-mm/33b85d82.7764.1842e9ab207.Coremail.chenguoqic@163.com/
      Link: https://lkml.kernel.org/r/a5dac112-cf4b-7af-a33-f386e347fd38@google.com
      Fixes: b9a8a419 ("truncate,shmem: Handle truncates that split large folios")
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Reported-by: NGuoqi Chen <chenguoqic@163.com>
        Link: https://lore.kernel.org/all/20221101032248.819360-1-kernel@hev.cc/
      Cc: Rui Wang <kernel@hev.cc>
      Cc: Huacai Chen <chenhuacai@loongson.cn>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
      Cc: <stable@vger.kernel.org>	[5.17+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      44bcabd7
    • M
      kselftests: cgroup: update kmem test precision tolerance · de16d6e4
      Michal Hocko 提交于
      1813e51e ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
      the batch size while this test case has been left behind. This has led
      to a test failure reported by test bot:
      not ok 2 selftests: cgroup: test_kmem # exit=1
      
      Update the tolerance for the pcp charges to reflect the
      MEMCG_CHARGE_BATCH change to fix this.
      
      [akpm@linux-foundation.org: update comments, per Roman]
      Link: https://lkml.kernel.org/r/Y4m8Unt6FhWKC6IH@dhcp22.suse.cz
      Fixes: 1813e51e ("memcg: increase MEMCG_CHARGE_BATCH to 64")
      Signed-off-by: NMichal Hocko <mhocko@suse.com>
      Reported-by: Nkernel test robot <yujie.liu@intel.com>
        Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.comAcked-by: NShakeel Butt <shakeelb@google.com>
      Acked-by: NRoman Gushchin <roman.gushchin@linux.dev>
      Tested-by: NYujie Liu <yujie.liu@intel.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Michal Koutný" <mkoutny@suse.com>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Soheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      de16d6e4
    • J
      mm: do not BUG_ON missing brk mapping, because userspace can unmap it · f5ad5083
      Jason A. Donenfeld 提交于
      The following program will trigger the BUG_ON that this patch removes,
      because the user can munmap() mm->brk:
      
        #include <sys/syscall.h>
        #include <sys/mman.h>
        #include <assert.h>
        #include <unistd.h>
      
        static void *brk_now(void)
        {
          return (void *)syscall(SYS_brk, 0);
        }
      
        static void brk_set(void *b)
        {
          assert(syscall(SYS_brk, b) != -1);
        }
      
        int main(int argc, char *argv[])
        {
          void *b = brk_now();
          brk_set(b + 4096);
          assert(munmap(b - 4096, 4096 * 2) == 0);
          brk_set(b);
          return 0;
        }
      
      Compile that with musl, since glibc actually uses brk(), and then
      execute it, and it'll hit this splat:
      
        kernel BUG at mm/mmap.c:229!
        invalid opcode: 0000 [#1] PREEMPT SMP
        CPU: 12 PID: 1379 Comm: a.out Tainted: G S   U             6.1.0-rc7+ #419
        RIP: 0010:__do_sys_brk+0x2fc/0x340
        Code: 00 00 4c 89 ef e8 04 d3 fe ff eb 9a be 01 00 00 00 4c 89 ff e8 35 e0 fe ff e9 6e ff ff ff 4d 89 a7 20>
        RSP: 0018:ffff888140bc7eb0 EFLAGS: 00010246
        RAX: 0000000000000000 RBX: 00000000007e7000 RCX: ffff8881020fe000
        RDX: ffff8881020fe001 RSI: ffff8881955c9b00 RDI: ffff8881955c9b08
        RBP: 0000000000000000 R08: ffff8881955c9b00 R09: 00007ffc77844000
        R10: 0000000000000000 R11: 0000000000000001 R12: 00000000007e8000
        R13: 00000000007e8000 R14: 00000000007e7000 R15: ffff8881020fe000
        FS:  0000000000604298(0000) GS:ffff88901f700000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000603fe0 CR3: 000000015ba9a005 CR4: 0000000000770ee0
        PKRU: 55555554
        Call Trace:
         <TASK>
         do_syscall_64+0x2b/0x50
         entry_SYSCALL_64_after_hwframe+0x46/0xb0
        RIP: 0033:0x400678
        Code: 10 4c 8d 41 08 4c 89 44 24 10 4c 8b 01 8b 4c 24 08 83 f9 2f 77 0a 4c 8d 4c 24 20 4c 01 c9 eb 05 48 8b>
        RSP: 002b:00007ffc77863890 EFLAGS: 00000212 ORIG_RAX: 000000000000000c
        RAX: ffffffffffffffda RBX: 000000000040031b RCX: 0000000000400678
        RDX: 00000000004006a1 RSI: 00000000007e6000 RDI: 00000000007e7000
        RBP: 00007ffc77863900 R08: 0000000000000000 R09: 00000000007e6000
        R10: 00007ffc77863930 R11: 0000000000000212 R12: 00007ffc77863978
        R13: 00007ffc77863988 R14: 0000000000000000 R15: 0000000000000000
         </TASK>
      
      Instead, just return the old brk value if the original mapping has been
      removed.
      
      [akpm@linux-foundation.org: fix changelog, per Liam]
      Link: https://lkml.kernel.org/r/20221202162724.2009-1-Jason@zx2c4.com
      Fixes: 2e7ce7d3 ("mm/mmap: change do_brk_flags() to expand existing VMA and add do_brk_munmap()")
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: NLiam R. Howlett <Liam.Howlett@oracle.com>
      Reviewed-by: NSeongJae Park <sj@kernel.org>
      Cc: Yu Zhao <yuzhao@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Jann Horn <jannh@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      f5ad5083
    • M
      mailmap: update Matti Vaittinen's email address · 38f1d4ae
      Matti Vaittinen 提交于
      The email backend used by ROHM keeps labeling patches as spam.  This can
      result in missing the patches.
      
      Switch my mail address from a company mail to a personal one.
      
      Link: https://lkml.kernel.org/r/8f4498b66fedcbded37b3b87e0c516e659f8f583.1669912977.git.mazziesaccount@gmail.comSigned-off-by: NMatti Vaittinen <mazziesaccount@gmail.com>
      Suggested-by: NKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Cc: Anup Patel <anup@brainfault.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Atish Patra <atishp@atishpatra.org>
      Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
      Cc: Ben Widawsky <bwidawsk@kernel.org>
      Cc: Bjorn Andersson <andersson@kernel.org>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Kirill Tkhai <tkhai@ya.ru>
      Cc: Qais Yousef <qyousef@layalina.io>
      Cc: Vasily Averin <vasily.averin@linux.dev>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      38f1d4ae
    • L
      Merge tag 'media/v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 3ecc3791
      Linus Torvalds 提交于
      Pull media fix from Mauro Carvalho Chehab:
       "A v4l-core fix related to validating DV timings related to video
        blanking values"
      
      * tag 'media/v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: v4l2-dv-timings.c: fix too strict blanking sanity checks
      3ecc3791
    • L
      Merge tag 'soc-fixes-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 9857feb3
      Linus Torvalds 提交于
      Pull ARM SoC fix from Arnd Bergmann:
       "One more last minute revert for a boot regression that was found on
        the popular colibri-imx7"
      
      * tag 'soc-fixes-6.1-6' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        Revert "ARM: dts: imx7: Fix NAND controller size-cells"
      9857feb3
  6. 09 12月, 2022 16 次提交
    • L
      Merge tag 'drm-fixes-2022-12-09' of git://anongit.freedesktop.org/drm/drm · 0d1409e4
      Linus Torvalds 提交于
      Pull drm fixes from Dave Airlie:
       "Last set of fixes for final, scattered bunch of fixes, two amdgpu, one
        vmwgfx, and some misc others.
      
        amdgpu:
         - S0ix fix
         - DCN 3.2 array out of bounds fix
      
        shmem:
         - Fixes to shmem-helper error paths
      
        bridge:
         - Fix polarity bug in bridge/ti-sn65dsi86
      
        dw-hdmi:
         - Prefer 8-bit RGB fallback before any YUV mode in dw-hdmi, since
           some panels lie about YUV support
      
        vmwgfx:
         - Stop using screen objects when SEV is active"
      
      * tag 'drm-fixes-2022-12-09' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: fix array index out of bound error in DCN32 DML
        drm/amdgpu/sdma_v4_0: turn off SDMA ring buffer in the s2idle suspend
        drm/vmwgfx: Don't use screen objects when SEV is active
        drm/shmem-helper: Avoid vm_open error paths
        drm/shmem-helper: Remove errant put in error path
        drm: bridge: dw_hdmi: fix preference of RGB modes over YUV420
        drm/bridge: ti-sn65dsi86: Fix output polarity setting bug
        drm/vmwgfx: Fix race issue calling pin_user_pages
      0d1409e4
    • D
      Merge tag 'drm-misc-fixes-2022-12-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · c4252650
      Dave Airlie 提交于
      drm-misc-fixes for v6.1 final?:
      - Fix polarity bug in bridge/ti-sn65dsi86.
      - Prefer 8-bit RGB fallback before any YUV mode in dw-hdmi, since some
        panels lie about YUV support.
      - Fixes to shmem-helper error paths.
      - Small vmwgfx to stop using screen objects when SEV is active.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/8110f02d-d155-926e-8674-c88b806c3a3a@linux.intel.com
      c4252650
    • D
      Merge tag 'amd-drm-fixes-6.1-2022-12-07' of... · b4b241ad
      Dave Airlie 提交于
      Merge tag 'amd-drm-fixes-6.1-2022-12-07' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-6.1-2022-12-07:
      
      amdgpu:
      - S0ix fix
      - DCN 3.2 array out of bounds fix
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221207222751.9558-1-alexander.deucher@amd.com
      b4b241ad
    • L
      Merge tag 'block-6.1-2022-12-08' of git://git.kernel.dk/linux · 859c73d4
      Linus Torvalds 提交于
      Pull block fix from Jens Axboe:
       "A small fix for initializing the NVMe quirks before initializing the
        subsystem"
      
      * tag 'block-6.1-2022-12-08' of git://git.kernel.dk/linux:
        nvme initialize core quirks before calling nvme_init_subsystem
      859c73d4
    • L
      Merge tag 'io_uring-6.1-2022-12-08' of git://git.kernel.dk/linux · af145500
      Linus Torvalds 提交于
      Pull io_uring fix from Jens Axboe:
       "A single small fix for an issue related to ordering between
        cancelation and current->io_uring teardown"
      
      * tag 'io_uring-6.1-2022-12-08' of git://git.kernel.dk/linux:
        io_uring: Fix a null-ptr-deref in io_tctx_exit_cb()
      af145500
    • L
      Merge tag 'net-6.1-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 010b6761
      Linus Torvalds 提交于
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bluetooth, can and netfilter.
      
        Current release - new code bugs:
      
         - bonding: ipv6: correct address used in Neighbour Advertisement
           parsing (src vs dst typo)
      
         - fec: properly scope IRQ coalesce setup during link up to supported
           chips only
      
        Previous releases - regressions:
      
         - Bluetooth fixes for fake CSR clones (knockoffs):
             - re-add ERR_DATA_REPORTING quirk
             - fix crash when device is replugged
      
         - Bluetooth:
             - silence a user-triggerable dmesg error message
             - L2CAP: fix u8 overflow, oob access
             - correct vendor codec definition
             - fix support for Read Local Supported Codecs V2
      
         - ti: am65-cpsw: fix RGMII configuration at SPEED_10
      
         - mana: fix race on per-CQ variable NAPI work_done
      
        Previous releases - always broken:
      
         - af_unix: diag: fetch user_ns from in_skb in unix_diag_get_exact(),
           avoid null-deref
      
         - af_can: fix NULL pointer dereference in can_rcv_filter
      
         - can: slcan: fix UAF with a freed work
      
         - can: can327: flush TX_work on ldisc .close()
      
         - macsec: add missing attribute validation for offload
      
         - ipv6: avoid use-after-free in ip6_fragment()
      
         - nft_set_pipapo: actually validate intervals in fields after the
           first one
      
         - mvneta: prevent oob access in mvneta_config_rss()
      
         - ipv4: fix incorrect route flushing when table ID 0 is used, or when
           source address is deleted
      
         - phy: mxl-gpy: add workaround for IRQ bug on GPY215B and GPY215C"
      
      * tag 'net-6.1-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
        net: dsa: sja1105: avoid out of bounds access in sja1105_init_l2_policing()
        s390/qeth: fix use-after-free in hsci
        macsec: add missing attribute validation for offload
        net: mvneta: Fix an out of bounds check
        net: thunderbolt: fix memory leak in tbnet_open()
        ipv6: avoid use-after-free in ip6_fragment()
        net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq()
        net: phy: mxl-gpy: add MDINT workaround
        net: dsa: mv88e6xxx: accept phy-mode = "internal" for internal PHY ports
        xen/netback: don't call kfree_skb() under spin_lock_irqsave()
        dpaa2-switch: Fix memory leak in dpaa2_switch_acl_entry_add() and dpaa2_switch_acl_entry_remove()
        ethernet: aeroflex: fix potential skb leak in greth_init_rings()
        tipc: call tipc_lxc_xmit without holding node_read_lock
        can: esd_usb: Allow REC and TEC to return to zero
        can: can327: flush TX_work on ldisc .close()
        can: slcan: fix freed work crash
        can: af_can: fix NULL pointer dereference in can_rcv_filter
        net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
        ipv4: Fix incorrect route flushing when table ID 0 is used
        ipv4: Fix incorrect route flushing when source address is deleted
        ...
      010b6761
    • L
      Merge tag 'for-linus-2022120801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · ce19275f
      Linus Torvalds 提交于
      Pull HID fixes from Jiri Kosina:
       "A regression fix for handling Logitech HID++ devices and memory
        corruption fixes:
      
         - regression fix (revert) for catch-all handling of Logitech HID++
           Bluetooth devices; there are devices that turn out not to work with
           this, and the root cause is yet to be properly understood. So we
           are dropping it for now, and it will be revisited for 6.2 or 6.3
           (Benjamin Tissoires)
      
         - memory corruption fix in HID core (ZhangPeng)
      
         - memory corruption fix in hid-lg4ff (Anastasia Belova)
      
         - Kconfig fix for I2C_HID (Benjamin Tissoires)
      
         - a few device-id specific quirks that piggy-back on top of the
           important fixes above"
      
      * tag 'for-linus-2022120801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        Revert "HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices"
        Revert "HID: logitech-hidpp: Remove special-casing of Bluetooth devices"
        HID: usbhid: Add ALWAYS_POLL quirk for some mice
        HID: core: fix shift-out-of-bounds in hid_report_raw_event
        HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk
        HID: fix I2C_HID not selected when I2C_HID_OF_ELAN is
        HID: hid-lg4ff: Add check for empty lbuf
        HID: ite: Enable QUIRK_TOUCHPAD_ON_OFF_REPORT on Acer Aspire Switch V 10
        HID: uclogic: Fix frame templates for big endian architectures
      ce19275f
    • L
      Merge tag 'soc-fixes-6.1-5' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · f3e84166
      Linus Torvalds 提交于
      Pull ARM SoC fix from Arnd Bergmann:
       "One last build fix came in, addressing a link failure when building
        without CONFIG_OUTER_CACHE"
      
      * tag 'soc-fixes-6.1-5' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: at91: fix build for SAMA5D3 w/o L2 cache
      f3e84166
    • B
      Revert "HID: logitech-hidpp: Enable HID++ for all the Logitech Bluetooth devices" · a9d9e46c
      Benjamin Tissoires 提交于
      This reverts commit 532223c8.
      
      As reported in [0], hid-logitech-hidpp now binds on all bluetooth mice,
      but there are corner cases where hid-logitech-hidpp just gives up on
      the mouse. This leads the end user with a dead mouse.
      
      Given that we are at -rc8, we are definitively too late to find a proper
      fix. We already identified 2 issues less than 24 hours after the bug
      report. One in that ->match() was never designed to be used anywhere else
      than in hid-generic, and the other that hid-logitech-hidpp has corner
      cases where it gives up on devices it is not supposed to.
      
      So we have no choice but postpone this patch to the next kernel release.
      
      [0] https://lore.kernel.org/linux-input/CAJZ5v0g-_o4AqMgNwihCb0jrwrcJZfRrX=jv8aH54WNKO7QB8A@mail.gmail.com/Reported-by: NRafael J . Wysocki <rjw@rjwysocki.net>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      a9d9e46c
    • B
      Revert "HID: logitech-hidpp: Remove special-casing of Bluetooth devices" · 40f2432b
      Benjamin Tissoires 提交于
      This reverts commit 8544c812.
      
      We need to revert commit 532223c8 ("HID: logitech-hidpp: Enable HID++
      for all the Logitech Bluetooth devices") because that commit might make
      hid-logitech-hidpp bind on mice that are not well enough supported by
      hid-logitech-hidpp, and the end result is that the probe of those mice
      is now returning -ENODEV, leaving the end user with a dead mouse.
      
      Given that commit 8544c812 ("HID: logitech-hidpp: Remove special-casing
      of Bluetooth devices") is a direct dependency of 532223c8, revert it
      too.
      
      Note that this also adapt according to commit 908d325e ("HID:
      logitech-hidpp: Detect hi-res scrolling support") to re-add support of
      the devices that were removed from that commit too.
      
      I have locally an MX Master and I tested this device with that revert,
      ensuring we still have high-res scrolling.
      Reported-by: NRafael J . Wysocki <rjw@rjwysocki.net>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      40f2432b
    • L
      Merge tag 'loongarch-fixes-6.1-3' of... · 7f043b76
      Linus Torvalds 提交于
      Merge tag 'loongarch-fixes-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Export smp_send_reschedule() for modules use, fix a huge page entry
        update issue, and add documents for booting description"
      
      * tag 'loongarch-fixes-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        docs/zh_CN: Add LoongArch booting description's translation
        docs/LoongArch: Add booting description
        LoongArch: mm: Fix huge page entry update for virtual machine
        LoongArch: Export symbol for function smp_send_reschedule()
      7f043b76
    • L
      Merge tag 'for-linus-xsa-6.1-rc9b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · a4c3a07e
      Linus Torvalds 提交于
      Pull xen fix from Juergen Gross:
       "A single fix for the recent security issue XSA-423"
      
      * tag 'for-linus-xsa-6.1-rc9b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/netback: fix build warning
      a4c3a07e
    • L
      Merge tag 'gpio-fixes-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 306ba240
      Linus Torvalds 提交于
      Pull gpio fixes from Bartosz Golaszewski:
      
       - fix a memory leak in gpiolib core
      
       - fix reference leaks in gpio-amd8111 and gpio-rockchip
      
      * tag 'gpio-fixes-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio/rockchip: fix refcount leak in rockchip_gpiolib_register()
        gpio: amd8111: Fix PCI device reference count leak
        gpiolib: fix memory leak in gpiochip_setup_dev()
      306ba240
    • L
      Merge tag 'ata-6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · 57fb3f66
      Linus Torvalds 提交于
      Pull ATA fix from Damien Le Moal:
      
       - Avoid a NULL pointer dereference in the libahci platform code that
         can happen on initialization when a device tree does not specify
         names for the adapter clocks (from Anders)
      
      * tag 'ata-6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        ata: libahci_platform: ahci_platform_find_clk: oops, NULL pointer
      57fb3f66
    • T
      memcg: Fix possible use-after-free in memcg_write_event_control() · fbf83212
      Tejun Heo 提交于
      memcg_write_event_control() accesses the dentry->d_name of the specified
      control fd to route the write call.  As a cgroup interface file can't be
      renamed, it's safe to access d_name as long as the specified file is a
      regular cgroup file.  Also, as these cgroup interface files can't be
      removed before the directory, it's safe to access the parent too.
      
      Prior to 347c4a87 ("memcg: remove cgroup_event->cft"), there was a
      call to __file_cft() which verified that the specified file is a regular
      cgroupfs file before further accesses.  The cftype pointer returned from
      __file_cft() was no longer necessary and the commit inadvertently
      dropped the file type check with it allowing any file to slip through.
      With the invarients broken, the d_name and parent accesses can now race
      against renames and removals of arbitrary files and cause
      use-after-free's.
      
      Fix the bug by resurrecting the file type check in __file_cft().  Now
      that cgroupfs is implemented through kernfs, checking the file
      operations needs to go through a layer of indirection.  Instead, let's
      check the superblock and dentry type.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Fixes: 347c4a87 ("memcg: remove cgroup_event->cft")
      Cc: stable@kernel.org # v3.14+
      Reported-by: NJann Horn <jannh@google.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: NRoman Gushchin <roman.gushchin@linux.dev>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fbf83212
    • R
      net: dsa: sja1105: avoid out of bounds access in sja1105_init_l2_policing() · f8bac7f9
      Radu Nicolae Pirea (OSS) 提交于
      The SJA1105 family has 45 L2 policing table entries
      (SJA1105_MAX_L2_POLICING_COUNT) and SJA1110 has 110
      (SJA1110_MAX_L2_POLICING_COUNT). Keeping the table structure but
      accounting for the difference in port count (5 in SJA1105 vs 10 in
      SJA1110) does not fully explain the difference. Rather, the SJA1110 also
      has L2 ingress policers for multicast traffic. If a packet is classified
      as multicast, it will be processed by the policer index 99 + SRCPORT.
      
      The sja1105_init_l2_policing() function initializes all L2 policers such
      that they don't interfere with normal packet reception by default. To have
      a common code between SJA1105 and SJA1110, the index of the multicast
      policer for the port is calculated because it's an index that is out of
      bounds for SJA1105 but in bounds for SJA1110, and a bounds check is
      performed.
      
      The code fails to do the proper thing when determining what to do with the
      multicast policer of port 0 on SJA1105 (ds->num_ports = 5). The "mcast"
      index will be equal to 45, which is also equal to
      table->ops->max_entry_count (SJA1105_MAX_L2_POLICING_COUNT). So it passes
      through the check. But at the same time, SJA1105 doesn't have multicast
      policers. So the code programs the SHARINDX field of an out-of-bounds
      element in the L2 Policing table of the static config.
      
      The comparison between index 45 and 45 entries should have determined the
      code to not access this policer index on SJA1105, since its memory wasn't
      even allocated.
      
      With enough bad luck, the out-of-bounds write could even overwrite other
      valid kernel data, but in this case, the issue was detected using KASAN.
      
      Kernel log:
      
      sja1105 spi5.0: Probed switch chip: SJA1105Q
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in sja1105_setup+0x1cbc/0x2340
      Write of size 8 at addr ffffff880bd57708 by task kworker/u8:0/8
      ...
      Workqueue: events_unbound deferred_probe_work_func
      Call trace:
      ...
      sja1105_setup+0x1cbc/0x2340
      dsa_register_switch+0x1284/0x18d0
      sja1105_probe+0x748/0x840
      ...
      Allocated by task 8:
      ...
      sja1105_setup+0x1bcc/0x2340
      dsa_register_switch+0x1284/0x18d0
      sja1105_probe+0x748/0x840
      ...
      
      Fixes: 38fbe91f ("net: dsa: sja1105: configure the multicast policers, if present")
      CC: stable@vger.kernel.org # 5.15+
      Signed-off-by: NRadu Nicolae Pirea (OSS) <radu-nicolae.pirea@oss.nxp.com>
      Reviewed-by: NVladimir Oltean <olteanv@gmail.com>
      Link: https://lore.kernel.org/r/20221207132347.38698-1-radu-nicolae.pirea@oss.nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f8bac7f9