6.18.61-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 445/1005 i2c: imx-lpi2c: properly unwind resources on probe failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Song <[email protected]>
[ Upstream commit cbd043b00ee3f542c115c8809c4d9a67465c07d5 ]
When probe fails at devm_clk_rate_exclusive_get() or clk_get_rate(), which occur before runtime PM is initialized, the clocks enabled by clk_bulk_prepare_enable() are never disabled.
When probe fails after runtime PM is initialized, the previous error path called pm_runtime_put_sync(), which triggers the runtime suspend callback. However, due to different clock management strategies on different SoCs[1] (to avoid deadlocks between the global prepare_lock and runtime PM), the callback may only disable clocks without unpreparing them, causing an incomplete unwind.
Introduce a new error label 'clk_disable' to explicitly invoke clk_bulk_disable_unprepare(). Replace pm_runtime_put_sync() with the sequence of pm_runtime_disable(), pm_runtime_set_suspended() and pm_runtime_put_noidle() to bypass the runtime suspend callback during error recovery. During the LPI2C driver probe phase, clock APIs are used exclusively to manage clocks. Once probing succeeds, clock management is handed over to the runtime PM core.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/i2c/busses/i2c-imx-lpi2c.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-imx-lpi2c.c +14 -7
@@ -1500,14 +1500,18 @@ static int lpi2c_imx_probe(struct platform_device *pdev)* each transfer */ ret =devm_clk_rate_exclusive_get (&pdev->dev, lpi2c_imx->clks[0 ].clk); -if (ret) -return dev_err_probe (&pdev->dev, ret, -"can't lock I2C peripheral clock rate\n" ); +if (ret) { + ret =dev_err_probe (&pdev->dev, ret, +"can't lock I2C peripheral clock rate\n" ); + goto clk_disable; + } lpi2c_imx->rate_per =clk_get_rate (lpi2c_imx->clks[0 ].clk); -if (!lpi2c_imx->rate_per) -return dev_err_probe (&pdev->dev, -EINVAL , -"can't get I2C peripheral clock rate\n" ); +if (!lpi2c_imx->rate_per) { + ret =dev_err_probe (&pdev->dev, -EINVAL , +"can't get I2C peripheral clock rate\n" ); + goto clk_disable; + }pm_runtime_set_autosuspend_delay (&pdev->dev,I2C_PM_TIMEOUT );pm_runtime_use_autosuspend (&pdev->dev);
@@ -1545,8 +1549,11 @@ static int lpi2c_imx_probe(struct platform_device *pdev) rpm_disable:pm_runtime_dont_use_autosuspend (&pdev->dev); -pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +clk_disable: +clk_bulk_disable_unprepare (lpi2c_imx->num_clks, lpi2c_imx->clks);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 446/1005 fbdev: maxine: fix 64-bit build error
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 3adec5c640dc09dca5605043e138412fd5a0629d ]
The KSEG1ADDR() macro is only defined for non-64BIT builds. Use the CKSEG1ADDR() macro instead.
In file included from ../drivers/video/fbdev/maxinefb.c:34:../drivers/video/fbdev/maxinefb.c: In function 'maxinefb_ims332_write_register':../include/video/maxinefb.h:16:41: error: implicit declaration of function 'KSEG1ADDR'; did you mean 'CKSEG1ADDR'? [-Wimplicit-function-declaration]
16 | #define MAXINEFB_IMS332_ADDRESS KSEG1ADDR(0x1c140000)../drivers/video/fbdev/maxinefb.c:66:49: note: in expansion of macro 'MAXINEFB_IMS332_ADDRESS'
66 | register unsigned char *regs = (char *) MAXINEFB_IMS332_ADDRESS;../drivers/video/fbdev/maxinefb.c:66:40: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
66 | register unsigned char *regs = (char *) MAXINEFB_IMS332_ADDRESS;
--- include/video/maxinefb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/video/maxinefb.h +2 -2
@@ -13,13 +13,13 @@/* * IMS332 video controller register base address */ -#define MAXINEFB_IMS332_ADDRESS KSEG1ADDR(0x1c140000) +#define MAXINEFB_IMS332_ADDRESS CKSEG1ADDR(0x1c140000)/* * Begin of DECstation 5000/xx onboard framebuffer memory, default resolution * is 1024x768x8 */ -#define DS5000_xx_ONBOARD_FBMEM_START KSEG1ADDR(0x0a000000) +#define DS5000_xx_ONBOARD_FBMEM_START CKSEG1ADDR(0x0a000000)/* * The IMS 332 video controller used in the DECstation 5000/xx series
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 447/1005 fbdev: platinumfb: add error checking for ioremap calls
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: BingKun Yue <[email protected]>
[ Upstream commit ba13226fc966004713aed47931db8922b84d1960 ]
The ioremap() and ioremap_wt() calls in platinumfb_probe() were not checked for failure. If any of these mappings fail, the driver would dereference NULL pointers, leading to a kernel panic.
Add proper error checking and use goto-based cleanup to avoid code duplication across the error paths.
--- drivers/video/fbdev/platinumfb.c | 35 ++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
drivers/video/fbdev/platinumfb.c +29 -6
@@ -567,15 +567,30 @@ static int platinumfb_probe(struct platform_device* odev)/* frame buffer - map only 4MB */ pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; pinfo->frame_buffer =ioremap_wt (pinfo->rsrc_fb.start,0x400000 ); +if (!pinfo->frame_buffer) { +dev_err (&odev->dev,"failed to ioremap frame buffer\n" ); + rc = -ENOMEM ; + goto err_release_fb; + } pinfo->base_frame_buffer = pinfo->frame_buffer;/* registers */ pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; pinfo->platinum_regs =ioremap (pinfo->rsrc_reg.start,0x1000 ); +if (!pinfo->platinum_regs) { +dev_err (&odev->dev,"failed to ioremap registers\n" ); + rc = -ENOMEM ; + goto err_unmap_fb; + } pinfo->cmap_regs_phys =0xf301b000 ;/* XXX not in prom? */ request_mem_region (pinfo->cmap_regs_phys,0x1000 ,"platinumfb cmap" ); pinfo->cmap_regs =ioremap (pinfo->cmap_regs_phys,0x1000 ); +if (!pinfo->cmap_regs) { +dev_err (&odev->dev,"failed to ioremap cmap registers\n" ); + rc = -ENOMEM ; + goto err_release_cmap; + }/* Grok total video ram */ out_be32 (&pinfo->platinum_regs->reg[16 ].r, (unsigned )pinfo->frame_buffer_phys);
@@ -623,13 +638,21 @@ static int platinumfb_probe(struct platform_device* odev)dev_set_drvdata (&odev->dev, info); rc =platinum_init_fb (info); -if (rc !=0 ) { -iounmap (pinfo->frame_buffer); -iounmap (pinfo->platinum_regs); -iounmap (pinfo->cmap_regs); -framebuffer_release (info); - } +if (rc !=0 ) + goto err_unmap_cmap; + +return 0 ; +err_unmap_cmap: +iounmap (pinfo->cmap_regs); +err_release_cmap: +release_mem_region (pinfo->cmap_regs_phys,0x1000 ); +iounmap (pinfo->platinum_regs); +err_unmap_fb: +iounmap (pinfo->frame_buffer); +err_release_fb: +release_mem_region (pinfo->rsrc_fb.start,resource_size (&pinfo->rsrc_fb)); +framebuffer_release (info);return rc; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 448/1005 ksmbd: enable TCP keepalive for accepted connections
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 56549c18a4f75309161ca780feaa4d17904e3ee9 ]
A client that disappears without sending a FIN or RST can leave its ksmbd connection in ESTABLISHED indefinitely. ksmbd sets a socket receive timeout, but the connection receive loop retries timeout errors without a limit, so the connection remains in conn_list and consumes the per-IP connection quota.
Enable SO_KEEPALIVE on accepted TCP sockets so the TCP stack can detect a silent peer failure. The keepalive idle time, interval, and probe count remain controlled by the existing TCP sysctl settings.
--- fs/smb/server/transport_tcp.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/smb/server/transport_tcp.c +6 -0
@@ -312,6 +312,12 @@ static int ksmbd_kthread_fn(void *p)ksmbd_debug (CONN ,"connect success: accepted new connection\n" ); client_sk->sk->sk_rcvtimeo =KSMBD_TCP_RECV_TIMEOUT ; client_sk->sk->sk_sndtimeo =KSMBD_TCP_SEND_TIMEOUT ; +/* +* Detect peers that disappear without sending a FIN or RST. +* Otherwise the connection handler can retry receive timeouts +* indefinitely and keep the connection in conn_list. +*/ +sock_set_keepalive (client_sk->sk);ksmbd_tcp_new_connection (client_sk); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 449/1005 sched_ext/scx_flatcg: expire cached hweights on weight changes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <[email protected]>
[ Upstream commit 94c20e1fb334c2082b443c4470a86ad982f67282 ]
fcg_cgroup_set_weight() updates cgc->weight and the parent's child_weight_sum but doesn't bump hweight_gen, so the hweights cached by cgrp_refresh_hweight() stay stale until some task activation bumps the generation. For cgroups whose tasks never go through a 0->n runnable transition (e.g. persistently busy ones), a cpu.weight change never propagates to scheduling at all.
Bump hweight_gen on weight changes so the next refresh recomputes with the new weight.
Verified on a flatcg VM: a live cpu.weight 100->800 change on a busy cgroup leaves HWT update at 0 and the distribution unchanged; with it, hweight_gen increments and the refresh recomputes.
--- tools/sched_ext/scx_flatcg.bpf.c | 3 +++ 1 file changed, 3 insertions(+)
tools/sched_ext/scx_flatcg.bpf.c +3 -0
@@ -605,6 +605,9 @@ void BPF_STRUCT_OPS(fcg_cgroup_set_weight, struct cgroup *cgrp, u32 weight) pcgc->child_weight_sum += (s64 )weight - cgc->weight; cgc->weight = weight;bpf_spin_unlock (&cgv_tree_lock); + +/* expire cached hweights so the new weight propagates */ +__sync_fetch_and_add (&hweight_gen,1 ); }static bool try_pick_next_cgroup (u64 *cgidp)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 450/1005 ACPI: button: Add DMI quirk for Razer Blade Pro 17 early 2020 lid switch
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Everaars <[email protected]>
[ Upstream commit 415125669c2ddc773c579a60df108f75712dfa83 ]
The lid switch reports "close" but can miss the matching "open", leaving _LID closed after resume. systemd-logind then suspends the system again roughly every 35 seconds.
Reading the embedded controller's PSTA byte while _LID is stale shows that bit 0x04 is set, which the DSDT treats as open. The DSDT returns the cached LIDS byte from _LID. Its wake path aborts in RTEC on an unhandled SystemCMOS region before copying PSTA to LIDS.
Initialize the lid state to open on resume, matching the existing quirk for the Razer Blade Stealth 13 late 2019. With button.lid_init_state=open, a physical close suspended once and resume reported open without another suspend.
--- drivers/acpi/button.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/acpi/button.c +11 -0
@@ -132,6 +132,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = { }, .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, }, + { +/* +* Razer Blade Pro 17 early 2020, notification of the LID device +* only happens on close, not on open and _LID keeps returning closed. +*/ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Razer" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Blade Pro 17 (Early 2020) - RZ09-0329"), + }, + .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, + }, {/* * Samsung galaxybook2 ,initial _LID device notification returns
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 451/1005 f2fs: avoid setting SBI_NEED_FSCK on transient resize failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daeho Jeong <[email protected]>
[ Upstream commit 258c95150c26a30db1896eacd3bdef26314f2ca1 ]
When free_segment_range() fails in f2fs_resize_fs(), no on-disk superblock or filesystem metadata has been modified yet, and free_segment_range() safely restores all in-memory counters before returning.
However, the current error recovery path unconditionally sets the SBI_NEED_FSCK flag and prints a scary error message on any error, forcing an unnecessary and time-consuming fsck.f2fs repair on the subsequent mount/reboot.
Fix this by separating the error recovery path with a dedicated recover_user_blocks label to bypass setting SBI_NEED_FSCK on free_segment_range() failures.
--- fs/f2fs/gc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/f2fs/gc.c +6 -3
@@ -2415,7 +2415,7 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)set_sbi_flag (sbi,SBI_IS_RESIZEFS ); err =free_segment_range (sbi, secs, false);if (err) - goto recover_out; + goto recover_user_blocks;update_sb_metadata (sbi, -secs);
@@ -2437,11 +2437,14 @@ int f2fs_resize_fs(struct file *filp, __u64 block_count)f2fs_commit_super (sbi, false); } recover_out: -clear_sbi_flag (sbi,SBI_IS_RESIZEFS );if (err) { +f2fs_bug_on (sbi, err == -EAGAIN );set_sbi_flag (sbi,SBI_NEED_FSCK );f2fs_err (sbi,"resize_fs failed, should run fsck to repair!" ); - + } +recover_user_blocks: +clear_sbi_flag (sbi,SBI_IS_RESIZEFS ); +if (err) {spin_lock (&sbi->stat_lock); sbi->user_block_count += shrunk_blocks;spin_unlock (&sbi->stat_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 452/1005 ALSA: hda/realtek: Fix ALC700 audio on Intel Hades Canyon
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csaba Budai <[email protected]>
[ Upstream commit 1fcccdc20a76b4639b00124cf2a379b837bd2bf7 ]
On Intel Hades Canyon systems with an ALC700 codec, analog audio can become unusable after rebooting from Windows into Linux.
The affected system uses codec subsystem ID 8086:2073. In the broken state, Realtek coefficient 0x1b has value 0x4a4b. Setting bit 0x0400 changes it to 0x4e4b and immediately restores normal analog playback.
The BIOS also sets this bit after disabling and re-enabling onboard audio, while Windows may leave it cleared. Linux currently does not restore it during codec initialization.
Add a machine-specific fixup for Intel Hades Canyon which sets only bit 0x0400 of coefficient 0x1b during HDA_FIXUP_ACT_INIT.
The fix has been verified across Windows -> Linux reboots on an Intel NUC8i7HNB with an ALC700 codec.
--- sound/hda/codecs/realtek/alc269.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/hda/codecs/realtek/alc269.c +20 -0
@@ -3820,6 +3820,7 @@ enum {ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE ,ALC225_FIXUP_S3_POP_NOISE ,ALC700_FIXUP_INTEL_REFERENCE , +ALC700_FIXUP_INTEL_HADES_CANYON ,ALC274_FIXUP_DELL_BIND_DACS ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB , ALC298_FIXUP_TPT470_DOCK_FIX,
@@ -4040,6 +4041,19 @@ static void alc287_fixup_lenovo_yoga_book_9i(struct hda_codec *codec,__snd_hda_apply_fixup (codec, id, action,0 ); } +static void alc700_fixup_intel_hades_canyon (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +/* +* Windows may leave coef 0x1b bit 0x0400 cleared, causing broken +* analog playback after rebooting into Linux. Restore the bit +* during codec initialization. +*/ +if (action ==HDA_FIXUP_ACT_INIT ) +alc_update_coef_idx (codec,0x1b ,0x0400 ,0x0400 ); +} +static const struct hda_fixup alc269_fixups[] = { [ALC233_FIXUP_WUJIE_SPEAKERS ] = { .type =HDA_FIXUP_PINS ,
@@ -5092,6 +5106,10 @@ static const struct hda_fixup alc269_fixups[] = { {} } }, + [ALC700_FIXUP_INTEL_HADES_CANYON] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc700_fixup_intel_hades_canyon, + }, [ALC274_FIXUP_DELL_BIND_DACS] = { .type = HDA_FIXUP_FUNC, .v.func = alc274_fixup_bind_dacs,
@@ -7653,6 +7671,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x2782 ,0xa128 ,"Positivo N15RPE-S" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x2782 ,0xa212 ,"Lunnen Ground 14" ,ALC269VC_FIXUP_LUNNEN_GROUND_14 ),SND_PCI_QUIRK (0x7017 ,0x2014 ,"Star Labs StarFighter" ,ALC233_FIXUP_STARLABS_STARFIGHTER ), +SND_PCI_QUIRK (0x8086 ,0x2073 ,"Intel NUC 8 Hades Canyon" , +ALC700_FIXUP_INTEL_HADES_CANYON ),SND_PCI_QUIRK (0x8086 ,0x2074 ,"Intel NUC 8" ,ALC233_FIXUP_INTEL_NUC8_DMIC ),SND_PCI_QUIRK (0x8086 ,0x2080 ,"Intel NUC 8 Rugged" ,ALC256_FIXUP_INTEL_NUC8_RUGGED ), SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 453/1005 ALSA: usb-audio: Add iD14 MkI to monitor-mix volume quirk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Porter <[email protected]>
[ Upstream commit 17056a36d276a740f09dca723de1bc6aa3eb4ef9 ]
Add the iD14 MkI USB ID to the existing audient_id14_map. This names feature unit 12 Monitor Mix Playback Volume.
Live meter A/B testing on MkI USB ID 2708:0002 reproduced the same asymmetric attenuation seen on MkII. At ALSA value 104, the right channel was 23.07 dB below the left. At 127, both channels were equal.
The misleading Speaker Playback Volume name causes PipeWire to adopt FU12 as the stream master. Reuse the existing map to keep the control available while preventing that selection.
Hardware-tested on Bazzite 7.2.0-ogc4.1.fc44.x86_64 with this change backported. ALSA exposed Monitor Mix Playback Volume after module load and USB reconnect. PipeWire volume changes from 100% to 35% and back left all four FU12 values at 127. Channel-isolated left/right playback remained balanced after reconnect.
Build-tested with CONFIG_SND_USB_AUDIO=m using the focused sound/usb target.
--- sound/usb/mixer_maps.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
sound/usb/mixer_maps.c +13 -8
@@ -505,13 +505,13 @@ static const struct usbmix_connector_map gigabyte_b450_connector_map[] = { {} }; -/* Audient iD14: FU 12 advertises Volume on only 4 of its 6 logical channels -* and sits on the monitor mixer branch, but it is traced through to the -* Speaker output terminal and gets named "Speaker Playback Volume". Userspace -* then adopts it as the stream's hardware volume, and any setting below 0 dB -* attenuates some channels but not others (20 dB imbalance at 80%). Give it a -* non-standard name so that it is no longer taken for the stream's master -* volume, while remaining reachable for anyone who wants the monitor gain. +/* Audient iD14 MkI and MkII: FU 12 sits on the monitor mixer branch but is +* traced through to the Speaker output terminal, so it is named "Speaker +* Playback Volume". On MkII it controls only 4 of 6 playback channels. MkI +* testing found asymmetric attenuation within the main stereo pair. Userspace +* adopts this control as the stream's hardware volume, causing imbalance below +* 0 dB. Give it a non-standard name so that userspace no longer treats it as +* the stream master, while keeping the monitor gain reachable. */ static const struct usbmix_name_map audient_id14_map[] = { {12 ,"Monitor Mix Playback" },/* FU, partial coverage */
@@ -602,7 +602,12 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .map = maya44_map, }, { -/* Audient iD14 */ + /* Audient iD14 MkI */ + .id = USB_ID(0x2708, 0x0002), + .map = audient_id14_map, + }, + { + /* Audient iD14 MkII */ .id = USB_ID(0x2708, 0x0008), .map = audient_id14_map, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 454/1005 scsi: snic: Fix SCSI host leak on workqueue allocation failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Changcheng <[email protected]>
[ Upstream commit 12e67eb89eb2b9516685c744d3f7de0a2d1bd701 ]
In snic_add_host(), if scsi_add_host() succeeds but alloc_ordered_workqueue() fails, the function returns -ENOMEM with shost->work_q left as NULL. The caller's error path then calls snic_del_host(), which returns early when !shost->work_q without calling scsi_remove_host(). The Scsi_Host remains registered in sysfs as a zombie device even after the probe has failed. This causes:
- The leaked host remains visible in /sys/class/scsi_host/ after probe failure, with state "running".
- Subsequent SCSI host numbering is permanently shifted (the leaked host ID from ida_alloc() is never reclaimed).
- Memory leak: the Scsi_Host allocation can never be freed because device_add() took a reference that can only be released by device_del() inside scsi_remove_host().
Fix by adding scsi_remove_host() in the workqueue allocation failure path inside snic_add_host(), undoing the successful scsi_add_host() before returning the error. This is cleaner than modifying snic_del_host() because snic_del_host() is called from a shared error label that also serves paths where snic_add_host() was never invoked.
Reproducer (requires no real SNIC hardware):
- Build CONFIG_SCSI_SNIC=y (built-in)
- Add snic.test_mode=1 snic.inject_wq_fail=1 to kernel cmdline
- Boot with a PCI device matching the snic driver (e.g. QEMU edu device, PCI ID 0x1234:0x11e8, temporarily added to the driver's PCI ID table)
Before the fix:
# /sys/class/scsi_host/ contains a zombie host0: $ cat /sys/class/scsi_host/host0/proc_name snic_scsi $ cat /sys/class/scsi_host/host0/state running # ata_piix gets host1, host2 (host0 stuck): scsi host1: ata_piix scsi host2: ata_piix
After the fix:
# host0 is properly freed and reused by ata_piix: scsi host0: ata_piix scsi host1: ata_piix # No zombie host in /sys/class/scsi_host/
--- drivers/scsi/snic/snic_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/snic/snic_main.c +1 -0
@@ -305,6 +305,7 @@ snic_add_host(struct Scsi_Host *shost, struct pci_dev *pdev)if (!shost->work_q) {SNIC_HOST_ERR (shost,"Failed to Create ScsiHost wq.\n" ); +scsi_remove_host (shost); ret = -ENOMEM ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 455/1005 docs: block: fix dead http link in blk-mq.rst
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jenson Johnathon Reggentin <[email protected]>
[ Upstream commit b40a680ea4efe4ef2addada63e304a94d19500d1 ]
The current link http://kernel.dk/blk-mq.pdf leads to a 404 error page.
https://www.kernel.dk/blk-mq.pdf leads to the correct document.
v2 to add the missing www. prefix in the actual file change.
Message-ID: <[email protected]>
--- Documentation/block/blk-mq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/block/blk-mq.rst +1 -1
@@ -139,7 +139,7 @@ completed. Further reading --------------- -- `Linux Block IO: Introducing Multi-queue SSD Access on Multi-core Systems <http://kernel.dk/blk-mq.pdf>`_ +- `Linux Block IO: Introducing Multi-queue SSD Access on Multi-core Systems <https://www.kernel.dk/blk-mq.pdf>`_ - `NOOP scheduler <https://en.wikipedia.org/wiki/Noop_scheduler>`_
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 456/1005 net: ethernet: mtk_wed: increase WED v2 WDMA RESV_BUFF to 0x80
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiji Yang <[email protected]>
[ Upstream commit c0ef04232f9fac083c3d8a77ce58ba32243e6734 ]
Change WDMA RESV_BUFF from 0x40 to 0x80 to avoid CDM TX FIFO overflow. Without this patch mt7986 and mt7981 may have WDMA TX hang issue. This patch was pulled from mtk-openwrt-feeds GPL open source project.
--- drivers/net/ethernet/mediatek/mtk_wed.c | 5 +++++ drivers/net/ethernet/mediatek/mtk_wed_regs.h | 1 + 2 files changed, 6 insertions(+)
drivers/net/ethernet/mediatek/mtk_wed.c +5 -0
@@ -2071,6 +2071,11 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)wdma_set (dev,MTK_WDMA_GLO_CFG ,MTK_WDMA_GLO_CFG_TX_DMA_EN ); } +if (mtk_wed_is_v2 (dev->hw)) +wdma_m32 (dev,MTK_WDMA_GLO_CFG , +MTK_WDMA_GLO_CFG_RESV_BUFF , +FIELD_PREP (MTK_WDMA_GLO_CFG_RESV_BUFF ,0x80 )); +wed_set (dev,MTK_WED_GLO_CFG ,MTK_WED_GLO_CFG_TX_DMA_EN |MTK_WED_GLO_CFG_RX_DMA_EN );
drivers/net/ethernet/mediatek/mtk_wed_regs.h +1 -0
@@ -433,6 +433,7 @@ struct mtk_wdma_desc {#define MTK_WDMA_GLO_CFG_TX_DMA_BUSY BIT(1)#define MTK_WDMA_GLO_CFG_RX_DMA_EN BIT(2)#define MTK_WDMA_GLO_CFG_RX_DMA_BUSY BIT(3) +#define MTK_WDMA_GLO_CFG_RESV_BUFF GENMASK(23, 16)#define MTK_WDMA_GLO_CFG_RX_INFO3_PRERES BIT(26)#define MTK_WDMA_GLO_CFG_RX_INFO2_PRERES BIT(27)#define MTK_WDMA_GLO_CFG_RX_INFO1_PRERES BIT(28)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 457/1005 fbcon: Fix KASAN slab-out-of-bounds Read in fbcon_prepare_logo
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 94e6a058b16820e02f25e1221a4c4e713ba23550 ]
Ensure the logo will not exceed the screen size, which then should fix a reported KASAN: slab-out-of-bounds Read in fbcon_prepare_logo.
--- drivers/video/fbdev/core/fbcon.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/video/fbdev/core/fbcon.c +7 -0
@@ -600,6 +600,13 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, erase &= ~0x400 ; logo_height =fb_prepare_logo (info, par->rotate); logo_lines =DIV_ROUND_UP (logo_height, vc->vc_font.height); + logo_lines =min (logo_lines, rows); + logo_lines =min (logo_lines, new_rows -1 ); +if (logo_lines <=0 ) { + logo_lines =0 ; + logo_shown =FBCON_LOGO_DONTSHOW ; +return ; + } q = (unsigned short *) (vc->vc_origin + vc->vc_size_row * rows); step = logo_lines * cols;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 458/1005 powercap: intel_rapl: Fix kernel panic during PMU unbind
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumeet Pawnikar <[email protected]>
[ Upstream commit 916b61abba586d950a4d8264e2841cc5ccfa4df1 ]
rapl_package_add_pmu() fails internally at perf_pmu_register(), and rapl_pmu_update() leaves the global rapl_pmu.pmu structure zero-initialized via memset and returns an error. But any previously probed packages retain has_pmu = true.
When the driver is subsequently unbound or removed, rapl_package_remove_pmu_locked() sees has_pmu == true and unconditionally calls perf_pmu_unregister(&rapl_pmu.pmu) on the zeroed-out structure. This attempts a list_del_rcu() on a NULL list head, immediately causing a kernel panic.
Fix this by checking if the PMU is actually registered before attempting to unregister it.
--- drivers/powercap/intel_rapl_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/powercap/intel_rapl_common.c +3 -1
@@ -2106,7 +2106,9 @@ void rapl_package_remove_pmu(struct rapl_package *rp)return ; } -perf_pmu_unregister (&rapl_pmu.pmu); +if (rapl_pmu.registered) +perf_pmu_unregister (&rapl_pmu.pmu); +memset (&rapl_pmu,0 ,sizeof (struct rapl_pmu )); }EXPORT_SYMBOL_GPL (rapl_package_remove_pmu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 459/1005 net: stmmac: fix device node reference leaks in stmmac_mtl_setup()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Md Rabbani <[email protected]>
[ Upstream commit 317fe168f4c0fc30e5c375c22d9c8911940aea9b ]
In stmmac_mtl_setup(), q_node is shared across the RX and TX queue parsing loops. When the RX queue loop breaks early because the number of parsed queues reaches plat->rx_queues_to_use, q_node retains an acquired reference count. If the error check passes
(queue == plat->rx_queues_to_use), execution proceeds directly to the TX queue loop, where of_get_next_child() immediately overwrites q_node with the first TX child, permanently leaking the retained RX child device node reference.
Switch both loops to for_each_child_of_node_scoped() so child node references are automatically dropped upon loop exit or early break, and remove the now-unnecessary function-scoped q_node variable and its manual of_node_put() at the exit label.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -4
@@ -131,7 +131,6 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)static int stmmac_mtl_setup (struct platform_device *pdev,struct plat_stmmacenet_data *plat) { -struct device_node *q_node;struct device_node *rx_node;struct device_node *tx_node;u8 queue =0 ;
@@ -174,7 +173,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev, plat->rx_sched_algorithm =MTL_RX_ALGORITHM_SP ;/* Processing individual RX queue config */ -for_each_child_of_node (rx_node, q_node) { +for_each_child_of_node_scoped (rx_node, q_node) {if (queue >= plat->rx_queues_to_use)break ;
@@ -237,7 +236,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev, queue =0 ;/* Processing individual TX queue config */ -for_each_child_of_node (tx_node, q_node) { +for_each_child_of_node_scoped (tx_node, q_node) {if (queue >= plat->tx_queues_to_use)break ;
@@ -290,7 +289,6 @@ static int stmmac_mtl_setup(struct platform_device *pdev, out:of_node_put (rx_node);of_node_put (tx_node); -of_node_put (q_node);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 460/1005 ALSA: hda/realtek: Add quirk for Lenovo IdeaPad Slim 3 15ABR8
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit be79a45e2ec289eb9fad519e8f5a3d4fc3789dd0 ]
The internal microphone on Lenovo IdeaPad Slim 3 15ABR8 (subsystem 17aa:3862) exhibits severe distortion at default gain levels. The Capture Volume is fixed at 63 (max) and cannot be lowered without explicit userspace intervention. The existing fixup ALC269_FIXUP_LIMIT_INT_MIC_BOOST limits the gain range and resolves the issue.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7515,6 +7515,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3852 ,"Lenovo Yoga 7 14ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3855 ,"Legion 7 16ITHG6" ,ALC287_FIXUP_LEGION_16ITHG6 ), +SND_PCI_QUIRK (0x17aa ,0x3862 ,"Lenovo IdeaPad Slim 3 15ABR8" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x17aa ,0x3865 ,"Lenovo 13X" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3866 ,"Lenovo 13X" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 461/1005 fuse: zero the partial EOF page when extending a file
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jimmy Zuber <[email protected]>
[ Upstream commit 34b5c4a6e4fb9dbb3f9d87f3b0fb0372105c8302 ]
Extending a fuse file past a non-page-aligned EOF does not zero the tail of the old last page. When that page is cached and has been mmap-dirtied beyond the old EOF, the now in-bounds tail is served to later reads as stale data rather than zeros, which violates POSIX file-extension semantics.
Some file systems get this zeroing automatically at writeback time (block_write_full_folio() / iomap_writeback_handle_eof() zero the tail of the folio straddling i_size). A non-writeback caching fuse file system uses neither path, so it has to zero the tail itself from the size-extending paths, like XFS (xfs_file_write_zero_eof()) and ext4 (ext4_block_zero_eof()) do.
Call truncate_pagecache_range() over the newly-exposed range up front from the three paths that extend a file, before the new size is published:
- a buffered write whose position is past the old EOF (fuse_perform_write());
- a size-extending setattr/truncate (fuse_do_setattr());
- a size-extending fallocate (fuse_file_fallocate()).
This unmaps the stale mappings and zeroes the partial tail of the old EOF folio, so a later read returns zeros. Truncating [old EOF, write start) before a buffered write keeps the dropped range disjoint from the written data, so a write that lands inside the old EOF folio is preserved.
writeback_cache connections are unaffected, as their writes go through iomap_file_buffered_write(), which zeroes post-EOF folios. The bug is observable on a non-writeback_cache server that returns FOPEN_KEEP_CACHE on writable files (without FOPEN_DIRECT_IO), and is caught by the new write_extend_eof fuse selftest.
--- fs/fuse/dir.c | 3 +++ fs/fuse/file.c | 9 +++++++++ 2 files changed, 12 insertions(+)
fs/fuse/dir.c +3 -0
@@ -2095,6 +2095,9 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,*/ if ((is_truncate || !is_wb) &&S_ISREG (inode->i_mode) && oldsize != outarg.attr.size) { +if (outarg.attr.size > oldsize) +truncate_pagecache_range (inode, oldsize, + outarg.attr.size -1 );truncate_pagecache (inode, outarg.attr.size);invalidate_inode_pages2 (mapping); }
fs/fuse/file.c +9 -0
@@ -1290,9 +1290,13 @@ static ssize_t fuse_perform_write(struct kiocb *iocb, struct iov_iter *ii)struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode);loff_t pos = iocb->ki_pos; +loff_t old_size =i_size_read (inode);int err =0 ;ssize_t res =0 ; +if (pos > old_size) +truncate_pagecache_range (inode, old_size, pos -1 ); +if (inode->i_size < pos +iov_iter_count (ii))set_bit (FUSE_I_SIZE_UNSTABLE , &fi->state);
@@ -2952,6 +2956,11 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,/* we could have extended the file */ if (!(mode &FALLOC_FL_KEEP_SIZE )) { +loff_t oldsize =i_size_read (inode); + +if (offset + length > oldsize) +truncate_pagecache_range (inode, oldsize, + offset + length -1 );if (fuse_write_update_attr (inode, offset + length, length))file_update_time (file); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 462/1005 ASoC: amd: yc: Add DMI entry for Alienware m18 R1 AMD
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit fd8ed52ecea6b93e23d52cb2758fb4fb4029067f ]
Add DMI entry so the YC machine driver probes on this model and the internal DMIC works.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -514,6 +514,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Alienware" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R1 AMD"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 463/1005 HID: i2c-hid: Add a quirk for a Cirque I2C device.
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Klishko <[email protected]>
[ Upstream commit 1c942462c3969b287a86ab6dbb143324289d564e ]
Cirque touchpads with PID D0C1 generate an error when probed by the I2C HID driver, resulting in no hidraw device created. Adding I2C_HID_QUIRK_NO_IRQ_AFTER_RESET fixes the issue.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/i2c-hid/i2c-hid-core.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -333,6 +333,7 @@#define I2C_VENDOR_ID_CIRQUE 0x0488#define I2C_PRODUCT_ID_CIRQUE_1063 0x1063 +#define I2C_PRODUCT_ID_CIRQUE_D0C1 0xD0C1#define USB_VENDOR_ID_CJTOUCH 0x24b8#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020
drivers/hid/i2c-hid/i2c-hid-core.c +2 -0
@@ -136,6 +136,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_BAD_INPUT_SIZE }, {I2C_VENDOR_ID_CIRQUE ,I2C_PRODUCT_ID_CIRQUE_1063 , I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND }, + { I2C_VENDOR_ID_CIRQUE, I2C_PRODUCT_ID_CIRQUE_D0C1, + I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },/* * Without additional power on command, at least some QTEC devices send garbage */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 464/1005 HID: multitouch: Fix stale MT slots when contact count drops to zero
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Carey <[email protected]>
[ Upstream commit e8e60b6439eed340a611e9d7a5b9bcbd0ef62725 ]
The INGENIC 17EF:6161 touchscreen (Lenovo Yoga Book 9 14IAH10) reports HID_DG_CONTACTCOUNT=0 in the frame immediately following the last finger lift rather than omitting the frame entirely. In mt_touch_report() the existing code only updates num_expected when contact_count is non-zero, so a zero contact count on the first packet of a new frame leaves num_expected at its previous value (e.g. 2 for a two-finger gesture). The sync check "num_received >= num_expected" then evaluates "0 >= 2" and never fires, preventing INPUT_MT_DROP_UNUSED from releasing the stale slots. Those slots remain active in the kernel MT layer until the next touch, at which point they are released in a batch alongside the new contact — causing the userspace event consumer to miss the intervening finger-up sequence and corrupt its gesture session state.
Fix by resetting num_expected to 0 when contact_count is zero and num_received is still 0 (i.e., this is the first and only packet of the frame, not a continuation packet in a multi-packet sequence). With num_expected=0 the sync check "0 >= 0" fires immediately, calling input_mt_sync_frame() which drops the stale slots via INPUT_MT_DROP_UNUSED.
The num_received==0 guard is critical: continuation packets in a multi-packet frame arrive after at least one contact has already been processed (num_received>0), so they are correctly excluded from this path and the existing multi-packet logic is unaffected.
--- drivers/hid/hid-multitouch.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/hid/hid-multitouch.c +8 -11
@@ -1332,21 +1332,18 @@ static void mt_touch_report(struct hid_device *hid,* Includes multi-packet support where subsequent * packets are sent with zero contactcount. */ -if (contact_count >=0 ) { +if (contact_count >0 ) + app->num_expected = contact_count; +else if (app->num_received ==0 && app->prev_scantime != scantime) {/* +* New multi-report frame: +* * For Win8 PTPs the first packet (td->num_received == 0) may * have a contactcount of 0 if there only is a button event. -* We double check that this is not a continuation packet -* of a possible multi-packet frame be checking that the -* timestamp has changed. +* +* Some other devices use a sentinel frame with 0 to release all contacts */ -if ((app->quirks &MT_QUIRK_WIN8_PTP_BUTTONS ) && - app->num_received ==0 && - app->prev_scantime != scantime) - app->num_expected = contact_count; -/* A non 0 contact count always indicates a first packet */ -else if (contact_count) - app->num_expected = contact_count; + app->num_expected =0 ; } app->prev_scantime = scantime;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 465/1005 tpm: tpm_tis_spi: fix nodef CR50 tpm_tis_spi_resume is null
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Jun <[email protected]>
[ Upstream commit b4d1adc70471d0752bba674552d19971ed9fa869 ]
if no define CONFIG_TCG_TIS_SPI_CR50 in config,
the add of tpm_tis_spi_resume is null, this cause the tpm chip to fail to resume.
--- drivers/char/tpm/tpm_tis_spi.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_spi.h +6 -2
@@ -40,8 +40,12 @@ static inline int cr50_spi_probe(struct spi_device *spi) }#endif -#if defined(CONFIG_PM_SLEEP ) && defined(CONFIG_TCG_TIS_SPI_CR50 ) -extern int tpm_tis_spi_resume (struct device *dev); +#if defined(CONFIG_PM_SLEEP ) +#if defined(CONFIG_TCG_TIS_SPI_CR50 ) +extern int tpm_tis_spi_resume (struct device *dev); +#else +#define tpm_tis_spi_resume tpm_tis_resume +#endif #else #define tpm_tis_spi_resume NULL#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 466/1005 tpm: atmel: depend on X86
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 4bfacee94f309346bef0b598ea091088b9150af9 ]
tpm_atmel probes for the chip at fixed x86 Super-I/O ports (0x4e) with inb()/outb(), so it only works on x86. TCG_ATMEL nevertheless depends only on HAS_IOPORT_MAP/HAS_IOPORT, which arm and arm64 also satisfy. There the probe is useless, and on platforms whose unbacked I/O access faults it oopses in init_atmel() at boot (e.g. arm/versatile):
Unable to handle kernel paging request at virtual address fee0004e PC is at init_atmel+0x34/0x244
TCG_NSC and TCG_TIS already "depends on X86" (commit 2f592f2a7d74 ("TPM:
NSC and TIS drivers X86 dependency fix")); TCG_ATMEL was missed. Add the same dependency.
--- drivers/char/tpm/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/tpm/Kconfig +1 -2
@@ -163,8 +163,7 @@ config TCG_NSC config TCG_ATMEL tristate "Atmel TPM Interface" - depends on HAS_IOPORT_MAP - depends on HAS_IOPORT + depends on X86 help If you have a TPM security chip from Atmel say Yes and it will be accessible from within Linux. To compile this driver
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 467/1005 ALSA: usb-audio: Skip mixer creation on M-Audio Venom
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Federico Valentín Andrade <[email protected]>
[ Upstream commit 4c0ec35e011309bd7091053ad5bbc01420967a66 ]
The M-Audio Venom (0763:2084) does not answer any GET_CUR request of its feature units, hanging up the USB microcontroller and "responding" with timeouts. So the mixer building lasts around 47 seconds, and the device does not stream at all.
The same GET_CUR requests issued through libusb (with no kernel driver bound) complete correctly and blazingly fast. So it seems to only happen during the initial probe.
I defined an explicit composite quirk to bypass the mixer creation, as it is not needed (the synth already comes with volume controls).
With both this and the device flag applied, the synth works flawlessly.
--- sound/usb/quirks-table.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
sound/usb/quirks-table.h +22 -0
@@ -1814,6 +1814,28 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ +/* +* M-Audio Venom +* +* The AudioControl interface times out on every GET_CUR request, +* which adds around 47 seconds to the card registration and +* freezes the device, blocking streaming. +* Using an explicit composite quirk to skip the mixer entirely. +*/ +USB_DEVICE_VENDOR_SPEC (0x0763 ,0x2084 ), + QUIRK_DRIVER_INFO { + .vendor_name ="M-Audio" , + .product_name = "Venom", + QUIRK_DATA_COMPOSITE { + { QUIRK_DATA_IGNORE(0) }, + { QUIRK_DATA_STANDARD_AUDIO(1) }, + { QUIRK_DATA_STANDARD_AUDIO(2) }, + { QUIRK_DATA_STANDARD_MIDI(3) }, + QUIRK_COMPOSITE_END + } + } +},/* Casio devices */ {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 468/1005 ASoC: amd: acp3x-es83xx: Add HVY-WXX9/M1060 DMI quirk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Aysel <[email protected]>
[ Upstream commit c1a39c228aceebc0ede83781ea906d257e324009 ]
Add matching DMI table entry for the ES83xx machine driver, so the HUAWEI HVY-WXX9 / M1060 board (MateBook D16 2021, Ryzen 5 4600H) can successfully probe its ES8316 codec via the acp3x-es83xx machine driver, consistent with the existing M1010/M1020/M1040 entries for the same board name.
--- sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +8 -0
@@ -379,6 +379,14 @@ static const struct dmi_system_id acp3x_es83xx_dmi_table[] = { }, .driver_data = (void *)(ES83XX_ENABLE_DMIC), }, + { + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1060"), + }, + .driver_data = (void *)(ES83XX_ENABLE_DMIC), + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 469/1005 ceph: do not cache negative dentries for snapped directories
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit af59562a5b3d34fb3aa7753f2543393578d06dbf ]
When a LOOKUP/LOOKUPSNAP in a snapped directory returns ENOENT without a trace, ceph_finish_lookup() creates a negative dentry via d_add(dentry, NULL). For live directories this is fine — the dentry naturally expires. But for snapped directories, ceph_d_revalidate() unconditionally trusts all cached dentries (valid = 1), so a negative dentry created by a transient error persists forever, hiding entries that genuinely exist in the snapshot.
Only cache negative dentries for live (non-snapshotted) parent directories. For snapped parents, skip the negative dentry so that VFS retries the lookup on the next access. Since the conditions that trigger a negative dentry (MDS transient error, local ENOENT shortcut, or MDS null dentry lease) are all rare in snapped directories, the performance impact of this change is negligible.
--- fs/ceph/dir.c | 10 ++++++++-- fs/ceph/inode.c | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-)
fs/ceph/dir.c +8 -2
@@ -774,8 +774,13 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,d_drop (dentry); err = -ENOENT ; }else { -if (d_unhashed (dentry)) -d_add (dentry,NULL ); +if (d_unhashed (dentry)) { +struct inode *parent = +d_inode (dentry->d_parent); +if (!parent || +ceph_snap (parent) ==CEPH_NOSNAP ) +d_add (dentry,NULL ); + } } } }
@@ -840,6 +845,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, dentry->d_name.len) && !is_root_ceph_dentry(dir, dentry) && ceph_test_mount_opt(fsc, DCACHE) && + ceph_snap(dir) == CEPH_NOSNAP && __ceph_dir_is_complete(ci) && __ceph_caps_issued_mask_metric(ci, CEPH_CAP_FILE_SHARED, 1)) {__ceph_touch_fmode (ci, mdsc,CEPH_FILE_MODE_RD );
fs/ceph/inode.c +2 -1
@@ -1783,7 +1783,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)ceph_dir_clear_ordered (dir);d_delete (dn); }else if (have_lease) { -if (d_unhashed (dn)) +if (d_unhashed (dn) && +ceph_snap (dir) ==CEPH_NOSNAP )d_add (dn,NULL ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 470/1005 ALSA: hda/conexant: Always enable the headset-mic pin on plugin
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Song <[email protected]>
[ Upstream commit 9642a5e843758686e02a7f0d1df9eb0f7f96603c ]
Rename the function to cx_process_headset_detect_plug_type() to reflect that it only reports the detected plug type, and move the pin control write into cx_update_headset_mic_vref() so that node 0x19 is always set to enable the headset mic with the 80% VREF whenever the mic is present, regardless of the type detection result.
--- sound/hda/codecs/conexant.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/hda/codecs/conexant.c +6 -4
@@ -213,7 +213,7 @@ static void cx_remove(struct hda_codec *codec)snd_hda_gen_remove (codec); } -static void cx_process_headset_plugin (struct hda_codec *codec) +static void cx_process_headset_detect_plug_type (struct hda_codec *codec) {unsigned int val;unsigned int count =0 ;
@@ -249,10 +249,12 @@ static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_* Check hp&mic tag to process headset plugin & plugout. */ mic_present =snd_hda_codec_read (codec,0x19 ,0 ,AC_VERB_GET_PIN_SENSE ,0x0 ); -if (!(mic_present &AC_PINSENSE_PRESENCE ))/* mic plugout */ +if (!(mic_present &AC_PINSENSE_PRESENCE )) {/* mic plugout */ snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x20 ); -else -cx_process_headset_plugin (codec); + }else { +cx_process_headset_detect_plug_type (codec); +snd_hda_codec_write (codec,0x19 ,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0x24 ); + } }static int cx_suspend (struct hda_codec *codec)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 471/1005 ASoC: amd: acp-config: Add HVY-WXX9/M1060 DMI quirk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Aysel <[email protected]>
[ Upstream commit 032bb633e0c34a88b70a4bfc65ebd4e2b510f706 ]
Add DMI match table entry for HUAWEI HVY-WXX9 board, product version M1060, a MateBook D16 2021 (Ryzen 5 4600H) revision not covered by the existing M1010/M1020/M1040 entries. This board uses the same FLAG_AMD_LEGACY / ACP_PCI_DEV_ID configuration as the other HVY-WXX9 variants.
--- sound/soc/amd/acp-config.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/soc/amd/acp-config.c +14 -0
@@ -159,6 +159,20 @@ static const struct config_entry config_table[] = { {} }, }, + { + .flags = FLAG_AMD_LEGACY, + .device = ACP_PCI_DEV_ID, + .dmi_table = (const struct dmi_system_id []) { + { + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"HUAWEI" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"HVY-WXX9" ), +DMI_EXACT_MATCH (DMI_PRODUCT_VERSION ,"M1060" ), + }, + }, + {} + }, + }, };static int snd_amd_acp_acpi_find_config (struct pci_dev *pci)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 472/1005 ceph: fix use-after-dereference of NULL ci in __ceph_remove_cap()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiubo Li <[email protected]>
[ Upstream commit a354d7eaa1a57f1532c8072a424cc2d339a73cc0 ]
The NULL check for "ci" in __ceph_remove_cap() was dead code because ci was dereferenced via &ci->netfs.inode before the check, and cap->session was dereferenced via session->s_mdsc->fsc->client even earlier. On a double-remove, both cap->ci and cap->session are set to NULL by the first call, so the second call would crash before ever reaching the guard.
Move ci, session, cl, and inode initializations after the NULL check so that the early-return actually works.
--- fs/ceph/caps.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
fs/ceph/caps.c +10 -7
@@ -1141,18 +1141,21 @@ int ceph_is_any_caps(struct inode *inode)*/ void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release) { -struct ceph_mds_session *session = cap->session; -struct ceph_client *cl = session->s_mdsc->fsc->client; -struct ceph_inode_info *ci = cap->ci; -struct inode *inode = &ci->netfs.inode; +struct ceph_mds_session *session; +struct ceph_client *cl; +struct ceph_inode_info *ci; +struct inode *inode;struct ceph_mds_client *mdsc;int removed =0 ;/* 'ci' being NULL means the remove have already occurred */ -if (!ci) { -doutc (cl,"inode is NULL\n" ); + ci = cap->ci; +if (!ci)return ; - } + + session = cap->session; + cl = session->s_mdsc->fsc->client; + inode = &ci->netfs.inode;lockdep_assert_held (&ci->i_ceph_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 473/1005 netfilter: tproxy: use DEBUG_NET_WARN_ON_ONCE for protocol fallbacks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 1f0391aea883e99d402d0f77ba3530e4e879350d ]
Replace WARN_ON calls with DEBUG_NET_WARN_ON_ONCE in the default switch blocks of nf_tproxy_get_sock_v4 and v6. Unsupported transport protocols are already safely handled by returning a NULL socket pointer. This prevents unnecessary system panics when panic_on_warn=1 is enabled in production systems.
--- net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 +- net/ipv6/netfilter/nf_tproxy_ipv6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/netfilter/nf_tproxy_ipv4.c +1 -1
@@ -137,7 +137,7 @@ nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb, }break ;default : -WARN_ON (1 ); +DEBUG_NET_WARN_ON_ONCE (1 ); sk =NULL ; }
net/ipv6/netfilter/nf_tproxy_ipv6.c +1 -1
@@ -136,7 +136,7 @@ nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff, }break ;default : -WARN_ON (1 ); +DEBUG_NET_WARN_ON_ONCE (1 ); sk =NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 474/1005 ksmbd: handle allocated range queries on dense files
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 350684e0498512d06963858b810101f58563810b ]
FSCTL_QUERY_ALLOCATED_RANGES currently relies on SEEK_DATA and SEEK_HOLE for every file. That works for files with holes, but it is not a good match for dense files.
A zeroed range in a dense file may be represented as an unwritten extent and skipped by SEEK_DATA. The server can then return no allocated ranges even though the file should still be treated as allocated from the protocol point of view.
For dense files, report the requested range clipped to EOF as allocated instead of probing holes. Keep using SEEK_DATA and SEEK_HOLE for files marked with FILE_ATTRIBUTE_SPARSE_FILE, and wait for writeback before probing so punch-hole updates are visible to the filesystem seek implementation.
This fixes the case where a query after zeroing data could return no ranges for a dense file.
--- fs/smb/server/vfs.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
fs/smb/server/vfs.c +26 -3
@@ -1034,7 +1034,8 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length, {struct file *f = fp->filp;struct inode *inode =file_inode (fp->filp); -loff_t maxbytes = (u64 )inode->i_sb->s_maxbytes, end; +loff_t maxbytes = (u64 )inode->i_sb->s_maxbytes, end, query_start; +loff_t query_length, size;loff_t extent_start, extent_end;int ret =0 ;
@@ -1050,11 +1051,33 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,if (length > maxbytes || (maxbytes - length) < start) length = maxbytes - start; -if (start + length > inode->i_size) - length = inode->i_size - start; + size =i_size_read (inode); +if (start >= size) +return 0 ; + +if (!length) +return 0 ; + +if (start + length > size) + length = size - start; *out_count =0 ; + query_start = start; + query_length = length; end = start + length; +if (!(fp->f_ci->m_fattr &FILE_ATTRIBUTE_SPARSE_FILE_LE )) { + ranges[0 ].file_offset =cpu_to_le64 (query_start); + ranges[0 ].length =cpu_to_le64 (query_length); + *out_count =1 ; +return 0 ; + } + +if (start < end) { + ret =file_write_and_wait_range (f, start, end -1 ); +if (ret) +return ret; + } +while (start < end && *out_count < in_count) { extent_start =vfs_llseek (f, start,SEEK_DATA );if (extent_start <0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 475/1005 regmap: irq: Free the irqdomain we create
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 2e42cade8ff1ff579e77976d9869db4df1feaf74 ]
When domain support was added to regmap-irq it was not possible to remove domains, this was added later by 8ee99ada293b (irqdomain: Support removal of IRQ domains.). We did update the main removal path to free the domain but forgot the error unwinding case during creation that is now in regmap_add_irq_chip_fwnode() after some code motion, meaning that errors during instantiation result in an unused irqchip being left hanging around. Add the missing irq_remove_domain() call where the comment says it should be.
--- drivers/base/regmap/regmap-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap-irq.c +1 -1
@@ -941,7 +941,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,return 0 ; err_domain: -/* Should really dispose of the domain but... */ +irq_domain_remove (d->domain); err_mutex:mutex_destroy (&d->lock);lockdep_unregister_key (&d->lock_key);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 476/1005 HID: i2c-hid: Add i2c-hid-quirk-bad-input-size quirk for 0911:5288 device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youth Cao <[email protected]>
[ Upstream commit 58d97b45f3f43af0afd9c74e8480d22d36fd3f72 ]
I have recently acquired a cheap Apollo Lake-based laptop that uses a Hynitron CST128-A touchpad controller. While booting from a Debian LiveCD, the kernel log is flooded with the following error (though the touchpad works well):
i2c_hid_acpi i2c-ALPS0001:00: i2c_hid_get_input: incomplete report (27/42405)
The CST128-A was identified via ACPI as ALPS0001:00, and the I2C HID device ID (0911:5288) was shared with the Hantick 5288.
Add the I2C_HID_QUIRK_BAD_INPUT_SIZE quirk option to the existing Hantick 5288 quirk entry to suppress the kernel log flood.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +1 -1
@@ -123,7 +123,7 @@ static const struct i2c_hid_quirks {__u32 quirks; } i2c_hid_quirks[] = { {I2C_VENDOR_ID_HANTICK ,I2C_PRODUCT_ID_HANTICK_5288 , - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, + I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | I2C_HID_QUIRK_BAD_INPUT_SIZE }, { I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15, I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 477/1005 HID: i2c-hid: add reset quirk for Lenovo Yoga Slim 7x Gen 11 keyboard
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Keri <[email protected]>
[ Upstream commit 39e8e085710a2d36d9ceade11739fb7b87f5aeb0 ]
The ITE controller behind the keyboard of the Lenovo Yoga Slim 7x Gen 11 (048d:83db) carries out a reset but never raises the interrupt that acknowledges it. i2c_hid_finish_hwreset() therefore waits out its full one second timeout and logs "device did not ack reset within 1000 ms" on every probe and every resume, before the keyboard comes up regardless.
Set I2C_HID_QUIRK_NO_IRQ_AFTER_RESET for it, as is already done for several other ITE parts, so the reset is followed by a fixed 100 ms sleep instead.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/i2c-hid/i2c-hid-core.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -737,6 +737,7 @@#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a#define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396#define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_KEYBOARD 0x8987 +#define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD 0x83db#define USB_DEVICE_ID_ITE8595 0x8595#define USB_DEVICE_ID_ITE_MEDION_E1239T 0xce50
drivers/hid/i2c-hid/i2c-hid-core.c +2 -0
@@ -126,6 +126,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | I2C_HID_QUIRK_BAD_INPUT_SIZE }, {I2C_VENDOR_ID_ITE ,I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15 , I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, + { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD, + I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118, I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 478/1005 HID: elecom: Add support for ELECOM M-XT4DRBK (018E)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Berke Durak <[email protected]>
[ Upstream commit f3c2b266b8fd7cf816d36168d19f67e716f2c080 ]
The 2025 revision of the left-handed EX-G wireless trackball (M-XT4DRBK-G) reports USB ID 056e:018e instead of 056e:00fd. Its report descriptor declares an 8-bit button field (Report Count 8) but only five usages (Usage Maximum 5), so the sixth (Fn) button ends up as a duplicate of button 5 and is unusable.
The report descriptor has the same layout as the M-XT3DRBK 018C (button usage maximum at offset 16, button report count at 22, button report size at 24, padding report size at 30), so reuse that fixup.
Rename the existing M_XT4DRBK define to M_XT4DRBK_00FD to match the convention used for the other EX-G revisions.
Tested on a Raspberry Pi 5 with the same fixup in an out-of-tree module on 6.12 (6.12.96+rpt-rpi-2712); all six buttons are reported after the fix, and they work (tested with xev as well).
Report descriptor as sent by the device, pre-fix (056e:018e, 215 bytes):
05 01 09 02 A1 01 09 01 A1 00 85 01 05 09 19 01
29 05 15 00 25 01 95 08 75 01 81 02 95 01 75 00
81 01 05 01 09 30 09 31 16 00 80 26 FF 7F 75 10
95 02 81 06 C0 A1 00 05 01 09 38 15 81 25 7F 75
08 95 01 81 06 C0 A1 00 05 0C 0A 38 02 95 01 75
08 15 81 25 7F 81 06 C0 C0 06 01 FF 09 00 A1 01
85 02 09 00 15 00 26 FF 00 75 08 95 07 81 02 C0
05 0C 09 01 A1 01 85 05 15 00 26 3C 02 19 00 2A
3C 02 75 10 95 01 81 00 C0 05 01 09 80 A1 01 85
03 19 81 29 83 15 00 25 01 95 03 75 01 81 02 95
01 75 05 81 01 C0 06 BC FF 09 88 A1 01 85 04 95
01 75 08 15 00 26 FF 00 19 00 2A FF 00 81 00 C0
06 02 FF 09 02 A1 01 85 06 09 02 15 00 26 FF 00
75 08 95 07 B1 02 C0
--- drivers/hid/hid-elecom.c | 6 ++++-- drivers/hid/hid-ids.h | 3 ++- drivers/hid/hid-quirks.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/hid/hid-elecom.c +4 -2
@@ -79,7 +79,7 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,case USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB :case USB_DEVICE_ID_ELECOM_M_XT3URBK_018F :case USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC : -case USB_DEVICE_ID_ELECOM_M_XT4DRBK : +case USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD :/* * Report descriptor format: * 12: button bit count
@@ -104,6 +104,7 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,mouse_button_fixup (hdev, rdesc, *rsize,12 ,30 ,14 ,20 ,8 );break ;case USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C : +case USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E :/* * Report descriptor format: * 22: button bit count
@@ -148,7 +149,8 @@ static const struct hid_device_id elecom_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT2DRBK) },
drivers/hid/hid-ids.h +2 -1
@@ -466,7 +466,8 @@#define USB_DEVICE_ID_ELECOM_M_XT3URBK_018F 0x018f#define USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC 0x00fc#define USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C 0x018c -#define USB_DEVICE_ID_ELECOM_M_XT4DRBK 0x00fd +#define USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD 0x00fd +#define USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E 0x018e#define USB_DEVICE_ID_ELECOM_M_DT1URBK 0x00fe#define USB_DEVICE_ID_ELECOM_M_DT1DRBK 0x00ff#define USB_DEVICE_ID_ELECOM_M_DT2DRBK 0x018d
drivers/hid/hid-quirks.c +2 -1
@@ -431,7 +431,8 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT2DRBK) },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 479/1005 nvme-fc: do not warn on controller removal race
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit 62b70e6c87121ae5b79ca20c3a5b005590336ec5 ]
In nvme_fc_reconnect_or_delete(), the system attempts to remove the controller when reconnect limits are reached by calling nvme_delete_ctrl(). This call is currently wrapped in a WARN_ON().
If a user concurrently deletes the controller via sysfs, the controller's state may have already transitioned out of the CONNECTING state. When this happens, nvme_delete_ctrl() correctly rejects the operation and returns -EBUSY. Because of the WARN_ON() wrapper, this race condition triggers an unnecessary kernel warning stack trace.
Remove the WARN_ON() macro around nvme_delete_ctrl(); this allows the system to safely ignore the -EBUSY return value if the controller is already being deleted.
--- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/fc.c +1 -1
@@ -3334,7 +3334,7 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) ctrl->cnum,min_t (int, portptr->dev_loss_tmo, (ctrl->ctrl.opts->max_reconnects * ctrl->ctrl.opts->reconnect_delay))); -WARN_ON (nvme_delete_ctrl (&ctrl->ctrl)); +nvme_delete_ctrl (&ctrl->ctrl); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 480/1005 HID: roccat: fix locking in roccat_connect() and roccat_disconnect()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit d76994443eed0af297cb82bd038ae9d76327ef90 ]
Extend critical section in roccat_connect() to ensure that partially initialized 'struct roccat_device' is never exposed in 'devices' list, and do the same in roccat_disconnect() to avoid racy 'devices' access against roccat_release().
--- drivers/hid/hid-roccat.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hid/hid-roccat.c +3 -5
@@ -344,8 +344,6 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int reportreturn temp; } -mutex_unlock (&devices_lock); -init_waitqueue_head (&device->wait);INIT_LIST_HEAD (&device->readers);mutex_init (&device->readers_lock);
@@ -356,6 +354,7 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int report device->cbuf_end =0 ; device->report_size = report_size; +mutex_unlock (&devices_lock);return minor; }EXPORT_SYMBOL_GPL (roccat_connect);
@@ -369,15 +368,12 @@ void roccat_disconnect(int minor)mutex_lock (&devices_lock); device = devices[minor]; -mutex_unlock (&devices_lock); device->exist =0 ;/* TODO exist maybe not needed */ device_destroy (device->dev->class,MKDEV (roccat_major, minor)); -mutex_lock (&devices_lock); devices[minor] =NULL ; -mutex_unlock (&devices_lock);if (device->open) {hid_hw_close (device->hid);
@@ -385,6 +381,8 @@ void roccat_disconnect(int minor) }else {roccat_free_device (device); } + +mutex_unlock (&devices_lock); }EXPORT_SYMBOL_GPL (roccat_disconnect);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 481/1005 scsi: devinfo: Add BLIST_SKIP_IO_HINTS for EMC Symmetrix
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ewan D. Milne <[email protected]>
[ Upstream commit f06a44e235ef188689ba23ffc72e9e89b10951a9 ]
EMC Symmetrix returns an error on MODE SENSE for page 0Ah subpage 05h because it does not implement the SBC-5 I/O hints. These commands began to be sent as a result of commit 4f53138fffc2 ("scsi: sd: Translate data lifetime information"). Add BLIST_SKIP_IO_HINTS to avoid sending these commands because in large configurations the failed commands are displacing other useful information in internal error logs.
--- drivers/scsi/scsi_devinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_devinfo.c +1 -1
@@ -161,7 +161,7 @@ static struct { {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* EMC CLARiiON, no storage on LUN 0 */ {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | - BLIST_REPORTLUN2 | BLIST_RETRY_ITF}, + BLIST_REPORTLUN2 | BLIST_RETRY_ITF | BLIST_SKIP_IO_HINTS}, {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN}, {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN},
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 482/1005 ASoC: amd: yc: Add Lenovo ThinkPad E16 Gen 2 (21JN) to quirks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Adachi <[email protected]>
[ Upstream commit 4cae4ca34992d210d115e8e891f1e88c9df5f24c ]
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -234,6 +234,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "21J6"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "21JN"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 483/1005 gpio: mvebu: keep resume masks within the irqchip cache
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 02af7eac17bc62a72335c1fc8c4af4471654f6cc ]
mvebu_gpio_resume() writes the edge/level mask registers saved at suspend time straight back to hardware, bypassing the irqchip's mask_cache_priv. genirq skips mask_irq() for a line it already considers masked, so restoring a bit in hardware that genirq thinks is still masked leaves that line unmasked behind genirq's back. An asserted level line then has nobody to ack it, and the moment interrupts are re-enabled the chained handler storms, hanging resume.
AND the restored mask values with the matching irqchip mask cache so only lines genirq currently considers unmasked are unmasked again. Read the caches under gc->lock to keep them consistent with the mask/unmask handlers.
Tested on Helios4 (armhf): 5 suspend cycles woken by magic packet, no hang; mvebu_gpio_resume() returns in 6 usecs.
--- drivers/gpio/gpio-mvebu.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
drivers/gpio/gpio-mvebu.c +27 -6
@@ -1006,6 +1006,8 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state)static int mvebu_gpio_resume (struct platform_device *pdev) {struct mvebu_gpio_chip *mvchip =platform_get_drvdata (pdev); +u32 edge_cache = ~0U , level_cache = ~0U ; +unsigned long flags;int i; regmap_write(mvchip->regs, GPIO_OUT_OFF + mvchip->offset,
@@ -1017,32 +1019,51 @@ static int mvebu_gpio_resume(struct platform_device *pdev)regmap_write (mvchip->regs,GPIO_IN_POL_OFF + mvchip->offset, mvchip->in_pol_reg); +/* +* genirq skips mask_irq() for a line it already considers masked, so +* unmasking one behind its back leaves an asserted level line that +* nobody masks. Restore only bits the irqchip cache still has set. +* +* Snapshot the caches under the raw spinlock, but release it before +* the regmap writes below: regmap_write() takes a sleepable lock on +* PREEMPT_RT. +*/ +if (mvchip->domain) { +struct irq_chip_generic *gc; + + gc =irq_get_domain_generic_chip (mvchip->domain,0 ); +raw_spin_lock_irqsave (&gc->lock, flags); + level_cache = gc->chip_types[0 ].mask_cache_priv; + edge_cache = gc->chip_types[1 ].mask_cache_priv; +raw_spin_unlock_irqrestore (&gc->lock, flags); + } +switch (mvchip->soc_variant) {case MVEBU_GPIO_SOC_VARIANT_ORION :case MVEBU_GPIO_SOC_VARIANT_A8K :regmap_write (mvchip->regs,GPIO_EDGE_MASK_OFF + mvchip->offset, - mvchip->edge_mask_regs[0 ]); + mvchip->edge_mask_regs[0 ] & edge_cache);regmap_write (mvchip->regs,GPIO_LEVEL_MASK_OFF + mvchip->offset, - mvchip->level_mask_regs[0 ]); + mvchip->level_mask_regs[0 ] & level_cache);break ;case MVEBU_GPIO_SOC_VARIANT_MV78200 :for (i =0 ; i <2 ; i++) {regmap_write (mvchip->regs,GPIO_EDGE_MASK_MV78200_OFF (i), - mvchip->edge_mask_regs[i]); + mvchip->edge_mask_regs[i] & edge_cache);regmap_write (mvchip->regs,GPIO_LEVEL_MASK_MV78200_OFF (i), - mvchip->level_mask_regs[i]); + mvchip->level_mask_regs[i] & level_cache); }break ;case MVEBU_GPIO_SOC_VARIANT_ARMADAXP :for (i =0 ; i <4 ; i++) {regmap_write (mvchip->regs,GPIO_EDGE_MASK_ARMADAXP_OFF (i), - mvchip->edge_mask_regs[i]); + mvchip->edge_mask_regs[i] & edge_cache);regmap_write (mvchip->regs,GPIO_LEVEL_MASK_ARMADAXP_OFF (i), - mvchip->level_mask_regs[i]); + mvchip->level_mask_regs[i] & level_cache); }break ;default :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 484/1005 sfc: add X4D PF support
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Moreton <[email protected]>
[ Upstream commit 24fedc7a569bce181728f0dd616504bef9f1513b ]
X4D is an X4 controller instance as an IP block in an SoC. It has the same feature set as X4.
--- drivers/net/ethernet/sfc/efx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/sfc/efx.c +4 -0
@@ -903,6 +903,10 @@ static const struct pci_device_id efx_pci_table[] = { .driver_data = (unsigned long)&efx_x4_nic_type}, {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x2c03), /* X4 PF (FF only) */ .driver_data = (unsigned long)&efx_x4_nic_type}, + {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x8c03), /* X4D PF (FF/LL) */ + .driver_data = (unsigned long)&efx_x4_nic_type}, + {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0xac03), /* X4D PF (FF only) */ + .driver_data = (unsigned long)&efx_x4_nic_type}, {0} /* end of list */ };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 485/1005 ASoC: amd: yc: Add DMI quirk for Lenovo V15 G6 ARP
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Ortiz <[email protected]>
[ Upstream commit d395e1b62d9694f2e4add9122f8d473eacd374aa ]
The Lenovo V15 G6 ARP (product name 83UU) uses the ACP6x PDM interface for its internal digital microphone array. Its firmware exposes neither the AcpDmicConnected _DSD property nor the _WOV method, so acp6x_probe() falls through to the DMI check and returns -ENODEV, leaving acp_yc_mach.0 unbound and no capture device registered.
Add a DMI quirk entry for this model. With it, the machine driver binds and the DMIC capture device is created:
acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC support via DMI card 2: acp6x [acp6x], device 0: DMIC capture dmic-hifi-0
Capture was verified working with arecord and PipeWire.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -374,6 +374,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "83Q3"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83UU"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 486/1005 HID: universal-pidff: Add support for Turtle Beach VelocityOne Race
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 53f7f7955a684e820bdd6bd6792c45c4b434f637 ]
Add usb VID and device PID to hid-ids.h
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-universal-pidff.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -1415,6 +1415,9 @@#define USB_DEVICE_ID_ASUS_MD_5110 0x5110#define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 +#define USB_VENDOR_ID_TURTLE_BEACH 0x10f5 +#define USB_DEVICE_ID_TB_VELOCITYONE_RACE 0x7077 +#define USB_VENDOR_ID_TWINHAN 0x6253#define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100
drivers/hid/hid-universal-pidff.c +1 -0
@@ -187,6 +187,7 @@ static const struct hid_device_id universal_pidff_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_LA_PRIMA) }, { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_TONY_KANAAN) }, + { HID_USB_DEVICE(USB_VENDOR_ID_TURTLE_BEACH, USB_DEVICE_ID_TB_VELOCITYONE_RACE)}, {} };MODULE_DEVICE_TABLE (hid, universal_pidff_devices);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 487/1005 HID: Intel-thc-hid: Intel-quickspi: Fix buffer overflow
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Even Xu <[email protected]>
[ Upstream commit a1cdd72371270640bd357bd3e3b2ec0be17c9536 ]
The input buffers are used to store complete HID-over-SPI packets, including their protocol headers. However, their sizes are currently calculated from the payload length only.
Allocate enough space for both the payload and the packet header to prevent a buffer overflow when the payload reaches its maximum size.
--- drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c +2 -1
@@ -549,7 +549,8 @@ static int quickspi_alloc_report_buf(struct quickspi_device *qsdev) max_input_len =max (le16_to_cpu (qsdev->dev_desc.rep_desc_len),le16_to_cpu (qsdev->dev_desc.max_input_len)); - qsdev->input_buf =devm_kzalloc (qsdev->dev, max_input_len,GFP_KERNEL ); + qsdev->input_buf =devm_kzalloc (qsdev->dev, +HIDSPI_INPUT_BODY_SIZE (max_input_len),GFP_KERNEL );if (!qsdev->input_buf)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 488/1005 HID: Intel-thc-hid: Intel-quicki2c: Fix buffer overflow
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Even Xu <[email protected]>
[ Upstream commit 5e5c3b9db1c5910d6a9175c97b76a95566e4dc32 ]
The input and output buffers are used to store complete HID-over-I2C packets, including their protocol headers. However, their sizes are currently calculated from the payload length only.
Allocate enough space for both the payload and the packet header to prevent a buffer overflow when the payload reaches its maximum size.
--- drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +4 -2
@@ -586,7 +586,8 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev)*/ max_report_len =max (le16_to_cpu (qcdev->dev_desc.max_input_len),SZ_4K ); - qcdev->input_buf =devm_kzalloc (qcdev->dev, max_report_len,GFP_KERNEL ); + qcdev->input_buf =devm_kzalloc (qcdev->dev, +HIDI2C_PACKET_LEN (max_report_len),GFP_KERNEL );if (!qcdev->input_buf)return -ENOMEM ;
@@ -596,7 +597,8 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev) max_report_len =max (le16_to_cpu (qcdev->dev_desc.max_output_len), max_report_len); - qcdev->report_buf =devm_kzalloc (qcdev->dev, max_report_len,GFP_KERNEL ); + qcdev->report_buf =devm_kzalloc (qcdev->dev, +HIDI2C_PACKET_LEN (max_report_len),GFP_KERNEL );if (!qcdev->report_buf)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 489/1005 ASoC: Intel: bytcr_rt5651: Add quirk for Chuwi Hi8 with generic DMI strings
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jasper Firth <[email protected]>
[ Upstream commit c5a8fc2abe05cf6db71f57ff0177fddc59861a1a ]
Some Chuwi Hi8 tablets with model number CWI513 ship with a BIOS (American Megatrends 5.11, dated 05/21/2016) whose DMI sys_vendor and product_name are both "Default string". The tested unit is labelled just "Hi8", but its model number is the same as the existing "Chuwi Hi8 Pro (CWI513)" entry, and it needs the same quirks. That entry matches on sys_vendor "Hampoo" and product_name "X1D3_C806N", so it never applies to these units.
Without its quirks the internal speaker, whose amplifier has a differential input wired across LOUT left and right, cancels to a faint distorted residual for any centred (L == R) content, and the headphone channels are swapped.
Add an entry matching board_vendor "Hampoo" and board_name "Cherry Trail CR", plus the BIOS date since those two are too generic on their own. drivers/platform/x86/touchscreen_dmi.c already matches the Chuwi HiBook the same way.
The quirks are those of the existing Hi8 Pro entry, except for the over-current detection scale factor: 1.0 instead of the 0.75 from BYT_RT5651_DEFAULT_QUIRKS. With 0.75 and a CTIA headset (inline mic and one button), loud speech into the mic, and headphone playback coupling onto the mic line, were reported as spurious KEY_PLAYPAUSE presses, one of them held for a whole 8 second speech window. With 1.0 the same test gave no spurious events, and 3 real button presses were reported as exactly 3 press/release pairs.
Tested on a unit with the generic DMI strings, with a module built from this patch and no quirk module parameter. The quirks were applied via the new entry, the card components read "cfg-spk:1 cfg-mic:in2 cfg-hp:lrswap", and the following all work: speaker, headphone left/right order, jack and headset-mic detection, headset button, and the internal and headset mics.
The problem was diagnosed with the help of an AI coding assistant, which also drafted this changelog.
--- sound/soc/intel/boards/bytcr_rt5651.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/soc/intel/boards/bytcr_rt5651.c +17 -0
@@ -409,6 +409,23 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {BYT_RT5651_HP_LR_SWAPPED | BYT_RT5651_MONO_SPEAKER), }, + { +/* Chuwi Hi8 (CWI513) with a BIOS using generic DMI strings */ + .callback = byt_rt5651_quirk_cb, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Hampoo" ), +DMI_MATCH (DMI_BOARD_NAME ,"Cherry Trail CR" ), +/* Above matches are too generic, add bios-date match */ + DMI_MATCH(DMI_BIOS_DATE, "05/21/2016"), + }, + .driver_data = (void *)(BYT_RT5651_MCLK_EN | +BYT_RT5651_JD1_1 | +BYT_RT5651_OVCD_TH_2000UA | +BYT_RT5651_OVCD_SF_1P0 | +BYT_RT5651_IN2_MAP | +BYT_RT5651_HP_LR_SWAPPED | + BYT_RT5651_MONO_SPEAKER), + }, {/* Chuwi Vi8 Plus (CWI519) */ .callback = byt_rt5651_quirk_cb,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 490/1005 nvme-tcp: delay nvme_tcp_reclassify_socket()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 447a7a3026eda85ac2738cbe6ee5ab066a39dad0 ]
Commit 841aee4d75f1 ("nvme-tcp: lockdep: annotate in-kernel sockets") introduced nvme_tcp_reclassify_socket() to resolve a lockdep WARN by distinguishing userspace sockets from nvme-tcp sockets. After that, TLS encryption support was introduced to nvme-tcp and it added another lock dependency on userspace socket handling by tlshd, which resulted in a new lockdep WARN. This WARN was hidden by the commit 19bdb70c77d3 ("nvme-tcp: lockdep: use dynamic lockdep keys per socket instance"). However, it turned out the commit 19bdb70c77d3 has a bug of lockdep key lifetime management, and it is to be reverted by another patch in this series. After the revert, the WARN was unveiled and observed at the blktests test case nvme/062:
WARNING: possible circular locking dependency detected
7.3.0-rc2+ #455 Tainted: G W
------------------------------------------------------
tlshd/75867 is trying to acquire lock:
ffffffff91ada5e0 (fs_reclaim){+.+.}-{0:0}, at: __kmalloc_cache_noprof+0x64/0x6d0
but task is already holding lock:
ffff888197808258 (sk_lock-AF_INET-NVME){+.+.}-{0:0}, at: do_tcp_setsockopt+0x499/0x26a0
which lock already depends on the new lock.
To fix the lockdep WARN caused by the TLS encryption support, delay the reclassification of the nvme-tcp sockets. Currently the reclassification happens before the TLS handshake starts, which pulls in the additional lock dependencies related to tlshd. Reclassify the sockets after the TLS handshake instead, to cut that dependency.
--- drivers/nvme/host/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +2 -1
@@ -1859,7 +1859,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, }sk_net_refcnt_upgrade (queue->sock->sk); -nvme_tcp_reclassify_socket (queue->sock);/* Single syn retry */ tcp_sock_set_syncnt (queue->sock->sk,1 );
@@ -1948,6 +1947,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, goto err_init_connect; } +nvme_tcp_reclassify_socket (queue->sock); + ret =nvme_tcp_init_connection (queue);if (ret) goto err_init_connect;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 491/1005 docs: update the unmount propagation rule
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 3f5dc09141a7bfe286620a6869d1d70ffe32d6b8 ]
Section 5f still describes the rule propagate_umount() used before commit f0d0ba19985d ("Rewrite of propagate_umount()"). It states that a mount that receives the unmount by propagation is left alone as soon as it has any submount. That's not true anymore.
A propagated unmount unmounts a mount with sub-mounts as long as every sub-mount gets unmounted together with it. This is the case when the sub-mounts are unmounted by the same propagation. Only a sub-mount that cannot be unmounted keeps its parent mounted.
The section also only describes a single mount without sub-mounts. But lazy unmounts take a tree and every mount of the tree propagates its unmount from its parent mount.
--- Documentation/filesystems/sharedsubtree.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
Documentation/filesystems/sharedsubtree.rst +14 -6
@@ -564,8 +564,8 @@ f) Unmount semantics where 'A' is a mount mounted on mount 'B' at dentry 'b'. If mount 'B' is shared, then all most-recently-mounted mounts at dentry - 'b' on mounts that receive propagation from mount 'B' and does not have - sub-mounts within them are unmounted. + 'b' on mounts that receive propagation from mount 'B' are unmounted as + well, if every mount below them is also unmounted. Example: Let's say 'B1', 'B2', 'B3' are shared mounts that propagate to each other.
@@ -584,10 +584,18 @@ f) Unmount semantics So all 'C1', 'C2' and 'C3' should be unmounted. - If any of 'C2' or 'C3' has some child mounts, then that mount is not - unmounted, but all other mounts are unmounted. However if 'C1' is told - to be unmounted and 'C1' has some sub-mounts, the umount operation is - failed entirely. + If any of 'C2' or 'C3' has a child mount that cannot be unmounted + then that mount is not unmounted. But all other mounts are unmounted. + A child mount that is itself unmounted by the same unmount + propagation does not keep its parent mounted. However if 'C1' is + supposed to be unmounted and 'C1' has some sub-mounts, the unmount + fails. + + A lazy umount (MNT_DETACH) takes a whole tree. Every mount of the + tree then propagates its unmount from its own parent as described + above, so the mounts that receive propagation lose the corresponding + trees as well. Documentation/filesystems/propagate_umount.txt has the + precise rules, including the ones for locked mounts. g) Clone Namespace
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 492/1005 ALSA: hda/realtek: Limit internal mic boost on HP Pavilion 15 (103c:2164)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hernan Ganzo <[email protected]>
[ Upstream commit 786fb6b3f513937f712db5a9ba6a12cbc6982ba9 ]
The HP Pavilion 15 with the ALC3227 codec (SSID 103c:2164) exposes the full four-step internal mic boost on pin 0x12: nsteps=3 with stepsize=0x2f, that is 0, 12, 24 and 36 dB. Combined with the ADC capture gain of +30 dB the analogue cascade reaches 66 dB, and the internal microphone clips on the ambient noise of a quiet room; the upper two steps are unusable at any useful input level. This is the defect class ALC269_FIXUP_LIMIT_INT_MIC_BOOST exists for.
The machine matches no SSID quirk and falls through to the pin table, which selects ALC269_FIXUP_HP_MUTE_LED_MIC1 through a pin signature shared with several other HP models. Add an SSID entry instead, using ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED: the existing fixup that applies alc269_fixup_limit_int_mic_boost() and chains to the same mute LED fixup, as already done for 103c:218b. The boost becomes 0 or 12 dB and the LED handling is unchanged.
Tested on the affected machine by selecting the same fixup through the model string (snd-hda-intel.model), which bypasses the SSID and pin tables, with the driver confirming the selection:
snd_hda_codec_alc269 hdaudioC1D0: ALC3227: picked fixup limit-mic-boost (model specified)
With that, Internal Mic Boost reports Limits 0 - 1 (0 or 12 dB) instead of 0 - 3 (0 to 36 dB), so alc269_fixup_limit_int_mic_boost() clamps this codec's internal mic pin as intended. Note that /proc/asound/card1/codec#0 keeps printing the unclamped hardware caps (nsteps=0x03): that file reads codec parameters uncached by design, while the fixup overrides the driver's cached parameter that the control is built from.
This does not by itself make the default capture volume sane -- the remaining 12 dB on top of the +30 dB ADC gain is still hotter than this machine's usable operating point. It removes the two unusable steps from the hardware range, which is what a quirk of this class can do.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6707,6 +6707,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x164b ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x1586 ,"HP" ,ALC269_FIXUP_HP_MUTE_LED_MIC2 ),SND_PCI_QUIRK (0x103c ,0x18e6 ,"HP" ,ALC269_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x2164 ,"HP Pavilion 15 Notebook PC" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x218b ,"HP" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x21f9 ,"HP" ,ALC269_FIXUP_HP_MUTE_LED_MIC1 ), SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 493/1005 ALSA: usb-audio: Add mixer mapping for MSI MAG B850M MORTAR WIFI
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Bojanowski <[email protected]>
[ Upstream commit 7b457ae8cf711831f19d20963f5ed2fdf4842d3a ]
The USB audio device 0db0:cc78 (Realtek ALC4080) on the MSI MAG B850M MORTAR WIFI motherboard exposes all playback controls as "PCM", which makes it hard to tell the outputs apart.
Its mixer layout matches the one of the MSI MPG X570S Carbon Max Wifi (units 29, 30 and 32), so reuse msi_mpg_x570s_carbon_max_wifi_alc4080_map for this device too. With the mapping applied, the controls show up as "Speaker", "Front Headphone" and "IEC958".
Tested with a patched snd-usb-audio module on a 7.2.7 kernel.
--- sound/usb/mixer_maps.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/usb/mixer_maps.c +4 -0
@@ -718,6 +718,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x0db0, 0xa073), .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, }, + {/* MSI MAG B850M MORTAR WIFI */ + .id = USB_ID(0x0db0, 0xcc78), + .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, + }, {/* MSI TRX40 */ .id = USB_ID(0x0db0, 0x543d), .map = trx40_mobo_map,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 494/1005 ALSA: hda/realtek: Add quirk for Lenovo ThinkBook 16p Gen 3 ARH (21EK)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: KIM MinWoo <[email protected]>
[ Upstream commit 3867e38b2d4b844d89076f988c7b9741c87a9858 ]
The ThinkBook 16p Gen 3 ARH (SSID 17aa:3871) has a TI TAS2563 amplifier device on I2C, exposed by ACPI as INT8866, the same arrangement as the Yoga 7 14ARB7 (SSID 17aa:3870). Without a quirk, the codec falls back to the vendor-wide Lenovo quirk (ALC269_FIXUP_LENOVO_XPAD_ACPI), the amplifier is never bound, and the internal speakers stay silent while the headphone output works.
Reuse the Yoga 7 14ARB7 fixup, which binds the INT8866 device as a side codec. ALC287_FIXUP_TAS2781_I2C does not work on this machine because it looks for a TIAS2781 device.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7527,6 +7527,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {HDA_CODEC_QUIRK (0x17aa ,0x38a7 ,"Legion Pro 7 16ARX8H" ,ALC287_FIXUP_TAS2781_I2C ),/* this must match before PCI SSID 17aa:386f below */ SND_PCI_QUIRK (0x17aa ,0x386f ,"Legion Pro 7i 16IAX7" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3870 ,"Lenovo Yoga 7 14ARB7" ,ALC287_FIXUP_YOGA7_14ARB7_I2C ), +SND_PCI_QUIRK (0x17aa ,0x3871 ,"Lenovo ThinkBook 16p Gen 3 ARH" ,ALC287_FIXUP_YOGA7_14ARB7_I2C ),SND_PCI_QUIRK (0x17aa ,0x3874 ,"Legion 7i 16IAX7" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3877 ,"Lenovo Legion 7 Slim 16ARHA7" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 495/1005 ALSA: hda/realtek: Add quirk for Lenovo ThinkBook G8+
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit 4322ac247f4ce7932edbd46aa37f3dae62cde424 ]
Fix Bass Speaker volume control on Lenovo ThinkBook G8+ by adding quirk 17aa:38dc with ALC285_FIXUP_SPEAKER2_TO_DAC1.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7572,6 +7572,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x38d5 ,"Yoga S990-16 Pro IMH YC Quad" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38d6 ,"Yoga S990-16 Pro IMH VECO Quad" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38d7 ,"Lenovo Yoga 9 14IMH9" ,ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x38dc ,"Lenovo ThinkBook G8" ,ALC285_FIXUP_SPEAKER2_TO_DAC1 ),SND_PCI_QUIRK (0x17aa ,0x38df ,"Yoga Y990 Intel YC Dual" ,ALC287_FIXUP_TAS2781_I2C ),SND_PCI_QUIRK (0x17aa ,0x38e0 ,"Yoga Y990 Intel VECO Dual" ,ALC287_FIXUP_TAS2781_I2C ), SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 496/1005 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 15-ec1xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Banha <[email protected]>
[ Upstream commit 775aa96c310d59f3d15a6e5a9bd1796fd1ba95ec ]
The mute LED on the HP Pavilion Gaming Laptop 15-ec1xxx (103c:87b2) does not work automatically. Add the ALC285_FIXUP_HP_MUTE_LED quirk to fix this behavior.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6822,6 +6822,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8786 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x8787 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x8788 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x87b2 ,"HP Pavilion Gaming Laptop 15-ec1xxx" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x87b7 ,"HP Laptop 14-fq0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x87cb, "HP Pavilion 15-eg0xxx", ALC287_FIXUP_HP_GPIO_LED),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 497/1005 ALSA: hda/realtek: Add quirk for HP ENVY 13-aq1xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tarun Noonemunthala <[email protected]>
[ Upstream commit a01a223bd685be42e908d970de32eeb3646097f3 ]
The HP ENVY Laptop 13-aq1xxx (PCI SSID 103c:86ad) uses an ALC285 codec with two speaker pairs: front (pin 0x14) and bottom (pin 0x17).
The BIOS leaves pin 0x14 as [N/A] ("not connected"), so the generic parser never enables the front pair and only the bottom speakers are audible. The vendor driver (RTKVHD64.sys) programs that pin with the value 0x90170150 and runs the HP amplifier initialization, which is already implemented in the driver as ALC285_FIXUP_HP_GPIO_AMP_INIT.
Add a board fixup that applies the pin configuration for 0x14 and chains to the existing amplifier init fixup.
The pin value was recovered from the vendor driver's own configuration data. The patch and this changelog were prepared with an AI coding assistant (see the Assisted-by tag below); the change was reviewed and tested by the submitter on the affected machine.
Tested on an HP ENVY 13-aq1xxx by rebuilding snd-hda-codec-alc269 from the Fedora 7.1.10 source and loading it: the codec now reports "line_outs=2 (0x14/0x17)", pin 0x14 comes up as an output (Pin-ctls 0x40) with its amplifier unmuted, and both speaker pairs play.
--- sound/hda/codecs/realtek/alc269.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/hda/codecs/realtek/alc269.c +11 -0
@@ -3774,6 +3774,7 @@ enum {ALC285_FIXUP_HP_SPECTRE_X360_EB1 ,ALC285_FIXUP_HP_SPECTRE_X360_DF1 ,ALC285_FIXUP_HP_ENVY_X360 , +ALC285_FIXUP_HP_ENVY_13AQ ,ALC288_FIXUP_DELL_HEADSET_MODE ,ALC288_FIXUP_DELL1_MIC_NO_PRESENCE , ALC288_FIXUP_DELL_XPS_13,
@@ -5981,6 +5982,15 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, }, + [ALC285_FIXUP_HP_ENVY_13AQ] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x14 ,0x90170150 },/* front speakers */ + { } + }, + .chained = true, + .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, + }, [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_ideapad_s740_coef,
@@ -6794,6 +6804,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x864f ,"HP Laptop 15-dy0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x869d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x86ad ,"HP ENVY 13-aq1xxx" ,ALC285_FIXUP_HP_ENVY_13AQ ),SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ), SND_PCI_QUIRK(0x103c, 0x86c8, "HP Laptop 14s-dr1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 498/1005 ALSA: hda/realtek: Add mute LED quirk for HP Victus 15-fb2xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krish Gulati <[email protected]>
[ Upstream commit c748c42abb9b549fc79c41ea55e1f220eadb60ec ]
The HP Victus 15-fb2xxx (PCI SSID 103c:8c2f) with the ALC245 codec does not turn on the mute LED when audio is muted.
Add a quirk entry to enable it.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7004,6 +7004,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8c17 ,"HP Spectre x360 2-in-1 Laptop 16-aa0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX ),SND_PCI_QUIRK (0x103c ,0x8c21 ,"HP Pavilion Plus Laptop 14-ey0XXX" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x8c2d ,"HP Victus 15-fa1xxx (MB 8C2D)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ), +SND_PCI_QUIRK (0x103c ,0x8c2f ,"HP Victus 15-fb2xxx" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8c30 ,"HP Victus 15-fb1xxx" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ),SND_PCI_QUIRK (0x103c ,0x8c3f ,"HP Victus 15-fa1xxx (MB 8C3F)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ), SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 499/1005 ALSA: hda/realtek: Add quirk for Acer Nitro AN515-45
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit 0d90a929836344f1d3b39f22f08ccecc62378a59 ]
The Acer Nitro AN515-45 requires ALC2XX_FIXUP_HEADSET_MIC to make the headset microphone work properly.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6615,6 +6615,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x142b ,"Acer Swift SF314-42" ,ALC255_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x1430 ,"Acer TravelMate B311R-31" ,ALC256_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x1466 ,"Acer Aspire A515-56" ,ALC255_FIXUP_ACER_HEADPHONE_AND_MIC ), +SND_PCI_QUIRK (0x1025 ,0x151e ,"Acer Nitro AN515-45" ,ALC2XX_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1025 ,0x1534 ,"Acer Predator PH315-54" ,ALC255_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x1539 ,"Acer Nitro 5 AN515-57" ,ALC2XX_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 500/1005 ALSA: hda/realtek: Fix speakers on ASUS PM3406CHA
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhtasham Nawr al-Mahmud <[email protected]>
[ Upstream commit 0eee030c2c09c7a44be778de5f451d9e7a2f09c1 ]
The ASUS ExpertBook PM3406CHA uses an ALC256 codec with subsystem ID 1043:1664. On Linux boot, the internal speakers are silent even though playback is routed to the codec and the speaker pin is configured for output.
The codec starts with coefficient 0x10 set to 0x1d20. Writing 0x7f20 to coefficient 0x10 immediately restores internal speaker output.
This was reproduced on the affected hardware from a fresh boot using hda-verb. Reducing a larger initialization sequence showed that this coefficient write alone is sufficient; no GPIO, EAPD, pin-control, or other coefficient changes are required. After applying the coefficient in userspace, speaker output also remains functional across suspend and resume.
Add a machine-specific HDA fixup that writes the required coefficient.
The fixup has been compile-tested, but could not be boot-tested because the affected hardware is no longer available.
--- sound/hda/codecs/realtek/alc269.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/hda/codecs/realtek/alc269.c +10 -0
@@ -3678,6 +3678,7 @@ enum {ALC269_FIXUP_SONY_VAIO ,ALC275_FIXUP_SONY_VAIO_GPIO2 ,ALC269_FIXUP_DELL_M101Z , +ALC256_FIXUP_ASUS_PM3406CHA ,ALC269_FIXUP_SKU_IGNORE ,ALC269_FIXUP_ASUS_G73JW , ALC269_FIXUP_ASUS_N7601ZM_PINS,
@@ -4089,6 +4090,14 @@ static const struct hda_fixup alc269_fixups[] = { {} } }, + [ALC256_FIXUP_ASUS_PM3406CHA] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x10 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x7f20 }, + {} + } + }, [ALC269_FIXUP_SKU_IGNORE] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_sku_ignore,
@@ -7184,6 +7193,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1652 ,"ASUS ROG Zephyrus Do 15 SE" ,ALC289_FIXUP_ASUS_ZEPHYRUS_DUAL_SPK ),SND_PCI_QUIRK (0x1043 ,0x1662 ,"ASUS GV301QH" ,ALC294_FIXUP_ASUS_DUAL_SPK ),SND_PCI_QUIRK (0x1043 ,0x1663 ,"ASUS GU603ZI/ZJ/ZQ/ZU/ZV" ,ALC285_FIXUP_ASUS_HEADSET_MIC ), +SND_PCI_QUIRK (0x1043 ,0x1664 ,"ASUS ExpertBook PM3406CHA" ,ALC256_FIXUP_ASUS_PM3406CHA ),SND_PCI_QUIRK (0x1043 ,0x1683 ,"ASUS UM3402YAR" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x16a3 ,"ASUS UX3402VA" ,ALC245_FIXUP_CS35L41_SPI_2 ), SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 501/1005 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 14-dv1001TU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: renpanpan <[email protected]>
[ Upstream commit ece609abc95cc0f75e633d93f3d868b030d9a8fe ]
The HP Pavilion 14-dv1001TU (subsystem ID 103c:8987) uses a Realtek ALC287 codec. The mute LED on this machine is controlled by GPIO bit 0x10, which was verified via hda-verb, but the subsystem ID is missing from the quirk table. As a result, the ALC287_FIXUP_HP_GPIO_LED fixup that drives GPIO 0x10 is never applied and the mute LED stays off even though the associated LED class device toggles correctly.
Add the missing SND_PCI_QUIRK entry to map this subsystem ID to ALC287_FIXUP_HP_GPIO_LED so the mute LED works as expected.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6902,6 +6902,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8975 ,"HP EliteBook x360 840 Aero G9" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x897d ,"HP mt440 Mobile Thin Client U74" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8981 ,"HP Elite Dragonfly G3" ,ALC245_FIXUP_CS35L41_SPI_4 ), +SND_PCI_QUIRK (0x103c ,0x8987 ,"HP Pavilion 14-dv1001TU" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x898a ,"HP Pavilion 15-eg100" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x898e ,"HP EliteBook 835 G9" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 502/1005 usb: mtu3: Fix double dereference in TP_printk
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Murzin <[email protected]>
[ Upstream commit cfb3293c4573289f11f913611f530ea6b1926d67 ]
Paul reported kernel splat:
[ 0.000000] TRACE EVENT ERROR: Event mtu3_gadget_ep_set_halt has double dereference in TP_printk: &REC->gpd_ring->dma [ 0.000000] ------------[ cut here ]------------ [ 0.000000] Event mtu3_gadget_ep_set_halt has double dereference in TP_printk: &REC->gpd_ring->dma [ 0.000000] WARNING: kernel/trace/trace_events.c:420 at test_double_dereference+0x144/0x14c, CPU#0: swapper/0/0 [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 7.3.0-rc1 #15247 PREEMPT [ 0.000000] Hardware name: linux,dummy-virt (DT) [ 0.000000] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.000000] pc : test_double_dereference+0x144/0x14c [ 0.000000] lr : test_double_dereference+0x144/0x14c [ 0.000000] sp : ffffc80aa7633bf0 [ 0.000000] x29: ffffc80aa7633bf0 x28: ffffc80aa7c0f047 x27: 000508b58019388f [ 0.000000] x26: 0000000000000003 x25: 0000000000000007 x24: ffffc80aa5fceff8 [ 0.000000] x23: ffffc80aa7c0f05a x22: ffffc80aa64edfe8 x21: ffffc80aa7c0fce8 [ 0.000000] x20: ffffc80aa7c0f047 x19: 0000000000000013 x18: 0000000000000001 [ 0.000000] x17: 6572656420656c62 x16: 756f642073616820 x15: 746c61685f746573 [ 0.000000] x14: 0000000000000000 x13: ffff000139d90000 x12: 0000000000000045 [ 0.000000] x11: 00000000000000cf x10: ffff00013f546428 x9 : ffff000139d90000 [ 0.000000] x8 : 3fffffffffffc000 x7 : 0000000000000001 x6 : 0000000000000001 [ 0.000000] x5 : ffff00013f4e6440 x4 : 0000000000000000 x3 : 0000000000000000 [ 0.000000] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffc80aa764a700 [ 0.000000] Call trace: [ 0.000000] test_double_dereference+0x144/0x14c (P) [ 0.000000] trace_event_raw_init+0x37c/0x5d8 [ 0.000000] event_init+0x34/0xc0 [ 0.000000] trace_event_init+0xec/0x588 [ 0.000000] trace_init+0x24/0x6e0 [ 0.000000] start_kernel+0x4a0/0x8ec [ 0.000000] __primary_switched+0x88/0x90 [ 0.000000] irq event stamp: 0 [ 0.000000] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [ 0.000000] hardirqs last disabled at (0): [<0000000000000000>] 0x0 [ 0.000000] softirqs last enabled at (0): [<0000000000000000>] 0x0 [ 0.000000] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] TRACE EVENT ERROR: Event mtu3_gadget_ep_disable has double dereference in TP_printk: &REC->gpd_ring->dma [ 0.000000] TRACE EVENT ERROR: Event mtu3_gadget_ep_enable has double dereference in TP_printk: &REC->gpd_ring->dma
Which also observed by Mark and myself.
The splat it result of new check introduced by b5cc230af5e5 ("tracing:
Warn when an event dereferences a pointer in TP_printk()") which correctly catches issue with %pad dereferencing the address saved in the ring buffer. TP_fast_assign() logic gets executed when the tracepoint is triggered, however the TP_printk() is executed when the user reads the trace buffer which could be seconds, minutes, hours, days, even months later and nothing guarantee that __entry->gpd_ring pointer will still be pointing to what it was when it was recorded.
Fix the issue by capturing immediate value of gpd_ring.dma when trace point is triggered.
--- drivers/usb/mtu3/mtu3_trace.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/mtu3/mtu3_trace.h +3 -1
@@ -224,6 +224,7 @@ DECLARE_EVENT_CLASS(mtu3_log_ep, __field(unsigned int, flags) __field(unsigned int, direction) __field(struct mtu3_gpd_ring *, gpd_ring) + __field(dma_addr_t, gpd_ring_dma) ),TP_fast_assign ( __assign_str(name);
@@ -235,12 +236,13 @@ DECLARE_EVENT_CLASS(mtu3_log_ep, __entry->flags = mep->flags; __entry->direction = mep->is_in; __entry->gpd_ring = &mep->gpd_ring; + __entry->gpd_ring_dma = mep->gpd_ring.dma ), TP_printk("%s: type %s maxp %d slot %d mult %d burst %d ring %p/%pad flags %c:%c%c%c:%c", __get_str(name), usb_ep_type_string(__entry->type), __entry->maxp, __entry->slot, __entry->mult, __entry->maxburst, - __entry->gpd_ring, &__entry->gpd_ring->dma, + __entry->gpd_ring, &__entry->gpd_ring_dma, __entry->flags & MTU3_EP_ENABLED ? 'E' : 'e', __entry->flags & MTU3_EP_STALL ? 'S' : 's', __entry->flags & MTU3_EP_WEDGE ? 'W' : 'w',
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 503/1005 net: usb: qmi_wwan: add Rolling Wireless RN947R
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reinhard Speyerer <[email protected]>
[ Upstream commit 7375d38364a9aa66fb31716bcefef38aecad75d8 ]
Add Rolling Wireless RN947R 0x9300 composition:
DIAG + ADB + NMEA + MODEM + RMNET + QDSS + ADPL
T: Bus=01 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=33f8 ProdID=9300 Rev= 0.00 S: Manufacturer=Rolling Wireless S: Product=RN947R S: SerialNumber=xxxxxxxxxxx C:* #Ifs= 7 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#=21 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#=22 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1453,6 +1453,7 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_SET_DTR(0x1546, 0x1312, 4)}, /* u-blox LARA-R6 01B */ {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET */ + {QMI_QUIRK_SET_DTR(0x33f8, 0x9300, 8)}, /* Rolling RN947R RMNET */ {QMI_FIXED_INTF(0x2dee, 0x4d22, 5)}, /* MeiG Smart SRM825L */ {QMI_QUIRK_SET_DTR(0x2dee, 0x4d63, 0)}, /* MeiG SRM813Q w/ Modem(PPP) */ {QMI_QUIRK_SET_DTR(0x2dee, 0x4d64, 0)}, /* MeiG SRM813Q w/ NMEA */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 504/1005 ALSA: hda/realtek: Add quirk for ASRock NUC BOX-358H
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eckhart Mohr <[email protected]>
[ Upstream commit 9a44b828dd7c0be1d0d6d6cf178d9727ceb6da6e ]
Fix headphone jack detection for some devices
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7640,6 +7640,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x9e56 ,"Lenovo ZhaoYang CF4620Z" ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1849 ,0x0269 ,"Positivo Master C6400" ,ALC269VB_FIXUP_ASUS_ZENBOOK ),SND_PCI_QUIRK (0x1849 ,0x1233 ,"ASRock NUC Box 1100" ,ALC233_FIXUP_NO_AUDIO_JACK ), +SND_PCI_QUIRK (0x1849 ,0x6256 ,"ASRock NUC Box 358H" ,ALC233_FIXUP_NO_AUDIO_JACK ),SND_PCI_QUIRK (0x1849 ,0xa233 ,"Positivo Master C6300" ,ALC269_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1854 ,0x0440 ,"LG CQ6" ,ALC256_FIXUP_HEADPHONE_AMP_VOL ), SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 505/1005 ALSA: hda/realtek: Add ALC235 support for headset mode
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zeyu Li <[email protected]>
[ Upstream commit 9ee4266827cfb67b9fbb89136ea6a8f3d7809f5c ]
The ALC235 (0x10ec0235) is registered as the ALC255 codec variant in patch_alc269(), but the headset mode functions were missing a case for it, so the CTIA/OMTP jack type detection and routing never ran on this codec. As a result, a plugged-in headset is detected (jack presence works) but the microphone signal is never routed, leaving the capture stream permanently silent.
Verified on an ASUS M5451GA laptop (HDA:10ec0235,10431814): with the ALC255 coef sequence applied, the headset microphone works correctly.
--- sound/hda/codecs/realtek/realtek.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/hda/codecs/realtek/realtek.c +6 -0
@@ -1305,6 +1305,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) }switch (codec->core.vendor_id) { +case 0x10ec0235 :case 0x10ec0255 :alc_process_coef_fw (codec, coef0255);break ;
@@ -1420,6 +1421,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, };switch (codec->core.vendor_id) { +case 0x10ec0235 :case 0x10ec0255 :alc_write_coef_idx (codec,0x45 ,0xc489 );snd_hda_set_pin_ctl_cache (codec, hp_pin,0 );
@@ -1575,6 +1577,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)alc_process_coef_fw (codec, coef0225);alc_hp_enable_unmute (codec,75 );break ; +case 0x10ec0235 :case 0x10ec0255 :alc_process_coef_fw (codec, coef0255);break ;
@@ -1676,6 +1679,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) };switch (codec->core.vendor_id) { +case 0x10ec0235 :case 0x10ec0255 :alc_process_coef_fw (codec, coef0255);break ;
@@ -1793,6 +1797,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) };switch (codec->core.vendor_id) { +case 0x10ec0235 :case 0x10ec0255 :alc_process_coef_fw (codec, coef0255);break ;
@@ -1894,6 +1899,7 @@ static void alc_determine_headset_type(struct hda_codec *codec) }switch (codec->core.vendor_id) { +case 0x10ec0235 :case 0x10ec0255 :alc_process_coef_fw (codec, coef0255);msleep (300 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 506/1005 spi: cadence-qspi: Fix status polling with octal DTR chips
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit fd99864b0ac936e870c7ae28354c5cd3dad5efd0 ]
Most SPI NOR chips today use 0x05 as ReaD Status Register (RDSR) opcode. After almost every transaction, the core will wait for the said transation to be digested by the chip by polling its status register. This mechanism has been automated by certain chips, such as the Cadence QSPI controller. Unfortunately, the feature has been disabled for various (relevant) reasons. Disabling this feature has been done by setting WRITE_COMPLETION_CTRL_REG.DISABLE_POLLING_FLD, keeping the rest of the register intact. In this same register, there is also a field named WRITE_COMPLETION_CTRL_REG.OPCODE_FLD, which by default also contains 0x05, as primary RDSR opcode.
As a result, both the SPI NOR and SPI NAND cores, primary users through spi-mem of the spi_mem_ops interface, do send their own RDSR. In this driver, such command goes through one of the fifth possible data path specifically crafted for short register-like commands, named STIG. In STIG mode, the opcode of the operation is written to OSPI_FLASH_CMD_CTRL_REG. This means that the opcode field of STIG configuration and the opcode field of the automatic polling configuration contain the same value.
Unfortunately, the TRM explains in two different places that this configuration is forbidden, without explaining why it is problematic:
$12.4.2.4.11 OSPI Software-Triggered Instruction Generator (STIG)
``` OSPI_FLASH_CMD_CTRL_REG[31-24] CMD_OPCODE_FLD bits should be set different than OSPI_DEV_INSTR_RD_CONFIG_REG[7-0] RD_OPCODE_NON_XIP_FLD and OSPI_DEV_INSTR_WR_CONFIG_REG[7-0] WR_OPCODE_FLD. ```
and
$12.4.2.5.2 Configuring the OSPI Controller for Optimal Use
``` When using the OSPI Controller, the opcodes in OSPI_DEV_INSTR_RD_CONFIG_REG[7-0] RD_OPCODE_NON_XIP_FLD, OSPI_DEV_INSTR_WR_CONFIG_REG[7-0] WR_OPCODE_FLD and OSPI_WRITE_COMPLETION_CTRL_REG[7-0] OPCODE_FLD bit fields shall not match the opcode in the OSPI_FLASH_CMD_CTRL_REG[31-24] CMD_OPCODE_FLD bit field. ```
For some reasons, this is only unveiled now when testing in ODTR mode. Plain SDR modes work flawlessly with the same chips. One possible reason for this, is that the internal data path in ODTR mode is very different due to the extra opcode extension/repetition which may be interpreted differently (this is a wild guess). For sure there is an interference, as even the TRM states that there is some magic happening:
$12.4.2.4.13 OSPI Command Translation
``` The WREN and the RDSR device instructions are the only ones that are sent by the controller under the hood. ```
I cannot probe the bus when the problem arises, so I don't know exactly what is sent on the bus. Practically speaking, the chip was driving the lines low (reading all 0s), which is not the usual default state when the chip is not driving the lines (all 1s). Other people on the mailing list claimed successfully using ODTR chips with this controller. My take here is that either they were using a variant of the IP without write completion at all (there is a quirk for it), or they were using chips slightly more flexible about their opcode sequency or maybe with different addr/dummy requirements.
Clearing the WRITE_COMPLETION_CTRL_REG.OPCODE_FLD while disabling write completion polling entirely seems the best compromise.
--- drivers/spi/spi-cadence-quadspi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi-cadence-quadspi.c +1 -2
@@ -1058,8 +1058,7 @@ static int cqspi_write_setup(struct cqspi_flash_pdata *f_pdata,* care of polling the status register. */ if (cqspi->wr_completion) { - reg =readl (reg_base +CQSPI_REG_WR_COMPLETION_CTRL ); - reg |=CQSPI_REG_WR_DISABLE_AUTO_POLL ; + reg =CQSPI_REG_WR_DISABLE_AUTO_POLL ;writel (reg, reg_base +CQSPI_REG_WR_COMPLETION_CTRL );/* * DAC mode require auto polling as flash needs to be polled
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 507/1005 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 15-eg3xxx (103c:8bfd)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaidheer Sirigineedi <[email protected]>
[ Upstream commit 13dffca9043500ed6033d770b491a043fb952bc5 ]
The mute LED on the HP Pavilion Laptop 15-eg3xxx (PCI SSID 103c:8bfd, Realtek ALC287) does not work because the machine has no entry in the quirk table. No fixup is applied, so the mute LED is never driven, even though the mute function itself works.
The LED is controlled via GPIO pin 4 (mask 0x10), which is exactly what ALC287_FIXUP_HP_GPIO_LED configures. This was verified on the hardware with hda-verb: setting the GPIO data bit lights the mute LED, and clearing it turns the LED off.
hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x10 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIRECTION 0x10
hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x10 # LED on
hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00 # LED off
Add a quirk entry for 103c:8bfd using ALC287_FIXUP_HP_GPIO_LED.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7010,6 +7010,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8be8 ,"HP Envy 17" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8be9 ,"HP Envy 15" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8bf0 ,"HP" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8bfd ,"HP Pavilion 15-eg3xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8c15 ,"HP Spectre x360 2-in-1 Laptop 14-eu0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX ),SND_PCI_QUIRK (0x103c ,0x8c16 ,"HP Spectre x360 2-in-1 Laptop 16-aa0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX ), SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 508/1005 ALSA: usb-audio: Add native DSD support for Cambridge Audio streamers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matus Gajdos <[email protected]>
[ Upstream commit 4e1462e7cd6a9b920f441842726cc2b9d232673e ]
The Cambridge Audio streamer advertises the UAC2 RAW_DATA format on altsetting 2 of its playback interface, but without the DSD_RAW quirk flag the driver exposes it only as a SPECIAL format that cannot be used.
Add QUIRK_FLAG_DSD_RAW for the device (USB ID 22e8:ca10), so the altsetting is exposed as DSD_U32_BE, enabling native DSD64/128/256 playback.
Tested with: gst-launch-1.0 filesrc location=file.dsf ! \
avdemux_dsf ! dsdconvert ! \
alsasink device=hw:2,0--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2379,6 +2379,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_DSD_RAW),DEVICE_FLG (0x21b4 ,0x0232 ,/* Ayre QX-5 Twenty */ QUIRK_FLAG_DSD_RAW ), +DEVICE_FLG (0x22e8 ,0xca10 ,/* Cambridge Audio streamers */ +QUIRK_FLAG_DSD_RAW ),DEVICE_FLG (0x2522 ,0x0007 ,/* LH Labs Geek Out HD Audio 1V5 */ QUIRK_FLAG_SET_IFACE_FIRST ), DEVICE_FLG(0x262a, 0x9302, /* ddHiFi TC44C */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 509/1005 drm/amdgpu/gfx12: set KMD_QUEUE for kernel gfx queues
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Zhang <[email protected]>
[ Upstream commit 9fe5745f9d8eca38d31d9b672a1998edf856f651 ]
Set KMD_QUEUE in the GFX MQD and kernel ring control registers so CP preserves kernel IB VMIDs instead of replacing them with the queue VMID. Use prop->kernel_queue to distinguish kernel and user MQDs.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2 -0
@@ -2733,6 +2733,7 @@ static int gfx_v12_0_cp_gfx_resume(struct amdgpu_device *adev) rb_bufsz =order_base_2 (ring->ring_size /8 ); tmp =REG_SET_FIELD (0 ,CP_RB0_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,RB_BLKSZ , rb_bufsz -2 ); + tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,KMD_QUEUE ,1 );WREG32_SOC15 (GC ,0 , regCP_RB0_CNTL, tmp);/* Initialize the ring buffer's write pointers */
@@ -3025,6 +3026,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 ); + tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,KMD_QUEUE , prop->kernel_queue);#ifdef __BIG_ENDIAN tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,BUF_SWAP ,1 );#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 510/1005 drm/amdgpu/gfx11: set KMD_QUEUE for kernel gfx queues
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Zhang <[email protected]>
[ Upstream commit 8228688eb40cc116127e80394cb8157417854c70 ]
Set KMD_QUEUE in the GFX MQD and kernel ring control registers so CP preserves kernel IB VMIDs instead of replacing them with the queue VMID. Use prop->kernel_queue to distinguish kernel and user MQDs.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -0
@@ -3737,6 +3737,7 @@ static int gfx_v11_0_cp_gfx_resume(struct amdgpu_device *adev) rb_bufsz =order_base_2 (ring->ring_size /8 ); tmp =REG_SET_FIELD (0 ,CP_RB0_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,RB_BLKSZ , rb_bufsz -2 ); + tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,KMD_QUEUE ,1 );WREG32_SOC15 (GC ,0 , regCP_RB0_CNTL, tmp);/* Initialize the ring buffer's write pointers */
@@ -4145,6 +4146,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 ); + tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,KMD_QUEUE , prop->kernel_queue);#ifdef __BIG_ENDIAN tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,BUF_SWAP ,1 );#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 511/1005 RISC-V: errata: Add SiFive MAL-9092 workaround
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yong-Xuan Wang <[email protected]>
[ Upstream commit 148ab873d8194cb44f29474da3b4428fa2e100d1 ]
SiFive cores with MAL-9092 require fence.rw instructions around HLV/HLVX/HSV hypervisor instructions to ensure proper memory ordering when accessing guest memory.
Note that HSTATUS.HU is cleared during KVM initialization, restricting hypervisor instructions to HS-mode only. If future changes enable HSTATUS.HU for U-mode access, additional errata considerations will be needed.
--- arch/riscv/Kconfig.errata | 14 ++++++++++++++ arch/riscv/errata/sifive/errata.c | 20 ++++++++++++++++++++ arch/riscv/include/asm/errata_list_vendors.h | 3 ++- arch/riscv/include/asm/insn-def.h | 16 +++++++++++++--- 4 files changed, 49 insertions(+), 4 deletions(-)
arch/riscv/Kconfig.errata +14 -0
@@ -95,6 +95,20 @@ config ERRATA_STARFIVE_JH7100 Say "Y" if you want to support the BeagleV Starlight and/or StarFive VisionFive V1 boards. +config ERRATA_SIFIVE_MAL_9092 + bool "Apply SiFive HLV/HLVX/HSV fence errata" + depends on ERRATA_SIFIVE && 64BIT + default y + help + This will apply the SiFive MAL-9092 errata to add fence.rw + instructions around all HLV/HLVX/HSV instructions. + + Note: HSTATUS.HU is cleared during KVM initialization. If future + changes enable HSTATUS.HU to allow hypervisor instructions in + U-mode, additional errata handling may be required. + + If you don't know what to do here, say "Y". + config ERRATA_THEAD bool "T-HEAD errata" depends on RISCV_ALTERNATIVE
arch/riscv/errata/sifive/errata.c +20 -0
@@ -51,6 +51,22 @@ static bool errata_cip_1200_check_func(unsigned long arch_id, unsigned long impreturn true; } +static bool errata_mal_9092_check_func (unsigned long arch_id,unsigned long impid) +{ +/* +* Affected cores: +* Architecture ID: 0x8000000000000109 +* Implementation ID: 0x19251031, 0x19251217, 0x19260320 +*/ + +if (arch_id !=0x8000000000000109 ) +return false; +if (impid !=0x19251031 && impid !=0x19251217 && impid !=0x19260320 ) +return false; + +return true; +} +static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER ] = { { .name ="cip-453" ,
@@ -60,6 +76,10 @@ static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER] = { .name = "cip-1200", .check_func = errata_cip_1200_check_func }, + { + .name = "mal-9092", + .check_func = errata_mal_9092_check_func + }, }; static u32 __init_or_module sifive_errata_probe(unsigned long archid,
arch/riscv/include/asm/errata_list_vendors.h +2 -1
@@ -11,7 +11,8 @@#ifdef CONFIG_ERRATA_SIFIVE #define ERRATA_SIFIVE_CIP_453 0#define ERRATA_SIFIVE_CIP_1200 1 -#define ERRATA_SIFIVE_NUMBER 2 +#define ERRATA_SIFIVE_MAL_9092 2 +#define ERRATA_SIFIVE_NUMBER 3#endif #ifdef CONFIG_ERRATA_THEAD
arch/riscv/include/asm/insn-def.h +13 -3
@@ -191,18 +191,28 @@INSN_R (OPCODE_SYSTEM ,FUNC3 (0 ),FUNC7 (49 ), \ __RD(0), RS1(gaddr), RS2(vmid)) +#define ALT_SIFIVE_MAL_9092_FENCE \ +ALTERNATIVE("nop", "fence rw, rw", SIFIVE_VENDOR_ID, \ + ERRATA_SIFIVE_MAL_9092, CONFIG_ERRATA_SIFIVE_MAL_9092) +#define HLVX_HU (dest, addr) \ + ALT_SIFIVE_MAL_9092_FENCE "\n" \ INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(50), \ - RD(dest), RS1(addr), __RS2(3)) + RD(dest), RS1(addr), __RS2(3)) "\n" \ + ALT_SIFIVE_MAL_9092_FENCE#define HLV_W (dest, addr) \ + ALT_SIFIVE_MAL_9092_FENCE "\n" \ INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(52), \ - RD(dest), RS1(addr), __RS2(0)) + RD(dest), RS1(addr), __RS2(0)) "\n" \ + ALT_SIFIVE_MAL_9092_FENCE#ifdef CONFIG_64BIT #define HLV_D (dest, addr) \ + ALT_SIFIVE_MAL_9092_FENCE "\n" \ INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(54), \ - RD(dest), RS1(addr), __RS2(0)) + RD(dest), RS1(addr), __RS2(0)) "\n" \ + ALT_SIFIVE_MAL_9092_FENCE#else #define HLV_D (dest, addr) \ __ASM_STR(.error "hlv.d requires 64-bit support")
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 512/1005 regmap: Remove debugfs before cache teardown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Reeves <[email protected]>
[ Upstream commit 834035934cef9e60169de682f4dc9feafd49e51a ]
regmap_exit() and regmap_reinit_cache() destroy the register cache before removing debugfs. A concurrent debugfs cache operation can therefore access cache state after the backend exit callback starts freeing it.
Remove debugfs before cache teardown, and clear the debugfs pointer after removal. During cache reinitialization, recreate debugfs only after the new cache initializes successfully.
--- drivers/base/regmap/regmap-debugfs.c | 1 + drivers/base/regmap/regmap.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/base/regmap/regmap-debugfs.c +1 -0
@@ -657,6 +657,7 @@ void regmap_debugfs_exit(struct regmap *map) {if (map->debugfs) {debugfs_remove_recursive (map->debugfs); + map->debugfs =NULL ;mutex_lock (&map->cache_lock);regmap_debugfs_free_dump_cache (map);mutex_unlock (&map->cache_lock);
drivers/base/regmap/regmap.c +9 -6
@@ -1424,8 +1424,8 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) {int ret; -regcache_exit (map);regmap_debugfs_exit (map); +regcache_exit (map); map->max_register = config->max_register; map->max_register_is_set = map->max_register ?: config->max_register_is_0;
@@ -1441,12 +1441,16 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)if (ret)return ret; -regmap_debugfs_init (map); - map->cache_bypass = false; map->cache_only = false; -return regcache_init (map, config); + ret =regcache_init (map, config); +if (ret) +return ret; + +regmap_debugfs_init (map); + +return 0 ; }EXPORT_SYMBOL_GPL (regmap_reinit_cache);
@@ -1460,9 +1464,8 @@ void regmap_exit(struct regmap *map)struct regmap_async *async;regmap_detach_dev (map->dev, map); -regcache_exit (map); -regmap_debugfs_exit (map); +regcache_exit (map);regmap_range_exit (map);if (map->bus && map->bus->free_context) map->bus->free_context (map->bus_context);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 513/1005 nbcon/reboot: Switch NBCON consoles into the emergency mode in emergency_restart()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Mladek <[email protected]>
[ Upstream commit d8e5fc3002294a28af53e97f6c83a35956e738f3 ]
When the system is going down a normal way, the NBCON kthreads are flushed and stopped properly via a syscore shutdown callback, see printk_kthreads_shutdown().
One missing piece is emergency_restart() where the kthreads are not stopped. It might be called from several non-panic code paths, e.g. sysrq-o, kdb_reboot(), or some watchdogs.
Fix it by explicitly entering the emergency (atomic) mode and trying to flush the consoles there.
Note that printk_trigger_flush() must be used instead of pr_flush() because the later is not safe in an atomic context.
--- kernel/reboot.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/reboot.c +9 -0
@@ -8,6 +8,7 @@#define pr_fmt (fmt) "reboot: " fmt#include <linux/atomic.h> +#include <linux/console.h> #include <linux/ctype.h> #include <linux/export.h> #include <linux/kexec.h>
@@ -94,6 +95,14 @@ void emergency_restart(void) {kmsg_dump (KMSG_DUMP_EMERG ); system_state =SYSTEM_RESTART ; + +/* +* NBCON kthreads won't be flushed and stopped properly in +* the emergency restart. Move them to the atomic mode. +*/ +nbcon_cpu_emergency_enter (); +printk_trigger_flush (); +machine_emergency_restart (); }EXPORT_SYMBOL_GPL (emergency_restart);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 514/1005 Revert "namei: dont reveal overmounted entries in refwalk"
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 214897acc8c2e5d6b63189d23ccaed6fa2af45a9 ]
This reverts commit 8189ab688f5a2c745dc90b63374da02f213d6994.
This bug class is bigger than can be fixed with this simple patch. Back out of it and give us some time to fix this properly.
--- fs/namei.c | 29 ----------------------------- 1 file changed, 29 deletions(-)
fs/namei.c +0 -29
@@ -1973,33 +1973,6 @@ static const char *pick_link(struct nameidata *nd, struct path *link,return NULL ; } -/* -* Be careful in case the dentry is unlinked or renamed. Any mounts -* stacked on top of it are going away. We need to make sure that we -* don't reveal the underyling dentry during refwalk. In rcuwalk we -* catch this via d_seq and another lookup for the name. Give the same -* guarantee in refwalk. -*/ -static bool unlink_may_reveal (struct nameidata *nd,int flags, -struct path *path,struct dentry *dentry) -{ -/* ".." and LOOKUP_DOWN may land on an unhashed directory */ -if (flags &WALK_NOFOLLOW ) -return false; -if (nd->flags &LOOKUP_REVAL ) -return false; -/* We crossed onto a mount and the name led us here while it still existed */ -if (path->mnt != nd->path.mnt) -return false; -/* only a name on its way out is flagged */ -if (likely (!cant_mount (dentry))) -return false; -if (!d_unlinked (dentry)) -return false; -dput (no_free_ptr (path->dentry)); -return true; -} -/* * Do we need to follow links? We _really_ want to be able * to do this check without having to look at inode->i_op,
@@ -2028,8 +2001,6 @@ static const char *step_into(struct nameidata *nd, int flags,if (unlikely (!inode))return ERR_PTR (-ENOENT ); }else { -if (unlikely (unlink_may_reveal (nd, flags, &path, dentry))) -return ERR_PTR (-ESTALE );dput (nd->path.dentry);if (nd->path.mnt != path.mnt)mntput (nd->path.mnt);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 515/1005 media: em28xx: use video_unregister_device for radio_dev
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohinthan P <[email protected]>
[ Upstream commit 2579cbe68005f46fc7f8f95364f6b101b07b9d1c ]
Commit 7c8bf63b7937 ("media: em28xx: use vb2_video_unregister_device") converted device unregistrations in em28xx to use vb2_video_unregister_device() instead of video_unregister_device().
However, radio devices do not have an associated videobuf2 queue (v4l2->radio_dev.queue is NULL). Calling vb2_video_unregister_device() on a radio device triggers a WARNING in vb2_video_unregister_device():
!vdev->queue
WARNING: drivers/media/common/videobuf2/videobuf2-v4l2.c:1264 at vb2_video_unregister_device+0x1f8/0x200
Call Trace:
em28xx_v4l2_init+0x1c39/0x3150 drivers/media/usb/em28xx/em28xx-video.c:3085As documented in vb2_video_unregister_device(), video_unregister_device() should be used instead when vdev->queue is NULL.
Revert to calling video_unregister_device() for v4l2->radio_dev in both em28xx_v4l2_fini() and the em28xx_v4l2_init() error unwind path.
--- drivers/media/usb/em28xx/em28xx-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/em28xx/em28xx-video.c +2 -2
@@ -2243,7 +2243,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev)if (video_is_registered (&v4l2->radio_dev)) {dev_info (&dev->intf->dev,"V4L2 device %s deregistered\n" ,video_device_node_name (&v4l2->radio_dev)); -vb2_video_unregister_device (&v4l2->radio_dev); +video_unregister_device (&v4l2->radio_dev); }if (video_is_registered (&v4l2->vbi_dev)) { dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n",
@@ -2901,7 +2901,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)dev_info (&dev->intf->dev,"V4L2 device %s deregistered\n" ,video_device_node_name (&v4l2->radio_dev)); -vb2_video_unregister_device (&v4l2->radio_dev); +video_unregister_device (&v4l2->radio_dev); }if (video_is_registered (&v4l2->vbi_dev)) { dev_info(&dev->intf->dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 516/1005 ARM: 9524/1: mm: align hugetlb mappings to the huge page size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
commit 1eb87d8f77379d4e4b279487b8c859fb64bd1afb upstream.
mmap(MAP_HUGETLB) on 32-bit Arm can return an address which is not aligned to the huge page size. In a QEMU virt guest, unmapping the VMA then hits the alignment check in __unmap_hugepage_range():
kernel BUG at mm/hugetlb.c:5213!
Internal error: Oops - BUG: 0 [#1] SMP ARM PC is at __unmap_hugepage_range+0x540/0x584 LR is at __zap_vma_range+0x13a0/0x1410
Commit 7bd3f1e1a9ae ("mm: make hugetlb mappings go through mm_get_unmapped_area_vmflags") made hugetlb mappings use the architecture's arch_get_unmapped_area(). The generic implementations handle hugetlb alignment, but the Arm implementations only account for the optional SHMLBA cache-colouring constraint. A 4 KiB-page kernel can therefore align the mapping to 4 KiB or 16 KiB instead of the required 2 MiB.
Set the alignment mask from the file's hstate for hugetlb mappings in both Arm implementations. Huge-page alignment also satisfies the SHMLBA constraint.
--- arch/arm/mm/mmap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mm/mmap.c +9 -2
@@ -11,6 +11,7 @@#include <linux/io.h> #include <linux/personality.h> #include <linux/random.h> +#include <linux/hugetlb.h> #include <asm/cachetype.h> #define COLOUR_ALIGN (addr,pgoff) \
@@ -72,7 +73,10 @@ arch_get_unmapped_area(struct file *filp info.length = len; info.low_limit = mm->mmap_base; info.high_limit =TASK_SIZE ; - info.align_mask = do_align ? (PAGE_MASK & (SHMLBA -1 )) :0 ; +if (filp &&is_file_hugepages (filp)) + info.align_mask =huge_page_mask_align (filp); +else + info.align_mask = do_align ? (PAGE_MASK & (SHMLBA -1 )) :0 ; info.align_offset = pgoff <<PAGE_SHIFT ;return vm_unmapped_area (&info); }
@@ -123,7 +127,10 @@ arch_get_unmapped_area_topdown(struct fi info.length = len; info.low_limit =FIRST_USER_ADDRESS ; info.high_limit = mm->mmap_base; - info.align_mask = do_align ? (PAGE_MASK & (SHMLBA -1 )) :0 ; +if (filp &&is_file_hugepages (filp)) + info.align_mask =huge_page_mask_align (filp); +else + info.align_mask = do_align ? (PAGE_MASK & (SHMLBA -1 )) :0 ; info.align_offset = pgoff <<PAGE_SHIFT ; addr =vm_unmapped_area (&info);
Greg Kroah-Hartman
maintainerPATCH 517/1005 blk-crypto: fix NULL deref and UAF in __blk_crypto_evict_key()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit c8c53d669d4e45b3a804013251a34387d7e11bfb upstream.
Sashiko reported a possible NULL pointer dereference, triggered by the following flow:
dm-inlinecrypt ctor # first use of the fallback
├─ blk_crypto_init_key() # succeeds, ctx->key.size != 0
├─ blk_crypto_start_using_key()
│ ├─ hw-wrapped key: -EOPNOTSUPP
│ │ # profile never allocated (NULL)
│ └─ raw key: fallback_start_using_mode()
│ └─ blk_crypto_fallback_init() fails
│ └─ kfree(profile) # not NULLed
├─ goto bad
└─ inlinecrypt_dtr() # evicts whenever key.size is set
└─ blk_crypto_evict_key()
└─ blk_crypto_config_supported_natively() = false
└─ blk_crypto_fallback_evict_key()
└─ __blk_crypto_evict_key(blk_crypto_fallback_profile)
└─ profile->num_slots # BOOM!!!This issue can be reproduced using the following commands:
dd if=/dev/zero of=/tmp/backing bs=1M count=64
LOOP=$(losetup -f --show /tmp/backing)
SZ=$(blockdev --getsz $LOOP)
KEY=$(head -c 64 /dev/urandom | od -An -tx1 | tr -d ' \n')
dmsetup create ic --table "0 $SZ inlinecrypt aes-xts-plain64 \
$KEY 0 $LOOP 0 1 keytype:hw-wrapped"And the following oops is triggered:
==================================================================
blk-crypto: loop0: no support for wrapped keys
Oops: general protection fault, probably for non-canonical address
0xdffffc000000000b: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000058-0x000000000000005f]
CPU: 5 UID: 0 PID: 901 Comm: dmsetup 7.3.0-rc3 #1 PREEMPT(lazy)
RIP: 0010:__blk_crypto_evict_key+0x2e/0x3b0
Call Trace:
blk_crypto_evict_key+0x24c/0x320
inlinecrypt_dtr+0xf6/0x160
inlinecrypt_ctr+0x2d3/0xbd0
dm_table_add_target+0x661/0xf40
table_load+0x1c4/0x490
ctl_ioctl+0x32f/0x5f0
dm_ctl_ioctl+0xe/0x20
==================================================================dm-inlinecrypt is the only caller that can evict a key that was never started, as fscrypt frees such a key without evicting it.
Fix this by returning early from blk_crypto_fallback_evict_key() when tfms_inited[] is not set for the key's mode. tfms_inited[] is only set after blk_crypto_fallback_init() has successfully initialized the profile, so the crash above is no longer reachable.
The bug has been latent since commit c984ff1423ae ("blk-crypto:
dynamically allocate fallback profile") was merged in v6.5, and only became actually triggerable when commit e7f57d2c47e2 ("dm-inlinecrypt:
add target for inline block device encryption") was merged in v7.2.
--- block/blk-crypto-fallback.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/blk-crypto-fallback.c +6 -0
@@ -465,6 +465,12 @@ bool blk_crypto_fallback_bio_prep(structint blk_crypto_fallback_evict_key (const struct blk_crypto_key *key) { +/* +* Pairs with smp_store_release() in +* blk_crypto_fallback_start_using_mode() +*/ +if (!smp_load_acquire (&tfms_inited[key->crypto_cfg.crypto_mode])) +return 0 ;return __blk_crypto_evict_key (blk_crypto_fallback_profile, key); }
Greg Kroah-Hartman
maintainerPATCH 518/1005 ceph: fail readdir when the MDS reply carries no dirfrag
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfu Xie <[email protected]>
commit 728c856d7da04fb79f7aa00e974ffb6f55e55995 upstream.
A ceph mount oopses in ceph_readdir() when the MDS answers a READDIR request with a reply whose extra blob is empty. parse_reply_info() skips reply blobs whose length is zero, so parse_reply_info_readdir() never runs, r_reply_info.dir_dir stays NULL, and the reply still parses as successful. ceph_mdsc_do_request() returns 0 and ceph_readdir() then reads rinfo->dir_dir->frag with no NULL check:
/* extra */
ceph_decode_32_safe(&p, end, len, bad);
if (len > 0) {
...
err = parse_reply_info_extra(&p, p + len, req, features, s);
...
}The oops on v7.3.0-rc4-00537-ga3ff15db6820, one getdents64(2) on the mount root after an ms_mode=legacy mount, trimmed:
BUG: KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI CPU: 1 UID: 0 PID: 266 Comm: ls Tainted: G N 7.3.0-rc4-00537-ga3ff15db6820 #1 PREEMPT(lazy) RIP: 0010:ceph_readdir+0xbff/0x3ea0 Call Trace: <TASK> ? __pfx_ceph_readdir+0x10/0x10 wrap_directory_iterator+0xa2/0xe0 iterate_dir+0x1da/0x5d0 __x64_sys_getdents64+0x13b/0x2a0 do_syscall_64+0xdd/0x4a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK>
The unconditional frag read came in with 81c6aea5275ea ("ceph: handle frag mismatch between readdir request and reply"), so the bug is old.
Treat a reply with no dirfrag as a protocol violation: warn once, drop the request and return -EIO, the same way ceph_readdir() already handles the two malformed-reply cases later in the function.
Tested on v7.3.0-rc4-00537-ga3ff15db6820 (KASAN). Unpatched, the getdents64(2) above takes the machine down (oops=panic) on the first READDIR reply. With the patch it warns once and getdents64(2) returns -EIO, no oops, no hang. A conformant reply for an empty directory — dirfrag present, zero entries, FRAG_END|FRAG_COMPLETE — still lists "." and ".." and returns EOF on both kernels, so normal readdir behavior is unchanged. The oops is still present in v7.3-rc5 (72d3fcf802c45).
--- fs/ceph/dir.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ceph/dir.c +4 -0
@@ -466,6 +466,10 @@ more: (int)req->r_reply_info.hash_order); rinfo = &req->r_reply_info; +if (WARN_ON_ONCE (!rinfo->dir_dir)) { +ceph_mdsc_put_request (req); +return -EIO ; + }if (le32_to_cpu (rinfo->dir_dir->frag) != frag) { frag =le32_to_cpu (rinfo->dir_dir->frag);if (!rinfo->hash_order) {
Greg Kroah-Hartman
maintainerPATCH 519/1005 fuse: dont BUG when the copy buffer is exhausted
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
commit c1338aae7b4054e26f322155423f6aba90aeea23 upstream.
fuse_copy_fill() hits BUG_ON(!err) once the iterator backing the copy runs out of pages. Over io-uring the amount copied is not bounded by the payload buffer the server registered, so an unprivileged user can drain the iterator and panic the host - mount a FUSE filesystem with small payload buffers, then setxattr() a larger value:
kernel BUG at fs/fuse/dev.c:1064!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 1 UID: 0 PID: 148 Comm: exploit Not tainted 7.3.0-rc1 #2 RIP: 0010:fuse_copy_fill (fs/fuse/dev.c:1033) Call Trace: <TASK> fuse_copy_args (fs/fuse/dev.c:1354 fs/fuse/dev.c:1380) fuse_uring_args_to_ring (fs/fuse/dev_uring.c:891) fuse_uring_prepare_send (fs/fuse/dev_uring.c:940 fs/fuse/dev_uring.c:1057) fuse_uring_send_in_task (fs/fuse/dev_uring.c:1745) tctx_task_work_run (io_uring/tw.c:96) tctx_task_work (io_uring/tw.c:133) task_work_run (kernel/task_work.c:233) io_run_task_work (io_uring/tw.h:84) io_cqring_wait (io_uring/wait.c:278) __do_sys_io_uring_enter (io_uring/io_uring.c:2676) do_syscall_64 (arch/x86/entry/syscall_64.c:61) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The reply path can drain it the same way, via the server-supplied payload_sz in fuse_uring_copy_from_ring().
Return -EIO instead. All three fuse_copy_fill() callers already propagate the error.
--- fs/fuse/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/dev.c +2 -1
@@ -937,7 +937,8 @@ static int fuse_copy_fill(struct fuse_co err =iov_iter_get_pages2 (cs->iter, &page,PAGE_SIZE ,1 , &off);if (err <0 )return err; -BUG_ON (!err); +if (!err) +return -EIO ; cs->len = err; cs->offset = off; cs->pg = page;
Greg Kroah-Hartman
maintainerPATCH 520/1005 kcov: ignore an out-of-range comparison count in write_comp_data()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fang Xieyan <[email protected]>
commit f5263bee9eb84d2388fd7555a18d518e17226894 upstream.
write_comp_data() reads the comparison record count from area[0] and uses it to index the coverage buffer:
area = (u64 *)t->kcov_area;
max_pos = t->kcov_size * sizeof(unsigned long);
count = READ_ONCE(area[0]);
/* Every record is KCOV_WORDS_PER_CMP 64-bit words. */
start_index = 1 + count * KCOV_WORDS_PER_CMP;
end_pos = (start_index + KCOV_WORDS_PER_CMP) * sizeof(u64);
if (likely(end_pos <= max_pos)) {The buffer is mmap'd writable into the collecting process, so count is under its control and end_pos <= max_pos is its only bound. A count that wraps the u64 multiply leaves end_pos below max_pos, so the check passes while the record store lands 24 bytes before the buffer, in the unmapped vmalloc guard page, and faults:
BUG: unable to handle page fault for address: ffa0000000b60fe8 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page Oops: 0002 [#1] SMP KASAN NOPTI RIP: 0010:write_comp_data+0x7e/0xa0 ... Kernel panic - not syncing: Fatal exception
Bound count first: only max_pos / (sizeof(u64) * KCOV_WORDS_PER_CMP) records fit, so a larger count is not a valid index and is dropped. kcov_move_area() bounds the same untrusted count this way, and no count the end_pos <= max_pos check accepts reaches that limit, so no valid record is lost.
kcov is a root-only debugfs file (debugfs_create_file_unsafe("kcov", 0600, ...)) and write_comp_data() exists only under CONFIG_KCOV_ENABLE_COMPARISONS, so this is a local, debug-kernel robustness fix: the process corrupts its own buffer and the kernel oopses. It crosses no privilege boundary. Additional details at [1]
--- kernel/kcov.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/kcov.c +8 -0
@@ -253,6 +253,14 @@ static void notrace write_comp_data(u64 count =READ_ONCE (area[0 ]); +/* +* area[0] is writable by the collecting process, so count cannot be +* trusted. Bound it to the records that fit, as kcov_move_area() +* does, so the end_pos multiply below cannot wrap past its check. +*/ +if (count >= max_pos / (sizeof (u64) *KCOV_WORDS_PER_CMP )) +return ; +/* Every record is KCOV_WORDS_PER_CMP 64-bit words. */ start_index =1 + count *KCOV_WORDS_PER_CMP ; end_pos = (start_index +KCOV_WORDS_PER_CMP ) *sizeof (u64);
Greg Kroah-Hartman
maintainerPATCH 521/1005 kcsan: Avoid division by zero in kcsan_prandom_u32_max()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
commit 99b6fcce87037cfb6b5e177848342e97f5141205 upstream.
KCSAN's skip_watch, udelay_task and udelay_interrupt parameters can be changed at runtime through /sys/module/kcsan/parameters/, where 0 means watching every access or not delaying at all. With the default CONFIG_KCSAN_SKIP_WATCH_RANDOMIZE=y and CONFIG_KCSAN_DELAY_RANDOMIZE=y, writing 0 to any of them makes the next watchpoint setup divide by zero:
# echo 0 > /sys/module/kcsan/parameters/udelay_task Oops: divide error: 0000 [#1] SMP NOPTI CPU: 0 UID: 0 PID: 93 Comm: sh Not tainted 7.3.0-rc5 #3 PREEMPT(lazy) RIP: 0010:kcsan_setup_watchpoint+0x1b5/0x410 Code: ... 65 89 05 ad 8d 98 02 d3 ee <f7> f6 29 d7 e8 22 0e 0f 01 ... RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 ... __show_trace_log_lvl+0x1bd/0x315 __die_body.cold+0x19/0x2b die+0x34/0x50 ... BUG: TASK stack guard page was hit at ffffd3ab001fbfe8 (...)
reset_kcsan_skip() and delay_access() pass these values unchecked to kcsan_prandom_u32_max(), which returns "state % ep_ro". delay_access() halves the delay for compound and assert accesses, so udelay_interrupt=1 is enough there.
The oops path runs instrumented code, which faults again until the stack overflows. With skip_watch=0 the guest hangs without printing anything.
The division came in with commit 71a076f4a61a ("kcsan: Rewrite kcsan_prandom_u32_max() without prandom_u32_state()"). Before it, the helper scaled the random value with a multiply-shift, which yields 0 for ep_ro == 0. Go back to that via reciprocal_scale().
Tested in an x86-64 KCSAN guest with virtme-ng: after this patch, writing 0 to each parameter, or 1 to udelay_interrupt, no longer oopses. skip_watch=0 now watches every access, which is very slow with the default delays but completes when they are set to 0.
--- kernel/kcsan/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/kcsan/core.c +4 -3
@@ -290,8 +290,9 @@ should_watch(struct kcsan_ctx *ctx, cons }/* -* Returns a pseudo-random number in interval [0, ep_ro). Simple linear -* congruential generator, using constants from "Numerical Recipes". +* Returns a pseudo-random number in interval [0, ep_ro), or 0 if ep_ro is 0, +* which the runtime-tunable callers may pass. Simple linear congruential +* generator, using constants from "Numerical Recipes". */ static u32 kcsan_prandom_u32_max (u32 ep_ro) {
@@ -300,7 +301,7 @@ static u32 kcsan_prandom_u32_max(u32 ep_ state =1664525 * state +1013904223 ;this_cpu_write (kcsan_rand_state, state); -return state % ep_ro; +return reciprocal_scale (state, ep_ro); }static inline void reset_kcsan_skip (void )
Greg Kroah-Hartman
maintainerPATCH 522/1005 libceph: bound mon_command ack decode to front len
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
commit 62b41a16d8603d4d809fda212f15c3e9c783a82b upstream.
handle_command_ack() bounds the decode with msg->front_alloc_len, the size of the reply buffer, instead of msg->front.iov_len, the number of bytes the monitor sent. mon_alloc_msg() routes every CEPH_MSG_MON_COMMAND_ACK to get_generic_reply(), which returns the preallocated ->reply of whichever generic request carries the same tid, so the buffer keeps its fixed size however short the reply is. An ack with hdr.front_len below sizeof(struct ceph_mon_request_header) + sizeof(u32), including 0, still passes ceph_decode_need(), and ceph_decode_32() returns four bytes that were never
received: uninitialized slab memory, stale bytes of an earlier message, or bytes the peer planted by sending a reply that lands in the same buffer and is then rejected. The read stays within the allocation, so KASAN does not flag it.
req->result reaches userspace through ceph_monc_do_statfs(), ceph_monc_get_version() and ceph_monc_blocklist_add(); rbd hands it back from write() on /sys/bus/rbd/add_single_major, and rbd_get_client() passes it to ERR_PTR() unchecked, which faults:
rbd: failed to get latest osdmap: -186318427
BUG: unable to handle page fault for address: fffffbfffe9ca034 Oops: Oops: 0000 [#1] SMP KASAN NOPTI RIP: 0010:do_rbd_add (drivers/block/rbd.c:7105) Call Trace: ... kernfs_fop_write_iter (fs/kernfs/file.c:345) vfs_write (fs/read_write.c:595 fs/read_write.c:687) ksys_write (fs/read_write.c:739) do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:84) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Kernel panic - not syncing: Fatal exception
Use msg->front.iov_len, matching handle_subscribe_ack(), handle_statfs_reply(), handle_get_version_reply() and handle_auth_reply(). A well-formed ack has front.iov_len >= 22 and is unaffected; a short one takes the existing bad: path. This applies commit d3c32939fa0e ("libceph:
bound get_version reply decode to front len") to the last decode-side use of front_alloc_len in this file.
--- net/ceph/mon_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/mon_client.c +1 -1
@@ -943,7 +943,7 @@ static void handle_command_ack(struct ce {struct ceph_mon_generic_request *req;void *p = msg->front.iov_base; -void *const end = p + msg->front_alloc_len; +void *const end = p + msg->front.iov_len;u64 tid =le64_to_cpu (msg->hdr.tid);dout ("%s msg %p tid %llu\n" , __func__, msg, tid);
Greg Kroah-Hartman
maintainerPATCH 523/1005 media: cx88: Disable PCI device on MPEG initialization failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
commit 80494a83223bc972145c23890b083d20651512bd upstream.
cx8802_init_common() enables the PCI device, then returns directly if DMA mask setup or IRQ registration fails. cx8802_probe() frees the device and drops the shared core reference without disabling PCI.
Disable the PCI device on both post-enable failures. Preserve -EIO for a DMA mask failure and the original request_irq() error. Do not call the full fini helper because the IRQ was not successfully requested. The successful probe and normal removal paths are unchanged.
These missing error-path disables are present in the initial Git import.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/media/pci/cx88/cx88-mpeg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/pci/cx88/cx88-mpeg.c +7 -2
@@ -392,7 +392,8 @@ static int cx8802_init_common(struct cx8 err =dma_set_mask (&dev->pci->dev,DMA_BIT_MASK (32 ));if (err) {pr_err ("Oops: no 32bit PCI DMA ???\n" ); -return -EIO ; + err = -EIO ; + goto fail_disable_device; } dev->pci_rev = dev->pci->revision;
@@ -413,13 +414,17 @@ static int cx8802_init_common(struct cx8 IRQF_SHARED, dev->core->name, dev);if (err <0 ) {pr_err ("can't get IRQ %d\n" , dev->pci->irq); -return err; + goto fail_disable_device; }cx_set (MO_PCI_INTMSK , core->pci_irqmask);/* everything worked */ pci_set_drvdata (dev->pci, dev);return 0 ; + +fail_disable_device: +pci_disable_device (dev->pci); +return err; }static void cx8802_fini_common (struct cx8802_dev *dev)
Greg Kroah-Hartman
maintainerPATCH 524/1005 media: em28xx: reject audio endpoint with zero packet size
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
commit aebfe430ba885d2f8fc882d7a6d60a7fdbe535d8 upstream.
em28xx_audio_urb_init() divides by the audio endpoint's wMaxPacketSize without checking it, so a USB device that declares a zero-sized audio endpoint divides by zero at probe time.
Reject a zero-sized audio endpoint like a missing one; the caller already unwinds on a negative return.
Oops: divide error: 0000 [#1] SMP NOPTI Workqueue: usb_hub_wq hub_event RIP: 0010:em28xx_audio_init (drivers/media/usb/em28xx/em28xx-audio.c:718) Call Trace: em28xx_init_extension (drivers/media/usb/em28xx/em28xx-core.c:1248) em28xx_init_dev.isra.0 (drivers/media/usb/em28xx/em28xx-cards.c:3887) em28xx_usb_probe (drivers/media/usb/em28xx/em28xx-cards.c:4258) usb_probe_interface (drivers/usb/core/driver.c:396) ... usb_set_configuration (drivers/usb/core/message.c:2268) usb_generic_driver_probe (drivers/usb/core/generic.c:250) usb_probe_device (drivers/usb/core/driver.c:291) ... usb_new_device (drivers/usb/core/hub.c:2703) hub_event (drivers/usb/core/hub.c:5961) process_one_work (kernel/workqueue.c:3322) worker_thread (kernel/workqueue.c:3486) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:158) ret_from_fork_asm (arch/x86/entry/entry_64.S:245) Kernel panic - not syncing: Fatal exception
--- drivers/media/usb/em28xx/em28xx-audio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/media/usb/em28xx/em28xx-audio.c +7 -0
@@ -693,6 +693,13 @@ static int em28xx_audio_urb_init(struct } ep_size =em28xx_audio_ep_packet_size (udev, ep); +if (ep_size ==0 ) { +dev_err (&dev->intf->dev, +"Audio endpoint 0x%02x has a zero packet size\n" , +EM28XX_EP_AUDIO ); +return -ENODEV ; + } + interval =1 << (ep->bInterval -1 ); dev_info(&dev->intf->dev,
Greg Kroah-Hartman
maintainerPATCH 525/1005 media: go7007: only set audio_enabled if go7007_snd_init() succeeded
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
commit 2eacf058d2dbb0ae3aaf576459da9e5f2b6bbfbd upstream.
go7007_register_encoder() sets go->audio_enabled before calling go7007_snd_init() and discards its return value. go7007_snd_init() assigns go->snd_context only on success, so a failed ALSA setup leaves audio_enabled set with snd_context still NULL. The disconnect path tests audio_enabled and calls go7007_snd_remove(), which dereferences snd_context unconditionally.
go7007_snd_init() returns -ENODEV once its never-decremented static card counter reaches SNDRV_CARDS, so SNDRV_CARDS attach/detach cycles arm the next attach; no memory pressure is needed.
Set go->audio_enabled only once go7007_snd_init() has succeeded.
Oops: general protection fault, probably for non-canonical address ... KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] Workqueue: usb_hub_wq hub_event RIP: 0010:go7007_snd_remove (drivers/media/usb/go7007/snd-go7007.c:273) Call Trace: go7007_usb_disconnect (drivers/media/usb/go7007/go7007-usb.c:1336) usb_unbind_interface (drivers/usb/core/driver.c:461) device_remove (drivers/base/dd.c:618) device_release_driver_internal (drivers/base/dd.c:1349) bus_remove_device (drivers/base/bus.c:664) device_del (drivers/base/core.c:3965) usb_disable_device (drivers/usb/core/message.c:1478) usb_disconnect hub_event (drivers/usb/core/hub.c:5966) process_one_work (kernel/workqueue.c:3396) worker_thread (kernel/workqueue.c:3560) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:158) ret_from_fork_asm (arch/x86/entry/entry_64.S:245) Kernel panic - not syncing: Fatal exception
--- drivers/media/usb/go7007/go7007-driver.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/usb/go7007/go7007-driver.c +2 -3
@@ -306,10 +306,9 @@ int go7007_register_encoder(struct go700if (ret <0 )return ret; -if (go->board_info->flags &GO7007_BOARD_HAS_AUDIO ) { +if ((go->board_info->flags &GO7007_BOARD_HAS_AUDIO ) && +go7007_snd_init (go) ==0 ) go->audio_enabled =1 ; -go7007_snd_init (go); - }return 0 ; }EXPORT_SYMBOL (go7007_register_encoder);
Greg Kroah-Hartman
maintainerPATCH 526/1005 net: ipv4: add zero check for snd_cwnd_clamp
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaho Jiang <[email protected]>
commit 363c8c79220d0db4d65dcd570529ddda15067cb5 upstream.
When RTAX_CWND is locked, user is able to pass 0 into it. This could lead to writing 0 to tp->snd_cwnd, leading to a division by zero error.
Oops: divide error: 0000 [#1] SMP KASAN NOPTI Call Trace: <IRQ> tcp_reno_cong_avoid (net/ipv4/tcp_cong.c:510 (discriminator 1)) tcp_ack (net/ipv4/tcp_input.c:3517 net/ipv4/tcp_input.c:3873 net/ipv4/tcp_input.c:4440) tcp_rcv_established (net/ipv4/tcp_input.c:6685) tcp_v4_do_rcv (net/ipv4/tcp_ipv4.c:1854) tcp_v4_rcv (net/ipv4/tcp_ipv4.c:2248) ip_protocol_deliver_rcu (net/ipv4/ip_input.c:207 (discriminator 1)) ip_local_deliver_finish (net/ipv4/ip_input.c:241 (discriminator 1)) ip_local_deliver (./include/linux/netfilter.h:325 ./include/linux/netfilter.h:319 net/ipv4/ip_input.c:262) ip_rcv (./include/net/dst.h:481 (discriminator 6) net/ipv4/ip_input.c:492 (discriminator 6) ./include/linux/netfilter.h:325 (discriminator 6) ./include/li) __netif_receive_skb_one_core (net/core/dev.c:6297 (discriminator 4)) __netif_receive_skb (net/core/dev.c:6410) process_backlog (net/core/dev.c:6761) __napi_poll.constprop.0 (net/core/dev.c:7830) net_rx_action (net/core/dev.c:7893 net/core/dev.c:8050) handle_softirqs (kernel/softirq.c:645) __irq_exit_rcu (kernel/softirq.c:679 kernel/softirq.c:519 kernel/softirq.c:758) irq_exit_rcu (kernel/softirq.c:775) sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1062 (discriminator 35) arch/x86/kernel/apic/apic.c:1062 (discriminator 35)) RIP: 0010:tcp_cong_avoid_ai (net/ipv4/tcp_cong.c:482)
Fix by checking if user pass in zero as parameter and if lock is present.
--- net/ipv4/metrics.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/metrics.c +5 -0
@@ -60,6 +60,11 @@ static int ip_metrics_convert(struct nlaif (ecn_ca) metrics[RTAX_FEATURES -1 ] |=DST_FEATURE_ECN_CA ; +if ((metrics[RTAX_LOCK -1 ] & (1 <<RTAX_CWND )) && !metrics[RTAX_CWND -1 ]) { +NL_SET_ERR_MSG (extack,"Locked cwnd metric must be non zero" ); +return -EINVAL ; + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 527/1005 net: usb: pegasus: do not advance rx_skb->data on dropped frames
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Jie Law <[email protected]>
commit bfa09dccf98cf78dd9282259b2140bd1472f5ae9 upstream.
For the 0x8513 chip, read_bulk_callback() skips the 2-byte receive header by advancing pegasus->rx_skb->data in place. This is done before the pkt_len > PEGASUS_MTU check, and when that check drops the frame the good path resubmits the same skb with the advanced rx_skb->data as the transfer buffer, still PEGASUS_MTU bytes long.
Every frame with an oversized length field therefore moves the receive buffer two more bytes towards the end of the skb data area. A device that keeps sending such frames makes the host controller write received data over skb_shared_info and past the end of the allocation, and the corrupted skb_shared_info is used when the skb is eventually freed. With an emulated device sending frames filled with 0x5a on a KASAN kernel:
BUG: KASAN: slab-out-of-bounds in dummy_timer+0xade/0x3f00 [dummy_hcd] Write of size 1536 at addr ffff888105821202 by task swapper/1/0 ... Oops: general protection fault, probably for non-canonical address 0xeb4b474b4b4b4b4c: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0x5a5a5a5a5a5a5a60-0x5a5a5a5a5a5a5a67] RIP: 0010:skb_release_data+0x36f/0x800
Only skip the header with skb_reserve() once the frame is going to be passed up, so the receive buffer always starts at the beginning of the skb data area. Unlike the old pointer adjustment, skb_reserve() also moves skb->tail, so the two header bytes now count against the buffer
size: lower the length limit for the 0x8513 accordingly, otherwise a pkt_len of PEGASUS_MTU - 1 or PEGASUS_MTU would trip skb_over_panic().
Found by code review with LLM assistance and reproduced with an emulated USB device (raw-gadget + dummy_hcd).
--- drivers/net/usb/pegasus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/usb/pegasus.c +4 -2
@@ -464,6 +464,7 @@ static void read_bulk_callback(struct uru8 *buf = urb->transfer_buffer;int rx_status, count = urb->actual_length;int status = urb->status; +int rx_offset =0 ;__u16 pkt_len;if (!pegasus)
@@ -513,7 +514,7 @@ static void read_bulk_callback(struct urif (pegasus->chip ==0x8513 ) { pkt_len =le32_to_cpu (*(__le32 *)urb->transfer_buffer); pkt_len &=0x0fff ; - pegasus->rx_skb->data +=2 ; + rx_offset =2 ; }else { pkt_len = buf[count -3 ] <<8 ; pkt_len += buf[count -4 ];
@@ -525,13 +526,14 @@ static void read_bulk_callback(struct ur* If the packet is unreasonably long, quietly drop it rather than * kernel panicing by calling skb_put. */ -if (pkt_len >PEGASUS_MTU ) +if (pkt_len >PEGASUS_MTU - rx_offset) goto goon;/* * at this point we are sure pegasus->rx_skb != NULL * so we go ahead and pass up the packet. */ +skb_reserve (pegasus->rx_skb, rx_offset);skb_put (pegasus->rx_skb, pkt_len); pegasus->rx_skb->protocol =eth_type_trans (pegasus->rx_skb, net);netif_rx (pegasus->rx_skb);
Greg Kroah-Hartman
maintainerPATCH 528/1005 nfsd: fix race between client_info_show() and free_client()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ameer Hamza <[email protected]>
commit ee62dc03a69ee57855de35da1a8ab53b51d30b32 upstream.
client_info_show() renders /proc/fs/nfsd/clients/<id>/info and walks clp->cl_sessions under clp->cl_lock to print each session's slot counts. free_client() tears down the same list without taking cl_lock, and is the only unlocked mutator of cl_sessions. A reader can observe a client mid-teardown because get_nfsdfs_clp() pins the nfs4_client but not its sessions: free_client() frees every session before calling nfsd_client_rmdir(), so an in-flight seq_file reader can follow a list_del()'d node whose ->next now holds LIST_POISON1 and take a general protection fault:
Oops: general protection fault, probably for non-canonical address
0xdead00000000014c
CPU: 1 UID: 0 PID: 132488 Comm: cat
RIP: 0010:client_info_show+0x2bf/0x3d0
RAX: dead000000000100
Call Trace:
seq_read_iter+0x12a/0x4b0
seq_read+0xf1/0x130
vfs_read+0xbf/0x350
ksys_read+0x6f/0xf0
do_syscall_64+0x8b/0xcb0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Kernel panic - not syncing: Fatal exceptionDetach cl_sessions onto a local reaplist under cl_lock, then free the sessions after dropping the lock. Removing entries from cl_sessions under cl_lock matches unhash_session(), and the detach-then-reap shape matches how __destroy_client() reaps cl_delegations. The sessions cannot be freed while cl_lock is held, since free_session() calls nfsd4_del_conns(), which re-acquires it.
--- fs/nfsd/nfs4state.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +9 -3
@@ -2539,10 +2539,16 @@ static void drop_client(struct nfs4_cliestatic void free_client (struct nfs4_client *clp) { -while (!list_empty (&clp->cl_sessions)) { +LIST_HEAD (reaplist); + +/* client_info_show() walks cl_sessions under cl_lock */ +spin_lock (&clp->cl_lock); +list_splice_init (&clp->cl_sessions, &reaplist); +spin_unlock (&clp->cl_lock); +while (!list_empty (&reaplist)) {struct nfsd4_session *ses; - ses = list_entry(clp->cl_sessions.next, struct nfsd4_session, - se_perclnt); + ses = list_entry(reaplist.next, struct nfsd4_session, + se_perclnt);list_del (&ses->se_perclnt);WARN_ON_ONCE (atomic_read (&ses->se_ref));free_session (ses);
Greg Kroah-Hartman
maintainerPATCH 529/1005 ocfs2/dlm: drain join handlers before releasing module text
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
commit 28f366d84023651e50e32e29931401ba0df3e679 upstream.
The code for a registered DLM handler must remain resident until its last invocation finishes. dlm_unregister_net_handlers() only removes dlm_join_handlers from the o2net registry. o2net_handler_get() takes a kref on the wrapper, but that reference does not pin ocfs2_dlm text. o2net_process_message() calls nh_func after dropping o2net_handler_lock.
With CONFIG_OCFS2_FS_O2CB=m, ocfs2_dlm can be loaded independently of ocfs2_stack_o2cb while nodemanager continues handling messages from a configured, heartbeating peer. If no dependent module or module reference prevents normal unload, the following ordering is possible:
Receive worker Module unload
-------------- -------------
o2net_handler_get()
take wrapper kref
drop handler lock
<preempted>
dlm_exit()
unregister handlers
release DLM module text
call saved nh_func
in released module text
Use o2net_unregister_and_flush_handler_list() in the shared DLM unregister helper. It first prevents new lookups, then waits for the ordered o2net workqueue to drain, including a concurrent destruction of that queue. The acquired invocation therefore finishes before dlm_exit() returns and the loader releases the callback code. The same helper covers partial registration and dlm_init() error unwind before module memory is released.
Skip the drain when the private join-handler list is empty. Early dlm_init() failures can reach this helper before any handler has been published. Partial-registration failure also reaches it a second time after the first call has already unregistered and drained the list. Neither case needs to take o2net_wq_mutex or drain unrelated work. The list is changed only by serialized module init/exit paths; a nonempty list still uses the full unregister-and-flush helper.
Oops report as below:
Oops: int3: 0000 [#1] SMP KASAN NOPTI
CPU: 2 UID: 0 PID: 54 Comm: kworker/u16:3 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy)Hardware identification omitted.
Workqueue: o2net o2net_rx_until_empty [ocfs2_nodemanager]
RIP: 0010:0xffffffffc0423871
[Instruction byte dump omitted.]Register dump omitted.
Call Trace:
<TASK>
? o2net_rx_until_empty+0x19b1/0x3300 [ocfs2_nodemanager]
? __pfx_o2net_rx_until_empty+0x10/0x10 [ocfs2_nodemanager]
? lock_acquire+0x190/0x300
? process_one_work+0x935/0x1b40
? process_one_work+0x834/0x1b40
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x290
? srso_alias_return_thunk+0x5/0xfbef5
? process_one_work+0x9a8/0x1b40
? __pfx_process_one_work+0x10/0x10
? lock_acquire+0x190/0x300
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
? worker_thread+0x65c/0xe40
? srso_alias_return_thunk+0x5/0xfbef5
? __kthread_parkme+0x177/0x220
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_worker_thread+0x10/0x10
? kthread+0x351/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
? ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf70
? __pfx_kthread+0x10/0x10
? ret_from_fork_asm+0x1a/0x30
</TASK>
Modules linked in: ocfs2_nodemanager [last unloaded: ocfs2_dlm]
---[ end trace 0000000000000000 ]------ fs/ocfs2/dlm/dlmdomain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlm/dlmdomain.c +2 -1
@@ -2213,7 +2213,8 @@ static LIST_HEAD(dlm_join_handlers);static void dlm_unregister_net_handlers (void ) { -o2net_unregister_handler_list (&dlm_join_handlers); +if (!list_empty (&dlm_join_handlers)) +o2net_unregister_and_flush_handler_list (&dlm_join_handlers); }static int dlm_register_net_handlers (void )
Greg Kroah-Hartman
maintainerPATCH 530/1005 ocfs2: drain quorum work before removing the cluster
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
commit b584c45b6066fd9799c44ffb9badcb5db351c8a6 upstream.
The configured cluster must remain available until an in-flight quorum decision has finished using its fencing method. o2quo_make_decision() drops qs_lock before calling o2quo_fence_self(), which marks heartbeat regions for unclean stop and then reads o2nm_single_cluster->cl_fence_method. Cluster removal clears the singleton without waiting for this independent system-workqueue item.
When a failed-quorum decision overlaps removal of the heartbeat regions, nodes and cluster through configfs, the worker can be preempted after marking the regions and resume after the singleton has been cleared:
Quorum worker Configfs removal
select fence; drop qs_lock
o2hb_stop_all_regions()
remove regions; join heartbeat threads remove nodes; stop o2net clear singleton; release cluster
read cl_fence_method
The resumed read dereferences NULL instead of applying the configured fencing method. The heartbeat thread's dependency protects the local node only until the thread exits, and draining o2net does not wait for qs_work.
Add o2quo_flush_work() to drain pending or running quorum decisions before clearing the singleton in o2nm_cluster_group_drop_item(). By this point the heartbeat regions and nodes have been removed, so their work publishers are stopped. The worker can finish while the cluster and its configured fencing method remain available. It does not acquire the configfs mutex held by the removal path.
Keep o2quo_exit() as the counterpart of o2quo_init() for module teardown and initialization failure, and have it call the same drain helper. Cluster removal uses only the explicitly named drain operation.
KASAN report as below:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000011b: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x00000000000008d8-0x00000000000008df]
CPU: 0 UID: 0 PID: 72 Comm: kworker/0:2 Not tainted 7.3.0-rc4-next-20260921-pmb-ocfs2-functional-v1+ #1 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: events o2quo_make_decision
RIP: 0010:o2quo_fence_self+0x65/0x200Register dump omitted.
Call Trace:
<TASK>
o2quo_make_decision+0x345/0x3a0
? __pfx_o2quo_make_decision+0x10/0x10
? process_one_work+0x834/0x1b40
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x290
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x9a8/0x1b40
? __pfx_process_one_work+0x10/0x10
? lock_acquire+0x190/0x300
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? srso_alias_return_thunk+0x5/0xfbef5
? __kthread_parkme+0x177/0x220
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_worker_thread+0x10/0x10
kthread+0x351/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf70
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]------ fs/ocfs2/cluster/nodemanager.c | 3 +++ fs/ocfs2/cluster/quorum.c | 7 ++++++- fs/ocfs2/cluster/quorum.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
fs/ocfs2/cluster/nodemanager.c +3 -0
@@ -11,6 +11,7 @@#include "tcp.h" #include "nodemanager.h" #include "heartbeat.h" +#include "quorum.h" #include "masklog.h" #include "sys.h"
@@ -739,6 +740,8 @@ static void o2nm_cluster_group_drop_itemstruct o2nm_cluster *cluster =to_o2nm_cluster (item);BUG_ON (o2nm_single_cluster != cluster); +/* Drain quorum work before it loses access to the cluster. */ +o2quo_flush_work (); o2nm_single_cluster =NULL ;configfs_remove_default_groups (&cluster->cl_group);
fs/ocfs2/cluster/quorum.c +6 -1
@@ -318,9 +318,14 @@ void o2quo_init(void)INIT_WORK (&qs->qs_work, o2quo_make_decision); } -void o2quo_exit (void ) +void o2quo_flush_work (void ) {struct o2quo_state *qs = &o2quo_state;flush_work (&qs->qs_work); } + +void o2quo_exit (void ) +{ +o2quo_flush_work (); +}
fs/ocfs2/cluster/quorum.h +1 -0
@@ -8,6 +8,7 @@void o2quo_init (void );void o2quo_exit (void ); +void o2quo_flush_work (void );void o2quo_hb_up (u8 node);void o2quo_hb_down (u8 node);
Greg Kroah-Hartman
maintainerPATCH 531/1005 ocfs2: pin owning modules for open debugfs files
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
commit 26d7e34b4226709084461a07bf28d9066fa96d8c upstream.
The OCFS2 debugfs file operation tables do not set owner. The full debugfs proxy obtains real_fops with fops_get() at open and keeps it until final release. Without an owner, this does not acquire a reference to the module containing the table and its callbacks. Removing the debugfs entries does not drain retained open files.
An open connected_nodes file can therefore outlive ocfs2_nodemanager and make full_proxy_release() read real_fops->release from freed module memory. Heming also reproduced the issue with fs_state and asked for the other OCFS2 debugfs operation tables to be checked.
Set owner to THIS_MODULE in all eleven explicit debugfs operation
tables: five in ocfs2_nodemanager, four in ocfs2_dlm, and two in ocfs2. The existing debugfs get/put pair then holds the appropriate module until final release. Leave the open, read and release callbacks unchanged. The blockcheck table already sets owner through DEFINE_DEBUGFS_ATTRIBUTE(), so it needs no change.
The original controlled test used an unloadable OCFS2 module and case-local probe filters without changing the candidate open, unload or release logic. Closing a retained connected_nodes file after normal unload produced:
BUG: unable to handle page fault for address: fffffbfff804cfef Oops: Oops: 0000 [#1] SMP KASAN NOPTI RIP: 0010:full_proxy_release+0xbf/0x190 Call Trace: <TASK> __fput+0x39a/0xa60 fput_close_sync+0xff/0x200 __x64_sys_close+0x8c/0xf0 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> Modules linked in: [last unloaded: ocfs2_nodemanager]
--- fs/ocfs2/cluster/heartbeat.c | 1 + fs/ocfs2/cluster/netdebug.c | 4 ++++ fs/ocfs2/dlm/dlmdebug.c | 5 +++++ fs/ocfs2/dlmglue.c | 2 ++ fs/ocfs2/super.c | 1 + 5 files changed, 13 insertions(+)
fs/ocfs2/cluster/heartbeat.c +1 -0
@@ -1428,6 +1428,7 @@ static ssize_t o2hb_debug_read(struct fi#endif /* CONFIG_DEBUG_FS */ static const struct file_operations o2hb_debug_fops = { + .owner =THIS_MODULE , .open = o2hb_debug_open, .release = o2hb_debug_release, .read = o2hb_debug_read,
fs/ocfs2/cluster/netdebug.c +4 -0
@@ -183,6 +183,7 @@ static int nst_fop_release(struct inode }static const struct file_operations nst_seq_fops = { + .owner =THIS_MODULE , .open = nst_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -415,6 +416,7 @@ static int stats_fop_open(struct inode * }static const struct file_operations stats_seq_fops = { + .owner =THIS_MODULE , .open = stats_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -427,6 +429,7 @@ static int sc_fop_open(struct inode *ino }static const struct file_operations sc_seq_fops = { + .owner =THIS_MODULE , .open = sc_fop_open, .read = seq_read, .llseek = seq_lseek,
@@ -476,6 +479,7 @@ static ssize_t o2net_debug_read(struct f }static const struct file_operations nodes_fops = { + .owner =THIS_MODULE , .open = nodes_fop_open, .release = o2net_debug_release, .read = o2net_debug_read,
fs/ocfs2/dlm/dlmdebug.c +5 -0
@@ -7,6 +7,7 @@* Copyright (C) 2004, 2008 Oracle. All rights reserved. */ +#include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/highmem.h>
@@ -341,6 +342,7 @@ bail: }static const struct file_operations debug_purgelist_fops = { + .owner =THIS_MODULE , .open = debug_purgelist_open, .release = debug_release, .read = debug_read,
@@ -398,6 +400,7 @@ bail: }static const struct file_operations debug_mle_fops = { + .owner =THIS_MODULE , .open = debug_mle_open, .release = debug_release, .read = debug_read,
@@ -605,6 +608,7 @@ static int debug_lockres_release(struct }static const struct file_operations debug_lockres_fops = { + .owner =THIS_MODULE , .open = debug_lockres_open, .release = debug_lockres_release, .read = seq_read,
@@ -800,6 +804,7 @@ bail: }static const struct file_operations debug_state_fops = { + .owner =THIS_MODULE , .open = debug_state_open, .release = debug_release, .read = debug_read,
fs/ocfs2/dlmglue.c +2 -0
@@ -7,6 +7,7 @@* Copyright (C) 2003, 2004 Oracle. All rights reserved. */ +#include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/highmem.h>
@@ -3311,6 +3312,7 @@ static int ocfs2_dlm_debug_open(struct i }static const struct file_operations ocfs2_dlm_debug_fops = { + .owner =THIS_MODULE , .open = ocfs2_dlm_debug_open, .release = ocfs2_dlm_debug_release, .read = seq_read,
fs/ocfs2/super.c +1 -0
@@ -387,6 +387,7 @@ static ssize_t ocfs2_debug_read(struct f#endif /* CONFIG_DEBUG_FS */ static const struct file_operations ocfs2_osb_debug_fops = { + .owner =THIS_MODULE , .open = ocfs2_osb_debug_open, .release = ocfs2_debug_release, .read = ocfs2_debug_read,
Greg Kroah-Hartman
maintainerPATCH 532/1005 ocfs2: publish the filecheck owner before adding sysfs attributes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
commit e062baf5680845705d21df415c8f0751c96b0792 upstream.
ocfs2_filecheck_create_sysfs() initializes the filecheck allocation before calling kobject_init_and_add(), but assigns entry->fs_fcheck only after that call returns. The default attribute group can already be visible while registration is in progress. A concurrent read can therefore enter ocfs2_filecheck_attr_show() with a NULL fs_fcheck and try to lock its fc_lock.
Assign the initialized owner before adding the kobject, so every activated attribute has valid state. Clear the pointer when addition fails, preserving the existing teardown guard and error cleanup.
A controlled probe-instrumented test kernel with the original OCFS2 registration ordering produced this Oops during a concurrent sysfs read:
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f] RIP: 0010:kasan_byte_accessible+0x15/0x30 Call Trace: <TASK> __kasan_check_byte+0x13/0x50 lock_acquire+0x113/0x300 _raw_spin_lock+0x31/0x40 ocfs2_filecheck_attr_show+0x138/0x5f0 ocfs2_filecheck_show+0x5d/0x90 sysfs_kf_seq_show+0x1d3/0x360 seq_read_iter+0x480/0x1110 kernfs_fop_read_iter+0x419/0x5a0 vfs_read+0x7d2/0xc20 ksys_read+0x111/0x200 do_syscall_64+0x114/0x620 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> Modules linked in:
--- fs/ocfs2/filecheck.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/ocfs2/filecheck.c +4 -1
@@ -179,17 +179,20 @@ int ocfs2_filecheck_create_sysfs(struct fcheck->fc_size =0 ; fcheck->fc_done =0 ; +/* Publish the initialized owner before activating its sysfs callbacks. */ + entry->fs_fcheck = fcheck; entry->fs_kobj.kset = osb->osb_dev_kset;init_completion (&entry->fs_kobj_unregister); ret =kobject_init_and_add (&entry->fs_kobj, &ocfs2_ktype_filecheck,NULL ,"filecheck" );if (ret) { +/* Mount failure still calls ocfs2_filecheck_remove_sysfs(). */ + entry->fs_fcheck =NULL ;kobject_put (&entry->fs_kobj);kfree (fcheck);return ret; } - entry->fs_fcheck = fcheck;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 533/1005 thunderbolt: Do not RPM complete unrelated subtrees on unplug
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Gopel <[email protected]>
commit 96a8479804e3f7af43e639e9df39f562f1a75fd5 upstream.
When a Thunderbolt device is unplugged, that switch and every switch subsequent to it on the bus device list is complete()d, not just its child devices. In the case of multiple domains, it may cause, eg, an attempt to complete() the uninitialized domain 1 root switch RPM completion on unplug of a switch from domain 0 (though ordering is not guaranteed numerically sorted).
I initially noticed this issue on a Dell XPS9720 when the system would seem to sporadically not wake after unplugging a Thunderbolt dock. I tried multiple kernel versions including v7.2.7 and v7.3-rc4 to see if that resolved the issue, but the issue persisted. Eventually I found that I could consistently generate a kernel Oops reporting a page fault at 0xffff_ffff_ffff_fff8 on unplug from one side of the laptop and went bug hunting. I became suspicious of the bus_for_each_dev() walk that I ultimately ended up changing. To confirm this issue, I did an eBPF trace of bus_for_each_dev(), complete_rpm(), and complete() while unplugging in a variety of situations and found that an unplug from domain 0 tries to complete_rpm() domain 1's switch, whose RPM completion is not initialized and thus is holding a null wait-list pointer, triggering the page fault.
Here are the key sections of that eBPF trace. Note that HEAD denotes the completion's own wait-list HEAD:
```
RESCAN_ENTER domain=0
COMPLETE rescan_domain=0 target=0-1 target_domain=0
route=0x1 parent=0-0 unplugged=1
COMPLETION done=0 head=HEAD next=HEAD prev=HEAD
BUS_WALK domain=0 start=0-1 callback=complete_rpm
CALLBACK_ENTER rescan_domain=0 dev=1-0 parent=domain1 is_switch=1
COMPLETE rescan_domain=0 target=1-0 target_domain=1
route=0x0 parent=domain1 unplugged=0
COMPLETION done=0 head=HEAD next=0 prev=0
complete+5
complete_rpm+43
bus_for_each_dev+133
icm_free_unplugged_children+250
icm_rescan_work+42
```This patch gates the complete() on an additional condition - that the Thunderbolt domain matches the domain of the device that was unplugged.
I only have a single system with multiple Thunderbolt domains - the Dell XPS9720. I am consistently able to reproduce the Oops on that system. Since running with this patch, I have not seen the Oops reoccur. I have also tested it on a Thinkpad X1-Gen12, and that system boots and runs well with it, but it only has a single Thunderbolt domain, so it does not exercise the multi-domain failure case.
--- drivers/thunderbolt/icm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thunderbolt/icm.c +3 -3
@@ -2068,7 +2068,7 @@ static int complete_rpm(struct device *d {struct tb_switch *sw =tb_to_switch (dev); -if (sw) +if (sw && sw->tb == data)complete (&sw->rpm_complete);return 0 ; }
@@ -2084,8 +2084,8 @@ static void remove_unplugged_switch(stru* tb_switch_remove() calls pm_runtime_get_sync() that then waits * for it. */ -complete_rpm (&sw->dev,NULL ); -bus_for_each_dev (&tb_bus_type, &sw->dev,NULL , complete_rpm); +complete_rpm (&sw->dev, sw->tb); +bus_for_each_dev (&tb_bus_type, &sw->dev, sw->tb, complete_rpm);tb_switch_remove (sw);pm_runtime_mark_last_busy (parent);
Greg Kroah-Hartman
maintainerPATCH 534/1005 udf: fix return value for non-recorded-allocated extents in udf_map_block()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giorgi Kobakhia <[email protected]>
commit 0f242ca0878896df30292f4922700a32e8fdd039 upstream.
When someone creates a corrupted UDF filesystem where symlink contains other extent type than EXT_RECORDED_ALLOCATED, it can leads to a crash like:
Oops: general protection fault KASAN: maybe wild-memory-access RIP: 0010:page_get_link (fs/namei.c:6503) Call Trace: vfs_readlink (fs/namei.c:6419) do_readlinkat (fs/stat.c:583) __x64_sys_readlink (fs/stat.c:605 fs/stat.c:602 fs/stat.c:602)
This is because in this case udf_map_block() fails to convert return value of inode_bmap() from 1 to 0. Returned '1' propagates through udf_bread() all the way up to __page_get_link() where it ends up being treated as a folio pointer with obvious results.
Move the reset to 0 line outside the if, so udf_map_block() returns either 0 or -errno, even if the extent type is not EXT_RECORDED_ALLOCATED.
--- fs/udf/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/inode.c +1 -1
@@ -375,8 +375,8 @@ static int udf_map_block(struct inode *i map->pblk =udf_get_lb_pblock (inode->i_sb, &eloc, offset); map->oflags |=UDF_BLK_MAPPED ; - ret =0 ; } + ret =0 ; out_read:up_read (&iinfo->i_data_sem);brelse (epos.bh);
Greg Kroah-Hartman
maintainerPATCH 535/1005 wwan: wwan_hwsim: Pin module for debugfs file operations
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Viet Dung <[email protected]>
commit a388f17e23b7e305cb306aafd73bb10d6b8ca452 upstream.
An open debugfs file retains its file_operations pointer in the debugfs proxy state. However, wwan_hwsim_debugfs_portdestroy_fops, wwan_hwsim_debugfs_portcreate_fops, wwan_hwsim_debugfs_devdestroy_fops, and wwan_hwsim_debugfs_devcreate_fops in wwan_hwsim.c have no .owner set to THIS_MODULE.
As a result, full_proxy_open_regular() calls fops_get() which succeeds without taking a reference to the wwan_hwsim module. When a userspace process opens any of these debugfs files, a subsequent module unload (rmmod wwan_hwsim) can succeed while the file descriptor remains open.
When the userspace process subsequently closes the descriptor, full_proxy_release() accesses the already unmapped file_operations structure, triggering a kernel oops in full_proxy_release():
BUG: unable to handle page fault for address: fffffbfff84f90ef Oops: 0000 [#2] SMP KASAN NOPTI RIP: 0010:full_proxy_release+0x8e/0x140 Call Trace: <TASK> __fput+0x357/0xaa0 fput_close_sync+0xe6/0x1a0 file_close_fd_locked+0x17e/0x2f0 do_close+0x33/0x70 __x64_sys_close+0x44/0x80 do_syscall_64+0xc3/0x590 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
The issue was discovered via manual code audit of wwan_hwsim.c and reproduced on a Linux 7.3-rc6 test VM with CONFIG_WWAN_HWSIM=m.
Set .owner = THIS_MODULE on all four debugfs file_operations structures in wwan_hwsim.c so that debugfs pins the module until close has completed.
--- drivers/net/wwan/wwan_hwsim.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wwan/wwan_hwsim.c +4 -0
@@ -380,6 +380,7 @@ static ssize_t wwan_hwsim_debugfs_portde }static const struct file_operations wwan_hwsim_debugfs_portdestroy_fops = { + .owner =THIS_MODULE , .write = wwan_hwsim_debugfs_portdestroy_write, .open = simple_open, .llseek = noop_llseek,
@@ -404,6 +405,7 @@ static ssize_t wwan_hwsim_debugfs_portcr }static const struct file_operations wwan_hwsim_debugfs_portcreate_fops = { + .owner =THIS_MODULE , .write = wwan_hwsim_debugfs_portcreate_write, .open = simple_open, .llseek = noop_llseek,
@@ -425,6 +427,7 @@ static ssize_t wwan_hwsim_debugfs_devdes }static const struct file_operations wwan_hwsim_debugfs_devdestroy_fops = { + .owner =THIS_MODULE , .write = wwan_hwsim_debugfs_devdestroy_write, .open = simple_open, .llseek = noop_llseek,
@@ -448,6 +451,7 @@ static ssize_t wwan_hwsim_debugfs_devcre }static const struct file_operations wwan_hwsim_debugfs_devcreate_fops = { + .owner =THIS_MODULE , .write = wwan_hwsim_debugfs_devcreate_write, .open = simple_open, .llseek = noop_llseek,
Greg Kroah-Hartman
maintainerPATCH 536/1005 xfs: fix integer overflow problem when setting large free areas
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit 7e55f84434f3a63d59feb8f89076d280ea9aa8e5 upstream.
LOLLM points out that the min_t comparison in xrep_rtbitmap_mark_free operates on a 64-bit bitmap word offset quantity and a 32-bit words-per-block ratio. Unfortunately, I should have done the comparison with the (64-bit) xrep_wordoff_t type, but used the 32-bit word count type. Oops.
--- fs/xfs/scrub/rtbitmap_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/scrub/rtbitmap_repair.c +1 -1
@@ -276,7 +276,7 @@ xrep_rtbitmap_mark_free(xrep_wordoff_t rem;xrep_wordcnt_t wordcnt; - wordcnt =min_t (xrep_wordcnt_t, nextwordoff - wordoff, + wordcnt =min_t (xrep_wordoff_t, nextwordoff - wordoff, bufwsize);/*
Greg Kroah-Hartman
maintainerPATCH 537/1005 netfilter: nf_conntrack_expect: use conntrack GC to reap expectations
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b8b09dc2bf35a00d4e0556b5d6308c7b917ebda2 ]
This patch replaces the timer API by GC worker approach for expectations, as it already happened in many other subsystems.
Use the existing conntrack GC worker to iterate over the local list of expectations in the master conntrack to reap expired expectations. Check IPS_HELPER_BIT to run GC for expectations, set it on for nft_ct expectation which nevers sets it. Hold the expectation spinlock while iterating over the master conntrack expectation list to synchronize with nf_ct_remove_expectations(). This also performs runtime packet path garbage collection through the expectation insertion and lookup functions while walking over one of the chains of the global expectation hashtables. Unconfirmed conntrack entries are skipped since ct->ext can be reallocated and dying are skipped since those will be gone soon. Set on IPS_HELPER_BIT if the helper ct extension is added, then the new GC worker does not need to bump the ct refcount to check if the ct->ext helper is available.
This removes the extra bump on the refcount for expectation timers, this allows to remove several nf_ct_expect_put() calls after the unlink, after this update only refcount remains at 1 while on the expectation hashes.
This patch implicitly addresses a race with the existing timer API allowing an expectation to access a stale exp->master pointer which has been already released when expectation removal loses races with an expiring timer, ie. timer_del() reporting false.
Add a new NF_CT_EXPECT_DEAD flag to reap this expectation via GC. This is needed by nf_conntrack_unexpect_related() which is called in error paths to invalidate newly created expectations that has been added into the hashes. These expectactions cannot be inmediately released as GC or nf_ct_remove_expectations() could race to make it. On expectation insert, the runtime GC reaps stale expectations before checking the expectation limit set by policy.
Set current timestamp in nf_ct_expect_alloc(), then add the expectation policy timeout (or custom timeout specified added on top of this) to specify the expectation lifetime.
--- include/net/netfilter/nf_conntrack_expect.h | 16 +- .../linux/netfilter/nf_conntrack_common.h | 1 + net/netfilter/nf_conntrack_core.c | 33 +++- net/netfilter/nf_conntrack_expect.c | 145 +++++++++--------- net/netfilter/nf_conntrack_h323_main.c | 4 +- net/netfilter/nf_conntrack_helper.c | 10 +- net/netfilter/nf_conntrack_netlink.c | 22 ++- net/netfilter/nf_conntrack_sip.c | 13 +- net/netfilter/nft_ct.c | 3 +- 9 files changed, 139 insertions(+), 108 deletions(-)
include/net/netfilter/nf_conntrack_expect.h +13 -3
@@ -54,8 +54,8 @@ struct nf_conntrack_expect {/* The conntrack of the master connection */ struct nf_conn *master; -/* Timer function; deletes the expectation. */ -struct timer_list timeout; +/* jiffies32 when this expectation expires */ +u32 timeout;#if IS_ENABLED (CONFIG_NF_NAT )union nf_inet_addr saved_addr;
@@ -69,6 +69,14 @@ struct nf_conntrack_expect {struct rcu_head rcu; }; +static inline bool nf_ct_exp_is_expired (const struct nf_conntrack_expect *exp) +{ +if (READ_ONCE (exp->flags) &NF_CT_EXPECT_DEAD ) +return true; + +return (__s32)(READ_ONCE (exp->timeout) - nfct_time_stamp) <=0 ; +} +static inline struct net *nf_ct_exp_net (struct nf_conntrack_expect *exp) {return read_pnet (&exp->net);
@@ -130,7 +138,6 @@ static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)void nf_ct_remove_expectations (struct nf_conn *ct);void nf_ct_unexpect_related (struct nf_conntrack_expect *exp); -bool nf_ct_remove_expect (struct nf_conntrack_expect *exp);void nf_ct_expect_iterate_destroy (bool (*iter)(struct nf_conntrack_expect *e,void *data),void *data); void nf_ct_expect_iterate_net(struct net *net,
@@ -153,5 +160,8 @@ static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect, return nf_ct_expect_related_report(expect, 0, 0, flags); } +struct nf_conn_help ; +void nf_ct_expectation_gc (struct nf_conn_help *master_help); +#endif /*_NF_CONNTRACK_EXPECT_H*/
include/uapi/linux/netfilter/nf_conntrack_common.h +1 -0
@@ -160,6 +160,7 @@ enum ip_conntrack_expect_events {#define NF_CT_EXPECT_USERSPACE 0x4#ifdef __KERNEL__ +#define NF_CT_EXPECT_DEAD 0x8#define NF_CT_EXPECT_MASK (NF_CT_EXPECT_PERMANENT | NF_CT_EXPECT_INACTIVE | \ NF_CT_EXPECT_USERSPACE)#endif
net/netfilter/nf_conntrack_core.c +32 -1
@@ -1467,6 +1467,31 @@ static bool gc_worker_can_early_drop(const struct nf_conn *ct)return false; } +static void nf_ct_help_gc (struct nf_conn *ct) +{ +struct nf_conn_help *help; + +if (!refcount_inc_not_zero (&ct->ct_general.use)) +return ; + +/* load ->status after refcount increase */ +smp_acquire__after_ctrl_dep (); + +if (!nf_ct_is_confirmed (ct) ||nf_ct_is_dying (ct)) { +nf_ct_put (ct); +return ; + } + +/* re-check helper due to SLAB_TYPESAFE_BY_RCU */ +if (test_bit (IPS_HELPER_BIT , &ct->status)) { + help =nfct_help (ct); +if (help) +nf_ct_expectation_gc (help); + } + +nf_ct_put (ct); +} +static void gc_worker (struct work_struct *work) {unsigned int i, hashsz, nf_conntrack_max95 =0 ;
@@ -1539,7 +1564,13 @@ static void gc_worker(struct work_struct *work) expires = (expires - (long )next_run) / ++count; next_run += expires; -if (nf_conntrack_max95 ==0 ||gc_worker_skip_ct (tmp)) +if (gc_worker_skip_ct (tmp)) +continue ; + +if (test_bit (IPS_HELPER_BIT , &tmp->status)) +nf_ct_help_gc (tmp); + +if (nf_conntrack_max95 ==0 )continue ; net =nf_ct_net (tmp);
net/netfilter/nf_conntrack_expect.c +72 -73
294 lines not on this page · raw message
net/netfilter/nf_conntrack_h323_main.c +2 -2
@@ -1396,8 +1396,8 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,"timeout to %u seconds for" , info->timeout);nf_ct_dump_tuple (&exp->tuple); -mod_timer_pending (&exp->timeout, - jiffies + info->timeout *HZ ); +WRITE_ONCE (exp->timeout, + nfct_time_stamp + (info->timeout *HZ )); }spin_unlock_bh (&nf_conntrack_expect_lock); }
net/netfilter/nf_conntrack_helper.c +4 -6
@@ -180,10 +180,10 @@ nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)struct nf_conn_help *help; help =nf_ct_ext_add (ct,NF_CT_EXT_HELPER , gfp); -if (help) +if (help) { +__set_bit (IPS_HELPER_BIT , &ct->status);INIT_HLIST_HEAD (&help->expectations); -else -pr_debug ("failed to add helper extension area" ); + }return help; }EXPORT_SYMBOL_GPL (nf_ct_helper_ext_add);
@@ -202,10 +202,8 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,return 0 ; help =nfct_help (tmpl); -if (help !=NULL ) { +if (help) helper =rcu_dereference (help->helper); -set_bit (IPS_HELPER_BIT , &ct->status); - } help =nfct_help (ct);
net/netfilter/nf_conntrack_netlink.c +9 -13
@@ -3006,8 +3006,8 @@ static int ctnetlink_exp_dump_expect(struct sk_buff *skb, const struct nf_conntrack_expect *exp) { + __s32 timeout = (__s32)(READ_ONCE(exp->timeout) - nfct_time_stamp) / HZ;struct nf_conn *master = exp->master; -long timeout = ((long )exp->timeout.expires - (long )jiffies) /HZ ;struct nf_conntrack_helper *helper;#if IS_ENABLED (CONFIG_NF_NAT )struct nlattr *nest_parms;
@@ -3170,6 +3170,9 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) restart:hlist_for_each_entry_rcu (exp, &nf_ct_expect_hash[cb->args[0 ]], hnode) { +if (nf_ct_exp_is_expired (exp)) +continue ; +if (l3proto && exp->tuple.src.l3num != l3proto)continue ;
@@ -3449,11 +3452,8 @@ static int ctnetlink_del_expect(struct sk_buff *skb, }/* after list removal, usage count == 1 */ -if (timer_delete (&exp->timeout)) { -nf_ct_unlink_expect_report (exp,NETLINK_CB (skb).portid, -nlmsg_report (info->nlh)); -nf_ct_expect_put (exp); - } +nf_ct_unlink_expect_report (exp,NETLINK_CB (skb).portid, +nlmsg_report (info->nlh));spin_unlock_bh (&nf_conntrack_expect_lock);/* have to put what we 'get' above. * after this line usage count == 0 */
@@ -3477,14 +3477,10 @@ static int ctnetlink_change_expect(struct nf_conntrack_expect *x, const struct nlattr * const cda[]) { - if (cda[CTA_EXPECT_TIMEOUT]) { - if (!timer_delete(&x->timeout)) - return -ETIME; + if (cda[CTA_EXPECT_TIMEOUT]) + WRITE_ONCE(x->timeout, nfct_time_stamp + + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ); - x->timeout.expires = jiffies + -ntohl (nla_get_be32 (cda[CTA_EXPECT_TIMEOUT ])) *HZ ; -add_timer (&x->timeout); - }return 0 ; }
net/netfilter/nf_conntrack_sip.c +5 -8
@@ -894,11 +894,10 @@ static int refresh_signalling_expectation(struct nf_conn *ct, exp->tuple.dst.protonum != proto || exp->tuple.dst.u.udp.port != port) continue; -if (mod_timer_pending (&exp->timeout, jiffies + expires *HZ )) { - exp->flags &= ~NF_CT_EXPECT_INACTIVE ; - found =1 ; -break ; - } +WRITE_ONCE (exp->timeout, nfct_time_stamp + (expires *HZ )); +WRITE_ONCE (exp->flags, exp->flags & ~NF_CT_EXPECT_INACTIVE ); + found =1 ; +break ; }spin_unlock_bh (&nf_conntrack_expect_lock);return found;
@@ -914,8 +913,7 @@ static void flush_expectations(struct nf_conn *ct, bool media)hlist_for_each_entry_safe (exp, next, &help->expectations, lnode) {if ((exp->class !=SIP_EXPECT_SIGNALLING ) ^ media)continue ; -if (!nf_ct_remove_expect (exp)) -continue ; +nf_ct_unlink_expect (exp);if (!media)break ; }
@@ -1385,7 +1383,6 @@ static int process_register_request(struct sk_buff *skb, unsigned int protoff,nf_ct_expect_init (exp,SIP_EXPECT_SIGNALLING ,nf_ct_l3num (ct), saddr, &daddr, proto,NULL , &port); - exp->timeout.expires = sip_timeout *HZ ;rcu_assign_pointer (exp->assign_helper, helper); exp->flags =NF_CT_EXPECT_PERMANENT |NF_CT_EXPECT_INACTIVE ;
net/netfilter/nft_ct.c +1 -2
@@ -1147,7 +1147,6 @@ static void nft_ct_helper_obj_eval(struct nft_object *obj, help =nf_ct_helper_ext_add (ct,GFP_ATOMIC );if (help) {rcu_assign_pointer (help->helper, to_assign); -set_bit (IPS_HELPER_BIT , &ct->status);if ((ct->status &IPS_NAT_MASK ) && !nfct_seqadj (ct))if (!nfct_seqadj_ext_add (ct))
@@ -1329,7 +1328,7 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj, &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, priv->l4proto, NULL, &priv->dport); - exp->timeout.expires = jiffies + priv->timeout *HZ ; + exp->timeout += priv->timeout *HZ ;if (nf_ct_expect_related (exp,0 ) !=0 ) regs->verdict.code =NF_DROP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 538/1005 netfilter: nf_conntrack_expect: add and use nf_ct_expect_related_pair()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
commit 4aa63842fc92de1bce59d4709a0d32e718890bb2 upstream.
Add a new function to insert a pair of expectations, this is required by the SIP and H323 NAT helpers. The spinlock is held to check if there is a slot for both expectations, in such case, insert them.
This removes the need for nf_ct_unexpect_related() inside the loop to find a pair of consecutive ports, otherwise inserting expectations whose dead flag is already set on can happen.
Bump master_help->expecting for the expectation class after checking if the expectation fits in the master expectation list, which is needed for this new _pair() function variant to run the eviction routine including the preallocated slot for the first expectation in the pair.
[ Joas: nf_ct_expect_insert() and __nf_ct_expect_check() do not take
a master_help argument in this tree, so keep their existing signatures; nf_ct_expect_related_report() gets master_help from nfct_help(expect->master) for the moved expecting[] increment. ]
--- include/net/netfilter/nf_conntrack_expect.h | 3 ++ net/ipv4/netfilter/nf_nat_h323.c | 22 +++++-------- net/netfilter/nf_conntrack_expect.c | 35 ++++++++++++++++++++- net/netfilter/nf_nat_sip.c | 20 ++++-------- 4 files changed, 50 insertions(+), 30 deletions(-)
include/net/netfilter/nf_conntrack_expect.h +3 -0
@@ -160,6 +160,9 @@ static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect,return nf_ct_expect_related_report (expect,0 ,0 , flags); } +int nf_ct_expect_related_pair (struct nf_conntrack_expect *expect[], +unsigned int flag); +struct nf_conn_help ;void nf_ct_expectation_gc (struct nf_conn_help *master_help);
net/ipv4/netfilter/nf_nat_h323.c +7 -15
@@ -179,6 +179,7 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,struct nf_conntrack_expect *rtp_exp, struct nf_conntrack_expect *rtcp_exp) { + struct nf_conntrack_expect *rtp_pair[2] = { rtp_exp, rtcp_exp };struct nf_ct_h323_master *info =nfct_help_data (ct);int dir =CTINFO2DIR (ctinfo);int i;
@@ -221,22 +222,13 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,int ret; rtp_exp->tuple.dst.u.udp.port =htons (nated_port); - ret =nf_ct_expect_related (rtp_exp,0 ); + rtcp_exp->tuple.dst.u.udp.port =htons (nated_port +1 ); + ret =nf_ct_expect_related_pair (rtp_pair,0 );if (ret ==0 ) { - rtcp_exp->tuple.dst.u.udp.port = -htons (nated_port +1 ); - ret =nf_ct_expect_related (rtcp_exp,0 ); -if (ret ==0 ) -break ; -else if (ret == -EBUSY ) { -nf_ct_unexpect_related (rtp_exp); -continue ; - }else if (ret <0 ) { -nf_ct_unexpect_related (rtp_exp); - nated_port =0 ; -break ; - } - }else if (ret != -EBUSY ) { +break ; + }else if (ret == -EBUSY ) { +continue ; + }else if (ret <0 ) { nated_port =0 ;break ; }
net/netfilter/nf_conntrack_expect.c +34 -1
@@ -425,7 +425,6 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp) exp->timeout += helper->expect_policy[exp->class].timeout *HZ ;hlist_add_head_rcu (&exp->lnode, &master_help->expectations); - master_help->expecting[exp->class]++;hlist_add_head_rcu (&exp->hnode, &nf_ct_expect_hash[h]); cnet =nf_ct_pernet (net);
@@ -525,6 +524,7 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,if (ret <0 ) goto out; +nfct_help (expect->master)->expecting[expect->class]++;nf_ct_expect_insert (expect);nf_ct_expect_event_report (IPEXP_NEW , expect, portid, report);
@@ -537,6 +537,39 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, }EXPORT_SYMBOL_GPL (nf_ct_expect_related_report); +int nf_ct_expect_related_pair (struct nf_conntrack_expect *expect[], +unsigned int flags) +{ +struct nf_conn_help *master_help; +int i, ret; + +spin_lock_bh (&nf_conntrack_expect_lock); + master_help =nfct_help (expect[0 ]->master); +if (!master_help || master_help !=nfct_help (expect[1 ]->master)) { + ret = -EINVAL ; + goto out; + } + +for (i =0 ; i <2 ; i++) { + ret =__nf_ct_expect_check (expect[i], flags); +if (ret <0 ) { +if (i ==1 ) + master_help->expecting[expect[0 ]->class]--; + goto out; + } + master_help->expecting[expect[i]->class]++; + } + +for (i =0 ; i <2 ; i++) { +nf_ct_expect_insert (expect[i]); +nf_ct_expect_event_report (IPEXP_NEW , expect[i],0 ,0 ); + } +out: +spin_unlock_bh (&nf_conntrack_expect_lock); +return ret; +} +EXPORT_SYMBOL_GPL (nf_ct_expect_related_pair); +void nf_ct_expect_iterate_destroy (bool (*iter)(struct nf_conntrack_expect *e,void *data),void *data) {
net/netfilter/nf_nat_sip.c +6 -14
@@ -585,6 +585,7 @@ static unsigned int nf_nat_sdp_media(struct sk_buff *skb, unsigned int protoff,unsigned int medialen, union nf_inet_addr *rtp_addr) { + struct nf_conntrack_expect *rtp_pair[2] = { rtp_exp, rtcp_exp };enum ip_conntrack_info ctinfo;struct nf_conn *ct =nf_ct_get (skb, &ctinfo);enum ip_conntrack_dir dir =CTINFO2DIR (ctinfo);
@@ -615,24 +616,15 @@ static unsigned int nf_nat_sdp_media(struct sk_buff *skb, unsigned int protoff,int ret; rtp_exp->tuple.dst.u.udp.port =htons (port); - ret =nf_ct_expect_related (rtp_exp, -NF_CT_EXP_F_SKIP_MASTER ); -if (ret == -EBUSY ) -continue ; -else if (ret <0 ) { - port =0 ; -break ; - } rtcp_exp->tuple.dst.u.udp.port =htons (port +1 ); - ret =nf_ct_expect_related (rtcp_exp, -NF_CT_EXP_F_SKIP_MASTER ); + + ret =nf_ct_expect_related_pair (rtp_pair, +NF_CT_EXP_F_SKIP_MASTER );if (ret ==0 )break ; -else if (ret == -EBUSY ) { -nf_ct_unexpect_related (rtp_exp); +else if (ret == -EBUSY )continue ; - }else if (ret <0 ) { -nf_ct_unexpect_related (rtp_exp); +else if (ret <0 ) { port =0 ;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 539/1005 netfilter: ctnetlink: do not expose expectation DEAD flag
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 322371b09058ad10d0282a0e7ec8eaa764e6aaac ]
Expose expectation flags included in the NF_CT_EXPECT_MASK bitmask only. The DEAD flag is internal, do not expose it.
--- net/netfilter/nf_conntrack_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -3050,7 +3050,7 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,#endif if (nla_put_be32 (skb,CTA_EXPECT_TIMEOUT ,htonl (timeout)) ||nla_put_be32 (skb,CTA_EXPECT_ID ,nf_expect_get_id (exp)) || -nla_put_be32 (skb,CTA_EXPECT_FLAGS ,htonl (exp->flags)) || +nla_put_be32 (skb,CTA_EXPECT_FLAGS ,htonl (exp->flags &NF_CT_EXPECT_MASK )) ||nla_put_be32 (skb,CTA_EXPECT_CLASS ,htonl (exp->class))) goto nla_put_failure;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 540/1005 sctp: auth: discard auth_chunk when skb_clone fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Luo <[email protected]>
[ Upstream commit 9ae7ed101cf28613071ebfbc42668c8917a670cf ]
When processing AUTH + COOKIE-ECHO packets, if skb_clone() fails due to memory pressure, chunk->auth_chunk is NULL. The original code still sets chunk->auth = 1 and continues, leaving the COOKIE-ECHO to be processed without a valid auth_chunk for deferred verification.
Discard the AUTH chunk early via pdiscard when skb_clone() fails, so that the receive loop can continue processing remaining chunks in the inqueue instead of stalling the entire packet.
--- net/sctp/associola.c | 4 ++++ net/sctp/endpointola.c | 4 ++++ 2 files changed, 8 insertions(+)
net/sctp/associola.c +4 -0
@@ -1009,6 +1009,10 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)if (next_hdr->type ==SCTP_CID_COOKIE_ECHO ) { chunk->auth_chunk =skb_clone (chunk->skb,GFP_ATOMIC ); +if (!chunk->auth_chunk) { + chunk->pdiscard =1 ; +continue ; + } chunk->auth =1 ;continue ; }
net/sctp/endpointola.c +4 -0
@@ -368,6 +368,10 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)if (next_hdr->type ==SCTP_CID_COOKIE_ECHO ) { chunk->auth_chunk =skb_clone (chunk->skb,GFP_ATOMIC ); +if (!chunk->auth_chunk) { + chunk->pdiscard =1 ; +continue ; + } chunk->auth =1 ;continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 541/1005 dt-bindings: interrupt-controller: gicv5: Relax IRS properties constraints
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
[ Upstream commit 1d77e79d62cfe46ad3619d42ee0d1ebd3f0f79f4 ]
An IRS is architecturally allowed to be stand-alone (ie with no direct CPU connection).
Relax "cpus" and "arm,iaffids" properties constraints allowing a standalone IRS configuration.
--- .../bindings/interrupt-controller/arm,gic-v5.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v5.yaml +6 -3
@@ -120,13 +120,14 @@ patternProperties: cpus: description: - CPUs managed by the IRS. + CPUs managed by the IRS. Omit it if the IRS has no associated CPUs. arm,iaffids: $ref: /schemas/types.yaml#/definitions/uint16-array description: Interrupt AFFinity ID (IAFFID) associated with the CPU whose CPU node phandle is at the same index in the cpus array. + Omit it if the IRS has no associated CPUs. patternProperties: "^its@[0-9a-f]+$":
@@ -210,12 +211,14 @@ patternProperties: - reg - reg-names + dependencies: + cpus: [ "arm,iaffids" ] + arm,iaffids: [ cpus ] + required: - compatible - reg - reg-names - - cpus - - arm,iaffids additionalProperties: false
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 542/1005 irqchip/gic-v5: Fix standalone IRSes OF probe
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
[ Upstream commit 64212d63193cfd81849f5948365c7b0ecd011745 ]
An IRS is architecturally allowed to be standalone, namely, with no direct CPUs connections. Make sure such configuration is allowed on OF firmware by skipping "cpus" and "arm,iaffids" IRS node properties parsing if they are not present so that the IRS configuration can complete successfully.
--- drivers/irqchip/irq-gic-v5-irs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/irqchip/irq-gic-v5-irs.c +4 -0
@@ -604,6 +604,10 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node,u16 iaffid_mask =GENMASK (iaffid_bits -1 ,0 );int ret, i, ncpus, niaffids; +/* An IRS is architecturally allowed to have no cpus associated with it */ +if (!of_property_present (node,"cpus" ) && !of_property_present (node,"arm,iaffids" )) +return 0 ; + ncpus =of_count_phandle_with_args (node,"cpus" ,NULL );if (ncpus <0 )return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 543/1005 drm/xe/display: skip FORCE_WC and vm_bound check for external dma-bufs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Auld <[email protected]>
[ Upstream commit 3e493f88c84088ccd7b53cdd23ac5c875c9a60dd ]
Currently, xe_display_bo_framebuffer_init() unconditionally attempts to apply XE_BO_FLAG_FORCE_WC to the buffer and rejects the FB creation with -EINVAL if the BO is already VM_BINDed.
However, for imported dma-bufs (ttm_bo_type_sg), this check doesn't seem to make much sense since CPU caching policy is entirely controlled by the exporter. Plus there is no place to set this flag, in the first place. Also this is not rejected if not yet vm_binded, but that seems arbitrary since setting or not setting FORCE_WC should a noop either way, at this stage, and whether it is currently VM_BINDed makes no difference.
Currently if we run an app and offload rendering to an external dGPU, like NV or another xe device, the dma-buf passed back to the compositor (igpu) will be an actual external import from xe pov, and it will be missing FORCE_WC, and if the compositor side did a VM_BIND before turning into it into an fb the whole thing gets rejected.
So it looks like we either need to reject outright, no matter what, or this usecase is valid and we need to loosen the restriction for sg buffers. Proposing here to loosen the restriction.
--- drivers/gpu/drm/xe/display/intel_fb_bo.c | 3 ++- drivers/gpu/drm/xe/display/xe_fb_pin.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/intel_fb_bo.c +2 -1
@@ -46,7 +46,8 @@ int intel_fb_bo_framebuffer_init(struct drm_framebuffer *fb,if (ret) goto err; -if (!(bo->flags &XE_BO_FLAG_SCANOUT )) { +if (!(bo->flags &XE_BO_FLAG_SCANOUT ) && + bo->ttm.type != ttm_bo_type_sg) {/* * XE_BO_FLAG_SCANOUT should ideally be set at creation, or is * automatically set when creating FB. We cannot change caching
drivers/gpu/drm/xe/display/xe_fb_pin.c +2 -1
@@ -420,7 +420,8 @@ int intel_plane_pin_fb(struct intel_plane_state *new_plane_state,return 0 ;/* We reject creating !SCANOUT fb's, so this is weird.. */ -drm_WARN_ON (bo->ttm.base.dev, !(bo->flags &XE_BO_FLAG_SCANOUT )); +drm_WARN_ON (bo->ttm.base.dev, !(bo->flags &XE_BO_FLAG_SCANOUT ) && + bo->ttm.type != ttm_bo_type_sg); vma =__xe_pin_fb_vma (intel_fb, &new_plane_state->view.gtt, alignment);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 544/1005 KVM: x86: Always initialize EFER reserved bits on vendor initialization
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
[ Upstream commit a4b8acd428ba3f03952ef309d7f438dbc357557b ]
EFER reserved bits are statically initialized, and do not reset if a vendor module is re-loaded. For example, loading kvm_amd with nested=1 removes EFER.SVME (and potentially EFER.LMSLE) from the reserved bits. Reloading kvm_amd with nested=0 does not add them back, allowing userspace to set EFER.SVME with nested=0.
Re-initializing EFER reserved bits before configuring them on vendor initialization.
--- arch/x86/kvm/x86.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +9 -2
@@ -106,8 +106,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_host);#define emul_to_vcpu (ctxt) \ ((struct kvm_vcpu *)(ctxt)->vcpu) -/* Enable syscall by default because its emulated by KVM */ -static u64 __read_mostly efer_reserved_bits = ~((u64 )EFER_SCE ); +static u64 __read_mostly efer_reserved_bits;#define KVM_EXIT_HYPERCALL_VALID_MASK (1 << KVM_HC_MAP_GPA_RANGE)
@@ -1432,6 +1431,12 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)return 0 ; } +static void kvm_init_efer_bits (void ) +{ +/* Enable syscall by default because its emulated by KVM */ + efer_reserved_bits = ~((u64 )EFER_SCE ); +} +void kvm_enable_efer_bits (u64 mask) { efer_reserved_bits &= ~mask;
@@ -9757,6 +9762,8 @@ int kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)if (boot_cpu_has (X86_FEATURE_ARCH_CAPABILITIES ))rdmsrq (MSR_IA32_ARCH_CAPABILITIES , kvm_host.arch_capabilities); +kvm_init_efer_bits (); + r = ops->hardware_setup ();if (r !=0 ) goto out_mmu_exit;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 545/1005 mm/migrate: use huge_ptep_get() in remove_migration_pte()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dev Jain <[email protected]>
[ Upstream commit ac1ec50d71b953524100ddc09057ee61a3dfaff3 ]
remove_migration_pte() converts migration entries back to present PTEs after folio migration completes. For hugetlb folios, page_vma_mapped_walk() returns the pte pointer to the hugetlb folio in pvmw.pte, but the code reads it with ptep_get().
On arches which provide their own huge_ptep_get() to dereference a huge pte pointer, accessing via ptep_get() would cause pte_pfn(), pte_present() etc to misbehave.
It is not clear whether this has a trivially visible effect to userspace.
Use huge_ptep_get() to dereference a huge pte pointer.
--- mm/migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mm/migrate.c +5 -1
@@ -370,7 +370,11 @@ static bool remove_migration_pte(struct folio *folio, continue; }#endif - old_pte =ptep_get (pvmw.pte); +if (folio_test_hugetlb (folio)) + old_pte =huge_ptep_get (vma->vm_mm, pvmw.address, + pvmw.pte); +else + old_pte =ptep_get (pvmw.pte);if (rmap_walk_arg->map_unused_to_zeropage &&try_to_map_unused_to_zeropage (&pvmw, folio, old_pte, idx))continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 546/1005 HID: input: read battery capacity from its actual report offset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Villaseñor Montfort <[email protected]>
[ Upstream commit d07644524b6511b622ee7b0e2e68c9ee43d522a4 ]
hidinput_query_battery_capacity() assumes the state-of-charge value is the first byte following the report ID (buf[1]) and ignores where the battery field actually sits within the report.
An Apple Magic Trackpad 2 precedes the AbsoluteStateOfCharge byte with a byte of status flags in its battery reports, so this query returns the flags byte instead of the charge level.
The device happens to make that easy to observe, because it exposes the same cell twice: its report descriptor declares AbsoluteStateOfCharge in two reports (0x90 and 0x9b), so hidinput_setup_battery() registers two power supplies. Only the first one is refreshed by hid-magicmouse -- it uses hid_get_battery(), which returns the first battery of the list -- and that refresh goes through the report event path, which parses the field correctly. Nothing ever reports the second one, so every read of its capacity takes the query path above. On a USB-C Magic Trackpad over USB, on an unpatched 7.1.5:
hid-<serial>-battery-144 = 100% (Charging) <- report event path hid-<serial>-battery-155 = 3% (Discharging) <- query path
Both are the same physical battery. A raw HIDIOCGINPUT of the two reports at that same moment:
report 0x90 -> [90 03 64]
report 0x9b -> [9b 03 64 64 00 00 10 00 00 00 00 00 00 00]
^flags ^SoC = 0x64 = 100%
The device answers correctly in both cases; only the offset the kernel reads the capacity from is wrong. 0x03 is the flags byte (present, charging), reported as "3%".
Bluetooth takes the same query path for its capacity, where the trackpad reported a bogus near-constant ~4% -- 0b100, the FullyCharged flag -- regardless of the real charge.
Store the battery field's offset within the report at setup time and use it when querying, so the capacity is read from its real position. The report event path already parses the field correctly through the HID core; only the explicit GET_REPORT query was wrong.
Devices whose capacity field is the first field in the report have a report_offset of 0 and are unaffected (buf[1 + 0] == buf[1]).
--- drivers/hid/hid-input.c | 17 +++++++++++++---- include/linux/hid.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/hid/hid-input.c +13 -4
@@ -437,19 +437,27 @@ static int hidinput_query_battery_capacity(struct hid_device *dev) {u8 *buf;int ret; +/* +* The capacity field may not be the first field in the report: some +* devices (e.g. the Apple Magic Trackpad 2 over Bluetooth) precede it +* with status flags. Read it from its actual byte offset in the report +* (report_offset is in bits; the leading byte is the report id). +*/ +int offset =1 + dev->battery_report_offset /8 ; +int len = offset +1 ; - buf =kmalloc (4 ,GFP_KERNEL ); + buf =kmalloc (max (len,4 ),GFP_KERNEL );if (!buf)return -ENOMEM ; - ret =hid_hw_raw_request (dev, dev->battery_report_id, buf,4 , + ret =hid_hw_raw_request (dev, dev->battery_report_id, buf,max (len,4 ), dev->battery_report_type,HID_REQ_GET_REPORT ); -if (ret <2 ) { +if (ret < len) {kfree (buf);return -ENODATA ; } - ret =hidinput_scale_battery_capacity (dev, buf[1 ]); + ret =hidinput_scale_battery_capacity (dev, buf[offset]);kfree (buf);return ret; }
@@ -567,6 +575,7 @@ static int hidinput_setup_battery(struct hid_device *dev, unsigned report_type, dev->battery_max = max; dev->battery_report_type = report_type; dev->battery_report_id = field->report->id; + dev->battery_report_offset = field->report_offset; dev->battery_charge_status =POWER_SUPPLY_STATUS_DISCHARGING ;/*
include/linux/hid.h +1 -0
@@ -679,6 +679,7 @@ struct hid_device {__s32 battery_max;__s32 battery_report_type;__s32 battery_report_id; +__s32 battery_report_offset;__s32 battery_charge_status;enum hid_battery_status battery_status;bool battery_avoid_query;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 547/1005 mm/page_alloc: dont spin_trylock() when disallowed in free_one_page()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brendan Jackman <[email protected]>
[ Upstream commit 52dcc33881e55189650404f833c0e6b7913d6c16 ]
__free_frozen_pages() checks can_spin_trylock() before entering into the main free_frozen_page_commit()/free_one_page() path, but before this it can get to free_one_page() via the !pcp_allowed_order() and MIGRATE_ISOLATE paths.
The !pcp_allowed_order() path depends on usage by callers so might not be possible in practice. The MIGRATE_ISOLATE path probably means kernel crashes and privilege escalation if anyone ever did memory hotplug and BPF tracing on a PREEMPT_RT or !SMP build.
--- mm/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/page_alloc.c +3 -1
@@ -1585,7 +1585,9 @@ static void free_one_page(struct zone *zone, struct page *page,unsigned long flags;if (unlikely (fpi_flags &FPI_TRYLOCK )) { -if (!spin_trylock_irqsave (&zone->lock, flags)) { +if ((IS_ENABLED (CONFIG_PREEMPT_RT ) && (in_nmi () ||in_hardirq ())) || + (!IS_ENABLED (CONFIG_SMP ) &&in_nmi ()) || + !spin_trylock_irqsave (&zone->lock, flags)) {add_page_to_zone_llist (zone, page, order);return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 548/1005 i3c: master: Fix potential UAF in i3c_device_uevent()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit e5e8dd2e959f470524c16ca444d001c90d6bb3ad ]
i3c_device_uevent() dereferences i3cdev->desc without holding the bus normal-use lock. Since the descriptor pointer can be replaced concurrently, including when a uevent is generated from sysfs, this can result in dereferencing a stale descriptor and lead to a use-after-free.
Use i3c_device_get_info() instead, which protects access to the descriptor with the normal-use lock.
Commit 6cf7b65f7029 ("i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock") replaced the accessor with a direct descriptor dereference because i3c_device_get_info() would recursively acquire bus->lock during device registration.
This change depends on "i3c: master: Fix recursive locking during device registration", which moves device registration out from under bus->lock and removes the possibility of that deadlock. Without that change, restoring the i3c_device_get_info() call would reintroduce the deadlock.
--- drivers/i3c/master.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i3c/master.c +1 -2
@@ -315,8 +315,7 @@ static int i3c_device_uevent(const struct device *dev, struct kobj_uevent_env *estruct i3c_device_info devinfo;u16 manuf, part, ext; -if (i3cdev->desc) - devinfo = i3cdev->desc->info; +i3c_device_get_info (i3cdev, &devinfo); manuf =I3C_PID_MANUF_ID (devinfo.pid); part =I3C_PID_PART_ID (devinfo.pid); ext =I3C_PID_EXTRA_INFO (devinfo.pid);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 549/1005 LoongArch: KVM: Check kvm_request_pending() in kvm_late_check_requests()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit 14d2714d6537a9df5bea2515185034dbb9d30f03 ]
Add kvm_request_pending() checking firstly in kvm_late_check_requests(), at most time there is no pending request, then the following pending bit checking can be skipped.
Also embed function kvm_check_pmu() in to kvm_late_check_requests(), and put it after the kvm_request_pending() checking.
Stable-dep-of: 32d05564a612 ("LoongArch: KVM: Set vcpu->cpu before IN_GUEST_MODE is set")
--- arch/loongarch/kvm/vcpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/loongarch/kvm/vcpu.c +9 -9
@@ -148,14 +148,6 @@ static void kvm_lose_pmu(struct kvm_vcpu *vcpu)kvm_restore_host_pmu (vcpu); } -static void kvm_check_pmu (struct kvm_vcpu *vcpu) -{ -if (kvm_check_request (KVM_REQ_PMU , vcpu)) { -kvm_own_pmu (vcpu); - vcpu->arch.aux_inuse |=KVM_LARCH_PMU ; - } -} -static void kvm_update_stolen_time (struct kvm_vcpu *vcpu) {u32 version;
@@ -226,6 +218,15 @@ static int kvm_check_requests(struct kvm_vcpu *vcpu)static void kvm_late_check_requests (struct kvm_vcpu *vcpu) {lockdep_assert_irqs_disabled (); + +if (!kvm_request_pending (vcpu)) +return ; + +if (kvm_check_request (KVM_REQ_PMU , vcpu)) { +kvm_own_pmu (vcpu); + vcpu->arch.aux_inuse |=KVM_LARCH_PMU ; + } +if (kvm_check_request (KVM_REQ_TLB_FLUSH_GPA , vcpu))if (vcpu->arch.flush_gpa !=INVALID_GPA ) {kvm_flush_tlb_gpa (vcpu, vcpu->arch.flush_gpa);
@@ -285,7 +286,6 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)/* Make sure the vcpu mode has been written */ smp_store_mb (vcpu->mode,IN_GUEST_MODE );kvm_check_vpid (vcpu); -kvm_check_pmu (vcpu);/* * Called after function kvm_check_vpid()
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 550/1005 LoongArch: KVM: Deliver interrupt after IN_GUEST_MODE is set
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit 8c5cd2b9d6a724998c1ab9af06ac897b6152d568 ]
Interrupt delivery should be called after IN_GUEST_MODE is set. Other threads may be posting interrupt however does not send IPI to the vCPU, since the vCPU is not in IN_GUEST_MODE yet.
Here move function call with kvm_deliver_intr() after IN_GUEST_MODE is set, and set mode with OUTSIDE_GUEST_MODE with atomic method.
Stable-dep-of: 32d05564a612 ("LoongArch: KVM: Set vcpu->cpu before IN_GUEST_MODE is set")
--- arch/loongarch/kvm/vcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/kvm/vcpu.c +2 -2
@@ -281,10 +281,10 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)* check vmid before vcpu enter guest */ local_irq_disable (); -kvm_deliver_intr (vcpu);kvm_deliver_exception (vcpu);/* Make sure the vcpu mode has been written */ smp_store_mb (vcpu->mode,IN_GUEST_MODE ); +kvm_deliver_intr (vcpu);kvm_check_vpid (vcpu);/*
@@ -322,7 +322,7 @@ static int kvm_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)u32 intr = estat &CSR_ESTAT_IS ;u32 ecode = (estat &CSR_ESTAT_EXC ) >>CSR_ESTAT_EXC_SHIFT ; - vcpu->mode =OUTSIDE_GUEST_MODE ; +smp_store_mb (vcpu->mode,OUTSIDE_GUEST_MODE );/* Set a default exit reason */ run->exit_reason =KVM_EXIT_UNKNOWN ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 551/1005 LoongArch: KVM: Set vcpu->cpu before IN_GUEST_MODE is set
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit 32d05564a6128d59ea876cf9078fe6866a809e14 ]
In function kvm_make_vcpu_request(), it will send IPI to physical CPU when vCPU is in IN_GUEST_MODE mode. And physical CPU is set in function kvm_check_vpid(), thus it should be called before IN_GUEST_MODE is set. Otherwise IPI will send to wrong old physical CPU where vCPU is running.
--- arch/loongarch/kvm/vcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kvm/vcpu.c +1 -1
@@ -282,10 +282,10 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)*/ local_irq_disable ();kvm_deliver_exception (vcpu); +kvm_check_vpid (vcpu);/* Make sure the vcpu mode has been written */ smp_store_mb (vcpu->mode,IN_GUEST_MODE );kvm_deliver_intr (vcpu); -kvm_check_vpid (vcpu);/* * Called after function kvm_check_vpid()
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 552/1005 rust: bug: fix warn_on macro build error on UML
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUJITA Tomonori <[email protected]>
[ Upstream commit 30a449e04a32033d8e4844fdb4938a0ebccfa37b ]
Callers that go through kernel::prelude have CStrExt in scope, but code inside the kernel crate imports explicitly and may not. Using warn_on! from such a module fails to build on UML, which is the only configuration where warn_flags! needs a C string pointer rather than an inline asm bug entry:
error[E0599]: no method named as_char_ptr found for reference &ffi::CStr in the current scope
--> linux/rust/kernel/bug.rs:83:49
|
83 | $crate::c_str!(::core::file!()).as_char_ptr(),
| ^^^^^^^^^^^
|
::: linux/rust/kernel/time.rs:427:9
|
427 | warn_on!(self.nanos < 0);
| ------------------------ in this macro invocation
| = help: items from traits can only be used if the trait is in scope
= note: this error originates in the macro $crate::warn_flags which comes from the expansion of the macro warn_on (in Nightly builds, run with -Z mac)
help: trait CStrExt which provides as_char_ptr is implemented but not in scope; perhaps you want to import it
--> linux/rust/kernel/time.rs:27:1
|
27 + use crate::str::CStrExt;
Call the method through its fully qualified path, which resolves without any import at the expansion site.
--- rust/kernel/bug.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/bug.rs +1 -1
@@ -83,7 +83,7 @@ macro_rules! warn_flags {// with a valid null-terminated string. unsafe { $crate::bindings::warn_slowpath_fmt ( - $crate::c_str!(::core::file!()).as_char_ptr (), + $crate::str::CStrExt ::as_char_ptr ($crate::c_str!(::core::file!())),line! ()as $crate::ffi::c_int , $flagsas $crate::ffi::c_uint , ::core::ptr::null(),
Signature · 1 line
2.53.0
Re: [PATCH 6.18 0552/1005] rust: bug: fix warn_on macro build error on UML
Quoted 2 lines · On Wed, 04 Nov 2026 16:04:45 -0500 Greg Kroah-Hartman…
+ $crate::str::CStrExt::as_char_ptr($crate::c_str!(::core::file!())),
We would need CStrExt that we don't have in 6.18.y for this to work:
error[E0433]: failed to resolve: could not find `CStrExt` in `str`
--> drivers/android/binder/freeze.rs:109:13
|
109 | kernel::warn_on!(freeze.num_cleared_duplicates != 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `CStrExt` in `str`
|
= note: this error originates in the macro `$crate::warn_flags` which comes from the expansion of the macro `kernel::warn_on` (in Nightly builds, run with -Z macro-backtrace for more info)We should instead do e.g.
$crate::str::CStr::as_char_ptr($crate::c_str!(::core::file!())),
I can send a custom one, but we should drop this one.
Cheers,
Miguel
Greg Kroah-Hartman
maintainerPATCH 553/1005 nfsd: dedup nfs4_client_to_reclaim inserts
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 9b57793863f69c608691c98e57c2f9be2db9dfed ]
nfs4_client_to_reclaim() unconditionally allocates a new nfs4_client_reclaim, prepends it to reclaim_str_hashtbl[], and bumps reclaim_str_hashtbl_size with no check for an existing entry for the same client name. After a reboot with a populated recovery directory that inflates the counter by one for every client that reclaims:
boot: load_recdir()
nfs4_client_to_reclaim(name) /* entry #1, size++ */
grace: RECLAIM_COMPLETE
__nfsd4_create_reclaim_record_grace()
nfs4_client_to_reclaim(name) /* entry #2, size++ */inc_reclaim_complete() ends the grace period early only when
atomic_inc_return(&nn->nr_reclaim_complete) ==
nn->reclaim_str_hashtbl_sizeWith reclaim_str_hashtbl_size at 2N and nr_reclaim_complete capped at N, the equality never holds and the fast end-of-grace path is dead. The grace period always runs out the full 90-second laundromat timer, and the shadow entry left in the hash table carries a dangling cr_clp for any reader that walks it.
Fix nfs4_client_to_reclaim() to look the name up with nfsd4_find_reclaim_client() first and, on a hit, fold the new princhash into the existing record (if it lacks one) and return that record without allocating or touching reclaim_str_hashtbl_size. On kmemdup() failure during the fold-in, return NULL so __cld_pipe_inprogress_downcall() surfaces -EFAULT to nfsdcld, matching the miss-path contract.
Add an rw_semaphore (reclaim_str_hashtbl_lock) to struct nfsd_net that serialises all access to reclaim_str_hashtbl[] and reclaim_str_hashtbl_size. Writers (nfs4_client_to_reclaim, nfs4_remove_reclaim_record callers) hold the write side; readers (nfsd4_cld_check*, inc_reclaim_complete, clients_still_reclaiming, nfs4_has_reclaimed_state, nfsd4_check_legacy_client) hold the read side. All call sites are in sleepable context, and none is a hot path, so the rwsem cost is negligible.
--- fs/nfsd/netns.h | 6 ++++- fs/nfsd/nfs4recover.c | 36 ++++++++++++++++++++----- fs/nfsd/nfs4state.c | 61 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 89 insertions(+), 14 deletions(-)
fs/nfsd/netns.h +5 -1
@@ -93,6 +93,7 @@ struct nfsd_net {*/ struct list_head *reclaim_str_hashtbl;int reclaim_str_hashtbl_size; +struct rw_semaphore reclaim_str_hashtbl_lock;struct list_head *conf_id_hashtbl;struct rb_root conf_name_tree;struct list_head *unconf_id_hashtbl;
@@ -105,7 +106,10 @@ struct nfsd_net {* close_lru holds (open) stateowner queue ordered by nfs4_stateowner.so_time * for last close replay. * -* All of the above fields are protected by the client_mutex. +* reclaim_str_hashtbl[], reclaim_str_hashtbl_size are protected by +* reclaim_str_hashtbl_lock. +* +* All of the remaining fields are protected by the client_lock. */ struct list_head client_lru;struct list_head close_lru;
fs/nfsd/nfs4recover.c +29 -7
@@ -337,10 +337,12 @@ __nfsd4_remove_reclaim_record_grace(const char *dname, int len,return ; } name.len = len; +down_write (&nn->reclaim_str_hashtbl_lock); crp =nfsd4_find_reclaim_client (name, nn); -kfree (name.data);if (crp)nfs4_remove_reclaim_record (crp, nn); +up_write (&nn->reclaim_str_hashtbl_lock); +kfree (name.data); } static void
@@ -541,6 +543,7 @@ nfs4_legacy_state_init(struct net *net)for (i =0 ; i <CLIENT_HASH_SIZE ; i++)INIT_LIST_HEAD (&nn->reclaim_str_hashtbl[i]); nn->reclaim_str_hashtbl_size =0 ; +init_rwsem (&nn->reclaim_str_hashtbl_lock);return 0 ; }
@@ -660,13 +663,16 @@ nfsd4_check_legacy_client(struct nfs4_client *clp) goto out_enoent; } name.len =HEXDIR_LEN ; +down_read (&nn->reclaim_str_hashtbl_lock); crp =nfsd4_find_reclaim_client (name, nn); -kfree (name.data);if (crp) {set_bit (NFSD4_CLIENT_STABLE , &clp->cl_flags); crp->cr_clp = clp; -return 0 ; } +up_read (&nn->reclaim_str_hashtbl_lock); +kfree (name.data); +if (crp) +return 0 ; out_enoent:return -ENOENT ;
@@ -1238,6 +1244,7 @@ nfsd4_cld_check(struct nfs4_client *clp)return 0 ;/* look for it in the reclaim hashtable otherwise */ +down_read (&nn->reclaim_str_hashtbl_lock); crp =nfsd4_find_reclaim_client (clp->cl_name, nn);if (crp) goto found;
@@ -1256,6 +1263,7 @@ nfsd4_cld_check(struct nfs4_client *clp)if (!name.data) {dprintk ("%s: failed to allocate memory for name.data!\n" , __func__); +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; } name.len =HEXDIR_LEN ;
@@ -1266,9 +1274,11 @@ nfsd4_cld_check(struct nfs4_client *clp) }#endif +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; found: crp->cr_clp = clp; +up_read (&nn->reclaim_str_hashtbl_lock);return 0 ; }
@@ -1280,6 +1290,7 @@ nfsd4_cld_check_v2(struct nfs4_client *clp)struct cld_net *cn = nn->cld_net;#endif struct nfs4_client_reclaim *crp; +unsigned int princhashlen;char *principal =NULL ;/* did we already find that this client is stable? */
@@ -1287,6 +1298,7 @@ nfsd4_cld_check_v2(struct nfs4_client *clp)return 0 ;/* look for it in the reclaim hashtable otherwise */ +down_read (&nn->reclaim_str_hashtbl_lock); crp =nfsd4_find_reclaim_client (clp->cl_name, nn);if (crp) goto found;
@@ -1305,6 +1317,7 @@ nfsd4_cld_check_v2(struct nfs4_client *clp)if (!name.data) {dprintk ("%s: failed to allocate memory for name.data\n" , __func__); +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; } name.len =HEXDIR_LEN ;
@@ -1315,23 +1328,31 @@ nfsd4_cld_check_v2(struct nfs4_client *clp) }#endif +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; found: -if (crp->cr_princhash.len) { + princhashlen = crp->cr_princhash.len; +if (princhashlen) {u8 digest[SHA256_DIGEST_SIZE ]; +u8 *pdata;if (clp->cl_cred.cr_raw_principal) principal = clp->cl_cred.cr_raw_principal;else if (clp->cl_cred.cr_principal) principal = clp->cl_cred.cr_principal; -if (principal ==NULL ) +if (principal ==NULL ) { +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; + }sha256 (principal,strlen (principal), digest); -if (memcmp (crp->cr_princhash.data, digest, - crp->cr_princhash.len)) + pdata = crp->cr_princhash.data; +if (memcmp (pdata, digest, princhashlen)) { +up_read (&nn->reclaim_str_hashtbl_lock);return -ENOENT ; + } } crp->cr_clp = clp; +up_read (&nn->reclaim_str_hashtbl_lock);return 0 ; }
@@ -1431,6 +1452,7 @@ nfs4_cld_state_init(struct net *net)for (i =0 ; i <CLIENT_HASH_SIZE ; i++)INIT_LIST_HEAD (&nn->reclaim_str_hashtbl[i]); nn->reclaim_str_hashtbl_size =0 ; +init_rwsem (&nn->reclaim_str_hashtbl_lock);set_bit (NFSD_NET_TRACK_RECLAIM_COMPLETES , &nn->flags);atomic_set (&nn->nr_reclaim_complete,0 );
fs/nfsd/nfs4state.c +55 -6
122 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 554/1005 nfsd: use test_and_clear_bit for somebody_reclaimed to prevent lost update
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 0a5a548861ab09e79a6b3062ac17e410323af3cd ]
clients_still_reclaiming() uses separate test_bit() and clear_bit() calls on NFSD_NET_SOMEBODY_RECLAIMED. A concurrent set_bit() from the OPEN or LOCK reclaim path arriving between the test and clear is silently lost, causing the next laundromat tick to end grace prematurely.
Replace with test_and_clear_bit() to make the read-and-clear atomic.
--- fs/nfsd/nfs4state.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfs4state.c +1 -2
@@ -6856,9 +6856,8 @@ static bool clients_still_reclaiming(struct nfsd_net *nn)if (atomic_read (&nn->nr_reclaim_complete) == size)return false; } -if (!test_bit (NFSD_NET_SOMEBODY_RECLAIMED , &nn->flags)) +if (!test_and_clear_bit (NFSD_NET_SOMEBODY_RECLAIMED , &nn->flags))return false; -clear_bit (NFSD_NET_SOMEBODY_RECLAIMED , &nn->flags);/* * If we've given them *two* lease times to reclaim, and they're * still not done, give up:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 555/1005 LoongArch: Expand module virtual address space to 2GB
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit 18210a104bb97e28c26dc31fd9fc7b5c381fec62 ]
The current 256MB module virtual address space is easily exhausted when loading massive graphics drivers such as amdgpu along with the large unstripped symbol tables, resulting in allocation failures of "execmem:
unable to allocate memory".
Thus, expand the module virtual address space to 2GB while keeping the current normal code model '-mcmodel=normal', rather than using the medium code model '-mcmodel=medium'. This approach avoids the extra performance overhead and larger binary size of forcing every function call into a 2-instruction sequence of 'pcaddu18i + jirl'.
Given that individual module code segments rarely exceed 128MB, most jumps remain fast direct calls by using the bl instruction. For the long-distance jumps exceeding the +/-128MB limit, apply_r_larch_b26() emits PLT entries, while signed_imm_check() guarantees the run-time safety by rejecting any out-of-bound instruction offsets.
There is still a risk that the distance between .init.text and .text of the same module exceeds 128MB. So we divide the 2GB virtual space to be two sub-regions: the first 256MB is for module text, and the rest is for module data.
--- arch/loongarch/include/asm/pgtable.h | 2 +- arch/loongarch/mm/init.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-)
arch/loongarch/include/asm/pgtable.h +1 -1
@@ -80,7 +80,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];* still reliably trap. */ #define MODULES_VADDR (vm_map_base + PCI_IOSIZE + (2 * PAGE_SIZE)) -#define MODULES_END (MODULES_VADDR + SZ_256M) +#define MODULES_END (MODULES_VADDR + SZ_2G)/* 256MB for text, rest for data */ #ifdef CONFIG_KFENCE #define KFENCE_AREA_SIZE (((CONFIG_KFENCE_NUM_OBJECTS + 1) * 2 + 2) * PAGE_SIZE)
arch/loongarch/mm/init.c +14 -3
@@ -221,15 +221,26 @@ pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss;EXPORT_SYMBOL (invalid_pte_table);#ifdef CONFIG_EXECMEM +#define MODULES_TEXT_START (MODULES_VADDR) +#define MODULES_TEXT_END (MODULES_VADDR + SZ_256M) +#define MODULES_DATA_START (MODULES_VADDR + SZ_256M) +#define MODULES_DATA_END (MODULES_END) +static struct execmem_info execmem_info__ro_after_init ;struct execmem_info __init *execmem_arch_setup (void ) { execmem_info = (struct execmem_info ){ .ranges = { - [EXECMEM_DEFAULT ] = { - .start =MODULES_VADDR , - .end =MODULES_END , + [EXECMEM_MODULE_TEXT ] = { + .start =MODULES_TEXT_START , + .end =MODULES_TEXT_END , + .pgprot =PAGE_KERNEL , + .alignment =1 , + }, + [EXECMEM_MODULE_DATA ] = { + .start =MODULES_DATA_START , + .end =MODULES_DATA_END , .pgprot =PAGE_KERNEL , .alignment =1 , },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 556/1005 rust: cfi: disable function merging if CFI is enabled
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Guo <[email protected]>
[ Upstream commit 29b03d1de967a177176d12811d970cac7882afcf ]
In Rust doc tests, there is a dummy __module_firmware_test_init function generated by the example in module_firmware!'s documentation, which just returns zero. Many other documentation examples generate functions that produce zero. LKP test robot reports [1] a Flags::zeroed instance; my local reproduction has a Bounded::new::<0>.
LLVM's MergeFunctionsPass incorrectly merges functions with different KCFI types, causing __module_firmware_test_init to be merged into one of the zero-returning functions. As module init is invoked via an indirect function call, KCFI is checked and this produces a KCFI failure.
I've reported this bug to upstream LLVM [2]; in the meantime, disable function merging if CFI is enabled. No separate treatment is needed for CONFIG_RUST_INLINE_HELPERS, as Clang does not enable function merging by default.
[ LLVM already has a pending PR:
https://github.com/llvm/llvm-project/pull/217665
which solves the issue. In addition, I asked upstream Rust if the unstable -Zmerge-functions=disabled flag will remain around:
https://rust-lang.zulipchat.com/#narrow/channel/425075-rust-for-linux/topic/.60-Zmerge-functions.3Ddisabled.60/
and it does indeed look like that will be the case. - Miguel ]
--- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
@@ -1037,7 +1037,8 @@ endif ifdef CONFIG_RUST # Always pass -Zsanitizer-cfi-normalize-integers as CONFIG_RUST selects # CONFIG_CFI_ICALL_NORMALIZE_INTEGERS. - RUSTC_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers + # Disable function merging as LLVM incorrectly merges functions with different KCFI types. + RUSTC_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zmerge-functions=disabled KBUILD_RUSTFLAGS += $(RUSTC_FLAGS_CFI) export RUSTC_FLAGS_CFI endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 557/1005 mm/kmemleak: stop the task stack scan early when interrupted
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit eb11f56eeca56069613d00bf623607e305b271d9 ]
scan_block() already checks scan_should_stop() for every pointer and bails out of the current block, but the task stack walk cannot tell and keeps issuing a separate scan_should_stop() between every task.
Return that status from scan_block() and use it as the task stack loop condition, so the walk stops as soon as a scan is interrupted.
Stable-dep-of: 3541a2b06ecd ("mm/kmemleak: report RCU-tasks quiescent states during the scan")
--- mm/kmemleak.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
mm/kmemleak.c +12 -6
@@ -1518,22 +1518,25 @@ static int scan_should_stop(void)/* * Scan a memory block (exclusive range) for valid pointers and add those -* found to the gray list. +* found to the gray list. Return non-zero if the scan was interrupted. */ -static void scan_block (void *_start,void *_end, -struct kmemleak_object *scanned) +static int scan_block (void *_start,void *_end, +struct kmemleak_object *scanned) {unsigned long *ptr;unsigned long *start =PTR_ALIGN (_start,BYTES_PER_POINTER );unsigned long *end = _end - (BYTES_PER_POINTER -1 );unsigned long flags; +int stop =0 ;raw_spin_lock_irqsave (&kmemleak_lock, flags);for (ptr = start; ptr < end; ptr++) {unsigned long pointer; -if (scan_should_stop ()) +if (scan_should_stop ()) { + stop =1 ;break ; + }kasan_disable_current (); pointer = *(unsigned long *)kasan_reset_tag ((void *)ptr);
@@ -1543,6 +1546,8 @@ static void scan_block(void *_start, void *_end,pointer_update_refs (scanned, pointer,OBJECT_PERCPU ); }raw_spin_unlock_irqrestore (&kmemleak_lock, flags); + +return stop; }/*
@@ -1698,6 +1703,7 @@ static void kmemleak_scan_task_stacks(void) {struct pid *pid;int nr =1 ; +int stop =0 ; do { struct task_struct *p = NULL;
@@ -1716,13 +1722,13 @@ static void kmemleak_scan_task_stacks(void)void *stack =try_get_task_stack (p);if (stack) { -scan_block (stack, stack +THREAD_SIZE ,NULL ); + stop =scan_block (stack, stack +THREAD_SIZE ,NULL );put_task_stack (p); }put_task_struct (p); }cond_resched (); - }while (pid && !scan_should_stop ()); + }while (pid && !stop); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 558/1005 mm/kmemleak: report RCU-tasks quiescent states during the scan
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 3541a2b06ecd78ba333188df04368dcf97273d6a ]
kmemleak_scan() can run for ages on large debug kernels. It was causing some soft-lockups which I got fixed with commit 3175fcfec8b16baeb ("mm/kmemleak: avoid soft lockup when scanning task stacks") with our beloved cond_resched().
I've got the fix above deployed in the Meta fleet, and now I am seeing:
INFO: rcu_tasks detected stalls on tasks:
task:kmemleak state:R ... nvcsw: 274/274 holdout: 1 idle_cpu: -1/3
scan_block
scan_gray_list
kmemleak_scanand, worse, blocks the callers waiting on that grace period. Here a BPF struct_ops map free, which waits via synchronize_rcu_mult(call_rcu, call_rcu_tasks), is stuck long enough to also trip the hung task check:
INFO: task kworker/...:bpf_map_free_deferred blocked for 122 seconds
__wait_rcu_gp
bpf_struct_ops_map_freeThen I've learned that cond_resched() is not an RCU-tasks quiescent state, so, we need to use stronger primitives.
Use cond_resched_tasks_rcu_qs() at the scan reschedule points so the scan reports an RCU-tasks quiescent state as it proceeds.
Inspired by commit b96285e10aad ("tracing: Have osnoise_main() add a quiescent state for task rcu").
--- mm/kmemleak.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
mm/kmemleak.c +7 -7
@@ -1562,7 +1562,7 @@ static void scan_large_block(void *start, void *end) next =min (start +MAX_SCAN_SIZE , end);scan_block (start, next,NULL ); start = next; - cond_resched(); + cond_resched_tasks_rcu_qs(); } }#endif
@@ -1597,7 +1597,7 @@ static void scan_object(struct kmemleak_object *object)scan_block (start, end, object);raw_spin_unlock_irqrestore (&object->lock, flags); -cond_resched (); +cond_resched_tasks_rcu_qs ();raw_spin_lock_irqsave (&object->lock, flags);if (!(object->flags &OBJECT_ALLOCATED ))break ;
@@ -1619,7 +1619,7 @@ static void scan_object(struct kmemleak_object *object)break ;raw_spin_unlock_irqrestore (&object->lock, flags); -cond_resched (); +cond_resched_tasks_rcu_qs ();raw_spin_lock_irqsave (&object->lock, flags); }while (object->flags &OBJECT_ALLOCATED ); }else {
@@ -1647,7 +1647,7 @@ static void scan_gray_list(void)*/ object =list_entry (gray_list.next,typeof (*object), gray_list);while (&object->gray_list != &gray_list) { -cond_resched (); +cond_resched_tasks_rcu_qs ();/* may add new objects to the list */ if (!scan_should_stop ())
@@ -1682,7 +1682,7 @@ static void kmemleak_cond_resched(struct kmemleak_object *object)raw_spin_unlock_irq (&kmemleak_lock);rcu_read_unlock (); -cond_resched (); +cond_resched_tasks_rcu_qs ();rcu_read_lock ();raw_spin_lock_irq (&kmemleak_lock);
@@ -1727,7 +1727,7 @@ static void kmemleak_scan_task_stacks(void) }put_task_struct (p); } -cond_resched (); +cond_resched_tasks_rcu_qs (); }while (pid && !stop); }
@@ -1803,7 +1803,7 @@ static void kmemleak_scan(void)struct page *page =pfn_to_online_page (pfn);if (!(pfn &63 )) -cond_resched (); +cond_resched_tasks_rcu_qs ();if (!page)continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 559/1005 mm/migrate_device: clear stale mapping after freeing swapcache
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 34a00895d032a414830d41106a09329ae6c251b6 ]
__migrate_device_pages() reads the folio mapping before calling folio_free_swap(). When folio_free_swap() succeeds, the folio is removed from the swap cache, but the saved mapping still points to swap_space.
Passing the stale mapping to folio_migrate_mapping() makes it use the mapped-folio path for a folio that is no longer in swapcache. It can then operate on swap_space.i_pages with invalid reference accounting, eventually triggering a folio reference count BUG.
After a successful split, nr still contains the number of pages in the original large folio, although each resulting page is now a separate order-0 folio. Reset nr to 1 so each split folio is processed separately, including its own swapcache removal and mapping lookup.
Refresh the saved mapping after folio_free_swap() so the current folio state is used during migration.
--- mm/migrate_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/migrate_device.c +6 -0
@@ -765,6 +765,12 @@ static void __migrate_device_pages(unsigned long *src_pfns, src_pfns[i] &= ~MIGRATE_PFN_MIGRATE ;continue ; } + +/* +* folio_free_swap() removed the folio from the swap +* cache. Refresh the saved mapping before migration. +*/ + mapping =folio_mapping (folio); } }else if (folio_is_zone_device (newfolio)) {/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 560/1005 smb: client: reject SetEA requests that do not fit the request buffer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunpeng Tian <[email protected]>
[ Upstream commit 4aa2c106aef4bf3dfd97c30842db0767b26e8428 ]
CIFSSMBSetEA() copies the caller's extended attribute value into the SMB request buffer without checking that it fits. The requirement is stated in the source but was never implemented:
/*BB add length check to see if it would fit in negotiated SMB buffer size BB */ /* if (ea_value_len > buffer_size - 512 (enough for header)) */ if (ea_value_len) memcpy(parm_data->list.name + name_len + 1, ea_value, ea_value_len);
The only bound applied on the way in is in cifs_xattr_set():
#define MAX_EA_VALUE_SIZE CIFSMaxBufSize ... if (size > MAX_EA_VALUE_SIZE)
CIFSMaxBufSize is the full payload capacity of the buffer, so a value of exactly that size leaves no room for the SMB header, the TRANS2 parameter block, the fealist header and the EA name that are written ahead of it in the same object.
SendReceive() already enforces the correct limit on this very length:
if (in_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)
but it is called after the copy has taken place. An unprivileged setxattr(2) on an SMB1 mount with a 250-byte name and a 16384-byte value writes 16384 bytes starting 345 bytes into a 16588-byte cifs_request object, ending 141 bytes past it:
BUG: KASAN: slab-out-of-bounds in CIFSSMBSetEA+0xabc/0xde0 Write of size 16384 at addr ffff888003aa0159 by task init/68 __asan_memcpy+0x3c/0x60 CIFSSMBSetEA+0xabc/0xde0 cifs_xattr_set+0xd3a/0xff0 __vfs_setxattr+0x13e/0x1a0 The buggy address is located 345 bytes inside of allocated 16588-byte region
Apply SendReceive()'s limit to the assembled request before the copy rather than after it, and widen the byte counters so the sum cannot wrap before it is tested.
byte_count is also tested against U16_MAX, because it is stored in the 16-bit pSMB->ByteCount. That becomes reachable when CIFSMaxBufSize is raised at module load, where it may be set as high as 1024*127: with a 5-byte EA name and a 65521-byte value, count is exactly U16_MAX while byte_count is 65556, and cpu_to_le16() would truncate it to 20 and transmit a frame whose ByteCount does not match its length. Testing byte_count covers count as well, since byte_count is the larger of the two and count's only 16-bit consumer is written after this point.
check_add_overflow() is evaluated first so that total_len is assigned before it is reported.
--- fs/smb/client/cifssmb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/smb/client/cifssmb.c +11 -1
@@ -6245,8 +6245,10 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,int name_len;int rc =0 ;int bytes_returned =0 ; -__u16 params, param_offset, byte_count, offset, count; +__u16 params, param_offset; +unsigned int byte_count, offset, count;int remap =cifs_remap (cifs_sb); +unsigned int total_len;cifs_dbg (FYI ,"In SetEA\n" ); SetEARetry:
@@ -6297,6 +6299,14 @@ CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, pSMB->Reserved3 =0 ; pSMB->SubCommand =cpu_to_le16 (TRANS2_SET_PATH_INFORMATION ); byte_count =3 /* pad */ + params + count; +if (check_add_overflow (be32_to_cpu (pSMB->hdr.smb_buf_length) +4 , + byte_count, &total_len) || + byte_count >U16_MAX || + total_len > CIFSMaxBufSize +MAX_CIFS_HDR_SIZE ) { +cifs_dbg (VFS ,"EA request too large: %u bytes\n" , total_len); +cifs_buf_release (pSMB); +return -E2BIG ; + } pSMB->DataCount =cpu_to_le16 (count); parm_data->list_len =cpu_to_le32 (count); parm_data->list.EA_flags =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 561/1005 riscv: hwprobe: initialize pair->value in hwprobe_one_pair()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Chiu <[email protected]>
[ Upstream commit d0fc6fab20460add1f27402cd8b945d094a56b21 ]
The vendor-extension handlers reached from hwprobe_one_pair() (hwprobe_isa_vendor_ext_thead_0() and friends) only OR the present bits into pair->value via VENDOR_EXTENSION_SUPPORTED() and clear their own missing bits; they assume the caller has already zeroed pair->value.
That holds for hwprobe_get_values() (it zeroes each pair) and hwprobe_get_cpus() (it re-initializes its scratch pair per key), but not for complete_hwprobe_vdso_data(), which reuses a single pair across all keys without re-zeroing. A vendor key therefore inherits stale bits from the previously probed key, and the wrong value is cached in the vDSO all_cpu_hwprobe_values[] and handed to userspace on the fast patih.
Zero pair->value once at the top of hwprobe_one_pair() so every handler starts from a clean value regardless of the caller, and drop the now redundant zeroing in the *_BLOCK_SIZE cases. hwprobe_isa_ext0() keeps its own zeroing because hwprobe_ext0_has() calls it directly, bypassing hwprobe_one_pair().
--- arch/riscv/kernel/sys_hwprobe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sys_hwprobe.c +2 -2
@@ -263,6 +263,8 @@ static u64 hwprobe_vec_misaligned(const struct cpumask *cpus)static void hwprobe_one_pair (struct riscv_hwprobe *pair,const struct cpumask *cpus) { + pair->value =0 ; +switch (pair->key) {case RISCV_HWPROBE_KEY_MVENDORID :case RISCV_HWPROBE_KEY_MARCHID :
@@ -293,12 +295,10 @@ static void hwprobe_one_pair(struct riscv_hwprobe *pair,break ;case RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE : - pair->value =0 ;if (hwprobe_ext0_has (cpus,RISCV_HWPROBE_EXT_ZICBOZ )) pair->value = riscv_cboz_block_size;break ;case RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE : - pair->value =0 ;if (hwprobe_ext0_has (cpus,RISCV_HWPROBE_EXT_ZICBOM )) pair->value = riscv_cbom_block_size;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 562/1005 ipv6: udp: Create exceptions before socket matching
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit ac76cab50e899a7346408b8d3c3a4192c2eefb9f ]
Currently, when ICMPv6 Packet Too Big and Redirect Message packets are locally delivered and quote a UDP packet, an exception is only created in the IPv6 exception cache if the kernel can match the UDP packet to an existing socket.
This behavior allows off-path attackers to conduct a side-channel attack on the exception cache in order to discover the ephemeral port used by a connected UDP socket.
Commit 4785305c05b2 ("ipv6: use siphash in rt6_exception_hash()") and commit a00df2caffed ("ipv6: make exception cache less predictible") tried to mitigate such attacks by making it harder for attackers to discover hash collisions in the exception cache and by randomizing the number of exceptions a hash bucket can hold, respectively. Unfortunately, both of the mitigations can be bypassed.
Instead, mitigate such attacks by always creating an exception, even before trying to find a matching socket. Do that by calling ip6_update_pmtu() and ip6_redirect(), the helpers used when the quoted packet did not originate from a socket.
This means that guesses (right or wrong) from an off-path attacker will always result in an exception being created or updated in the cache that the attacker can observe.
Pass the ifindex of the ingress device and the default uid, in a similar fashion to icmpv6_err(). Unlike IPv4, an oif of 0 would not match any nexthop in ip6_redirect_nh_match() and no exception would be created in response to a Redirect Message.
Note that this does not allow attackers to create exceptions that they could not create before, as both helpers can already be reached with little to no validation. For example, by sending an ICMPv6 error that quotes an ICMPv6 Echo Reply or one that quotes a UDP source port that matches a wildcard socket.
Also note that in the good case (matched socket) the above scheme comes at the cost of an extra route lookup, as the no socket helpers perform their own lookup before the one performed by ip6_sk_update_pmtu() / ip6_sk_redirect(). When the two resolve to different nexthops, it also results in two exceptions being created for the same destination IP. One in the exception cache of the nexthop resolved by the no socket helpers and another in the exception cache of the nexthop used by the socket.
--- net/ipv6/udp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/ipv6/udp.c +13 -0
@@ -701,6 +701,17 @@ static struct sock *__udp6_lib_err_encap(struct net *net,return sk; } +static void udpv6_err_update_exception (struct net *net,struct sk_buff *skb, +u8 type,__be32 info) +{ +if (type ==ICMPV6_PKT_TOOBIG ) +ip6_update_pmtu (skb, net, info, skb->dev->ifindex,0 , +sock_net_uid (net,NULL )); +else if (type ==NDISC_REDIRECT ) +ip6_redirect (skb, net, skb->dev->ifindex,0 , +sock_net_uid (net,NULL )); +} +int __udp6_lib_err (struct sk_buff *skb,struct inet6_skb_parm *opt,u8 type,u8 code,int offset,__be32 info,struct udp_table *udptable)
@@ -716,6 +727,8 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,int err;struct net *net =dev_net (skb->dev); +udpv6_err_update_exception (net, skb, type, info); + sk =__udp6_lib_lookup (net, daddr, uh->dest, saddr, uh->source,inet6_iif (skb),inet6_sdif (skb), udptable,NULL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 563/1005 thunderbolt: Make the DP tunnel activation callback mandatory
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Peter <[email protected]>
[ Upstream commit 12f5d8b85a66a0ac08d082517d92ce136f8c0d42 ]
tb_tunnel_alloc_dp() takes an optional callback which is run from dprx_work once the DPRX capabilities read has completed. Without that callback tb_dp_dprx_start() reads the capabilities synchronously and never queues the work. It however always takes a tunnel reference which is only dropped by dprx_work itself or by tb_dp_dprx_stop() when cancel_delayed_work() actually canceled that work. That reference is thus leaked for every tunnel without a callback.
The only tunnels without one are those from tb_tunnel_discover_dp(), which are activated again when restoring from hibernation. Pass the callback to tb_tunnel_discover_dp() as well and drop the synchronous path such that the DPRX capabilities are always read from dprx_work. Hibernation restore then also no longer blocks for up to 12 seconds while waiting for that read to complete.
Also fix up the KUnit tests.
--- drivers/thunderbolt/tb.c | 4 ++- drivers/thunderbolt/test.c | 37 +++++++++++++++++++--------- drivers/thunderbolt/tunnel.c | 47 ++++++++++++++++++++---------------- drivers/thunderbolt/tunnel.h | 8 +++--- 4 files changed, 60 insertions(+), 36 deletions(-)
drivers/thunderbolt/tb.c +3 -1
@@ -89,6 +89,7 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port, const char *reason);static void tb_queue_dp_bandwidth_request (struct tb *tb,u64 route,u8 port,int retry,unsigned long delay); +static void tb_dp_tunnel_active (struct tb_tunnel *tunnel,void *data);static void tb_queue_hotplug (struct tb *tb,u64 route,u8 port,bool unplug) {
@@ -385,7 +386,8 @@ static void tb_switch_discover_tunnels(struct tb_switch *sw,switch (port->config.type) {case TB_TYPE_DP_HDMI_IN : - tunnel =tb_tunnel_discover_dp (tb, port, alloc_hopids); + tunnel =tb_tunnel_discover_dp (tb, port, alloc_hopids, + tb_dp_tunnel_active, tb);tb_increase_tmu_accuracy (tunnel);break ;
drivers/thunderbolt/test.c +26 -11
@@ -1407,6 +1407,10 @@ static void tb_test_tunnel_pcie(struct kunit *test)tb_tunnel_put (tunnel1); } +static void tb_test_dp_tunnel_active (struct tb_tunnel *tunnel,void *data) +{ +} +static void tb_test_tunnel_dp (struct kunit *test) {struct tb_switch *host, *dev;
@@ -1427,7 +1431,8 @@ static void tb_test_tunnel_dp(struct kunit *test) in = &host->ports[5 ]; out = &dev->ports[13 ]; - tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, tunnel);KUNIT_EXPECT_EQ (test, tunnel->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel->src_port, in);
@@ -1473,7 +1478,8 @@ static void tb_test_tunnel_dp_chain(struct kunit *test) in = &host->ports[5 ]; out = &dev4->ports[14 ]; - tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, tunnel);KUNIT_EXPECT_EQ (test, tunnel->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel->src_port, in);
@@ -1523,7 +1529,8 @@ static void tb_test_tunnel_dp_tree(struct kunit *test) in = &dev2->ports[13 ]; out = &dev5->ports[13 ]; - tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, tunnel);KUNIT_EXPECT_EQ (test, tunnel->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel->src_port, in);
@@ -1588,7 +1595,8 @@ static void tb_test_tunnel_dp_max_length(struct kunit *test) in = &dev6->ports[13 ]; out = &dev12->ports[13 ]; - tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, tunnel);KUNIT_EXPECT_EQ (test, tunnel->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel->src_port, in);
@@ -1658,7 +1666,8 @@ static void tb_test_tunnel_3dp(struct kunit *test) out2 = &dev5->ports[13 ]; out3 = &dev4->ports[14 ]; - tunnel1 =tb_tunnel_alloc_dp (NULL , in1, out1,1 ,0 ,0 ,NULL ,NULL ); + tunnel1 =tb_tunnel_alloc_dp (NULL , in1, out1,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_TRUE (test, tunnel1 !=NULL );KUNIT_EXPECT_EQ (test, tunnel1->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel1->src_port, in1);
@@ -1666,7 +1675,8 @@ static void tb_test_tunnel_3dp(struct kunit *test)KUNIT_ASSERT_EQ (test, tunnel1->npaths,3 );KUNIT_ASSERT_EQ (test, tunnel1->paths[0 ]->path_length,3 ); - tunnel2 =tb_tunnel_alloc_dp (NULL , in2, out2,1 ,0 ,0 ,NULL ,NULL ); + tunnel2 =tb_tunnel_alloc_dp (NULL , in2, out2,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_TRUE (test, tunnel2 !=NULL );KUNIT_EXPECT_EQ (test, tunnel2->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel2->src_port, in2);
@@ -1674,7 +1684,8 @@ static void tb_test_tunnel_3dp(struct kunit *test)KUNIT_ASSERT_EQ (test, tunnel2->npaths,3 );KUNIT_ASSERT_EQ (test, tunnel2->paths[0 ]->path_length,4 ); - tunnel3 =tb_tunnel_alloc_dp (NULL , in3, out3,1 ,0 ,0 ,NULL ,NULL ); + tunnel3 =tb_tunnel_alloc_dp (NULL , in3, out3,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_TRUE (test, tunnel3 !=NULL );KUNIT_EXPECT_EQ (test, tunnel3->type,TB_TUNNEL_DP );KUNIT_EXPECT_PTR_EQ (test, tunnel3->src_port, in3);
@@ -1771,7 +1782,8 @@ static void tb_test_tunnel_port_on_path(struct kunit *test) in = &dev2->ports[13 ]; out = &dev5->ports[13 ]; - dp_tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + dp_tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, dp_tunnel);KUNIT_EXPECT_TRUE (test,tb_tunnel_port_on_path (dp_tunnel, in));
@@ -2203,7 +2215,8 @@ static void tb_test_credit_alloc_dp(struct kunit *test) in = &host->ports[5 ]; out = &dev->ports[14 ]; - tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + tunnel =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, tunnel);KUNIT_ASSERT_EQ (test, tunnel->npaths, (size_t )3 );
@@ -2439,7 +2452,8 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL1(struct kunit *test, in = &host->ports[5 ]; out = &dev->ports[13 ]; - dp_tunnel1 =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + dp_tunnel1 =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, dp_tunnel1);KUNIT_ASSERT_EQ (test, dp_tunnel1->npaths, (size_t )3 );
@@ -2476,7 +2490,8 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL2(struct kunit *test, in = &host->ports[6 ]; out = &dev->ports[14 ]; - dp_tunnel2 =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 ,NULL ,NULL ); + dp_tunnel2 =tb_tunnel_alloc_dp (NULL , in, out,1 ,0 ,0 , + tb_test_dp_tunnel_active,NULL );KUNIT_ASSERT_NOT_NULL (test, dp_tunnel2);KUNIT_ASSERT_EQ (test, dp_tunnel2->npaths, (size_t )3 );
drivers/thunderbolt/tunnel.c +26 -21
98 lines not on this page · raw message
drivers/thunderbolt/tunnel.h +5 -3
@@ -67,8 +67,8 @@ enum tb_tunnel_state {* @dprx_canceled: Was DPRX capabilities read poll canceled * @dprx_timeout: If set DPRX capabilities read poll work will timeout after this passes * @dprx_work: Worker that is scheduled to poll completion of DPRX capabilities read -* @callback: Optional callback called when DP tunnel is fully activated -* @callback_data: Optional data for @callback +* @callback: Callback called when DP tunnel is fully activated +* @callback_data: Data for @callback */ struct tb_tunnel {struct kref kref;
@@ -116,7 +116,9 @@ struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,bool tb_tunnel_reserved_pci (struct tb_port *port,int *reserved_up,int *reserved_down);struct tb_tunnel *tb_tunnel_discover_dp (struct tb *tb,struct tb_port *in, -bool alloc_hopid); +bool alloc_hopid, +void (*callback)(struct tb_tunnel *,void *), +void *callback_data); struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in, struct tb_port *out, int link_nr, int max_up, int max_down,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 564/1005 drm/amd/display: DML2.1 Reintegration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Austin Zheng <[email protected]>
[ Upstream commit 0975c4deb6c2a5abc1865f0ba5502b10c87b7d27 ]
[Summary of changes]
- Updated structs
- Renaming of variables for clarity
Stable-dep-of: 93a77d353cb2 ("drm/amd/display: Remove const Qualifier From Non-Pointer Fields")
--- .../dml21/inc/dml_top_display_cfg_types.h | 11 + .../dml21/inc/dml_top_soc_parameter_types.h | 7 +- .../display/dc/dml2/dml21/inc/dml_top_types.h | 13 + .../src/dml2_core/dml2_core_dcn4_calcs.c | 55 ++- .../dml21/src/dml2_core/dml2_core_factory.c | 2 + .../src/dml2_core/dml2_core_shared_types.h | 10 +- .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 459 +++++++++--------- .../src/inc/dml2_internal_shared_types.h | 36 +- 8 files changed, 336 insertions(+), 257 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/inc/dml_top_display_cfg_types.h +11 -0
@@ -49,6 +49,11 @@ enum dml2_source_format_class { dml2_422_packed_12 =18 }; +enum dml2_sample_positioning { + dml2_interstitial =0 , + dml2_cosited =1 +}; +enum dml2_rotation_angle { dml2_rotation_0 =0 , dml2_rotation_90 =1 ,
@@ -222,7 +227,11 @@ struct dml2_composition_cfg {struct {bool enabled; +bool easf_enabled; +bool isharp_enabled;bool upsp_enabled; +enum dml2_sample_positioning upsp_sample_positioning; +unsigned int upsp_vtaps;struct {double h_ratio;double v_ratio;
@@ -385,6 +394,7 @@ struct dml2_plane_parameters {// The actual reserved vblank time used for the corresponding stream in mode_programming would be at least as much as this per-plane override. long reserved_vblank_time_ns;unsigned int max_vactive_det_fill_delay_us;// 0 = no reserved time, +ve = explicit max delay +unsigned int vactive_latency_to_hide_for_pstate_admissibility_us;unsigned int gpuvm_min_page_size_kbytes;unsigned int hostvm_min_page_size_kbytes;
@@ -456,6 +466,7 @@ struct dml2_display_cfg {bool enable;bool value; } force_nom_det_size_kbytes; +bool mode_support_check_disable;bool mcache_admissibility_check_disable;bool surface_viewport_size_check_disable;
drivers/gpu/drm/amd/display/dc/dml2/dml21/inc/dml_top_soc_parameter_types.h +6 -1
@@ -145,6 +145,8 @@ struct dml2_soc_bb {struct dml2_soc_vmin_clock_limits vmin_limit;double lower_bound_bandwidth_dchub; +double fraction_of_urgent_bandwidth_nominal_target; +double fraction_of_urgent_bandwidth_flip_target;unsigned int dprefclk_mhz;unsigned int xtalclk_mhz;unsigned int pcie_refclk_mhz;
@@ -170,6 +172,7 @@ struct dml2_soc_bb {struct dml2_ip_capabilities {unsigned int pipe_count;unsigned int otg_count; +unsigned int TDLUT_33cube_count;unsigned int num_dsc;unsigned int max_num_dp2p0_streams;unsigned int max_num_hdmi_frl_outputs;
@@ -188,7 +191,9 @@ struct dml2_ip_capabilities {unsigned int subvp_prefetch_end_to_mall_start_us;unsigned int subvp_fw_processing_delay;unsigned int max_vactive_det_fill_delay_us; - +unsigned int ppt_max_allow_delay_ns; +unsigned int temp_read_max_allow_delay_us; +unsigned int dummy_pstate_max_allow_delay_us;/* FAMS2 delays */ struct {unsigned int max_allow_delay_us;
drivers/gpu/drm/amd/display/dc/dml2/dml21/inc/dml_top_types.h +13 -0
@@ -70,6 +70,8 @@ struct dml2_pmo_options {bool disable_dyn_odm;bool disable_dyn_odm_for_multi_stream;bool disable_dyn_odm_for_stream_with_svp; +struct dml2_pmo_pstate_strategy *override_strategy_lists[DML2_MAX_PLANES ]; +unsigned int num_override_strategies_per_list[DML2_MAX_PLANES ]; };struct dml2_options {
@@ -193,6 +195,14 @@ struct dml2_mcache_surface_allocation { } informative; }; +enum dml2_pstate_type { + dml2_pstate_type_uclk, + dml2_pstate_type_ppt, + dml2_pstate_type_temp_read, + dml2_pstate_type_dummy_pstate, + dml2_pstate_type_count +}; +enum dml2_pstate_method { dml2_pstate_method_na =0 ,/* hw exclusive modes */
@@ -310,6 +320,7 @@ struct dml2_mode_support_info {bool NumberOfOTGSupport;bool NumberOfHDMIFRLSupport;bool NumberOfDP2p0Support; +bool NumberOfTDLUT33cubeSupport;bool WritebackScaleRatioAndTapsSupport;bool CursorSupport;bool PitchSupport;
@@ -357,6 +368,8 @@ struct dml2_mode_support_info {unsigned int AlignedCPitch[DML2_MAX_PLANES ];bool g6_temp_read_support;bool temp_read_or_ppt_support; +bool qos_bandwidth_support; +bool dcfclk_support; };// dml2_mode_support_info struct dml2_display_cfg_programming {
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +29 -26
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c +2 -0
@@ -15,6 +15,8 @@ bool dml2_core_create(enum dml2_project_id project_id, struct dml2_core_instancememset (out,0 ,sizeof (struct dml2_core_instance )); + out->project_id = project_id; +switch (project_id) {case dml2_project_dcn4x_stage1: result = false;
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared_types.h +8 -2
@@ -37,6 +37,7 @@ struct dml2_core_ip_params {unsigned int writeback_interface_buffer_size_kbytes;unsigned int max_num_dpp;unsigned int max_num_otg; +unsigned int TDLUT_33cube_count;unsigned int max_num_wb;unsigned int max_dchub_pscl_bw_pix_per_clk;unsigned int max_pscl_lb_bw_pix_per_clk;
@@ -46,6 +47,7 @@ struct dml2_core_ip_params {double max_vscl_ratio;unsigned int max_hscl_taps;unsigned int max_vscl_taps; +unsigned int odm_combine_support_mask;unsigned int num_dsc;unsigned int maximum_dsc_bits_per_component;unsigned int maximum_pixels_per_line_per_dsc_unit;
@@ -82,7 +84,6 @@ struct dml2_core_ip_params {unsigned int subvp_swath_height_margin_lines;unsigned int subvp_fw_processing_delay_us;unsigned int subvp_pstate_allow_width_us; -// MRQ bool dcn_mrq_present;unsigned int zero_size_buffer_entries;
@@ -103,6 +104,8 @@ struct dml2_core_internal_DmlPipe {unsigned int DPPPerSurface;bool ScalerEnabled;bool UPSPEnabled; +unsigned int UPSPVTaps; +enum dml2_sample_positioning UPSPSamplePositioning;enum dml2_rotation_angle RotationAngle;bool mirrored;unsigned int ViewportHeight;
@@ -230,6 +233,7 @@ struct dml2_core_internal_mode_support_info {bool MSOOrODMSplitWithNonDPLink;bool NotEnoughLanesForMSO;bool NumberOfOTGSupport; +bool NumberOfTDLUT33cubeSupport;bool NumberOfHDMIFRLSupport;bool NumberOfDP2p0Support;bool WritebackScaleRatioAndTapsSupport;
@@ -1306,7 +1310,7 @@ struct dml2_core_calcs_CalculateVMRowAndSwath_params {unsigned int HostVMMinPageSize;unsigned int DCCMetaBufferSizeBytes;bool mrq_present; -enum dml2_pstate_method pstate_switch_modes[DML2_MAX_PLANES ]; +enum dml2_pstate_method *pstate_switch_modes;// Output bool *PTEBufferSizeNotExceeded;
@@ -2308,6 +2312,7 @@ struct dml2_core_calcs_mode_support_ex {const struct dml2_display_cfg *in_display_cfg;const struct dml2_mcg_min_clock_table *min_clk_table;int min_clk_index; +enum dml2_project_id project_id;//unsigned int in_state_index; struct dml2_core_internal_mode_support_info *out_evaluation_info; };
@@ -2320,6 +2325,7 @@ struct dml2_core_calcs_mode_programming_ex {const struct dml2_mcg_min_clock_table *min_clk_table;const struct core_display_cfg_support_info *cfg_support_info;int min_clk_index; +enum dml2_project_id project_id;struct dml2_display_cfg_programming *programming; };
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +241 -218
765 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/inc/dml2_internal_shared_types.h +26 -10
@@ -255,7 +255,7 @@ struct dml2_implicit_svp_meta {unsigned long v_front_porch; }; -struct dml2_fams2_per_method_common_meta { +struct dml2_pstate_per_method_common_meta {/* generic params */ unsigned int allow_start_otg_vline;unsigned int allow_end_otg_vline;
@@ -265,7 +265,7 @@ struct dml2_fams2_per_method_common_meta {double period_us; }; -struct dml2_fams2_meta { +struct dml2_pstate_meta {bool valid;double otg_vline_time_us;unsigned int scheduling_delay_otg_vlines;
@@ -280,14 +280,14 @@ struct dml2_fams2_meta {unsigned int max_vtotal;double min_refresh_rate_hz;double max_frame_time_us; -unsigned int dram_clk_change_blackout_otg_vlines; +unsigned int blackout_otg_vlines;struct {double max_vactive_det_fill_delay_us;unsigned int max_vactive_det_fill_delay_otg_vlines; -struct dml2_fams2_per_method_common_meta common; +struct dml2_pstate_per_method_common_meta common; } method_vactive;struct { -struct dml2_fams2_per_method_common_meta common; +struct dml2_pstate_per_method_common_meta common; } method_vblank;struct {unsigned int programming_delay_otg_vlines;
@@ -296,15 +296,24 @@ struct dml2_fams2_meta {unsigned long phantom_vactive;unsigned long phantom_vfp;unsigned long phantom_vtotal; -struct dml2_fams2_per_method_common_meta common; +struct dml2_pstate_per_method_common_meta common; } method_subvp;struct {unsigned int programming_delay_otg_vlines;unsigned int stretched_vtotal; -struct dml2_fams2_per_method_common_meta common; +struct dml2_pstate_per_method_common_meta common; } method_drr; }; +/* mask of synchronized timings by stream index */ +struct dml2_pmo_synchronized_timing_groups { +unsigned int num_timing_groups; +unsigned int synchronized_timing_group_masks[DML2_MAX_PLANES ]; +bool group_is_drr_enabled[DML2_MAX_PLANES ]; +bool group_is_drr_active[DML2_MAX_PLANES ]; +double group_line_time_us[DML2_MAX_PLANES ]; +}; +struct dml2_optimization_stage3_state {bool performed;bool success;
@@ -319,7 +328,7 @@ struct dml2_optimization_stage3_state {// Meta-data for FAMS2 bool fams2_required; -struct dml2_fams2_meta stream_fams2_meta[DML2_MAX_PLANES ]; +struct dml2_pstate_meta stream_pstate_meta[DML2_MAX_PLANES ];int min_clk_index_for_latency; };
@@ -472,6 +481,7 @@ struct dml2_core_scratch { };struct dml2_core_instance { +enum dml2_project_id project_id;struct dml2_mcg_min_clock_table *minimum_clock_table;struct dml2_core_internal_state_inputs inputs;struct dml2_core_internal_state_intermediates intermediates;
@@ -619,6 +629,12 @@ struct dml2_pmo_optimize_for_stutter_in_out {#define PMO_DCN4_MAX_NUM_VARIANTS 2#define PMO_DCN4_MAX_BASE_STRATEGIES 10 +struct dml2_scheduling_check_locals { +struct dml2_pstate_per_method_common_meta group_common_pstate_meta[DML2_MAX_PLANES ]; +unsigned int sorted_group_gtl_disallow_index[DML2_MAX_PLANES ]; +unsigned int sorted_group_gtl_period_index[DML2_MAX_PLANES ]; +}; + struct dml2_pmo_scratch { union { struct {
@@ -648,7 +664,7 @@ struct dml2_pmo_scratch {// Stores all the implicit SVP meta information indexed by stream index of the display // configuration under inspection, built at optimization stage init struct dml2_implicit_svp_meta stream_svp_meta[DML2_MAX_PLANES ]; -struct dml2_fams2_meta stream_fams2_meta[DML2_MAX_PLANES ]; +struct dml2_pstate_meta stream_pstate_meta[DML2_MAX_PLANES ];unsigned int optimal_vblank_reserved_time_for_stutter_us[DML2_PMO_STUTTER_CANDIDATE_LIST_SIZE ];unsigned int num_stutter_candidates;
@@ -663,7 +679,7 @@ struct dml2_pmo_scratch {double group_line_time_us[DML2_MAX_PLANES ];/* scheduling check locals */ -struct dml2_fams2_per_method_common_meta group_common_fams2_meta[DML2_MAX_PLANES ]; +struct dml2_pstate_per_method_common_meta group_common_pstate_meta[DML2_MAX_PLANES ];unsigned int sorted_group_gtl_disallow_index[DML2_MAX_PLANES ];unsigned int sorted_group_gtl_period_index[DML2_MAX_PLANES ];double group_phase_offset[DML2_MAX_PLANES ];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 565/1005 drm/amd/display: Update P-state naming for clarity.
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Austin Zheng <[email protected]>
[ Upstream commit e44ee152a5ea8ee1b5f5440a754a9fd17639f230 ]
[Why & How]
P-state can refer to different things like UCLK P-state, PPT, or temp read Update naming for clarity
Stable-dep-of: 93a77d353cb2 ("drm/amd/display: Remove const Qualifier From Non-Pointer Fields")
--- .../dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 2 +- .../src/dml2_core/dml2_core_shared_types.h | 18 ++++++++++++------ .../dml2/dml21/src/dml2_core/dml2_core_utils.c | 2 ++ 3 files changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +1 -1
@@ -13023,7 +13023,7 @@ void dml2_core_calcs_get_informative(const struct dml2_core_internal_display_mod out->informative.mode_support_info.InvalidCombinationOfMALLUseForPState = mode_lib->ms.support.InvalidCombinationOfMALLUseForPState; out->informative.mode_support_info.ExceededMALLSize = mode_lib->ms.support.ExceededMALLSize; out->informative.mode_support_info.EnoughWritebackUnits = mode_lib->ms.support.EnoughWritebackUnits; - out->informative.mode_support_info.temp_read_or_ppt_support = mode_lib->ms.support.temp_read_or_ppt_support; + out->informative.mode_support_info.temp_read_or_ppt_support = mode_lib->ms.support.global_temp_read_or_ppt_supported; out->informative.mode_support_info.g6_temp_read_support = mode_lib->ms.support.g6_temp_read_support; out->informative.mode_support_info.ExceededMultistreamSlots = mode_lib->ms.support.ExceededMultistreamSlots;
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared_types.h +12 -6
@@ -263,8 +263,11 @@ struct dml2_core_internal_mode_support_info {bool DCCMetaBufferSizeNotExceeded;enum dml2_pstate_change_support DRAMClockChangeSupport[DML2_MAX_PLANES ];enum dml2_pstate_change_support FCLKChangeSupport[DML2_MAX_PLANES ]; +enum dml2_pstate_change_support temp_read_or_ppt_support[DML2_MAX_PLANES ]; +bool global_dram_clock_change_support_required;bool global_dram_clock_change_supported;bool global_fclk_change_supported; +bool global_temp_read_or_ppt_supported;bool USRRetrainingSupport;bool AvgBandwidthSupport;bool UrgVactiveBandwidthSupport;
@@ -335,7 +338,6 @@ struct dml2_core_internal_mode_support_info {bool incorrect_imall_usage;bool g6_temp_read_support; -bool temp_read_or_ppt_support;struct dml2_core_internal_watermarks watermarks;bool dcfclk_support;
@@ -643,7 +645,7 @@ struct dml2_core_internal_mode_support {unsigned int DSTYAfterScaler[DML2_MAX_PLANES ];unsigned int DSTXAfterScaler[DML2_MAX_PLANES ]; -enum dml2_pstate_method pstate_switch_modes[DML2_MAX_PLANES ]; +enum dml2_pstate_method uclk_pstate_switch_modes[DML2_MAX_PLANES ]; };/// @brief A mega structure that houses various info for model programming step.
@@ -834,6 +836,7 @@ struct dml2_core_internal_mode_program {double max_urgent_latency_us;double df_response_time_us; +enum dml2_pstate_method uclk_pstate_switch_modes[DML2_MAX_PLANES ];// ------------------- // Output // -------------------
@@ -960,11 +963,12 @@ struct dml2_core_internal_mode_program {double MaxActiveFCLKChangeLatencySupported;bool USRRetrainingSupport;bool g6_temp_read_support; -bool temp_read_or_ppt_support;enum dml2_pstate_change_support FCLKChangeSupport[DML2_MAX_PLANES ];enum dml2_pstate_change_support DRAMClockChangeSupport[DML2_MAX_PLANES ]; +enum dml2_pstate_change_support temp_read_or_ppt_support[DML2_MAX_PLANES ];bool global_dram_clock_change_supported;bool global_fclk_change_supported; +bool global_temp_read_or_ppt_supported;double MaxActiveDRAMClockChangeLatencySupported[DML2_MAX_PLANES ];double WritebackAllowFCLKChangeEndPosition[DML2_MAX_PLANES ];double WritebackAllowDRAMClockChangeEndPosition[DML2_MAX_PLANES ];
@@ -1310,7 +1314,7 @@ struct dml2_core_calcs_CalculateVMRowAndSwath_params {unsigned int HostVMMinPageSize;unsigned int DCCMetaBufferSizeBytes;bool mrq_present; -enum dml2_pstate_method *pstate_switch_modes; +enum dml2_pstate_method *uclk_pstate_switch_modes;// Output bool *PTEBufferSizeNotExceeded;
@@ -1737,10 +1741,12 @@ struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_paramunsigned int max_request_size_bytes;unsigned int *meta_row_height_l;unsigned int *meta_row_height_c; +enum dml2_pstate_method *uclk_pstate_switch_modes;// Output struct dml2_core_internal_watermarks *Watermark;enum dml2_pstate_change_support *DRAMClockChangeSupport; +bool *global_dram_clock_change_support_required;bool *global_dram_clock_change_supported;double *MaxActiveDRAMClockChangeLatencySupported;unsigned int *SubViewportLinesNeededInMALL;
@@ -1751,10 +1757,10 @@ struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_paramdouble *VActiveLatencyHidingMargin;double *VActiveLatencyHidingUs;bool *g6_temp_read_support; -bool *temp_read_or_ppt_support; +enum dml2_pstate_change_support *temp_read_or_ppt_support; +bool *global_temp_read_or_ppt_supported; }; -struct dml2_core_calcs_CalculateSwathAndDETConfiguration_params {const struct dml2_display_cfg *display_cfg;unsigned int ConfigReturnBufferSizeInKByte;
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_utils.c +2 -0
@@ -306,6 +306,8 @@ void dml2_core_utils_print_mode_support_info(const struct dml2_core_internal_modDML_LOG_VERBOSE ("DML: support: ExceededMALLSize = %d\n" , support->ExceededMALLSize);if (!fail_only || support->g6_temp_read_support ==0 )DML_LOG_VERBOSE ("DML: support: g6_temp_read_support = %d\n" , support->g6_temp_read_support); +if (!fail_only || (support->global_dram_clock_change_supported ==0 && support->global_dram_clock_change_support_required)) +DML_LOG_VERBOSE ("DML: support: dram_clock_change_support = %d\n" , support->global_dram_clock_change_supported);if (!fail_only || support->ImmediateFlipSupport ==0 )DML_LOG_VERBOSE ("DML: support: ImmediateFlipSupport = %d\n" , support->ImmediateFlipSupport);if (!fail_only || support->LinkCapacitySupport ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 566/1005 drm/amd/display: add const qualifiers to watermark params struct
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenjing Liu <[email protected]>
[ Upstream commit dd2308c1d007d7a3416c02e542abdc6acc23966d ]
[why]
There are few non const input pointer fields. Setting them to const to prevent future modification of read-only data.
Stable-dep-of: 93a77d353cb2 ("drm/amd/display: Remove const Qualifier From Non-Pointer Fields")
--- .../src/dml2_core/dml2_core_shared_types.h | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared_types.h +17 -17
@@ -1718,30 +1718,30 @@ struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_paramdouble ReturnBW;bool SynchronizeTimings;bool SynchronizeDRRDisplaysForUCLKPStateChange; -unsigned int *dpte_group_bytes; +const unsigned int *dpte_group_bytes;struct dml2_core_internal_SOCParametersList mmSOCParameters;unsigned int WritebackChunkSize;double SOCCLK ;double DCFClkDeepSleep; -unsigned int *DETBufferSizeY; -unsigned int *DETBufferSizeC; -unsigned int *SwathHeightY; -unsigned int *SwathHeightC; -unsigned int *SwathWidthY; -unsigned int *SwathWidthC; -unsigned int *DPPPerSurface; -double *BytePerPixelDETY; -double *BytePerPixelDETC; -unsigned int *DSTXAfterScaler; -unsigned int *DSTYAfterScaler; +const unsigned int *DETBufferSizeY; +const unsigned int *DETBufferSizeC; +const unsigned int *SwathHeightY; +const unsigned int *SwathHeightC; +const unsigned int *SwathWidthY; +const unsigned int *SwathWidthC; +const unsigned int *DPPPerSurface; +const double *BytePerPixelDETY; +const double *BytePerPixelDETC; +const unsigned int *DSTXAfterScaler; +const unsigned int *DSTYAfterScaler;bool UnboundedRequestEnabled;unsigned int CompressedBufferSizeInkByte;bool max_outstanding_when_urgent_expected; -unsigned int max_outstanding_requests; -unsigned int max_request_size_bytes; -unsigned int *meta_row_height_l; -unsigned int *meta_row_height_c; -enum dml2_pstate_method *uclk_pstate_switch_modes; +const unsigned int max_outstanding_requests; +const unsigned int max_request_size_bytes; +const unsigned int *meta_row_height_l; +const unsigned int *meta_row_height_c; +const enum dml2_pstate_method *uclk_pstate_switch_modes;// Output struct dml2_core_internal_watermarks *Watermark;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 567/1005 drm/amd/display: Remove const Qualifier From Non-Pointer Fields
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Austin Zheng <[email protected]>
[ Upstream commit 93a77d353cb26772ae2fba50ae7321ae996b7f00 ]
[WHY/HOW]
Integer values for dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_params should not have the const qualifier.
This prevents using different values of the inputs when the function is called again.
--- .../dc/dml2/dml21/src/dml2_core/dml2_core_shared_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared_types.h +2 -2
@@ -1737,8 +1737,8 @@ struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_parambool UnboundedRequestEnabled;unsigned int CompressedBufferSizeInkByte;bool max_outstanding_when_urgent_expected; -const unsigned int max_outstanding_requests; -const unsigned int max_request_size_bytes; +unsigned int max_outstanding_requests; +unsigned int max_request_size_bytes;const unsigned int *meta_row_height_l;const unsigned int *meta_row_height_c;const enum dml2_pstate_method *uclk_pstate_switch_modes;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 568/1005 LoongArch: KVM: Add unregister helpers for the KVM interrupt devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chaithanya Lagisetty <[email protected]>
[ Upstream commit 4af22177032ab2357bf551fbfcdebc8fd9f2502d ]
The IPI/EIOINTC/PCH-PIC/DMSINTC KVM devices each have a helper that registers their kvm_device_ops, but there is no counterpart to remove them, so a caller that needs to undo a registration has to open-code kvm_unregister_device_ops() with the matching device type.
Add kvm_loongarch_unregister_{ipi,eiointc,pch_pic,dmsintc}_device() next to the existing register helpers. kvm_unregister_device_ops() is a no-op when the corresponding device type is not currently registered.
No functional change, as there are no callers yet.
--- arch/loongarch/include/asm/kvm_eiointc.h | 1 + arch/loongarch/include/asm/kvm_ipi.h | 1 + arch/loongarch/include/asm/kvm_pch_pic.h | 1 + arch/loongarch/kvm/intc/eiointc.c | 5 +++++ arch/loongarch/kvm/intc/ipi.c | 5 +++++ arch/loongarch/kvm/intc/pch_pic.c | 5 +++++ 6 files changed, 18 insertions(+)
arch/loongarch/include/asm/kvm_eiointc.h +1 -0
@@ -118,6 +118,7 @@ struct loongarch_eiointc { };int kvm_loongarch_register_eiointc_device (void ); +void kvm_loongarch_unregister_eiointc_device (void );void eiointc_set_irq (struct loongarch_eiointc *s,int irq,int level);#endif /* __ASM_KVM_EIOINTC_H */
arch/loongarch/include/asm/kvm_ipi.h +1 -0
@@ -41,5 +41,6 @@ struct ipi_state {#define IOCSR_ANY_SEND 0x158int kvm_loongarch_register_ipi_device (void ); +void kvm_loongarch_unregister_ipi_device (void );#endif
arch/loongarch/include/asm/kvm_pch_pic.h +1 -0
@@ -69,6 +69,7 @@ struct loongarch_pch_pic { };int kvm_loongarch_register_pch_pic_device (void ); +void kvm_loongarch_unregister_pch_pic_device (void );void pch_pic_set_irq (struct loongarch_pch_pic *s,int irq,int level);void pch_msi_set_irq (struct kvm *kvm,int irq,int level);
arch/loongarch/kvm/intc/eiointc.c +5 -0
@@ -700,3 +700,8 @@ int kvm_loongarch_register_eiointc_device(void) {return kvm_register_device_ops (&kvm_eiointc_dev_ops,KVM_DEV_TYPE_LOONGARCH_EIOINTC ); } + +void kvm_loongarch_unregister_eiointc_device (void ) +{ +kvm_unregister_device_ops (KVM_DEV_TYPE_LOONGARCH_EIOINTC ); +}
arch/loongarch/kvm/intc/ipi.c +5 -0
@@ -476,3 +476,8 @@ int kvm_loongarch_register_ipi_device(void) {return kvm_register_device_ops (&kvm_ipi_dev_ops,KVM_DEV_TYPE_LOONGARCH_IPI ); } + +void kvm_loongarch_unregister_ipi_device (void ) +{ +kvm_unregister_device_ops (KVM_DEV_TYPE_LOONGARCH_IPI ); +}
arch/loongarch/kvm/intc/pch_pic.c +5 -0
@@ -495,3 +495,8 @@ int kvm_loongarch_register_pch_pic_device(void) {return kvm_register_device_ops (&kvm_pch_pic_dev_ops,KVM_DEV_TYPE_LOONGARCH_PCHPIC ); } + +void kvm_loongarch_unregister_pch_pic_device (void ) +{ +kvm_unregister_device_ops (KVM_DEV_TYPE_LOONGARCH_PCHPIC ); +}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 569/1005 LoongArch: KVM: Fix resource leak in kvm_loongarch_env_init() error path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chaithanya Lagisetty <[email protected]>
[ Upstream commit 910132bc7d72f26a8b288c2a38c32445a48d5be0 ]
kvm_loongarch_env_init() allocates the per-CPU kvm_context (vmcs) and kvm_loongarch_ops, registers the perf callbacks, and then registers the IPI/EIOINTC/PCH-PIC/DMSINTC KVM devices. If any of those device registrations fails, the function returned the error directly, leaving everything acquired so far in place: vmcs and kvm_loongarch_ops are never freed, the perf callbacks stay registered, and all previously registered KVM device operations remain registered. kvm_loongarch_init() propagates the errors without calling kvm_loongarch_env_exit(), so nothing else cleans up either.
Unwind the error path in reverse order of registration, so that each failure only undoes what had actually been set up. Use the same helpers in kvm_loongarch_env_exit() to remove the device registrations during normal teardown as well.
--- arch/loongarch/kvm/main.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
arch/loongarch/kvm/main.c +21 -2
@@ -376,21 +376,40 @@ static int kvm_loongarch_env_init(void)/* Register LoongArch IPI interrupt controller interface. */ ret =kvm_loongarch_register_ipi_device ();if (ret) -return ret; + goto err_env;/* Register LoongArch EIOINTC interrupt controller interface. */ ret =kvm_loongarch_register_eiointc_device ();if (ret) -return ret; + goto err_ipi;/* Register LoongArch PCH-PIC interrupt controller interface. */ ret =kvm_loongarch_register_pch_pic_device (); +if (ret) + goto err_eiointc; + +return 0 ; + +err_eiointc: +kvm_loongarch_unregister_eiointc_device (); +err_ipi: +kvm_loongarch_unregister_ipi_device (); +err_env: +kvm_unregister_perf_callbacks (); +kfree (kvm_loongarch_ops); + kvm_loongarch_ops =NULL ; +free_percpu (vmcs); + vmcs =NULL ;return ret; }static void kvm_loongarch_env_exit (void ) { +kvm_loongarch_unregister_pch_pic_device (); +kvm_loongarch_unregister_eiointc_device (); +kvm_loongarch_unregister_ipi_device (); +if (vmcs)free_percpu (vmcs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 570/1005 s390/crypto: Replace cond_resched() with msleep(1)
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit e11733826f9779eb954abdcd2b60b273558f1a77 ]
With [1] cond_resched() is always compiled away and becomes a no-op.
The comments for all cond_resched() calls in crypto code however indicate that the current process should be scheduled away to avoid instant re-invocation of a callback. This is not what cond_resched() would do or did.
Instead of just removing the cond_resched() calls, replace them with msleep() calls, as suggested by Holger Dengler. This forces the current task to be scheduled away (sleeps) like originally intended.
Holger provided information why this intended [2]:
"
Let me give a bit of background here: The protected key can only get invalid, if the Linux instance (z/VM or KVM guest) is moved to another hypervisor on a different machine (aka life guest relocation). In such a case, the crypto accelerator card and the host has to exchange the "real key", which is wrapped by the host and handed back to the guest as the re-newed protected key. Unfortunately there is no asynchronous trigger on completion, you have to re-try (and maybe get another "in progress" return).
And as if that weren't bad enough, if this key exchange between card and host is the first one, card and host has to instantiate a secure communication channel (including a key exchange for the transport layer). "
[1] commit 7dadeaa6e851 ("sched: Further restrict the preemption modes")
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[[email protected]: took Peter's patch [3] and provided commit message]
Stable-dep-of: 403648373816 ("s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithms")
--- arch/s390/crypto/paes_s390.c | 44 ++++------------------------------- arch/s390/crypto/phmac_s390.c | 25 +++----------------- arch/s390/include/asm/pkey.h | 16 +++++++++++++ 3 files changed, 23 insertions(+), 62 deletions(-)
arch/s390/crypto/paes_s390.c +4 -40
@@ -542,16 +542,7 @@ static int ecb_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =ecb_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue is full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell the scheduler to voluntarily give up the CPU here. -*/ -cond_resched (); -pr_debug ("rescheduling request\n" ); -return -ENOSPC ; +return pkey_handle_expired (); }else if (rc) {skcipher_walk_done (walk, rc); }
@@ -806,16 +797,7 @@ static int cbc_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =cbc_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue is full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell the scheduler to voluntarily give up the CPU here. -*/ -cond_resched (); -pr_debug ("rescheduling request\n" ); -return -ENOSPC ; +return pkey_handle_expired (); }else if (rc) {skcipher_walk_done (walk, rc); }
@@ -1113,16 +1095,7 @@ static int ctr_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =ctr_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue is full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell the scheduler to voluntarily give up the CPU here. -*/ -cond_resched (); -pr_debug ("rescheduling request\n" ); -return -ENOSPC ; +return pkey_handle_expired (); }else if (rc) {skcipher_walk_done (walk, rc); }
@@ -1553,16 +1526,7 @@ static int xts_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =xts_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue is full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell the scheduler to voluntarily give up the CPU here. -*/ -cond_resched (); -pr_debug ("rescheduling request\n" ); -return -ENOSPC ; +return pkey_handle_expired (); }else if (rc) {skcipher_walk_done (walk, rc); }
arch/s390/crypto/phmac_s390.c +3 -22
@@ -893,16 +893,7 @@ static int phmac_do_one_request(struct crypto_engine *engine, void *areq)case OP_FINUP : rc =phmac_kmac_update (req, true);if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell scheduler to voluntarily give up the CPU here. -*/ -pr_debug ("rescheduling request\n" ); -cond_resched (); -return -ENOSPC ; +return pkey_handle_expired (); }else if (rc) {hwh_advance (hwh, rc); goto out;
@@ -913,18 +904,8 @@ static int phmac_do_one_request(struct crypto_engine *engine, void *areq) fallthrough;case OP_FINAL : rc =phmac_kmac_final (req, true); -if (rc == -EKEYEXPIRED ) { -/* -* Protected key expired, conversion is in process. -* Trigger a re-schedule of this request by returning -* -ENOSPC ("hardware queue full") to the crypto engine. -* To avoid immediately re-invocation of this callback, -* tell scheduler to voluntarily give up the CPU here. -*/ -pr_debug ("rescheduling request\n" ); -cond_resched (); -return -ENOSPC ; - } +if (rc == -EKEYEXPIRED ) +return pkey_handle_expired ();break ;default :/* unknown/unsupported/unimplemented asynch op */
arch/s390/include/asm/pkey.h +16 -0
@@ -13,6 +13,7 @@#include <linux/ioctl.h> #include <linux/types.h> +#include <linux/delay.h> #include <uapi/asm/pkey.h> /*
@@ -38,4 +39,19 @@ int pkey_key2protkey(const u8 *key, u32 keylen,*/ #define PKEY_XFLAG_NOMEMALLOC 0x0001 +static inline int pkey_handle_expired (void ) +{ +/* +* Protected key expired due to relocation to another host. The long +* running re-wrap has no asynchronous completion notification, so +* polling is required. Trigger a re-schedule of this request by +* returning -ENOSPC ("hardware queue full") to the crypto engine. +* To avoid immediately re-invocation of this callback, +* tell the scheduler to voluntarily give up the CPU here. +*/ +msleep (1 ); +pr_debug ("rescheduling request\n" ); +return -ENOSPC ; +} +#endif /* _KAPI_PKEY_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 571/1005 s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithms
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <[email protected]>
[ Upstream commit 403648373816ae8eb76fe4a393836b0d65fa8f85 ]
All the 4 PAES cipher processing loops were not checking the return value of skcipher_walk_done() immediately after calling it. This could lead to error masking when both the walk operation failed and a subsequent key conversion was needed (k < n condition).
Add immediate error checks after skcipher_walk_done() in all main processing loops (ECB, CBC, CTR, XTS modes) to ensure walk errors are properly propagated and not masked by subsequent operations.
With that comes a slight rework around the skcipher_walk_done() invocation. It is now necessary to check if the walk has already been finalized (walk->nbytes is then 0) or not to avoid double de-allocation of resources held by the walk.
--- arch/s390/crypto/paes_s390.c | 38 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-)
arch/s390/crypto/paes_s390.c +27 -11
@@ -428,8 +428,11 @@ static int ecb_paes_do_crypt(struct s390_paes_ctx *ctx, n = nbytes & ~(AES_BLOCK_SIZE -1 ); k =cpacf_km (ctx->fc | req_ctx->modifier, param, walk->dst.virt.addr, walk->src.virt.addr, n); -if (k) +if (k) { rc =skcipher_walk_done (walk, nbytes - k); +if (rc) + goto out; + }if (k < n) {if (!maysleep) { rc = -EKEYEXPIRED ;
@@ -490,7 +493,7 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier)atomic_dec (&ctx->via_engine_ctr); } -if (rc != -EINPROGRESS ) +if (rc != -EINPROGRESS && walk->nbytes)skcipher_walk_done (walk, rc); out:
@@ -543,7 +546,7 @@ static int ecb_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =ecb_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) {return pkey_handle_expired (); - }else if (rc) { + }else if (rc && walk->nbytes) {skcipher_walk_done (walk, rc); }
@@ -684,6 +687,8 @@ static int cbc_paes_do_crypt(struct s390_paes_ctx *ctx,if (k) {memcpy (walk->iv, param->iv,AES_BLOCK_SIZE ); rc =skcipher_walk_done (walk, nbytes - k); +if (rc) + goto out; }if (k < n) {if (!maysleep) {
@@ -745,7 +750,7 @@ static int cbc_paes_crypt(struct skcipher_request *req, unsigned long modifier)atomic_dec (&ctx->via_engine_ctr); } -if (rc != -EINPROGRESS ) +if (rc != -EINPROGRESS && walk->nbytes)skcipher_walk_done (walk, rc); out:
@@ -798,7 +803,7 @@ static int cbc_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =cbc_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) {return pkey_handle_expired (); - }else if (rc) { + }else if (rc && walk->nbytes) {skcipher_walk_done (walk, rc); }
@@ -960,6 +965,11 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx, AES_BLOCK_SIZE);crypto_inc (walk->iv,AES_BLOCK_SIZE ); rc =skcipher_walk_done (walk, nbytes - k); +if (rc) { +if (locked) +mutex_unlock (&ctrblk_lock); + goto out; + } }if (k < n) {if (!maysleep) {
@@ -1053,7 +1063,7 @@ static int ctr_paes_crypt(struct skcipher_request *req)atomic_dec (&ctx->via_engine_ctr); } -if (rc != -EINPROGRESS ) +if (rc != -EINPROGRESS && walk->nbytes)skcipher_walk_done (walk, rc); out:
@@ -1096,7 +1106,7 @@ static int ctr_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =ctr_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) {return pkey_handle_expired (); - }else if (rc) { + }else if (rc && walk->nbytes) {skcipher_walk_done (walk, rc); }
@@ -1274,8 +1284,11 @@ static int xts_paes_do_crypt_fullkey(struct s390_pxts_ctx *ctx, n = nbytes & ~(AES_BLOCK_SIZE -1 ); k =cpacf_km (ctx->fc | req_ctx->modifier, param->key + offset, walk->dst.virt.addr, walk->src.virt.addr, n); -if (k) +if (k) { rc =skcipher_walk_done (walk, nbytes - k); +if (rc) + goto out; + }if (k < n) {if (!maysleep) { rc = -EKEYEXPIRED ;
@@ -1367,8 +1380,11 @@ static int xts_paes_do_crypt_2keys(struct s390_pxts_ctx *ctx, n = nbytes & ~(AES_BLOCK_SIZE -1 ); k =cpacf_km (ctx->fc | req_ctx->modifier, param->key + offset, walk->dst.virt.addr, walk->src.virt.addr, n); -if (k) +if (k) { rc =skcipher_walk_done (walk, nbytes - k); +if (rc) + goto out; + }if (k < n) {if (!maysleep) { rc = -EKEYEXPIRED ;
@@ -1474,7 +1490,7 @@ static inline int xts_paes_crypt(struct skcipher_request *req, unsigned long modatomic_dec (&ctx->via_engine_ctr); } -if (rc != -EINPROGRESS ) +if (rc != -EINPROGRESS && walk->nbytes)skcipher_walk_done (walk, rc); out:
@@ -1527,7 +1543,7 @@ static int xts_paes_do_one_request(struct crypto_engine *engine, void *areq) rc =xts_paes_do_crypt (ctx, req_ctx, true);if (rc == -EKEYEXPIRED ) {return pkey_handle_expired (); - }else if (rc) { + }else if (rc && walk->nbytes) {skcipher_walk_done (walk, rc); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 572/1005 s390/crypto: Fix use of mutex in atomic context in PAES
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <[email protected]>
[ Upstream commit 749990db95d45cc3d96aab999ac7f110259b200c ]
The PAES CTR implementation used a mutex to lock one page of exclusive memory for fast CTR processing. Unfortunately a mutex is not save to use in atomic or interrupt context. So use a binary semaphore instead which is save to use in such environments.
Furthermore rework the code to get rid of conditional locking. So restructure the PAES CRT code by extracting the main loop into a separate function and just give in information about the (locked) page can be used or not (is not locked).
--- arch/s390/crypto/paes_s390.c | 107 +++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 50 deletions(-)
arch/s390/crypto/paes_s390.c +57 -50
@@ -20,7 +20,7 @@#include <linux/init.h> #include <linux/miscdevice.h> #include <linux/module.h> -#include <linux/mutex.h> +#include <linux/semaphore.h> #include <linux/spinlock.h> #include <crypto/aes.h> #include <crypto/algapi.h>
@@ -42,7 +42,7 @@#define PXTS_256_PROTKEY_SIZE (32 + 32 + 32)/* k1 + k2 + verification pattern */ static u8 *ctrblk; -static DEFINE_MUTEX (ctrblk_lock); +static DEFINE_SEMAPHORE(ctrblk_sem, 1);static cpacf_mask_t km_functions, kmc_functions, kmctr_functions;
@@ -911,41 +911,14 @@ static inline unsigned int __ctrblk_init(u8 *ctrptr, u8 *iv, unsigned int nbytesreturn n; } -static int ctr_paes_do_crypt (struct s390_paes_ctx *ctx, -struct s390_pctr_req_ctx *req_ctx, -bool maysleep) +static int __ctr_paes_do_crypt (struct s390_paes_ctx *ctx, +struct ctr_param *param, +struct skcipher_walk *walk, +bool maysleep,bool locked) { -struct ctr_param *param = &req_ctx->param; -struct skcipher_walk *walk = &req_ctx->walk; -u8 buf[AES_BLOCK_SIZE ], *ctrptr;unsigned int nbytes, n, k; -int pk_state, locked, rc =0 ; - -if (!req_ctx->param_init_done) { -/* fetch and check protected key state */ -spin_lock_bh (&ctx->pk_lock); - pk_state = ctx->pk_state; -switch (pk_state) { -case PK_STATE_NO_KEY : - rc = -ENOKEY ; -break ; -case PK_STATE_CONVERT_IN_PROGRESS : - rc = -EKEYEXPIRED ; -break ; -case PK_STATE_VALID : -memcpy (param->key, ctx->pk.protkey,sizeof (param->key)); - req_ctx->param_init_done = true; -break ; -default : - rc = pk_state <0 ? pk_state : -EIO ; -break ; - } -spin_unlock_bh (&ctx->pk_lock); - } -if (rc) - goto out; - - locked =mutex_trylock (&ctrblk_lock); +u8 *ctrptr; +int rc =0 ;/* * Note that in case of partial processing or failure the walk
@@ -965,37 +938,71 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx, AES_BLOCK_SIZE);crypto_inc (walk->iv,AES_BLOCK_SIZE ); rc =skcipher_walk_done (walk, nbytes - k); -if (rc) { -if (locked) -mutex_unlock (&ctrblk_lock); +if (rc) goto out; - } }if (k < n) {if (!maysleep) { -if (locked) -mutex_unlock (&ctrblk_lock); rc = -EKEYEXPIRED ; goto out; } rc =paes_convert_key (ctx); -if (rc) { -if (locked) -mutex_unlock (&ctrblk_lock); +if (rc) goto out; - }spin_lock_bh (&ctx->pk_lock);memcpy (param->key, ctx->pk.protkey,sizeof (param->key));spin_unlock_bh (&ctx->pk_lock); } } -if (locked) -mutex_unlock (&ctrblk_lock); + +out: +return rc; +} + +static int ctr_paes_do_crypt (struct s390_paes_ctx *ctx, +struct s390_pctr_req_ctx *req_ctx, +bool maysleep) +{ +struct ctr_param *param = &req_ctx->param; +struct skcipher_walk *walk = &req_ctx->walk; +u8 buf[AES_BLOCK_SIZE ]; +int pk_state, rc =0 ; + +if (!req_ctx->param_init_done) { +/* fetch and check protected key state */ +spin_lock_bh (&ctx->pk_lock); + pk_state = ctx->pk_state; +switch (pk_state) { +case PK_STATE_NO_KEY : + rc = -ENOKEY ; +break ; +case PK_STATE_CONVERT_IN_PROGRESS : + rc = -EKEYEXPIRED ; +break ; +case PK_STATE_VALID : +memcpy (param->key, ctx->pk.protkey,sizeof (param->key)); + req_ctx->param_init_done = true; +break ; +default : + rc = pk_state <0 ? pk_state : -EIO ; +break ; + } +spin_unlock_bh (&ctx->pk_lock); + } +if (rc) + goto out; + +if (down_trylock (&ctrblk_sem) ==0 ) { + rc =__ctr_paes_do_crypt (ctx, param, walk, maysleep, true); +up (&ctrblk_sem); + }else { + rc =__ctr_paes_do_crypt (ctx, param, walk, maysleep, false); + }/* final block may be < AES_BLOCK_SIZE, copy only nbytes */ -if (nbytes) { +if (!rc && walk->nbytes >0 ) {memset (buf,0 ,AES_BLOCK_SIZE ); -memcpy (buf, walk->src.virt.addr, nbytes); +memcpy (buf, walk->src.virt.addr, walk->nbytes);while (1 ) { if (cpacf_kmctr(ctx->fc, param, buf, buf, AES_BLOCK_SIZE,
@@ -1012,7 +1019,7 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,memcpy (param->key, ctx->pk.protkey,sizeof (param->key));spin_unlock_bh (&ctx->pk_lock); } -memcpy (walk->dst.virt.addr, buf, nbytes); +memcpy (walk->dst.virt.addr, buf, walk->nbytes);crypto_inc (walk->iv,AES_BLOCK_SIZE ); rc =skcipher_walk_done (walk,0 ); }
Signature · 1 line
2.53.0