óÐÉÓÏË ÉÚÍÅÎÅÎÉÊ × Linux 4.14.316

 
3c589_cs: Fix an error handling path in tc589_probe() [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Sat May 20 11:48:55 2023 +0200

    3c589_cs: Fix an error handling path in tc589_probe()
    
    commit 640bf95b2c7c2981fb471acdafbd3e0458f8390d upstream.
    
    Should tc589_config() fail, some resources need to be released as already
    done in the remove function.
    
    Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
    Signed-off-by: Christophe JAILLET <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/d8593ae867b24c79063646e36f9b18b0790107cb.1684575975.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ACPI: EC: Fix oops when removing custom query handlers [+ + +]
Author: Armin Wolf <[email protected]>
Date:   Fri Mar 24 21:26:27 2023 +0100

    ACPI: EC: Fix oops when removing custom query handlers
    
    [ Upstream commit e5b492c6bb900fcf9722e05f4a10924410e170c1 ]
    
    When removing custom query handlers, the handler might still
    be used inside the EC query workqueue, causing a kernel oops
    if the module holding the callback function was already unloaded.
    
    Fix this by flushing the EC query workqueue when removing
    custom query handlers.
    
    Tested on a Acer Travelmate 4002WLMi
    
    Signed-off-by: Armin Wolf <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects [+ + +]
Author: void0red <[email protected]>
Date:   Wed Apr 5 15:57:57 2023 +0200

    ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
    
    [ Upstream commit ae5a0eccc85fc960834dd66e3befc2728284b86c ]
    
    ACPICA commit 0d5f467d6a0ba852ea3aad68663cbcbd43300fd4
    
    ACPI_ALLOCATE_ZEROED may fails, object_info might be null and will cause
    null pointer dereference later.
    
    Link: https://github.com/acpica/acpica/commit/0d5f467d
    Signed-off-by: Bob Moore <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ACPICA: Avoid undefined behavior: applying zero offset to null pointer [+ + +]
Author: Tamir Duberstein <[email protected]>
Date:   Wed Apr 5 15:42:43 2023 +0200

    ACPICA: Avoid undefined behavior: applying zero offset to null pointer
    
    [ Upstream commit 05bb0167c80b8f93c6a4e0451b7da9b96db990c2 ]
    
    ACPICA commit 770653e3ba67c30a629ca7d12e352d83c2541b1e
    
    Before this change we see the following UBSAN stack trace in Fuchsia:
    
      #0    0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302
      #1.2  0x000020d0f660777f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f
      #1.1  0x000020d0f660777f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f
      #1    0x000020d0f660777f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f
      #2    0x000020d0f660b96d in handlepointer_overflow_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:809 <libclang_rt.asan.so>+0x4196d
      #3    0x000020d0f660b50d in compiler-rt/lib/ubsan/ubsan_handlers.cpp:815 <libclang_rt.asan.so>+0x4150d
      #4    0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302
      #5    0x000021e4213e2369 in acpi_ds_call_control_method(struct acpi_thread_state*, struct acpi_walk_state*, union acpi_parse_object*) ../../third_party/acpica/source/components/dispatcher/dsmethod.c:605 <platform-bus-x86.so>+0x262369
      #6    0x000021e421437fac in acpi_ps_parse_aml(struct acpi_walk_state*) ../../third_party/acpica/source/components/parser/psparse.c:550 <platform-bus-x86.so>+0x2b7fac
      #7    0x000021e4214464d2 in acpi_ps_execute_method(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/parser/psxface.c:244 <platform-bus-x86.so>+0x2c64d2
      #8    0x000021e4213aa052 in acpi_ns_evaluate(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/namespace/nseval.c:250 <platform-bus-x86.so>+0x22a052
      #9    0x000021e421413dd8 in acpi_ns_init_one_device(acpi_handle, u32, void*, void**) ../../third_party/acpica/source/components/namespace/nsinit.c:735 <platform-bus-x86.so>+0x293dd8
      #10   0x000021e421429e98 in acpi_ns_walk_namespace(acpi_object_type, acpi_handle, u32, u32, acpi_walk_callback, acpi_walk_callback, void*, void**) ../../third_party/acpica/source/components/namespace/nswalk.c:298 <platform-bus-x86.so>+0x2a9e98
      #11   0x000021e4214131ac in acpi_ns_initialize_devices(u32) ../../third_party/acpica/source/components/namespace/nsinit.c:268 <platform-bus-x86.so>+0x2931ac
      #12   0x000021e42147c40d in acpi_initialize_objects(u32) ../../third_party/acpica/source/components/utilities/utxfinit.c:304 <platform-bus-x86.so>+0x2fc40d
      #13   0x000021e42126d603 in acpi::acpi_impl::initialize_acpi(acpi::acpi_impl*) ../../src/devices/board/lib/acpi/acpi-impl.cc:224 <platform-bus-x86.so>+0xed603
    
    Add a simple check that avoids incrementing a pointer by zero, but
    otherwise behaves as before. Note that our findings are against ACPICA
    20221020, but the same code exists on master.
    
    Link: https://github.com/acpica/acpica/commit/770653e3
    Signed-off-by: Bob Moore <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
af_key: Reject optional tunnel/BEET mode templates in outbound policies [+ + +]
Author: Tobias Brunner <[email protected]>
Date:   Tue May 9 11:00:06 2023 +0200

    af_key: Reject optional tunnel/BEET mode templates in outbound policies
    
    [ Upstream commit cf3128a7aca55b2eefb68281d44749c683bdc96f ]
    
    xfrm_state_find() uses `encap_family` of the current template with
    the passed local and remote addresses to find a matching state.
    If an optional tunnel or BEET mode template is skipped in a mixed-family
    scenario, there could be a mismatch causing an out-of-bounds read as
    the addresses were not replaced to match the family of the next template.
    
    While there are theoretical use cases for optional templates in outbound
    policies, the only practical one is to skip IPComp states in inbound
    policies if uncompressed packets are received that are handled by an
    implicitly created IPIP state instead.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Tobias Brunner <[email protected]>
    Acked-by: Herbert Xu <[email protected]>
    Signed-off-by: Steffen Klassert <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
af_unix: Fix a data race of sk->sk_receive_queue->qlen. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Tue May 9 17:34:55 2023 -0700

    af_unix: Fix a data race of sk->sk_receive_queue->qlen.
    
    [ Upstream commit 679ed006d416ea0cecfe24a99d365d1dea69c683 ]
    
    KCSAN found a data race of sk->sk_receive_queue->qlen where recvmsg()
    updates qlen under the queue lock and sendmsg() checks qlen under
    unix_state_sock(), not the queue lock, so the reader side needs
    READ_ONCE().
    
    BUG: KCSAN: data-race in __skb_try_recv_from_queue / unix_wait_for_peer
    
    write (marked) to 0xffff888019fe7c68 of 4 bytes by task 49792 on cpu 0:
     __skb_unlink include/linux/skbuff.h:2347 [inline]
     __skb_try_recv_from_queue+0x3de/0x470 net/core/datagram.c:197
     __skb_try_recv_datagram+0xf7/0x390 net/core/datagram.c:263
     __unix_dgram_recvmsg+0x109/0x8a0 net/unix/af_unix.c:2452
     unix_dgram_recvmsg+0x94/0xa0 net/unix/af_unix.c:2549
     sock_recvmsg_nosec net/socket.c:1019 [inline]
     ____sys_recvmsg+0x3a3/0x3b0 net/socket.c:2720
     ___sys_recvmsg+0xc8/0x150 net/socket.c:2764
     do_recvmmsg+0x182/0x560 net/socket.c:2858
     __sys_recvmmsg net/socket.c:2937 [inline]
     __do_sys_recvmmsg net/socket.c:2960 [inline]
     __se_sys_recvmmsg net/socket.c:2953 [inline]
     __x64_sys_recvmmsg+0x153/0x170 net/socket.c:2953
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    read to 0xffff888019fe7c68 of 4 bytes by task 49793 on cpu 1:
     skb_queue_len include/linux/skbuff.h:2127 [inline]
     unix_recvq_full net/unix/af_unix.c:229 [inline]
     unix_wait_for_peer+0x154/0x1a0 net/unix/af_unix.c:1445
     unix_dgram_sendmsg+0x13bc/0x14b0 net/unix/af_unix.c:2048
     sock_sendmsg_nosec net/socket.c:724 [inline]
     sock_sendmsg+0x148/0x160 net/socket.c:747
     ____sys_sendmsg+0x20e/0x620 net/socket.c:2503
     ___sys_sendmsg+0xc6/0x140 net/socket.c:2557
     __sys_sendmmsg+0x11d/0x370 net/socket.c:2643
     __do_sys_sendmmsg net/socket.c:2672 [inline]
     __se_sys_sendmmsg net/socket.c:2669 [inline]
     __x64_sys_sendmmsg+0x58/0x70 net/socket.c:2669
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    value changed: 0x0000000b -> 0x00000001
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 PID: 49793 Comm: syz-executor.0 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Michal Kubiak <[email protected]>
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ALSA: hda: Add NVIDIA codec IDs a3 through a7 to patch table [+ + +]
Author: Nikhil Mahale <[email protected]>
Date:   Wed May 17 14:37:36 2023 +0530

    ALSA: hda: Add NVIDIA codec IDs a3 through a7 to patch table
    
    commit dc4f2ccaedddb489a83e7b12ebbdc347272aacc9 upstream.
    
    These IDs are for AD102, AD103, AD104, AD106, and AD107 gpus with
    audio functions that are largely similar to the existing ones.
    
    Tested audio using gnome-settings, over HDMI, DP-SST and DP-MST
    connections on AD106 gpu.
    
    Signed-off-by: Nikhil Mahale <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: hda: Fix Oops by 9.1 surround channel names [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Tue May 16 20:44:12 2023 +0200

    ALSA: hda: Fix Oops by 9.1 surround channel names
    
    commit 3b44ec8c5c44790a82f07e90db45643c762878c6 upstream.
    
    get_line_out_pfx() may trigger an Oops by overflowing the static array
    with more than 8 channels.  This was reported for MacBookPro 12,1 with
    Cirrus codec.
    
    As a workaround, extend for the 9.1 channels and also fix the
    potential Oops by unifying the code paths accessing the same array
    with the proper size check.
    
    Reported-by: Olliver Schinagl <[email protected]>
    Cc: <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp [+ + +]
Author: Min Li <[email protected]>
Date:   Mon Apr 17 10:27:54 2023 +0800

    Bluetooth: L2CAP: fix "bad unlock balance" in l2cap_disconnect_rsp
    
    [ Upstream commit 25e97f7b1866e6b8503be349eeea44bb52d661ce ]
    
    conn->chan_lock isn't acquired before l2cap_get_chan_by_scid,
    if l2cap_get_chan_by_scid returns NULL, then 'bad unlock balance'
    is triggered.
    
    Reported-by: [email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Min Li <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cassini: Fix a memory leak in the error handling path of cas_init_one() [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Mon May 15 21:09:11 2023 +0200

    cassini: Fix a memory leak in the error handling path of cas_init_one()
    
    [ Upstream commit 412cd77a2c24b191c65ea53025222418db09817c ]
    
    cas_saturn_firmware_init() allocates some memory using vmalloc(). This
    memory is freed in the .remove() function but not it the error handling
    path of the probe.
    
    Add the missing vfree() to avoid a memory leak, should an error occur.
    
    Fixes: fcaa40669cd7 ("cassini: use request_firmware")
    Signed-off-by: Christophe JAILLET <[email protected]>
    Reviewed-by: Pavan Chebbi <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ceph: force updating the msg pointer in non-split case [+ + +]
Author: Xiubo Li <[email protected]>
Date:   Thu May 18 09:47:23 2023 +0800

    ceph: force updating the msg pointer in non-split case
    
    commit 4cafd0400bcb6187c0d4ab4d4b0229a89ac4f8c2 upstream.
    
    When the MClientSnap reqeust's op is not CEPH_SNAP_OP_SPLIT the
    request may still contain a list of 'split_realms', and we need
    to skip it anyway. Or it will be parsed as a corrupt snaptrace.
    
    Cc: [email protected]
    Link: https://tracker.ceph.com/issues/61200
    Reported-by: Frank Schilder <[email protected]>
    Signed-off-by: Xiubo Li <[email protected]>
    Reviewed-by: Ilya Dryomov <[email protected]>
    Signed-off-by: Ilya Dryomov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
clk: tegra20: fix gcc-7 constant overflow warning [+ + +]
Author: Arnd Bergmann <[email protected]>
Date:   Mon Feb 27 09:59:10 2023 +0100

    clk: tegra20: fix gcc-7 constant overflow warning
    
    [ Upstream commit b4a2adbf3586efa12fe78b9dec047423e01f3010 ]
    
    Older gcc versions get confused by comparing a u32 value to a negative
    constant in a switch()/case block:
    
    drivers/clk/tegra/clk-tegra20.c: In function 'tegra20_clk_measure_input_freq':
    drivers/clk/tegra/clk-tegra20.c:581:2: error: case label does not reduce to an integer constant
      case OSC_CTRL_OSC_FREQ_12MHZ:
      ^~~~
    drivers/clk/tegra/clk-tegra20.c:593:2: error: case label does not reduce to an integer constant
      case OSC_CTRL_OSC_FREQ_26MHZ:
    
    Make the constants unsigned instead.
    
    Signed-off-by: Arnd Bergmann <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cpupower: Make TSC read per CPU for Mperf monitor [+ + +]
Author: Wyes Karny <[email protected]>
Date:   Thu May 4 06:25:44 2023 +0000

    cpupower: Make TSC read per CPU for Mperf monitor
    
    [ Upstream commit c2adb1877b76fc81ae041e1db1a6ed2078c6746b ]
    
    System-wide TSC read could cause a drift in C0 percentage calculation.
    Because if first TSC is read and then one by one mperf is read for all
    cpus, this introduces drift between mperf reading of later CPUs and TSC
    reading.  To lower this drift read TSC per CPU and also just after mperf
    read.  This technique improves C0 percentage calculation in Mperf monitor.
    
    Before fix: (System 100% busy)
    
                  | Mperf              || RAPL        || Idle_Stats
     PKG|CORE| CPU| C0   | Cx   | Freq  || pack | core  || POLL | C1   | C2
       0|   0|   0| 87.15| 12.85|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   0| 256| 84.62| 15.38|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   1|   1| 87.15| 12.85|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   1| 257| 84.08| 15.92|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   2|   2| 86.61| 13.39|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   2| 258| 83.26| 16.74|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   3|   3| 86.61| 13.39|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   3| 259| 83.60| 16.40|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   4|   4| 86.33| 13.67|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   4| 260| 83.33| 16.67|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   5|   5| 86.06| 13.94|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   5| 261| 83.05| 16.95|  2695||168659003|3970468||  0.00|  0.00| 0.00
       0|   6|   6| 85.51| 14.49|  2695||168659003|3970468||  0.00|  0.00| 0.00
    
    After fix: (System 100% busy)
    
                 | Mperf              || RAPL        || Idle_Stats
     PKG|CORE| CPU| C0   | Cx   | Freq  || pack | core  || POLL | C1   | C2
       0|   0|   0| 98.03|  1.97|  2415||163295480|3811189||  0.00|  0.00| 0.00
       0|   0| 256| 98.50|  1.50|  2394||163295480|3811189||  0.00|  0.00| 0.00
       0|   1|   1| 99.99|  0.01|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   1| 257| 99.99|  0.01|  2375||163295480|3811189||  0.00|  0.00| 0.00
       0|   2|   2| 99.99|  0.01|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   2| 258|100.00|  0.00|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   3|   3|100.00|  0.00|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   3| 259| 99.99|  0.01|  2435||163295480|3811189||  0.00|  0.00| 0.00
       0|   4|   4|100.00|  0.00|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   4| 260|100.00|  0.00|  2435||163295480|3811189||  0.00|  0.00| 0.00
       0|   5|   5| 99.99|  0.01|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   5| 261|100.00|  0.00|  2435||163295480|3811189||  0.00|  0.00| 0.00
       0|   6|   6|100.00|  0.00|  2401||163295480|3811189||  0.00|  0.00| 0.00
       0|   6| 262|100.00|  0.00|  2435||163295480|3811189||  0.00|  0.00| 0.00
    
    Cc: Thomas Renninger <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Dominik Brodowski <[email protected]>
    
    Fixes: 7fe2f6399a84 ("cpupowerutils - cpufrequtils extended with quite some features")
    Signed-off-by: Wyes Karny <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/tegra: Avoid potential 32-bit integer overflow [+ + +]
Author: Nur Hussein <[email protected]>
Date:   Thu Apr 6 04:25:59 2023 +0800

    drm/tegra: Avoid potential 32-bit integer overflow
    
    [ Upstream commit 2429b3c529da29d4277d519bd66d034842dcd70c ]
    
    In tegra_sor_compute_config(), the 32-bit value mode->clock is
    multiplied by 1000, and assigned to the u64 variable pclk. We can avoid
    a potential 32-bit integer overflow by casting mode->clock to u64 before
    we do the arithmetic and assignment.
    
    Signed-off-by: Nur Hussein <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ext2: Check block size validity during mount [+ + +]
Author: Jan Kara <[email protected]>
Date:   Wed Mar 1 11:59:39 2023 +0100

    ext2: Check block size validity during mount
    
    [ Upstream commit 62aeb94433fcec80241754b70d0d1836d5926b0a ]
    
    Check that log of block size stored in the superblock has sensible
    value. Otherwise the shift computing the block size can overflow leading
    to undefined behavior.
    
    Reported-by: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa() [+ + +]
Author: Ojaswin Mujoo <[email protected]>
Date:   Sat Mar 25 13:43:39 2023 +0530

    ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
    
    [ Upstream commit 93cdf49f6eca5e23f6546b8f28457b2e6a6961d9 ]
    
    When the length of best extent found is less than the length of goal extent
    we need to make sure that the best extent atleast covers the start of the
    original request. This is done by adjusting the ac_b_ex.fe_logical (logical
    start) of the extent.
    
    While doing so, the current logic sometimes results in the best extent's
    logical range overflowing the goal extent. Since this best extent is later
    added to the inode preallocation list, we have a possibility of introducing
    overlapping preallocations. This is discussed in detail here [1].
    
    As per Jan's suggestion, to fix this, replace the existing logic with the
    below logic for adjusting best extent as it keeps fragmentation in check
    while ensuring logical range of best extent doesn't overflow out of goal
    extent:
    
    1. Check if best extent can be kept at end of goal range and still cover
       original start.
    2. Else, check if best extent can be kept at start of goal range and still
       cover original start.
    3. Else, keep the best extent at start of original request.
    
    Also, add a few extra BUG_ONs that might help catch errors faster.
    
    [1] https://lore.kernel.org/r/[email protected]
    
    Suggested-by: Jan Kara <[email protected]>
    Signed-off-by: Ojaswin Mujoo <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/r/f96aca6d415b36d1f90db86c1a8cd7e2e9d7ab0e.1679731817.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ext4: set goal start correctly in ext4_mb_normalize_request [+ + +]
Author: Kemeng Shi <[email protected]>
Date:   Sat Mar 4 01:21:01 2023 +0800

    ext4: set goal start correctly in ext4_mb_normalize_request
    
    [ Upstream commit b07ffe6927c75d99af534d685282ea188d9f71a6 ]
    
    We need to set ac_g_ex to notify the goal start used in
    ext4_mb_find_by_goal. Set ac_g_ex instead of ac_f_ex in
    ext4_mb_normalize_request.
    Besides we should assure goal start is in range [first_data_block,
    blocks_count) as ext4_mb_initialize_context does.
    
    [ Added a check to make sure size is less than ar->pright; otherwise
      we could end up passing an underflowed value of ar->pright - size to
      ext4_get_group_no_and_offset(), which will trigger a BUG_ON later on.
      - TYT ]
    
    Signed-off-by: Kemeng Shi <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
forcedeth: Fix an error handling path in nv_probe() [+ + +]
Author: Christophe JAILLET <[email protected]>
Date:   Sat May 20 10:30:17 2023 +0200

    forcedeth: Fix an error handling path in nv_probe()
    
    commit 5b17a4971d3b2a073f4078dd65331efbe35baa2d upstream.
    
    If an error occures after calling nv_mgmt_acquire_sema(), it should be
    undone with a corresponding nv_mgmt_release_sema() call.
    
    Add it in the error handling path of the probe as already done in the
    remove function.
    
    Fixes: cac1c52c3621 ("forcedeth: mgmt unit interface")
    Signed-off-by: Christophe JAILLET <[email protected]>
    Acked-by: Zhu Yanjun <[email protected]>
    Link: https://lore.kernel.org/r/355e9a7d351b32ad897251b6f81b5886fcdc6766.1684571393.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode() [+ + +]
Author: Tetsuo Handa <[email protected]>
Date:   Tue Apr 11 19:57:33 2023 +0900

    fs: hfsplus: remove WARN_ON() from hfsplus_cat_{read,write}_inode()
    
    [ Upstream commit 81b21c0f0138ff5a499eafc3eb0578ad2a99622c ]
    
    syzbot is hitting WARN_ON() in hfsplus_cat_{read,write}_inode(), for
    crafted filesystem image can contain bogus length. There conditions are
    not kernel bugs that can justify kernel to panic.
    
    Reported-by: syzbot <[email protected]>
    Link: https://syzkaller.appspot.com/bug?extid=e2787430e752a92b8750
    Reported-by: syzbot <[email protected]>
    Link: https://syzkaller.appspot.com/bug?extid=4913dca2ea6e4d43f3f1
    Signed-off-by: Tetsuo Handa <[email protected]>
    Reviewed-by: Viacheslav Dubeyko <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
gfs2: Fix inode height consistency check [+ + +]
Author: Andreas Gruenbacher <[email protected]>
Date:   Tue Mar 28 00:43:16 2023 +0200

    gfs2: Fix inode height consistency check
    
    [ Upstream commit cfcdb5bad34f600aed7613c3c1a5e618111f77b7 ]
    
    The maximum allowed height of an inode's metadata tree depends on the
    filesystem block size; it is lower for bigger-block filesystems.  When
    reading in an inode, make sure that the height doesn't exceed the
    maximum allowed height.
    
    Arrays like sd_heightsize are sized to be big enough for any filesystem
    block size; they will often be slightly bigger than what's needed for a
    specific filesystem.
    
    Reported-by: [email protected]
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HID: logitech-hidpp: Don't use the USB serial for USB devices [+ + +]
Author: Bastien Nocera <[email protected]>
Date:   Thu Mar 2 14:01:16 2023 +0100

    HID: logitech-hidpp: Don't use the USB serial for USB devices
    
    [ Upstream commit 7ad1fe0da0fa91bf920b79ab05ae97bfabecc4f4 ]
    
    For devices that support the 0x0003 feature (Device Information) version 4,
    set the serial based on the output of that feature, rather than relying
    on the usbhid code setting the USB serial.
    
    This should allow the serial when connected through USB to (nearly)
    match the one when connected through a unifying receiver.
    
    For example, on the serials on a G903 wired/wireless mouse:
    - Unifying: 4067-e8-ce-cd-45
    - USB before patch: 017C385C3837
    - USB after patch: c086-e8-ce-cd-45
    
    Signed-off-by: Bastien Nocera <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: logitech-hidpp: Reconcile USB and Unifying serials [+ + +]
Author: Bastien Nocera <[email protected]>
Date:   Thu Mar 2 14:01:17 2023 +0100

    HID: logitech-hidpp: Reconcile USB and Unifying serials
    
    [ Upstream commit 5b3691d15e04b6d5a32c915577b8dbc5cfb56382 ]
    
    Now that USB HID++ devices can gather a serial number that matches the
    one that would be gathered when connected through a Unifying receiver,
    remove the last difference by dropping the product ID as devices
    usually have different product IDs when connected through USB or
    Unifying.
    
    For example, on the serials on a G903 wired/wireless mouse:
    - Unifying before patch: 4067-e8-ce-cd-45
    - USB before patch: c086-e8-ce-cd-45
    - Unifying and USB after patch: e8-ce-cd-45
    
    Signed-off-by: Bastien Nocera <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: wacom: generic: Set battery quirk only when we see battery data [+ + +]
Author: Jason Gerecke <[email protected]>
Date:   Thu Apr 13 11:17:43 2023 -0700

    HID: wacom: generic: Set battery quirk only when we see battery data
    
    [ Upstream commit bea407a427baa019758f29f4d31b26f008bb8cc6 ]
    
    Some devices will include battery status usages in the HID descriptor
    but we won't see that battery data for one reason or another. For example,
    AES sensors won't send battery data unless an AES pen is in proximity.
    If a user does not have an AES pen but instead only interacts with the
    AES touchscreen with their fingers then there is no need for us to create
    a battery object. Similarly, if a family of peripherals shares the same
    HID descriptor between wired-only and wireless-capable SKUs, users of the
    former may never see a battery event and will not want a power_supply
    object created.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217062
    Link: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2354
    Signed-off-by: Jason Gerecke <[email protected]>
    Tested-by: Mario Limonciello <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igb: fix bit_shift to be in [1..8] range [+ + +]
Author: Aleksandr Loktionov <[email protected]>
Date:   Tue May 16 10:41:46 2023 -0700

    igb: fix bit_shift to be in [1..8] range
    
    [ Upstream commit 60d758659f1fb49e0d5b6ac2691ede8c0958795b ]
    
    In igb_hash_mc_addr() the expression:
            "mc_addr[4] >> 8 - bit_shift", right shifting "mc_addr[4]"
    shift by more than 7 bits always yields zero, so hash becomes not so different.
    Add initialization with bit_shift = 1 and add a loop condition to ensure
    bit_shift will be always in [1..8] range.
    
    Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")
    Signed-off-by: Aleksandr Loktionov <[email protected]>
    Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Input: xpad - add constants for GIP interface numbers [+ + +]
Author: Vicki Pfau <[email protected]>
Date:   Thu Apr 13 23:57:42 2023 -0700

    Input: xpad - add constants for GIP interface numbers
    
    [ Upstream commit f9b2e603c6216824e34dc9a67205d98ccc9a41ca ]
    
    Wired GIP devices present multiple interfaces with the same USB identification
    other than the interface number. This adds constants for differentiating two of
    them and uses them where appropriate
    
    Signed-off-by: Vicki Pfau <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv6: Fix out-of-bounds access in ipv6_find_tlv() [+ + +]
Author: Gavrilov Ilia <[email protected]>
Date:   Tue May 23 08:29:44 2023 +0000

    ipv6: Fix out-of-bounds access in ipv6_find_tlv()
    
    commit 878ecb0897f4737a4c9401f3523fd49589025671 upstream.
    
    optlen is fetched without checking whether there is more than one byte to parse.
    It can lead to out-of-bounds access.
    
    Found by InfoTeCS on behalf of Linux Verification Center
    (linuxtesting.org) with SVACE.
    
    Fixes: c61a40432509 ("[IPV6]: Find option offset by type.")
    Signed-off-by: Gavrilov Ilia <[email protected]>
    Reviewed-by: Jiri Pirko <[email protected]>
    Reviewed-by: David Ahern <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: ipvlan:Fix out-of-bounds caused by unclear skb->cb [+ + +]
Author: t.feng <[email protected]>
Date:   Wed May 10 11:50:44 2023 +0800

    ipvlan:Fix out-of-bounds caused by unclear skb->cb
    
    [ Upstream commit 90cbed5247439a966b645b34eb0a2e037836ea8e ]
    
    If skb enqueue the qdisc, fq_skb_cb(skb)->time_to_send is changed which
    is actually skb->cb, and IPCB(skb_in)->opt will be used in
    __ip_options_echo. It is possible that memcpy is out of bounds and lead
    to stack overflow.
    We should clear skb->cb before ip_local_out or ip6_local_out.
    
    v2:
    1. clean the stack info
    2. use IPCB/IP6CB instead of skb->cb
    
    crash on stable-5.10(reproduce in kasan kernel).
    Stack info:
    [ 2203.651571] BUG: KASAN: stack-out-of-bounds in
    __ip_options_echo+0x589/0x800
    [ 2203.653327] Write of size 4 at addr ffff88811a388f27 by task
    swapper/3/0
    [ 2203.655460] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Not tainted
    5.10.0-60.18.0.50.h856.kasan.eulerosv2r11.x86_64 #1
    [ 2203.655466] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
    BIOS rel-1.10.2-0-g5f4c7b1-20181220_000000-szxrtosci10000 04/01/2014
    [ 2203.655475] Call Trace:
    [ 2203.655481]  <IRQ>
    [ 2203.655501]  dump_stack+0x9c/0xd3
    [ 2203.655514]  print_address_description.constprop.0+0x19/0x170
    [ 2203.655530]  __kasan_report.cold+0x6c/0x84
    [ 2203.655586]  kasan_report+0x3a/0x50
    [ 2203.655594]  check_memory_region+0xfd/0x1f0
    [ 2203.655601]  memcpy+0x39/0x60
    [ 2203.655608]  __ip_options_echo+0x589/0x800
    [ 2203.655654]  __icmp_send+0x59a/0x960
    [ 2203.655755]  nf_send_unreach+0x129/0x3d0 [nf_reject_ipv4]
    [ 2203.655763]  reject_tg+0x77/0x1bf [ipt_REJECT]
    [ 2203.655772]  ipt_do_table+0x691/0xa40 [ip_tables]
    [ 2203.655821]  nf_hook_slow+0x69/0x100
    [ 2203.655828]  __ip_local_out+0x21e/0x2b0
    [ 2203.655857]  ip_local_out+0x28/0x90
    [ 2203.655868]  ipvlan_process_v4_outbound+0x21e/0x260 [ipvlan]
    [ 2203.655931]  ipvlan_xmit_mode_l3+0x3bd/0x400 [ipvlan]
    [ 2203.655967]  ipvlan_queue_xmit+0xb3/0x190 [ipvlan]
    [ 2203.655977]  ipvlan_start_xmit+0x2e/0xb0 [ipvlan]
    [ 2203.655984]  xmit_one.constprop.0+0xe1/0x280
    [ 2203.655992]  dev_hard_start_xmit+0x62/0x100
    [ 2203.656000]  sch_direct_xmit+0x215/0x640
    [ 2203.656028]  __qdisc_run+0x153/0x1f0
    [ 2203.656069]  __dev_queue_xmit+0x77f/0x1030
    [ 2203.656173]  ip_finish_output2+0x59b/0xc20
    [ 2203.656244]  __ip_finish_output.part.0+0x318/0x3d0
    [ 2203.656312]  ip_finish_output+0x168/0x190
    [ 2203.656320]  ip_output+0x12d/0x220
    [ 2203.656357]  __ip_queue_xmit+0x392/0x880
    [ 2203.656380]  __tcp_transmit_skb+0x1088/0x11c0
    [ 2203.656436]  __tcp_retransmit_skb+0x475/0xa30
    [ 2203.656505]  tcp_retransmit_skb+0x2d/0x190
    [ 2203.656512]  tcp_retransmit_timer+0x3af/0x9a0
    [ 2203.656519]  tcp_write_timer_handler+0x3ba/0x510
    [ 2203.656529]  tcp_write_timer+0x55/0x180
    [ 2203.656542]  call_timer_fn+0x3f/0x1d0
    [ 2203.656555]  expire_timers+0x160/0x200
    [ 2203.656562]  run_timer_softirq+0x1f4/0x480
    [ 2203.656606]  __do_softirq+0xfd/0x402
    [ 2203.656613]  asm_call_irq_on_stack+0x12/0x20
    [ 2203.656617]  </IRQ>
    [ 2203.656623]  do_softirq_own_stack+0x37/0x50
    [ 2203.656631]  irq_exit_rcu+0x134/0x1a0
    [ 2203.656639]  sysvec_apic_timer_interrupt+0x36/0x80
    [ 2203.656646]  asm_sysvec_apic_timer_interrupt+0x12/0x20
    [ 2203.656654] RIP: 0010:default_idle+0x13/0x20
    [ 2203.656663] Code: 89 f0 5d 41 5c 41 5d 41 5e c3 cc cc cc cc cc cc cc
    cc cc cc cc cc cc 0f 1f 44 00 00 0f 1f 44 00 00 0f 00 2d 9f 32 57 00 fb
    f4 <c3> cc cc cc cc 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 be 08
    [ 2203.656668] RSP: 0018:ffff88810036fe78 EFLAGS: 00000256
    [ 2203.656676] RAX: ffffffffaf2a87f0 RBX: ffff888100360000 RCX:
    ffffffffaf290191
    [ 2203.656681] RDX: 0000000000098b5e RSI: 0000000000000004 RDI:
    ffff88811a3c4f60
    [ 2203.656686] RBP: 0000000000000000 R08: 0000000000000001 R09:
    ffff88811a3c4f63
    [ 2203.656690] R10: ffffed10234789ec R11: 0000000000000001 R12:
    0000000000000003
    [ 2203.656695] R13: ffff888100360000 R14: 0000000000000000 R15:
    0000000000000000
    [ 2203.656729]  default_idle_call+0x5a/0x150
    [ 2203.656735]  cpuidle_idle_call+0x1c6/0x220
    [ 2203.656780]  do_idle+0xab/0x100
    [ 2203.656786]  cpu_startup_entry+0x19/0x20
    [ 2203.656793]  secondary_startup_64_no_verify+0xc2/0xcb
    
    [ 2203.657409] The buggy address belongs to the page:
    [ 2203.658648] page:0000000027a9842f refcount:1 mapcount:0
    mapping:0000000000000000 index:0x0 pfn:0x11a388
    [ 2203.658665] flags:
    0x17ffffc0001000(reserved|node=0|zone=2|lastcpupid=0x1fffff)
    [ 2203.658675] raw: 0017ffffc0001000 ffffea000468e208 ffffea000468e208
    0000000000000000
    [ 2203.658682] raw: 0000000000000000 0000000000000000 00000001ffffffff
    0000000000000000
    [ 2203.658686] page dumped because: kasan: bad access detected
    
    To reproduce(ipvlan with IPVLAN_MODE_L3):
    Env setting:
    =======================================================
    modprobe ipvlan ipvlan_default_mode=1
    sysctl net.ipv4.conf.eth0.forwarding=1
    iptables -t nat -A POSTROUTING -s 20.0.0.0/255.255.255.0 -o eth0 -j
    MASQUERADE
    ip link add gw link eth0 type ipvlan
    ip -4 addr add 20.0.0.254/24 dev gw
    ip netns add net1
    ip link add ipv1 link eth0 type ipvlan
    ip link set ipv1 netns net1
    ip netns exec net1 ip link set ipv1 up
    ip netns exec net1 ip -4 addr add 20.0.0.4/24 dev ipv1
    ip netns exec net1 route add default gw 20.0.0.254
    ip netns exec net1 tc qdisc add dev ipv1 root netem loss 10%
    ifconfig gw up
    iptables -t filter -A OUTPUT -p tcp --dport 8888 -j REJECT --reject-with
    icmp-port-unreachable
    =======================================================
    And then excute the shell(curl any address of eth0 can reach):
    
    for((i=1;i<=100000;i++))
    do
            ip netns exec net1 curl x.x.x.x:8888
    done
    =======================================================
    
    Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
    Signed-off-by: "t.feng" <[email protected]>
    Suggested-by: Florian Westphal <[email protected]>
    Reviewed-by: Paolo Abeni <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
lib: cpu_rmap: Avoid use after free on rmap->obj array entries [+ + +]
Author: Eli Cohen <[email protected]>
Date:   Wed Feb 8 07:51:02 2023 +0200

    lib: cpu_rmap: Avoid use after free on rmap->obj array entries
    
    [ Upstream commit 4e0473f1060aa49621d40a113afde24818101d37 ]
    
    When calling irq_set_affinity_notifier() with NULL at the notify
    argument, it will cause freeing of the glue pointer in the
    corresponding array entry but will leave the pointer in the array. A
    subsequent call to free_irq_cpu_rmap() will try to free this entry again
    leading to possible use after free.
    
    Fix that by setting NULL to the array entry and checking that we have
    non-zero at the array entry when iterating over the array in
    free_irq_cpu_rmap().
    
    The current code does not suffer from this since there are no cases
    where irq_set_affinity_notifier(irq, NULL) (note the NULL passed for the
    notify arg) is called, followed by a call to free_irq_cpu_rmap() so we
    don't hit and issue. Subsequent patches in this series excersize this
    flow, hence the required fix.
    
    Cc: Thomas Gleixner <[email protected]>
    Signed-off-by: Eli Cohen <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Linux 4.14.316 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Tue May 30 12:38:39 2023 +0100

    Linux 4.14.316
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Guenter Roeck <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Harshit Mogalapalli <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
m68k: Move signal frame following exception on 68020/030 [+ + +]
Author: Finn Thain <[email protected]>
Date:   Sat May 6 19:38:12 2023 +1000

    m68k: Move signal frame following exception on 68020/030
    
    commit b845b574f86dcb6a70dfa698aa87a237b0878d2a upstream.
    
    On 68030/020, an instruction such as, moveml %a2-%a3/%a5,%sp@- may cause
    a stack page fault during instruction execution (i.e. not at an
    instruction boundary) and produce a format 0xB exception frame.
    
    In this situation, the value of USP will be unreliable.  If a signal is
    to be delivered following the exception, this USP value is used to
    calculate the location for a signal frame.  This can result in a
    corrupted user stack.
    
    The corruption was detected in dash (actually in glibc) where it showed
    up as an intermittent "stack smashing detected" message and crash
    following signal delivery for SIGCHLD.
    
    It was hard to reproduce that failure because delivery of the signal
    raced with the page fault and because the kernel places an unpredictable
    gap of up to 7 bytes between the USP and the signal frame.
    
    A format 0xB exception frame can be produced by a bus error or an
    address error.  The 68030 Users Manual says that address errors occur
    immediately upon detection during instruction prefetch.  The instruction
    pipeline allows prefetch to overlap with other instructions, which means
    an address error can arise during the execution of a different
    instruction.  So it seems likely that this patch may help in the address
    error case also.
    
    Reported-and-tested-by: Stan Johnson <[email protected]>
    Link: https://lore.kernel.org/all/CAMuHMdW3yD22_ApemzW_6me3adq6A458u1_F0v-1EYwK_62jPA@mail.gmail.com/
    Cc: Michael Schmitz <[email protected]>
    Cc: Andreas Schwab <[email protected]>
    Cc: [email protected]
    Co-developed-by: Michael Schmitz <[email protected]>
    Signed-off-by: Michael Schmitz <[email protected]>
    Signed-off-by: Finn Thain <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/r/9e66262a754fcba50208aa424188896cc52a1dd1.1683365892.git.fthain@linux-m68k.org
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mcb-pci: Reallocate memory region to avoid memory overlapping [+ + +]
Author: Rodríguez Barbarin, José Javier <[email protected]>
Date:   Tue Apr 11 10:33:28 2023 +0200

    mcb-pci: Reallocate memory region to avoid memory overlapping
    
    [ Upstream commit 9be24faadd085c284890c3afcec7a0184642315a ]
    
    mcb-pci requests a fixed-size memory region to parse the chameleon
    table, however, if the chameleon table is smaller that the allocated
    region, it could overlap with the IP Cores' memory regions.
    
    After parsing the chameleon table, drop/reallocate the memory region
    with the actual chameleon table size.
    
    Co-developed-by: Jorge Sanjuan Garcia <[email protected]>
    Signed-off-by: Jorge Sanjuan Garcia <[email protected]>
    Signed-off-by: Javier Rodriguez <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
media: netup_unidvb: fix use-after-free at del_timer() [+ + +]
Author: Duoming Zhou <[email protected]>
Date:   Wed Mar 8 12:55:14 2023 +0000

    media: netup_unidvb: fix use-after-free at del_timer()
    
    [ Upstream commit 0f5bb36bf9b39a2a96e730bf4455095b50713f63 ]
    
    When Universal DVB card is detaching, netup_unidvb_dma_fini()
    uses del_timer() to stop dma->timeout timer. But when timer
    handler netup_unidvb_dma_timeout() is running, del_timer()
    could not stop it. As a result, the use-after-free bug could
    happen. The process is shown below:
    
        (cleanup routine)          |        (timer routine)
                                   | mod_timer(&dev->tx_sim_timer, ..)
    netup_unidvb_finidev()         | (wait a time)
      netup_unidvb_dma_fini()      | netup_unidvb_dma_timeout()
        del_timer(&dma->timeout);  |
                                   |   ndev->pci_dev->dev //USE
    
    Fix by changing del_timer() to del_timer_sync().
    
    Link: https://lore.kernel.org/linux-media/[email protected]
    Fixes: 52b1eaf4c59a ("[media] netup_unidvb: NetUP Universal DVB-S/S2/T/T2/C PCI-E card driver")
    Signed-off-by: Duoming Zhou <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: radio-shark: Add endpoint checks [+ + +]
Author: Alan Stern <[email protected]>
Date:   Mon Apr 10 15:40:05 2023 -0400

    media: radio-shark: Add endpoint checks
    
    commit 76e31045ba030e94e72105c01b2e98f543d175ac upstream.
    
    The syzbot fuzzer was able to provoke a WARNING from the radio-shark2
    driver:
    
    ------------[ cut here ]------------
    usb 1-1: BOGUS urb xfer, pipe 1 != type 3
    WARNING: CPU: 0 PID: 3271 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed2/0x1880 drivers/usb/core/urb.c:504
    Modules linked in:
    CPU: 0 PID: 3271 Comm: kworker/0:3 Not tainted 6.1.0-rc4-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
    Workqueue: usb_hub_wq hub_event
    RIP: 0010:usb_submit_urb+0xed2/0x1880 drivers/usb/core/urb.c:504
    Code: 7c 24 18 e8 00 36 ea fb 48 8b 7c 24 18 e8 36 1c 02 ff 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 a0 b6 90 8a e8 9a 29 b8 03 <0f> 0b e9 58 f8 ff ff e8 d2 35 ea fb 48 81 c5 c0 05 00 00 e9 84 f7
    RSP: 0018:ffffc90003876dd0 EFLAGS: 00010282
    RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000000000
    RDX: ffff8880750b0040 RSI: ffffffff816152b8 RDI: fffff5200070edac
    RBP: ffff8880172d81e0 R08: 0000000000000005 R09: 0000000000000000
    R10: 0000000080000000 R11: 0000000000000000 R12: 0000000000000001
    R13: ffff8880285c5040 R14: 0000000000000002 R15: ffff888017158200
    FS:  0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007ffe03235b90 CR3: 000000000bc8e000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
     usb_bulk_msg+0x226/0x550 drivers/usb/core/message.c:387
     shark_write_reg+0x1ff/0x2e0 drivers/media/radio/radio-shark2.c:88
    ...
    
    The problem was caused by the fact that the driver does not check
    whether the endpoints it uses are actually present and have the
    appropriate types.  This can be fixed by adding a simple check of
    these endpoints (and similarly for the radio-shark driver).
    
    Link: https://syzkaller.appspot.com/bug?extid=4b3f8190f6e13b3efd74
    Reported-and-tested-by: [email protected]
    Signed-off-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
memstick: r592: Fix UAF bug in r592_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Wed Mar 8 00:43:38 2023 +0800

    memstick: r592: Fix UAF bug in r592_remove due to race condition
    
    [ Upstream commit 63264422785021704c39b38f65a78ab9e4a186d7 ]
    
    In r592_probe, dev->detect_timer was bound with r592_detect_timer.
    In r592_irq function, the timer function will be invoked by mod_timer.
    
    If we remove the module which will call hantro_release to make cleanup,
    there may be a unfinished work. The possible sequence is as follows,
    which will cause a typical UAF bug.
    
    Fix it by canceling the work before cleanup in r592_remove.
    
    CPU0                  CPU1
    
                        |r592_detect_timer
    r592_remove         |
      memstick_free_host|
      put_device;       |
      kfree(host);      |
                        |
                        | queue_work
                        |   &host->media_checker //use
    
    Signed-off-by: Zheng Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mfd: dln2: Fix memory leak in dln2_probe() [+ + +]
Author: Qiang Ning <[email protected]>
Date:   Thu Mar 30 10:43:53 2023 +0800

    mfd: dln2: Fix memory leak in dln2_probe()
    
    [ Upstream commit 96da8f148396329ba769246cb8ceaa35f1ddfc48 ]
    
    When dln2_setup_rx_urbs() in dln2_probe() fails, error out_free forgets
    to call usb_put_dev() to decrease the refcount of dln2->usb_dev.
    
    Fix this by adding usb_put_dev() in the error handling code of
    dln2_probe().
    
    Signed-off-by: Qiang Ning <[email protected]>
    Signed-off-by: Lee Jones <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
net: annotate sk->sk_err write from do_recvmmsg() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue May 9 16:35:53 2023 +0000

    net: annotate sk->sk_err write from do_recvmmsg()
    
    [ Upstream commit e05a5f510f26607616fecdd4ac136310c8bea56b ]
    
    do_recvmmsg() can write to sk->sk_err from multiple threads.
    
    As said before, many other points reading or writing sk_err
    need annotations.
    
    Fixes: 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path")
    Signed-off-by: Eric Dumazet <[email protected]>
    Reported-by: syzbot <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: Catch invalid index in XPS mapping [+ + +]
Author: Nick Child <[email protected]>
Date:   Tue Mar 21 10:07:24 2023 -0500

    net: Catch invalid index in XPS mapping
    
    [ Upstream commit 5dd0dfd55baec0742ba8f5625a0dd064aca7db16 ]
    
    When setting the XPS value of a TX queue, warn the user once if the
    index of the queue is greater than the number of allocated TX queues.
    
    Previously, this scenario went uncaught. In the best case, it resulted
    in unnecessary allocations. In the worst case, it resulted in
    out-of-bounds memory references through calls to `netdev_get_tx_queue(
    dev, index)`. Therefore, it is important to inform the user but not
    worth returning an error and risk downing the netdevice.
    
    Signed-off-by: Nick Child <[email protected]>
    Reviewed-by: Piotr Raczynski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: fec: Better handle pm_runtime_get() failing in .remove() [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Wed May 10 22:00:20 2023 +0200

    net: fec: Better handle pm_runtime_get() failing in .remove()
    
    [ Upstream commit f816b9829b19394d318e01953aa3b2721bca040d ]
    
    In the (unlikely) event that pm_runtime_get() (disguised as
    pm_runtime_resume_and_get()) fails, the remove callback returned an
    error early. The problem with this is that the driver core ignores the
    error value and continues removing the device. This results in a
    resource leak. Worse the devm allocated resources are freed and so if a
    callback of the driver is called later the register mapping is already
    gone which probably results in a crash.
    
    Fixes: a31eda65ba21 ("net: fec: fix clock count mis-match")
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs(). [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Mon May 8 10:55:43 2023 -0700

    net: Fix load-tearing on sk->sk_stamp in sock_recv_cmsgs().
    
    [ Upstream commit dfd9248c071a3710c24365897459538551cb7167 ]
    
    KCSAN found a data race in sock_recv_cmsgs() where the read access
    to sk->sk_stamp needs READ_ONCE().
    
    BUG: KCSAN: data-race in packet_recvmsg / packet_recvmsg
    
    write (marked) to 0xffff88803c81f258 of 8 bytes by task 19171 on cpu 0:
     sock_write_timestamp include/net/sock.h:2670 [inline]
     sock_recv_cmsgs include/net/sock.h:2722 [inline]
     packet_recvmsg+0xb97/0xd00 net/packet/af_packet.c:3489
     sock_recvmsg_nosec net/socket.c:1019 [inline]
     sock_recvmsg+0x11a/0x130 net/socket.c:1040
     sock_read_iter+0x176/0x220 net/socket.c:1118
     call_read_iter include/linux/fs.h:1845 [inline]
     new_sync_read fs/read_write.c:389 [inline]
     vfs_read+0x5e0/0x630 fs/read_write.c:470
     ksys_read+0x163/0x1a0 fs/read_write.c:613
     __do_sys_read fs/read_write.c:623 [inline]
     __se_sys_read fs/read_write.c:621 [inline]
     __x64_sys_read+0x41/0x50 fs/read_write.c:621
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    read to 0xffff88803c81f258 of 8 bytes by task 19183 on cpu 1:
     sock_recv_cmsgs include/net/sock.h:2721 [inline]
     packet_recvmsg+0xb64/0xd00 net/packet/af_packet.c:3489
     sock_recvmsg_nosec net/socket.c:1019 [inline]
     sock_recvmsg+0x11a/0x130 net/socket.c:1040
     sock_read_iter+0x176/0x220 net/socket.c:1118
     call_read_iter include/linux/fs.h:1845 [inline]
     new_sync_read fs/read_write.c:389 [inline]
     vfs_read+0x5e0/0x630 fs/read_write.c:470
     ksys_read+0x163/0x1a0 fs/read_write.c:613
     __do_sys_read fs/read_write.c:623 [inline]
     __se_sys_read fs/read_write.c:621 [inline]
     __x64_sys_read+0x41/0x50 fs/read_write.c:621
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    value changed: 0xffffffffc4653600 -> 0x0000000000000000
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 PID: 19183 Comm: syz-executor.5 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
    
    Fixes: 6c7c98bad488 ("sock: avoid dirtying sk_stamp, if possible")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
net: fix skb leak in __skb_tstamp_tx() [+ + +]
Author: Pratyush Yadav <[email protected]>
Date:   Mon May 22 17:30:20 2023 +0200

    net: fix skb leak in __skb_tstamp_tx()
    
    commit 8a02fb71d7192ff1a9a47c9d937624966c6e09af upstream.
    
    Commit 50749f2dd685 ("tcp/udp: Fix memleaks of sk and zerocopy skbs with
    TX timestamp.") added a call to skb_orphan_frags_rx() to fix leaks with
    zerocopy skbs. But it ended up adding a leak of its own. When
    skb_orphan_frags_rx() fails, the function just returns, leaking the skb
    it just cloned. Free it before returning.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: 50749f2dd685 ("tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.")
    Signed-off-by: Pratyush Yadav <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment() [+ + +]
Author: Dong Chenchen <[email protected]>
Date:   Thu May 11 20:54:40 2023 +0800

    net: nsh: Use correct mac_offset to unwind gso skb in nsh_gso_segment()
    
    [ Upstream commit c83b49383b595be50647f0c764a48c78b5f3c4f8 ]
    
    As the call trace shows, skb_panic was caused by wrong skb->mac_header
    in nsh_gso_segment():
    
    invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
    CPU: 3 PID: 2737 Comm: syz Not tainted 6.3.0-next-20230505 #1
    RIP: 0010:skb_panic+0xda/0xe0
    call Trace:
     skb_push+0x91/0xa0
     nsh_gso_segment+0x4f3/0x570
     skb_mac_gso_segment+0x19e/0x270
     __skb_gso_segment+0x1e8/0x3c0
     validate_xmit_skb+0x452/0x890
     validate_xmit_skb_list+0x99/0xd0
     sch_direct_xmit+0x294/0x7c0
     __dev_queue_xmit+0x16f0/0x1d70
     packet_xmit+0x185/0x210
     packet_snd+0xc15/0x1170
     packet_sendmsg+0x7b/0xa0
     sock_sendmsg+0x14f/0x160
    
    The root cause is:
    nsh_gso_segment() use skb->network_header - nhoff to reset mac_header
    in skb_gso_error_unwind() if inner-layer protocol gso fails.
    However, skb->network_header may be reset by inner-layer protocol
    gso function e.g. mpls_gso_segment. skb->mac_header reset by the
    inaccurate network_header will be larger than skb headroom.
    
    nsh_gso_segment
        nhoff = skb->network_header - skb->mac_header;
        __skb_pull(skb,nsh_len)
        skb_mac_gso_segment
            mpls_gso_segment
                skb_reset_network_header(skb);//skb->network_header+=nsh_len
                return -EINVAL;
        skb_gso_error_unwind
            skb_push(skb, nsh_len);
            skb->mac_header = skb->network_header - nhoff;
            // skb->mac_header > skb->headroom, cause skb_push panic
    
    Use correct mac_offset to restore mac_header and get rid of nhoff.
    
    Fixes: c411ed854584 ("nsh: add GSO support")
    Reported-by: [email protected]
    Suggested-by: Eric Dumazet <[email protected]>
    Signed-off-by: Dong Chenchen <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: pasemi: Fix return type of pasemi_mac_start_tx() [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Sun Mar 19 16:41:08 2023 -0700

    net: pasemi: Fix return type of pasemi_mac_start_tx()
    
    [ Upstream commit c8384d4a51e7cb0e6587f3143f29099f202c5de1 ]
    
    With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
    indirect call targets are validated against the expected function
    pointer prototype to make sure the call target is valid to help mitigate
    ROP attacks. If they are not identical, there is a failure at run time,
    which manifests as either a kernel panic or thread getting killed. A
    warning in clang aims to catch these at compile time, which reveals:
    
      drivers/net/ethernet/pasemi/pasemi_mac.c:1665:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
              .ndo_start_xmit         = pasemi_mac_start_tx,
                                        ^~~~~~~~~~~~~~~~~~~
      1 error generated.
    
    ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of
    'netdev_tx_t', not 'int'. Adjust the return type of
    pasemi_mac_start_tx() to match the prototype's to resolve the warning.
    While PowerPC does not currently implement support for kCFI, it could in
    the future, which means this warning becomes a fatal CFI failure at run
    time.
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1750
    Signed-off-by: Nathan Chancellor <[email protected]>
    Reviewed-by: Horatiu Vultur <[email protected]>
    Link: https://lore.kernel.org/r/20230319-pasemi-incompatible-pointer-types-strict-v1-1-1b9459d8aef0@kernel.org
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfilter: nf_tables: add nft_setelem_parse_key() [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:05 2023 +0200

    netfilter: nf_tables: add nft_setelem_parse_key()
    
    [ 20a1452c35425b2cef76f21f8395ef069dfddfa9 ]
    
    Add helper function to parse the set element key netlink attribute.
    
    v4: No changes
    v3: New patch
    
    [sbrivio: refactor error paths and labels; use NFT_DATA_VALUE_MAXLEN
      instead of sizeof(*key) in helper, value can be longer than that;
      rebase]
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: allow up to 64 bytes in the set element data area [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:06 2023 +0200

    netfilter: nf_tables: allow up to 64 bytes in the set element data area
    
    [ fdb9c405e35bdc6e305b9b4e20ebc141ed14fc81 ]
    
    So far, the set elements could store up to 128-bits in the data area.
    
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: bogus EBUSY in helper removal from transaction [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Thu Mar 14 10:50:20 2019 +0100

    netfilter: nf_tables: bogus EBUSY in helper removal from transaction
    
    commit 8ffcd32f64633926163cdd07a7d295c500a947d1 upstream.
    
    Proper use counter updates when activating and deactivating the object,
    otherwise, this hits bogus EBUSY error.
    
    Fixes: cd5125d8f518 ("netfilter: nf_tables: split set destruction in deactivate and destroy phase")
    Reported-by: Laura Garcia <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: do not allow RULE_ID to refer to another chain [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:09 2023 +0200

    netfilter: nf_tables: do not allow RULE_ID to refer to another chain
    
    [ 36d5b2913219ac853908b0f1c664345e04313856 ]
    
    When doing lookups for rules on the same batch by using its ID, a rule from
    a different chain can be used. If a rule is added to a chain but tries to
    be positioned next to a rule from a different chain, it will be linked to
    chain2, but the use counter on chain1 would be the one to be incremented.
    
    When looking for rules by ID, use the chain that was used for the lookup by
    name. The chain used in the context copied to the transaction needs to
    match that same chain. That way, struct nft_rule does not need to get
    enlarged with another member.
    
    Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute")
    Fixes: 75dd48e2e420 ("netfilter: nf_tables: Support RULE_ID reference in new rule")
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: do not allow SET_ID to refer to another table [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:10 2023 +0200

    netfilter: nf_tables: do not allow SET_ID to refer to another table
    
    [ 470ee20e069a6d05ae549f7d0ef2bdbcee6a81b2 ]
    
    When doing lookups for sets on the same batch by using its ID, a set from a
    different table can be used.
    
    Then, when the table is removed, a reference to the set may be kept after
    the set is freed, leading to a potential use-after-free.
    
    When looking for sets by ID, use the table that was used for the lookup by
    name, and only return sets belonging to that same table.
    
    This fixes CVE-2022-2586, also reported as ZDI-CAN-17470.
    
    Reported-by: Team Orca of Sea Security (@seasecresponse)
    Fixes: 958bee14d071 ("netfilter: nf_tables: use new transaction infrastructure to handle sets")
    Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: fix register ordering [+ + +]
Author: Florian Westphal <[email protected]>
Date:   Sat May 27 18:08:11 2023 +0200

    netfilter: nf_tables: fix register ordering
    
    [ d209df3e7f7002d9099fdb0f6df0f972b4386a63 ]
    
    [ We hit the trace described in commit message with the
    kselftest/nft_trans_stress.sh. This patch diverges from the upstream one
    since kernel 4.14 does not have following symbols:
    nft_chain_filter_init, nf_tables_flowtable_notifier ]
    
    We must register nfnetlink ops last, as that exposes nf_tables to
    userspace.  Without this, we could theoretically get nfnetlink request
    before net->nft state has been initialized.
    
    Fixes: 99633ab29b213 ("netfilter: nf_tables: complete net namespace support")
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    [apanyaki: backport to v4.14-stable]
    Signed-off-by: Andrew Paniakin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: stricter validation of element data [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:07 2023 +0200

    netfilter: nf_tables: stricter validation of element data
    
    [ 7e6bc1f6cabcd30aba0b11219d8e01b952eacbb6 ]
    
    Make sure element data type and length do not mismatch the one specified
    by the set declaration.
    
    Fixes: 7d7402642eaf ("netfilter: nf_tables: variable sized set element keys / data")
    Reported-by: Hugues ANGUELKOV <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_tables: validate registers coming from userspace. [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:04 2023 +0200

    netfilter: nf_tables: validate registers coming from userspace.
    
    [ 6e1acfa387b9ff82cfc7db8cc3b6959221a95851 ]
    
    Bail out in case userspace uses unsupported registers.
    
    Fixes: 49499c3e6e18 ("netfilter: nf_tables: switch registers to 32 bit addressing")
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nft_dynset: do not reject set updates with NFT_SET_EVAL [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:08 2023 +0200

    netfilter: nft_dynset: do not reject set updates with NFT_SET_EVAL
    
    [ 215a31f19dedd4e92a67cf5a9717ee898d012b3a ]
    
    NFT_SET_EVAL is signalling the kernel that this sets can be updated from
    the evaluation path, even if there are no expressions attached to the
    element. Otherwise, set updates with no expressions fail. Update
    description to describe the right semantics.
    
    Fixes: 22fe54d5fefc ("netfilter: nf_tables: add support for dynamic set updates")
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nftables: add nft_parse_register_load() and use it [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:01 2023 +0200

    netfilter: nftables: add nft_parse_register_load() and use it
    
    [ backport of 4f16d25c68ec844299a4df6ecbb0234eaf88a935 ]
    
    This new function combines the netlink register attribute parser
    and the load validation function.
    
    This update requires to replace:
    
            enum nft_registers      sreg:8;
    
    in many of the expression private areas otherwise compiler complains
    with:
    
            error: cannot take address of bit-field ‘sreg’
    
    when passing the register field as reference.
    
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nftables: add nft_parse_register_store() and use it [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:02 2023 +0200

    netfilter: nftables: add nft_parse_register_store() and use it
    
    [ 345023b0db315648ccc3c1a36aee88304a8b4d91 ]
    
    This new function combines the netlink register attribute parser
    and the store validation function.
    
    This update requires to replace:
    
            enum nft_registers      dreg:8;
    
    in many of the expression private areas otherwise compiler complains
    with:
    
            error: cannot take address of bit-field ‘dreg’
    
    when passing the register field as reference.
    
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nftables: statify nft_parse_register() [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Sat May 27 18:08:03 2023 +0200

    netfilter: nftables: statify nft_parse_register()
    
    [ 08a01c11a5bb3de9b0a9c9b2685867e50eda9910 ]
    
    This function is not used anymore by any extension, statify it.
    
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
netlink: annotate accesses to nlk->cb_running [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue May 9 16:56:34 2023 +0000

    netlink: annotate accesses to nlk->cb_running
    
    [ Upstream commit a939d14919b799e6fff8a9c80296ca229ba2f8a4 ]
    
    Both netlink_recvmsg() and netlink_native_seq_show() read
    nlk->cb_running locklessly. Use READ_ONCE() there.
    
    Add corresponding WRITE_ONCE() to netlink_dump() and
    __netlink_dump_start()
    
    syzbot reported:
    BUG: KCSAN: data-race in __netlink_dump_start / netlink_recvmsg
    
    write to 0xffff88813ea4db59 of 1 bytes by task 28219 on cpu 0:
    __netlink_dump_start+0x3af/0x4d0 net/netlink/af_netlink.c:2399
    netlink_dump_start include/linux/netlink.h:308 [inline]
    rtnetlink_rcv_msg+0x70f/0x8c0 net/core/rtnetlink.c:6130
    netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2577
    rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6192
    netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
    netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365
    netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1942
    sock_sendmsg_nosec net/socket.c:724 [inline]
    sock_sendmsg net/socket.c:747 [inline]
    sock_write_iter+0x1aa/0x230 net/socket.c:1138
    call_write_iter include/linux/fs.h:1851 [inline]
    new_sync_write fs/read_write.c:491 [inline]
    vfs_write+0x463/0x760 fs/read_write.c:584
    ksys_write+0xeb/0x1a0 fs/read_write.c:637
    __do_sys_write fs/read_write.c:649 [inline]
    __se_sys_write fs/read_write.c:646 [inline]
    __x64_sys_write+0x42/0x50 fs/read_write.c:646
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    read to 0xffff88813ea4db59 of 1 bytes by task 28222 on cpu 1:
    netlink_recvmsg+0x3b4/0x730 net/netlink/af_netlink.c:2022
    sock_recvmsg_nosec+0x4c/0x80 net/socket.c:1017
    ____sys_recvmsg+0x2db/0x310 net/socket.c:2718
    ___sys_recvmsg net/socket.c:2762 [inline]
    do_recvmmsg+0x2e5/0x710 net/socket.c:2856
    __sys_recvmmsg net/socket.c:2935 [inline]
    __do_sys_recvmmsg net/socket.c:2958 [inline]
    __se_sys_recvmmsg net/socket.c:2951 [inline]
    __x64_sys_recvmmsg+0xe2/0x160 net/socket.c:2951
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    value changed: 0x00 -> 0x01
    
    Fixes: 16b304f3404f ("netlink: Eliminate kmalloc in netlink dump operation.")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode() [+ + +]
Author: Ryusuke Konishi <[email protected]>
Date:   Wed May 10 00:29:56 2023 +0900

    nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()
    
    commit 9b5a04ac3ad9898c4745cba46ea26de74ba56a8e upstream.
    
    During unmount process of nilfs2, nothing holds nilfs_root structure after
    nilfs2 detaches its writer in nilfs_detach_log_writer().  However, since
    nilfs_evict_inode() uses nilfs_root for some cleanup operations, it may
    cause use-after-free read if inodes are left in "garbage_list" and
    released by nilfs_dispose_list() at the end of nilfs_detach_log_writer().
    
    Fix this issue by modifying nilfs_evict_inode() to only clear inode
    without additional metadata changes that use nilfs_root if the file system
    is degraded to read-only or the writer is detached.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Reported-by: [email protected]
    Closes: https://lkml.kernel.org/r/[email protected]
    Tested-by: Ryusuke Konishi <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
parisc: Allow to reboot machine after system halt [+ + +]
Author: Helge Deller <[email protected]>
Date:   Mon May 22 22:57:30 2023 +0200

    parisc: Allow to reboot machine after system halt
    
    commit 2028315cf59bb899a5ac7e87dc48ecb8fac7ac24 upstream.
    
    In case a machine can't power-off itself on system shutdown,
    allow the user to reboot it by pressing the RETURN key.
    
    Cc: <[email protected]> # v4.14+
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
phy: st: miphy28lp: use _poll_timeout functions for waits [+ + +]
Author: Alain Volmat <[email protected]>
Date:   Fri Feb 10 23:43:08 2023 +0100

    phy: st: miphy28lp: use _poll_timeout functions for waits
    
    [ Upstream commit e3be4dd2c8d8aabfd2c3127d0e2e5754d3ae82d6 ]
    
    This commit introduces _poll_timeout functions usage instead of
    wait loops waiting for a status bit.
    
    Signed-off-by: Alain Volmat <[email protected]>
    Reviewed-by: Patrice Chotard <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Sat Apr 15 20:23:32 2023 +0200

    power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition
    
    commit 5c34c0aef185dcd10881847b9ebf20046aa77cb4 upstream.
    
    bq27xxx_battery_update() assumes / requires that it is only run once,
    not multiple times at the same time. But there are 3 possible callers:
    
    1. bq27xxx_battery_poll() delayed_work item handler
    2. bq27xxx_battery_irq_handler_thread() I2C IRQ handler
    3. bq27xxx_battery_setup()
    
    And there is no protection against these racing with each other,
    fix this race condition by making all callers take di->lock:
    
    - Rename bq27xxx_battery_update() to bq27xxx_battery_update_unlocked()
    
    - Add new bq27xxx_battery_update() which takes di->lock and then calls
      bq27xxx_battery_update_unlocked()
    
    - Make stale cache check code in bq27xxx_battery_get_property(), which
      already takes di->lock directly to check the jiffies, call
      bq27xxx_battery_update_unlocked() instead of messing with
      the delayed_work item
    
    - Make bq27xxx_battery_update_unlocked() mod the delayed-work item
      so that the next poll is delayed to poll_interval milliseconds after
      the last update independent of the source of the update
    
    Fixes: 740b755a3b34 ("bq27x00: Poll battery state")
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: bq27xxx: Fix I2C IRQ race on remove [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Sat Apr 15 20:23:33 2023 +0200

    power: supply: bq27xxx: Fix I2C IRQ race on remove
    
    commit 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 upstream.
    
    devm_request_threaded_irq() requested IRQs are only free-ed after
    the driver's remove function has ran. So the IRQ could trigger and
    call bq27xxx_battery_update() after bq27xxx_battery_teardown() has
    already run.
    
    Switch to explicitly free-ing the IRQ in bq27xxx_battery_i2c_remove()
    to fix this.
    
    Fixes: 8807feb91b76 ("power: bq27xxx_battery: Add interrupt handling support")
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: bq27xxx: Fix poll_interval handling and races on remove [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Sat Apr 15 20:23:34 2023 +0200

    power: supply: bq27xxx: Fix poll_interval handling and races on remove
    
    commit c00bc80462afc7963f449d7f21d896d2f629cacc upstream.
    
    Before this patch bq27xxx_battery_teardown() was setting poll_interval = 0
    to avoid bq27xxx_battery_update() requeuing the delayed_work item.
    
    There are 2 problems with this:
    
    1. If the driver is unbound through sysfs, rather then the module being
       rmmod-ed, this changes poll_interval unexpectedly
    
    2. This is racy, after it being set poll_interval could be changed
       before bq27xxx_battery_update() checks it through
       /sys/module/bq27xxx_battery/parameters/poll_interval
    
    Fix this by added a removed attribute to struct bq27xxx_device_info and
    using that instead of setting poll_interval to 0.
    
    There also is another poll_interval related race on remove(), writing
    /sys/module/bq27xxx_battery/parameters/poll_interval will requeue
    the delayed_work item for all devices on the bq27xxx_battery_devices
    list and the device being removed was only removed from that list
    after cancelling the delayed_work item.
    
    Fix this by moving the removal from the bq27xxx_battery_devices list
    to before cancelling the delayed_work item.
    
    Fixes: 8cfaaa811894 ("bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver")
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: leds: Fix blink to LED on transition [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Thu Apr 13 12:09:41 2023 +0200

    power: supply: leds: Fix blink to LED on transition
    
    commit e4484643991e0f6b89060092563f0dbab9450cbb upstream.
    
    When a battery's status changes from charging to full then
    the charging-blink-full-solid trigger tries to change
    the LED from blinking to solid/on.
    
    As is documented in include/linux/leds.h to deactivate blinking /
    to make the LED solid a LED_OFF must be send:
    
    """
             * Deactivate blinking again when the brightness is set to LED_OFF
             * via the brightness_set() callback.
    """
    
    led_set_brighness() calls with a brightness value other then 0 / LED_OFF
    merely change the brightness of the LED in its on state while it is
    blinking.
    
    So power_supply_update_bat_leds() must first send a LED_OFF event
    before the LED_FULL to disable blinking.
    
    Fixes: 6501f728c56f ("power_supply: Add new LED trigger charging-blink-solid-full")
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Vasily Khoruzhick <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: sbs-charger: Fix INHIBITED bit for Status reg [+ + +]
Author: Daisuke Nojiri <[email protected]>
Date:   Mon Apr 24 11:25:58 2023 -0700

    power: supply: sbs-charger: Fix INHIBITED bit for Status reg
    
    commit b2f2a3c9800208b0db2c2e34b05323757117faa2 upstream.
    
    CHARGE_INHIBITED bit position of the ChargerStatus register is actually
    0 not 1. This patch corrects it.
    
    Fixes: feb583e37f8a8 ("power: supply: add sbs-charger driver")
    Signed-off-by: Daisuke Nojiri <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
recordmcount: Fix memory leaks in the uwrite function [+ + +]
Author: Hao Zeng <[email protected]>
Date:   Wed Apr 26 09:05:27 2023 +0800

    recordmcount: Fix memory leaks in the uwrite function
    
    [ Upstream commit fa359d068574d29e7d2f0fdd0ebe4c6a12b5cfb9 ]
    
    Common realloc mistake: 'file_append' nulled but not freed upon failure
    
    Link: https://lkml.kernel.org/r/[email protected]
    
    Signed-off-by: Hao Zeng <[email protected]>
    Suggested-by: Steven Rostedt <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
regmap: cache: Return error in cache sync operations for REGCACHE_NONE [+ + +]
Author: Alexander Stein <[email protected]>
Date:   Mon Mar 13 08:18:11 2023 +0100

    regmap: cache: Return error in cache sync operations for REGCACHE_NONE
    
    [ Upstream commit fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 ]
    
    There is no sense in doing a cache sync on REGCACHE_NONE regmaps.
    Instead of panicking the kernel due to missing cache_ops, return an error
    to client driver.
    
    Signed-off-by: Alexander Stein <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sched: Fix KCSAN noinstr violation [+ + +]
Author: Josh Poimboeuf <[email protected]>
Date:   Wed Apr 12 10:24:07 2023 -0700

    sched: Fix KCSAN noinstr violation
    
    [ Upstream commit e0b081d17a9f4e5c0cbb0e5fbeb1abe3de0f7e4e ]
    
    With KCSAN enabled, end_of_stack() can get out-of-lined.  Force it
    inline.
    
    Fixes the following warnings:
    
      vmlinux.o: warning: objtool: check_stackleak_irqoff+0x2b: call to end_of_stack() leaves .noinstr.text section
    
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Link: https://lore.kernel.org/r/cc1b4d73d3a428a00d206242a68fdf99a934ca7b.1681320026.git.jpoimboe@kernel.org
    Signed-off-by: Sasha Levin <[email protected]>

 
scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Sat Mar 18 16:16:35 2023 +0800

    scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition
    
    [ Upstream commit f486893288f3e9b171b836f43853a6426515d800 ]
    
    mptlan_probe() calls mpt_register_lan_device() which initializes the
    &priv->post_buckets_task workqueue. A call to
    mpt_lan_wake_post_buckets_task() will subsequently start the work.
    
    During driver unload in mptlan_remove() the following race may occur:
    
    CPU0                  CPU1
    
                        |mpt_lan_post_receive_buckets_work()
    mptlan_remove()     |
      free_netdev()     |
        kfree(dev);     |
                        |
                        | dev->mtu
                        |   //use
    
    Fix this by finishing the work prior to cleaning up in mptlan_remove().
    
    [mkp: we really should remove mptlan instead of attempting to fix it]
    
    Signed-off-by: Zheng Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/memfd: Fix unknown type name build failure [+ + +]
Author: Hardik Garg <[email protected]>
Date:   Fri May 26 16:21:36 2023 -0700

    selftests/memfd: Fix unknown type name build failure
    
    Partially backport v6.3 commit 11f75a01448f ("selftests/memfd: add tests
    for MFD_NOEXEC_SEAL MFD_EXEC") to fix an unknown type name build error.
    In some systems, the __u64 typedef is not present due to differences in
    system headers, causing compilation errors like this one:
    
    fuse_test.c:64:8: error: unknown type name '__u64'
       64 | static __u64 mfd_assert_get_seals(int fd)
    
    This header includes the  __u64 typedef which increases the likelihood
    of successful compilation on a wider variety of systems.
    
    Signed-off-by: Hardik Garg <[email protected]>
    Reviewed-by: Tyler Hicks (Microsoft) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
serial: 8250: Reinit port->pm on port specific driver unbind [+ + +]
Author: Tony Lindgren <[email protected]>
Date:   Tue Apr 18 13:14:06 2023 +0300

    serial: 8250: Reinit port->pm on port specific driver unbind
    
    [ Upstream commit 04e82793f068d2f0ffe62fcea03d007a8cdc16a7 ]
    
    When we unbind a serial port hardware specific 8250 driver, the generic
    serial8250 driver takes over the port. After that we see an oops about 10
    seconds later. This can produce the following at least on some TI SoCs:
    
    Unhandled fault: imprecise external abort (0x1406)
    Internal error: : 1406 [#1] SMP ARM
    
    Turns out that we may still have the serial port hardware specific driver
    port->pm in use, and serial8250_pm() tries to call it after the port
    specific driver is gone:
    
    serial8250_pm [8250_base] from uart_change_pm+0x54/0x8c [serial_base]
    uart_change_pm [serial_base] from uart_hangup+0x154/0x198 [serial_base]
    uart_hangup [serial_base] from __tty_hangup.part.0+0x328/0x37c
    __tty_hangup.part.0 from disassociate_ctty+0x154/0x20c
    disassociate_ctty from do_exit+0x744/0xaac
    do_exit from do_group_exit+0x40/0x8c
    do_group_exit from __wake_up_parent+0x0/0x1c
    
    Let's fix the issue by calling serial8250_set_defaults() in
    serial8250_unregister_port(). This will set the port back to using
    the serial8250 default functions, and sets the port->pm to point to
    serial8250_pm.
    
    Signed-off-by: Tony Lindgren <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

serial: Add support for Advantech PCI-1611U card [+ + +]
Author: Vitaliy Tomin <[email protected]>
Date:   Sun Apr 23 11:45:12 2023 +0800

    serial: Add support for Advantech PCI-1611U card
    
    commit d2b00516de0e1d696724247098f6733a6ea53908 upstream.
    
    Add support for Advantech PCI-1611U card
    
    Advantech provides opensource drivers for this and many others card
    based on legacy copy of 8250_pci driver called adv950
    
    https://www.advantech.com/emt/support/details/driver?id=1-TDOIMJ
    
    It is hard to maintain to run as out of tree module on newer kernels.
    Just adding PCI ID to kernel 8250_pci works perfect.
    
    Signed-off-by: Vitaliy Tomin <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
spi: fsl-cpm: Use 16 bit mode for large transfers with even size [+ + +]
Author: Christophe Leroy <[email protected]>
Date:   Mon May 15 16:07:15 2023 +0200

    spi: fsl-cpm: Use 16 bit mode for large transfers with even size
    
    (cherry picked from upstream fc96ec826bced75cc6b9c07a4ac44bbf651337ab)
    
    On CPM, the RISC core is a lot more efficiant when doing transfers
    in 16-bits chunks than in 8-bits chunks, but unfortunately the
    words need to be byte swapped as seen in a previous commit.
    
    So, for large tranfers with an even size, allocate a temporary tx
    buffer and byte-swap data before and after transfer.
    
    This change allows setting higher speed for transfer. For instance
    on an MPC 8xx (CPM1 comms RISC processor), the documentation tells
    that transfer in byte mode at 1 kbit/s uses 0.200% of CPM load
    at 25 MHz while a word transfer at the same speed uses 0.032%
    of CPM load. This means the speed can be 6 times higher in
    word mode for the same CPM load.
    
    For the time being, only do it on CPM1 as there must be a
    trade-off between the CPM load reduction and the CPU load required
    to byte swap the data.
    
    Signed-off-by: Christophe Leroy <[email protected]>
    Link: https://lore.kernel.org/r/f2e981f20f92dd28983c3949702a09248c23845c.1680371809.git.christophe.leroy@csgroup.eu
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

spi: fsl-spi: Re-organise transfer bits_per_word adaptation [+ + +]
Author: Christophe Leroy <[email protected]>
Date:   Mon May 15 16:07:14 2023 +0200

    spi: fsl-spi: Re-organise transfer bits_per_word adaptation
    
    (backported from upstream 8a5299a1278eadf1e08a598a5345c376206f171e)
    
    For different reasons, fsl-spi driver performs bits_per_word
    modifications for different reasons:
    - On CPU mode, to minimise amount of interrupts
    - On CPM/QE mode to work around controller byte order
    
    For CPU mode that's done in fsl_spi_prepare_message() while
    for CPM mode that's done in fsl_spi_setup_transfer().
    
    Reunify all of it in fsl_spi_prepare_message(), and catch
    impossible cases early through master's bits_per_word_mask
    instead of returning EINVAL later.
    
    Signed-off-by: Christophe Leroy <[email protected]>
    Link: https://lore.kernel.org/r/0ce96fe96e8b07cba0613e4097cfd94d09b8919a.1680371809.git.christophe.leroy@csgroup.eu
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

spi: spi-fsl-spi: automatically adapt bits-per-word in cpu mode [+ + +]
Author: Rasmus Villemoes <[email protected]>
Date:   Mon May 15 16:07:13 2023 +0200

    spi: spi-fsl-spi: automatically adapt bits-per-word in cpu mode
    
    (cherry picked from upstream af0e6242909c3c4297392ca3e94eff1b4db71a97)
    
    Taking one interrupt for every byte is rather slow. Since the
    controller is perfectly capable of transmitting 32 bits at a time,
    change t->bits_per-word to 32 when the length is divisible by 4 and
    large enough that the reduced number of interrupts easily compensates
    for the one or two extra fsl_spi_setup_transfer() calls this causes.
    
    Signed-off-by: Rasmus Villemoes <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Christophe Leroy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3 [+ + +]
Author: Kevin Groeneveld <[email protected]>
Date:   Sat Mar 18 18:21:32 2023 -0400

    spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3
    
    [ Upstream commit 87c614175bbf28d3fd076dc2d166bac759e41427 ]
    
    When using gpio based chip select the cs value can go outside the range
    0 – 3. The various MX51_ECSPI_* macros did not take this into consideration
    resulting in possible corruption of the configuration.
    
    For example for any cs value over 3 the SCLKPHA bits would not be set and
    other values in the register possibly corrupted.
    
    One way to fix this is to just mask the cs bits to 2 bits. This still
    allows all 4 native chip selects to work as well as gpio chip selects
    (which can use any of the 4 chip select configurations).
    
    Signed-off-by: Kevin Groeneveld <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE [+ + +]
Author: Philipp Hortmann <[email protected]>
Date:   Thu Feb 23 07:47:21 2023 +0100

    staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE
    
    [ Upstream commit fda2093860df4812d69052a8cf4997e53853a340 ]
    
    Replace macro RTL_PCI_DEVICE with PCI_DEVICE to get rid of rtl819xp_ops
    which is empty.
    
    Signed-off-by: Philipp Hortmann <[email protected]>
    Link: https://lore.kernel.org/r/8b45ee783fa91196b7c9d6fc840a189496afd2f4.1677133271.git.philipp.g.hortmann@gmail.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
statfs: enforce statfs[64] structure initialization [+ + +]
Author: Ilya Leoshkevich <[email protected]>
Date:   Thu May 4 16:40:20 2023 +0200

    statfs: enforce statfs[64] structure initialization
    
    commit ed40866ec7d328b3dfb70db7e2011640a16202c3 upstream.
    
    s390's struct statfs and struct statfs64 contain padding, which
    field-by-field copying does not set. Initialize the respective structs
    with zeros before filling them and copying them to userspace, like it's
    already done for the compat versions of these structs.
    
    Found by KMSAN.
    
    [[email protected]: fixed typo in patch description]
    Acked-by: Heiko Carstens <[email protected]>
    Cc: [email protected] # v4.14+
    Signed-off-by: Ilya Leoshkevich <[email protected]>
    Reviewed-by: Andrew Morton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexander Gordeev <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb-storage: fix deadlock when a scsi command timeouts more than once [+ + +]
Author: Maxime Bizon <[email protected]>
Date:   Fri May 5 13:47:59 2023 +0200

    usb-storage: fix deadlock when a scsi command timeouts more than once
    
    commit a398d5eac6984316e71474e25b975688f282379b upstream.
    
    With faulty usb-storage devices, read/write can timeout, in that case
    the SCSI layer will abort and re-issue the command. USB storage has no
    internal timeout, it relies on SCSI layer aborting commands via
    .eh_abort_handler() for non those responsive devices.
    
    After two consecutive timeouts of the same command, SCSI layer calls
    .eh_device_reset_handler(), without calling .eh_abort_handler() first.
    
    With usb-storage, this causes a deadlock:
    
      -> .eh_device_reset_handler
        -> device_reset
          -> mutex_lock(&(us->dev_mutex));
    
    mutex already by usb_stor_control_thread(), which is waiting for
    command completion:
    
      -> usb_stor_control_thread (mutex taken here)
        -> usb_stor_invoke_transport
          -> usb_stor_Bulk_transport
            -> usb_stor_bulk_srb
              -> usb_stor_bulk_transfer_sglist
                -> usb_sg_wait
    
    Make sure we cancel any pending command in .eh_device_reset_handler()
    to avoid this.
    
    Signed-off-by: Maxime Bizon <[email protected]>
    Cc: [email protected]
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/all/ZEllnjMKT8ulZbJh@sakura/
    Reviewed-by: Alan Stern <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
USB: core: Add routines for endpoint checks in old drivers [+ + +]
Author: Alan Stern <[email protected]>
Date:   Mon Apr 10 15:37:07 2023 -0400

    USB: core: Add routines for endpoint checks in old drivers
    
    commit 13890626501ffda22b18213ddaf7930473da5792 upstream.
    
    Many of the older USB drivers in the Linux USB stack were written
    based simply on a vendor's device specification.  They use the
    endpoint information in the spec and assume these endpoints will
    always be present, with the properties listed, in any device matching
    the given vendor and product IDs.
    
    While that may have been true back then, with spoofing and fuzzing it
    is not true any more.  More and more we are finding that those old
    drivers need to perform at least a minimum of checking before they try
    to use any endpoint other than ep0.
    
    To make this checking as simple as possible, we now add a couple of
    utility routines to the USB core.  usb_check_bulk_endpoints() and
    usb_check_int_endpoints() take an interface pointer together with a
    list of endpoint addresses (numbers and directions).  They check that
    the interface's current alternate setting includes endpoints with
    those addresses and that each of these endpoints has the right type:
    bulk or interrupt, respectively.
    
    Although we already have usb_find_common_endpoints() and related
    routines meant for a similar purpose, they are not well suited for
    this kind of checking.  Those routines find endpoints of various
    kinds, but only one (either the first or the last) of each kind, and
    they don't verify that the endpoints' addresses agree with what the
    caller expects.
    
    In theory the new routines could be more general: They could take a
    particular altsetting as their argument instead of always using the
    interface's current altsetting.  In practice I think this won't matter
    too much; multiple altsettings tend to be used for transferring media
    (audio or visual) over isochronous endpoints, not bulk or interrupt.
    Drivers for such devices will generally require more sophisticated
    checking than these simplistic routines provide.
    
    Signed-off-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: sisusbvga: Add endpoint checks [+ + +]
Author: Alan Stern <[email protected]>
Date:   Mon Apr 10 15:38:22 2023 -0400

    USB: sisusbvga: Add endpoint checks
    
    commit df05a9b05e466a46725564528b277d0c570d0104 upstream.
    
    The syzbot fuzzer was able to provoke a WARNING from the sisusbvga driver:
    
    ------------[ cut here ]------------
    usb 1-1: BOGUS urb xfer, pipe 3 != type 1
    WARNING: CPU: 1 PID: 26 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Modules linked in:
    CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.2.0-rc5-syzkaller-00199-g5af6ce704936 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
    Workqueue: usb_hub_wq hub_event
    RIP: 0010:usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504
    Code: 7c 24 18 e8 6c 50 80 fb 48 8b 7c 24 18 e8 62 1a 01 ff 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 60 b1 fa 8a e8 84 b0 be 03 <0f> 0b e9 58 f8 ff ff e8 3e 50 80 fb 48 81 c5 c0 05 00 00 e9 84 f7
    RSP: 0018:ffffc90000a1ed18 EFLAGS: 00010282
    RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
    RDX: ffff888012783a80 RSI: ffffffff816680ec RDI: fffff52000143d95
    RBP: ffff888079020000 R08: 0000000000000005 R09: 0000000000000000
    R10: 0000000080000000 R11: 0000000000000000 R12: 0000000000000003
    R13: ffff888017d33370 R14: 0000000000000003 R15: ffff888021213600
    FS:  0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005592753a60b0 CR3: 0000000022899000 CR4: 00000000003506e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     sisusb_bulkout_msg drivers/usb/misc/sisusbvga/sisusbvga.c:224 [inline]
     sisusb_send_bulk_msg.constprop.0+0x904/0x1230 drivers/usb/misc/sisusbvga/sisusbvga.c:379
     sisusb_send_bridge_packet drivers/usb/misc/sisusbvga/sisusbvga.c:567 [inline]
     sisusb_do_init_gfxdevice drivers/usb/misc/sisusbvga/sisusbvga.c:2077 [inline]
     sisusb_init_gfxdevice+0x87b/0x4000 drivers/usb/misc/sisusbvga/sisusbvga.c:2177
     sisusb_probe+0x9cd/0xbe2 drivers/usb/misc/sisusbvga/sisusbvga.c:2869
    ...
    
    The problem was caused by the fact that the driver does not check
    whether the endpoints it uses are actually present and have the
    appropriate types.  This can be fixed by adding a simple check of
    the endpoints.
    
    Link: https://syzkaller.appspot.com/bug?extid=23be03b56c5259385d79
    Reported-and-tested-by: [email protected]
    Signed-off-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Tue May 16 14:23:42 2023 +0000

    vlan: fix a potential uninit-value in vlan_dev_hard_start_xmit()
    
    [ Upstream commit dacab578c7c6cd06c50c89dfa36b0e0f10decd4e ]
    
    syzbot triggered the following splat [1], sending an empty message
    through pppoe_sendmsg().
    
    When VLAN_FLAG_REORDER_HDR flag is set, vlan_dev_hard_header()
    does not push extra bytes for the VLAN header, because vlan is offloaded.
    
    Unfortunately vlan_dev_hard_start_xmit() first reads veth->h_vlan_proto
    before testing (vlan->flags & VLAN_FLAG_REORDER_HDR).
    
    We need to swap the two conditions.
    
    [1]
    BUG: KMSAN: uninit-value in vlan_dev_hard_start_xmit+0x171/0x7f0 net/8021q/vlan_dev.c:111
    vlan_dev_hard_start_xmit+0x171/0x7f0 net/8021q/vlan_dev.c:111
    __netdev_start_xmit include/linux/netdevice.h:4883 [inline]
    netdev_start_xmit include/linux/netdevice.h:4897 [inline]
    xmit_one net/core/dev.c:3580 [inline]
    dev_hard_start_xmit+0x253/0xa20 net/core/dev.c:3596
    __dev_queue_xmit+0x3c7f/0x5ac0 net/core/dev.c:4246
    dev_queue_xmit include/linux/netdevice.h:3053 [inline]
    pppoe_sendmsg+0xa93/0xb80 drivers/net/ppp/pppoe.c:900
    sock_sendmsg_nosec net/socket.c:724 [inline]
    sock_sendmsg net/socket.c:747 [inline]
    ____sys_sendmsg+0xa24/0xe40 net/socket.c:2501
    ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2555
    __sys_sendmmsg+0x411/0xa50 net/socket.c:2641
    __do_sys_sendmmsg net/socket.c:2670 [inline]
    __se_sys_sendmmsg net/socket.c:2667 [inline]
    __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2667
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    Uninit was created at:
    slab_post_alloc_hook+0x12d/0xb60 mm/slab.h:774
    slab_alloc_node mm/slub.c:3452 [inline]
    kmem_cache_alloc_node+0x543/0xab0 mm/slub.c:3497
    kmalloc_reserve+0x148/0x470 net/core/skbuff.c:520
    __alloc_skb+0x3a7/0x850 net/core/skbuff.c:606
    alloc_skb include/linux/skbuff.h:1277 [inline]
    sock_wmalloc+0xfe/0x1a0 net/core/sock.c:2583
    pppoe_sendmsg+0x3af/0xb80 drivers/net/ppp/pppoe.c:867
    sock_sendmsg_nosec net/socket.c:724 [inline]
    sock_sendmsg net/socket.c:747 [inline]
    ____sys_sendmsg+0xa24/0xe40 net/socket.c:2501
    ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2555
    __sys_sendmmsg+0x411/0xa50 net/socket.c:2641
    __do_sys_sendmmsg net/socket.c:2670 [inline]
    __se_sys_sendmmsg net/socket.c:2667 [inline]
    __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2667
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    
    CPU: 0 PID: 29770 Comm: syz-executor.0 Not tainted 6.3.0-rc6-syzkaller-gc478e5b17829 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
vsock: avoid to close connected socket after the timeout [+ + +]
Author: Zhuang Shengen <[email protected]>
Date:   Thu May 11 19:34:30 2023 +0800

    vsock: avoid to close connected socket after the timeout
    
    [ Upstream commit 6d4486efe9c69626cab423456169e250a5cd3af5 ]
    
    When client and server establish a connection through vsock,
    the client send a request to the server to initiate the connection,
    then start a timer to wait for the server's response. When the server's
    RESPONSE message arrives, the timer also times out and exits. The
    server's RESPONSE message is processed first, and the connection is
    established. However, the client's timer also times out, the original
    processing logic of the client is to directly set the state of this vsock
    to CLOSE and return ETIMEDOUT. It will not notify the server when the port
    is released, causing the server port remain.
    when client's vsock_connect timeout,it should check sk state is
    ESTABLISHED or not. if sk state is ESTABLISHED, it means the connection
    is established, the client should not set the sk state to CLOSE
    
    Note: I encountered this issue on kernel-4.18, which can be fixed by
    this patch. Then I checked the latest code in the community
    and found similar issue.
    
    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Signed-off-by: Zhuang Shengen <[email protected]>
    Reviewed-by: Stefano Garzarella <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex [+ + +]
Author: Hector Martin <[email protected]>
Date:   Tue Feb 14 18:24:19 2023 +0900

    wifi: brcmfmac: cfg80211: Pass the PMK in binary instead of hex
    
    [ Upstream commit 89b89e52153fda2733562776c7c9d9d3ebf8dd6d ]
    
    Apparently the hex passphrase mechanism does not work on newer
    chips/firmware (e.g. BCM4387). It seems there was a simple way of
    passing it in binary all along, so use that and avoid the hexification.
    
    OpenBSD has been doing it like this from the beginning, so this should
    work on all chips.
    
    Also clear the structure before setting the PMK. This was leaking
    uninitialized stack contents to the device.
    
    Reviewed-by: Linus Walleij <[email protected]>
    Reviewed-by: Arend van Spriel <[email protected]>
    Signed-off-by: Hector Martin <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Tue Apr 18 15:25:46 2023 +0200

    wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
    
    [ Upstream commit ef16799640865f937719f0771c93be5dca18adc6 ]
    
    A received TKIP key may be up to 32 bytes because it may contain
    MIC rx/tx keys too. These are not used by iwl and copying these
    over overflows the iwl_keyinfo.key field.
    
    Add a check to not copy more data to iwl_keyinfo.key then will fit.
    
    This fixes backtraces like this one:
    
     memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
     WARNING: CPU: 1 PID: 946 at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 iwlagn_send_sta_key+0x375/0x390 [iwldvm]
     <snip>
     Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A21 05/08/2017
     RIP: 0010:iwlagn_send_sta_key+0x375/0x390 [iwldvm]
     <snip>
     Call Trace:
      <TASK>
      iwl_set_dynamic_key+0x1f0/0x220 [iwldvm]
      iwlagn_mac_set_key+0x1e4/0x280 [iwldvm]
      drv_set_key+0xa4/0x1b0 [mac80211]
      ieee80211_key_enable_hw_accel+0xa8/0x2d0 [mac80211]
      ieee80211_key_replace+0x22d/0x8e0 [mac80211]
     <snip>
    
    Link: https://www.alionet.org/index.php?topic=1469.0
    Link: https://lore.kernel.org/linux-wireless/[email protected]/
    Link: https://lore.kernel.org/linux-wireless/[email protected]/
    Cc: Kees Cook <[email protected]>
    Suggested-by: Johannes Berg <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/mm: Avoid incomplete Global INVLPG flushes [+ + +]
Author: Dave Hansen <[email protected]>
Date:   Tue May 16 12:24:25 2023 -0700

    x86/mm: Avoid incomplete Global INVLPG flushes
    
    commit ce0b15d11ad837fbacc5356941712218e38a0a83 upstream.
    
    The INVLPG instruction is used to invalidate TLB entries for a
    specified virtual address.  When PCIDs are enabled, INVLPG is supposed
    to invalidate TLB entries for the specified address for both the
    current PCID *and* Global entries.  (Note: Only kernel mappings set
    Global=1.)
    
    Unfortunately, some INVLPG implementations can leave Global
    translations unflushed when PCIDs are enabled.
    
    As a workaround, never enable PCIDs on affected processors.
    
    I expect there to eventually be microcode mitigations to replace this
    software workaround.  However, the exact version numbers where that
    will happen are not known today.  Once the version numbers are set in
    stone, the processor list can be tweaked to only disable PCIDs on
    affected processors with affected microcode.
    
    Note: if anyone wants a quick fix that doesn't require patching, just
    stick 'nopcid' on your kernel command-line.
    
    Signed-off-by: Dave Hansen <[email protected]>
    Reviewed-by: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Signed-off-by: Daniel Sneddon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/show_trace_log_lvl: Ensure stack pointer is aligned, again [+ + +]
Author: Vernon Lovejoy <[email protected]>
Date:   Fri May 12 12:42:32 2023 +0200

    x86/show_trace_log_lvl: Ensure stack pointer is aligned, again
    
    commit 2e4be0d011f21593c6b316806779ba1eba2cd7e0 upstream.
    
    The commit e335bb51cc15 ("x86/unwind: Ensure stack pointer is aligned")
    tried to align the stack pointer in show_trace_log_lvl(), otherwise the
    "stack < stack_info.end" check can't guarantee that the last read does
    not go past the end of the stack.
    
    However, we have the same problem with the initial value of the stack
    pointer, it can also be unaligned. So without this patch this trivial
    kernel module
    
            #include <linux/module.h>
    
            static int init(void)
            {
                    asm volatile("sub    $0x4,%rsp");
                    dump_stack();
                    asm volatile("add    $0x4,%rsp");
    
                    return -EAGAIN;
            }
    
            module_init(init);
            MODULE_LICENSE("GPL");
    
    crashes the kernel.
    
    Fixes: e335bb51cc15 ("x86/unwind: Ensure stack pointer is aligned")
    Signed-off-by: Vernon Lovejoy <[email protected]>
    Signed-off-by: Oleg Nesterov <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xen/pvcalls-back: fix double frees with pvcalls_new_active_socket() [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Wed May 3 18:11:35 2023 +0300

    xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()
    
    commit 8fafac202d18230bb9926bda48e563fd2cce2a4f upstream.
    
    In the pvcalls_new_active_socket() function, most error paths call
    pvcalls_back_release_active(fedata->dev, fedata, map) which calls
    sock_release() on "sock".  The bug is that the caller also frees sock.
    
    Fix this by making every error path in pvcalls_new_active_socket()
    release the sock, and don't free it in the caller.
    
    Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command")
    Signed-off-by: Dan Carpenter <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Juergen Gross <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>