6.12.74-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/42 scsi: qla2xxx: Fix bsg_done() causing double free
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anil Gurumurthy <[email protected]>
commit c2c68225b1456f4d0d393b5a8778d51bb0d5b1d0 upstream.
Kernel panic observed on system,
[5353358.825191] BUG: unable to handle page fault for address: ff5f5e897b024000 [5353358.825194] #PF: supervisor write access in kernel mode [5353358.825195] #PF: error_code(0x0002) - not-present page [5353358.825196] PGD 100006067 P4D 0 [5353358.825198] Oops: 0002 [#1] PREEMPT SMP NOPTI [5353358.825200] CPU: 5 PID: 2132085 Comm: qlafwupdate.sub Kdump: loaded Tainted: G W L ------- --- 5.14.0-503.34.1.el9_5.x86_64 #1 [5353358.825203] Hardware name: HPE ProLiant DL360 Gen11/ProLiant DL360 Gen11, BIOS 2.44 01/17/2025 [5353358.825204] RIP: 0010:memcpy_erms+0x6/0x10 [5353358.825211] RSP: 0018:ff591da8f4f6b710 EFLAGS: 00010246 [5353358.825212] RAX: ff5f5e897b024000 RBX: 0000000000007090 RCX: 0000000000001000 [5353358.825213] RDX: 0000000000001000 RSI: ff591da8f4fed090 RDI: ff5f5e897b024000 [5353358.825214] RBP: 0000000000010000 R08: ff5f5e897b024000 R09: 0000000000000000 [5353358.825215] R10: ff46cf8c40517000 R11: 0000000000000001 R12: 0000000000008090 [5353358.825216] R13: ff591da8f4f6b720 R14: 0000000000001000 R15: 0000000000000000 [5353358.825218] FS: 00007f1e88d47740(0000) GS:ff46cf935f940000(0000) knlGS:0000000000000000 [5353358.825219] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [5353358.825220] CR2: ff5f5e897b024000 CR3: 0000000231532004 CR4: 0000000000771ef0 [5353358.825221] PKRU: 55555554 [5353358.825222] Call Trace: [5353358.825223] <TASK> [5353358.825224] ? show_trace_log_lvl+0x1c4/0x2df [5353358.825229] ? show_trace_log_lvl+0x1c4/0x2df [5353358.825232] ? sg_copy_buffer+0xc8/0x110 [5353358.825236] ? __die_body.cold+0x8/0xd [5353358.825238] ? page_fault_oops+0x134/0x170 [5353358.825242] ? kernelmode_fixup_or_oops+0x84/0x110 [5353358.825244] ? exc_page_fault+0xa8/0x150 [5353358.825247] ? asm_exc_page_fault+0x22/0x30 [5353358.825252] ? memcpy_erms+0x6/0x10 [5353358.825253] sg_copy_buffer+0xc8/0x110 [5353358.825259] qla2x00_process_vendor_specific+0x652/0x1320 [qla2xxx] [5353358.825317] qla24xx_bsg_request+0x1b2/0x2d0 [qla2xxx]
Most routines in qla_bsg.c call bsg_done() only for success cases. However a few invoke it for failure case as well leading to a double free. Validate before calling bsg_done().
--- drivers/scsi/qla2xxx/qla_bsg.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +17 -11
@@ -1546,8 +1546,9 @@ qla2x00_update_optrom(struct bsg_job *bs ha->optrom_buffer =NULL ; ha->optrom_state =QLA_SWAITING ;mutex_unlock (&ha->optrom_mutex); -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +if (!rval) +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len);return rval; }
@@ -2612,8 +2613,9 @@ qla2x00_manage_host_stats(struct bsg_job sizeof(struct ql_vnd_mng_host_stats_resp)); bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +if (!ret) +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len);return ret; }
@@ -2702,8 +2704,9 @@ qla2x00_get_host_stats(struct bsg_job *b bsg_job->reply_payload.sg_cnt, data, response_len); bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +if (!ret) +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len);kfree (data); host_stat_out:
@@ -2802,8 +2805,9 @@ reply: bsg_job->reply_payload.sg_cnt, data, response_len); bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +if (!ret) +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); tgt_stat_out:kfree (data);
@@ -2864,8 +2868,9 @@ qla2x00_manage_host_port(struct bsg_job bsg_job->reply_payload.sg_cnt, &rsp_data, sizeof(struct ql_vnd_mng_host_port_resp)); bsg_reply->result =DID_OK ; -bsg_job_done (bsg_job, bsg_reply->result, - bsg_reply->reply_payload_rcv_len); +if (!ret) +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len);return ret; }
@@ -3240,7 +3245,8 @@ int qla2x00_mailbox_passthru(struct bsg_ bsg_job->reply_len =sizeof (*bsg_job->reply); bsg_reply->result =DID_OK <<16 ; -bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); +if (!ret) +bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);kfree (req_data);
Greg Kroah-Hartman
maintainerPATCH 10/42 ASoC: cs35l45: Corrects ASP_TX5 DAPM widget channel
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Rivera-Matos <[email protected]>
[ Upstream commit 6dd0fdc908c02318c28ec2c0979661846ee0a9f7 ]
ASP_TX5 was incorrectly mapped to a channel value of 3 corrects, the channel value of 4.
--- sound/soc/codecs/cs35l45.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs35l45.c +1 -1
@@ -455,7 +455,7 @@ static const struct snd_soc_dapm_widget cs35l45_dapm_widgets[] = {SND_SOC_DAPM_AIF_OUT ("ASP_TX2" ,NULL ,1 ,CS35L45_ASP_ENABLES1 ,CS35L45_ASP_TX2_EN_SHIFT ,0 ),SND_SOC_DAPM_AIF_OUT ("ASP_TX3" ,NULL ,2 ,CS35L45_ASP_ENABLES1 ,CS35L45_ASP_TX3_EN_SHIFT ,0 ),SND_SOC_DAPM_AIF_OUT ("ASP_TX4" ,NULL ,3 ,CS35L45_ASP_ENABLES1 ,CS35L45_ASP_TX4_EN_SHIFT ,0 ), -SND_SOC_DAPM_AIF_OUT ("ASP_TX5" ,NULL ,3 ,CS35L45_ASP_ENABLES1 ,CS35L45_ASP_TX5_EN_SHIFT ,0 ), +SND_SOC_DAPM_AIF_OUT ("ASP_TX5" ,NULL ,4 ,CS35L45_ASP_ENABLES1 ,CS35L45_ASP_TX5_EN_SHIFT ,0 ),SND_SOC_DAPM_MUX ("ASP_TX1 Source" ,SND_SOC_NOPM ,0 ,0 , &cs35l45_asp_muxes[0 ]), SND_SOC_DAPM_MUX("ASP_TX2 Source", SND_SOC_NOPM, 0, 0, &cs35l45_asp_muxes[1]),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 11/42 ALSA: hda/realtek - fixed speaker no sound
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
[ Upstream commit 630fbc6e870eb06c5126cc97a3abecbe012272c8 ]
If it play a 5s above silence media stream, it will cause silence detection trigger.
Speaker will make no sound when you use another app to play a stream. Add this patch will solve this issue.
GPIO2: Mute Hotkey GPIO3: Mic Mute LED
Enable this will turn on hotkey and LED support.
--- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/pci/hda/patch_realtek.c +11 -0
@@ -7650,11 +7650,22 @@ static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo, struct snd_pcm_substream *substream, int action) { +static const struct coef_fw dis_coefs[] = { +WRITE_COEF (0x24 ,0x0013 ),WRITE_COEF (0x25 ,0x0000 ),WRITE_COEF (0x26 ,0xC203 ), +WRITE_COEF (0x28 ,0x0004 ),WRITE_COEF (0x29 ,0xb023 ), + };/* Disable AMP silence detection */ +static const struct coef_fw en_coefs[] = { +WRITE_COEF (0x24 ,0x0013 ),WRITE_COEF (0x25 ,0x0000 ),WRITE_COEF (0x26 ,0xC203 ), +WRITE_COEF (0x28 ,0x0084 ),WRITE_COEF (0x29 ,0xb023 ), + };/* Enable AMP silence detection */ +switch (action) {case HDA_GEN_PCM_ACT_OPEN : +alc_process_coef_fw (codec, dis_coefs);alc_write_coefex_idx (codec,0x5a ,0x00 ,0x954f );/* write gpio3 to high */ break ;case HDA_GEN_PCM_ACT_CLOSE : +alc_process_coef_fw (codec, en_coefs);alc_write_coefex_idx (codec,0x5a ,0x00 ,0x554f );/* write gpio3 as default value */ break ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 12/42 romfs: check sb_set_blocksize() return value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit ab7ad7abb3660c58ffffdf07ff3bb976e7e0afa0 ]
romfs_fill_super() ignores the return value of sb_set_blocksize(), which can fail if the requested block size is incompatible with the block device's configuration.
This can be triggered by setting a loop device's block size larger than PAGE_SIZE using ioctl(LOOP_SET_BLOCK_SIZE, 32768), then mounting a romfs filesystem on that device.
When sb_set_blocksize(sb, ROMBSIZE) is called with ROMBSIZE=4096 but the device has logical_block_size=32768, bdev_validate_blocksize() fails because the requested size is smaller than the device's logical block size. sb_set_blocksize() returns 0 (failure), but romfs ignores this and continues mounting.
The superblock's block size remains at the device's logical block size (32768). Later, when sb_bread() attempts I/O with this oversized block size, it triggers a kernel BUG in folio_set_bh():
kernel BUG at fs/buffer.c:1582!
BUG_ON(size > PAGE_SIZE);Fix by checking the return value of sb_set_blocksize() and failing the mount with -EINVAL if it returns 0.
--- fs/romfs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/romfs/super.c +4 -1
@@ -458,7 +458,10 @@ static int romfs_fill_super(struct super_block *sb, struct fs_context *fc)#ifdef CONFIG_BLOCK if (!sb->s_mtd) { -sb_set_blocksize (sb,ROMBSIZE ); +if (!sb_set_blocksize (sb,ROMBSIZE )) { +errorf (fc,"romfs: unable to set blocksize\n" ); +return -EINVAL ; + } }else { sb->s_blocksize =ROMBSIZE ; sb->s_blocksize_bits =blksize_bits (ROMBSIZE );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 13/42 =?UTF-8?q?drm/tegra:=20hdmi:=20sor:=20Fix=20error:=20variable=20?= =?UTF-8?q?=E2=80=98j=E2=80=99=20set=20but=20not=20used?=
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brahmajit Das <[email protected]>
[ Upstream commit 1beee8d0c263b3e239c8d6616e4f8bb700bed658 ]
The variable j is set, however never used in or outside the loop, thus resulting in dead code.
Building with GCC 16 results in a build error due to -Werror=unused-but-set-variable= enabled by default.
This patch clean up the dead code and fixes the build error.
Example build log:drivers/gpu/drm/tegra/sor.c:1867:19: error: variable ‘j’ set but not used [-Werror=unused-but-set-variable=]
1867 | size_t i, j;
| ^
--- drivers/gpu/drm/tegra/hdmi.c | 4 ++-- drivers/gpu/drm/tegra/sor.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +2 -2
@@ -658,7 +658,7 @@ static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data, {const u8 *ptr = data;unsigned long offset; -size_t i, j; +size_t i;u32 value;switch (ptr[0 ]) {
@@ -691,7 +691,7 @@ static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data,* - subpack_low: bytes 0 - 3 * - subpack_high: bytes 4 - 6 (with byte 7 padded to 0x00) */ -for (i =3 , j =0 ; i < size; i +=7 , j +=8 ) { +for (i =3 ; i < size; i +=7 ) {size_t rem = size - i, num =min_t (size_t, rem,4 ); value =tegra_hdmi_subpack (&ptr[i], num);
drivers/gpu/drm/tegra/sor.c +2 -2
@@ -1864,7 +1864,7 @@ static void tegra_sor_hdmi_write_infopack(struct tegra_sor *sor, {const u8 *ptr = data;unsigned long offset; -size_t i, j; +size_t i;u32 value;switch (ptr[0 ]) {
@@ -1897,7 +1897,7 @@ static void tegra_sor_hdmi_write_infopack(struct tegra_sor *sor,* - subpack_low: bytes 0 - 3 * - subpack_high: bytes 4 - 6 (with byte 7 padded to 0x00) */ -for (i =3 , j =0 ; i < size; i +=7 , j +=8 ) { +for (i =3 ; i < size; i +=7 ) {size_t rem = size - i, num =min_t (size_t, rem,4 ); value =tegra_sor_hdmi_subpack (&ptr[i], num);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 14/42 platform/x86: classmate-laptop: Add missing NULL pointer checks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit fe747d7112283f47169e9c16e751179a9b38611e ]
In a few places in the Classmate laptop driver, code using the accel object may run before that object's address is stored in the driver data of the input device using it.
For example, cmpc_accel_sensitivity_store_v4() is the "show" method of cmpc_accel_sensitivity_attr_v4 which is added in cmpc_accel_add_v4(), before calling dev_set_drvdata() for inputdev->dev. If the sysfs attribute is accessed prematurely, the dev_get_drvdata(&inputdev->dev) call in in cmpc_accel_sensitivity_store_v4() returns NULL which leads to a NULL pointer dereference going forward.
Moreover, sysfs attributes using the input device are added before initializing that device by cmpc_add_acpi_notify_device() and if one of them is accessed before running that function, a NULL pointer dereference will occur.
For example, cmpc_accel_sensitivity_attr_v4 is added before calling cmpc_add_acpi_notify_device() and if it is read prematurely, the dev_get_drvdata(&acpi->dev) call in cmpc_accel_sensitivity_show_v4() returns NULL which leads to a NULL pointer dereference going forward.
Fix this by adding NULL pointer checks in all of the relevant places.
--- drivers/platform/x86/classmate-laptop.c | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/platform/x86/classmate-laptop.c +32 -0
@@ -206,7 +206,12 @@ static ssize_t cmpc_accel_sensitivity_show_v4(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ;return sprintf (buf,"%d\n" , accel->sensitivity); }
@@ -223,7 +228,12 @@ static ssize_t cmpc_accel_sensitivity_store_v4(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ; r =kstrtoul (buf,0 , &sensitivity);if (r)
@@ -255,7 +265,12 @@ static ssize_t cmpc_accel_g_select_show_v4(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ;return sprintf (buf,"%d\n" , accel->g_select); }
@@ -272,7 +287,12 @@ static ssize_t cmpc_accel_g_select_store_v4(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ; r =kstrtoul (buf,0 , &g_select);if (r)
@@ -301,6 +321,8 @@ static int cmpc_accel_open_v4(struct input_dev *input) acpi =to_acpi_device (input->dev.parent); accel =dev_get_drvdata (&input->dev); +if (!accel) +return -ENXIO ;cmpc_accel_set_sensitivity_v4 (acpi->handle, accel->sensitivity);cmpc_accel_set_g_select_v4 (acpi->handle, accel->g_select);
@@ -548,7 +570,12 @@ static ssize_t cmpc_accel_sensitivity_show(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ;return sprintf (buf,"%d\n" , accel->sensitivity); }
@@ -565,7 +592,12 @@ static ssize_t cmpc_accel_sensitivity_store(struct device *dev, acpi =to_acpi_device (dev); inputdev =dev_get_drvdata (&acpi->dev); +if (!inputdev) +return -ENXIO ; + accel =dev_get_drvdata (&inputdev->dev); +if (!accel) +return -ENXIO ; r =kstrtoul (buf,0 , &sensitivity);if (r)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 15/42 ASoC: Intel: sof_es8336: Add DMI quirk for Huawei BOD-WXX9
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tagir Garaev <[email protected]>
[ Upstream commit 6b641122d31f9d33e7d60047ee0586d1659f3f54 ]
Add DMI entry for Huawei Matebook D (BOD-WXX9) with HEADPHONE_GPIO and DMIC quirks.
This device has ES8336 codec with:
- GPIO 16 (headphone-enable) for headphone amplifier control
- GPIO 17 (speakers-enable) for speaker amplifier control
- GPIO 269 for jack detection IRQ
- 2-channel DMIC
Hardware investigation shows that both GPIO 16 and 17 are required for proper audio routing, as headphones and speakers share the same physical output (HPOL/HPOR) and are separated only via amplifier enable signals.
RFC: Seeking advice on GPIO control issue:
GPIO values change in driver (gpiod_get_value() shows logical value changes) but not physically (debugfs gpio shows no change). The same gpiod_set_value_cansleep() calls work correctly in probe context with msleep(), but fail when called from DAPM event callbacks.
Context information from diagnostics:
- in_atomic=0, in_interrupt=0, irqs_disabled=0
- Process context: pipewire
- GPIO 17 (speakers): changes in driver, no physical change
- GPIO 16 (headphone): changes in driver, no physical change
In Windows, audio switching works without visible GPIO changes, suggesting possible ACPI/firmware involvement.
Any suggestions on how to properly control these GPIOs from DAPM events would be appreciated.
--- sound/soc/intel/boards/sof_es8336.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/intel/boards/sof_es8336.c +9 -0
@@ -332,6 +332,15 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id)* if the topology file is modified as well. */ static const struct dmi_system_id sof_es8336_quirk_table[] = { + { + .callback = sof_es8336_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"HUAWEI" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"BOD-WXX9" ), + }, + .driver_data = (void *)(SOF_ES8336_HEADPHONE_GPIO | +SOF_ES8336_ENABLE_DMIC ) + }, { .callback = sof_es8336_quirk_cb, .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 16/42 ASoC: amd: yc: Add quirk for HP 200 G2a 16
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Su <[email protected]>
[ Upstream commit 611c7d2262d5645118e0b3a9a88475d35a8366f2 ]
Fix the missing mic on HP 200 G2a 16 by adding quirk with the board ID 8EE4
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -633,6 +633,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_BOARD_NAME, "8BD6"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), + DMI_MATCH(DMI_BOARD_NAME, "8EE4"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 17/42 ALSA: hda/realtek: Enable headset mic for Acer Nitro 5
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Baptista <[email protected]>
[ Upstream commit 51db05283f7c9c95a3e6853a3044cd04226551bf ]
Add quirk to support microphone input through headphone jack on Acer Nitro 5 AN515-57 (ALC295).
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10450,6 +10450,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {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 ,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 ),SND_PCI_QUIRK (0x1025 ,0x1597 ,"Acer Nitro 5 AN517-55" ,ALC2XX_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 18/42 platform/x86/amd/pmc: Add quirk for MECHREVO Wujie 15X Pro
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: gongqi <[email protected]>
[ Upstream commit 2b4e00d8e70ca8736fda82447be6a4e323c6d1f5 ]
The MECHREVO Wujie 15X Pro suffers from spurious IRQ issues related to the AMD PMC. Add it to the quirk list to use the spurious_8042 fix.
--- drivers/platform/x86/amd/pmc/pmc-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/amd/pmc/pmc-quirks.c +7 -0
@@ -296,6 +296,13 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_BOARD_NAME, "XxKK4NAx_XxSP4NAx"), } }, + { + .ident = "MECHREVO Wujie 15X Pro", + .driver_data = &quirk_spurious_8042, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "WUJIE Series-X5SP4NAG"), + } + }, {} };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 19/42 platform/x86: panasonic-laptop: Fix sysfs group leak in error path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 43b0b7eff4b3fb684f257d5a24376782e9663465 ]
The acpi_pcc_hotkey_add() error path leaks sysfs group pcc_attr_group if platform_device_register_simple() fails for the "panasonic" platform device.
Address this by making it call sysfs_remove_group() in that case for the group in question.
--- drivers/platform/x86/panasonic-laptop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/panasonic-laptop.c +3 -1
@@ -1089,7 +1089,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) PLATFORM_DEVID_NONE, NULL, 0);if (IS_ERR (pcc->platform)) { result =PTR_ERR (pcc->platform); - goto out_backlight; + goto out_sysfs; } result =device_create_file (&pcc->platform->dev, &dev_attr_cdpower);
@@ -1105,6 +1105,8 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) out_platform:platform_device_unregister (pcc->platform); +out_sysfs: +sysfs_remove_group (&device->dev.kobj, &pcc_attr_group); out_backlight:backlight_device_unregister (pcc->backlight); out_input:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 2/42 bnxt_en: Change FW message timeout warning
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
commit 0fcad44a86bdc2b5f202d91ba1eeeee6fceb7b25 upstream.
The firmware advertises a "hwrm_cmd_max_timeout" value to the driver for NVRAM and coredump related functions that can take tens of seconds to complete. The driver polls for the operation to complete under mutex and may trigger hung task watchdog warning if the wait is too long. To warn the user about this, the driver currently prints a warning if this advertised value exceeds 40 seconds:
Device requests max timeout of %d seconds, may trigger hung task watchdog
Initially, we chose 40 seconds, well below the kernel's default CONFIG_DEFAULT_HUNG_TASK_TIMEOUT (120 seconds) to avoid triggering the hung task watchdog. But 60 seconds is the timeout on most production FW and cannot be reduced further. Change the driver's warning threshold to 60 seconds to avoid triggering this warning on all production devices. We also print the warning if the value exceeds CONFIG_DEFAULT_HUNG_TASK_TIMEOUT which may be set to architecture specific defaults as low as 10 seconds.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 +++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -4
@@ -9770,7 +9770,7 @@ static int bnxt_hwrm_ver_get(struct bnxtstruct hwrm_ver_get_input *req;u16 fw_maj, fw_min, fw_bld, fw_rsv;u32 dev_caps_cfg, hwrm_ver; -int rc, len; +int rc, len, max_tmo_secs; rc =hwrm_req_init (bp, req,HWRM_VER_GET );if (rc)
@@ -9843,9 +9843,12 @@ static int bnxt_hwrm_ver_get(struct bnxt bp->hwrm_cmd_max_timeout =le16_to_cpu (resp->max_req_timeout) *1000 ;if (!bp->hwrm_cmd_max_timeout) bp->hwrm_cmd_max_timeout =HWRM_CMD_MAX_TIMEOUT ; -else if (bp->hwrm_cmd_max_timeout >HWRM_CMD_MAX_TIMEOUT ) -netdev_warn (bp->dev,"Device requests max timeout of %d seconds, may trigger hung task watchdog\n" , - bp->hwrm_cmd_max_timeout /1000 ); + max_tmo_secs = bp->hwrm_cmd_max_timeout /1000 ; +if (bp->hwrm_cmd_max_timeout >HWRM_CMD_MAX_TIMEOUT || + max_tmo_secs >CONFIG_DEFAULT_HUNG_TASK_TIMEOUT ) { +netdev_warn (bp->dev,"Device requests max timeout of %d seconds, may trigger hung task watchdog (kernel default %ds)\n" , + max_tmo_secs,CONFIG_DEFAULT_HUNG_TASK_TIMEOUT ); + }if (resp->hwrm_intf_maj_8b >=1 ) { bp->hwrm_max_req_len =le16_to_cpu (resp->max_req_win_len);
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +1 -1
@@ -58,7 +58,7 @@ void hwrm_update_token(struct bnxt *bp,#define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len)#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) -#define HWRM_CMD_MAX_TIMEOUT 40000U +#define HWRM_CMD_MAX_TIMEOUT 60000U#define SHORT_HWRM_CMD_TIMEOUT 20#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
Greg Kroah-Hartman
maintainerPATCH 20/42 ASoC: cs42l43: Correct handling of 3-pole jack load detection
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit e77a4081d7e324dfa876a9560b2a78969446ba82 ]
The load detection process for 3-pole jacks requires slightly updated reference values to ensure an accurate result. Update the code to apply different tunings for the 3-pole and 4-pole cases. This also updates the thresholds overall so update the relevant comments to match.
--- sound/soc/codecs/cs42l43-jack.c | 37 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
sound/soc/codecs/cs42l43-jack.c +31 -6
@@ -508,7 +508,23 @@ void cs42l43_bias_sense_timeout(struct work_struct *work)pm_runtime_put_autosuspend (priv->dev); } -static void cs42l43_start_load_detect (struct cs42l43_codec *priv) +static const struct reg_sequence cs42l43_3pole_patch[] = { + {0x4000 ,0x00000055 }, + {0x4000 ,0x000000AA }, + {0x17420 ,0x8500F300 }, + {0x17424 ,0x36003E00 }, + {0x4000 ,0x00000000 }, +}; + +static const struct reg_sequence cs42l43_4pole_patch[] = { + {0x4000 ,0x00000055 }, + {0x4000 ,0x000000AA }, + {0x17420 ,0x7800E600 }, + {0x17424 ,0x36003800 }, + {0x4000 ,0x00000000 }, +}; + +static void cs42l43_start_load_detect (struct cs42l43_codec *priv,bool mic) {struct cs42l43 *cs42l43 = priv->core;
@@ -532,6 +548,15 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv)dev_err (priv->dev,"Load detect HP power down timed out\n" ); } +if (mic) +regmap_multi_reg_write_bypassed (cs42l43->regmap, + cs42l43_4pole_patch, +ARRAY_SIZE (cs42l43_4pole_patch)); +else +regmap_multi_reg_write_bypassed (cs42l43->regmap, + cs42l43_3pole_patch, +ARRAY_SIZE (cs42l43_3pole_patch)); +regmap_update_bits (cs42l43->regmap,CS42L43_BLOCK_EN3 ,CS42L43_ADC1_EN_MASK |CS42L43_ADC2_EN_MASK ,0 );regmap_update_bits (cs42l43->regmap,CS42L43_DACCNFG2 ,CS42L43_HP_HPF_EN_MASK ,0 );
@@ -610,7 +635,7 @@ static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic)reinit_completion (&priv->load_detect); -cs42l43_start_load_detect (priv); +cs42l43_start_load_detect (priv, mic); time_left =wait_for_completion_timeout (&priv->load_detect,msecs_to_jiffies (CS42L43_LOAD_TIMEOUT_MS ));cs42l43_stop_load_detect (priv);
@@ -634,11 +659,11 @@ static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic) }switch (val &CS42L43_AMP3_RES_DET_MASK ) { -case 0x0 :// low impedance -case 0x1 :// high impedance +case 0x0 :// < 22 Ohm impedance +case 0x1 :// < 150 Ohm impedance +case 0x2 :// < 1000 Ohm impedance return CS42L43_JACK_HEADPHONE ; -case 0x2 :// lineout -case 0x3 :// Open circuit +case 0x3 :// > 1000 Ohm impedance return CS42L43_JACK_LINEOUT ;default :return -EINVAL ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 21/42 tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit daafcc0ef0b358d9d622b6e3b7c43767aa3814ee ]
The dma_map_sg tracepoint can trigger a perf buffer overflow when tracing large scatter-gather lists. With devices like virtio-gpu creating large DRM buffers, nents can exceed 1000 entries, resulting in:
phys_addrs: 1000 * 8 bytes = 8,000 bytes
dma_addrs: 1000 * 8 bytes = 8,000 bytes
lengths: 1000 * 4 bytes = 4,000 bytes
Total: ~20,000 bytes
This exceeds PERF_MAX_TRACE_SIZE (8192 bytes), causing:
WARNING: CPU: 0 PID: 5497 at kernel/trace/trace_event_perf.c:405 perf buffer not large enough, wanted 24620, have 8192
Cap all three dynamic arrays at 128 entries using min() in the array size calculation. This ensures arrays are only as large as needed (up to the cap), avoiding unnecessary memory allocation for small operations while preventing overflow for large ones.
The tracepoint now records the full nents/ents counts and a truncated flag so users can see when data has been capped.
Changes in v2:
- Use min(nents, DMA_TRACE_MAX_ENTRIES) for dynamic array sizing instead of fixed DMA_TRACE_MAX_ENTRIES allocation (feedback from Steven Rostedt)
- This allocates only what's needed up to the cap, avoiding waste for small operations
--- include/trace/events/dma.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
include/trace/events/dma.h +19 -6
@@ -278,6 +278,8 @@ TRACE_EVENT(dma_free_sgt, sizeof(u64), sizeof(u64))) ); +#define DMA_TRACE_MAX_ENTRIES 128 + TRACE_EVENT(dma_map_sg, TP_PROTO(struct device *dev, struct scatterlist *sgl, int nents, int ents, enum dma_data_direction dir, unsigned long attrs),
@@ -285,9 +287,12 @@ TRACE_EVENT(dma_map_sg,TP_STRUCT__entry (__string (device ,dev_name (dev )) -__dynamic_array (u64, phys_addrs, nents) -__dynamic_array (u64, dma_addrs, ents) - __dynamic_array(unsigned int, lengths, ents) +__field (int, full_nents) +__field (int, full_ents) +__field (bool, truncated) +__dynamic_array (u64, phys_addrs,min (nents,DMA_TRACE_MAX_ENTRIES )) +__dynamic_array (u64, dma_addrs,min (ents,DMA_TRACE_MAX_ENTRIES )) + __dynamic_array(unsigned int, lengths, min(ents, DMA_TRACE_MAX_ENTRIES)) __field(enum dma_data_direction, dir) __field(unsigned long, attrs) ),
@@ -295,11 +300,16 @@ TRACE_EVENT(dma_map_sg,TP_fast_assign ( struct scatterlist *sg;int i; +int traced_nents =min_t (int, nents,DMA_TRACE_MAX_ENTRIES ); +int traced_ents =min_t (int, ents,DMA_TRACE_MAX_ENTRIES );__assign_str (device); -for_each_sg (sgl, sg, nents, i) + __entry->full_nents = nents; + __entry->full_ents = ents; + __entry->truncated = (nents >DMA_TRACE_MAX_ENTRIES ) || (ents >DMA_TRACE_MAX_ENTRIES ); +for_each_sg (sgl, sg, traced_nents, i) ((u64 *)__get_dynamic_array (phys_addrs))[i] =sg_phys (sg); -for_each_sg (sgl, sg, ents, i) { +for_each_sg (sgl, sg, traced_ents, i) { ((u64 *)__get_dynamic_array (dma_addrs))[i] =sg_dma_address (sg); ((unsigned int *)__get_dynamic_array(lengths))[i] =
@@ -309,9 +319,12 @@ TRACE_EVENT(dma_map_sg, __entry->attrs = attrs; ), - TP_printk("%s dir=%s dma_addrs=%s sizes=%s phys_addrs=%s attrs=%s", + TP_printk("%s dir=%s nents=%d/%d ents=%d/%d%s dma_addrs=%s sizes=%s phys_addrs=%s attrs=%s", __get_str(device), decode_dma_data_direction(__entry->dir), + min_t(int, __entry->full_nents, DMA_TRACE_MAX_ENTRIES), __entry->full_nents, + min_t(int, __entry->full_ents, DMA_TRACE_MAX_ENTRIES), __entry->full_ents, + __entry->truncated ? " [TRUNCATED]" : "", __print_array(__get_dynamic_array(dma_addrs), __get_dynamic_array_len(dma_addrs) / sizeof(u64), sizeof(u64)),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 3/42 bnxt_en: hide CONFIG_DETECT_HUNG_TASK specific code
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 8ff6175139967cd17b2a62bca4b2de2559942b7e upstream.
The CONFIG_DEFAULT_HUNG_TASK_TIMEOUT setting is only available when the hung task detection is enabled, otherwise the code now produces a build failure:
drivers/net/ethernet/broadcom/bnxt/bnxt.c:10188:21: error: use of undeclared identifier 'CONFIG_DEFAULT_HUNG_TASK_TIMEOUT'
10188 | max_tmo_secs > CONFIG_DEFAULT_HUNG_TASK_TIMEOUT) {
Enclose this warning logic in an #ifdef to ensure this builds.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -0
@@ -9844,11 +9844,13 @@ static int bnxt_hwrm_ver_get(struct bnxtif (!bp->hwrm_cmd_max_timeout) bp->hwrm_cmd_max_timeout =HWRM_CMD_MAX_TIMEOUT ; max_tmo_secs = bp->hwrm_cmd_max_timeout /1000 ; +#ifdef CONFIG_DETECT_HUNG_TASK if (bp->hwrm_cmd_max_timeout >HWRM_CMD_MAX_TIMEOUT || max_tmo_secs >CONFIG_DEFAULT_HUNG_TASK_TIMEOUT ) {netdev_warn (bp->dev,"Device requests max timeout of %d seconds, may trigger hung task watchdog (kernel default %ds)\n" , max_tmo_secs,CONFIG_DEFAULT_HUNG_TASK_TIMEOUT ); } +#endif if (resp->hwrm_intf_maj_8b >=1 ) { bp->hwrm_max_req_len =le16_to_cpu (resp->max_req_win_len);
Greg Kroah-Hartman
maintainerPATCH 4/42 bus: fsl-mc: Replace snprintf and sprintf with sysfs_emit in sysfs show functions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chelsy Ratnawat <[email protected]>
[ Upstream commit a50522c805a6c575c80f41b04706e084d814e116 ]
Use sysfs_emit() instead of snprintf()/sprintf() when writing to sysfs buffers, as recommended by the kernel documentation.
Stable-dep-of: 148891e95014 ("bus: fsl-mc: fix use-after-free in driver_override_show()")
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +3 -3
@@ -175,8 +175,8 @@ static ssize_t modalias_show(struct devi {struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); -return sprintf (buf,"fsl-mc:v%08Xd%s\n" , mc_dev->obj_desc.vendor, - mc_dev->obj_desc.type); +return sysfs_emit (buf,"fsl-mc:v%08Xd%s\n" , mc_dev->obj_desc.vendor, + mc_dev->obj_desc.type); }static DEVICE_ATTR_RO (modalias);
@@ -202,7 +202,7 @@ static ssize_t driver_override_show(stru {struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); -return snprintf (buf,PAGE_SIZE ,"%s\n" , mc_dev->driver_override); +return sysfs_emit (buf,"%s\n" , mc_dev->driver_override); }static DEVICE_ATTR_RW (driver_override);
Greg Kroah-Hartman
maintainerPATCH 5/42 bus: fsl-mc: fix use-after-free in driver_override_show()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gui-Dong Han <[email protected]>
[ Upstream commit 148891e95014b5dc5878acefa57f1940c281c431 ]
The driver_override_show() function reads the driver_override string without holding the device_lock. However, driver_override_store() uses driver_set_override(), which modifies and frees the string while holding the device_lock.
This can result in a concurrent use-after-free if the string is freed by the store function while being read by the show function.
Fix this by holding the device_lock around the read operation.
--- drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +5 -1
@@ -201,8 +201,12 @@ static ssize_t driver_override_show(stru struct device_attribute *attr, char *buf) { struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); +ssize_t len; -return sysfs_emit (buf,"%s\n" , mc_dev->driver_override); +device_lock (dev); + len =sysfs_emit (buf,"%s\n" , mc_dev->driver_override); +device_unlock (dev); +return len; }static DEVICE_ATTR_RW (driver_override);
Greg Kroah-Hartman
maintainerPATCH 6/42 ALSA: hda/realtek: Fix headset mic for TongFang X6AR55xU
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Guttzeit <[email protected]>
[ Upstream commit b48fe9af1e60360baf09ca6b7a3cd6541f16e611 ]
Add a PCI quirk to enable microphone detection on the headphone jack of TongFang X6AR55xU devices.
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -11835,6 +11835,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x12, 0x90a60140}, {0x19, 0x04a11030}, {0x21, 0x04211020}), + SND_HDA_PIN_QUIRK(0x10ec0274, 0x1d05, "TongFang", ALC274_FIXUP_HP_HEADSET_MIC, + {0x17, 0x90170110}, + {0x19, 0x03a11030}, + {0x21, 0x03211020}), SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT, ALC282_STANDARD_PINS, {0x12, 0x90a609c0},
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 7/42 ASoC: amd: yc: Add ASUS ExpertBook PM1503CDA to quirks list
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anatolii Shirykalov <[email protected]>
[ Upstream commit 018b211b1d321a52ed8d8de74ce83ce52a2e1224 ]
Add ASUS ExpertBook PM1503CDA to the DMI quirks table to enable internal DMIC support via the ACP6x machine driver.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -535,6 +535,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK PM1503CDA"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 8/42 gpio: sprd: Change sprd_gpio lock to raw_spin_lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuewen Yan <[email protected]>
[ Upstream commit 96313fcc1f062ba239f4832c9eff685da6c51c99 ]
There was a lockdep warning in sprd_gpio:
[ 6.258269][T329@C6] [ BUG: Invalid wait context ]
[ 6.258270][T329@C6] 6.18.0-android17-0-g30527ad7aaae-ab00009-4k #1 Tainted: G W OE
[ 6.258272][T329@C6] -----------------------------
[ 6.258273][T329@C6] modprobe/329 is trying to lock:
[ 6.258275][T329@C6] ffffff8081c91690 (&sprd_gpio->lock){....}-{3:3}, at: sprd_gpio_irq_unmask+0x4c/0xa4 [gpio_sprd]
[ 6.258282][T329@C6] other info that might help us debug this:
[ 6.258283][T329@C6] context-{5:5}
[ 6.258285][T329@C6] 3 locks held by modprobe/329:
[ 6.258286][T329@C6] #0: ffffff808baca108 (&dev->mutex){....}-{4:4}, at: __driver_attach+0xc4/0x204
[ 6.258295][T329@C6] #1: ffffff80965e7240 (request_class#4){+.+.}-{4:4}, at: __setup_irq+0x1cc/0x82c
[ 6.258304][T329@C6] #2: ffffff80965e70c8 (lock_class#4){....}-{2:2}, at: __setup_irq+0x21c/0x82c
[ 6.258313][T329@C6] stack backtrace:
[ 6.258314][T329@C6] CPU: 6 UID: 0 PID: 329 Comm: modprobe Tainted: G W OE 6.18.0-android17-0-g30527ad7aaae-ab00009-4k #1 PREEMPT 3ad5b0f45741a16e5838da790706e16ceb6717df
[ 6.258316][T329@C6] Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
[ 6.258317][T329@C6] Hardware name: Unisoc UMS9632-base Board (DT)
[ 6.258318][T329@C6] Call trace:
[ 6.258318][T329@C6] show_stack+0x20/0x30 (C)
[ 6.258321][T329@C6] __dump_stack+0x28/0x3c
[ 6.258324][T329@C6] dump_stack_lvl+0xac/0xf0
[ 6.258326][T329@C6] dump_stack+0x18/0x3c
[ 6.258329][T329@C6] __lock_acquire+0x824/0x2c28
[ 6.258331][T329@C6] lock_acquire+0x148/0x2cc
[ 6.258333][T329@C6] _raw_spin_lock_irqsave+0x6c/0xb4
[ 6.258334][T329@C6] sprd_gpio_irq_unmask+0x4c/0xa4 [gpio_sprd 814535e93c6d8e0853c45c02eab0fa88a9da6487]
[ 6.258337][T329@C6] irq_startup+0x238/0x350
[ 6.258340][T329@C6] __setup_irq+0x504/0x82c
[ 6.258342][T329@C6] request_threaded_irq+0x118/0x184
[ 6.258344][T329@C6] devm_request_threaded_irq+0x94/0x120
[ 6.258347][T329@C6] sc8546_init_irq+0x114/0x170 [sc8546_charger 223586ccafc27439f7db4f95b0c8e6e882349a99]
[ 6.258352][T329@C6] sc8546_charger_probe+0x53c/0x5a0 [sc8546_charger 223586ccafc27439f7db4f95b0c8e6e882349a99]
[ 6.258358][T329@C6] i2c_device_probe+0x2c8/0x350
[ 6.258361][T329@C6] really_probe+0x1a8/0x46c
[ 6.258363][T329@C6] __driver_probe_device+0xa4/0x10c
[ 6.258366][T329@C6] driver_probe_device+0x44/0x1b4
[ 6.258369][T329@C6] __driver_attach+0xd0/0x204
[ 6.258371][T329@C6] bus_for_each_dev+0x10c/0x168
[ 6.258373][T329@C6] driver_attach+0x2c/0x3c
[ 6.258376][T329@C6] bus_add_driver+0x154/0x29c
[ 6.258378][T329@C6] driver_register+0x70/0x10c
[ 6.258381][T329@C6] i2c_register_driver+0x48/0xc8
[ 6.258384][T329@C6] init_module+0x28/0xfd8 [sc8546_charger 223586ccafc27439f7db4f95b0c8e6e882349a99]
[ 6.258389][T329@C6] do_one_initcall+0x128/0x42c
[ 6.258392][T329@C6] do_init_module+0x60/0x254
[ 6.258395][T329@C6] load_module+0x1054/0x1220
[ 6.258397][T329@C6] __arm64_sys_finit_module+0x240/0x35c
[ 6.258400][T329@C6] invoke_syscall+0x60/0xec
[ 6.258402][T329@C6] el0_svc_common+0xb0/0xe4
[ 6.258405][T329@C6] do_el0_svc+0x24/0x30
[ 6.258407][T329@C6] el0_svc+0x54/0x1c4
[ 6.258409][T329@C6] el0t_64_sync_handler+0x68/0xdc
[ 6.258411][T329@C6] el0t_64_sync+0x1c4/0x1c8This is because the spin_lock would change to rt_mutex in PREEMPT_RT, however the sprd_gpio->lock would use in hard-irq, this is unsafe.
So change the spin_lock_t to raw_spin_lock_t to use the spinlock in hard-irq.
--- drivers/gpio/gpio-sprd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-sprd.c +4 -4
@@ -35,7 +35,7 @@struct sprd_gpio {struct gpio_chip chip;void __iomem *base; -spinlock_t lock; +raw_spinlock_t lock;int irq; };
@@ -54,7 +54,7 @@ static void sprd_gpio_update(struct gpio_chip *chip, unsigned int offset,unsigned long flags;u32 tmp; -spin_lock_irqsave (&sprd_gpio->lock, flags); +raw_spin_lock_irqsave (&sprd_gpio->lock, flags); tmp =readl_relaxed (base + reg);if (val)
@@ -63,7 +63,7 @@ static void sprd_gpio_update(struct gpio_chip *chip, unsigned int offset, tmp &= ~BIT (SPRD_GPIO_BIT (offset));writel_relaxed (tmp, base + reg); -spin_unlock_irqrestore (&sprd_gpio->lock, flags); +raw_spin_unlock_irqrestore (&sprd_gpio->lock, flags); }static int sprd_gpio_read (struct gpio_chip *chip,unsigned int offset,u16 reg)
@@ -234,7 +234,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)if (IS_ERR (sprd_gpio->base))return PTR_ERR (sprd_gpio->base); -spin_lock_init (&sprd_gpio->lock); +raw_spin_lock_init (&sprd_gpio->lock); sprd_gpio->chip.label =dev_name (&pdev->dev); sprd_gpio->chip.ngpio =SPRD_GPIO_NR ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 9/42 ALSA: hda/realtek: Add quirk for Inspur S14-G1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit 9e18920e783d0bcd4c127a7adc66565243ab9655 ]
Inspur S14-G1 is equipped with ALC256.
Enable "power saving mode" and Enable "headset jack mode".
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -11379,6 +11379,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1ee7 ,0x2078 ,"HONOR BRB-X M1010" ,ALC2XX_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1f66 ,0x0105 ,"Ayaneo Portable Game Player" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x2014 ,0x800a ,"Positivo ARN50" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x2039 ,0x0001 ,"Inspur S14-G1" ,ALC295_FIXUP_CHROME_BOOK ),SND_PCI_QUIRK (0x2782 ,0x0214 ,"VAIO VJFE-CL" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x2782 ,0x0228 ,"Infinix ZERO BOOK 13" ,ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13 ), SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainercover 6.12.74-rc1 review
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.74-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.12.74-rc1
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit FN920C04 RNDIS compositions
Yongpeng Yang <[email protected]>
f2fs: fix IS_CHECKPOINTED flag inconsistency issue caused by concurrent atomic commit and checkpoint writes
Chao Yu <[email protected]>
f2fs: fix to avoid UAF in f2fs_write_end_io()
Danilo Krummrich <[email protected]>
iommu/arm-smmu-qcom: do not register driver in probe()
Chao Yu <[email protected]>
f2fs: fix to avoid mapping wrong physical block for swapfile
Yongpeng Yang <[email protected]>
f2fs: fix out-of-bounds access in sysfs attribute read/write
Chao Yu <[email protected]>
f2fs: fix to check sysfs filename w/ gc_pin_file_thresh correctly
Zhiguo Niu <[email protected]>
f2fs: fix to add gc count stat in f2fs_gc_range
Greg Kroah-Hartman <[email protected]>
fbdev: smscufx: properly copy ioctl memory to kernelspace
Guangshuo Li <[email protected]>
fbdev: rivafb: fix divide error in nv3_arb()
Chen Ridong <[email protected]>
cpuset: Fix missing adaptation for cpuset_is_populated
Daniel Borkmann <[email protected]>
Revert "wireguard: device: enable threaded NAPI"
Tiezhu Yang <[email protected]>
LoongArch: Rework KASAN initialization for PTW-enabled systems
David Hildenbrand (Red Hat) <[email protected]>
mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather
David Hildenbrand (Red Hat) <[email protected]>
mm/hugetlb: fix two comments related to huge_pmd_unshare()
David Hildenbrand (Red Hat) <[email protected]>
mm/hugetlb: fix hugetlb_pmd_shared()
Jane Chu <[email protected]>
mm/hugetlb: fix copy_hugetlb_page_range() to use ->pt_share_count
Alban Bedel <[email protected]>
gpiolib: acpi: Fix gpio count with string references
Ziyi Guo <[email protected]>
ASoC: fsl_xcvr: fix missing lock in fsl_xcvr_mode_put()
Melissa Wen <[email protected]>
drm/amd/display: remove assert around dpp_base replacement
Melissa Wen <[email protected]>
drm/amd/display: extend delta clamping logic to CM3 LUT helper
Deepanshu Kartikey <[email protected]>
tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow
Charles Keepax <[email protected]>
ASoC: cs42l43: Correct handling of 3-pole jack load detection
Rafael J. Wysocki <[email protected]>
platform/x86: panasonic-laptop: Fix sysfs group leak in error path
gongqi <[email protected]>
platform/x86/amd/pmc: Add quirk for MECHREVO Wujie 15X Pro
Breno Baptista <[email protected]>
ALSA: hda/realtek: Enable headset mic for Acer Nitro 5
Dirk Su <[email protected]>
ASoC: amd: yc: Add quirk for HP 200 G2a 16
Tagir Garaev <[email protected]>
ASoC: Intel: sof_es8336: Add DMI quirk for Huawei BOD-WXX9
Rafael J. Wysocki <[email protected]>
platform/x86: classmate-laptop: Add missing NULL pointer checks
Brahmajit Das <[email protected]>
drm/tegra: hdmi: sor: Fix error: variable ‘j’ set but not used
Deepanshu Kartikey <[email protected]>
romfs: check sb_set_blocksize() return value
Kailang Yang <[email protected]>
ALSA: hda/realtek - fixed speaker no sound
Ricardo Rivera-Matos <[email protected]>
ASoC: cs35l45: Corrects ASP_TX5 DAPM widget channel
Zhang Heng <[email protected]>
ALSA: hda/realtek: Add quirk for Inspur S14-G1
Xuewen Yan <[email protected]>
gpio: sprd: Change sprd_gpio lock to raw_spin_lock
Anatolii Shirykalov <[email protected]>
ASoC: amd: yc: Add ASUS ExpertBook PM1503CDA to quirks list
Tim Guttzeit <[email protected]>
ALSA: hda/realtek: Fix headset mic for TongFang X6AR55xU
Gui-Dong Han <[email protected]>
bus: fsl-mc: fix use-after-free in driver_override_show()
Chelsy Ratnawat <[email protected]>
bus: fsl-mc: Replace snprintf and sprintf with sysfs_emit in sysfs show functions
Arnd Bergmann <[email protected]>
bnxt_en: hide CONFIG_DETECT_HUNG_TASK specific code
Michael Chan <[email protected]>
bnxt_en: Change FW message timeout warning
Anil Gurumurthy <[email protected]>
scsi: qla2xxx: Fix bsg_done() causing double free
-------------
Diffstat:
Makefile | 4 +- arch/loongarch/mm/kasan_init.c | 79 +++++------ drivers/bus/fsl-mc/fsl-mc-bus.c | 10 +- drivers/gpio/gpio-sprd.c | 8 +- drivers/gpio/gpiolib-acpi-core.c | 1 + .../gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 30 ++++- .../drm/amd/display/dc/dwb/dcn30/dcn30_cm_common.h | 2 +- .../drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 9 +- .../drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 18 +-- .../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 16 ++- drivers/gpu/drm/tegra/hdmi.c | 4 +- drivers/gpu/drm/tegra/sor.c | 4 +- drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 14 ++ drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 14 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 24 +++- drivers/iommu/arm/arm-smmu/arm-smmu.h | 5 + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 +- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 2 +- drivers/net/wireguard/device.c | 1 - drivers/platform/x86/amd/pmc/pmc-quirks.c | 7 + drivers/platform/x86/classmate-laptop.c | 32 +++++ drivers/platform/x86/panasonic-laptop.c | 4 +- drivers/scsi/qla2xxx/qla_bsg.c | 28 ++-- drivers/usb/serial/option.c | 6 + drivers/video/fbdev/riva/riva_hw.c | 3 + drivers/video/fbdev/smscufx.c | 8 +- fs/f2fs/data.c | 26 ++-- fs/f2fs/gc.c | 1 + fs/f2fs/node.c | 14 +- fs/f2fs/sysfs.c | 62 +++++++-- fs/romfs/super.c | 5 +- include/asm-generic/tlb.h | 77 ++++++++++- include/linux/hugetlb.h | 17 ++- include/linux/mm_types.h | 6 + include/trace/events/dma.h | 25 +++- kernel/cgroup/cpuset.c | 2 +- mm/hugetlb.c | 146 +++++++++++---------- mm/mmu_gather.c | 33 +++++ mm/rmap.c | 25 ++-- sound/pci/hda/patch_realtek.c | 17 +++ sound/soc/amd/yc/acp6x-mach.c | 14 ++ sound/soc/codecs/cs35l45.c | 2 +- sound/soc/codecs/cs42l43-jack.c | 37 +++++- sound/soc/fsl/fsl_xcvr.c | 3 + sound/soc/intel/boards/sof_es8336.c | 9 ++ 45 files changed, 642 insertions(+), 225 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 23/42 drm/amd/display: remove assert around dpp_base replacement
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <[email protected]>
[ Upstream commit 84962445cd8a83dc5bed4c8ad5bbb2c1cdb249a0 ]
There is nothing wrong if in_shaper_func type is DISTRIBUTED POINTS. Remove the assert placed for a TODO to avoid misinterpretations.
--- drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +0 -1
@@ -499,7 +499,6 @@ bool dcn32_set_mcm_luts( lut_params = &plane_state->in_shaper_func.pwl; else if (plane_state->in_shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {// TODO: dpp_base replace -ASSERT (false);cm3_helper_translate_curve_to_hw_format (plane_state->ctx, &plane_state->in_shaper_func, &dpp_base->shaper_params, true);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 32/42 cpuset: Fix missing adaptation for cpuset_is_populated
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
Commit b1bcaed1e39a ("cpuset: Treat cpusets in attaching as populated") was backported to the long‑term support (LTS) branches. However, because commit d5cf4d34a333 ("cgroup/cpuset: Don't track # of local child partitions") was not backported, a corresponding adaptation to the backported code is still required.
To ensure correct behavior, replace cgroup_is_populated with cpuset_is_populated in the partition_is_populated function.
--- kernel/cgroup/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cpuset.c +1 -1
@@ -347,7 +347,7 @@ static inline bool partition_is_populate cs->attach_in_progress)return true;if (!excluded_child && !cs->nr_subparts) -return cgroup_is_populated (cs->css.cgroup); +return cpuset_is_populated (cs);rcu_read_lock ();cpuset_for_each_descendant_pre (cp, pos_css, cs) {
Greg Kroah-Hartman
maintainerPATCH 33/42 fbdev: rivafb: fix divide error in nv3_arb()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
commit 0209e21e3c372fa2da04c39214bec0b64e4eb5f4 upstream.
A userspace program can trigger the RIVA NV3 arbitration code by calling the FBIOPUT_VSCREENINFO ioctl on /dev/fb*. When doing so, the driver recomputes FIFO arbitration parameters in nv3_arb(), using state->mclk_khz (derived from the PRAMDAC MCLK PLL) as a divisor without validating it first.
In a normal setup, state->mclk_khz is provided by the real hardware and is non-zero. However, an attacker can construct a malicious or misconfigured device (e.g. a crafted/emulated PCI device) that exposes a bogus PLL configuration, causing state->mclk_khz to become zero. Once nv3_get_param() calls nv3_arb(), the division by state->mclk_khz in the gns calculation causes a divide error and crashes the kernel.
Fix this by checking whether state->mclk_khz is zero and bailing out before doing the division.
The following log reveals it:
rivafb: setting virtual Y resolution to 2184
divide error: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 0 PID: 2187 Comm: syz-executor.0 Not tainted 5.18.0-rc1+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 RIP: 0010:nv3_arb drivers/video/fbdev/riva/riva_hw.c:439 [inline] RIP: 0010:nv3_get_param+0x3ab/0x13b0 drivers/video/fbdev/riva/riva_hw.c:546 Call Trace: nv3CalcArbitration.constprop.0+0x255/0x460 drivers/video/fbdev/riva/riva_hw.c:603 nv3UpdateArbitrationSettings drivers/video/fbdev/riva/riva_hw.c:637 [inline] CalcStateExt+0x447/0x1b90 drivers/video/fbdev/riva/riva_hw.c:1246 riva_load_video_mode+0x8a9/0xea0 drivers/video/fbdev/riva/fbdev.c:779 rivafb_set_par+0xc0/0x5f0 drivers/video/fbdev/riva/fbdev.c:1196 fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1033 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1109 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1188 __x64_sys_ioctl+0x122/0x190 fs/ioctl.c:856
--- drivers/video/fbdev/riva/riva_hw.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/riva/riva_hw.c +3 -0
@@ -436,6 +436,9 @@ static char nv3_arb(nv3_fifo_info * res_ vmisses =2 ; eburst_size = state->memory_width *1 ; mburst_size =32 ; +if (!state->mclk_khz) +return (0 ); + gns =1000000 * (gmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz; ainfo->by_gfacc = gns*ainfo->gdrain_rate/1000000 ; ainfo->wcmocc =0 ;
Greg Kroah-Hartman
maintainerPATCH 34/42 fbdev: smscufx: properly copy ioctl memory to kernelspace
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 120adae7b42faa641179270c067864544a50ab69 upstream.
The UFX_IOCTL_REPORT_DAMAGE ioctl does not properly copy data from userspace to kernelspace, and instead directly references the memory, which can cause problems if invalid data is passed from userspace. Fix this all up by correctly copying the memory before accessing it within the kernel.
--- drivers/video/fbdev/smscufx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/video/fbdev/smscufx.c +6 -2
@@ -932,7 +932,6 @@ static int ufx_ops_ioctl(struct fb_info unsigned long arg) {struct ufx_data *dev = info->par; -struct dloarea *area =NULL ;if (!atomic_read (&dev->usb_active))return 0 ;
@@ -947,6 +946,10 @@ static int ufx_ops_ioctl(struct fb_info/* TODO: Help propose a standard fb.h ioctl to report mmap damage */ if (cmd ==UFX_IOCTL_REPORT_DAMAGE ) { + struct dloarea *area __free(kfree) = kmalloc(sizeof(*area), GFP_KERNEL); +if (!area) +return -ENOMEM ; +/* If we have a damage-aware client, turn fb_defio "off" * To avoid perf imact of unnecessary page fault handling. * Done by resetting the delay for this fb_info to a very
@@ -956,7 +959,8 @@ static int ufx_ops_ioctl(struct fb_infoif (info->fbdefio) info->fbdefio->delay =UFX_DEFIO_WRITE_DISABLE ; - area = (struct dloarea *)arg; +if (copy_from_user (area, (u8 __user *)arg,sizeof (*area))) +return -EFAULT ;if (area->x <0 ) area->x =0 ;
Greg Kroah-Hartman
maintainerPATCH 35/42 f2fs: fix to add gc count stat in f2fs_gc_range
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiguo Niu <[email protected]>
commit 761dac9073cd67d4705a94cd1af674945a117f4c upstream.
It missed the stat count in f2fs_gc_range.
--- fs/f2fs/gc.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/gc.c +1 -0
@@ -2072,6 +2072,7 @@ int f2fs_gc_range(struct f2fs_sb_info *sif (unlikely (f2fs_cp_error (sbi)))return -EIO ; +stat_inc_gc_call_count (sbi,FOREGROUND );for (segno = start_seg; segno <= end_seg; segno +=SEGS_PER_SEC (sbi)) {struct gc_inode_list gc_list = { .ilist =LIST_HEAD_INIT (gc_list.ilist),
Greg Kroah-Hartman
maintainerPATCH 36/42 f2fs: fix to check sysfs filename w/ gc_pin_file_thresh correctly
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 0eda086de85e140f53c6123a4c00662f4e614ee4 upstream.
Sysfs entry name is gc_pin_file_thresh instead of gc_pin_file_threshold, fix it.
--- fs/f2fs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/sysfs.c +1 -1
@@ -732,7 +732,7 @@ out:return count; } -if (!strcmp (a->attr.name,"gc_pin_file_threshold" )) { +if (!strcmp (a->attr.name,"gc_pin_file_thresh" )) {if (t >MAX_GC_FAILED_PINNED_FILES )return -EINVAL ; sbi->gc_pin_file_threshold = t;
Greg Kroah-Hartman
maintainerPATCH 37/42 f2fs: fix out-of-bounds access in sysfs attribute read/write
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongpeng Yang <[email protected]>
commit 98ea0039dbfdd00e5cc1b9a8afa40434476c0955 upstream.
Some f2fs sysfs attributes suffer from out-of-bounds memory access and incorrect handling of integer values whose size is not 4 bytes.
For example:
vm:~# echo 65537 > /sys/fs/f2fs/vde/carve_out vm:~# cat /sys/fs/f2fs/vde/carve_out 65537 vm:~# echo 4294967297 > /sys/fs/f2fs/vde/atgc_age_threshold vm:~# cat /sys/fs/f2fs/vde/atgc_age_threshold 1
carve_out maps to {struct f2fs_sb_info}->carve_out, which is a 8-bit integer. However, the sysfs interface allows setting it to a value larger than 255, resulting in an out-of-range update.
atgc_age_threshold maps to {struct atgc_management}->age_threshold, which is a 64-bit integer, but its sysfs interface cannot correctly set values larger than UINT_MAX.
The root causes are:
1. __sbi_store() treats all default values as unsigned int, which prevents updating integers larger than 4 bytes and causes out-of-bounds writes for integers smaller than 4 bytes.
2. f2fs_sbi_show() also assumes all default values are unsigned int, leading to out-of-bounds reads and incorrect access to integers larger than 4 bytes.
This patch introduces {struct f2fs_attr}->size to record the actual size of the integer associated with each sysfs attribute. With this information, sysfs read and write operations can correctly access and update values according to their real data size, avoiding memory corruption and truncation.
--- fs/f2fs/sysfs.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 8 deletions(-)
fs/f2fs/sysfs.c +52 -8
@@ -58,6 +58,7 @@ struct f2fs_attr { const char *buf, size_t len);int struct_type;int offset; +int size;int id; };
@@ -325,11 +326,30 @@ static ssize_t main_blkaddr_show(struct (unsigned long long)MAIN_BLKADDR(sbi)); } +static ssize_t __sbi_show_value (struct f2fs_attr *a, +struct f2fs_sb_info *sbi,char *buf, +unsigned char *value) +{ +switch (a->size) { +case 1 : +return sysfs_emit (buf,"%u\n" , *(u8 *)value); +case 2 : +return sysfs_emit (buf,"%u\n" , *(u16 *)value); +case 4 : +return sysfs_emit (buf,"%u\n" , *(u32 *)value); +case 8 : +return sysfs_emit (buf,"%llu\n" , *(u64 *)value); +default : +f2fs_bug_on (sbi,1 ); +return sysfs_emit (buf, +"show sysfs node value with wrong type\n" ); + } +} +static ssize_t f2fs_sbi_show (struct f2fs_attr *a,struct f2fs_sb_info *sbi,char *buf) {unsigned char *ptr =NULL ; -unsigned int *ui; ptr =__struct_ptr (sbi, a->struct_type);if (!ptr)
@@ -409,9 +429,30 @@ static ssize_t f2fs_sbi_show(struct f2fs atomic_read(&sbi->cp_call_count[BACKGROUND]));#endif - ui = (unsigned int *)(ptr + a->offset); +return __sbi_show_value (a, sbi, buf, ptr + a->offset); +} -return sysfs_emit (buf,"%u\n" , *ui); +static void __sbi_store_value (struct f2fs_attr *a, +struct f2fs_sb_info *sbi, +unsigned char *ui,unsigned long value) +{ +switch (a->size) { +case 1 : + *(u8 *)ui = value; +break ; +case 2 : + *(u16 *)ui = value; +break ; +case 4 : + *(u32 *)ui = value; +break ; +case 8 : + *(u64 *)ui = value; +break ; +default : +f2fs_bug_on (sbi,1 ); +f2fs_err (sbi,"store sysfs node value with wrong type" ); + } } static ssize_t __sbi_store(struct f2fs_attr *a,
@@ -868,7 +909,7 @@ out:return count; } - *ui = (unsigned int )t; +__sbi_store_value (a, sbi, ptr + a->offset, t);return count; }
@@ -1015,24 +1056,27 @@ static struct f2fs_attr f2fs_attr_sb_##_ .id = F2FS_FEATURE_##_feat, \ } -#define F2FS_ATTR_OFFSET (_struct_type, _name, _mode, _show, _store, _offset) \ +#define F2FS_ATTR_OFFSET (_struct_type, _name, _mode, _show, _store, _offset, _size) \ static struct f2fs_attr f2fs_attr_##_name = { \ .attr = {.name = __stringify(_name), .mode = _mode }, \ .show = _show, \ .store = _store, \ .struct_type = _struct_type, \ - .offset = _offset \ + .offset = _offset, \ + .size = _size \ }#define F2FS_RO_ATTR (struct_type, struct_name, name, elname) \ F2FS_ATTR_OFFSET(struct_type, name, 0444, \ f2fs_sbi_show, NULL, \ - offsetof(struct struct_name, elname)) + offsetof(struct struct_name, elname), \ + sizeof_field(struct struct_name, elname))#define F2FS_RW_ATTR (struct_type, struct_name, name, elname) \ F2FS_ATTR_OFFSET(struct_type, name, 0644, \ f2fs_sbi_show, f2fs_sbi_store, \ - offsetof(struct struct_name, elname)) + offsetof(struct struct_name, elname), \ + sizeof_field(struct struct_name, elname))#define F2FS_GENERAL_RO_ATTR (name) \ static struct f2fs_attr f2fs_attr_##name = __ATTR(name, 0444, name##_show, NULL)
Greg Kroah-Hartman
maintainerPATCH 38/42 f2fs: fix to avoid mapping wrong physical block for swapfile
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 5c145c03188bc9ba1c29e0bc4d527a5978fc47f9 upstream.
Xiaolong Guo reported a f2fs bug in bugzilla [1]
[1] https://bugzilla.kernel.org/show_bug.cgi?id=220951
Quoted:
"When using stress-ng's swap stress test on F2FS filesystem with kernel 6.6+, the system experiences data corruption leading to either:
1 dm-verity corruption errors and device reboot
2 F2FS node corruption errors and boot hangs
The issue occurs specifically when:
1 Using F2FS filesystem (ext4 is unaffected)
2 Swapfile size is less than F2FS section size (2MB)
3 Swapfile has fragmented physical layout (multiple non-contiguous extents) 4 Kernel version is 6.6+ (6.1 is unaffected)
The root cause is in check_swap_activate() function in fs/f2fs/data.c. When the first extent of a small swapfile (< 2MB) is not aligned to section boundaries, the function incorrectly treats it as the last extent, failing to map subsequent extents. This results in incorrect swap_extent creation where only the first extent is mapped, causing subsequent swap writes to overwrite wrong physical locations (other files' data).
Steps to Reproduce
1 Setup a device with F2FS-formatted userdata partition
2 Compile stress-ng from https://github.com/ColinIanKing/stress-ng
3 Run swap stress test: (Android devices)
adb shell "cd /data/stressng; ./stress-ng-64 --metrics-brief --timeout 60 --swap 0"
Log:
1 Ftrace shows in kernel 6.6, only first extent is mapped during second f2fs_map_blocks call in check_swap_activate():
stress-ng-swap-8990: f2fs_map_blocks: ino=11002, file offset=0, start blkaddr=0x43143, len=0x1
(Only 4KB mapped, not the full swapfile)
2 in kernel 6.1, both extents are correctly mapped:
stress-ng-swap-5966: f2fs_map_blocks: ino=28011, file offset=0, start blkaddr=0x13cd4, len=0x1
stress-ng-swap-5966: f2fs_map_blocks: ino=28011, file offset=1, start blkaddr=0x60c84b, len=0xff
The problematic code is in check_swap_activate():
if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec ||
nr_pblocks % blks_per_sec ||
!f2fs_valid_pinned_area(sbi, pblock)) {
bool last_extent = false;
not_aligned++;
nr_pblocks = roundup(nr_pblocks, blks_per_sec);
if (cur_lblock + nr_pblocks > sis->max)
nr_pblocks -= blks_per_sec;
/* this extent is last one */
if (!nr_pblocks) {
nr_pblocks = last_lblock - cur_lblock;
last_extent = true;
}
ret = f2fs_migrate_blocks(inode, cur_lblock, nr_pblocks);
if (ret) {
if (ret == -ENOENT)
ret = -EINVAL;
goto out;
}
if (!last_extent)
goto retry;
}When the first extent is unaligned and roundup(nr_pblocks, blks_per_sec) exceeds sis->max, we subtract blks_per_sec resulting in nr_pblocks = 0. The code then incorrectly assumes this is the last extent, sets nr_pblocks = last_lblock - cur_lblock (entire swapfile), and performs migration. After migration, it doesn't retry mapping, so subsequent extents are never processed. "
In order to fix this issue, we need to lookup block mapping info after we migrate all blocks in the tail of swapfile.
--- fs/f2fs/data.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/f2fs/data.c +7 -7
@@ -3980,6 +3980,7 @@ static int check_swap_activate(struct swwhile (cur_lblock < last_lblock && cur_lblock < sis->max) {struct f2fs_map_blocks map; +bool last_extent = false; retry:cond_resched ();
@@ -4005,11 +4006,10 @@ retry: pblock = map.m_pblk; nr_pblocks = map.m_len; -if ((pblock -SM_I (sbi)->main_blkaddr) % blks_per_sec || - nr_pblocks % blks_per_sec || -f2fs_is_sequential_zone_area (sbi, pblock)) { -bool last_extent = false; - +if (!last_extent && + ((pblock -SM_I (sbi)->main_blkaddr) % blks_per_sec || + nr_pblocks % blks_per_sec || +f2fs_is_sequential_zone_area (sbi, pblock))) { not_aligned++; nr_pblocks =roundup (nr_pblocks, blks_per_sec);
@@ -4030,8 +4030,8 @@ retry: goto out; } -if (!last_extent) - goto retry; +/* lookup block mapping info after block migration */ + goto retry; }if (cur_lblock + nr_pblocks >= sis->max)
Greg Kroah-Hartman
maintainerPATCH 39/42 iommu/arm-smmu-qcom: do not register driver in probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
commit ed1ac3c977dd6b119405fa36dd41f7151bd5b4de upstream.
Commit 0b4eeee2876f ("iommu/arm-smmu-qcom: Register the TBU driver in qcom_smmu_impl_init") intended to also probe the TBU driver when CONFIG_ARM_SMMU_QCOM_DEBUG is disabled, but also moved the corresponding platform_driver_register() call into qcom_smmu_impl_init() which is called from arm_smmu_device_probe().
However, it neither makes sense to register drivers from probe() callbacks of other drivers, nor does the driver core allow registering drivers with a device lock already being held.
The latter was revealed by commit dc23806a7c47 ("driver core: enforce device_lock for driver_match_device()") leading to a deadlock condition described in [1].
Additionally, it was noted by Robin that the current approach is potentially racy with async probe [2].
Hence, fix this by registering the qcom_smmu_tbu_driver from module_init(). Unfortunately, due to the vendoring of the driver, this requires an indirection through arm-smmu-impl.c.
--- drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 14 ++++++++++++++ drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 14 ++++++++++---- drivers/iommu/arm/arm-smmu/arm-smmu.c | 24 +++++++++++++++++++++++- drivers/iommu/arm/arm-smmu/arm-smmu.h | 5 +++++ 4 files changed, 52 insertions(+), 5 deletions(-)
drivers/iommu/arm/arm-smmu/arm-smmu-impl.c +14 -0
@@ -227,3 +227,17 @@ struct arm_smmu_device *arm_smmu_impl_inreturn smmu; } + +int __init arm_smmu_impl_module_init (void ) +{ +if (IS_ENABLED (CONFIG_ARM_SMMU_QCOM )) +return qcom_smmu_module_init (); + +return 0 ; +} + +void __exit arm_smmu_impl_module_exit(void) +{ +if (IS_ENABLED (CONFIG_ARM_SMMU_QCOM )) +qcom_smmu_module_exit (); +}
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +10 -4
@@ -638,10 +638,6 @@ struct arm_smmu_device *qcom_smmu_impl_i {const struct device_node *np = smmu->dev->of_node;const struct of_device_id *match; -static u8 tbu_registered; - -if (!tbu_registered++) -platform_driver_register (&qcom_smmu_tbu_driver);#ifdef CONFIG_ACPI if (np ==NULL ) {
@@ -666,3 +662,13 @@ struct arm_smmu_device *qcom_smmu_impl_ireturn smmu; } + +int __init qcom_smmu_module_init (void ) +{ +return platform_driver_register (&qcom_smmu_tbu_driver); +} + +void __exit qcom_smmu_module_exit(void) +{ +platform_driver_unregister (&qcom_smmu_tbu_driver); +}
drivers/iommu/arm/arm-smmu/arm-smmu.c +23 -1
@@ -2386,7 +2386,29 @@ static struct platform_driver arm_smmu_d .remove_new = arm_smmu_device_remove, .shutdown = arm_smmu_device_shutdown, }; -module_platform_driver (arm_smmu_driver); + +static int __init arm_smmu_init (void ) +{ +int ret; + + ret =platform_driver_register (&arm_smmu_driver); +if (ret) +return ret; + + ret =arm_smmu_impl_module_init (); +if (ret) +platform_driver_unregister (&arm_smmu_driver); + +return ret; +} +module_init (arm_smmu_init); + +static void __exit arm_smmu_exit(void) +{ +arm_smmu_impl_module_exit (); +platform_driver_unregister (&arm_smmu_driver); +} +module_exit (arm_smmu_exit);MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMU implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );
drivers/iommu/arm/arm-smmu/arm-smmu.h +5 -0
@@ -538,6 +538,11 @@ struct arm_smmu_device *arm_smmu_impl_instruct arm_smmu_device *nvidia_smmu_impl_init (struct arm_smmu_device *smmu);struct arm_smmu_device *qcom_smmu_impl_init (struct arm_smmu_device *smmu); +int __init arm_smmu_impl_module_init (void ); +void __exit arm_smmu_impl_module_exit(void); +int __init qcom_smmu_module_init (void ); +void __exit qcom_smmu_module_exit(void); +void arm_smmu_write_context_bank (struct arm_smmu_device *smmu,int idx);int arm_mmu500_reset (struct arm_smmu_device *smmu);
Greg Kroah-Hartman
maintainerPATCH 40/42 f2fs: fix to avoid UAF in f2fs_write_end_io()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit ce2739e482bce8d2c014d76c4531c877f382aa54 ]
As syzbot reported an use-after-free issue in f2fs_write_end_io().
It is caused by below race condition:
loop device umount
- worker_thread
- loop_process_work
- do_req_filebacked
- lo_rw_aio
- lo_rw_aio_complete
- blk_mq_end_request
- blk_update_request
- f2fs_write_end_io
- dec_page_count
- folio_end_writeback
- kill_f2fs_super
- kill_block_super
- f2fs_put_super
: free(sbi)
: get_pages(, F2FS_WB_CP_DATA)
accessed sbi which is freed
In kill_f2fs_super(), we will drop all page caches of f2fs inodes before call free(sbi), it guarantee that all folios should end its writeback, so it should be safe to access sbi before last folio_end_writeback().
Let's relocate ckpt thread wakeup flow before folio_end_writeback() to resolve this issue.
--- fs/f2fs/data.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/f2fs/data.c +9 -3
@@ -357,14 +357,20 @@ static void f2fs_write_end_io(struct bio page_folio(page)->index != nid_of_node(page));dec_page_count (sbi, type); + +/* +* we should access sbi before end_page_writeback() to +* avoid racing w/ kill_f2fs_super() +*/ +if (type ==F2FS_WB_CP_DATA && !get_pages (sbi, type) && +wq_has_sleeper (&sbi->cp_wait)) +wake_up (&sbi->cp_wait); +if (f2fs_in_warm_node_list (sbi, page))f2fs_del_fsync_node_entry (sbi, page);clear_page_private_gcing (page);end_page_writeback (page); } -if (!get_pages (sbi,F2FS_WB_CP_DATA ) && -wq_has_sleeper (&sbi->cp_wait)) -wake_up (&sbi->cp_wait);bio_put (bio); }
Greg Kroah-Hartman
maintainerPATCH 41/42 f2fs: fix IS_CHECKPOINTED flag inconsistency issue caused by concurrent atomic commit and checkpoint writes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongpeng Yang <[email protected]>
[ Upstream commit 7633a7387eb4d0259d6bea945e1d3469cd135bbc ]
During SPO tests, when mounting F2FS, an -EINVAL error was returned from f2fs_recover_inode_page. The issue occurred under the following scenario
Thread A Thread Bf2fs_ioc_commit_atomic_write
- f2fs_do_sync_file // atomic = true
- f2fs_fsync_node_pages
: last_folio = inode folio
: schedule before folio_lock(last_folio) f2fs_write_checkpoint
- block_operations// writeback last_folio
- schedule before f2fs_flush_nat_entries
: set_fsync_mark(last_folio, 1)
: set_dentry_mark(last_folio, 1)
: folio_mark_dirty(last_folio)
- __write_node_folio(last_folio)
: f2fs_down_read(&sbi->node_write)//block
- f2fs_flush_nat_entries
: {struct nat_entry}->flag |= BIT(IS_CHECKPOINTED)
- unblock_operations
: f2fs_up_write(&sbi->node_write)
f2fs_write_checkpoint//return
: f2fs_do_write_node_page()
f2fs_ioc_commit_atomic_write//return
SPO
Thread A calls f2fs_need_dentry_mark(sbi, ino), and the last_folio has already been written once. However, the {struct nat_entry}->flag did not have the IS_CHECKPOINTED set, causing set_dentry_mark(last_folio, 1) and write last_folio again after Thread B finishes f2fs_write_checkpoint.
After SPO and reboot, it was detected that {struct node_info}->blk_addr was not NULL_ADDR because Thread B successfully write the checkpoint.
This issue only occurs in atomic write scenarios. For regular file fsync operations, the folio must be dirty. If block_operations->f2fs_sync_node_pages successfully submit the folio write, this path will not be executed. Otherwise, the f2fs_write_checkpoint will need to wait for the folio write submission to complete, as sbi->nr_pages[F2FS_DIRTY_NODES] > 0. Therefore, the situation where f2fs_need_dentry_mark checks that the {struct nat_entry}->flag /wo the IS_CHECKPOINTED flag, but the folio write has already been submitted, will not occur.
Therefore, for atomic file fsync, sbi->node_write should be acquired through __write_node_folio to ensure that the IS_CHECKPOINTED flag correctly indicates that the checkpoint write has been completed.
--- fs/f2fs/node.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/f2fs/node.c +10 -4
@@ -1713,8 +1713,13 @@ static int __write_node_page(struct page goto redirty_out; } -if (atomic && !test_opt (sbi,NOBARRIER )) - fio.op_flags |=REQ_PREFLUSH |REQ_FUA ; +if (atomic) { +if (!test_opt (sbi,NOBARRIER )) + fio.op_flags |=REQ_PREFLUSH |REQ_FUA ; +if (IS_INODE (page)) +set_dentry_mark (page, +f2fs_need_dentry_mark (sbi,ino_of_node (page))); + }/* should add to global list before clearing PAGECACHE status */ if (f2fs_in_warm_node_list (sbi, page)) {
@@ -1869,8 +1874,9 @@ continue_unlock:if (is_inode_flag_set (inode,FI_DIRTY_INODE ))f2fs_update_inode (inode, page); -set_dentry_mark (page, -f2fs_need_dentry_mark (sbi, ino)); +if (!atomic) +set_dentry_mark (page, +f2fs_need_dentry_mark (sbi, ino)); }/* may be written by other thread */ if (!PageDirty (page))
Greg Kroah-Hartman
maintainerPATCH 24/42 ASoC: fsl_xcvr: fix missing lock in fsl_xcvr_mode_put()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziyi Guo <[email protected]>
[ Upstream commit f514248727606b9087bc38a284ff686e0093abf1 ]
fsl_xcvr_activate_ctl() has lockdep_assert_held(&card->snd_card->controls_rwsem), but fsl_xcvr_mode_put() calls it without acquiring this lock.
Other callers of fsl_xcvr_activate_ctl() in fsl_xcvr_startup() and fsl_xcvr_shutdown() properly acquire the lock with down_read()/up_read().
Add the missing down_read()/up_read() calls around fsl_xcvr_activate_ctl() in fsl_xcvr_mode_put() to fix the lockdep assertion and prevent potential race conditions when multiple userspace threads access the control.
--- sound/soc/fsl/fsl_xcvr.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/fsl/fsl_xcvr.c +3 -0
@@ -216,10 +216,13 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol *kcontrol, xcvr->mode =snd_soc_enum_item_to_val (e, item[0 ]); +down_read (&card->snd_card->controls_rwsem);fsl_xcvr_activate_ctl (dai, fsl_xcvr_arc_mode_kctl.name, (xcvr->mode ==FSL_XCVR_MODE_ARC ));fsl_xcvr_activate_ctl (dai, fsl_xcvr_earc_capds_kctl.name, (xcvr->mode ==FSL_XCVR_MODE_EARC )); +up_read (&card->snd_card->controls_rwsem); +/* Allow playback for SPDIF only */ rtd =snd_soc_get_pcm_runtime (card, card->dai_link); rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count =
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 42/42 USB: serial: option: add Telit FN920C04 RNDIS compositions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit 509f403f3ccec14188036212118651bf23599396 upstream.
Add the following compositions:
0x10a1: RNDIS + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 9 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a1 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=d128dba9 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10a6: RNDIS + tty (AT/NMEA) + tty (AT) + tty (diag)
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a6 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=d128dba9 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(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=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10ab: RNDIS + tty (AT) + tty (diag) + DPL (Data Packet Logging) + adb
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 11 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10ab Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=d128dba9 C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(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=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -1401,12 +1401,16 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a0, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a1, 0xff), /* Telit FN20C04 (RNDIS) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a2, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a3, 0xff), /* Telit FN920C04 (ECM) */ .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a4, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a6, 0xff), /* Telit FN920C04 (RNDIS) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a7, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a8, 0xff), /* Telit FN920C04 (ECM) */
@@ -1415,6 +1419,8 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10aa, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(3) | RSVD(4) | RSVD(5) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10ab, 0xff), /* Telit FN920C04 (RNDIS) */ + .driver_info = NCTRL(3) | RSVD(4) | RSVD(5) }, { USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x10b0, 0xff, 0xff, 0x30), /* Telit FE990B (rmnet) */ .driver_info = NCTRL(5) }, { USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x10b0, 0xff, 0xff, 0x40) },
Greg Kroah-Hartman
maintainerPATCH 25/42 gpiolib: acpi: Fix gpio count with string references
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alban Bedel <[email protected]>
[ Upstream commit c62e0658d458d8f100445445c3ddb106f3824a45 ]
Since commit 9880702d123f2 ("ACPI: property: Support using strings in reference properties") it is possible to use strings instead of local references. This work fine with single GPIO but not with arrays as acpi_gpio_package_count() didn't handle this case. Update it to handle strings like local references to cover this case as well.
--- drivers/gpio/gpiolib-acpi-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-acpi-core.c +1 -0
@@ -1351,6 +1351,7 @@ static int acpi_gpio_package_count(const union acpi_object *obj)while (element < end) {switch (element->type) {case ACPI_TYPE_LOCAL_REFERENCE : +case ACPI_TYPE_STRING : element +=3 ; fallthrough;case ACPI_TYPE_INTEGER :
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 26/42 mm/hugetlb: fix copy_hugetlb_page_range() to use ->pt_share_count
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jane Chu <[email protected]>
commit 14967a9c7d247841b0312c48dcf8cd29e55a4cc8 upstream.
commit 59d9094df3d79 ("mm: hugetlb: independent PMD page table shared count") introduced ->pt_share_count dedicated to hugetlb PMD share count tracking, but omitted fixing copy_hugetlb_page_range(), leaving the function relying on page_count() for tracking that no longer works.
When lazy page table copy for hugetlb is disabled, that is, revert commit bcd51a3c679d ("hugetlb: lazy page table copies in fork()") fork()'ing with hugetlb PMD sharing quickly lockup -
[ 239.446559] watchdog: BUG: soft lockup - CPU#75 stuck for 27s! [ 239.446611] RIP: 0010:native_queued_spin_lock_slowpath+0x7e/0x2e0 [ 239.446631] Call Trace: [ 239.446633] <TASK> [ 239.446636] _raw_spin_lock+0x3f/0x60 [ 239.446639] copy_hugetlb_page_range+0x258/0xb50 [ 239.446645] copy_page_range+0x22b/0x2c0 [ 239.446651] dup_mmap+0x3e2/0x770 [ 239.446654] dup_mm.constprop.0+0x5e/0x230 [ 239.446657] copy_process+0xd17/0x1760 [ 239.446660] kernel_clone+0xc0/0x3e0 [ 239.446661] __do_sys_clone+0x65/0xa0 [ 239.446664] do_syscall_64+0x82/0x930 [ 239.446668] ? count_memcg_events+0xd2/0x190 [ 239.446671] ? syscall_trace_enter+0x14e/0x1f0 [ 239.446676] ? syscall_exit_work+0x118/0x150 [ 239.446677] ? arch_exit_to_user_mode_prepare.constprop.0+0x9/0xb0 [ 239.446681] ? clear_bhb_loop+0x30/0x80 [ 239.446684] ? clear_bhb_loop+0x30/0x80 [ 239.446686] entry_SYSCALL_64_after_hwframe+0x76/0x7e
There are two options to resolve the potential latent issue:
1. warn against PMD sharing in copy_hugetlb_page_range(),
2. fix it.
This patch opts for the second option.
While at it, simplify the comment, the details are not actually relevant anymore.
--- include/linux/mm_types.h | 5 +++++ mm/hugetlb.c | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-)
include/linux/mm_types.h +5 -0
@@ -540,6 +540,11 @@ static inline int ptdesc_pmd_pts_count(s {return atomic_read (&ptdesc->pt_share_count); } + +static inline bool ptdesc_pmd_is_shared (struct ptdesc *ptdesc) +{ +return !!ptdesc_pmd_pts_count (ptdesc); +}#else static inline void ptdesc_pmd_pts_init (struct ptdesc *ptdesc) {
mm/hugetlb.c +5 -10
@@ -5258,18 +5258,13 @@ int copy_hugetlb_page_range(struct mm_stbreak ; } -/* -* If the pagetables are shared don't copy or take references. -* -* dst_pte == src_pte is the common case of src/dest sharing. -* However, src could have 'unshared' and dst shares with -* another vma. So page_count of ptep page is checked instead -* to reliably determine whether pte is shared. -*/ -if (page_count (virt_to_page (dst_pte)) >1 ) { +#ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING +/* If the pagetables are shared, there is nothing to do */ +if (ptdesc_pmd_is_shared (virt_to_ptdesc (dst_pte))) { addr |= last_addr_mask;continue ; } +#endif dst_ptl =huge_pte_lock (h, dst, dst_pte); src_ptl =huge_pte_lockptr (h, src, src_pte);
@@ -7270,7 +7265,7 @@ int huge_pmd_unshare(struct mm_struct *mhugetlb_vma_assert_locked (vma);if (sz !=PMD_SIZE )return 0 ; -if (!ptdesc_pmd_pts_count (virt_to_ptdesc (ptep))) +if (!ptdesc_pmd_is_shared (virt_to_ptdesc (ptep)))return 0 ;pud_clear (pud);
Greg Kroah-Hartman
maintainerPATCH 27/42 mm/hugetlb: fix hugetlb_pmd_shared()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand (Red Hat) <[email protected]>
commit ca1a47cd3f5f4c46ca188b1c9a27af87d1ab2216 upstream.
Patch series "mm/hugetlb: fixes for PMD table sharing (incl. using mmu_gather)", v3.
One functional fix, one performance regression fix, and two related comment fixes.
I cleaned up my prototype I recently shared [1] for the performance fix, deferring most of the cleanups I had in the prototype to a later point. While doing that I identified the other things.
The goal of this patch set is to be backported to stable trees "fairly" easily. At least patch #1 and #4.
Patch #1 fixes hugetlb_pmd_shared() not detecting any sharing Patch #2 + #3 are simple comment fixes that patch #4 interacts with. Patch #4 is a fix for the reported performance regression due to excessive IPI broadcasts during fork()+exit().
The last patch is all about TLB flushes, IPIs and mmu_gather.
Read: complicated
There are plenty of cleanups in the future to be had + one reasonable optimization on x86. But that's all out of scope for this series.
Runtime tested, with a focus on fixing the performance regression using the original reproducer [2] on x86.
This patch (of 4):
We switched from (wrongly) using the page count to an independent shared count. Now, shared page tables have a refcount of 1 (excluding speculative references) and instead use ptdesc->pt_share_count to identify sharing.
We didn't convert hugetlb_pmd_shared(), so right now, we would never detect a shared PMD table as such, because sharing/unsharing no longer touches the refcount of a PMD table.
Page migration, like mbind() or migrate_pages() would allow for migrating folios mapped into such shared PMD tables, even though the folios are not exclusive. In smaps we would account them as "private" although they are "shared", and we would be wrongly setting the PM_MMAP_EXCLUSIVE in the pagemap interface.
Fix it by properly using ptdesc_pmd_is_shared() in hugetlb_pmd_shared().
--- include/linux/hugetlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/hugetlb.h +1 -1
@@ -1272,7 +1272,7 @@ static inline __init void hugetlb_cma_re#ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING static inline bool hugetlb_pmd_shared (pte_t *pte) { -return page_count (virt_to_page (pte)) >1 ; +return ptdesc_pmd_is_shared (virt_to_ptdesc (pte)); }#else static inline bool hugetlb_pmd_shared (pte_t *pte)
Greg Kroah-Hartman
maintainerPATCH 28/42 mm/hugetlb: fix two comments related to huge_pmd_unshare()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand (Red Hat) <[email protected]>
commit 3937027caecb4f8251e82dd857ba1d749bb5a428 upstream.
Ever since we stopped using the page count to detect shared PMD page tables, these comments are outdated.
The only reason we have to flush the TLB early is because once we drop the i_mmap_rwsem, the previously shared page table could get freed (to then get reallocated and used for other purpose). So we really have to flush the TLB before that could happen.
So let's simplify the comments a bit.
The "If we unshared PMDs, the TLB flush was not recorded in mmu_gather." part introduced as in commit a4a118f2eead ("hugetlbfs: flush TLBs correctly after huge_pmd_unshare") was confusing: sure it is recorded in the mmu_gather, otherwise tlb_flush_mmu_tlbonly() wouldn't do anything. So let's drop that comment while at it as well.
We'll centralize these comments in a single helper as we rework the code next.
--- mm/hugetlb.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
mm/hugetlb.c +8 -16
@@ -5653,17 +5653,10 @@ void __unmap_hugepage_range(struct mmu_gtlb_end_vma (tlb, vma);/* -* If we unshared PMDs, the TLB flush was not recorded in mmu_gather. We -* could defer the flush until now, since by holding i_mmap_rwsem we -* guaranteed that the last refernece would not be dropped. But we must -* do the flushing before we return, as otherwise i_mmap_rwsem will be -* dropped and the last reference to the shared PMDs page might be -* dropped as well. -* -* In theory we could defer the freeing of the PMD pages as well, but -* huge_pmd_unshare() relies on the exact page_count for the PMD page to -* detect sharing, so we cannot defer the release of the page either. -* Instead, do flush now. +* There is nothing protecting a previously-shared page table that we +* unshared through huge_pmd_unshare() from getting freed after we +* release i_mmap_rwsem, so flush the TLB now. If huge_pmd_unshare() +* succeeded, flush the range corresponding to the pud. */ if (force_flush)tlb_flush_mmu_tlbonly (tlb);
@@ -6888,11 +6881,10 @@ long hugetlb_change_protection(struct vmcond_resched (); }/* -* Must flush TLB before releasing i_mmap_rwsem: x86's huge_pmd_unshare -* may have cleared our pud entry and done put_page on the page table: -* once we release i_mmap_rwsem, another task can do the final put_page -* and that page table be reused and filled with junk. If we actually -* did unshare a page of pmds, flush the range corresponding to the pud. +* There is nothing protecting a previously-shared page table that we +* unshared through huge_pmd_unshare() from getting freed after we +* release i_mmap_rwsem, so flush the TLB now. If huge_pmd_unshare() +* succeeded, flush the range corresponding to the pud. */ if (shared_pmd)flush_hugetlb_tlb_range (vma, range.start, range.end);
Greg Kroah-Hartman
maintainerPATCH 29/42 mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand (Red Hat) <[email protected]>
commit 8ce720d5bd91e9dc16db3604aa4b1bf76770a9a1 upstream.
As reported, ever since commit 1013af4f585f ("mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race") we can end up in some situations where we perform so many IPI broadcasts when unsharing hugetlb PMD page tables that it severely regresses some workloads.
In particular, when we fork()+exit(), or when we munmap() a large area backed by many shared PMD tables, we perform one IPI broadcast per unshared PMD table.
There are two optimizations to be had:
(1) When we process (unshare) multiple such PMD tables, such as during exit(), it is sufficient to send a single IPI broadcast (as long as we respect locking rules) instead of one per PMD table.
Locking prevents that any of these PMD tables could get reused before we drop the lock.
(2) When we are not the last sharer (> 2 users including us), there is no need to send the IPI broadcast. The shared PMD tables cannot become exclusive (fully unshared) before an IPI will be broadcasted by the last sharer.
Concurrent GUP-fast could walk into a PMD table just before we unshared it. It could then succeed in grabbing a page from the shared page table even after munmap() etc succeeded (and supressed an IPI). But there is not difference compared to GUP-fast just sleeping for a while after grabbing the page and re-enabling IRQs.
Most importantly, GUP-fast will never walk into page tables that are no-longer shared, because the last sharer will issue an IPI broadcast.
(if ever required, checking whether the PUD changed in GUP-fast
after grabbing the page like we do in the PTE case could handle this)
So let's rework PMD sharing TLB flushing + IPI sync to use the mmu_gather infrastructure so we can implement these optimizations and demystify the code at least a bit. Extend the mmu_gather infrastructure to be able to deal with our special hugetlb PMD table sharing implementation.
To make initialization of the mmu_gather easier when working on a single VMA (in particular, when dealing with hugetlb), provide tlb_gather_mmu_vma().
We'll consolidate the handling for (full) unsharing of PMD tables in tlb_unshare_pmd_ptdesc() and tlb_flush_unshared_tables(), and track in "struct mmu_gather" whether we had (full) unsharing of PMD tables.
Because locking is very special (concurrent unsharing+reuse must be prevented), we disallow deferring flushing to tlb_finish_mmu() and instead require an explicit earlier call to tlb_flush_unshared_tables().
Quoted 1 line
From hugetlb code, we call
huge_pmd_unshare_flush()where we make sure
that the expected lock protecting us from concurrent unsharing+reuse is still held.
Check with a VM_WARN_ON_ONCE() in tlb_finish_mmu() that tlb_flush_unshared_tables() was properly called earlier.
Document it all properly.
Notes about tlb_remove_table_sync_one() interaction with unsharing:
There are two fairly tricky things:
(1) tlb_remove_table_sync_one() is a NOP on architectures without CONFIG_MMU_GATHER_RCU_TABLE_FREE.
Here, the assumption is that the previous TLB flush would send an IPI to all relevant CPUs. Careful: some architectures like x86 only send IPIs to all relevant CPUs when tlb->freed_tables is set.
The relevant architectures should be selecting MMU_GATHER_RCU_TABLE_FREE, but x86 might not do that in stable kernels and it might have been problematic before this patch.
Also, the arch flushing behavior (independent of IPIs) is different when tlb->freed_tables is set. Do we have to enlighten them to also take care of tlb->unshared_tables? So far we didn't care, so hopefully we are fine. Of course, we could be setting tlb->freed_tables as well, but that might then unnecessarily flush too much, because the semantics of tlb->freed_tables are a bit fuzzy.
This patch changes nothing in this regard.
(2) tlb_remove_table_sync_one() is not a NOP on architectures with CONFIG_MMU_GATHER_RCU_TABLE_FREE that actually don't need a sync.
Take x86 as an example: in the common case (!pv, !X86_FEATURE_INVLPGB) we still issue IPIs during TLB flushes and don't actually need the second tlb_remove_table_sync_one().
This optimized can be implemented on top of this, by checking e.g., in tlb_remove_table_sync_one() whether we really need IPIs. But as described in (1), it really must honor tlb->freed_tables then to send IPIs to all relevant CPUs.
Notes on TLB flushing changes:
(1) Flushing for non-shared PMD tables
We're converting from flush_hugetlb_tlb_range() to tlb_remove_huge_tlb_entry(). Given that we properly initialize the MMU gather in tlb_gather_mmu_vma() to be hugetlb aware, similar to __unmap_hugepage_range(), that should be fine.
(2) Flushing for shared PMD tables
We're converting from various things (flush_hugetlb_tlb_range(), tlb_flush_pmd_range(), flush_tlb_range()) to tlb_flush_pmd_range().
tlb_flush_pmd_range() achieves the same that tlb_remove_huge_tlb_entry() would achieve in these scenarios. Note that tlb_remove_huge_tlb_entry() also calls __tlb_remove_tlb_entry(), however that is only implemented on powerpc, which does not support PMD table sharing.
Similar to (1), tlb_gather_mmu_vma() should make sure that TLB flushing keeps on working as expected.
Further, note that the ptdesc_pmd_pts_dec() in huge_pmd_share() is not a concern, as we are holding the i_mmap_lock the whole time, preventing concurrent unsharing. That ptdesc_pmd_pts_dec() usage will be removed separately as a cleanup later.
There are plenty more cleanups to be had, but they have to wait until this is fixed.
--- include/asm-generic/tlb.h | 77 ++++++++++++++++++++++++++++ include/linux/hugetlb.h | 15 +++-- include/linux/mm_types.h | 1 mm/hugetlb.c | 123 ++++++++++++++++++++++++++-------------------- mm/mmu_gather.c | 33 ++++++++++++ mm/rmap.c | 25 ++++++--- 6 files changed, 208 insertions(+), 66 deletions(-)
include/asm-generic/tlb.h +75 -2
@@ -46,7 +46,8 @@* * The mmu_gather API consists of: * -* - tlb_gather_mmu() / tlb_gather_mmu_fullmm() / tlb_finish_mmu() +* - tlb_gather_mmu() / tlb_gather_mmu_fullmm() / tlb_gather_mmu_vma() / +* tlb_finish_mmu() * * start and finish a mmu_gather *
@@ -344,6 +345,20 @@ struct mmu_gather { unsigned int vma_huge : 1; unsigned int vma_pfn : 1; +/* +* Did we unshare (unmap) any shared page tables? For now only +* used for hugetlb PMD table sharing. +*/ + unsigned int unshared_tables : 1; + +/* +* Did we unshare any page tables such that they are now exclusive +* and could get reused+modified by the new owner? When setting this +* flag, "unshared_tables" will be set as well. For now only used +* for hugetlb PMD table sharing. +*/ + unsigned int fully_unshared_tables : 1; +unsigned int batch_count;#ifndef CONFIG_MMU_GATHER_NO_GATHER
@@ -380,6 +395,7 @@ static inline void __tlb_reset_range(str tlb->cleared_pmds =0 ; tlb->cleared_puds =0 ; tlb->cleared_p4ds =0 ; + tlb->unshared_tables =0 ;/* * Do not reset mmu_gather::vma_* fields here, we do not * call into tlb_start_vma() again to set them if there is an
@@ -459,7 +475,7 @@ static inline void tlb_flush_mmu_tlbonly* these bits. */ if (!(tlb->freed_tables || tlb->cleared_ptes || tlb->cleared_pmds || - tlb->cleared_puds || tlb->cleared_p4ds)) + tlb->cleared_puds || tlb->cleared_p4ds || tlb->unshared_tables))return ;tlb_flush (tlb);
@@ -748,6 +764,63 @@ static inline bool huge_pmd_needs_flush( }#endif +#ifdef CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING +static inline void tlb_unshare_pmd_ptdesc (struct mmu_gather *tlb,struct ptdesc *pt, +unsigned long addr) +{ +/* +* The caller must make sure that concurrent unsharing + exclusive +* reuse is impossible until tlb_flush_unshared_tables() was called. +*/ +VM_WARN_ON_ONCE (!ptdesc_pmd_is_shared (pt)); +ptdesc_pmd_pts_dec (pt); + +/* Clearing a PUD pointing at a PMD table with PMD leaves. */ +tlb_flush_pmd_range (tlb, addr &PUD_MASK ,PUD_SIZE ); + +/* +* If the page table is now exclusively owned, we fully unshared +* a page table. +*/ +if (!ptdesc_pmd_is_shared (pt)) + tlb->fully_unshared_tables = true; + tlb->unshared_tables = true; +} + +static inline void tlb_flush_unshared_tables (struct mmu_gather *tlb) +{ +/* +* As soon as the caller drops locks to allow for reuse of +* previously-shared tables, these tables could get modified and +* even reused outside of hugetlb context, so we have to make sure that +* any page table walkers (incl. TLB, GUP-fast) are aware of that +* change. +* +* Even if we are not fully unsharing a PMD table, we must +* flush the TLB for the unsharer now. +*/ +if (tlb->unshared_tables) +tlb_flush_mmu_tlbonly (tlb); + +/* +* Similarly, we must make sure that concurrent GUP-fast will not +* walk previously-shared page tables that are getting modified+reused +* elsewhere. So broadcast an IPI to wait for any concurrent GUP-fast. +* +* We only perform this when we are the last sharer of a page table, +* as the IPI will reach all CPUs: any GUP-fast. +* +* Note that on configs where tlb_remove_table_sync_one() is a NOP, +* the expectation is that the tlb_flush_mmu_tlbonly() would have issued +* required IPIs already for us. +*/ +if (tlb->fully_unshared_tables) { +tlb_remove_table_sync_one (); + tlb->fully_unshared_tables = false; + } +} +#endif /* CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING */ +#endif /* CONFIG_MMU */ #endif /* _ASM_GENERIC__TLB_H */
include/linux/hugetlb.h +10 -5
@@ -235,8 +235,9 @@ pte_t *huge_pte_alloc(struct mm_struct *pte_t *huge_pte_offset (struct mm_struct *mm,unsigned long addr,unsigned long sz);unsigned long hugetlb_mask_last_page (struct hstate *h); -int huge_pmd_unshare (struct mm_struct *mm,struct vm_area_struct *vma, -unsigned long addr,pte_t *ptep); +int huge_pmd_unshare (struct mmu_gather *tlb,struct vm_area_struct *vma, +unsigned long addr,pte_t *ptep); +void huge_pmd_unshare_flush (struct mmu_gather *tlb,struct vm_area_struct *vma);void adjust_range_if_pmd_sharing_possible (struct vm_area_struct *vma,unsigned long *start,unsigned long *end);
@@ -295,13 +296,17 @@ static inline struct address_space *hugereturn NULL ; } -static inline int huge_pmd_unshare (struct mm_struct *mm, -struct vm_area_struct *vma, -unsigned long addr,pte_t *ptep) +static inline int huge_pmd_unshare (struct mmu_gather *tlb, +struct vm_area_struct *vma,unsigned long addr,pte_t *ptep) {return 0 ; } +static inline void huge_pmd_unshare_flush (struct mmu_gather *tlb, +struct vm_area_struct *vma) +{ +} +static inline void adjust_range_if_pmd_sharing_possible (struct vm_area_struct *vma,unsigned long *start,unsigned long *end)
include/linux/mm_types.h +1 -0
@@ -1262,6 +1262,7 @@ static inline unsigned int mm_cid_size(vstruct mmu_gather ;extern void tlb_gather_mmu (struct mmu_gather *tlb,struct mm_struct *mm);extern void tlb_gather_mmu_fullmm (struct mmu_gather *tlb,struct mm_struct *mm); +void tlb_gather_mmu_vma (struct mmu_gather *tlb,struct vm_area_struct *vma);extern void tlb_finish_mmu (struct mmu_gather *tlb);struct vm_fault ;
mm/hugetlb.c +72 -51
274 lines not on this page · raw message
mm/mmu_gather.c +33 -0
@@ -9,6 +9,7 @@#include <linux/smp.h> #include <linux/swap.h> #include <linux/rmap.h> +#include <linux/hugetlb.h> #include <asm/pgalloc.h> #include <asm/tlb.h>
@@ -394,6 +395,7 @@ static void __tlb_gather_mmu(struct mmu_ tlb->page_size =0 ;#endif + tlb->fully_unshared_tables =0 ;__tlb_reset_range (tlb);inc_tlb_flush_pending (tlb->mm); }
@@ -428,6 +430,31 @@ void tlb_gather_mmu_fullmm(struct mmu_ga }/** +* tlb_gather_mmu_vma - initialize an mmu_gather structure for operating on a +* single VMA +* @tlb: the mmu_gather structure to initialize +* @vma: the vm_area_struct +* +* Called to initialize an (on-stack) mmu_gather structure for operating on +* a single VMA. In contrast to tlb_gather_mmu(), calling this function will +* not require another call to tlb_start_vma(). In contrast to tlb_start_vma(), +* this function will *not* call flush_cache_range(). +* +* For hugetlb VMAs, this function will also initialize the mmu_gather +* page_size accordingly, not requiring a separate call to +* tlb_change_page_size(). +* +*/ +void tlb_gather_mmu_vma (struct mmu_gather *tlb,struct vm_area_struct *vma) +{ +tlb_gather_mmu (tlb, vma->vm_mm); +tlb_update_vma_flags (tlb, vma); +if (is_vm_hugetlb_page (vma)) +/* All entries have the same size. */ +tlb_change_page_size (tlb,huge_page_size (hstate_vma (vma))); +} + +/** * tlb_finish_mmu - finish an mmu_gather structure * @tlb: the mmu_gather structure to finish *
@@ -437,6 +464,12 @@ void tlb_gather_mmu_fullmm(struct mmu_gavoid tlb_finish_mmu (struct mmu_gather *tlb) {/* +* We expect an earlier huge_pmd_unshare_flush() call to sort this out, +* due to complicated locking requirements with page table unsharing. +*/ +VM_WARN_ON_ONCE (tlb->fully_unshared_tables); + +/* * If there are parallel threads are doing PTE changes on same range * under non-exclusive lock (e.g., mmap_lock read-side) but defer TLB * flush by batching, one thread may end up seeing inconsistent PTEs
mm/rmap.c +17 -8
@@ -77,7 +77,7 @@#include <linux/mm_inline.h> #include <linux/oom.h> -#include <asm/tlbflush.h> +#include <asm/tlb.h> #define CREATE_TRACE_POINTS #include <trace/events/tlb.h>
@@ -1745,13 +1745,17 @@ static bool try_to_unmap_one(struct foli* if unsuccessful. */ if (!anon) { +struct mmu_gather tlb; +VM_BUG_ON (!(flags &TTU_RMAP_LOCKED ));if (!hugetlb_vma_trylock_write (vma)) goto walk_abort; -if (huge_pmd_unshare (mm, vma, address, pvmw.pte)) { + +tlb_gather_mmu_vma (&tlb, vma); +if (huge_pmd_unshare (&tlb, vma, address, pvmw.pte)) {hugetlb_vma_unlock_write (vma); -flush_tlb_range (vma, - range.start, range.end); +huge_pmd_unshare_flush (&tlb, vma); +tlb_finish_mmu (&tlb);/* * The PMD table was unmapped, * consequently unmapping the folio.
@@ -1759,6 +1763,7 @@ static bool try_to_unmap_one(struct foli goto walk_done; }hugetlb_vma_unlock_write (vma); +tlb_finish_mmu (&tlb); } pteval =huge_ptep_clear_flush (vma, address, pvmw.pte); }else {
@@ -2110,17 +2115,20 @@ static bool try_to_migrate_one(struct fo* fail if unsuccessful. */ if (!anon) { +struct mmu_gather tlb; +VM_BUG_ON (!(flags &TTU_RMAP_LOCKED ));if (!hugetlb_vma_trylock_write (vma)) {page_vma_mapped_walk_done (&pvmw); ret = false;break ; } -if (huge_pmd_unshare (mm, vma, address, pvmw.pte)) { -hugetlb_vma_unlock_write (vma); -flush_tlb_range (vma, - range.start, range.end); +tlb_gather_mmu_vma (&tlb, vma); +if (huge_pmd_unshare (&tlb, vma, address, pvmw.pte)) { +hugetlb_vma_unlock_write (vma); +huge_pmd_unshare_flush (&tlb, vma); +tlb_finish_mmu (&tlb);/* * The PMD table was unmapped, * consequently unmapping the folio.
@@ -2129,6 +2137,7 @@ static bool try_to_migrate_one(struct fobreak ; }hugetlb_vma_unlock_write (vma); +tlb_finish_mmu (&tlb); }/* Nuke the hugetlb page table entry */ pteval =huge_ptep_clear_flush (vma, address, pvmw.pte);
Greg Kroah-Hartman
maintainerPATCH 30/42 LoongArch: Rework KASAN initialization for PTW-enabled systems
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
commit 5ec5ac4ca27e4daa234540ac32f9fc5219377d53 upstream.
kasan_init_generic() indicates that kasan is fully initialized, so it should be put at end of kasan_init().
Otherwise bringing up the primary CPU failed when CONFIG_KASAN is set on PTW-enabled systems, here are the call chains:
kernel_entry()
start_kernel()
setup_arch()
kasan_init()
kasan_init_generic()
The reason is PTW-enabled systems have speculative accesses which means memory accesses to the shadow memory after kasan_init() may be executed by hardware before. However, accessing shadow memory is safe only after kasan fully initialized because kasan_init() uses a temporary PGD table until we have populated all levels of shadow page tables and writen the PGD register. Moving kasan_init_generic() later can defer the occasion of kasan_enabled(), so as to avoid speculative accesses on shadow pages.
After moving kasan_init_generic() to the end, kasan_init() can no longer call kasan_mem_to_shadow() for shadow address conversion because it will always return kasan_early_shadow_page. On the other hand, we should keep the current logic of kasan_mem_to_shadow() for both the early and final stage because there may be instrumentation before kasan_init().
To solve this, we factor out a new mem_to_shadow() function from current kasan_mem_to_shadow() for the shadow address conversion in kasan_init().
[ Huacai: To backport from upstream to 6.6 & 6.12, kasan_enabled() is
replaced with kasan_arch_is_ready() and kasan_init_generic() is replaced with "kasan_early_stage = false". ]
--- arch/loongarch/mm/kasan_init.c | 77 +++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 37 deletions(-)
arch/loongarch/mm/kasan_init.c +40 -37
@@ -42,39 +42,43 @@ static pgd_t kasan_pg_dir[PTRS_PER_PGD]bool kasan_early_stage = true; -void *kasan_mem_to_shadow (const void *addr) +static void *mem_to_shadow (const void *addr) { -if (!kasan_arch_is_ready ()) { +unsigned long offset =0 ; +unsigned long maddr = (unsigned long )addr; +unsigned long xrange = (maddr >>XRANGE_SHIFT ) &0xffff ; + +if (maddr >=FIXADDR_START )return (void *)(kasan_early_shadow_page); - }else { -unsigned long maddr = (unsigned long )addr; -unsigned long xrange = (maddr >>XRANGE_SHIFT ) &0xffff ; -unsigned long offset =0 ; - -if (maddr >=FIXADDR_START ) -return (void *)(kasan_early_shadow_page); - - maddr &=XRANGE_SHADOW_MASK ; -switch (xrange) { -case XKPRANGE_CC_SEG : - offset =XKPRANGE_CC_SHADOW_OFFSET ; -break ; -case XKPRANGE_UC_SEG : - offset =XKPRANGE_UC_SHADOW_OFFSET ; -break ; -case XKPRANGE_WC_SEG : - offset =XKPRANGE_WC_SHADOW_OFFSET ; -break ; -case XKVRANGE_VC_SEG : - offset =XKVRANGE_VC_SHADOW_OFFSET ; -break ; -default : -WARN_ON (1 ); -return NULL ; - } -return (void *)((maddr >>KASAN_SHADOW_SCALE_SHIFT ) + offset); + maddr &=XRANGE_SHADOW_MASK ; +switch (xrange) { +case XKPRANGE_CC_SEG : + offset =XKPRANGE_CC_SHADOW_OFFSET ; +break ; +case XKPRANGE_UC_SEG : + offset =XKPRANGE_UC_SHADOW_OFFSET ; +break ; +case XKPRANGE_WC_SEG : + offset =XKPRANGE_WC_SHADOW_OFFSET ; +break ; +case XKVRANGE_VC_SEG : + offset =XKVRANGE_VC_SHADOW_OFFSET ; +break ; +default : +WARN_ON (1 ); +return NULL ; } + +return (void *)((maddr >>KASAN_SHADOW_SCALE_SHIFT ) + offset); +} + +void *kasan_mem_to_shadow (const void *addr) +{ +if (kasan_arch_is_ready ()) +return mem_to_shadow (addr); +else +return (void *)(kasan_early_shadow_page); }const void *kasan_shadow_to_mem (const void *shadow_addr)
@@ -295,10 +299,8 @@ void __init kasan_init(void)/* Maps everything to a single page of zeroes */ kasan_pgd_populate (KASAN_SHADOW_START ,KASAN_SHADOW_END ,NUMA_NO_NODE , true); -kasan_populate_early_shadow (kasan_mem_to_shadow ((void *)VMALLOC_START ), -kasan_mem_to_shadow ((void *)KFENCE_AREA_END )); - - kasan_early_stage = false; +kasan_populate_early_shadow (mem_to_shadow ((void *)VMALLOC_START ), +mem_to_shadow ((void *)KFENCE_AREA_END ));/* Populate the linear mapping */ for_each_mem_range (i, &pa_start, &pa_end) {
@@ -308,13 +310,13 @@ void __init kasan_init(void)if (start >= end)break ; -kasan_map_populate ((unsigned long )kasan_mem_to_shadow (start), - (unsigned long )kasan_mem_to_shadow (end),NUMA_NO_NODE ); +kasan_map_populate ((unsigned long )mem_to_shadow (start), + (unsigned long )mem_to_shadow (end),NUMA_NO_NODE ); }/* Populate modules mapping */ -kasan_map_populate ((unsigned long )kasan_mem_to_shadow ((void *)MODULES_VADDR ), - (unsigned long )kasan_mem_to_shadow ((void *)MODULES_END ),NUMA_NO_NODE ); +kasan_map_populate ((unsigned long )mem_to_shadow ((void *)MODULES_VADDR ), + (unsigned long )mem_to_shadow ((void *)MODULES_END ),NUMA_NO_NODE );/* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so we * should make sure that it maps the zero page read-only.
@@ -329,5 +331,6 @@ void __init kasan_init(void)/* At this point kasan is fully initialized. Enable error messages */ init_task.kasan_depth =0 ; + kasan_early_stage = false;pr_info ("KernelAddressSanitizer initialized.\n" ); }
Greg Kroah-Hartman
maintainerPATCH 31/42 Revert "wireguard: device: enable threaded NAPI"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
This reverts commit 933466fc50a8e4eb167acbd0d8ec96a078462e9c which is commit db9ae3b6b43c79b1ba87eea849fd65efa05b4b2e upstream.
We have had three independent production user reports in combination with Cilium utilizing WireGuard as encryption underneath that k8s Pod E/W traffic to certain peer nodes fully stalled. The situation appears as follows:
- Occurs very rarely but at random times under heavy networking load.
- Once the issue triggers the decryption side stops working completely for that WireGuard peer, other peers keep working fine. The stall happens also for newly initiated connections towards that particular WireGuard peer.
- Only the decryption side is affected, never the encryption side.
- Once it triggers, it never recovers and remains in this state, the CPU/mem on that node looks normal, no leak, busy loop or crash.
- bpftrace on the affected system shows that wg_prev_queue_enqueue fails, thus the MAX_QUEUED_PACKETS (1024 skbs!) for the peer's rx_queue is reached.
- Also, bpftrace shows that wg_packet_rx_poll for that peer is never called again after reaching this state for that peer. For other peers wg_packet_rx_poll does get called normally.
- Commit db9ae3b ("wireguard: device: enable threaded NAPI") switched WireGuard to threaded NAPI by default. The default has not been changed for triggering the issue, neither did CPU hotplugging occur (i.e. 5bd8de2 ("wireguard: queueing: always return valid online CPU in wg_cpumask_choose_online()")).
- The issue has been observed with stable kernels of v5.15 as well as v6.1. It was reported to us that v5.10 stable is working fine, and no report on v6.6 stable either (somewhat related discussion in [0] though).
- In the WireGuard driver the only material difference between v5.10 stable and v5.15 stable is the switch to threaded NAPI by default.
[0] https://lore.kernel.org/netdev/CA+wXwBTT74RErDGAnj98PqS=wvdh8eM1pi4q6tTdExtjnokKqA@mail.gmail.com/
Breakdown of the problem:
1) skbs arriving for decryption are enqueued to the peer->rx_queue in wg_packet_consume_data via wg_queue_enqueue_per_device_and_peer.
2) The latter only moves the skb into the MPSC peer queue if it does not surpass MAX_QUEUED_PACKETS (1024) which is kept track in an atomic counter via wg_prev_queue_enqueue.
3) In case enqueueing was successful, the skb is also queued up in the device queue, round-robin picks a next online CPU, and schedules the decryption worker.
4) The wg_packet_decrypt_worker, once scheduled, picks these up from the queue, decrypts the packets and once done calls into wg_queue_enqueue_per_peer_rx.
5) The latter updates the state to PACKET_STATE_CRYPTED on success
and calls napi_schedule on the per peer->napi instance.
6) NAPI then polls via wg_packet_rx_poll. wg_prev_queue_peek checks
on the peer->rx_queue. It will wg_prev_queue_dequeue if the
queue->peeked skb was not cached yet, or just return the latter
otherwise. (wg_prev_queue_drop_peeked later clears the cache.) 7) From an ordering perspective, the peer->rx_queue has skbs in order while the device queue with the per-CPU worker threads from a global ordering PoV can finish the decryption and signal the skb PACKET_STATE_CRYPTED out of order.
8) A situation can be observed that the first packet coming in will be stuck waiting for the decryption worker to be scheduled for a longer time when the system is under pressure.
9) While this is the case, the other CPUs in the meantime finish decryption and call into napi_schedule.
10) Now in wg_packet_rx_poll it picks up the first in-order skb from the peer->rx_queue and sees that its state is still PACKET_STATE_UNCRYPTED. The NAPI poll routine then exits early with work_done = 0 and calls napi_complete_done, signalling it "finished" processing.
11) The assumption in wg_packet_decrypt_worker is that when the decryption finished the subsequent napi_schedule will always lead to a later invocation of wg_packet_rx_poll to pick up the finished packet.
12) However, it appears that a later napi_schedule does /not/ schedule a later poll and thus no wg_packet_rx_poll.
13) If this situation happens exactly for the corner case where the decryption worker of the first packet is stuck and waiting to be scheduled, and the network load for WireGuard is very high then the queue can build up to MAX_QUEUED_PACKETS.
14) If this situation occurs, then no new decryption worker will be scheduled and also no new napi_schedule to make forward progress.
15) This means the peer->rx_queue stops processing packets completely and they are indefinitely stuck waiting for a new NAPI poll on that peer which never happens. New packets for that peer are then dropped due to full queue, as it has been observed on the production machines.
Technically, the backport of commit db9ae3b6b43c ("wireguard: device:
enable threaded NAPI") to stable should not have happened since it is more of an optimization rather than a pure fix and addresses a NAPI situation with utilizing many WireGuard tunnel devices in parallel. Revert it from stable given the backport triggers a regression for mentioned kernels.
--- drivers/net/wireguard/device.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireguard/device.c +0 -1
@@ -364,7 +364,6 @@ static int wg_newlink(struct net *src_neif (ret <0 ) goto err_free_handshake_queue; -dev_set_threaded (dev, true); ret =register_netdevice (dev);if (ret <0 ) goto err_uninit_ratelimiter;
Greg Kroah-Hartman
maintainerPATCH 22/42 drm/amd/display: extend delta clamping logic to CM3 LUT helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <[email protected]>
[ Upstream commit d25b32aa829a3ed5570138e541a71fb7805faec3 ]
Commit 27fc10d1095f ("drm/amd/display: Fix the delta clamping for shaper LUT") fixed banding when using plane shaper LUT in DCN10 CM helper. The problem is also present in DCN30 CM helper, fix banding by extending the same bug delta clamping fix to CM3.
--- .../amd/display/dc/dcn30/dcn30_cm_common.c | 30 +++++++++++++++---- .../display/dc/dwb/dcn30/dcn30_cm_common.h | 2 +- .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 9 +++--- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 17 ++++++----- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 16 +++++----- 5 files changed, 49 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c +24 -6
@@ -105,9 +105,12 @@ void cm_helper_program_gamcor_xfer_func(#define NUMBER_REGIONS 32#define NUMBER_SW_SEGMENTS 16 -bool cm3_helper_translate_curve_to_hw_format ( -const struct dc_transfer_func *output_tf, -struct pwl_params *lut_params,bool fixpoint) +#define DC_LOGGER \ + ctx->logger + +bool cm3_helper_translate_curve_to_hw_format (struct dc_context *ctx, +const struct dc_transfer_func *output_tf, +struct pwl_params *lut_params,bool fixpoint) {struct curve_points3 *corner_points;struct pwl_result_data *rgb_resulted;
@@ -256,6 +259,10 @@ bool cm3_helper_translate_curve_to_hw_format(if (fixpoint == true) { i =1 ;while (i != hw_points +2 ) { +uint32_t red_clamp; +uint32_t green_clamp; +uint32_t blue_clamp; +if (i >= hw_points) {if (dc_fixpt_lt (rgb_plus_1->red, rgb->red)) rgb_plus_1->red = dc_fixpt_add(rgb->red,
@@ -268,9 +275,20 @@ bool cm3_helper_translate_curve_to_hw_format( rgb_minus_1->delta_blue); } - rgb->delta_red_reg =dc_fixpt_clamp_u0d10 (rgb->delta_red); - rgb->delta_green_reg =dc_fixpt_clamp_u0d10 (rgb->delta_green); - rgb->delta_blue_reg =dc_fixpt_clamp_u0d10 (rgb->delta_blue); + rgb->delta_red =dc_fixpt_sub (rgb_plus_1->red, rgb->red); + rgb->delta_green =dc_fixpt_sub (rgb_plus_1->green, rgb->green); + rgb->delta_blue =dc_fixpt_sub (rgb_plus_1->blue, rgb->blue); + + red_clamp =dc_fixpt_clamp_u0d14 (rgb->delta_red); + green_clamp =dc_fixpt_clamp_u0d14 (rgb->delta_green); + blue_clamp =dc_fixpt_clamp_u0d14 (rgb->delta_blue); + +if (red_clamp >>10 || green_clamp >>10 || blue_clamp >>10 ) +DC_LOG_ERROR ("Losing delta precision while programming shaper LUT." ); + + rgb->delta_red_reg = red_clamp &0x3ff ; + rgb->delta_green_reg = green_clamp &0x3ff ; + rgb->delta_blue_reg = blue_clamp &0x3ff ; rgb->red_reg =dc_fixpt_clamp_u0d14 (rgb->red); rgb->green_reg =dc_fixpt_clamp_u0d14 (rgb->green); rgb->blue_reg =dc_fixpt_clamp_u0d14 (rgb->blue);
drivers/gpu/drm/amd/display/dc/dwb/dcn30/dcn30_cm_common.h +1 -1
@@ -59,7 +59,7 @@ void cm_helper_program_gamcor_xfer_func(const struct pwl_params *params, const struct dcn3_xfer_func_reg *reg); -bool cm3_helper_translate_curve_to_hw_format ( +bool cm3_helper_translate_curve_to_hw_format (struct dc_context *ctx,const struct dc_transfer_func *output_tf,struct pwl_params *lut_params,bool fixpoint);
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +5 -4
@@ -228,7 +228,7 @@ bool dcn30_set_blend_lut(if (plane_state->blend_tf.type ==TF_TYPE_HWPWL ) blend_lut = &plane_state->blend_tf.pwl;else if (plane_state->blend_tf.type ==TF_TYPE_DISTRIBUTED_POINTS ) { - result =cm3_helper_translate_curve_to_hw_format ( + result =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, &plane_state->blend_tf, &dpp_base->regamma_params, false);if (!result)return result;
@@ -316,8 +316,9 @@ bool dcn30_set_input_transfer_func(struct dc *dc,if (plane_state->in_transfer_func.type ==TF_TYPE_HWPWL ) params = &plane_state->in_transfer_func.pwl;else if (plane_state->in_transfer_func.type ==TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format (&plane_state->in_transfer_func, - &dpp_base->degamma_params, false)) +cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->in_transfer_func, + &dpp_base->degamma_params, false)) params = &dpp_base->degamma_params; result = dpp_base->funcs->dpp_program_gamcor_lut (dpp_base, params);
@@ -388,7 +389,7 @@ bool dcn30_set_output_transfer_func(struct dc *dc, params = &stream->out_transfer_func.pwl; else if (pipe_ctx->stream->out_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format ( + cm3_helper_translate_curve_to_hw_format(stream->ctx, &stream->out_transfer_func, &mpc->blender_params, false)) params = &mpc->blender_params;
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +10 -7
@@ -483,8 +483,9 @@ bool dcn32_set_mcm_luts(if (plane_state->blend_tf.type ==TF_TYPE_HWPWL ) lut_params = &plane_state->blend_tf.pwl;else if (plane_state->blend_tf.type ==TF_TYPE_DISTRIBUTED_POINTS ) { - result =cm3_helper_translate_curve_to_hw_format (&plane_state->blend_tf, - &dpp_base->regamma_params, false); + result =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->blend_tf, + &dpp_base->regamma_params, false);if (!result)return result;
@@ -499,8 +500,9 @@ bool dcn32_set_mcm_luts(else if (plane_state->in_shaper_func.type ==TF_TYPE_DISTRIBUTED_POINTS ) {// TODO: dpp_base replace ASSERT (false); -cm3_helper_translate_curve_to_hw_format (&plane_state->in_shaper_func, - &dpp_base->shaper_params, true); +cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->in_shaper_func, + &dpp_base->shaper_params, true); lut_params = &dpp_base->shaper_params; }
@@ -540,8 +542,9 @@ bool dcn32_set_input_transfer_func(struct dc *dc,if (plane_state->in_transfer_func.type ==TF_TYPE_HWPWL ) params = &plane_state->in_transfer_func.pwl;else if (plane_state->in_transfer_func.type ==TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format (&plane_state->in_transfer_func, - &dpp_base->degamma_params, false)) +cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->in_transfer_func, + &dpp_base->degamma_params, false)) params = &dpp_base->degamma_params; dpp_base->funcs->dpp_program_gamcor_lut (dpp_base, params);
@@ -572,7 +575,7 @@ bool dcn32_set_output_transfer_func(struct dc *dc, params = &stream->out_transfer_func.pwl; else if (pipe_ctx->stream->out_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format ( + cm3_helper_translate_curve_to_hw_format(stream->ctx, &stream->out_transfer_func, &mpc->blender_params, false)) params = &mpc->blender_params;
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +9 -7
@@ -514,7 +514,7 @@ void dcn401_populate_mcm_luts(struct dc *dc,if (mcm_luts.lut1d_func->type ==TF_TYPE_HWPWL ) m_lut_params.pwl = &mcm_luts.lut1d_func->pwl;else if (mcm_luts.lut1d_func->type ==TF_TYPE_DISTRIBUTED_POINTS ) { - rval =cm3_helper_translate_curve_to_hw_format ( + rval =cm3_helper_translate_curve_to_hw_format (mpc->ctx, mcm_luts.lut1d_func, &dpp_base->regamma_params, false); m_lut_params.pwl = rval ? &dpp_base->regamma_params :NULL ;
@@ -534,7 +534,7 @@ void dcn401_populate_mcm_luts(struct dc *dc, m_lut_params.pwl = &mcm_luts.shaper->pwl; else if (mcm_luts.shaper->type == TF_TYPE_DISTRIBUTED_POINTS) {ASSERT (false); - rval =cm3_helper_translate_curve_to_hw_format ( + rval =cm3_helper_translate_curve_to_hw_format (mpc->ctx, mcm_luts.shaper, &dpp_base->regamma_params, true); m_lut_params.pwl = rval ? &dpp_base->regamma_params :NULL ;
@@ -683,8 +683,9 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx,if (plane_state->blend_tf.type ==TF_TYPE_HWPWL ) lut_params = &plane_state->blend_tf.pwl;else if (plane_state->blend_tf.type ==TF_TYPE_DISTRIBUTED_POINTS ) { - rval =cm3_helper_translate_curve_to_hw_format (&plane_state->blend_tf, - &dpp_base->regamma_params, false); + rval =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->blend_tf, + &dpp_base->regamma_params, false); lut_params = rval ? &dpp_base->regamma_params :NULL ; } result = mpc->funcs->program_1dlut (mpc, lut_params, mpcc_id);
@@ -695,8 +696,9 @@ bool dcn401_set_mcm_luts(struct pipe_ctx *pipe_ctx, lut_params = &plane_state->in_shaper_func.pwl; else if (plane_state->in_shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {// TODO: dpp_base replace - rval =cm3_helper_translate_curve_to_hw_format (&plane_state->in_shaper_func, - &dpp_base->shaper_params, true); + rval =cm3_helper_translate_curve_to_hw_format (plane_state->ctx, + &plane_state->in_shaper_func, + &dpp_base->shaper_params, true); lut_params = rval ? &dpp_base->shaper_params :NULL ; } result &= mpc->funcs->program_shaper (mpc, lut_params, mpcc_id);
@@ -730,7 +732,7 @@ bool dcn401_set_output_transfer_func(struct dc *dc, params = &stream->out_transfer_func.pwl; else if (pipe_ctx->stream->out_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS && -cm3_helper_translate_curve_to_hw_format ( + cm3_helper_translate_curve_to_hw_format(stream->ctx, &stream->out_transfer_func, &mpc->blender_params, false)) params = &mpc->blender_params;
Signature · 1 line
2.51.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.74-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Am 17.02.2026 um 21:31 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.74-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
133 tests: 133 pass, 0 failLinux version: 6.12.74-rc1-g5d01fe87b74b
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.12.74-rc1-g5d01fe87b74b #1 SMP PREEMPT_DYNAMIC Wed Feb 18 08:27:14 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.12.y
Best regards,
Pavel
Signature · 1 line
In cooperation with Nabla.
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Compiled and tested on
- Verdin AM62
- Verdin iMX8MP
- Toradex SMARC iMX8MP
(For the records, unfortunately I had some test failure on Verdin AM62,
but I am 99% confident that it has nothing to do with this kernel, more likely something around my test infrastructure)
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.74-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 8 lines · On Tue, 17 Feb 2026 21:31:51 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.12.74 release. There are 42 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 19 Feb 2026 19:59:50 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
Thanks!
Cheers,
Miguel