Skip to content
  1. Sep 15, 2022
    • Yang Yingliang's avatar
      fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init() · fc5a2a96
      Yang Yingliang authored
      [ Upstream commit 07c55c98
      
       ]
      
      Add missing pci_disable_device() in error path in chipsfb_pci_init().
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fc5a2a96
    • Shigeru Yoshida's avatar
      fbdev: fbcon: Destroy mutex on freeing struct fb_info · c3abfd6c
      Shigeru Yoshida authored
      [ Upstream commit 58559dfc
      
       ]
      
      It's needed to destroy bl_curve_mutex on freeing struct fb_info since
      the mutex is embedded in the structure and initialized when it's
      allocated.
      
      Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c3abfd6c
    • David Sloan's avatar
      md: Flush workqueue md_rdev_misc_wq in md_alloc() · a7dff6f4
      David Sloan authored
      [ Upstream commit 5e8daf90
      
       ]
      
      A race condition still exists when removing and re-creating md devices
      in test cases. However, it is only seen on some setups.
      
      The race condition was tracked down to a reference still being held
      to the kobject by the rdev in the md_rdev_misc_wq which will be released
      in rdev_delayed_delete().
      
      md_alloc() waits for previous deletions by waiting on the md_misc_wq,
      but the md_rdev_misc_wq may still be holding a reference to a recently
      removed device.
      
      To fix this, also flush the md_rdev_misc_wq in md_alloc().
      
      Signed-off-by: default avatarDavid Sloan <david.sloan@eideticom.com>
      [logang@deltatee.com: rewrote commit message]
      Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7dff6f4
    • lily's avatar
      net/core/skbuff: Check the return value of skb_copy_bits() · 0b705806
      lily authored
      [ Upstream commit c624c58e
      
       ]
      
      skb_copy_bits() could fail, which requires a check on the return
      value.
      
      Signed-off-by: default avatarLi Zhong <floridsleeves@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b705806
    • Lukasz Luba's avatar
      cpufreq: check only freq_table in __resolve_freq() · bd1b7695
      Lukasz Luba authored
      [ Upstream commit 6ca7076f
      
       ]
      
      There is no need to check if the cpufreq driver implements callback
      cpufreq_driver::target_index. The logic in the __resolve_freq uses
      the frequency table available in the policy. It doesn't matter if the
      driver provides 'target_index' or 'target' callback. It just has to
      populate the 'policy->freq_table'.
      
      Thus, check only frequency table during the frequency resolving call.
      
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarLukasz Luba <lukasz.luba@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd1b7695
    • Florian Westphal's avatar
      netfilter: conntrack: work around exceeded receive window · e928cf25
      Florian Westphal authored
      [ Upstream commit cf97769c
      
       ]
      
      When a TCP sends more bytes than allowed by the receive window, all future
      packets can be marked as invalid.
      This can clog up the conntrack table because of 5-day default timeout.
      
      Sequence of packets:
       01 initiator > responder: [S], seq 171, win 5840, options [mss 1330,sackOK,TS val 63 ecr 0,nop,wscale 1]
       02 responder > initiator: [S.], seq 33211, ack 172, win 65535, options [mss 1460,sackOK,TS val 010 ecr 63,nop,wscale 8]
       03 initiator > responder: [.], ack 33212, win 2920, options [nop,nop,TS val 068 ecr 010], length 0
       04 initiator > responder: [P.], seq 172:240, ack 33212, win 2920, options [nop,nop,TS val 279 ecr 010], length 68
      
      Window is 5840 starting from 33212 -> 39052.
      
       05 responder > initiator: [.], ack 240, win 256, options [nop,nop,TS val 872 ecr 279], length 0
       06 responder > initiator: [.], seq 33212:34530, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 1318
      
      This is fine, conntrack will flag the connection as having outstanding
      data (UNACKED), which lowers the conntrack timeout to 300s.
      
       07 responder > initiator: [.], seq 34530:35848, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 1318
       08 responder > initiator: [.], seq 35848:37166, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 1318
       09 responder > initiator: [.], seq 37166:38484, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 1318
       10 responder > initiator: [.], seq 38484:39802, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 1318
      
      Packet 10 is already sending more than permitted, but conntrack doesn't
      validate this (only seq is tested vs. maxend, not 'seq+len').
      
      38484 is acceptable, but only up to 39052, so this packet should
      not have been sent (or only 568 bytes, not 1318).
      
      At this point, connection is still in '300s' mode.
      
      Next packet however will get flagged:
       11 responder > initiator: [P.], seq 39802:40128, ack 240, win 256, options [nop,nop,TS val 892 ecr 279], length 326
      
      nf_ct_proto_6: SEQ is over the upper bound (over the window of the receiver) .. LEN=378 .. SEQ=39802 ACK=240 ACK PSH ..
      
      Now, a couple of replies/acks comes in:
      
       12 initiator > responder: [.], ack 34530, win 4368,
      [.. irrelevant acks removed ]
       16 initiator > responder: [.], ack 39802, win 8712, options [nop,nop,TS val 296201291 ecr 2982371892], length 0
      
      This ack is significant -- this acks the last packet send by the
      responder that conntrack considered valid.
      
      This means that ack == td_end.  This will withdraw the
      'unacked data' flag, the connection moves back to the 5-day timeout
      of established conntracks.
      
       17 initiator > responder: ack 40128, win 10030, ...
      
      This packet is also flagged as invalid.
      
      Because conntrack only updates state based on packets that are
      considered valid, packet 11 'did not exist' and that gets us:
      
      nf_ct_proto_6: ACK is over upper bound 39803 (ACKed data not seen yet) .. SEQ=240 ACK=40128 WINDOW=10030 RES=0x00 ACK URG
      
      Because this received and processed by the endpoints, the conntrack entry
      remains in a bad state, no packets will ever be considered valid again:
      
       30 responder > initiator: [F.], seq 40432, ack 2045, win 391, ..
       31 initiator > responder: [.], ack 40433, win 11348, ..
       32 initiator > responder: [F.], seq 2045, ack 40433, win 11348 ..
      
      ... all trigger 'ACK is over bound' test and we end up with
      non-early-evictable 5-day default timeout.
      
      NB: This patch triggers a bunch of checkpatch warnings because of silly
      indent.  I will resend the cleanup series linked below to reduce the
      indent level once this change has propagated to net-next.
      
      I could route the cleanup via nf but that causes extra backport work for
      stable maintainers.
      
      Link: https://lore.kernel.org/netfilter-devel/20220720175228.17880-1-fw@strlen.de/T/#mb1d7147d36294573cc4f81d00f9f8dadfdd06cd8
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e928cf25
    • Sudeep Holla's avatar
      arm64: cacheinfo: Fix incorrect assignment of signed error value to unsigned fw_level · 29906311
      Sudeep Holla authored
      [ Upstream commit e75d18ce ]
      
      Though acpi_find_last_cache_level() always returned signed value and the
      document states it will return any errors caused by lack of a PPTT table,
      it never returned negative values before.
      
      Commit 0c80f9e1
      
       ("ACPI: PPTT: Leave the table mapped for the runtime usage")
      however changed it by returning -ENOENT if no PPTT was found. The value
      returned from acpi_find_last_cache_level() is then assigned to unsigned
      fw_level.
      
      It will result in the number of cache leaves calculated incorrectly as
      a huge value which will then cause the following warning from __alloc_pages
      as the order would be great than MAX_ORDER because of incorrect and huge
      cache leaves value.
      
        |  WARNING: CPU: 0 PID: 1 at mm/page_alloc.c:5407 __alloc_pages+0x74/0x314
        |  Modules linked in:
        |  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.19.0-10393-g7c2a8d3ac4c0 #73
        |  pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
        |  pc : __alloc_pages+0x74/0x314
        |  lr : alloc_pages+0xe8/0x318
        |  Call trace:
        |   __alloc_pages+0x74/0x314
        |   alloc_pages+0xe8/0x318
        |   kmalloc_order_trace+0x68/0x1dc
        |   __kmalloc+0x240/0x338
        |   detect_cache_attributes+0xe0/0x56c
        |   update_siblings_masks+0x38/0x284
        |   store_cpu_topology+0x78/0x84
        |   smp_prepare_cpus+0x48/0x134
        |   kernel_init_freeable+0xc4/0x14c
        |   kernel_init+0x2c/0x1b4
        |   ret_from_fork+0x10/0x20
      
      Fix the same by changing fw_level to be signed integer and return the
      error from init_cache_level() early in case of error.
      
      Reported-and-Tested-by: default avatarBruno Goncalves <bgoncalv@redhat.com>
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Link: https://lore.kernel.org/r/20220808084640.3165368-1-sudeep.holla@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      29906311
    • Helge Deller's avatar
      parisc: Add runtime check to prevent PA2.0 kernels on PA1.x machines · 27092358
      Helge Deller authored
      [ Upstream commit 591d2108
      
       ]
      
      If a 32-bit kernel was compiled for PA2.0 CPUs, it won't be able to run
      on machines with PA1.x CPUs. Add a check and bail out early if a PA1.x
      machine is detected.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      27092358
    • Li Qiong's avatar
      parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources() · deb2c9c0
      Li Qiong authored
      [ Upstream commit d46c742f
      
       ]
      
      As the possible failure of the kmalloc(), it should be better
      to fix this error path, check and return '-ENOMEM' error code.
      
      Signed-off-by: default avatarLi Qiong <liqiong@nfschina.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      deb2c9c0
    • Helge Deller's avatar
      Revert "parisc: Show error if wrong 32/64-bit compiler is being used" · c63ff388
      Helge Deller authored
      [ Upstream commit b4b18f47 ]
      
      This reverts commit b160628e
      
      .
      
      There is no need any longer to have this sanity check, because the
      previous commit ("parisc: Make CONFIG_64BIT available for ARCH=parisc64
      only") prevents that CONFIG_64BIT is set if ARCH==parisc.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c63ff388
    • Bart Van Assche's avatar
      scsi: ufs: core: Reduce the power mode change timeout · c5018912
      Bart Van Assche authored
      [ Upstream commit 8f2c9642
      
       ]
      
      The current power mode change timeout (180 s) is so large that it can cause
      a watchdog timer to fire. Reduce the power mode change timeout to 10
      seconds.
      
      Link: https://lore.kernel.org/r/20220811234401.1957911-1-bvanassche@acm.org
      Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5018912
    • Zhenneng Li's avatar
      drm/radeon: add a force flush to delay work when radeon · 5a7a5b2e
      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>
      5a7a5b2e
    • Candice Li's avatar
      drm/amdgpu: Check num_gfx_rings for gfx v9_0 rb setup. · 622a557b
      Candice Li authored
      [ Upstream commit c3519383
      
       ]
      
      No need to set up rb when no gfx rings.
      
      Signed-off-by: default avatarCandice Li <candice.li@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      622a557b
    • YiPeng Chai's avatar
      drm/amdgpu: Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to psp_hw_fini · c15c2c2c
      YiPeng Chai authored
      [ Upstream commit 9d705d77
      
       ]
      
      V1:
      The amdgpu_xgmi_remove_device function will send unload command
      to psp through psp ring to terminate xgmi, but psp ring has been
      destroyed in psp_hw_fini.
      
      V2:
      1. Change the commit title.
      2. Restore amdgpu_xgmi_remove_device to its original calling location.
         Move psp_xgmi_terminate call from amdgpu_xgmi_remove_device to
         psp_hw_fini.
      
      Signed-off-by: default avatarYiPeng Chai <YiPeng.Chai@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c15c2c2c
    • Jeffy Chen's avatar
      drm/gem: Fix GEM handle release errors · 1f574fbe
      Jeffy Chen authored
      [ Upstream commit ea2aa97c
      
       ]
      
      Currently we are assuming a one to one mapping between dmabuf and
      GEM handle when releasing GEM handles.
      
      But that is not always true, since we would create extra handles for the
      GEM obj in cases like gem_open() and getfb{,2}().
      
      A similar issue was reported at:
      https://lore.kernel.org/all/20211105083308.392156-1-jay.xu@rock-chips.com/
      
      Another problem is that the imported dmabuf might not always have
      gem_obj->dma_buf set, which would cause leaks in
      drm_gem_remove_prime_handles().
      
      Let's fix these for now by using handle to find the exact map to remove.
      
      Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220819072834.17888-1-jeffy.chen@rock-chips.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1f574fbe
    • Guixin Liu's avatar
      scsi: megaraid_sas: Fix double kfree() · bbfd857a
      Guixin Liu authored
      [ Upstream commit 8c499e49
      
       ]
      
      When allocating log_to_span fails, kfree(instance->ctrl_context) is called
      twice. Remove redundant call.
      
      Link: https://lore.kernel.org/r/1659424729-46502-1-git-send-email-kanie@linux.alibaba.com
      Acked-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
      Signed-off-by: default avatarGuixin Liu <kanie@linux.alibaba.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bbfd857a
    • Tony Battersby's avatar
      scsi: qla2xxx: Disable ATIO interrupt coalesce for quad port ISP27XX · 8179f0e0
      Tony Battersby authored
      [ Upstream commit 53661ded ]
      
      This partially reverts commit d2b292c3
      
       ("scsi: qla2xxx: Enable ATIO
      interrupt handshake for ISP27XX")
      
      For some workloads where the host sends a batch of commands and then
      pauses, ATIO interrupt coalesce can cause some incoming ATIO entries to be
      ignored for extended periods of time, resulting in slow performance,
      timeouts, and aborted commands.
      
      Disable interrupt coalesce and re-enable the dedicated ATIO MSI-X
      interrupt.
      
      Link: https://lore.kernel.org/r/97dcf365-89ff-014d-a3e5-1404c6af511c@cybernetics.com
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Reviewed-by: default avatarNilesh Javali <njavali@marvell.com>
      Signed-off-by: default avatarTony Battersby <tonyb@cybernetics.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8179f0e0
    • Yee Lee's avatar
      Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" · 625c78e1
      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>
      625c78e1
    • Linus Torvalds's avatar
      fs: only do a memory barrier for the first set_buffer_uptodate() · 7c633341
      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>
      7c633341
    • Stanislaw Gruszka's avatar
      wifi: iwlegacy: 4965: corrected fix for potential off-by-one overflow in il4965_rs_fill_link_cmd() · 44b402da
      Stanislaw Gruszka authored
      commit 6d0ef724 upstream.
      
      This reverts commit a8eb8e6f as
      it can cause invalid link quality command sent to the firmware
      and address the off-by-one issue by fixing condition of while loop.
      
      Cc: stable@vger.kernel.org
      Fixes: a8eb8e6f
      
       ("wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()")
      Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220815073737.GA999388@wp.pl
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44b402da
    • Hyunwoo Kim's avatar
      efi: capsule-loader: Fix use-after-free in efi_capsule_write · dd291e07
      Hyunwoo Kim authored
      commit 9cb636b5
      
       upstream.
      
      A race condition may occur if the user calls close() on another thread
      during a write() operation on the device node of the efi capsule.
      
      This is a race condition that occurs between the efi_capsule_write() and
      efi_capsule_flush() functions of efi_capsule_fops, which ultimately
      results in UAF.
      
      So, the page freeing process is modified to be done in
      efi_capsule_release() instead of efi_capsule_flush().
      
      Cc: <stable@vger.kernel.org> # v4.9+
      Signed-off-by: default avatarHyunwoo Kim <imv4bel@gmail.com>
      Link: https://lore.kernel.org/all/20220907102920.GA88602@ubuntu/
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd291e07
    • Ard Biesheuvel's avatar
      efi: libstub: Disable struct randomization · ee06f081
      Ard Biesheuvel authored
      commit 1a388792
      
       upstream.
      
      The EFI stub is a wrapper around the core kernel that makes it look like
      a EFI compatible PE/COFF application to the EFI firmware. EFI
      applications run on top of the EFI runtime, which is heavily based on
      so-called protocols, which are struct types consisting [mostly] of
      function pointer members that are instantiated and recorded in a
      protocol database.
      
      These structs look like the ideal randomization candidates to the
      randstruct plugin (as they only carry function pointers), but of course,
      these protocols are contracts between the firmware that exposes them,
      and the EFI applications (including our stubbed kernel) that invoke
      them. This means that struct randomization for EFI protocols is not a
      great idea, and given that the stub shares very little data with the
      core kernel that is represented as a randomizable struct, we're better
      off just disabling it completely here.
      
      Cc: <stable@vger.kernel.org> # v4.14+
      Reported-by: default avatarDaniel Marth <daniel.marth@inso.tuwien.ac.at>
      Tested-by: default avatarDaniel Marth <daniel.marth@inso.tuwien.ac.at>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee06f081
    • Jakub Kicinski's avatar
      net: wwan: iosm: remove pointless null check · 6427605f
      Jakub Kicinski authored
      commit dbbc7d04
      
       upstream.
      
      GCC 12 warns:
      
      drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c: In function ‘ipc_protocol_dl_td_process’:
      drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:406:13: warning: the comparison will always evaluate as ‘true’ for the address of ‘cb’ will never be NULL [-Waddress]
        406 |         if (!IPC_CB(skb)) {
            |             ^
      
      Indeed the check seems entirely pointless. Hopefully the other
      validation checks will catch if the cb is bad, but it can't be
      NULL.
      
      Reviewed-by: default avatarM Chetan Kumar <m.chetan.kumar@intel.com>
      Link: https://lore.kernel.org/r/20220519004342.2109832-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6427605f
  2. Sep 08, 2022