Skip to content
  1. Sep 15, 2022
    • Zhenneng Li's avatar
      drm/radeon: add a force flush to delay work when radeon · b878da58
      Zhenneng Li authored
      [ Upstream commit f461950f
      
       ]
      
      Although radeon card fence and wait for gpu to finish processing current batch rings,
      there is still a corner case that radeon lockup work queue may not be fully flushed,
      and meanwhile the radeon_suspend_kms() function has called pci_set_power_state() to
      put device in D3hot state.
      Per PCI spec rev 4.0 on 5.3.1.4.1 D3hot State.
      > Configuration and Message requests are the only TLPs accepted by a Function in
      > the D3hot state. All other received Requests must be handled as Unsupported Requests,
      > and all received Completions may optionally be handled as Unexpected Completions.
      This issue will happen in following logs:
      Unable to handle kernel paging request at virtual address 00008800e0008010
      CPU 0 kworker/0:3(131): Oops 0
      pc = [<ffffffff811bea5c>]  ra = [<ffffffff81240844>]  ps = 0000 Tainted: G        W
      pc is at si_gpu_check_soft_reset+0x3c/0x240
      ra is at si_dma_is_lockup+0x34/0xd0
      v0 = 0000000000000000  t0 = fff08800e0008010  t1 = 0000000000010000
      t2 = 0000000000008010  t3 = fff00007e3c00000  t4 = fff00007e3c00258
      t5 = 000000000000ffff  t6 = 0000000000000001  t7 = fff00007ef078000
      s0 = fff00007e3c016e8  s1 = fff00007e3c00000  s2 = fff00007e3c00018
      s3 = fff00007e3c00000  s4 = fff00007fff59d80  s5 = 0000000000000000
      s6 = fff00007ef07bd98
      a0 = fff00007e3c00000  a1 = fff00007e3c016e8  a2 = 0000000000000008
      a3 = 0000000000000001  a4 = 8f5c28f5c28f5c29  a5 = ffffffff810f4338
      t8 = 0000000000000275  t9 = ffffffff809b66f8  t10 = ff6769c5d964b800
      t11= 000000000000b886  pv = ffffffff811bea20  at = 0000000000000000
      gp = ffffffff81d89690  sp = 00000000aa814126
      Disabling lock debugging due to kernel taint
      Trace:
      [<ffffffff81240844>] si_dma_is_lockup+0x34/0xd0
      [<ffffffff81119610>] radeon_fence_check_lockup+0xd0/0x290
      [<ffffffff80977010>] process_one_work+0x280/0x550
      [<ffffffff80977350>] worker_thread+0x70/0x7c0
      [<ffffffff80977410>] worker_thread+0x130/0x7c0
      [<ffffffff80982040>] kthread+0x200/0x210
      [<ffffffff809772e0>] worker_thread+0x0/0x7c0
      [<ffffffff80981f8c>] kthread+0x14c/0x210
      [<ffffffff80911658>] ret_from_kernel_thread+0x18/0x20
      [<ffffffff80981e40>] kthread+0x0/0x210
       Code: ad3e0008  43f0074a  ad7e0018  ad9e0020  8c3001e8  40230101
       <88210000> 4821ed21
      So force lockup work queue flush to fix this problem.
      
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarZhenneng Li <lizhenneng@kylinos.cn>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b878da58
    • Yee Lee's avatar
      Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" · 730233be
      Yee Lee authored
      This reverts commit 23c2d497.
      
      Commit 23c2d497 ("mm: kmemleak: take a full lowmem check in
      kmemleak_*_phys()") brought false leak alarms on some archs like arm64
      that does not init pfn boundary in early booting. The final solution
      lands on linux-6.0: commit 0c24e061
      
       ("mm: kmemleak: add rbtree and
      store physical address for objects allocated with PA").
      
      Revert this commit before linux-6.0. The original issue of invalid PA
      can be mitigated by additional check in devicetree.
      
      The false alarm report is as following: Kmemleak output: (Qemu/arm64)
      unreferenced object 0xffff0000c0170a00 (size 128):
        comm "swapper/0", pid 1, jiffies 4294892404 (age 126.208s)
        hex dump (first 32 bytes):
       62 61 73 65 00 00 00 00 00 00 00 00 00 00 00 00  base............
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<(____ptrval____)>] __kmalloc_track_caller+0x1b0/0x2e4
          [<(____ptrval____)>] kstrdup_const+0x8c/0xc4
          [<(____ptrval____)>] kvasprintf_const+0xbc/0xec
          [<(____ptrval____)>] kobject_set_name_vargs+0x58/0xe4
          [<(____ptrval____)>] kobject_add+0x84/0x100
          [<(____ptrval____)>] __of_attach_node_sysfs+0x78/0xec
          [<(____ptrval____)>] of_core_init+0x68/0x104
          [<(____ptrval____)>] driver_init+0x28/0x48
          [<(____ptrval____)>] do_basic_setup+0x14/0x28
          [<(____ptrval____)>] kernel_init_freeable+0x110/0x178
          [<(____ptrval____)>] kernel_init+0x20/0x1a0
          [<(____ptrval____)>] ret_from_fork+0x10/0x20
      
      This pacth is also applicable to linux-5.17.y/linux-5.18.y/linux-5.19.y
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarYee Lee <yee.lee@mediatek.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      730233be
    • Linus Torvalds's avatar
      fs: only do a memory barrier for the first set_buffer_uptodate() · 758105a4
      Linus Torvalds authored
      commit 2f79cdfe upstream.
      
      Commit d4252071 ("add barriers to buffer_uptodate and
      set_buffer_uptodate") added proper memory barriers to the buffer head
      BH_Uptodate bit, so that anybody who tests a buffer for being up-to-date
      will be guaranteed to actually see initialized state.
      
      However, that commit didn't _just_ add the memory barrier, it also ended
      up dropping the "was it already set" logic that the BUFFER_FNS() macro
      had.
      
      That's conceptually the right thing for a generic "this is a memory
      barrier" operation, but in the case of the buffer contents, we really
      only care about the memory barrier for the _first_ time we set the bit,
      in that the only memory ordering protection we need is to avoid anybody
      seeing uninitialized memory contents.
      
      Any other access ordering wouldn't be about the BH_Uptodate bit anyway,
      and would require some other proper lock (typically BH_Lock or the folio
      lock).  A reader that races with somebody invalidating the buffer head
      isn't an issue wrt the memory ordering, it's a serialization issue.
      
      Now, you'd think that the buffer head operations don't matter in this
      day and age (and I certainly thought so), but apparently some loads
      still end up being heavy users of buffer heads.  In particular, the
      kernel test robot reported that not having this bit access optimization
      in place caused a noticeable direct IO performance regression on ext4:
      
        fxmark.ssd_ext4_no_jnl_DWTL_54_directio.works/sec -26.5% regression
      
      although you presumably need a fast disk and a lot of cores to actually
      notice.
      
      Link: https://lore.kernel.org/all/Yw8L7HTZ%2FdE2%2Fo9C@xsang-OptiPlex-9020/
      
      
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Tested-by: default avatarFengwei Yin <fengwei.yin@intel.com>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      758105a4
    • Takashi Iwai's avatar
      ALSA: seq: Fix data-race at module auto-loading · c34f8906
      Takashi Iwai authored
      commit 3e7e04b7
      
       upstream.
      
      It's been reported that there is a possible data-race accessing to the
      global card_requested[] array at ALSA sequencer core, which is used
      for determining whether to call request_module() for the card or not.
      This data race itself is almost harmless, as it might end up with one
      extra request_module() call for the already loaded module at most.
      But it's still better to fix.
      
      This patch addresses the possible data race of card_requested[] and
      client_requested[] arrays by replacing them with bitmask.
      It's an atomic operation and can work without locks.
      
      Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/CAEHB24_ay6YzARpA1zgCsE7=H9CSJJzux618E=Ka4h0YdKn=qA@mail.gmail.com
      Link: https://lore.kernel.org/r/20220823072717.1706-2-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c34f8906
    • Takashi Iwai's avatar
      ALSA: seq: oss: Fix data-race for max_midi_devs access · 9d8b475d
      Takashi Iwai authored
      commit 22dec134
      
       upstream.
      
      ALSA OSS sequencer refers to a global variable max_midi_devs at
      creating a new port, storing it to its own field.  Meanwhile this
      variable may be changed by other sequencer events at
      snd_seq_oss_midi_check_exit_port() in parallel, which may cause a data
      race.
      
      OTOH, this data race itself is almost harmless, as the access to the
      MIDI device is done via get_mdev() and it's protected with a refcount,
      hence its presence is guaranteed.
      
      Though, it's sill better to address the data-race from the code sanity
      POV, and this patch adds the proper spinlock for the protection.
      
      Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/CAEHB2493pZRXs863w58QWnUTtv3HHfg85aYhLn5HJHCwxqtHQg@mail.gmail.com
      Link: https://lore.kernel.org/r/20220823072717.1706-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d8b475d
    • Miquel Raynal's avatar
      net: mac802154: Fix a condition in the receive path · a8758c8a
      Miquel Raynal authored
      commit f0da4711 upstream.
      
      Upon reception, a packet must be categorized, either it's destination is
      the host, or it is another host. A packet with no destination addressing
      fields may be valid in two situations:
      - the packet has no source field: only ACKs are built like that, we
        consider the host as the destination.
      - the packet has a valid source field: it is directed to the PAN
        coordinator, as for know we don't have this information we consider we
        are not the PAN coordinator.
      
      There was likely a copy/paste error made during a previous cleanup
      because the if clause is now containing exactly the same condition as in
      the switch case, which can never be true. In the past the destination
      address was used in the switch and the source address was used in the
      if, which matches what the spec says.
      
      Cc: stable@vger.kernel.org
      Fixes: ae531b94
      
       ("ieee802154: use ieee802154_addr instead of *_sa variants")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/r/20220826142954.254853-1-miquel.raynal@bootlin.com
      
      
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8758c8a
    • Siddh Raman Pant's avatar
      wifi: mac80211: Don't finalize CSA in IBSS mode if state is disconnected · cdb9a8da
      Siddh Raman Pant authored
      commit 15bc8966 upstream.
      
      When we are not connected to a channel, sending channel "switch"
      announcement doesn't make any sense.
      
      The BSS list is empty in that case. This causes the for loop in
      cfg80211_get_bss() to be bypassed, so the function returns NULL
      (check line 1424 of net/wireless/scan.c), causing the WARN_ON()
      in ieee80211_ibss_csa_beacon() to get triggered (check line 500
      of net/mac80211/ibss.c), which was consequently reported on the
      syzkaller dashboard.
      
      Thus, check if we have an existing connection before generating
      the CSA beacon in ieee80211_ibss_finish_csa().
      
      Cc: stable@vger.kernel.org
      Fixes: cd7760e6 ("mac80211: add support for CSA in IBSS mode")
      Link: https://syzkaller.appspot.com/bug?id=05603ef4ae8926761b678d2939a3b2ad28ab9ca6
      
      
      Reported-by: default avatar <syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com>
      Signed-off-by: default avatarSiddh Raman Pant <code@siddh.me>
      Tested-by: default avatar <syzbot+b6c9fe29aefe68e4ad34@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20220814151512.9985-1-code@siddh.me
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cdb9a8da
    • Krishna Kurapati's avatar
      usb: gadget: mass_storage: Fix cdrom data transfers on MAC-OS · 84ef06d2
      Krishna Kurapati authored
      commit 9d4dc16e upstream.
      
      During cdrom emulation, the response to read_toc command must contain
      the cdrom address as the number of sectors (2048 byte sized blocks)
      represented either as an absolute value (when MSF bit is '0') or in
      terms of PMin/PSec/PFrame (when MSF bit is set to '1'). Incase of
      cdrom, the fsg_lun_open call sets the sector size to 2048 bytes.
      
      When MAC OS sends a read_toc request with MSF set to '1', the
      store_cdrom_address assumes that the address being provided is the
      LUN size represented in 512 byte sized blocks instead of 2048. It
      tries to modify the address further to convert it to 2048 byte sized
      blocks and store it in MSF format. This results in data transfer
      failures as the cdrom address being provided in the read_toc response
      is incorrect.
      
      Fixes: 3f565a36
      
       ("usb: gadget: storage: adapt logic block size to bound block devices")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
      Link: https://lore.kernel.org/r/1661570110-19127-1-git-send-email-quic_kriskura@quicinc.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84ef06d2
    • Alan Stern's avatar
      USB: core: Prevent nested device-reset calls · d90419b8
      Alan Stern authored
      commit 9c6d7788 upstream.
      
      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: default avatarRondreis <linhaoguo86@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/YwkflDxvg0KWqyZK@rowland.harvard.edu
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d90419b8
    • Josh Poimboeuf's avatar
      s390: fix nospec table alignments · 5e28b1cb
      Josh Poimboeuf authored
      commit c9305b6c upstream.
      
      Add proper alignment for .nospec_call_table and .nospec_return_table in
      vmlinux.
      
      [hca@linux.ibm.com]: The problem with the missing alignment of the nospec
      tables exist since a long time, however only since commit e6ed91fd
      ("s390/alternatives: remove padding generation code") and with
      CONFIG_RELOCATABLE=n the kernel may also crash at boot time.
      
      The above named commit reduced the size of struct alt_instr by one byte,
      so its new size is 11 bytes. Therefore depending on the number of cpu
      alternatives the size of the __alt_instructions array maybe odd, which
      again also causes that the addresses of the nospec tables will be odd.
      
      If the address of __nospec_call_start is odd and the kernel is compiled
      With CONFIG_RELOCATABLE=n the compiler may generate code that loads the
      address of __nospec_call_start with a 'larl' instruction.
      
      This will generate incorrect code since the 'larl' instruction only works
      with even addresses. In result the members of the nospec tables will be
      accessed with an off-by-one offset, which subsequently may lead to
      addressing exceptions within __nospec_revert().
      
      Fixes: f19fbd5e
      
       ("s390: introduce execute-trampolines for branches")
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org
      
      
      Cc: <stable@vger.kernel.org> # 4.16
      Reviewed-by: default avatarHeiko Carstens <hca@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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e28b1cb
    • Gerald Schaefer's avatar
      s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages · 0db07bfc
      Gerald Schaefer authored
      commit 7c8d42fd upstream.
      
      The alignment check in prepare_hugepage_range() is wrong for 2 GB
      hugepages, it only checks for 1 MB hugepage alignment.
      
      This can result in kernel crash in __unmap_hugepage_range() at the
      BUG_ON(start & ~huge_page_mask(h)) alignment check, for mappings
      created with MAP_FIXED at unaligned address.
      
      Fix this by correctly handling multiple hugepage sizes, similar to the
      generic version of prepare_hugepage_range().
      
      Fixes: d08de8e2
      
       ("s390/mm: add support for 2GB hugepages")
      Cc: <stable@vger.kernel.org> # 4.8+
      Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0db07bfc
    • Witold Lipieta's avatar
      usb-storage: Add ignore-residue quirk for NXP PN7462AU · 21a277d2
      Witold Lipieta authored
      commit 2aa48857
      
       upstream.
      
      This is USB mass storage primary boot loader for code download on
      NXP PN7462AU.
      
      Without the quirk it is impossible to write whole memory at once as
      device restarts during the write due to bogus residue values reported.
      
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarWitold Lipieta <witold.lipieta@thaumatec.com>
      Link: https://lore.kernel.org/r/20220809112911.462776-1-witold.lipieta@thaumatec.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21a277d2
    • Thierry GUIBERT's avatar
      USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) · b420f94e
      Thierry GUIBERT authored
      commit a10bc717
      
       upstream.
      
      Supports for ICOM F3400 and ICOM F4400 PMR radios in CDC-ACM driver
      enabling the AT serial port.
      The Vendor Id is 0x0C26
      The Product ID is 0x0020
      
      Output of lsusb :
      Bus 001 Device 009: ID 0c26:0020 Prolific Technology Inc. ICOM Radio
      Couldn't open device, some information will be missing
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0c26 Prolific Technology Inc.
        idProduct          0x0020
        bcdDevice            0.00
        iManufacturer           1 ICOM Inc.
        iProduct                2 ICOM Radio
        iSerial                 3 *obfuscated*
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength       0x0030
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0xc0
            Self Powered
          MaxPower                0mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval              12
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      
      Signed-off-by: default avatarThierry GUIBERT <thierry.guibert@croix-rouge.fr>
      Cc: stable <stable@kernel.org>
      Link: https://lore.kernel.org/r/20220819081702.84118-1-thierry.guibert@croix-rouge.fr
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b420f94e
    • Slark Xiao's avatar
      USB: serial: option: add support for Cinterion MV32-WA/WB RmNet mode · a1fa4cda
      Slark Xiao authored
      commit 8ffe20d0
      
       upstream.
      
      We added PIDs for MV32-WA/WB MBIM mode before, now we need to add
      support for RmNet mode.
      
      Test evidence as below:
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#=  3 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f3 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F3 USB Mobile Broadband
      S:  SerialNumber=d7b4be8d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      T:  Bus=03 Lev=01 Prnt=01 Port=02 Cnt=03 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00f4 Rev=05.04
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00F4 USB Mobile Broadband
      S:  SerialNumber=d095087d
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      Signed-off-by: default avatarSlark Xiao <slark_xiao@163.com>
      [ johan: sort entries ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1fa4cda
    • Yan Xinyu's avatar
      USB: serial: option: add support for OPPO R11 diag port · 72e8abe1
      Yan Xinyu authored
      commit 8d5fc280
      
       upstream.
      
      Add support for OPPO R11 USB diag serial port to option driver. This
      phone uses Qualcomm Snapdragon 660 SoC.
      
      usb-devices output:
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=22d9 ProdID=276c Rev=04.04
      S:  Manufacturer=OPPO
      S:  Product=SDM660-MTP _SN:09C6BCA7
      S:  SerialNumber=beb2c403
      C:  #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
      I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      I:  If#=0x1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
      
      Signed-off-by: default avatarYan Xinyu <sdlyyxy@bupt.edu.cn>
      Link: https://lore.kernel.org/r/20220714102037.4113889-1-sdlyyxy@bupt.edu.cn
      Link: https://lore.kernel.org/r/Yt1WfSZk03Plpnan@hovoldconsulting.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>
      72e8abe1
    • Johan Hovold's avatar
      USB: serial: cp210x: add Decagon UCA device id · ef6b8d33
      Johan Hovold authored
      commit ceb40384 upstream.
      
      Add the device id for Decagon Devices USB Cable Adapter.
      
      Link: https://lore.kernel.org/r/trinity-819f9db2-d3e1-40e9-a669-9c245817c046-1661523546680@msvc-mesg-web108
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef6b8d33
    • Mathias Nyman's avatar
      xhci: Add grace period after xHC start to prevent premature runtime suspend. · e7a5c019
      Mathias Nyman authored
      commit 33e32158
      
       upstream.
      
      After xHC controller is started, either in probe or resume, it can take
      a while before any of the connected usb devices are visible to the roothub
      due to link training.
      
      It's possible xhci driver loads, sees no acivity and suspends the host
      before the USB device is visible.
      
      In one testcase with a hotplugged xHC controller the host finally detected
      the connected USB device and generated a wake 500ms after host initial
      start.
      
      If hosts didn't suspend the device duringe training it probablty wouldn't
      take up to 500ms to detect it, but looking at specs reveal USB3 link
      training has a couple long timeout values, such as 120ms
      RxDetectQuietTimeout, and 360ms PollingLFPSTimeout.
      
      So Add a 500ms grace period that keeps polling the roothub for 500ms after
      start, preventing runtime suspend until USB devices are detected.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20220825150840.132216-3-mathias.nyman@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7a5c019
    • Armin Wolf's avatar
      hwmon: (gpio-fan) Fix array out of bounds access · e9f6972a
      Armin Wolf authored
      [ Upstream commit f233d2be ]
      
      The driver does not check if the cooling state passed to
      gpio_fan_set_cur_state() exceeds the maximum cooling state as
      stored in fan_data->num_speeds. Since the cooling state is later
      used as an array index in set_fan_speed(), an array out of bounds
      access can occur.
      This can be exploited by setting the state of the thermal cooling device
      to arbitrary values, causing for example a kernel oops when unavailable
      memory is accessed this way.
      
      Example kernel oops:
      [  807.987276] Unable to handle kernel paging request at virtual address ffffff80d0588064
      [  807.987369] Mem abort info:
      [  807.987398]   ESR = 0x96000005
      [  807.987428]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  807.987477]   SET = 0, FnV = 0
      [  807.987507]   EA = 0, S1PTW = 0
      [  807.987536]   FSC = 0x05: level 1 translation fault
      [  807.987570] Data abort info:
      [  807.987763]   ISV = 0, ISS = 0x00000005
      [  807.987801]   CM = 0, WnR = 0
      [  807.987832] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000001165000
      [  807.987872] [ffffff80d0588064] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
      [  807.987961] Internal error: Oops: 96000005 [#1] PREEMPT SMP
      [  807.987992] Modules linked in: cmac algif_hash aes_arm64 algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q garp stp llc snd_soc_hdmi_codec brcmfmac vc4 brcmutil cec drm_kms_helper snd_soc_core cfg80211 snd_compress bcm2835_codec(C) snd_pcm_dmaengine syscopyarea bcm2835_isp(C) bcm2835_v4l2(C) sysfillrect v4l2_mem2mem bcm2835_mmal_vchiq(C) raspberrypi_hwmon sysimgblt videobuf2_dma_contig videobuf2_vmalloc fb_sys_fops videobuf2_memops rfkill videobuf2_v4l2 videobuf2_common i2c_bcm2835 snd_bcm2835(C) videodev snd_pcm snd_timer snd mc vc_sm_cma(C) gpio_fan uio_pdrv_genirq uio drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
      [  807.988508] CPU: 0 PID: 1321 Comm: bash Tainted: G         C        5.15.56-v8+ #1575
      [  807.988548] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
      [  807.988574] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [  807.988608] pc : set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.988654] lr : gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.988691] sp : ffffffc008cf3bd0
      [  807.988710] x29: ffffffc008cf3bd0 x28: ffffff80019edac0 x27: 0000000000000000
      [  807.988762] x26: 0000000000000000 x25: 0000000000000000 x24: ffffff800747c920
      [  807.988787] x23: 000000000000000a x22: ffffff800369f000 x21: 000000001999997c
      [  807.988854] x20: ffffff800369f2e8 x19: ffffff8002ae8080 x18: 0000000000000000
      [  807.988877] x17: 0000000000000000 x16: 0000000000000000 x15: 000000559e271b70
      [  807.988938] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
      [  807.988960] x11: 0000000000000000 x10: ffffffc008cf3c20 x9 : ffffffcfb60c741c
      [  807.989018] x8 : 000000000000000a x7 : 00000000ffffffc9 x6 : 0000000000000009
      [  807.989040] x5 : 000000000000002a x4 : 0000000000000000 x3 : ffffff800369f2e8
      [  807.989062] x2 : 000000000000e780 x1 : 0000000000000001 x0 : ffffff80d0588060
      [  807.989084] Call trace:
      [  807.989091]  set_fan_speed.part.5+0x34/0x80 [gpio_fan]
      [  807.989113]  gpio_fan_set_cur_state+0x34/0x50 [gpio_fan]
      [  807.989199]  cur_state_store+0x84/0xd0
      [  807.989221]  dev_attr_store+0x20/0x38
      [  807.989262]  sysfs_kf_write+0x4c/0x60
      [  807.989282]  kernfs_fop_write_iter+0x130/0x1c0
      [  807.989298]  new_sync_write+0x10c/0x190
      [  807.989315]  vfs_write+0x254/0x378
      [  807.989362]  ksys_write+0x70/0xf8
      [  807.989379]  __arm64_sys_write+0x24/0x30
      [  807.989424]  invoke_syscall+0x4c/0x110
      [  807.989442]  el0_svc_common.constprop.3+0xfc/0x120
      [  807.989458]  do_el0_svc+0x2c/0x90
      [  807.989473]  el0_svc+0x24/0x60
      [  807.989544]  el0t_64_sync_handler+0x90/0xb8
      [  807.989558]  el0t_64_sync+0x1a0/0x1a4
      [  807.989579] Code: b9403801 f9402800 7100003f 8b35cc00 (b9400416)
      [  807.989627] ---[ end trace 8ded4c918658445b ]---
      
      Fix this by checking the cooling state and return an error if it
      exceeds the maximum cooling state.
      
      Tested on a Raspberry Pi 3.
      
      Fixes: b5cf88e4
      
       ("(gpio-fan): Add thermal control hooks")
      Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
      Link: https://lore.kernel.org/r/20220830011101.178843-1-W_Armin@gmx.de
      
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e9f6972a
    • Niek Nooijens's avatar
      USB: serial: ftdi_sio: add Omron CS1W-CIF31 device id · f7552ba1
      Niek Nooijens authored
      commit 001047ea
      
       upstream.
      
      works perfectly with:
      modprobe ftdi_sio
      echo "0590 00b2" | tee
      /sys/module/ftdi_sio/drivers/usb-serial\:ftdi_sio/new_id > /dev/null
      
      but doing this every reboot is a pain in the ass.
      
      Signed-off-by: default avatarNiek Nooijens <niek.nooijens@omron.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>
      f7552ba1
    • Helge Deller's avatar
      vt: Clear selection before changing the font · c555cf04
      Helge Deller authored
      commit 566f9c9f
      
       upstream.
      
      When changing the console font with ioctl(KDFONTOP) the new font size
      can be bigger than the previous font. A previous selection may thus now
      be outside of the new screen size and thus trigger out-of-bounds
      accesses to graphics memory if the selection is removed in
      vc_do_resize().
      
      Prevent such out-of-memory accesses by dropping the selection before the
      various con_font_set() console handlers are called.
      
      Reported-by: default avatar <syzbot+14b0e8f3fd1612e35350@syzkaller.appspotmail.com>
      Cc: stable <stable@kernel.org>
      Tested-by: default avatarKhalid Masum <khalid.masum.92@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Link: https://lore.kernel.org/r/YuV9apZGNmGfjcor@p100
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c555cf04
    • Dan Carpenter's avatar
      staging: rtl8712: fix use after free bugs · 7dce6b0e
      Dan Carpenter authored
      commit e230a445 upstream.
      
      _Read/Write_MACREG callbacks are NULL so the read/write_macreg_hdl()
      functions don't do anything except free the "pcmd" pointer.  It
      results in a use after free.  Delete them.
      
      Fixes: 2865d42c
      
       ("staging: r8712u: Add the new driver to the mainline kernel")
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarZheng Wang <hackerzheng666@gmail.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/Yw4ASqkYcUhUfoY2@kili
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7dce6b0e
    • Shenwei Wang's avatar
      serial: fsl_lpuart: RS485 RTS polariy is inverse · 29689973
      Shenwei Wang authored
      commit 846651ec upstream.
      
      The setting of RS485 RTS polarity is inverse in the current driver.
      
      When the property of 'rs485-rts-active-low' is enabled in the dts node,
      the RTS signal should be LOW during sending. Otherwise, if there is no
      such a property, the RTS should be HIGH during sending.
      
      Fixes: 03895cf4
      
       ("tty: serial: fsl_lpuart: Add support for RS-485")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarNicolas Diaz <nicolas.diaz@nxp.com>
      Signed-off-by: default avatarShenwei Wang <shenwei.wang@nxp.com>
      Link: https://lore.kernel.org/r/20220805144529.604856-1-shenwei.wang@nxp.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      29689973
    • Dan Carpenter's avatar
      wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() · 8dbc7a77
      Dan Carpenter authored
      [ Upstream commit d776763f ]
      
      The return type is supposed to be ssize_t, which is signed long,
      but "r" was declared as unsigned int.  This means that on 64 bit systems
      we return positive values instead of negative error codes.
      
      Fixes: 80a3511d
      
       ("cfg80211: add debugfs HT40 allow map")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YutvOQeJm0UjLhwU@kili
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8dbc7a77
    • Andy Shevchenko's avatar
      platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask · 23f8ce98
      Andy Shevchenko authored
      [ Upstream commit 0a90ed8d ]
      
      On Intel hardware the SLP_TYPx bitfield occupies bits 10-12 as per ACPI
      specification (see Table 4.13 "PM1 Control Registers Fixed Hardware
      Feature Control Bits" for the details).
      
      Fix the mask and other related definitions accordingly.
      
      Fixes: 93e5eadd
      
       ("x86/platform: New Intel Atom SOC power management controller driver")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20220801113734.36131-1-andriy.shevchenko@linux.intel.com
      
      
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      23f8ce98
    • Letu Ren's avatar
      fbdev: fb_pm2fb: Avoid potential divide by zero error · 6577e903
      Letu Ren authored
      commit 19f953e7
      
       upstream.
      
      In `do_fb_ioctl()` of fbmem.c, if cmd is FBIOPUT_VSCREENINFO, var will be
      copied from user, then go through `fb_set_var()` and
      `info->fbops->fb_check_var()` which could may be `pm2fb_check_var()`.
      Along the path, `var->pixclock` won't be modified. This function checks
      whether reciprocal of `var->pixclock` is too high. If `var->pixclock` is
      zero, there will be a divide by zero error. So, it is necessary to check
      whether denominator is zero to avoid crash. As this bug is found by
      Syzkaller, logs are listed below.
      
      divide error in pm2fb_check_var
      Call Trace:
       <TASK>
       fb_set_var+0x367/0xeb0 drivers/video/fbdev/core/fbmem.c:1015
       do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110
       fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
      
      Reported-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarLetu Ren <fantasquex@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6577e903
  2. Sep 05, 2022
    • Greg Kroah-Hartman's avatar
    • Kuniyuki Iwashima's avatar
      kprobes: don't call disarm_kprobe() for disabled kprobes · 19cd6307
      Kuniyuki Iwashima authored
      commit 9c80e799 upstream.
      
      The assumption in __disable_kprobe() is wrong, and it could try to disarm
      an already disarmed kprobe and fire the WARN_ONCE() below. [0]  We can
      easily reproduce this issue.
      
      1. Write 0 to /sys/kernel/debug/kprobes/enabled.
      
        # echo 0 > /sys/kernel/debug/kprobes/enabled
      
      2. Run execsnoop.  At this time, one kprobe is disabled.
      
        # /usr/share/bcc/tools/execsnoop &
        [1] 2460
        PCOMM            PID    PPID   RET ARGS
      
        # cat /sys/kernel/debug/kprobes/list
        ffffffff91345650  r  __x64_sys_execve+0x0    [FTRACE]
        ffffffff91345650  k  __x64_sys_execve+0x0    [DISABLED][FTRACE]
      
      3. Write 1 to /sys/kernel/debug/kprobes/enabled, which changes
         kprobes_all_disarmed to false but does not arm the disabled kprobe.
      
        # echo 1 > /sys/kernel/debug/kprobes/enabled
      
        # cat /sys/kernel/debug/kprobes/list
        ffffffff91345650  r  __x64_sys_execve+0x0    [FTRACE]
        ffffffff91345650  k  __x64_sys_execve+0x0    [DISABLED][FTRACE]
      
      4. Kill execsnoop, when __disable_kprobe() calls disarm_kprobe() for the
         disabled kprobe and hits the WARN_ONCE() in __disarm_kprobe_ftrace().
      
        # fg
        /usr/share/bcc/tools/execsnoop
        ^C
      
      Actually, WARN_ONCE() is fired twice, and __unregister_kprobe_top() misses
      some cleanups and leaves the aggregated kprobe in the hash table.  Then,
      __unregister_trace_kprobe() initialises tk->rp.kp.list and creates an
      infinite loop like this.
      
        aggregated kprobe.list -> kprobe.list -.
                                           ^    |
                                           '.__.'
      
      In this situation, these commands fall into the infinite loop and result
      in RCU stall or soft lockup.
      
        cat /sys/kernel/debug/kprobes/list : show_kprobe_addr() enters into the
                                             infinite loop with RCU.
      
        /usr/share/bcc/tools/execsnoop : warn_kprobe_rereg() holds kprobe_mutex,
                                         and __get_valid_kprobe() is stuck in
      				   the loop.
      
      To avoid the issue, make sure we don't call disarm_kprobe() for disabled
      kprobes.
      
      [0]
      Failed to disarm kprobe-ftrace at __x64_sys_execve+0x0/0x40 (error -2)
      WARNING: CPU: 6 PID: 2460 at kernel/kprobes.c:1130 __disarm_kprobe_ftrace.isra.19 (kernel/kprobes.c:1129)
      Modules linked in: ena
      CPU: 6 PID: 2460 Comm: execsnoop Not tainted 5.19.0+ #28
      Hardware name: Amazon EC2 c5.2xlarge/, BIOS 1.0 10/16/2017
      RIP: 0010:__disarm_kprobe_ftrace.isra.19 (kernel/kprobes.c:1129)
      Code: 24 8b 02 eb c1 80 3d c4 83 f2 01 00 75 d4 48 8b 75 00 89 c2 48 c7 c7 90 fa 0f 92 89 04 24 c6 05 ab 83 01 e8 e4 94 f0 ff <0f> 0b 8b 04 24 eb b1 89 c6 48 c7 c7 60 fa 0f 92 89 04 24 e8 cc 94
      RSP: 0018:ffff9e6ec154bd98 EFLAGS: 00010282
      RAX: 0000000000000000 RBX: ffffffff930f7b00 RCX: 0000000000000001
      RDX: 0000000080000001 RSI: ffffffff921461c5 RDI: 00000000ffffffff
      RBP: ffff89c504286da8 R08: 0000000000000000 R09: c0000000fffeffff
      R10: 0000000000000000 R11: ffff9e6ec154bc28 R12: ffff89c502394e40
      R13: ffff89c502394c00 R14: ffff9e6ec154bc00 R15: 0000000000000000
      FS:  00007fe800398740(0000) GS:ffff89c812d80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000000c00057f010 CR3: 0000000103b54006 CR4: 00000000007706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
      <TASK>
       __disable_kprobe (kernel/kprobes.c:1716)
       disable_kprobe (kernel/kprobes.c:2392)
       __disable_trace_kprobe (kernel/trace/trace_kprobe.c:340)
       disable_trace_kprobe (kernel/trace/trace_kprobe.c:429)
       perf_trace_event_unreg.isra.2 (./include/linux/tracepoint.h:93 kernel/trace/trace_event_perf.c:168)
       perf_kprobe_destroy (kernel/trace/trace_event_perf.c:295)
       _free_event (kernel/events/core.c:4971)
       perf_event_release_kernel (kernel/events/core.c:5176)
       perf_release (kernel/events/core.c:5186)
       __fput (fs/file_table.c:321)
       task_work_run (./include/linux/sched.h:2056 (discriminator 1) kernel/task_work.c:179 (discriminator 1))
       exit_to_user_mode_prepare (./include/linux/resume_user_mode.h:49 kernel/entry/common.c:169 kernel/entry/common.c:201)
       syscall_exit_to_user_mode (./arch/x86/include/asm/jump_label.h:55 ./arch/x86/include/asm/nospec-branch.h:384 ./arch/x86/include/asm/entry-common.h:94 kernel/entry/common.c:133 kernel/entry/common.c:296)
       do_syscall_64 (arch/x86/entry/common.c:87)
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
      RIP: 0033:0x7fe7ff210654
      Code: 15 79 89 20 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb be 0f 1f 00 8b 05 9a cd 20 00 48 63 ff 85 c0 75 11 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 3a f3 c3 48 83 ec 18 48 89 7c 24 08 e8 34 fc
      RSP: 002b:00007ffdbd1d3538 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
      RAX: 0000000000000000 RBX: 0000000000000008 RCX: 00007fe7ff210654
      RDX: 0000000000000000 RSI: 0000000000002401 RDI: 0000000000000008
      RBP: 0000000000000000 R08: 94ae31d6fda838a4 R0900007fe8001c9d30
      R10: 00007ffdbd1d34b0 R11: 0000000000000246 R12: 00007ffdbd1d3600
      R13: 0000000000000000 R14: fffffffffffffffc R15: 00007ffdbd1d3560
      </TASK>
      
      Link: https://lkml.kernel.org/r/20220813020509.90805-1-kuniyu@amazon.com
      Fixes: 69d54b91
      
       ("kprobes: makes kprobes/enabled works correctly for optimized kprobes.")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reported-by: default avatarAyushman Dutta <ayudutta@amazon.com>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
      Cc: Kuniyuki Iwashima <kuni1840@gmail.com>
      Cc: Ayushman Dutta <ayudutta@amazon.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19cd6307
    • Jann Horn's avatar
      mm/rmap: Fix anon_vma->degree ambiguity leading to double-reuse · c24ca0f1
      Jann Horn authored
      commit 2555283e upstream.
      
      anon_vma->degree tracks the combined number of child anon_vmas and VMAs
      that use the anon_vma as their ->anon_vma.
      
      anon_vma_clone() then assumes that for any anon_vma attached to
      src->anon_vma_chain other than src->anon_vma, it is impossible for it to
      be a leaf node of the VMA tree, meaning that for such VMAs ->degree is
      elevated by 1 because of a child anon_vma, meaning that if ->degree
      equals 1 there are no VMAs that use the anon_vma as their ->anon_vma.
      
      This assumption is wrong because the ->degree optimization leads to leaf
      nodes being abandoned on anon_vma_clone() - an existing anon_vma is
      reused and no new parent-child relationship is created.  So it is
      possible to reuse an anon_vma for one VMA while it is still tied to
      another VMA.
      
      This is an issue because is_mergeable_anon_vma() and its callers assume
      that if two VMAs have the same ->anon_vma, the list of anon_vmas
      attached to the VMAs is guaranteed to be the same.  When this assumption
      is violated, vma_merge() can merge pages into a VMA that is not attached
      to the corresponding anon_vma, leading to dangling page->mapping
      pointers that will be dereferenced during rmap walks.
      
      Fix it by separately tracking the number of child anon_vmas and the
      number of VMAs using the anon_vma as their ->anon_vma.
      
      Fixes: 7a3ef208
      
       ("mm: prevent endless growth of anon_vma hierarchy")
      Cc: stable@kernel.org
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [manually fixed up different indentation in stable]
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c24ca0f1
    • Geert Uytterhoeven's avatar
      netfilter: conntrack: NF_CONNTRACK_PROCFS should no longer default to y · e7a5ead5
      Geert Uytterhoeven authored
      [ Upstream commit aa5762c3 ]
      
      NF_CONNTRACK_PROCFS was marked obsolete in commit 54b07dca
      
      
      ("netfilter: provide config option to disable ancient procfs parts") in
      v3.3.
      
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e7a5ead5
    • Juergen Gross's avatar
      s390/hypfs: avoid error message under KVM · 4a06817c
      Juergen Gross authored
      [ Upstream commit 7b6670b0
      
       ]
      
      When booting under KVM the following error messages are issued:
      
      hypfs.7f5705: The hardware system does not support hypfs
      hypfs.7a79f0: Initialization of hypfs failed with rc=-61
      
      Demote the severity of first message from "error" to "info" and issue
      the second message only in other error cases.
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Acked-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220620094534.18967-1-jgross@suse.com
      
      
      [arch/s390/hypfs/hypfs_diag.c changed description]
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a06817c
    • Hsin-Yi Wang's avatar
      arm64: map FDT as RW for early_init_dt_scan() · 3e930a2d
      Hsin-Yi Wang authored
      commit e112b032
      
       upstream.
      
      Currently in arm64, FDT is mapped to RO before it's passed to
      early_init_dt_scan(). However, there might be some codes
      (eg. commit "fdt: add support for rng-seed") that need to modify FDT
      during init. Map FDT to RO after early fixups are done.
      
      Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      [mkbestas: fixed trivial conflicts for 4.9 backport]
      Signed-off-by: default avatarMichael Bestas <mkbestas@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e930a2d
    • Yang Jihong's avatar
      ftrace: Fix NULL pointer dereference in is_ftrace_trampoline when ftrace is dead · 8569b4ad
      Yang Jihong authored
      commit c3b0f72e upstream.
      
      ftrace_startup does not remove ops from ftrace_ops_list when
      ftrace_startup_enable fails:
      
      register_ftrace_function
        ftrace_startup
          __register_ftrace_function
            ...
            add_ftrace_ops(&ftrace_ops_list, ops)
            ...
          ...
          ftrace_startup_enable // if ftrace failed to modify, ftrace_disabled is set to 1
          ...
        return 0 // ops is in the ftrace_ops_list.
      
      When ftrace_disabled = 1, unregister_ftrace_function simply returns without doing anything:
      unregister_ftrace_function
        ftrace_shutdown
          if (unlikely(ftrace_disabled))
                  return -ENODEV;  // return here, __unregister_ftrace_function is not executed,
                                   // as a result, ops is still in the ftrace_ops_list
          __unregister_ftrace_function
          ...
      
      If ops is dynamically allocated, it will be free later, in this case,
      is_ftrace_trampoline accesses NULL pointer:
      
      is_ftrace_trampoline
        ftrace_ops_trampoline
          do_for_each_ftrace_op(op, ftrace_ops_list) // OOPS! op may be NULL!
      
      Syzkaller reports as follows:
      [ 1203.506103] BUG: kernel NULL pointer dereference, address: 000000000000010b
      [ 1203.508039] #PF: supervisor read access in kernel mode
      [ 1203.508798] #PF: error_code(0x0000) - not-present page
      [ 1203.509558] PGD 800000011660b067 P4D 800000011660b067 PUD 130fb8067 PMD 0
      [ 1203.510560] Oops: 0000 [#1] SMP KASAN PTI
      [ 1203.511189] CPU: 6 PID: 29532 Comm: syz-executor.2 Tainted: G    B   W         5.10.0 #8
      [ 1203.512324] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
      [ 1203.513895] RIP: 0010:is_ftrace_trampoline+0x26/0xb0
      [ 1203.514644] Code: ff eb d3 90 41 55 41 54 49 89 fc 55 53 e8 f2 00 fd ff 48 8b 1d 3b 35 5d 03 e8 e6 00 fd ff 48 8d bb 90 00 00 00 e8 2a 81 26 00 <48> 8b ab 90 00 00 00 48 85 ed 74 1d e8 c9 00 fd ff 48 8d bb 98 00
      [ 1203.518838] RSP: 0018:ffffc900012cf960 EFLAGS: 00010246
      [ 1203.520092] RAX: 0000000000000000 RBX: 000000000000007b RCX: ffffffff8a331866
      [ 1203.521469] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 000000000000010b
      [ 1203.522583] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff8df18b07
      [ 1203.523550] R10: fffffbfff1be3160 R11: 0000000000000001 R12: 0000000000478399
      [ 1203.524596] R13: 0000000000000000 R14: ffff888145088000 R15: 0000000000000008
      [ 1203.525634] FS:  00007f429f5f4700(0000) GS:ffff8881daf00000(0000) knlGS:0000000000000000
      [ 1203.526801] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1203.527626] CR2: 000000000000010b CR3: 0000000170e1e001 CR4: 00000000003706e0
      [ 1203.528611] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 1203.529605] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      
      Therefore, when ftrace_startup_enable fails, we need to rollback registration
      process and remove ops from ftrace_ops_list.
      
      Link: https://lkml.kernel.org/r/20220818032659.56209-1-yangjihong1@huawei.com
      
      
      
      Suggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8569b4ad
    • Letu Ren's avatar
      fbdev: fb_pm2fb: Avoid potential divide by zero error · 0f1174f4
      Letu Ren authored
      commit 19f953e7
      
       upstream.
      
      In `do_fb_ioctl()` of fbmem.c, if cmd is FBIOPUT_VSCREENINFO, var will be
      copied from user, then go through `fb_set_var()` and
      `info->fbops->fb_check_var()` which could may be `pm2fb_check_var()`.
      Along the path, `var->pixclock` won't be modified. This function checks
      whether reciprocal of `var->pixclock` is too high. If `var->pixclock` is
      zero, there will be a divide by zero error. So, it is necessary to check
      whether denominator is zero to avoid crash. As this bug is found by
      Syzkaller, logs are listed below.
      
      divide error in pm2fb_check_var
      Call Trace:
       <TASK>
       fb_set_var+0x367/0xeb0 drivers/video/fbdev/core/fbmem.c:1015
       do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110
       fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
      
      Reported-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarLetu Ren <fantasquex@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f1174f4
    • Karthik Alapati's avatar
      HID: hidraw: fix memory leak in hidraw_release() · 1bea0bbf
      Karthik Alapati authored
      commit a5623a20 upstream.
      
      Free the buffered reports before deleting the list entry.
      
      BUG: memory leak
      unreferenced object 0xffff88810e72f180 (size 32):
        comm "softirq", pid 0, jiffies 4294945143 (age 16.080s)
        hex dump (first 32 bytes):
          64 f3 c6 6a d1 88 07 04 00 00 00 00 00 00 00 00  d..j............
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff814ac6c3>] kmemdup+0x23/0x50 mm/util.c:128
          [<ffffffff8357c1d2>] kmemdup include/linux/fortify-string.h:440 [inline]
          [<ffffffff8357c1d2>] hidraw_report_event+0xa2/0x150 drivers/hid/hidraw.c:521
          [<ffffffff8356ddad>] hid_report_raw_event+0x27d/0x740 drivers/hid/hid-core.c:1992
          [<ffffffff8356e41e>] hid_input_report+0x1ae/0x270 drivers/hid/hid-core.c:2065
          [<ffffffff835f0d3f>] hid_irq_in+0x1ff/0x250 drivers/hid/usbhid/hid-core.c:284
          [<ffffffff82d3c7f9>] __usb_hcd_giveback_urb+0xf9/0x230 drivers/usb/core/hcd.c:1670
          [<ffffffff82d3cc26>] usb_hcd_giveback_urb+0x1b6/0x1d0 drivers/usb/core/hcd.c:1747
          [<ffffffff82ef1e14>] dummy_timer+0x8e4/0x14c0 drivers/usb/gadget/udc/dummy_hcd.c:1988
          [<ffffffff812f50a8>] call_timer_fn+0x38/0x200 kernel/time/timer.c:1474
          [<ffffffff812f5586>] expire_timers kernel/time/timer.c:1519 [inline]
          [<ffffffff812f5586>] __run_timers.part.0+0x316/0x430 kernel/time/timer.c:1790
          [<ffffffff812f56e4>] __run_timers kernel/time/timer.c:1768 [inline]
          [<ffffffff812f56e4>] run_timer_softirq+0x44/0x90 kernel/time/timer.c:1803
          [<ffffffff848000e6>] __do_softirq+0xe6/0x2ea kernel/softirq.c:571
          [<ffffffff81246db0>] invoke_softirq kernel/softirq.c:445 [inline]
          [<ffffffff81246db0>] __irq_exit_rcu kernel/softirq.c:650 [inline]
          [<ffffffff81246db0>] irq_exit_rcu+0xc0/0x110 kernel/softirq.c:662
          [<ffffffff84574f02>] sysvec_apic_timer_interrupt+0xa2/0xd0 arch/x86/kernel/apic/apic.c:1106
          [<ffffffff84600c8b>] asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:649
          [<ffffffff8458a070>] native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
          [<ffffffff8458a070>] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
          [<ffffffff8458a070>] acpi_safe_halt drivers/acpi/processor_idle.c:111 [inline]
          [<ffffffff8458a070>] acpi_idle_do_entry+0xc0/0xd0 drivers/acpi/processor_idle.c:554
      
      Link: https://syzkaller.appspot.com/bug?id=19a04b43c75ed1092021010419b5e560a8172c4f
      
      
      Reported-by: default avatar <syzbot+f59100a0428e6ded9443@syzkaller.appspotmail.com>
      Signed-off-by: default avatarKarthik Alapati <mail@karthek.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bea0bbf
    • Dongliang Mu's avatar
      media: pvrusb2: fix memory leak in pvr_probe · 2fe46195
      Dongliang Mu authored
      commit 945a9a8e
      
       upstream.
      
      The error handling code in pvr2_hdw_create forgets to unregister the
      v4l2 device. When pvr2_hdw_create returns back to pvr2_context_create,
      it calls pvr2_context_destroy to destroy context, but mp->hdw is NULL,
      which leads to that pvr2_hdw_destroy directly returns.
      
      Fix this by adding v4l2_device_unregister to decrease the refcount of
      usb interface.
      
      Reported-by: default avatar <syzbot+77b432d57c4791183ed4@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2fe46195
    • Luiz Augusto von Dentz's avatar
      Bluetooth: L2CAP: Fix build errors in some archs · e887ea3d
      Luiz Augusto von Dentz authored
      commit b840304f upstream.
      
      This attempts to fix the follow errors:
      
      In function 'memcmp',
          inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9,
          inlined from 'l2cap_global_chan_by_psm' at
          net/bluetooth/l2cap_core.c:2003:15:
      ./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp'
      specified bound 6 exceeds source size 0 [-Werror=stringop-overread]
         44 | #define __underlying_memcmp     __builtin_memcmp
            |                                 ^
      ./include/linux/fortify-string.h:420:16: note: in expansion of macro
      '__underlying_memcmp'
        420 |         return __underlying_memcmp(p, q, size);
            |                ^~~~~~~~~~~~~~~~~~~
      In function 'memcmp',
          inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9,
          inlined from 'l2cap_global_chan_by_psm' at
          net/bluetooth/l2cap_core.c:2004:15:
      ./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp'
      specified bound 6 exceeds source size 0 [-Werror=stringop-overread]
         44 | #define __underlying_memcmp     __builtin_memcmp
            |                                 ^
      ./include/linux/fortify-string.h:420:16: note: in expansion of macro
      '__underlying_memcmp'
        420 |         return __underlying_memcmp(p, q, size);
            |                ^~~~~~~~~~~~~~~~~~~
      
      Fixes: 332f1795
      
       ("Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e887ea3d
    • Jing Leng's avatar
      kbuild: Fix include path in scripts/Makefile.modpost · 583daae6
      Jing Leng authored
      commit 23a0cb8e
      
       upstream.
      
      When building an external module, if users don't need to separate the
      compilation output and source code, they run the following command:
      "make -C $(LINUX_SRC_DIR) M=$(PWD)". At this point, "$(KBUILD_EXTMOD)"
      and "$(src)" are the same.
      
      If they need to separate them, they run "make -C $(KERNEL_SRC_DIR)
      O=$(KERNEL_OUT_DIR) M=$(OUT_DIR) src=$(PWD)". Before running the
      command, they need to copy "Kbuild" or "Makefile" to "$(OUT_DIR)" to
      prevent compilation failure.
      
      So the kernel should change the included path to avoid the copy operation.
      
      Signed-off-by: default avatarJing Leng <jleng@ambarella.com>
      [masahiro: I do not think "M=$(OUT_DIR) src=$(PWD)" is the official way,
      but this patch is a nice clean up anyway.]
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      [nsc: updated context for v4.19]
      Signed-off-by: default avatarNicolas Schier <n.schier@avm.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      583daae6
    • Pawan Gupta's avatar
      x86/bugs: Add "unknown" reporting for MMIO Stale Data · 0616411a
      Pawan Gupta authored
      commit 7df54884 upstream.
      
      Older Intel CPUs that are not in the affected processor list for MMIO
      Stale Data vulnerabilities currently report "Not affected" in sysfs,
      which may not be correct. Vulnerability status for these older CPUs is
      unknown.
      
      Add known-not-affected CPUs to the whitelist. Report "unknown"
      mitigation status for CPUs that are not in blacklist, whitelist and also
      don't enumerate MSR ARCH_CAPABILITIES bits that reflect hardware
      immunity to MMIO Stale Data vulnerabilities.
      
      Mitigation is not deployed when the status is unknown.
      
        [ bp: Massage, fixup. ]
      
      Fixes: 8d50cdf8
      
       ("x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data")
      Suggested-by: default avatarAndrew Cooper <andrew.cooper3@citrix.com>
      Suggested-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/a932c154772f2121794a5f2eded1a11013114711.1657846269.git.pawan.kumar.gupta@linux.intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0616411a
    • Gayatri Kammela's avatar
      x86/cpu: Add Tiger Lake to Intel family · 1a2429c4
      Gayatri Kammela authored
      commit 6e1c32c5
      
       upstream.
      
      Add the model numbers/CPUIDs of Tiger Lake mobile and desktop to the
      Intel family.
      
      Suggested-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarGayatri Kammela <gayatri.kammela@intel.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rahul Tanwar <rahul.tanwar@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190905193020.14707-2-tony.luck@intel.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1a2429c4
    • Gerald Schaefer's avatar
      s390/mm: do not trigger write fault when vma does not allow VM_WRITE · 210d22b7
      Gerald Schaefer authored
      commit 41ac42f1 upstream.
      
      For non-protection pXd_none() page faults in do_dat_exception(), we
      call do_exception() with access == (VM_READ | VM_WRITE | VM_EXEC).
      In do_exception(), vma->vm_flags is checked against that before
      calling handle_mm_fault().
      
      Since commit 92f842ea ("[S390] store indication fault optimization"),
      we call handle_mm_fault() with FAULT_FLAG_WRITE, when recognizing that
      it was a write access. However, the vma flags check is still only
      checking against (VM_READ | VM_WRITE | VM_EXEC), and therefore also
      calling handle_mm_fault() with FAULT_FLAG_WRITE in cases where the vma
      does not allow VM_WRITE.
      
      Fix this by changing access check in do_exception() to VM_WRITE only,
      when recognizing write access.
      
      Link: https://lkml.kernel.org/r/20220811103435.188481-3-david@redhat.com
      Fixes: 92f842ea
      
       ("[S390] store indication fault optimization")
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      210d22b7