From 0638f37fee3c8c9f841a5fa3f11c8c23b14173ed Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 14 Dec 2023 07:39:50 -0500 Subject: [PATCH] Fixes for 5.15 Signed-off-by: Sasha Levin --- .../add-dmi-id-for-msi-bravo-15-b7ed.patch | 39 +++ ...t-underflow-from-error-handling-race.patch | 146 ++++++++++ ...amd-add-yc-machine-driver-using-dmic.patch | 224 +++++++++++++++ ...-alienware-m17-r5-amd-into-dmi-table.patch | 45 +++ ...d-yc-add-asus-m3402ra-into-dmi-table.patch | 43 +++ ...d-yc-add-asus-m5402ra-into-dmi-table.patch | 44 +++ ...vivobook-pro-15-to-quirks-list-for-a.patch | 42 +++ ...x-non-functional-mic-on-asus-e1504fa.patch | 46 ++++ ...ict-detection-of-patched-firmware-on.patch | 47 ++++ ...s_getattr_nosec-to-get-the-i_version.patch | 100 +++++++ .../ksmbd-fix-memory-leak-in-smb2_lock.patch | 41 +++ ...o-specify-flags-with-memblock_add_no.patch | 260 ++++++++++++++++++ ...handle-more-memory-types-passed-from.patch | 115 ++++++++ ...g-handle-memblock_add_node-failures-.patch | 92 +++++++ ...les-fix-exist-matching-on-bigendian-.patch | 85 ++++++ ...b-device-driver-for-config-selection.patch | 240 ++++++++++++++++ ...or-device-id-pair-for-asus-usb-c2500.patch | 50 ++++ ...r-device-id-pair-for-d-link-dub-e250.patch | 51 ++++ queue-5.15/series | 19 ++ ...i_version-handling-into-struct-kstat.patch | 112 ++++++++ 20 files changed, 1841 insertions(+) create mode 100644 queue-5.15/add-dmi-id-for-msi-bravo-15-b7ed.patch create mode 100644 queue-5.15/afs-fix-refcount-underflow-from-error-handling-race.patch create mode 100644 queue-5.15/asoc-amd-add-yc-machine-driver-using-dmic.patch create mode 100644 queue-5.15/asoc-amd-yc-add-alienware-m17-r5-amd-into-dmi-table.patch create mode 100644 queue-5.15/asoc-amd-yc-add-asus-m3402ra-into-dmi-table.patch create mode 100644 queue-5.15/asoc-amd-yc-add-asus-m5402ra-into-dmi-table.patch create mode 100644 queue-5.15/asoc-amd-yc-add-vivobook-pro-15-to-quirks-list-for-a.patch create mode 100644 queue-5.15/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch create mode 100644 queue-5.15/hid-lenovo-restrict-detection-of-patched-firmware-on.patch create mode 100644 queue-5.15/ima-use-vfs_getattr_nosec-to-get-the-i_version.patch create mode 100644 queue-5.15/ksmbd-fix-memory-leak-in-smb2_lock.patch create mode 100644 queue-5.15/memblock-allow-to-specify-flags-with-memblock_add_no.patch create mode 100644 queue-5.15/mips-loongson64-handle-more-memory-types-passed-from.patch create mode 100644 queue-5.15/mm-memory_hotplug-handle-memblock_add_node-failures-.patch create mode 100644 queue-5.15/netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch create mode 100644 queue-5.15/r8152-add-usb-device-driver-for-config-selection.patch create mode 100644 queue-5.15/r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch create mode 100644 queue-5.15/r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch create mode 100644 queue-5.15/series create mode 100644 queue-5.15/vfs-plumb-i_version-handling-into-struct-kstat.patch diff --git a/queue-5.15/add-dmi-id-for-msi-bravo-15-b7ed.patch b/queue-5.15/add-dmi-id-for-msi-bravo-15-b7ed.patch new file mode 100644 index 00000000000..105b019cc1a --- /dev/null +++ b/queue-5.15/add-dmi-id-for-msi-bravo-15-b7ed.patch @@ -0,0 +1,39 @@ +From 923e6733ba0c68c46050f934983b5573a11a3915 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 10 Sep 2023 13:54:34 -0500 +Subject: Add DMI ID for MSI Bravo 15 B7ED + +From: Walt Holman + +[ Upstream commit e616a916fe8431ebd5eb3cf4ac224d143c57083c ] + +Signed-off-by: Walt Holman +Link: https://lore.kernel.org/r/20230910185433.13677-1-waltholman09@gmail.com +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index ef07c729174d0..7e102bd443c0c 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -173,6 +173,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "M6500RC"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 B7ED"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +-- +2.43.0 + diff --git a/queue-5.15/afs-fix-refcount-underflow-from-error-handling-race.patch b/queue-5.15/afs-fix-refcount-underflow-from-error-handling-race.patch new file mode 100644 index 00000000000..6a28be3e22f --- /dev/null +++ b/queue-5.15/afs-fix-refcount-underflow-from-error-handling-race.patch @@ -0,0 +1,146 @@ +From 817f32649498d383706758955d1a9bf6418e4a7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 21:43:52 +0000 +Subject: afs: Fix refcount underflow from error handling race + +From: David Howells + +[ Upstream commit 52bf9f6c09fca8c74388cd41cc24e5d1bff812a9 ] + +If an AFS cell that has an unreachable (eg. ENETUNREACH) server listed (VL +server or fileserver), an asynchronous probe to one of its addresses may +fail immediately because sendmsg() returns an error. When this happens, a +refcount underflow can happen if certain events hit a very small window. + +The way this occurs is: + + (1) There are two levels of "call" object, the afs_call and the + rxrpc_call. Each of them can be transitioned to a "completed" state + in the event of success or failure. + + (2) Asynchronous afs_calls are self-referential whilst they are active to + prevent them from evaporating when they're not being processed. This + reference is disposed of when the afs_call is completed. + + Note that an afs_call may only be completed once; once completed + completing it again will do nothing. + + (3) When a call transmission is made, the app-side rxrpc code queues a Tx + buffer for the rxrpc I/O thread to transmit. The I/O thread invokes + sendmsg() to transmit it - and in the case of failure, it transitions + the rxrpc_call to the completed state. + + (4) When an rxrpc_call is completed, the app layer is notified. In this + case, the app is kafs and it schedules a work item to process events + pertaining to an afs_call. + + (5) When the afs_call event processor is run, it goes down through the + RPC-specific handler to afs_extract_data() to retrieve data from rxrpc + - and, in this case, it picks up the error from the rxrpc_call and + returns it. + + The error is then propagated to the afs_call and that is completed + too. At this point the self-reference is released. + + (6) If the rxrpc I/O thread manages to complete the rxrpc_call within the + window between rxrpc_send_data() queuing the request packet and + checking for call completion on the way out, then + rxrpc_kernel_send_data() will return the error from sendmsg() to the + app. + + (7) Then afs_make_call() will see an error and will jump to the error + handling path which will attempt to clean up the afs_call. + + (8) The problem comes when the error handling path in afs_make_call() + tries to unconditionally drop an async afs_call's self-reference. + This self-reference, however, may already have been dropped by + afs_extract_data() completing the afs_call + + (9) The refcount underflows when we return to afs_do_probe_vlserver() and + that tries to drop its reference on the afs_call. + +Fix this by making afs_make_call() attempt to complete the afs_call rather +than unconditionally putting it. That way, if afs_extract_data() manages +to complete the call first, afs_make_call() won't do anything. + +The bug can be forced by making do_udp_sendmsg() return -ENETUNREACH and +sticking an msleep() in rxrpc_send_data() after the 'success:' label to +widen the race window. + +The error message looks something like: + + refcount_t: underflow; use-after-free. + WARNING: CPU: 3 PID: 720 at lib/refcount.c:28 refcount_warn_saturate+0xba/0x110 + ... + RIP: 0010:refcount_warn_saturate+0xba/0x110 + ... + afs_put_call+0x1dc/0x1f0 [kafs] + afs_fs_get_capabilities+0x8b/0xe0 [kafs] + afs_fs_probe_fileserver+0x188/0x1e0 [kafs] + afs_lookup_server+0x3bf/0x3f0 [kafs] + afs_alloc_server_list+0x130/0x2e0 [kafs] + afs_create_volume+0x162/0x400 [kafs] + afs_get_tree+0x266/0x410 [kafs] + vfs_get_tree+0x25/0xc0 + fc_mount+0xe/0x40 + afs_d_automount+0x1b3/0x390 [kafs] + __traverse_mounts+0x8f/0x210 + step_into+0x340/0x760 + path_openat+0x13a/0x1260 + do_filp_open+0xaf/0x160 + do_sys_openat2+0xaf/0x170 + +or something like: + + refcount_t: underflow; use-after-free. + ... + RIP: 0010:refcount_warn_saturate+0x99/0xda + ... + afs_put_call+0x4a/0x175 + afs_send_vl_probes+0x108/0x172 + afs_select_vlserver+0xd6/0x311 + afs_do_cell_detect_alias+0x5e/0x1e9 + afs_cell_detect_alias+0x44/0x92 + afs_validate_fc+0x9d/0x134 + afs_get_tree+0x20/0x2e6 + vfs_get_tree+0x1d/0xc9 + fc_mount+0xe/0x33 + afs_d_automount+0x48/0x9d + __traverse_mounts+0xe0/0x166 + step_into+0x140/0x274 + open_last_lookups+0x1c1/0x1df + path_openat+0x138/0x1c3 + do_filp_open+0x55/0xb4 + do_sys_openat2+0x6c/0xb6 + +Fixes: 34fa47612bfe ("afs: Fix race in async call refcounting") +Reported-by: Bill MacAllister +Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052304 +Suggested-by: Jeffrey E Altman +Signed-off-by: David Howells +Reviewed-by: Jeffrey Altman +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/2633992.1702073229@warthog.procyon.org.uk/ # v1 +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + fs/afs/rxrpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c +index e3de7fea36435..f7305f2791fef 100644 +--- a/fs/afs/rxrpc.c ++++ b/fs/afs/rxrpc.c +@@ -420,7 +420,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + if (call->async) { + if (cancel_work_sync(&call->async_work)) + afs_put_call(call); +- afs_put_call(call); ++ afs_set_call_complete(call, ret, 0); + } + + ac->error = ret; +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-add-yc-machine-driver-using-dmic.patch b/queue-5.15/asoc-amd-add-yc-machine-driver-using-dmic.patch new file mode 100644 index 00000000000..3ec25392c46 --- /dev/null +++ b/queue-5.15/asoc-amd-add-yc-machine-driver-using-dmic.patch @@ -0,0 +1,224 @@ +From 3d2324a12a523b58e2d93b60818a7dfbd37ad7dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Oct 2021 16:50:43 +0530 +Subject: ASoC: amd: add YC machine driver using dmic + +From: Vijendar Mukunda + +[ Upstream commit fa991481b8b22a7797a828135ce62a73791bbe39 ] + +Add Yellow Carp platform machine driver using dmic. + +Signed-off-by: Vijendar Mukunda +Link: https://lore.kernel.org/r/20211018112044.1705805-13-Vijendar.Mukunda@amd.com +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 194 ++++++++++++++++++++++++++++++++++ + 1 file changed, 194 insertions(+) + create mode 100644 sound/soc/amd/yc/acp6x-mach.c + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +new file mode 100644 +index 0000000000000..9a767f47b89f1 +--- /dev/null ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -0,0 +1,194 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Machine driver for AMD Yellow Carp platform using DMIC ++ * ++ * Copyright 2021 Advanced Micro Devices, Inc. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "acp6x.h" ++ ++#define DRV_NAME "acp_yc_mach" ++ ++SND_SOC_DAILINK_DEF(acp6x_pdm, ++ DAILINK_COMP_ARRAY(COMP_CPU("acp_yc_pdm_dma.0"))); ++ ++SND_SOC_DAILINK_DEF(dmic_codec, ++ DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec.0", ++ "dmic-hifi"))); ++ ++SND_SOC_DAILINK_DEF(pdm_platform, ++ DAILINK_COMP_ARRAY(COMP_PLATFORM("acp_yc_pdm_dma.0"))); ++ ++static struct snd_soc_dai_link acp6x_dai_pdm[] = { ++ { ++ .name = "acp6x-dmic-capture", ++ .stream_name = "DMIC capture", ++ .capture_only = 1, ++ SND_SOC_DAILINK_REG(acp6x_pdm, dmic_codec, pdm_platform), ++ }, ++}; ++ ++static struct snd_soc_card acp6x_card = { ++ .name = "acp6x", ++ .owner = THIS_MODULE, ++ .dai_link = acp6x_dai_pdm, ++ .num_links = 1, ++}; ++ ++static const struct dmi_system_id yc_acp_quirk_table[] = { ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D2"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D3"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D4"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D5"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CF"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CG"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CQ"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CR"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21AW"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21AX"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21BN"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21BQ"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CH"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CJ"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CK"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D8"), ++ } ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), ++ } ++ }, ++ {} ++}; ++ ++static int acp6x_probe(struct platform_device *pdev) ++{ ++ struct acp6x_pdm *machine = NULL; ++ struct snd_soc_card *card; ++ int ret; ++ const struct dmi_system_id *dmi_id; ++ ++ dmi_id = dmi_first_match(yc_acp_quirk_table); ++ if (!dmi_id) ++ return -ENODEV; ++ card = &acp6x_card; ++ acp6x_card.dev = &pdev->dev; ++ ++ platform_set_drvdata(pdev, card); ++ snd_soc_card_set_drvdata(card, machine); ++ ret = devm_snd_soc_register_card(&pdev->dev, card); ++ if (ret) { ++ return dev_err_probe(&pdev->dev, ret, ++ "snd_soc_register_card(%s) failed\n", ++ card->name); ++ } ++ return 0; ++} ++ ++static struct platform_driver acp6x_mach_driver = { ++ .driver = { ++ .name = "acp_yc_mach", ++ .pm = &snd_soc_pm_ops, ++ }, ++ .probe = acp6x_probe, ++}; ++ ++module_platform_driver(acp6x_mach_driver); ++ ++MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:" DRV_NAME); +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-yc-add-alienware-m17-r5-amd-into-dmi-table.patch b/queue-5.15/asoc-amd-yc-add-alienware-m17-r5-amd-into-dmi-table.patch new file mode 100644 index 00000000000..eef07d5a320 --- /dev/null +++ b/queue-5.15/asoc-amd-yc-add-alienware-m17-r5-amd-into-dmi-table.patch @@ -0,0 +1,45 @@ +From 81fb4c42388b5db273a5e15c64af48a6cf542ece Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Oct 2022 18:42:27 +0100 +Subject: ASoC: amd: yc: Add Alienware m17 R5 AMD into DMI table + +From: Brent Mendelsohn + +[ Upstream commit d40b6529c6269cd5afddb1116a383cab9f126694 ] + +This model requires an additional detection quirk to enable the +internal microphone - BIOS doesn't seem to support AcpDmicConnected +(nothing in acpidump output). + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=216590 +Signed-off-by: Brent Mendelsohn +Reviewed-by: Mario Limonciello +Link: https://lore.kernel.org/r/20221024174227.4160-1-mendiebm@gmail.com +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index 9a767f47b89f1..d4f2f130fa5c2 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -152,6 +152,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "Alienware"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), ++ } ++ }, + {} + }; + +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-yc-add-asus-m3402ra-into-dmi-table.patch b/queue-5.15/asoc-amd-yc-add-asus-m3402ra-into-dmi-table.patch new file mode 100644 index 00000000000..678f25f3d5e --- /dev/null +++ b/queue-5.15/asoc-amd-yc-add-asus-m3402ra-into-dmi-table.patch @@ -0,0 +1,43 @@ +From 984d213fa8eab8cded29cb3539c79369e71bdf84 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Apr 2023 21:16:45 +0200 +Subject: ASoC: amd: yc: Add ASUS M3402RA into DMI table + +From: Enrico Belleri + +[ Upstream commit 110ccfa9dd6ca1272e50fbea614aa31f01d2c17e ] + +Fix builtin microphone on ASUS Vivobook S 14 OLED 2022 (M3402RA) + +Same issue with this model as apparently with other Rembrandt laptops: https://bugzilla.kernel.org/show_bug.cgi?id=216270 + +Signed-off-by: Enrico Belleri +Link: https://lore.kernel.org/r/20230427191645.24519-1-kilgore.trout@idesmi.eu +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index 387d228369d43..441b77d00f919 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -159,6 +159,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "M3402RA"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-yc-add-asus-m5402ra-into-dmi-table.patch b/queue-5.15/asoc-amd-yc-add-asus-m5402ra-into-dmi-table.patch new file mode 100644 index 00000000000..1f2f1ba8a50 --- /dev/null +++ b/queue-5.15/asoc-amd-yc-add-asus-m5402ra-into-dmi-table.patch @@ -0,0 +1,44 @@ +From 29b6432b94af560ad306cc18b46a02ec2fadd957 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Dec 2022 23:49:32 +0100 +Subject: ASoC: amd: yc: Add ASUS M5402RA into DMI table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Aniol Martí + +[ Upstream commit a0dd7fcab5cd221fa960f594c586e1f9f16c02c0 ] + +ASUS VivoBook 13 OLED (M5402RA) needs this quirk to get the built-in microphone working properly. + +Signed-off-by: Aniol Martí +Link: https://lore.kernel.org/r/20221227224932.9771-1-aniol@aniolmarti.cat +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index d4f2f130fa5c2..387d228369d43 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -152,6 +152,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-yc-add-vivobook-pro-15-to-quirks-list-for-a.patch b/queue-5.15/asoc-amd-yc-add-vivobook-pro-15-to-quirks-list-for-a.patch new file mode 100644 index 00000000000..90458613cc3 --- /dev/null +++ b/queue-5.15/asoc-amd-yc-add-vivobook-pro-15-to-quirks-list-for-a.patch @@ -0,0 +1,42 @@ +From 9a6e635caa4b3c2c87d2f1fbb79c61284cbad0f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Aug 2023 18:14:16 -0300 +Subject: ASoC: amd: yc: Add VivoBook Pro 15 to quirks list for acp6x + +From: BrenoRCBrito + +[ Upstream commit 3b1f08833c45d0167741e4097b0150e7cf086102 ] + +VivoBook Pro 15 Ryzen Edition uses Ryzen 6800H processor, and adding to + quirks list for acp6x will enable internal mic. + +Signed-off-by: BrenoRCBrito +Link: https://lore.kernel.org/r/20230818211417.32167-1-brenorcbrito@gmail.com +Signed-off-by: Mark Brown +Stable-dep-of: b24e3590c94a ("ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA") +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index 441b77d00f919..ef07c729174d0 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -166,6 +166,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "M3402RA"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "M6500RC"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +-- +2.43.0 + diff --git a/queue-5.15/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch b/queue-5.15/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch new file mode 100644 index 00000000000..8f2a5c658be --- /dev/null +++ b/queue-5.15/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch @@ -0,0 +1,46 @@ +From 6015931d641e62aff526e7315a36de012c651df7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Nov 2023 20:36:00 +0000 +Subject: ASoC: amd: yc: Fix non-functional mic on ASUS E1504FA + +From: Malcolm Hart + +[ Upstream commit b24e3590c94ab0aba6e455996b502a83baa5c31c ] + +This patch adds ASUSTeK COMPUTER INC "E1504FA" to the quirks file acp6x-mach.c +to enable microphone array on ASUS Vivobook GO 15. +I have this laptop and can confirm that the patch succeeds in enabling the +microphone array. + +Signed-off-by: Malcolm Hart +Cc: stable@vger.kernel.org +Rule: add +Link: https://lore.kernel.org/stable/875y1nt1bx.fsf%405harts.com +Link: https://lore.kernel.org/r/871qcbszh0.fsf@5harts.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c +index 7e102bd443c0c..b59d3a204c598 100644 +--- a/sound/soc/amd/yc/acp6x-mach.c ++++ b/sound/soc/amd/yc/acp6x-mach.c +@@ -173,6 +173,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "M6500RC"), + } + }, ++ { ++ .driver_data = &acp6x_card, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "E1504FA"), ++ } ++ }, + { + .driver_data = &acp6x_card, + .matches = { +-- +2.43.0 + diff --git a/queue-5.15/hid-lenovo-restrict-detection-of-patched-firmware-on.patch b/queue-5.15/hid-lenovo-restrict-detection-of-patched-firmware-on.patch new file mode 100644 index 00000000000..4cec282f2f0 --- /dev/null +++ b/queue-5.15/hid-lenovo-restrict-detection-of-patched-firmware-on.patch @@ -0,0 +1,47 @@ +From 23f45bd23d4b9e078ef08fe97bbb3d7236a3f31c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Dec 2023 15:31:48 +0200 +Subject: HID: lenovo: Restrict detection of patched firmware only to USB + cptkbd + +From: Mikhail Khvainitski + +[ Upstream commit 43527a0094c10dfbf0d5a2e7979395a38de3ff65 ] + +Commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and +stop applying workaround") introduced a regression for ThinkPad +TrackPoint Keyboard II which has similar quirks to cptkbd (so it uses +the same workarounds) but slightly different so that there are +false-positives during detecting well-behaving firmware. This commit +restricts detecting well-behaving firmware to the only model which +known to have one and have stable enough quirks to not cause +false-positives. + +Fixes: 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") +Link: https://lore.kernel.org/linux-input/ZXRiiPsBKNasioqH@jekhomev/ +Link: https://bbs.archlinux.org/viewtopic.php?pid=2135468#p2135468 +Signed-off-by: Mikhail Khvainitski +Tested-by: Yauhen Kharuzhy +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-lenovo.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c +index 901c1959efed4..965bddaa90aee 100644 +--- a/drivers/hid/hid-lenovo.c ++++ b/drivers/hid/hid-lenovo.c +@@ -540,7 +540,8 @@ static int lenovo_event_cptkbd(struct hid_device *hdev, + * so set middlebutton_state to 3 + * to never apply workaround anymore + */ +- if (cptkbd_data->middlebutton_state == 1 && ++ if (hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD && ++ cptkbd_data->middlebutton_state == 1 && + usage->type == EV_REL && + (usage->code == REL_X || usage->code == REL_Y)) { + cptkbd_data->middlebutton_state = 3; +-- +2.43.0 + diff --git a/queue-5.15/ima-use-vfs_getattr_nosec-to-get-the-i_version.patch b/queue-5.15/ima-use-vfs_getattr_nosec-to-get-the-i_version.patch new file mode 100644 index 00000000000..944e1c8414c --- /dev/null +++ b/queue-5.15/ima-use-vfs_getattr_nosec-to-get-the-i_version.patch @@ -0,0 +1,100 @@ +From 353023c6542fa48ee9c2dcc5b9a4c7627d9ab187 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Apr 2023 12:55:51 -0400 +Subject: IMA: use vfs_getattr_nosec to get the i_version + +From: Jeff Layton + +[ Upstream commit db1d1e8b9867aae5c3e61ad7859abfcc4a6fd6c7 ] + +IMA currently accesses the i_version out of the inode directly when it +does a measurement. This is fine for most simple filesystems, but can be +problematic with more complex setups (e.g. overlayfs). + +Make IMA instead call vfs_getattr_nosec to get this info. This allows +the filesystem to determine whether and how to report the i_version, and +should allow IMA to work properly with a broader class of filesystems in +the future. + +Reported-and-Tested-by: Stefan Berger +Reviewed-by: Christian Brauner +Signed-off-by: Jeff Layton +Signed-off-by: Mimi Zohar +Signed-off-by: Sasha Levin +--- + security/integrity/ima/ima_api.c | 9 ++++++--- + security/integrity/ima/ima_main.c | 12 ++++++++---- + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c +index 04b9e465463b6..f8e2a9e0c7e97 100644 +--- a/security/integrity/ima/ima_api.c ++++ b/security/integrity/ima/ima_api.c +@@ -13,7 +13,6 @@ + #include + #include + #include +-#include + + #include "ima.h" + +@@ -218,10 +217,11 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, + struct inode *inode = file_inode(file); + struct inode *real_inode = d_real_inode(file_dentry(file)); + const char *filename = file->f_path.dentry->d_name.name; ++ struct kstat stat; + int result = 0; + int length; + void *tmpbuf; +- u64 i_version; ++ u64 i_version = 0; + struct { + struct ima_digest_data hdr; + char digest[IMA_MAX_DIGEST_SIZE]; +@@ -243,7 +243,10 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, + * which do not support i_version, support is limited to an initial + * measurement/appraisal/audit. + */ +- i_version = inode_query_iversion(inode); ++ result = vfs_getattr_nosec(&file->f_path, &stat, STATX_CHANGE_COOKIE, ++ AT_STATX_SYNC_AS_STAT); ++ if (!result && (stat.result_mask & STATX_CHANGE_COOKIE)) ++ i_version = stat.change_cookie; + hash.hdr.algo = algo; + + /* Initialize hash digest to 0's in case of failure */ +diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c +index 7cd9df8499296..f64d86dfff36f 100644 +--- a/security/integrity/ima/ima_main.c ++++ b/security/integrity/ima/ima_main.c +@@ -24,7 +24,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -164,11 +163,16 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, + + mutex_lock(&iint->mutex); + if (atomic_read(&inode->i_writecount) == 1) { ++ struct kstat stat; ++ + update = test_and_clear_bit(IMA_UPDATE_XATTR, + &iint->atomic_flags); +- if (!IS_I_VERSION(inode) || +- !inode_eq_iversion(inode, iint->version) || +- (iint->flags & IMA_NEW_FILE)) { ++ if ((iint->flags & IMA_NEW_FILE) || ++ vfs_getattr_nosec(&file->f_path, &stat, ++ STATX_CHANGE_COOKIE, ++ AT_STATX_SYNC_AS_STAT) || ++ !(stat.result_mask & STATX_CHANGE_COOKIE) || ++ stat.change_cookie != iint->version) { + iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); + iint->measured_pcrs = 0; + if (update) +-- +2.43.0 + diff --git a/queue-5.15/ksmbd-fix-memory-leak-in-smb2_lock.patch b/queue-5.15/ksmbd-fix-memory-leak-in-smb2_lock.patch new file mode 100644 index 00000000000..8a74134425a --- /dev/null +++ b/queue-5.15/ksmbd-fix-memory-leak-in-smb2_lock.patch @@ -0,0 +1,41 @@ +From 1da10093512534035b89771a0d5a2a2edd325334 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Dec 2023 22:50:48 +0800 +Subject: ksmbd: fix memory leak in smb2_lock() + +From: Zizhi Wo + +[ Upstream commit 8f1752723019db900fb60a5b9d0dfd3a2bdea36c ] + +In smb2_lock(), if setup_async_work() executes successfully, +work->cancel_argv will bind the argv that generated by kmalloc(). And +release_async_work() is called in ksmbd_conn_try_dequeue_request() or +smb2_lock() to release argv. +However, when setup_async_work function fails, work->cancel_argv has not +been bound to the argv, resulting in the previously allocated argv not +being released. Call kfree() to fix it. + +Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") +Signed-off-by: Zizhi Wo +Acked-by: Namjae Jeon +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/ksmbd/smb2pdu.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c +index 656c627d1bdf7..a7973b7012e9b 100644 +--- a/fs/ksmbd/smb2pdu.c ++++ b/fs/ksmbd/smb2pdu.c +@@ -7068,6 +7068,7 @@ int smb2_lock(struct ksmbd_work *work) + smb2_remove_blocked_lock, + argv); + if (rc) { ++ kfree(argv); + err = -ENOMEM; + goto out; + } +-- +2.43.0 + diff --git a/queue-5.15/memblock-allow-to-specify-flags-with-memblock_add_no.patch b/queue-5.15/memblock-allow-to-specify-flags-with-memblock_add_no.patch new file mode 100644 index 00000000000..f1d4d407984 --- /dev/null +++ b/queue-5.15/memblock-allow-to-specify-flags-with-memblock_add_no.patch @@ -0,0 +1,260 @@ +From 9acd16712d95738c11f751a6ac5f10082b4c5a86 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Nov 2021 13:44:49 -0700 +Subject: memblock: allow to specify flags with memblock_add_node() + +From: David Hildenbrand + +[ Upstream commit 952eea9b01e4bbb7011329f1b7240844e61e5128 ] + +We want to specify flags when hotplugging memory. Let's prepare to pass +flags to memblock_add_node() by adjusting all existing users. + +Note that when hotplugging memory the system is already up and running +and we might have concurrent memblock users: for example, while we're +hotplugging memory, kexec_file code might search for suitable memory +regions to place kexec images. It's important to add the memory +directly to memblock via a single call with the right flags, instead of +adding the memory first and apply flags later: otherwise, concurrent +memblock users might temporarily stumble over memblocks with wrong +flags, which will be important in a follow-up patch that introduces a +new flag to properly handle add_memory_driver_managed(). + +Link: https://lkml.kernel.org/r/20211004093605.5830-4-david@redhat.com +Acked-by: Geert Uytterhoeven +Acked-by: Heiko Carstens +Signed-off-by: David Hildenbrand +Acked-by: Shahab Vahedi [arch/arc] +Reviewed-by: Mike Rapoport +Cc: "Aneesh Kumar K . V" +Cc: Arnd Bergmann +Cc: Christian Borntraeger +Cc: Eric Biederman +Cc: Huacai Chen +Cc: Jianyong Wu +Cc: Jiaxun Yang +Cc: Michal Hocko +Cc: Oscar Salvador +Cc: Thomas Bogendoerfer +Cc: Vasily Gorbik +Cc: Vineet Gupta +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Stable-dep-of: c7206e7bd214 ("MIPS: Loongson64: Handle more memory types passed from firmware") +Signed-off-by: Sasha Levin +--- + arch/arc/mm/init.c | 4 ++-- + arch/ia64/mm/contig.c | 2 +- + arch/ia64/mm/init.c | 2 +- + arch/m68k/mm/mcfmmu.c | 3 ++- + arch/m68k/mm/motorola.c | 6 ++++-- + arch/mips/loongson64/init.c | 4 +++- + arch/mips/sgi-ip27/ip27-memory.c | 3 ++- + arch/s390/kernel/setup.c | 3 ++- + include/linux/memblock.h | 3 ++- + include/linux/mm.h | 2 +- + mm/memblock.c | 9 +++++---- + mm/memory_hotplug.c | 2 +- + 12 files changed, 26 insertions(+), 17 deletions(-) + +diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c +index 699ecf1196414..110eb69e9bee8 100644 +--- a/arch/arc/mm/init.c ++++ b/arch/arc/mm/init.c +@@ -59,13 +59,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) + + low_mem_sz = size; + in_use = 1; +- memblock_add_node(base, size, 0); ++ memblock_add_node(base, size, 0, MEMBLOCK_NONE); + } else { + #ifdef CONFIG_HIGHMEM + high_mem_start = base; + high_mem_sz = size; + in_use = 1; +- memblock_add_node(base, size, 1); ++ memblock_add_node(base, size, 1, MEMBLOCK_NONE); + memblock_reserve(base, size); + #endif + } +diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c +index 9817caba07026..1e9eaa107eb73 100644 +--- a/arch/ia64/mm/contig.c ++++ b/arch/ia64/mm/contig.c +@@ -153,7 +153,7 @@ find_memory (void) + efi_memmap_walk(find_max_min_low_pfn, NULL); + max_pfn = max_low_pfn; + +- memblock_add_node(0, PFN_PHYS(max_low_pfn), 0); ++ memblock_add_node(0, PFN_PHYS(max_low_pfn), 0, MEMBLOCK_NONE); + + find_initrd(); + +diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c +index 5c6da8d83c1ad..5d165607bf354 100644 +--- a/arch/ia64/mm/init.c ++++ b/arch/ia64/mm/init.c +@@ -378,7 +378,7 @@ int __init register_active_ranges(u64 start, u64 len, int nid) + #endif + + if (start < end) +- memblock_add_node(__pa(start), end - start, nid); ++ memblock_add_node(__pa(start), end - start, nid, MEMBLOCK_NONE); + return 0; + } + +diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c +index eac9dde651934..6f1f251252944 100644 +--- a/arch/m68k/mm/mcfmmu.c ++++ b/arch/m68k/mm/mcfmmu.c +@@ -174,7 +174,8 @@ void __init cf_bootmem_alloc(void) + m68k_memory[0].addr = _rambase; + m68k_memory[0].size = _ramend - _rambase; + +- memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0); ++ memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0, ++ MEMBLOCK_NONE); + + /* compute total pages in system */ + num_pages = PFN_DOWN(_ramend - _rambase); +diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c +index 9f3f77785aa78..2b05bb2bac00d 100644 +--- a/arch/m68k/mm/motorola.c ++++ b/arch/m68k/mm/motorola.c +@@ -410,7 +410,8 @@ void __init paging_init(void) + + min_addr = m68k_memory[0].addr; + max_addr = min_addr + m68k_memory[0].size; +- memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0); ++ memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0, ++ MEMBLOCK_NONE); + for (i = 1; i < m68k_num_memory;) { + if (m68k_memory[i].addr < min_addr) { + printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n", +@@ -421,7 +422,8 @@ void __init paging_init(void) + (m68k_num_memory - i) * sizeof(struct m68k_mem_info)); + continue; + } +- memblock_add_node(m68k_memory[i].addr, m68k_memory[i].size, i); ++ memblock_add_node(m68k_memory[i].addr, m68k_memory[i].size, i, ++ MEMBLOCK_NONE); + addr = m68k_memory[i].addr + m68k_memory[i].size; + if (addr > max_addr) + max_addr = addr; +diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c +index c1498fdd5c79c..fc7a5c61d91d6 100644 +--- a/arch/mips/loongson64/init.c ++++ b/arch/mips/loongson64/init.c +@@ -77,7 +77,9 @@ void __init szmem(unsigned int node) + (u32)node_id, mem_type, mem_start, mem_size); + pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", + start_pfn, end_pfn, num_physpages); +- memblock_add_node(PFN_PHYS(start_pfn), PFN_PHYS(node_psize), node); ++ memblock_add_node(PFN_PHYS(start_pfn), ++ PFN_PHYS(node_psize), node, ++ MEMBLOCK_NONE); + break; + case SYSTEM_RAM_RESERVED: + pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", +diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c +index 6173684b5aaa0..adc2faeecf7c0 100644 +--- a/arch/mips/sgi-ip27/ip27-memory.c ++++ b/arch/mips/sgi-ip27/ip27-memory.c +@@ -341,7 +341,8 @@ static void __init szmem(void) + continue; + } + memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)), +- PFN_PHYS(slot_psize), node); ++ PFN_PHYS(slot_psize), node, ++ MEMBLOCK_NONE); + } + } + } +diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c +index 4dfe37b068898..b7ce6c7c84c6f 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -596,7 +596,8 @@ static void __init setup_resources(void) + * part of the System RAM resource. + */ + if (crashk_res.end) { +- memblock_add_node(crashk_res.start, resource_size(&crashk_res), 0); ++ memblock_add_node(crashk_res.start, resource_size(&crashk_res), ++ 0, MEMBLOCK_NONE); + memblock_reserve(crashk_res.start, resource_size(&crashk_res)); + insert_resource(&iomem_resource, &crashk_res); + } +diff --git a/include/linux/memblock.h b/include/linux/memblock.h +index 5df38332e4139..307cab05d67ec 100644 +--- a/include/linux/memblock.h ++++ b/include/linux/memblock.h +@@ -100,7 +100,8 @@ static inline void memblock_discard(void) {} + #endif + + void memblock_allow_resize(void); +-int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); ++int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid, ++ enum memblock_flags flags); + int memblock_add(phys_addr_t base, phys_addr_t size); + int memblock_remove(phys_addr_t base, phys_addr_t size); + int memblock_free(phys_addr_t base, phys_addr_t size); +diff --git a/include/linux/mm.h b/include/linux/mm.h +index a27a6b58d3740..5692055f202cb 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -2454,7 +2454,7 @@ static inline unsigned long get_num_physpages(void) + * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, + * max_highmem_pfn}; + * for_each_valid_physical_page_range() +- * memblock_add_node(base, size, nid) ++ * memblock_add_node(base, size, nid, MEMBLOCK_NONE) + * free_area_init(max_zone_pfns); + */ + void free_area_init(unsigned long *max_zone_pfn); +diff --git a/mm/memblock.c b/mm/memblock.c +index 2b7397781c99a..2f2094b16416e 100644 +--- a/mm/memblock.c ++++ b/mm/memblock.c +@@ -661,6 +661,7 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, + * @base: base address of the new region + * @size: size of the new region + * @nid: nid of the new region ++ * @flags: flags of the new region + * + * Add new memblock region [@base, @base + @size) to the "memory" + * type. See memblock_add_range() description for mode details +@@ -669,14 +670,14 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, + * 0 on success, -errno on failure. + */ + int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size, +- int nid) ++ int nid, enum memblock_flags flags) + { + phys_addr_t end = base + size - 1; + +- memblock_dbg("%s: [%pa-%pa] nid=%d %pS\n", __func__, +- &base, &end, nid, (void *)_RET_IP_); ++ memblock_dbg("%s: [%pa-%pa] nid=%d flags=%x %pS\n", __func__, ++ &base, &end, nid, flags, (void *)_RET_IP_); + +- return memblock_add_range(&memblock.memory, base, size, nid, 0); ++ return memblock_add_range(&memblock.memory, base, size, nid, flags); + } + + /** +diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c +index bc52a9d201ea6..2d8e9fb4ce0b2 100644 +--- a/mm/memory_hotplug.c ++++ b/mm/memory_hotplug.c +@@ -1385,7 +1385,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) + mem_hotplug_begin(); + + if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { +- ret = memblock_add_node(start, size, nid); ++ ret = memblock_add_node(start, size, nid, MEMBLOCK_NONE); + if (ret) + goto error_mem_hotplug_end; + } +-- +2.43.0 + diff --git a/queue-5.15/mips-loongson64-handle-more-memory-types-passed-from.patch b/queue-5.15/mips-loongson64-handle-more-memory-types-passed-from.patch new file mode 100644 index 00000000000..d5abdab4756 --- /dev/null +++ b/queue-5.15/mips-loongson64-handle-more-memory-types-passed-from.patch @@ -0,0 +1,115 @@ +From 1000f7d9c1ccb92e32c27ee86774299d53c7ec8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Nov 2023 11:15:20 +0000 +Subject: MIPS: Loongson64: Handle more memory types passed from firmware + +From: Jiaxun Yang + +[ Upstream commit c7206e7bd214ebb3ca6fa474a4423662327d9beb ] + +There are many types of revsered memory passed from firmware +that should be reserved in memblock, and UMA memory passed +from firmware that should be added to system memory for system +to use. + +Also for memblock there is no need to align those space into page, +which actually cause problems. + +Handle them properly to prevent memory corruption on some systems. + +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + .../include/asm/mach-loongson64/boot_param.h | 6 ++- + arch/mips/loongson64/init.c | 42 ++++++++++++------- + 2 files changed, 31 insertions(+), 17 deletions(-) + +diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h +index c454ef734c45c..e007edd6b60a7 100644 +--- a/arch/mips/include/asm/mach-loongson64/boot_param.h ++++ b/arch/mips/include/asm/mach-loongson64/boot_param.h +@@ -14,7 +14,11 @@ + #define ADAPTER_ROM 8 + #define ACPI_TABLE 9 + #define SMBIOS_TABLE 10 +-#define MAX_MEMORY_TYPE 11 ++#define UMA_VIDEO_RAM 11 ++#define VUMA_VIDEO_RAM 12 ++#define MAX_MEMORY_TYPE 13 ++ ++#define MEM_SIZE_IS_IN_BYTES (1 << 31) + + #define LOONGSON3_BOOT_MEM_MAP_MAX 128 + struct efi_memory_map_loongson { +diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c +index fc7a5c61d91d6..3d147de87d3f4 100644 +--- a/arch/mips/loongson64/init.c ++++ b/arch/mips/loongson64/init.c +@@ -49,8 +49,7 @@ void virtual_early_config(void) + void __init szmem(unsigned int node) + { + u32 i, mem_type; +- static unsigned long num_physpages; +- u64 node_id, node_psize, start_pfn, end_pfn, mem_start, mem_size; ++ phys_addr_t node_id, mem_start, mem_size; + + /* Otherwise come from DTB */ + if (loongson_sysconf.fw_interface != LOONGSON_LEFI) +@@ -64,27 +63,38 @@ void __init szmem(unsigned int node) + + mem_type = loongson_memmap->map[i].mem_type; + mem_size = loongson_memmap->map[i].mem_size; +- mem_start = loongson_memmap->map[i].mem_start; ++ ++ /* Memory size comes in MB if MEM_SIZE_IS_IN_BYTES not set */ ++ if (mem_size & MEM_SIZE_IS_IN_BYTES) ++ mem_size &= ~MEM_SIZE_IS_IN_BYTES; ++ else ++ mem_size = mem_size << 20; ++ ++ mem_start = (node_id << 44) | loongson_memmap->map[i].mem_start; + + switch (mem_type) { + case SYSTEM_RAM_LOW: + case SYSTEM_RAM_HIGH: +- start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT; +- node_psize = (mem_size << 20) >> PAGE_SHIFT; +- end_pfn = start_pfn + node_psize; +- num_physpages += node_psize; +- pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", +- (u32)node_id, mem_type, mem_start, mem_size); +- pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", +- start_pfn, end_pfn, num_physpages); +- memblock_add_node(PFN_PHYS(start_pfn), +- PFN_PHYS(node_psize), node, ++ case UMA_VIDEO_RAM: ++ pr_info("Node %d, mem_type:%d\t[%pa], %pa bytes usable\n", ++ (u32)node_id, mem_type, &mem_start, &mem_size); ++ memblock_add_node(mem_start, mem_size, node, + MEMBLOCK_NONE); + break; + case SYSTEM_RAM_RESERVED: +- pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", +- (u32)node_id, mem_type, mem_start, mem_size); +- memblock_reserve(((node_id << 44) + mem_start), mem_size << 20); ++ case VIDEO_ROM: ++ case ADAPTER_ROM: ++ case ACPI_TABLE: ++ case SMBIOS_TABLE: ++ pr_info("Node %d, mem_type:%d\t[%pa], %pa bytes reserved\n", ++ (u32)node_id, mem_type, &mem_start, &mem_size); ++ memblock_reserve(mem_start, mem_size); ++ break; ++ /* We should not reserve VUMA_VIDEO_RAM as it overlaps with MMIO */ ++ case VUMA_VIDEO_RAM: ++ default: ++ pr_info("Node %d, mem_type:%d\t[%pa], %pa bytes unhandled\n", ++ (u32)node_id, mem_type, &mem_start, &mem_size); + break; + } + } +-- +2.43.0 + diff --git a/queue-5.15/mm-memory_hotplug-handle-memblock_add_node-failures-.patch b/queue-5.15/mm-memory_hotplug-handle-memblock_add_node-failures-.patch new file mode 100644 index 00000000000..a9254f6e512 --- /dev/null +++ b/queue-5.15/mm-memory_hotplug-handle-memblock_add_node-failures-.patch @@ -0,0 +1,92 @@ +From d23ca92bf201f0e24e446dba77aca242c2e41e45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Nov 2021 13:44:42 -0700 +Subject: mm/memory_hotplug: handle memblock_add_node() failures in + add_memory_resource() + +From: David Hildenbrand + +[ Upstream commit 53d38316ab2017a7c0d733765b521700aa357ec9 ] + +Patch series "mm/memory_hotplug: full support for add_memory_driver_managed() with CONFIG_ARCH_KEEP_MEMBLOCK", v2. + +Architectures that require CONFIG_ARCH_KEEP_MEMBLOCK=y, such as arm64, +don't cleanly support add_memory_driver_managed() yet. Most +prominently, kexec_file can still end up placing kexec images on such +driver-managed memory, resulting in undesired behavior, for example, +having kexec images located on memory not part of the firmware-provided +memory map. + +Teaching kexec to not place images on driver-managed memory is +especially relevant for virtio-mem. Details can be found in commit +7b7b27214bba ("mm/memory_hotplug: introduce +add_memory_driver_managed()"). + +Extend memblock with a new flag and set it from memory hotplug code when +applicable. This is required to fully support virtio-mem on arm64, +making also kexec_file behave like on x86-64. + +This patch (of 2): + +If memblock_add_node() fails, we're most probably running out of memory. +While this is unlikely to happen, it can happen and having memory added +without a memblock can be problematic for architectures that use +memblock to detect valid memory. Let's fail in a nice way instead of +silently ignoring the error. + +Link: https://lkml.kernel.org/r/20211004093605.5830-1-david@redhat.com +Link: https://lkml.kernel.org/r/20211004093605.5830-2-david@redhat.com +Signed-off-by: David Hildenbrand +Cc: Mike Rapoport +Cc: Michal Hocko +Cc: Oscar Salvador +Cc: Jianyong Wu +Cc: "Aneesh Kumar K . V" +Cc: Vineet Gupta +Cc: Geert Uytterhoeven +Cc: Huacai Chen +Cc: Jiaxun Yang +Cc: Thomas Bogendoerfer +Cc: Heiko Carstens +Cc: Vasily Gorbik +Cc: Christian Borntraeger +Cc: Eric Biederman +Cc: Arnd Bergmann +Cc: Shahab Vahedi +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Stable-dep-of: c7206e7bd214 ("MIPS: Loongson64: Handle more memory types passed from firmware") +Signed-off-by: Sasha Levin +--- + mm/memory_hotplug.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c +index bf611c55fc66b..bc52a9d201ea6 100644 +--- a/mm/memory_hotplug.c ++++ b/mm/memory_hotplug.c +@@ -1384,8 +1384,11 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) + + mem_hotplug_begin(); + +- if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) +- memblock_add_node(start, size, nid); ++ if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { ++ ret = memblock_add_node(start, size, nid); ++ if (ret) ++ goto error_mem_hotplug_end; ++ } + + ret = __try_online_node(nid, false); + if (ret < 0) +@@ -1458,6 +1461,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) + rollback_node_hotadd(nid); + if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) + memblock_remove(start, size); ++error_mem_hotplug_end: + mem_hotplug_done(); + return ret; + } +-- +2.43.0 + diff --git a/queue-5.15/netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch b/queue-5.15/netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch new file mode 100644 index 00000000000..4a0c8f0744f --- /dev/null +++ b/queue-5.15/netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch @@ -0,0 +1,85 @@ +From 2cb2a23afd83c218fdc5aaeb736b00d31b63b6c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 12:29:54 +0100 +Subject: netfilter: nf_tables: fix 'exist' matching on bigendian arches +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Florian Westphal + +[ Upstream commit 63331e37fb227e796894b31d713697612c8dee7f ] + +Maze reports "tcp option fastopen exists" fails to match on +OpenWrt 22.03.5, r20134-5f15225c1e (5.10.176) router. + +"tcp option fastopen exists" translates to: +inet + [ exthdr load tcpopt 1b @ 34 + 0 present => reg 1 ] + [ cmp eq reg 1 0x00000001 ] + +.. but existing nft userspace generates a 1-byte compare. + +On LSB (x86), "*reg32 = 1" is identical to nft_reg_store8(reg32, 1), but +not on MSB, which will place the 1 last. IOW, on bigendian aches the cmp8 +is awalys false. + +Make sure we store this in a consistent fashion, so existing userspace +will also work on MSB (bigendian). + +Regardless of this patch we can also change nft userspace to generate +'reg32 == 0' and 'reg32 != 0' instead of u8 == 0 // u8 == 1 when +adding 'option x missing/exists' expressions as well. + +Fixes: 3c1fece8819e ("netfilter: nft_exthdr: Allow checking TCP option presence, too") +Fixes: b9f9a485fb0e ("netfilter: nft_exthdr: add boolean DCCP option matching") +Fixes: 055c4b34b94f ("netfilter: nft_fib: Support existence check") +Reported-by: Maciej Żenczykowski +Closes: https://lore.kernel.org/netfilter-devel/CAHo-OozyEqHUjL2-ntATzeZOiuftLWZ_HU6TOM_js4qLfDEAJg@mail.gmail.com/ +Signed-off-by: Florian Westphal +Acked-by: Phil Sutter +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_exthdr.c | 2 +- + net/netfilter/nft_fib.c | 8 ++++++-- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c +index daee46cf62abb..d1dcf5b2e92e1 100644 +--- a/net/netfilter/nft_exthdr.c ++++ b/net/netfilter/nft_exthdr.c +@@ -214,7 +214,7 @@ static void nft_exthdr_tcp_eval(const struct nft_expr *expr, + + offset = i + priv->offset; + if (priv->flags & NFT_EXTHDR_F_PRESENT) { +- *dest = 1; ++ nft_reg_store8(dest, 1); + } else { + if (priv->len % NFT_REG32_SIZE) + dest[priv->len / NFT_REG32_SIZE] = 0; +diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c +index b10ce732b337c..1fd4b2054e8f7 100644 +--- a/net/netfilter/nft_fib.c ++++ b/net/netfilter/nft_fib.c +@@ -140,11 +140,15 @@ void nft_fib_store_result(void *reg, const struct nft_fib *priv, + switch (priv->result) { + case NFT_FIB_RESULT_OIF: + index = dev ? dev->ifindex : 0; +- *dreg = (priv->flags & NFTA_FIB_F_PRESENT) ? !!index : index; ++ if (priv->flags & NFTA_FIB_F_PRESENT) ++ nft_reg_store8(dreg, !!index); ++ else ++ *dreg = index; ++ + break; + case NFT_FIB_RESULT_OIFNAME: + if (priv->flags & NFTA_FIB_F_PRESENT) +- *dreg = !!dev; ++ nft_reg_store8(dreg, !!dev); + else + strncpy(reg, dev ? dev->name : "", IFNAMSIZ); + break; +-- +2.43.0 + diff --git a/queue-5.15/r8152-add-usb-device-driver-for-config-selection.patch b/queue-5.15/r8152-add-usb-device-driver-for-config-selection.patch new file mode 100644 index 00000000000..f95f32330b6 --- /dev/null +++ b/queue-5.15/r8152-add-usb-device-driver-for-config-selection.patch @@ -0,0 +1,240 @@ +From 470a397c635218239fcafea883ac96b350c86ba8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jan 2023 17:07:38 +0100 +Subject: r8152: add USB device driver for config selection +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Bjørn Mork + +[ Upstream commit ec51fbd1b8a2bca2948dede99c14ec63dc57ff6b ] + +Subclassing the generic USB device driver to override the +default configuration selection regardless of matching interface +drivers. + +The r815x family devices expose a vendor specific function which +the r8152 interface driver wants to handle. This is the preferred +device mode. Additionally one or more USB class functions are +usually supported for hosts lacking a vendor specific driver. The +choice is USB configuration based, with one alternate function per +configuration. + +Example device with both NCM and ECM alternate cfgs: + +T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0 +D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 3 +P: Vendor=0bda ProdID=8156 Rev=31.00 +S: Manufacturer=Realtek +S: Product=USB 10/100/1G/2.5G LAN +S: SerialNumber=001000001 +C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=256mA +I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152 +E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=83(I) Atr=03(Int.) MxPS= 2 Ivl=128ms +C: #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=256mA +I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver= +E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms +I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver= +I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver= +E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms +C: #Ifs= 2 Cfg#= 3 Atr=a0 MxPwr=256mA +I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver= +E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=128ms +I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver= +I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver= +E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms + +A problem with this is that Linux will prefer class functions over +vendor specific functions. Using the above example, Linux defaults +to cfg #2, running the device in a sub-optimal NCM mode. + +Previously we've attempted to work around the problem by +blacklisting the devices in the ECM class driver "cdc_ether", and +matching on the ECM class function in the vendor specific interface +driver. The latter has been used to switch back to the vendor +specific configuration when the driver is probed for a class +function. + +This workaround has several issues; +- class driver blacklists is additional maintanence cruft in an + unrelated driver +- class driver blacklists prevents users from optionally running + the devices in class mode +- each device needs double match entries in the vendor driver +- the initial probing as a class function slows down device + discovery + +Now these issues have become even worse with the introduction of +firmware supporting both NCM and ECM, where NCM ends up as the +default mode in Linux. To use the same workaround, we now have +to blacklist the devices in to two different class drivers and +add yet another match entry to the vendor specific driver. + +This patch implements an alternative workaround strategy - +independent of the interface drivers. It avoids adding a +blacklist to the cdc_ncm driver and will let us remove the +existing blacklist from the cdc_ether driver. + +As an additional bonus, removing the blacklists allow users to +select one of the other device modes if wanted. + +Signed-off-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 115 ++++++++++++++++++++++++++++------------ + 1 file changed, 82 insertions(+), 33 deletions(-) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 54779caf18f9b..bcf7492bcf540 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -9639,6 +9639,9 @@ static int rtl8152_probe(struct usb_interface *intf, + if (version == RTL_VER_UNKNOWN) + return -ENODEV; + ++ if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) ++ return -ENODEV; ++ + if (!rtl_vendor_mode(intf)) + return -ENODEV; + +@@ -9848,43 +9851,35 @@ static void rtl8152_disconnect(struct usb_interface *intf) + } + } + +-#define REALTEK_USB_DEVICE(vend, prod) { \ +- USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC), \ +-}, \ +-{ \ +- USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_COMM, \ +- USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), \ +-} +- + /* table of devices that work with this driver */ + static const struct usb_device_id rtl8152_table[] = { + /* Realtek */ +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050), +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8053), +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152), +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153), +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8155), +- REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8156), ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8050) }, ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8053) }, ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8152) }, ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8153) }, ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8155) }, ++ { USB_DEVICE(VENDOR_ID_REALTEK, 0x8156) }, + + /* Microsoft */ +- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab), +- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6), +- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927), +- REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e), +- REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x721e), +- REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387), +- REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041), +- REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff), +- REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601), ++ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab) }, ++ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6) }, ++ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927) }, ++ { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e) }, ++ { USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x304f) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3054) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3062) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3069) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x3082) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x7205) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x720c) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x7214) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0x721e) }, ++ { USB_DEVICE(VENDOR_ID_LENOVO, 0xa387) }, ++ { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) }, ++ { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, ++ { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, + {} + }; + +@@ -9904,7 +9899,61 @@ static struct usb_driver rtl8152_driver = { + .disable_hub_initiated_lpm = 1, + }; + +-module_usb_driver(rtl8152_driver); ++static int rtl8152_cfgselector_probe(struct usb_device *udev) ++{ ++ struct usb_host_config *c; ++ int i, num_configs; ++ ++ /* The vendor mode is not always config #1, so to find it out. */ ++ c = udev->config; ++ num_configs = udev->descriptor.bNumConfigurations; ++ for (i = 0; i < num_configs; (i++, c++)) { ++ struct usb_interface_descriptor *desc = NULL; ++ ++ if (!c->desc.bNumInterfaces) ++ continue; ++ desc = &c->intf_cache[0]->altsetting->desc; ++ if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) ++ break; ++ } ++ ++ if (i == num_configs) ++ return -ENODEV; ++ ++ if (usb_set_configuration(udev, c->desc.bConfigurationValue)) { ++ dev_err(&udev->dev, "Failed to set configuration %d\n", ++ c->desc.bConfigurationValue); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static struct usb_device_driver rtl8152_cfgselector_driver = { ++ .name = MODULENAME "-cfgselector", ++ .probe = rtl8152_cfgselector_probe, ++ .id_table = rtl8152_table, ++ .generic_subclass = 1, ++}; ++ ++static int __init rtl8152_driver_init(void) ++{ ++ int ret; ++ ++ ret = usb_register_device_driver(&rtl8152_cfgselector_driver, THIS_MODULE); ++ if (ret) ++ return ret; ++ return usb_register(&rtl8152_driver); ++} ++ ++static void __exit rtl8152_driver_exit(void) ++{ ++ usb_deregister(&rtl8152_driver); ++ usb_deregister_device_driver(&rtl8152_cfgselector_driver); ++} ++ ++module_init(rtl8152_driver_init); ++module_exit(rtl8152_driver_exit); + + MODULE_AUTHOR(DRIVER_AUTHOR); + MODULE_DESCRIPTION(DRIVER_DESC); +-- +2.43.0 + diff --git a/queue-5.15/r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch b/queue-5.15/r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch new file mode 100644 index 00000000000..894657d740b --- /dev/null +++ b/queue-5.15/r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch @@ -0,0 +1,50 @@ +From e1b73e576d243b19fffeba5cb1395c1c045a91be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 2 Dec 2023 17:17:12 -0800 +Subject: r8152: add vendor/device ID pair for ASUS USB-C2500 + +From: Kelly Kane + +[ Upstream commit 7037d95a047cd89b1f680eed253c6ab586bef1ed ] + +The ASUS USB-C2500 is an RTL8156 based 2.5G Ethernet controller. + +Add the vendor and product ID values to the driver. This makes Ethernet +work with the adapter. + +Signed-off-by: Kelly Kane +Link: https://lore.kernel.org/r/20231203011712.6314-1-kelly@hawknetworks.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 1 + + include/linux/usb/r8152.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 1ad9f1b4bd92d..e64983d0898a0 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -9881,6 +9881,7 @@ static const struct usb_device_id rtl8152_table[] = { + { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, + { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, + { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) }, ++ { USB_DEVICE(VENDOR_ID_ASUS, 0x1976) }, + {} + }; + +diff --git a/include/linux/usb/r8152.h b/include/linux/usb/r8152.h +index 287e9d83fb8bc..33a4c146dc19c 100644 +--- a/include/linux/usb/r8152.h ++++ b/include/linux/usb/r8152.h +@@ -30,6 +30,7 @@ + #define VENDOR_ID_NVIDIA 0x0955 + #define VENDOR_ID_TPLINK 0x2357 + #define VENDOR_ID_DLINK 0x2001 ++#define VENDOR_ID_ASUS 0x0b05 + + #if IS_REACHABLE(CONFIG_USB_RTL8152) + extern u8 rtl8152_get_version(struct usb_interface *intf); +-- +2.43.0 + diff --git a/queue-5.15/r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch b/queue-5.15/r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch new file mode 100644 index 00000000000..4a01547bfb1 --- /dev/null +++ b/queue-5.15/r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch @@ -0,0 +1,51 @@ +From 4e1fb1955c4260ed44329cfc0367efc5449f40c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Aug 2023 01:05:50 +0200 +Subject: r8152: add vendor/device ID pair for D-Link DUB-E250 + +From: Antonio Napolitano + +[ Upstream commit 72f93a3136ee18fd59fa6579f84c07e93424681e ] + +The D-Link DUB-E250 is an RTL8156 based 2.5G Ethernet controller. + +Add the vendor and product ID values to the driver. This makes Ethernet +work with the adapter. + +Signed-off-by: Antonio Napolitano +Link: https://lore.kernel.org/r/CV200KJEEUPC.WPKAHXCQJ05I@mercurius +Signed-off-by: Jakub Kicinski +Stable-dep-of: 7037d95a047c ("r8152: add vendor/device ID pair for ASUS USB-C2500") +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 1 + + include/linux/usb/r8152.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index bcf7492bcf540..1ad9f1b4bd92d 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -9880,6 +9880,7 @@ static const struct usb_device_id rtl8152_table[] = { + { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) }, + { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, + { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) }, ++ { USB_DEVICE(VENDOR_ID_DLINK, 0xb301) }, + {} + }; + +diff --git a/include/linux/usb/r8152.h b/include/linux/usb/r8152.h +index 20d88b1defc30..287e9d83fb8bc 100644 +--- a/include/linux/usb/r8152.h ++++ b/include/linux/usb/r8152.h +@@ -29,6 +29,7 @@ + #define VENDOR_ID_LINKSYS 0x13b1 + #define VENDOR_ID_NVIDIA 0x0955 + #define VENDOR_ID_TPLINK 0x2357 ++#define VENDOR_ID_DLINK 0x2001 + + #if IS_REACHABLE(CONFIG_USB_RTL8152) + extern u8 rtl8152_get_version(struct usb_interface *intf); +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series new file mode 100644 index 00000000000..c03035e56be --- /dev/null +++ b/queue-5.15/series @@ -0,0 +1,19 @@ +r8152-add-usb-device-driver-for-config-selection.patch +r8152-add-vendor-device-id-pair-for-d-link-dub-e250.patch +r8152-add-vendor-device-id-pair-for-asus-usb-c2500.patch +vfs-plumb-i_version-handling-into-struct-kstat.patch +ima-use-vfs_getattr_nosec-to-get-the-i_version.patch +netfilter-nf_tables-fix-exist-matching-on-bigendian-.patch +asoc-amd-add-yc-machine-driver-using-dmic.patch +asoc-amd-yc-add-alienware-m17-r5-amd-into-dmi-table.patch +asoc-amd-yc-add-asus-m5402ra-into-dmi-table.patch +asoc-amd-yc-add-asus-m3402ra-into-dmi-table.patch +asoc-amd-yc-add-vivobook-pro-15-to-quirks-list-for-a.patch +add-dmi-id-for-msi-bravo-15-b7ed.patch +asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch +mm-memory_hotplug-handle-memblock_add_node-failures-.patch +memblock-allow-to-specify-flags-with-memblock_add_no.patch +mips-loongson64-handle-more-memory-types-passed-from.patch +ksmbd-fix-memory-leak-in-smb2_lock.patch +afs-fix-refcount-underflow-from-error-handling-race.patch +hid-lenovo-restrict-detection-of-patched-firmware-on.patch diff --git a/queue-5.15/vfs-plumb-i_version-handling-into-struct-kstat.patch b/queue-5.15/vfs-plumb-i_version-handling-into-struct-kstat.patch new file mode 100644 index 00000000000..f375c6e628a --- /dev/null +++ b/queue-5.15/vfs-plumb-i_version-handling-into-struct-kstat.patch @@ -0,0 +1,112 @@ +From 21586e51e3f9c2fbfe73b980f4366d16e74fecbc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 4 Dec 2016 09:29:46 -0500 +Subject: vfs: plumb i_version handling into struct kstat + +From: Jeff Layton + +[ Upstream commit a1175d6b1bdaf4f74eda47ab18eb44194f9cb796 ] + +The NFS server has a lot of special handling for different types of +change attribute access, depending on the underlying filesystem. In +most cases, it's doing a getattr anyway and then fetching that value +after the fact. + +Rather that do that, add a new STATX_CHANGE_COOKIE flag that is a +kernel-only symbol (for now). If requested and getattr can implement it, +it can fill out this field. For IS_I_VERSION inodes, add a generic +implementation in vfs_getattr_nosec. Take care to mask +STATX_CHANGE_COOKIE off in requests from userland and in the result +mask. + +Since not all filesystems can give the same guarantees of monotonicity, +claim a STATX_ATTR_CHANGE_MONOTONIC flag that filesystems can set to +indicate that they offer an i_version value that can never go backward. + +Eventually if we decide to make the i_version available to userland, we +can just designate a field for it in struct statx, and move the +STATX_CHANGE_COOKIE definition to the uapi header. + +Reviewed-by: NeilBrown +Reviewed-by: Jan Kara +Signed-off-by: Jeff Layton +Stable-dep-of: db1d1e8b9867 ("IMA: use vfs_getattr_nosec to get the i_version") +Signed-off-by: Sasha Levin +--- + fs/stat.c | 17 +++++++++++++++-- + include/linux/stat.h | 9 +++++++++ + 2 files changed, 24 insertions(+), 2 deletions(-) + +diff --git a/fs/stat.c b/fs/stat.c +index 246d138ec0669..e868e6382b709 100644 +--- a/fs/stat.c ++++ b/fs/stat.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -118,6 +119,11 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat, + stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | + STATX_ATTR_DAX); + ++ if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) { ++ stat->result_mask |= STATX_CHANGE_COOKIE; ++ stat->change_cookie = inode_query_iversion(inode); ++ } ++ + mnt_userns = mnt_user_ns(path->mnt); + if (inode->i_op->getattr) + return inode->i_op->getattr(mnt_userns, path, stat, +@@ -573,9 +579,11 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer) + + memset(&tmp, 0, sizeof(tmp)); + +- tmp.stx_mask = stat->result_mask; ++ /* STATX_CHANGE_COOKIE is kernel-only for now */ ++ tmp.stx_mask = stat->result_mask & ~STATX_CHANGE_COOKIE; + tmp.stx_blksize = stat->blksize; +- tmp.stx_attributes = stat->attributes; ++ /* STATX_ATTR_CHANGE_MONOTONIC is kernel-only for now */ ++ tmp.stx_attributes = stat->attributes & ~STATX_ATTR_CHANGE_MONOTONIC; + tmp.stx_nlink = stat->nlink; + tmp.stx_uid = from_kuid_munged(current_user_ns(), stat->uid); + tmp.stx_gid = from_kgid_munged(current_user_ns(), stat->gid); +@@ -612,6 +620,11 @@ int do_statx(int dfd, const char __user *filename, unsigned flags, + if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE) + return -EINVAL; + ++ /* STATX_CHANGE_COOKIE is kernel-only for now. Ignore requests ++ * from userland. ++ */ ++ mask &= ~STATX_CHANGE_COOKIE; ++ + error = vfs_statx(dfd, filename, flags, &stat, mask); + if (error) + return error; +diff --git a/include/linux/stat.h b/include/linux/stat.h +index 7df06931f25d8..c295fc03a2c98 100644 +--- a/include/linux/stat.h ++++ b/include/linux/stat.h +@@ -50,6 +50,15 @@ struct kstat { + struct timespec64 btime; /* File creation time */ + u64 blocks; + u64 mnt_id; ++ u64 change_cookie; + }; + ++/* These definitions are internal to the kernel for now. Mainly used by nfsd. */ ++ ++/* mask values */ ++#define STATX_CHANGE_COOKIE 0x40000000U /* Want/got stx_change_attr */ ++ ++/* file attribute values */ ++#define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */ ++ + #endif +-- +2.43.0 + -- 2.47.3