6.12.118-rc1 review
Greg Kroah-Hartman
maintainerPATCH 573/670 scsi: ufs: core: Add a helper for clearing hba->outstanding_reqs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Jhu <[email protected]>
[ Upstream commit 22d14117ec1845a81acb3a5c4be325f7e8332f70 ]
ufshcd_poll() and ufshcd_abort() each have their own copy of the code that clears bits in hba->outstanding_reqs under hba->outstanding_lock.
Move that code into ufshcd_clear_outstanding_reqs() and its locked variant __ufshcd_clear_outstanding_reqs(), and use them in both functions. No functional change.
--- drivers/ufs/core/ufshcd.c | 48 +++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/ufs/core/ufshcd.c +36 -12
@@ -5653,6 +5653,37 @@ static void ufshcd_clear_polled(struct ufs_hba *hba, } } +/* +* Return a bitmask of the transfer requests cleared from +* @hba->outstanding_reqs. +*/ +static unsigned long __ufshcd_clear_outstanding_reqs (struct ufs_hba *hba, +unsigned long mask, +bool from_irq) + __must_hold(&hba->outstanding_lock) +{ +unsigned long completed_reqs = mask & hba->outstanding_reqs; + +if (from_irq) { +/* Do not complete polled requests from interrupt context. */ +ufshcd_clear_polled (hba, &completed_reqs); + } + hba->outstanding_reqs &= ~completed_reqs; + +return completed_reqs; +} + +/* +* Return a bitmask of the transfer requests cleared from +* @hba->outstanding_reqs. +*/ +static unsigned long ufshcd_clear_outstanding_reqs (struct ufs_hba *hba, +unsigned long mask) +{ +guard (spinlock_irqsave)(&hba->outstanding_lock); +return __ufshcd_clear_outstanding_reqs (hba, mask, false); +} +/* * Return: > 0 if one or more commands have been completed or 0 if no * requests have been completed.
@@ -5663,6 +5694,7 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)unsigned long completed_reqs, flags;u32 tr_doorbell;struct ufs_hw_queue *hwq; +bool from_irq;if (hba->mcq_enabled) { hwq = &hba->uhq[queue_num];
@@ -5672,12 +5704,9 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)spin_lock_irqsave (&hba->outstanding_lock, flags); tr_doorbell =ufshcd_readl (hba,REG_UTP_TRANSFER_REQ_DOOR_BELL ); - completed_reqs = ~tr_doorbell & hba->outstanding_reqs; -if (queue_num ==UFSHCD_POLL_FROM_INTERRUPT_CONTEXT ) { -/* Do not complete polled requests from interrupt context. */ -ufshcd_clear_polled (hba, &completed_reqs); - } - hba->outstanding_reqs &= ~completed_reqs; + from_irq = queue_num ==UFSHCD_POLL_FROM_INTERRUPT_CONTEXT ; + completed_reqs =__ufshcd_clear_outstanding_reqs (hba, ~tr_doorbell, + from_irq);spin_unlock_irqrestore (&hba->outstanding_lock, flags);if (completed_reqs)
@@ -7662,7 +7691,6 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)struct ufshcd_lrb *lrbp = &hba->lrb[tag];unsigned long flags;int err =FAILED ; -bool outstanding;u32 reg;ufshcd_hold (hba);
@@ -7743,11 +7771,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)* Clear the corresponding bit from outstanding_reqs since the command * has been aborted successfully. */ -spin_lock_irqsave (&hba->outstanding_lock, flags); - outstanding =__test_and_clear_bit (tag, &hba->outstanding_reqs); -spin_unlock_irqrestore (&hba->outstanding_lock, flags); - -if (outstanding) +if (ufshcd_clear_outstanding_reqs (hba,BIT (tag)))ufshcd_release_scsi_cmd (hba, lrbp); err =SUCCESS ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 574/670 wifi: mt76: move the channel survey when the channel changes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devin Wittmayer <[email protected]>
[ Upstream commit 68342a7bd7e5e273e2969e3c0f4c62ee3d006ce8 ]
mt7921 and mt7925 report every survey counter against one channel and never mark the one in use. With firmware channel management, both use channel contexts and never call __mt76_set_channel(), so phy->chan_state, phy->chandef and phy->main_chandef keep the first channel of the band.
Update them when a context is assigned or changed, after booking the time spent on the old channel. This also makes the legacy rate lookup in mt76_connac2_mac_fill_txs() and mt7925_mac_add_txs_skb() use the band of the current channel.
With two channel contexts (multi-channel or MLO), the survey follows the context that was assigned or changed last, since the driver reads the band 0 counters only.
Tested on MT7922 over PCIe, MT7921AU and MT7925 over USB.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 14 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt792x_core.c | 1 + 5 files changed, 20 insertions(+)
drivers/net/wireless/mediatek/mt76/mac80211.c +14 -0
@@ -973,6 +973,20 @@ void mt76_update_survey(struct mt76_phy *phy) }EXPORT_SYMBOL_GPL (mt76_update_survey); +void mt76_phy_chandef_set (struct mt76_phy *phy, +struct cfg80211_chan_def *chandef) +{ +if (!chandef->chan) +return ; + +mt76_update_survey (phy); + + phy->chandef = *chandef; + phy->main_chan = chandef->chan; + phy->chan_state =mt76_channel_state (phy, chandef->chan); +} +EXPORT_SYMBOL_GPL (mt76_phy_chandef_set); +int mt76_set_channel (struct mt76_phy *phy,struct cfg80211_chan_def *chandef,bool offchannel) {
drivers/net/wireless/mediatek/mt76/mt76.h +2 -0
@@ -1400,6 +1400,8 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw,bool mt76_has_tx_pending (struct mt76_phy *phy);int mt76_update_channel (struct mt76_phy *phy);void mt76_update_survey (struct mt76_phy *phy); +void mt76_phy_chandef_set (struct mt76_phy *phy, +struct cfg80211_chan_def *chandef);void mt76_update_survey_active_time (struct mt76_phy *phy,ktime_t time);int mt76_get_survey (struct ieee80211_hw *hw,int idx,struct survey_info *survey);
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -0
@@ -1394,6 +1394,7 @@ mt7921_change_chanctx(struct ieee80211_hw *hw,mt7921_mcu_config_sniffer (mvif, ctx); else mt76_connac_mcu_uni_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); +mt76_phy_chandef_set (mvif->phy->mt76, &ctx->def);mt792x_mutex_release (phy->dev); }
drivers/net/wireless/mediatek/mt76/mt7925/main.c +2 -0
@@ -1873,6 +1873,7 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, link_conf, ctx); } } +mt76_phy_chandef_set (mvif->phy->mt76, &ctx->def);mt792x_mutex_release (phy->dev); }
@@ -2170,6 +2171,7 @@ static int mt7925_assign_vif_chanctx(struct ieee80211_hw *hw, mconf->mt76.ctx = ctx; mctx->bss_conf = mconf; +mt76_phy_chandef_set (mvif->phy->mt76, &ctx->def);mutex_unlock (&dev->mt76.mutex);return 0 ;
drivers/net/wireless/mediatek/mt76/mt792x_core.c +1 -0
@@ -308,6 +308,7 @@ int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw,mutex_lock (&dev->mt76.mutex); mvif->bss_conf.mt76.ctx = ctx; mctx->bss_conf = &mvif->bss_conf; +mt76_phy_chandef_set (&dev->mphy, &ctx->def);mutex_unlock (&dev->mt76.mutex);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 575/670 ASoC: amd: acp: add DMI override for ACP70 flag
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hasun Park <[email protected]>
[ Upstream commit d0426510a9e1fabf074e274ceff26ffc6500980a ]
Some ASUS ProArt PX13 systems expose ACP ACPI config flags that can select a non-working fallback path.
Add a DMI override in snd_amd_acp_find_config() for ACP70+ boards and return 0 so ACP ACPI flag-based selection is skipped on this platform.
This keeps machine driver selection on the intended SoundWire path.
Stable-dep-of: 38cb2ef26b64 ("ASoC: amd: acp-config: force SoundWire probe on Dell 14S DS14265")
--- sound/soc/amd/acp-config.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/soc/amd/acp-config.c +14 -1
@@ -23,6 +23,16 @@static int acp_quirk_data; +static const struct dmi_system_id acp70_acpi_flag_override_table[] = { + { + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HN7306EA" ), + }, + }, + {} +}; +static const struct config_entry config_table[] = { { .flags =FLAG_AMD_SOF ,
@@ -200,8 +210,11 @@ int snd_amd_acp_find_config(struct pci_dev *pci)*/ if (!pci->revision)return 0 ; -else if (pci->revision >=ACP_7_0_REV ) +else if (pci->revision >=ACP_7_0_REV ) { +if (dmi_check_system (acp70_acpi_flag_override_table)) +return 0 ;return snd_amd_acp_acpi_find_config (pci); + }for (i =0 ; i <ARRAY_SIZE (config_table); i++, table++) {if (table->device != device)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 576/670 ASoC: amd: acp: Add DMI quirk for ASUS Zenbook S16 UM5606GA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jasper Smet <[email protected]>
[ Upstream commit 6e4bfd9da8851f562f04503d8e43221957f96eeb ]
The ASUS Zenbook S16 (UM5606GA) with AMD Ryzen AI 9 465 (Strix Point, ACP 7.0) has a BIOS that incorrectly sets the ACPI property 'acp-audio-config-flag' to 0x10 (FLAG_AMD_LEGACY_ONLY_DMIC) for the ACP device. This prevents snd_pci_ps from probing the SoundWire bus, resulting in no internal audio (dummy output only).
The hardware uses a Cirrus Logic CS42L43 (headphone/jack) and four CS35L56 smart amplifiers (speakers), all on SoundWire link 1. The corresponding machine table entry (acp70_cs42l43_l1u0_cs35l56x4_l1u0123) already exists in amd-acp70-acpi-match.c and correctly describes this topology.
Add a DMI quirk to override the flag to 0, consistent with the existing entry for the HN7306EA.
Stable-dep-of: 38cb2ef26b64 ("ASoC: amd: acp-config: force SoundWire probe on Dell 14S DS14265")
--- sound/soc/amd/acp-config.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/acp-config.c +7 -0
@@ -30,6 +30,13 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HN7306EA"), }, }, + { + /* ASUS Zenbook S16 UM5606GA (Strix Point, ACP 7.0) */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "Zenbook S16 UM5606GA"), + }, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 577/670 ASoC: amd: acp: Add DMI quirk for Lenovo Yoga Pro 7 15ASH11
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackie Dong <[email protected]>
[ Upstream commit fc12cf16df9af867e1455b011cdd9310474a612e ]
Lenovo Yoga Pro 7 15ASH11 with AMD RYZEN AI MAX+ 388 (Strix Halo, ACP 7.0) uses Realtek ALC287 series codec and no any DMIC connected by ACP. All DMICs directly connet with ALC codec.
Without this quirk, Input Device of Gnome Sound settings shows Internal Stereo Microphone and Digital Microphone by default. In fact, Digital Microphone of ACP doesn't work due to no connecting with ALC287 codec, the Internal Stereo Microphone as analog device based on snd_hda_intel driver can work well.
Add a DMI quirk to override the flag to 0, consistent with the existing entry for the HN7306EA.
Stable-dep-of: 38cb2ef26b64 ("ASoC: amd: acp-config: force SoundWire probe on Dell 14S DS14265")
--- sound/soc/amd/acp-config.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/acp-config.c +7 -0
@@ -37,6 +37,13 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Zenbook S16 UM5606GA"), }, }, + { + /* Lenovo Yoga Pro 7 15ASH11 (Strix Halo, ACP 7.0) */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83W5"), + }, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 578/670 ASoC: amd: acp-config: force SoundWire probe on HP OmniBook X Flip 16
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sehat Mahde <[email protected]>
[ Upstream commit 4d6642d64cd00f276549ec2c0b0278aea2f8c1aa ]
The BIOS on the HP OmniBook X Flip 16-cc0xxx (board 8EA2) reports acp-audio-config-flag = FLAG_AMD_LEGACY_ONLY_DMIC. This binds the legacy ACP driver and registers a PDM-only card, so the SoundWire links are never scanned and the two TAS2783 speaker amplifiers and RT712-VB codec do not enumerate.
Add a DMI entry for board 8EA2 to the ACP70 ACPI flag override table so the firmware-provided flag is overridden and snd_pci_ps probes instead.
On the affected system, an otherwise identical upstream kernel without this entry binds snd_acp_pci, enumerates no SoundWire slave devices and exposes no internal speaker PCM. With the entry added, snd_pci_ps binds, both TAS2783 amplifiers and the RT712-VB enumerate over SoundWire, and the amd-soundwire card exposes the internal speaker playback PCM.
Developed with AI assistance. ChatGPT helped analyze the ACP and SoundWire behavior, structure the controlled A/B testing, and draft the patch changelog. All hardware measurements, kernel builds, reboots and playback tests were performed by the submitter. The submitter has reviewed the change, understands it and takes responsibility for it.
Append the entry after the existing Lenovo quirk because the neighboring upstream entries are absent. Preserve the HP match unchanged so the subsequent Dell quirk has its expected insertion context.
Stable-dep-of: 38cb2ef26b64 ("ASoC: amd: acp-config: force SoundWire probe on Dell 14S DS14265")
--- sound/soc/amd/acp-config.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/acp-config.c +7 -0
@@ -44,6 +44,13 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "83W5"), }, }, + { + /* HP OmniBook X Flip 16-cc0xxx */ + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "HP"), + DMI_MATCH(DMI_BOARD_NAME, "8EA2"), + }, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 579/670 ASoC: amd: acp-config: force SoundWire probe on Dell 14S DS14265
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Art O Cathain <[email protected]>
[ Upstream commit 38cb2ef26b6411277826da54c6bcf94523541058 ]
The BIOS on the Dell 14S DS14265 (ACP PCI revision 0x72) reports acp-audio-config-flag = FLAG_AMD_LEGACY_ONLY_DMIC. As a result snd_pci_ps returns early and the SoundWire links are never scanned, while the legacy snd_acp_pci driver probes the device, finds no matching machine driver ("No matching ASoC machine driver found") and no internal sound card is created. The CS42L45 headset codec on link 0 and the two CS35L63 speaker amplifiers on link 1 never enumerate.
Add a DMI entry for the model to the ACP70 ACPI flag override table so the firmware-provided flag is overridden and snd_pci_ps probes instead. Match on the product name rather than the board name, as the same symptom has been reported on several boards of this model (09PVND, 0M0J65, 0C7F12).
Tested on a DS14265 (board 09PVND, BIOS 1.5.3) with Debian's 7.2.6 kernel, with and without this entry. With it, snd_pci_ps binds, both SoundWire links come up, the CS42L45 and both CS35L63 enumerate, the existing CS42L45 + 2x CS35L63 machine entry matches, the amplifiers load their firmware and calibration, and the amd-soundwire card plays through both the internal speakers and the headphone jack. Also build-tested on asoc-next with W=1.
Developed with AI assistance. Claude read the ACP driver source, identified the BIOS flag as the cause and the override table as the fix, wrote the DMI entry and the out-of-tree test module, and drafted this changelog. All hardware testing was done by the submitter, who has reviewed the change, understands it and takes responsibility for it.
--- sound/soc/amd/acp-config.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/acp-config.c +7 -0
@@ -51,6 +51,13 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { DMI_MATCH(DMI_BOARD_NAME, "8EA2"), }, }, + { + /* Dell 14S DS14265 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell 14S DS14265"), + }, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 580/670 fuse: dont launder folios of a bad inode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joanne Koong <[email protected]>
[ Upstream commit 01d0f3d294af126f517d92c11e100525537f8be4 ]
fuse_flush() and fuse_writepages() reject writing back dirty data for any inode that has been marked bad, but fuse_launder_folio() doesn't.
This can cause the following warning in fuse_write_file_get() to trigger, as reported by syzbot:
WARNING: fs/fuse/file.c:2043 at fuse_write_file_get fs/fuse/file.c:2043 [inline]
WARNING: fs/fuse/file.c:2043 at fuse_iomap_writeback_range+0x7c8/0x18f0 fs/fuse/file.c:2227
Call Trace:
iomap_writeback_folio+0x1526/0x2490 fs/iomap/buffered-io.c:2022
fuse_launder_folio+0x17b/0x240 fs/fuse/file.c:2331
folio_unmap_invalidate+0x4cd/0x830 mm/truncate.c:634
invalidate_inode_pages2_range+0x629/0xb30 mm/truncate.c:726
fuse_open+0x5a6/0x770 fs/fuse/file.c:297This can be hit on a writeback cache mount:
1) a writeable file is open and a buffered write dirties some pages
2) another thread opens the same file read-only. fuse_open() passes the bad inode check and sends OPEN to the server.
3) a SETATTR reply with the wrong file type marks the inode bad
4) the writeable file is closed. Flush and release skip writeback because the inode is bad. The pages stay dirty but the file gets removed from write_files.
5) server replies to the OPEN. The reply has no FOPEN_KEEP_CACHE, so fuse_open() calls invalidate_inode_pages2().
6) the invalidation finds the dirty pages and calls fuse_launder_folio(), which finds no wriable file and hits the WARN_ON in fuse_write_file_get().
Instead of trying to write back dirty data for the bad inode, fuse_launder_folio() should return -EIO.
--- fs/fuse/file.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/fuse/file.c +4 -0
@@ -2538,6 +2538,10 @@ static int fuse_write_end(struct file *file, struct address_space *mapping,static int fuse_launder_folio (struct folio *folio) {int err =0 ; + +if (fuse_is_bad (folio->mapping->host)) +return -EIO ; +if (folio_clear_dirty_for_io (folio)) {struct inode *inode = folio->mapping->host;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 581/670 block: amiflop: synchronize flush timer before track flush
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit 9690943353cec1690a715e000ba6a74e5139f530 ]
The amiflop track buffer is shared with the timer callback. timer_delete() does not wait for an in-flight callback, and that callback can rearm itself when it cannot acquire the floppy controller. A synchronous track flush can therefore race with the callback.
Stop the timer before synchronous track writes and use timer_delete_sync() to wait for any callback already running. Keep callback rearming disabled until the write is complete. Apply this to the FDFMTTRK path as well.
FDFLUSH, FDFMTTRK and close-time flushes run outside the blk-mq request callback. Freeze their queues so an in-flight request cannot change the shared track buffer while it is encoded and written. Restart the timer if a track remains dirty after a failed flush.
--- drivers/block/amiflop.c | 69 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 8 deletions(-)
drivers/block/amiflop.c +61 -8
@@ -265,6 +265,8 @@ static struct fd_data_type data_types[] = {static struct amiga_floppy_struct unit[FD_MAX_UNITS ];static struct timer_list flush_track_timer[FD_MAX_UNITS ]; +static DEFINE_SPINLOCK (flush_track_timer_lock); +static bool flush_track_timer_stopped[FD_MAX_UNITS ];static struct timer_list post_write_timer;static unsigned long post_write_timer_drive;static struct timer_list motor_on_timer;
@@ -1370,11 +1372,22 @@ static void flush_track_callback(struct timer_list *timer)sizeof (flush_track_timer[0 ]); nr&=3 ; +spin_lock (&flush_track_timer_lock); +if (flush_track_timer_stopped[nr]) { +spin_unlock (&flush_track_timer_lock); +return ; + } +spin_unlock (&flush_track_timer_lock); + writefromint =1 ;if (!try_fdc (nr)) {/* we might block in an interrupt, so try again later */ - flush_track_timer[nr].expires = jiffies +1 ; -add_timer (flush_track_timer + nr); +spin_lock (&flush_track_timer_lock); +if (!flush_track_timer_stopped[nr]) { + flush_track_timer[nr].expires = jiffies +1 ; +add_timer (flush_track_timer + nr); + } +spin_unlock (&flush_track_timer_lock);return ; }get_fdc (nr);
@@ -1421,6 +1434,35 @@ static int non_int_flush_track (unsigned long nr)return 1 ; } +static void flush_track_timer_stop (unsigned int drive) +{ +unsigned long flags; + +spin_lock_irqsave (&flush_track_timer_lock, flags); + flush_track_timer_stopped[drive] = true; +spin_unlock_irqrestore (&flush_track_timer_lock, flags); + +timer_delete_sync (flush_track_timer + drive); +} + +static void flush_track_timer_start (unsigned int drive) +{ +unsigned long flags; + +spin_lock_irqsave (&flush_track_timer_lock, flags); + flush_track_timer_stopped[drive] = false; +if (unit[drive].dirty) +mod_timer (flush_track_timer + drive, jiffies +1 ); +spin_unlock_irqrestore (&flush_track_timer_lock, flags); +} + +static void flush_track_timer_sync (unsigned int drive) +{ +flush_track_timer_stop (drive); +non_int_flush_track (drive); +flush_track_timer_start (drive); +} +static int get_track (int drive,int track) {int error, errcnt;
@@ -1435,8 +1477,7 @@ static int get_track(int drive, int track) }if (unit[drive].dirty ==1 ) { -del_timer (flush_track_timer + drive); -non_int_flush_track (drive); +flush_track_timer_sync (drive); } errcnt =0 ;while (errcnt <MAX_ERRORS ) {
@@ -1562,6 +1603,12 @@ static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode,case FDFMTTRK :if (param < p->type->tracks * p->type->heads) { +flush_track_timer_stop (drive); +if (unit[drive].dirty ==1 && + !non_int_flush_track (drive)) { +flush_track_timer_start (drive); +return -EIO ; + }get_fdc (drive);if (fd_seek (drive,param) !=0 ){ memset(p->trackbuf, FD_FILL_BYTE,
@@ -1570,6 +1617,7 @@ static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode, }floppy_off (drive);rel_fdc (); +flush_track_timer_start (drive); }else return -EINVAL ;
@@ -1591,8 +1639,7 @@ static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode,case FDDEFPRM :return -EINVAL ;case FDFLUSH :/* unconditionally, even if not needed */ -del_timer (flush_track_timer + drive); -non_int_flush_track (drive); +flush_track_timer_sync (drive);break ;#ifdef RAW_IOCTL case IOCTL_RAW_TRACK :
@@ -1611,9 +1658,14 @@ static int fd_ioctl(struct block_device *bdev, blk_mode_t mode, unsigned int cmd, unsigned long param) { int ret; +bool freeze_queue = cmd ==FDFMTTRK || cmd ==FDFLUSH ;mutex_lock (&amiflop_mutex); +if (freeze_queue) +blk_mq_freeze_queue (bdev->bd_disk->queue); ret =fd_locked_ioctl (bdev, mode, cmd, param); +if (freeze_queue) +blk_mq_unfreeze_queue (bdev->bd_disk->queue);mutex_unlock (&amiflop_mutex);return ret;
@@ -1713,9 +1765,9 @@ static void floppy_release(struct gendisk *disk)int drive = p - unit;mutex_lock (&amiflop_mutex); +blk_mq_freeze_queue (disk->queue);if (unit[drive].dirty ==1 ) { -del_timer (flush_track_timer + drive); -non_int_flush_track (drive); +flush_track_timer_sync (drive); }if (!fd_ref[drive]--) {
@@ -1725,6 +1777,7 @@ static void floppy_release(struct gendisk *disk)#ifdef MODULE floppy_off (drive);#endif +blk_mq_unfreeze_queue (disk->queue);mutex_unlock (&amiflop_mutex); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 582/670 ALSA: synth: Use guard() for spin locks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 59ede7178d402b3bfa0266cbd9ad348d5612c295 ]
Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.
Stable-dep-of: 34e3e04b8a17 ("ALSA: emux: Fix UAF of soundfont zones at note-on")
--- sound/synth/emux/emux_effect.c | 29 ++++++++-------- sound/synth/emux/emux_synth.c | 54 +++++++---------------------- sound/synth/emux/soundfont.c | 63 ++++++++++++---------------------- 3 files changed, 49 insertions(+), 97 deletions(-)
sound/synth/emux/emux_effect.c +14 -15
@@ -168,7 +168,6 @@ snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan,unsigned char *srcp, *origp;struct snd_emux *emu;struct snd_emux_effect_table *fx; -unsigned long flags; emu = port->emu; fx = chan->private;
@@ -195,22 +194,22 @@ snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan, offset++;#endif /* modify the register values */ -spin_lock_irqsave (&emu->voice_lock, flags); -for (i =0 ; i < emu->max_voices; i++) { -struct snd_emux_voice *vp = &emu->voices[i]; -if (!STATE_IS_PLAYING (vp->state) || vp->chan != chan) -continue ; - srcp = (unsigned char *)&vp->reg.parm + offset; - origp = (unsigned char *)&vp->zone->v.parm + offset; -if (parm_defs[i].type &PARM_IS_BYTE ) { - *srcp = *origp; -effect_set_byte (srcp, chan, type); - }else { - *(unsigned short *)srcp = *(unsigned short *)origp; -effect_set_word ((unsigned short *)srcp, chan, type); + scoped_guard(spinlock_irqsave, &emu->voice_lock) { +for (i =0 ; i < emu->max_voices; i++) { +struct snd_emux_voice *vp = &emu->voices[i]; +if (!STATE_IS_PLAYING (vp->state) || vp->chan != chan) +continue ; + srcp = (unsigned char *)&vp->reg.parm + offset; + origp = (unsigned char *)&vp->zone->v.parm + offset; +if (parm_defs[i].type &PARM_IS_BYTE ) { + *srcp = *origp; +effect_set_byte (srcp, chan, type); + }else { + *(unsigned short *)srcp = *(unsigned short *)origp; +effect_set_word ((unsigned short *)srcp, chan, type); + } } } -spin_unlock_irqrestore (&emu->voice_lock, flags);/* activate them */ snd_emux_update_channel (port, chan, parm_defs[type].update);
sound/synth/emux/emux_synth.c +13 -41
250 lines not on this page · raw message
sound/synth/emux/soundfont.c +22 -41
136 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 583/670 ALSA: emux: Fix UAF of soundfont zones at note-on
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 34e3e04b8a1731a773797542f0781e99ce7cd755 ]
snd_emux_note_on() looks up the matching zones via snd_soundfont_search_zone(), which takes sflist->lock only during the lookup and returns the raw zone pointers after releasing it. The caller then stores them in vp->zone without any protection. Meanwhile, a concurrent SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES ioctl may unlink and free those zones in snd_soundfont_remove_unlocked(); this leads to a use-after-free in snd_emux_note_on(), and later at accessing the cached vp->zone, e.g. in snd_emux_send_effect().
Fix it by holding sflist->lock in snd_emux_note_on() over the whole zone lookup and voice setup, and let snd_soundfont_search_zone() require the caller to hold the lock, instead. snd_soundfont_lock_preset() takes sflist->lock for setting presets_locked, so the removal path now syncs with the note-on finish.
--- sound/synth/emux/emux_synth.c | 3 +++ sound/synth/emux/soundfont.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
sound/synth/emux/emux_synth.c +3 -0
@@ -60,6 +60,9 @@ snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)return ; key = note;/* remember the original note */ + +/* hold sflist->lock for protecting against concurrent free */ +guard (spinlock_irqsave)(&emu->sflist->lock); nvoices =get_zone (emu, port, ¬e, vel, chan, table);if (! nvoices)return ;
sound/synth/emux/soundfont.c +6 -3
@@ -1264,6 +1264,9 @@ delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp)* The found zones are stored on 'table' array. max_layers defines * the maximum number of elements in this array. * This function returns the number of found zones. 0 if not found. +* +* The caller must hold sflist->lock, and keep holding it as long as +* the returned zones are accessed. */ int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
@@ -1273,11 +1276,11 @@ snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, {int nvoices; -/* this function is supposed to be called atomically, -* so we check the lock. if it's busy, just returns 0 to +lockdep_assert_held (&sflist->lock); + +/* if the presets are being modified, just returns 0 to * tell the caller the busy state */ -guard (spinlock_irqsave)(&sflist->lock);if (sflist->presets_locked)return 0 ; nvoices = search_zones(sflist, notep, vel, preset, bank,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 584/670 ALSA: hda/hdmi: clamp num_cvts against cvt_nids[] in hdmi_read_pin_conn
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 6cf3ab38b0d53d41f00fe594b2986849bdf994ae ]
hdmi_add_cvt() stores each converter's NID into the fixed-size spec->cvt_nids[] array (used only by the Intel Haswell pin-connection fixup), but only when spec->num_cvts is still within ARRAY_SIZE(cvt_nids); the num_cvts counter itself is incremented unconditionally regardless of whether the store happened. A codec that reports more converters than cvt_nids[] can hold therefore ends up with num_cvts > ARRAY_SIZE(cvt_nids).
hdmi_read_pin_conn(), on the intel_hsw_fixup path, copies num_cvts elements from cvt_nids[] with memcpy(), so once num_cvts exceeds the array size this reads past cvt_nids[] and writes the resulting garbage NIDs into per_pin->mux_nids[].
Clamp the copy length to the actual size of cvt_nids[] instead of trusting num_cvts, which is also used unbounded as the size of the separate, dynamically-sized spec->cvts array and must not be truncated at the source.
--- sound/pci/hda/patch_hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +2 -1
@@ -1355,7 +1355,8 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx)snd_hda_set_dev_select (codec, pin_nid, dev_id);if (spec->intel_hsw_fixup) { - conns = spec->num_cvts; +/* spec->cvt_nids[] only has ARRAY_SIZE(spec->cvt_nids) slots */ + conns =min_t (int, spec->num_cvts,ARRAY_SIZE (spec->cvt_nids));memcpy (per_pin->mux_nids, spec->cvt_nids,sizeof (hda_nid_t) * conns); }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 585/670 KVM: arm64: vgic: Stop the target vcpu when disabling LPIs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
[ Upstream commit a1b4bd2c2c262b8094c86afb99364d16ac08cb66 ]
Disabling LPIs is pretty nasty, as it directly messes with the AP list of the affected CPU, which could be running... This has the potential to lead to really bad behaviours, and we should not be doing that.
Take example on the way the Active state is handled and simply pause the the vcpu so that we are sure it is in a quiescent state, and the state be safely manipulated.
Nobody has any expectation of performance for this anyway.
--- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/kvm/vgic/vgic-mmio-v3.c +10 -0
@@ -276,9 +276,19 @@ static void vgic_mmio_write_v3r_ctlr(struct kvm_vcpu *vcpu,if (ctlr !=GICR_CTLR_ENABLE_LPIS )return ; +/* +* Yes, disabling LPIs is painful, since it can be done from +* a *remote* vcpu! So let's not take any chance, and make +* sure that the target vCPU has written their LRs back to the +* irq structures, and release any reference they would have. +* +* If it hurts, don't do it. +*/ +kvm_arm_halt_guest (vcpu->kvm);vgic_flush_pending_lpis (vcpu);vgic_its_invalidate_all_caches (vcpu->kvm);atomic_set_release (&vgic_cpu->ctlr,0 ); +kvm_arm_resume_guest (vcpu->kvm); }else { ctlr =atomic_cmpxchg_acquire (&vgic_cpu->ctlr,0 ,GICR_CTLR_ENABLE_LPIS );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 586/670 fbcon: Retry rotated font allocation after failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Yiqi <[email protected]>
[ Upstream commit 7935db1a4a0f83a63590a222500e5016e2f6c85e ]
fbcon_rotate_font() records the font, its geometry and the rotation in par->rotated before calling font_data_rotate(). If the allocation fails, the error path clears par->rotated.buf, but the recorded key already looks up to date, so the next call takes the early-out and never retries. The rotated putcs/cursor ops keep returning early on the NULL buffer, and the console stays blank even after memory is available again.
Also test par->rotated.buf in the early-out, so a failed allocation is retried on the next call: at the next fbcon_switch(), fbcon_modechanged() or font change.
--- drivers/video/fbdev/core/fbcon_rotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fbcon_rotate.c +2 -1
@@ -27,7 +27,8 @@ static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)u8 *dst;if (vc->vc_font.data == par->fontdata && - par->p->con_rotate == par->cur_rotate) + par->p->con_rotate == par->cur_rotate && + par->fontbuffer) goto finished; src = par->fontdata = vc->vc_font.data;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 587/670 xen/gntdev: Fix gntdev_dmabuf ref leak in dmabuf_exp_wait_released()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 6f165abe2b40ede71c98956cd74cd17c18505e75 ]
dmabuf_exp_wait_released() takes a reference on the exported gntdev_dmabuf with dmabuf_exp_wait_obj_get_dmabuf() and passes it to dmabuf_exp_wait_obj_new(), which drops that reference after adding the wait object to the wait list. When the wait object allocation fails, dmabuf_exp_wait_obj_new() returns ERR_PTR(-ENOMEM) early and the reference is never dropped, leaking a reference to the exported gntdev_dmabuf.
Drop the reference on the allocation failure path so the reference is consumed whether the wait object is created or not.
Message-ID: <[email protected]>
--- drivers/xen/gntdev-dmabuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/gntdev-dmabuf.c +3 -1
@@ -96,8 +96,10 @@ dmabuf_exp_wait_obj_new(struct gntdev_dmabuf_priv *priv,struct gntdev_dmabuf_wait_obj *obj; obj =kzalloc (sizeof (*obj),GFP_KERNEL ); -if (!obj) +if (!obj) { +kref_put (&gntdev_dmabuf->u.exp.refcount, dmabuf_exp_release);return ERR_PTR (-ENOMEM ); + }init_completion (&obj->completion); obj->gntdev_dmabuf = gntdev_dmabuf;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 588/670 mm/mempolicy: use vm_normal_folio_pmd() in queue_folios_pmd()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price <[email protected]>
[ Upstream commit 9057170a941f0c5f4058f6fb9ab5d5fc9fcc9e83 ]
Patch series "mm: stop calling pmd_folio() on special PMDs", v3.
Two page table walkers resolve the folio behind a PMD with pmd_folio(), which is only valid for a PMD mapping a refcounted struct page:
madvise_cold_or_pageout_pte_range() mm/madvise.c queue_folios_pmd() mm/mempolicy.c
vmf_insert_pfn_pmd() installs special PMDs holding a raw pfn that need not have a memmap entry at all. Both walkers can reach one and fault on the first folio field read. The PTE halves of both already use vm_normal_folio(); these two patches make the PMD halves match.
The four callers of vmf_insert_pfn_pmd(), and which walker each reaches:
drivers/vfio/pci/vfio_pci_core.c VM_PFNMAP mempolicy drivers/gpu/drm/drm_gem_shmem_helper.c VM_PFNMAP mempolicy drivers/gpu/drm/panthor/panthor_gem.c VM_PFNMAP mempolicy drivers/hv/mshv_vtl_main.c VM_MIXEDMAP both
can_madv_lru_vma() rejects VM_PFNMAP, so only mshv_vtl_low reaches the madvise walker, and that needs CAP_SYS_ADMIN. queue_pages_walk_ops supplies its own ->test_walk, so walk_page_test()'s generic VM_PFNMAP skip never runs and vfio-pci is reachable by any process holding the device fd. Hence the different stable tags.
One behaviour change: mbind(MPOL_MF_STRICT) over a PMD mapped VM_PFNMAP region now returns 0 rather than -EIO. The PTE loop already returned 0 there. drm_gem_shmem and panthor are where this is observable, since they PMD map pages that do have a memmap entry and so never faulted.
Reproducer
==========
No hardware needed. An out of tree module stands in for the drivers
above: three misc devices, each with a ->huge_fault calling vmf_insert_pfn_pmd(), plus VM_HUGEPAGE so the fault path takes the PMD branch.
/dev/pmdspec_mixed VM_MIXEDMAP, pfn at the 1 TiB mark, no memmap /dev/pmdspec_pfnmap VM_PFNMAP, pfn at the 1 TiB mark, no memmap /dev/pmdspec_real VM_PFNMAP, real alloc_pages(PMD_ORDER) on node 0
Userspace maps the device into a PMD aligned window, reads one byte to fault the PMD in, checks a module parameter to confirm it went in, then issues the operation.
vng --run <bzImage> --user root --memory 4G --verbose \
--append "numa=fake=2" \
--exec "insmod pmdspec.ko && ./pmdspec_test <subtest>"numa=fake=2 gives a node 1 to bind to; the module allocates its real page on node 0, which is what makes queue_folio_required() true.
subtest operation parent series
--------------------------------------------------------------------
madv_cold madvise(MADV_COLD) oops ret=0 madv_pageout madvise(MADV_PAGEOUT) oops ret=0 mbind_mixed mbind(MPOL_BIND, n1, MPOL_MF_MOVE) oops ret=0 mbind_pfnmap mbind(MPOL_BIND, n1, MPOL_MF_STRICT) oops ret=0 mbind_real mbind(MPOL_BIND, n1, MPOL_MF_STRICT) -EIO ret=0
Two things the table shows that are easy to miss in the code:
- mbind_mixed passes only MPOL_MF_MOVE. MPOL_MF_STRICT is not needed for a VM_MIXEDMAP vma: walk_page_test() only skips VM_PFNMAP, and vma_migratable() is true for VM_MIXEDMAP.
- mbind_real demonstrates the user visible change (-EIO -> 0)
This patch (of 2):
mmap a VM_PFNMAP region whose ->huge_fault installs a PMD through vmf_insert_pfn_pmd() - a vfio-pci MMIO BAR does this - then
mbind(p, len, MPOL_BIND, &mask, maxnode, MPOL_MF_STRICT);
With a stand-in module for the driver:
BUG: unable to handle page fault for address: fffff96dc0000008 RIP: 0010:queue_folios_pte_range+0xaf/0x440 walk_pgd_range+0x52b/0xaf0 __walk_page_range+0x6a/0x1d0 walk_page_range_mm_unsafe+0x193/0x230 queue_pages_range+0x64/0xa0 do_mbind+0x25e/0x640
queue_folios_pmd(), inlined above, calls pmd_folio() on that PMD. The pfn is raw MMIO with no memmap entry, so the folio lands in unpopulated vmemmap. Neither guard stops the walk:
walk_page_test() skips VM_PFNMAP, but queue_pages_walk_ops
supplies ->test_walk, so it never runs
queue_pages_test_walk() honours vma_migratable(), but only while
MPOL_MF_STRICT is clear
A VM_MIXEDMAP vma needs neither flag, being vma_migratable(), so plain mbind(MPOL_MF_MOVE) reaches this too - and there the bad folio carries on into migrate_folio_add() and folio_isolate_lru(). mshv_vtl_low is such a mapping.
Use vm_normal_folio_pmd() and skip on NULL, as the PTE loop in queue_folios_pte_range() already does with vm_normal_folio(). This also filters the huge zero PMD, so its separate check is no longer needed.
mbind(MPOL_MF_STRICT) over a PMD mapped VM_PFNMAP region now returns 0 rather than -EIO. The PTE loop already returned 0 there.
--- mm/mempolicy.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
mm/mempolicy.c +5 -6
@@ -500,7 +500,8 @@ static inline bool queue_folio_required(struct folio *folio,return node_isset (nid, *qp->nmask) == !(flags &MPOL_MF_INVERT ); } -static void queue_folios_pmd (pmd_t *pmd,struct mm_walk *walk) +static void queue_folios_pmd (pmd_t *pmd,unsigned long addr, +struct mm_walk *walk) {struct folio *folio;struct queue_pages *qp = walk->private;
@@ -509,11 +510,9 @@ static void queue_folios_pmd(pmd_t *pmd, struct mm_walk *walk) qp->nr_failed++;return ; } - folio =pmd_folio (*pmd); -if (is_huge_zero_folio (folio)) { - walk->action =ACTION_CONTINUE ; + folio =vm_normal_folio_pmd (walk->vma, addr, *pmd); +if (!folio ||folio_is_zone_device (folio))return ; - }if (!queue_folio_required (folio, qp))return ; if (!(qp->flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) ||
@@ -545,7 +544,7 @@ static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, ptl =pmd_trans_huge_lock (pmd, vma);if (ptl) { -queue_folios_pmd (pmd, walk); +queue_folios_pmd (pmd, addr, walk);spin_unlock (ptl); goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 589/670 drm/amdgpu: Use (v)memdup_array_user in amdgpu_cs_pass1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
[ Upstream commit d4b6274cbf0b0ee92294d699f138b63aa4796ad0 ]
Replace k(v)malloc_array() + copy_from_user() with (v)memdup_array_user().
This shrinks the source code and improves separation between the kernel and userspace slabs.
Stable-dep-of: ba4c3c202919 ("drm/amdgpu: reject CS chunks too large for kvmalloc()")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 33 ++++++++------------------ 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +10 -23
@@ -203,25 +203,17 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,struct amdgpu_fpriv *fpriv = p->filp->driver_priv;unsigned int num_ibs[AMDGPU_CS_GANG_SIZE ] = { };struct amdgpu_vm *vm = &fpriv->vm; -uint64_t *chunk_array_user;uint64_t *chunk_array;uint32_t uf_offset =0 ;size_t size;int ret;int i; - chunk_array =kvmalloc_array (cs->in.num_chunks,sizeof (uint64_t ), -GFP_KERNEL ); -if (!chunk_array) -return -ENOMEM ; - -/* get chunks */ - chunk_array_user =u64_to_user_ptr (cs->in.chunks); -if (copy_from_user (chunk_array, chunk_array_user, -sizeof (uint64_t )*cs->in.num_chunks)) { - ret = -EFAULT ; - goto free_chunk; - } + chunk_array =memdup_array_user (u64_to_user_ptr (cs->in.chunks), + cs->in.num_chunks, +sizeof (uint64_t )); +if (IS_ERR (chunk_array)) +return PTR_ERR (chunk_array); p->nchunks = cs->in.num_chunks; p->chunks = kvmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk),
@@ -234,7 +226,6 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,for (i =0 ; i < p->nchunks; i++) {struct drm_amdgpu_cs_chunk __user *chunk_ptr =NULL ;struct drm_amdgpu_cs_chunk user_chunk; -uint32_t __user *cdata; chunk_ptr =u64_to_user_ptr (chunk_array[i]); if (copy_from_user(&user_chunk, chunk_ptr,
@@ -247,20 +238,16 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p, p->chunks[i].length_dw = user_chunk.length_dw; size = p->chunks[i].length_dw; - cdata =u64_to_user_ptr (user_chunk.chunk_data); - p->chunks[i].kdata =kvmalloc_array (size,sizeof (uint32_t ), -GFP_KERNEL ); -if (p->chunks[i].kdata ==NULL ) { - ret = -ENOMEM ; + p->chunks[i].kdata =vmemdup_array_user (u64_to_user_ptr (user_chunk.chunk_data), + size, +sizeof (uint32_t )); +if (IS_ERR (p->chunks[i].kdata)) { + ret =PTR_ERR (p->chunks[i].kdata); i--; goto free_partial_kdata; } size *=sizeof (uint32_t ); -if (copy_from_user (p->chunks[i].kdata, cdata, size)) { - ret = -EFAULT ; - goto free_partial_kdata; - }/* Assume the worst on the following checks */ ret = -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 590/670 drm/amdgpu: reject CS chunks too large for kvmalloc()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Zhang <[email protected]>
[ Upstream commit ba4c3c202919405f461a393e823e4b72c8518494 ]
The CS ioctl copies every chunk with vmemdup_array_user() before it looks at it, for whatever length_dw userspace gives. kvmalloc() warns about allocations above INT_MAX when called without __GFP_NOWARN, so any process with the render node can trigger a warning. On navi31, a CS with a chunk of length_dw 0x20000000 returns -ENOMEM after:
WARNING: mm/slub.c:6841 at __kvmalloc_node_noprof+0x5a5/0x7d0
Reject such chunks with -EINVAL before trying to copy them.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +6 -0
@@ -239,6 +239,12 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p, size = p->chunks[i].length_dw; +if (size >INT_MAX /sizeof (uint32_t )) { + ret = -EINVAL ; + i--; + goto free_partial_kdata; + } + p->chunks[i].kdata =vmemdup_array_user (u64_to_user_ptr (user_chunk.chunk_data), size,sizeof (uint32_t ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 591/670 power: supply: cros_charge-control: restore EC state on resume
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Pam <[email protected]>
[ Upstream commit 1f2a40f954c848dff9d8bb6d81e404f9e47f0e81 ]
The EC resets its charge control configuration when the AP powers off, so configured sustainer thresholds and charge behaviour are lost across hibernation.
Nothing notices the reset. Commit 4fc88ba435da ("power: supply:
cros_charge-control: adopt EC charge state on probe"), in the power-supply tree, made the driver adopt the EC's charge state, but only at probe, and a resume is not a probe. Sysfs therefore keeps reporting the configured values while the EC charges the battery to full. On a Framework Laptop 16 (Ryzen AI 300, charge control command version 3) with charge_control_end_threshold set to 80, a hibernate and resume cycle leaves the attribute still reading 80 while the battery charges past it to 100%.
Add a system sleep resume hook that reprograms the EC from the cached state. The same EC behaviour and the same fix already exist for another driver, see commit 2643187ccb86 ("platform/x86: ayaneo-ec: Add suspend hook").
Reprogramming the EC is only strictly required after hibernation, but it is cheap and idempotent, so hook every resume path rather than rely on the EC preserving its state across each kind of sleep transition.
Note that re-reading the state from the EC on resume, by reusing cros_chctl_init_state() or otherwise, would be wrong even on the command versions that support GET: the EC has been reset to its defaults by the time the hook runs, so adopting that state would silently discard the configuration the user asked for. The driver's cached state is the only remaining record of it, which is why it is pushed to the EC rather than refreshed from it.
--- drivers/power/supply/cros_charge-control.c | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/power/supply/cros_charge-control.c +28 -1
@@ -14,6 +14,7 @@#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_device.h> +#include <linux/pm.h> #include <linux/types.h> #define EC_CHARGE_CONTROL_BEHAVIOURS (BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO) | \
@@ -322,6 +323,7 @@ static int cros_chctl_probe(struct platform_device *pdev)dev_dbg (dev,"Command version: %u\n" , (unsigned int )priv->cmd_version); priv->cros_ec = cros_ec; +dev_set_drvdata (dev, priv); priv->device_attrs[CROS_CHCTL_ATTR_START_THRESHOLD ] = (struct device_attribute )__ATTR_RW (charge_control_start_threshold); priv->device_attrs[CROS_CHCTL_ATTR_END_THRESHOLD] =
@@ -352,13 +354,38 @@ static int cros_chctl_probe(struct platform_device *pdev)return devm_battery_hook_register (dev, &priv->battery_hook); } +static int cros_chctl_resume (struct device *dev) +{ +struct cros_chctl_priv *priv =dev_get_drvdata (dev); +int ret; + +/* +* The EC resets its charge control state when the AP powers off, so the +* configuration is lost across hibernation, while the values exposed to +* userspace still describe it. The cached state is the only remaining +* record of that configuration: reprogram the EC from it rather than +* re-reading the EC, which would adopt the reset defaults instead. +*/ +guard (mutex)(&priv->lock); + ret =cros_chctl_configure_ec (priv); +if (ret) +dev_err (dev,"failed to restore charge control state: %d\n" , ret); + +return ret; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(cros_chctl_pm_ops, NULL, cros_chctl_resume); +static const struct platform_device_id cros_chctl_id[] = { {"cros-charge-control" ,0 }, {} };static struct platform_driver cros_chctl_driver = { - .driver.name ="cros-charge-control" , + .driver = { + .name ="cros-charge-control" , + .pm =pm_sleep_ptr (&cros_chctl_pm_ops), + }, .probe = cros_chctl_probe, .id_table = cros_chctl_id, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 592/670 ublk: mark the io command cancelable before publishing it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit a261f0cacacc022e4fab5b8e38c59f74ce4942e8 ]
FETCH, COMMIT_AND_FETCH and NEED_GET_DATA publish the command in io->cmd before marking it cancelable. A cancel from the control path (STOP_DEV, QUIESCE_DEV) can complete it in between:
issue path control-path cancel
io->cmd = C
take C, io_uring_cmd_done(C):
C not marked, nothing to unlink
ublk_prep_cancel(C)
the completed C is linked on the cancelable list
ring exit: the cancel walk hits it → GPF (KASAN, with a delay added)
Mark the command before ublk_fill_io_cmd() publishes it. The handlers run with uring_lock held, as io_uring's cancel walk does, so marking takes no lock and the walk can't see a marked command before it is published. smp_wmb() orders the mark before the io->cmd store; the cancel loads cmd with READ_ONCE(io->cmd) before reading cmd->flags.
A marked command has to be completed by io_uring_cmd_done(), so a failed FETCH and the inline UBLK_IO_RES_OK of NEED_GET_DATA now do that. The CQE is the same.
--- drivers/block/ublk_drv.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/block/ublk_drv.c +14 -2
@@ -1589,8 +1589,10 @@ static void ublk_cancel_cmd(struct ublk_queue *ubq, unsigned tag, io->flags |=UBLK_IO_FLAG_CANCELED ;spin_unlock (&ubq->cancel_lock); +/* dependency ordered against smp_wmb() in ublk_prep_cancel() */ if (!done) -io_uring_cmd_done (io->cmd,UBLK_IO_RES_ABORT ,0 , issue_flags); +io_uring_cmd_done (READ_ONCE (io->cmd),UBLK_IO_RES_ABORT ,0 , + issue_flags); }/*
@@ -1807,6 +1809,12 @@ static inline void ublk_fill_io_cmd(struct ublk_io *io, io->addr = buf_addr; } +/* +* Call before ublk_fill_io_cmd() publishes @cmd in io->cmd: a control-path +* cancel may complete any command found there, and io_uring_cmd_done() only +* takes it off the cancelable list if it is marked already. The handlers +* hold uring_lock, so marking takes no lock. +*/ static inline void ublk_prep_cancel (struct io_uring_cmd *cmd,unsigned int issue_flags,struct ublk_queue *ubq,unsigned int tag)
@@ -1820,6 +1828,8 @@ static inline void ublk_prep_cancel(struct io_uring_cmd *cmd, pdu->ubq = ubq; pdu->tag = tag;io_uring_cmd_mark_cancelable (cmd, issue_flags); +/* pairs with the cancel loading cmd from io->cmd, then cmd->flags */ +smp_wmb (); } static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
@@ -1899,6 +1909,7 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, goto out; } +ublk_prep_cancel (cmd, issue_flags, ubq, tag);ublk_fill_io_cmd (io, cmd, ub_cmd->addr);ublk_mark_io_ready (ub, ubq);break ;
@@ -1925,19 +1936,20 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, goto out; } +ublk_prep_cancel (cmd, issue_flags, ubq, tag);ublk_fill_io_cmd (io, cmd, ub_cmd->addr);ublk_commit_completion (ub, ub_cmd);break ;case UBLK_IO_NEED_GET_DATA :if (!(io->flags &UBLK_IO_FLAG_OWNED_BY_SRV )) goto out; +ublk_prep_cancel (cmd, issue_flags, ubq, tag);ublk_fill_io_cmd (io, cmd, ub_cmd->addr);ublk_handle_need_get_data (ub, ub_cmd->q_id, ub_cmd->tag);break ;default : goto out; } -ublk_prep_cancel (cmd, issue_flags, ubq, tag);return -EIOCBQUEUED ; out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 593/670 nvmem: rockchip-otp: alloc clks with main struct
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 9f99bb979f930e52e6861114fe03535d4bc2f374 ]
Use a flexible array member to simplify allocation slightly. No need for a separate calloc.
Stable-dep-of: 9fc6a1592d84 ("nvmem: rockchip-otp: Serialize reads")
--- drivers/nvmem/rockchip-otp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/nvmem/rockchip-otp.c +2 -7
@@ -77,9 +77,9 @@ struct rockchip_data {struct rockchip_otp {struct device *dev;void __iomem *base; -struct clk_bulk_data *clks;struct reset_control *rst;const struct rockchip_data *data; +struct clk_bulk_data clks[]; };static int rockchip_otp_reset (struct rockchip_otp *otp)
@@ -327,7 +327,7 @@ static int rockchip_otp_probe(struct platform_device *pdev)if (!data)return dev_err_probe (dev, -EINVAL ,"failed to get match data\n" ); - otp =devm_kzalloc (&pdev->dev,sizeof (struct rockchip_otp ), + otp =devm_kzalloc (&pdev->dev,struct_size (otp, clks, data->num_clks),GFP_KERNEL );if (!otp)return -ENOMEM ;
@@ -339,11 +339,6 @@ static int rockchip_otp_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (otp->base),"failed to ioremap resource\n" ); - otp->clks =devm_kcalloc (dev, data->num_clks,sizeof (*otp->clks), -GFP_KERNEL ); -if (!otp->clks) -return -ENOMEM ; -for (i =0 ; i < data->num_clks; ++i) otp->clks[i].id = data->clks[i];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 594/670 nvmem: rockchip-otp: Serialize reads
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Charkov <[email protected]>
[ Upstream commit 9fc6a1592d844c0397f115ee8cbd935169b9a71e ]
The OTP controller is driven through a single set of registers holding a state machine which has to be stepped through for every word read, yet nothing keeps two readers out of each other's way. Concurrent reads interleave, and the outcome is either a reader bailing out:
rockchip-otp 2a580000.otp: timeout during read setup
or, worse, one of them silently taking delivery of the other's data.
Reading two cells in parallel from userspace on RK3576 reproduces both within 150 iterations - 53 read errors and 9 corrupted results, the latter either losing their first word or, in one case, ending in the two bytes which belong to the other reader's cell - whereas the same reads issued sequentially never fail. Concurrency is not hypothetical here, as six thermal sensors source their trim values from the OTP and reach the driver straight from asynchronous driver probing.
Guard the read path with a mutex. Reads are the only way into the hardware, as the driver registers no write callback, and they always run in process context, so a plain mutex spanning the whole clock-enable, read, clock-disable sequence is enough.
--- drivers/nvmem/rockchip-otp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/nvmem/rockchip-otp.c +14 -1
@@ -12,6 +12,7 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/nvmem-provider.h> #include <linux/reset.h> #include <linux/slab.h>
@@ -79,6 +80,8 @@ struct rockchip_otp {void __iomem *base;struct reset_control *rst;const struct rockchip_data *data; +/* Serializes access to the OTP controller state machine */ +struct mutex mutex;struct clk_bulk_data clks[]; };
@@ -239,16 +242,21 @@ static int rockchip_otp_read(void *context, unsigned int offset,if (!otp->data || !otp->data->reg_read)return -EINVAL ; +mutex_lock (&otp->mutex); + ret =clk_bulk_prepare_enable (otp->data->num_clks, otp->clks);if (ret <0 ) {dev_err (otp->dev,"failed to prepare/enable clks\n" ); -return ret; + goto unlock; } ret = otp->data->reg_read (context, offset, val, bytes);clk_bulk_disable_unprepare (otp->data->num_clks, otp->clks); +unlock: +mutex_unlock (&otp->mutex); +return ret; }
@@ -334,6 +342,11 @@ static int rockchip_otp_probe(struct platform_device *pdev) otp->data = data; otp->dev = dev; + + ret =devm_mutex_init (dev, &otp->mutex); +if (ret) +return ret; + otp->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (otp->base)) return dev_err_probe(dev, PTR_ERR(otp->base),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 595/670 hwmon: (acpi_power_meter) Fix 18.45 TW bug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 0b6eda22f9ab67ddb2a872b0c3fc578ad9f4e27e ]
The ACPI specification says:
"If an error occurs while obtaining the meter reading or if the value is not available then an Integer with all bits set is returned"
This integer can also be 64-bit wide on ACPI 2.0 and later systems, so we have to check for that too.
Compile-tested only.
--- drivers/hwmon/acpi_power_meter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwmon/acpi_power_meter.c +8 -2
@@ -10,6 +10,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/jiffies.h> +#include <linux/limits.h> #include <linux/mutex.h> #include <linux/dmi.h> #include <linux/slab.h>
@@ -31,7 +32,12 @@#define POWER_METER_CAN_NOTIFY (1 << 3)#define POWER_METER_IS_BATTERY (1 << 8)#define UNKNOWN_HYSTERESIS 0xFFFFFFFF -#define UNKNOWN_POWER 0xFFFFFFFF +/* +* ACPI integers can either be 32-bit or 64-bit wide, so +* we have to check for both values. +*/ +#define UNKNOWN_POWER_32 U32_MAX +#define UNKNOWN_POWER_64 U64_MAX#define METER_NOTIFY_CONFIG 0x80#define METER_NOTIFY_TRIP 0x81
@@ -349,7 +355,7 @@ static ssize_t show_power(struct device *dev,update_meter (resource);mutex_unlock (&resource->lock); -if (resource->power ==UNKNOWN_POWER ) +if (resource->power ==UNKNOWN_POWER_32 || resource->power ==UNKNOWN_POWER_64 )return -ENODATA ;return sprintf (buf,"%llu\n" , resource->power *1000 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 596/670 drm/amdgpu: reset SI ASIC on MacBookPros with VRAM at 0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Kucharek <[email protected]>
[ Upstream commit 5b56ede880317bd912f914d5cd38ba1d357677fa ]
On MacBookPros with switchable graphics, the firmware puts VRAM at MC address 0 when the iGPU is enabled. The EFI stub enables the iGPU on these machines through apple_set_os(). On a MacBookPro11,5 (Radeon R9 M370X, 1002:6821, subsystem 106b:0149), the driver adopts this layout at init:
MC_VM_FB_LOCATION=0x007f0000, HDP_NONSURFACE_BASE=0 VRAM at 0x0-0x7fffffff, GART table at 0x1400000
The driver posts the ASIC again on S3 resume and after a GPU reset. The VBIOS asic_init table then moves VRAM back to the VBIOS default:
MC_VM_FB_LOCATION=0xf47ff400, HDP_NONSURFACE_BASE=0xf4000000
gmc_v6_0 does not reprogram these registers. The GART table is then no longer in VRAM, and the gfx ring test times out:
amdgpu: ring gfx test failed (-110)
amdgpu: resume of IP block <gfx_v6_0> failed -110
Reset and post the ASIC at driver load on Apple boards with VRAM at 0. The driver then uses the VBIOS layout (VRAM at 0xf400000000) from the start, and later posts keep it. After the reset, FB_BASE is not 0, so a module reload does not reset the ASIC again.
The test is the same one that commit c54e4d105077 ("drm/amdgpu: make Mac FB workaround generic") uses: an Apple subsystem vendor and VRAM at
0. The VI quirk for the MacBookPro14,3 resets at load for the same reason:
commit b6b1d9721851 ("drm/amdgpu: reset VI ASIC on MacBookPro14,3")
Other Apple SI boards get the same reset if FB_BASE reads 0 at load.
Tested on a MacBookPro11,5 with 7.2.5 and this patch: the panel comes up at boot, and 4 of 4 deep S3 cycles resume. Without the patch, S3 resume fails every time. The GPU reset path is not tested.
--- drivers/gpu/drm/amd/amdgpu/si.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/si.c +10 -0
@@ -1509,6 +1509,16 @@ static bool si_need_full_reset(struct amdgpu_device *adev)static bool si_need_reset_on_init (struct amdgpu_device *adev) { +/* +* MacBookPros with switchable graphics put VRAM at 0 when the iGPU +* is enabled. Any later post (S3 resume, GPU reset) moves it back to +* the vbios default, so reset and post on load to start with the +* vbios layout. +*/ +if (adev->pdev->subsystem_vendor ==PCI_VENDOR_ID_APPLE && + !(RREG32 (mmMC_VM_FB_LOCATION) &0xFFFF )) +return true; +return false; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 597/670 tpm: tpm2_probe: propagate transport errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
[ Upstream commit 7d4f1cbfe063af5581dac66abe9e9c965e1031cc ]
tpm2_probe() reads the protocol version from the response tag and is documented to return -errno on failure, but it always returns 0. A transport error (tpm_transmit_cmd() < 0) is thus swallowed together with the intentionally ignored TPM response code, leaving TPM_CHIP_FLAG_TPM2 unset. A transient bus failure on the first command then misdetects a TPM 2.0 as a 1.2 and the probe fails on the TPM 1.2 path:
tpm_tis_i2c 0-002e: 1.2 TPM (device-id 0x1C, rev-id 22)
tpm tpm0: A TPM error (-62) occurred attempting to determine the timeouts
Return the transport error instead; rc >= 0 still means a valid header was received and the TPM's own response code is still ignored.
--- drivers/char/tpm/tpm2-cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm2-cmd.c +2 -1
@@ -551,9 +551,10 @@ int tpm2_probe(struct tpm_chip *chip) out = (struct tpm_header *)buf.data;if (be16_to_cpu (out->tag) ==TPM2_ST_NO_SESSIONS ) chip->flags |=TPM_CHIP_FLAG_TPM2 ; + rc =0 ; }tpm_buf_destroy (&buf); -return 0 ; +return rc; }EXPORT_SYMBOL_GPL (tpm2_probe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 598/670 power: supply: core: add wakeup source inhibit by power_supply_config
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 49000fee9e639f62ba1f965ed2ae4c5ad18d19e2 ]
To inhibit wakeup users currently have to use dedicated functions to register the power supply: {,devm_}power_supply_register_no_ws(). This is inconsistent to other runtime settings which can be configured through struct power_supply_config.
It's also not obvious what _no_ws() is meant to mean.
Extend power_supply_config to also be able to inhibit the wakeup source.
Stable-dep-of: db560f4b1c52 ("power: supply: bq27xxx: Ensure poll work is cancelled on remove")
--- drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/power/supply/power_supply_core.c +3 -0
@@ -1403,6 +1403,9 @@ __power_supply_register(struct device *parent,if (rc) goto device_add_failed; +if (cfg && cfg->no_wakeup_source) + ws = false; + rc =device_init_wakeup (dev, ws);if (rc) goto wakeup_init_failed;
include/linux/power_supply.h +2 -0
@@ -236,6 +236,8 @@ struct power_supply_config {char **supplied_to;size_t num_supplicants; + +bool no_wakeup_source; };/* Description of power supply */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 599/670 power: supply: bq27xxx_battery: register power supply with power_supply_register()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 1011646d4bd6c2eedb68d131ba7ddaf9ecd2aa9e ]
devm_power_supply_register_no_ws() is going to be removed. Switch to the general registration API.
Stable-dep-of: db560f4b1c52 ("power: supply: bq27xxx: Ensure poll work is cancelled on remove")
--- drivers/power/supply/bq27xxx_battery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/bq27xxx_battery.c +2 -1
@@ -2163,6 +2163,7 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)struct power_supply_config psy_cfg = { .of_node = di->dev->of_node, .drv_data = di, + .no_wakeup_source = true, };int ret;
@@ -2189,7 +2190,7 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) psy_desc->get_property = bq27xxx_battery_get_property; psy_desc->external_power_changed = bq27xxx_external_power_changed; - di->bat =devm_power_supply_register_no_ws (di->dev, psy_desc, &psy_cfg); + di->bat =devm_power_supply_register (di->dev, psy_desc, &psy_cfg);if (IS_ERR (di->bat))return dev_err_probe (di->dev,PTR_ERR (di->bat),"failed to register battery\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 600/670 power: supply: Use devm_mutex_init()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 7d715345a86941b9e6c8e520b40078692baed4a4 ]
Use devm_mutex_init() instead of hand-writing it.
This saves some LoC, improves readability and saves some space in the generated .o file.
As an example:
Before:
======
text data bss dec hex filename 35803 9352 384 45539 b1e3 drivers/power/supply/rt9467-charger.o
After:
=====
text data bss dec hex filename 34792 9008 384 44184 ac98 drivers/power/supply/rt9467-charger.o
Stable-dep-of: db560f4b1c52 ("power: supply: bq27xxx: Ensure poll work is cancelled on remove")
--- drivers/power/supply/bq27xxx_battery.c | 11 +-------- drivers/power/supply/mt6370-charger.c | 11 +-------- drivers/power/supply/rt9467-charger.c | 33 +++----------------------- 3 files changed, 5 insertions(+), 50 deletions(-)
drivers/power/supply/bq27xxx_battery.c +1 -10
@@ -2150,13 +2150,6 @@ static void bq27xxx_external_power_changed(struct power_supply *psy)mod_delayed_work (system_wq, &di->work,HZ /2 ); } -static void bq27xxx_battery_mutex_destroy (void *data) -{ -struct mutex *lock = data; - -mutex_destroy (lock); -} -int bq27xxx_battery_setup (struct bq27xxx_device_info *di) {struct power_supply_desc *psy_desc;
@@ -2168,9 +2161,7 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)int ret;INIT_DELAYED_WORK (&di->work, bq27xxx_battery_poll); -mutex_init (&di->lock); - ret =devm_add_action_or_reset (di->dev, bq27xxx_battery_mutex_destroy, - &di->lock); + ret =devm_mutex_init (di->dev, &di->lock);if (ret)return ret;
drivers/power/supply/mt6370-charger.c +1 -10
@@ -761,13 +761,6 @@ static int mt6370_chg_init_psy(struct mt6370_priv *priv)return PTR_ERR_OR_ZERO (priv->psy); } -static void mt6370_chg_destroy_attach_lock (void *data) -{ -struct mutex *attach_lock = data; - -mutex_destroy (attach_lock); -} -static void mt6370_chg_destroy_wq (void *data) {struct workqueue_struct *wq = data;
@@ -895,9 +888,7 @@ static int mt6370_chg_probe(struct platform_device *pdev)if (ret)return dev_err_probe (dev, ret,"Failed to init psy\n" ); -mutex_init (&priv->attach_lock); - ret =devm_add_action_or_reset (dev, mt6370_chg_destroy_attach_lock, - &priv->attach_lock); + ret =devm_mutex_init (dev, &priv->attach_lock);if (ret)return dev_err_probe (dev, ret,"Failed to init attach lock\n" );
drivers/power/supply/rt9467-charger.c +3 -30
@@ -1145,27 +1145,6 @@ static int rt9467_reset_chip(struct rt9467_chg_data *data)return regmap_field_write (data->rm_field[F_RST ],1 ); } -static void rt9467_chg_destroy_adc_lock (void *data) -{ -struct mutex *adc_lock = data; - -mutex_destroy (adc_lock); -} - -static void rt9467_chg_destroy_attach_lock (void *data) -{ -struct mutex *attach_lock = data; - -mutex_destroy (attach_lock); -} - -static void rt9467_chg_destroy_ichg_ieoc_lock (void *data) -{ -struct mutex *ichg_ieoc_lock = data; - -mutex_destroy (ichg_ieoc_lock); -} -static void rt9467_chg_complete_aicl_done (void *data) {struct completion *aicl_done = data;
@@ -1218,21 +1197,15 @@ static int rt9467_charger_probe(struct i2c_client *i2c)if (ret)return dev_err_probe (dev, ret,"Failed to add irq chip\n" ); -mutex_init (&data->adc_lock); - ret =devm_add_action_or_reset (dev, rt9467_chg_destroy_adc_lock, - &data->adc_lock); + ret =devm_mutex_init (dev, &data->adc_lock);if (ret)return dev_err_probe (dev, ret,"Failed to init ADC lock\n" ); -mutex_init (&data->attach_lock); - ret =devm_add_action_or_reset (dev, rt9467_chg_destroy_attach_lock, - &data->attach_lock); + ret =devm_mutex_init (dev, &data->attach_lock);if (ret)return dev_err_probe (dev, ret,"Failed to init attach lock\n" ); -mutex_init (&data->ichg_ieoc_lock); - ret =devm_add_action_or_reset (dev, rt9467_chg_destroy_ichg_ieoc_lock, - &data->ichg_ieoc_lock); + ret =devm_mutex_init (dev, &data->ichg_ieoc_lock);if (ret)return dev_err_probe (dev, ret,"Failed to init ICHG/IEOC lock\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 601/670 power: supply: bq27xxx: Ensure poll work is cancelled on remove
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit db560f4b1c5253853f978385db066220e0c218dc ]
The di->work poll work is queued from the poll callback itself and from bq27xxx_external_power_changed(). The cancel_delayed_work_sync() in bq27xxx_battery_teardown() runs while the power_supply is still registered, so external_power_changed() can re-arm the work after the cancel, and it runs after the driver data has been freed.
Register a devm_delayed_work_autocancel() before devm_power_supply_register(), so on unwind the power_supply is unregistered first, after which no new external_power_changed() callback can be dispatched, and the poll work is cancelled only then. Drop the now-redundant cancel from bq27xxx_battery_teardown().
This issue was found by an in-house static analysis tool.
--- drivers/power/supply/bq27xxx_battery.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/power/supply/bq27xxx_battery.c +7 -3
@@ -43,6 +43,7 @@*/ #include <linux/device.h> +#include <linux/devm-helpers.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/param.h>
@@ -2160,7 +2161,6 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) };int ret; -INIT_DELAYED_WORK (&di->work, bq27xxx_battery_poll); ret =devm_mutex_init (di->dev, &di->lock);if (ret)return ret;
@@ -2181,6 +2181,12 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) psy_desc->get_property = bq27xxx_battery_get_property; psy_desc->external_power_changed = bq27xxx_external_power_changed; +/* Cancel the poll work after the power_supply is unregistered. */ + ret =devm_delayed_work_autocancel (di->dev, &di->work, + bq27xxx_battery_poll); +if (ret) +return ret; + di->bat =devm_power_supply_register (di->dev, psy_desc, &psy_cfg);if (IS_ERR (di->bat)) return dev_err_probe(di->dev, PTR_ERR(di->bat),
@@ -2207,8 +2213,6 @@ void bq27xxx_battery_teardown(struct bq27xxx_device_info *di)mutex_lock (&di->lock); di->removed = true;mutex_unlock (&di->lock); - -cancel_delayed_work_sync (&di->work); }EXPORT_SYMBOL_GPL (bq27xxx_battery_teardown);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 602/670 drm/amd/pm: Revert state if force level fails
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 58893392989786eefd89aba48823dc3e27d37fd6 ]
Before forcing level, CG/PG is disabled or enabled depending on the new level. However if the force level operation fails, CG/PG state remains modified. Revert the state change on failure. Also, move invalid operation checks to the beginning before any logic that could change SOC state.
Stable-dep-of: ad6eb088a508 ("drm/amd/pm: reapply umd profile state after recovery")
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 58 +++++++++++++++++------------ 1 file changed, 35 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +35 -23
@@ -974,6 +974,24 @@ enum amd_dpm_forced_level amdgpu_dpm_get_performance_level(struct amdgpu_devicereturn level; } +static void amdgpu_dpm_enter_umd_state (struct amdgpu_device *adev) +{ +/* enter UMD Pstate */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_GFX , +AMD_PG_STATE_UNGATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_UNGATE ); +} + +static void amdgpu_dpm_exit_umd_state (struct amdgpu_device *adev) +{ +/* exit UMD Pstate */ +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_GATE ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_GFX , +AMD_PG_STATE_GATE ); +} +int amdgpu_dpm_force_performance_level (struct amdgpu_device *adev,enum amd_dpm_forced_level level) {
@@ -994,6 +1012,10 @@ int amdgpu_dpm_force_performance_level(struct amdgpu_device *adev,if (current_level == level)return 0 ; +if (!(current_level & profile_mode_mask) && + (level ==AMD_DPM_FORCED_LEVEL_PROFILE_EXIT )) +return -EINVAL ; +if (adev->asic_type ==CHIP_RAVEN ) {if (!(adev->apu_flags &AMD_APU_IS_RAVEN2 )) { if (current_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
@@ -1005,35 +1027,25 @@ int amdgpu_dpm_force_performance_level(struct amdgpu_device *adev, } } -if (!(current_level & profile_mode_mask) && - (level ==AMD_DPM_FORCED_LEVEL_PROFILE_EXIT )) -return -EINVAL ; - -if (!(current_level & profile_mode_mask) && - (level & profile_mode_mask)) { -/* enter UMD Pstate */ -amdgpu_device_ip_set_powergating_state (adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_PG_STATE_UNGATE ); -amdgpu_device_ip_set_clockgating_state (adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_CG_STATE_UNGATE ); - }else if ((current_level & profile_mode_mask) && - !(level & profile_mode_mask)) { -/* exit UMD Pstate */ -amdgpu_device_ip_set_clockgating_state (adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_CG_STATE_GATE ); -amdgpu_device_ip_set_powergating_state (adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_PG_STATE_GATE ); - } +if (!(current_level & profile_mode_mask) && (level & profile_mode_mask)) +amdgpu_dpm_enter_umd_state (adev); +else if ((current_level & profile_mode_mask) && + !(level & profile_mode_mask)) +amdgpu_dpm_exit_umd_state (adev);mutex_lock (&adev->pm.mutex);if (pp_funcs->force_performance_level (adev->powerplay.pp_handle, level)) {mutex_unlock (&adev->pm.mutex); +/* If new level failed, retain the umd state as before */ +if (!(current_level & profile_mode_mask) && + (level & profile_mode_mask)) +amdgpu_dpm_exit_umd_state (adev); +else if ((current_level & profile_mode_mask) && + !(level & profile_mode_mask)) +amdgpu_dpm_enter_umd_state (adev); +return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 603/670 drm/amd/pm: reapply umd profile state after recovery
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Wang <[email protected]>
[ Upstream commit ad6eb088a508d927641c8a76d1ca7911dfb7c80b ]
Resume and full GPU reset retain the selected UMD profile level in driver state.
The GFX and PMFW state behind it is reinitialized.
Add a generic DPM reapply path after CG and PG restoration. It restores the UMD GFX state and asks the PM backend to replay the retained level.
v2:
- Reapply only GFX CG to preserve the profile-owned GFX PG reference.
- Fall back to AUTO when reapply fails without failing device recovery.
- Propagate PowerPlay DPM errors before accepting AUTO fallback.
- Limit workload-profile error reporting to the swSMU reapply path.
This covers:
- PCI runtime resume
- Full GPU reset recovery
- System resume, including S3 and s2idle
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 --- .../gpu/drm/amd/include/kgd_pp_interface.h | 2 + drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 85 ++++++++++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 1 + .../gpu/drm/amd/pm/powerplay/amd_powerplay.c | 33 +++++-- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 87 +++++++++++++++++-- 7 files changed, 201 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
@@ -3307,6 +3307,12 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)amdgpu_device_set_cg_state (adev,AMD_CG_STATE_GATE );amdgpu_device_set_pg_state (adev,AMD_PG_STATE_GATE ); + r =amdgpu_dpm_reapply_umd_profile (adev); +if (r) { +dev_err (adev->dev,"Failed to restore UMD profile state: %d\n" , r); +return r; + } +amdgpu_device_fill_reset_magic (adev); r =amdgpu_device_enable_mgpu_fan_boost ();
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -14
@@ -2838,19 +2838,6 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)return 0 ; } -static void amdgpu_restore_umd_profile_pstate_after_runpm (struct amdgpu_device *adev) -{ -enum amd_dpm_forced_level level; -uint32_t profile_mode_mask =AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD | -AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK | -AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK | -AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ; - - level =amdgpu_dpm_get_performance_level (adev); -if (level & profile_mode_mask) -amdgpu_asic_update_umd_stable_pstate (adev, true); -} -static int amdgpu_pmops_runtime_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
@@ -2896,7 +2883,6 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)if (adev->pm.rpm_mode ==AMDGPU_RUNPM_PX ) drm_dev->switch_power_state =DRM_SWITCH_POWER_ON ; -amdgpu_restore_umd_profile_pstate_after_runpm (adev); adev->in_runpm = false;return 0 ; }
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
@@ -372,6 +372,8 @@ struct amd_pm_funcs {int (*print_clock_levels)(void *handle,enum pp_clock_type type,char *buf);int (*emit_clock_levels)(void *handle,enum pp_clock_type type,char *buf,int *offset);int (*force_performance_level)(void *handle,enum amd_dpm_forced_level level); +int (*reapply_performance_level)(void *handle, +enum amd_dpm_forced_level level);int (*get_sclk_od)(void *handle);int (*set_sclk_od)(void *handle,uint32_t value);int (*get_mclk_od)(void *handle);
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +85 -0
91 lines not on this page · raw message
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -0
@@ -480,6 +480,7 @@ void amdgpu_dpm_set_power_state(struct amdgpu_device *adev,enum amd_dpm_forced_level amdgpu_dpm_get_performance_level (struct amdgpu_device *adev);int amdgpu_dpm_force_performance_level (struct amdgpu_device *adev,enum amd_dpm_forced_level level); +int amdgpu_dpm_reapply_umd_profile (struct amdgpu_device *adev);int amdgpu_dpm_get_pp_num_states (struct amdgpu_device *adev,struct pp_states_info *states); int amdgpu_dpm_dispatch_task(struct amdgpu_device *adev,
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +28 -5
@@ -383,24 +383,46 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr, } } -static int pp_dpm_force_performance_level (void *handle, -enum amd_dpm_forced_level level) +static int pp_dpm_apply_performance_level (struct pp_hwmgr *hwmgr, +enum amd_dpm_forced_level level, +bool reapply) { -struct pp_hwmgr *hwmgr = handle; +int ret;if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; -if (level == hwmgr->dpm_level) +if (!reapply && level == hwmgr->dpm_level)return 0 ;pp_dpm_en_umd_pstate (hwmgr, &level); hwmgr->request_dpm_level = level; -hwmgr_handle_task (hwmgr,AMD_PP_TASK_READJUST_POWER_STATE ,NULL ); + ret =hwmgr_handle_task (hwmgr,AMD_PP_TASK_READJUST_POWER_STATE ,NULL ); +if (ret) +return ret; + + ret =phm_force_dpm_levels (hwmgr, level); +if (ret) +return ret; + + hwmgr->dpm_level = level;return 0 ; } +static int pp_dpm_force_performance_level (void *handle, +enum amd_dpm_forced_level level) +{ +return pp_dpm_apply_performance_level (handle, level, false); +} + +static int +pp_dpm_reapply_performance_level (void *handle, +enum amd_dpm_forced_level level) +{ +return pp_dpm_apply_performance_level (handle, level, true); +} +static enum amd_dpm_forced_level pp_dpm_get_performance_level (void *handle) {
@@ -1583,6 +1605,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .load_firmware = pp_dpm_load_fw, .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete, .force_performance_level = pp_dpm_force_performance_level, + .reapply_performance_level = pp_dpm_reapply_performance_level, .get_performance_level = pp_dpm_get_performance_level, .get_current_power_state = pp_dpm_get_current_power_state, .dispatch_tasks = pp_dpm_dispatch_tasks,
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +79 -8
139 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 604/670 fs: rotate inodes whose page cache could not be dropped
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaos Karaolidis <[email protected]>
[ Upstream commit 8ee09f597763acfd31c62a578ba88b792fc41b24 ]
When inode_lru_isolate() drops the page cache of an unused inode, it has to unlock the list, so it returns LRU_RETRY and the walk restarts at the head of the list, where the inode still is. If invalidate_mapping_pages() could not empty the mapping, the restarted walk strips the same inode again, and so on until nr_to_walk runs out. Every walk of that list then ends on this inode, and nothing behind it is reclaimed for as long as its cache stays.
Before commit 2a0629834cd8 ("vfs: Don't evict inode under the inode lru traversing context") the walker pinned the inode with a reference, and dropping it in iput_final() set I_REFERENCED, so the restarted walk rotated the inode to the tail. Set I_REFERENCED again when the mapping is still populated after the invalidation, in the same i_lock section that clears I_LRU_ISOLATING. inode_unpin_lru_isolating() now expects i_lock to be held, like inode_pin_lru_isolating().
On CONFIG_HIGHMEM kernels this can happen to any unused inode: a folio is left behind if it is locked, under writeback, spliced into a pipe, or still in another CPU's LRU-add batch after being read. Without HIGHMEM it happens to DAX inodes whose only entry is at index 0, which mapping_shrinkable() lets onto the LRU and invalidate_mapping_pages() never removes.
--- fs/inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/inode.c +7 -2
@@ -502,12 +502,11 @@ static void inode_pin_lru_isolating(struct inode *inode)static void inode_unpin_lru_isolating (struct inode *inode) { -spin_lock (&inode->i_lock); +lockdep_assert_held (&inode->i_lock);WARN_ON (!(inode->i_state &I_LRU_ISOLATING )); inode->i_state &= ~I_LRU_ISOLATING ;/* Called with inode->i_lock which ensures memory ordering. */ inode_wake_up_bit (inode, __I_LRU_ISOLATING); -spin_unlock (&inode->i_lock); }static void inode_wait_for_lru_isolating (struct inode *inode)
@@ -930,7 +929,13 @@ static enum lru_status inode_lru_isolate(struct list_head *item,__count_vm_events (PGINODESTEAL , reap);mm_account_reclaimed_pages (reap); } + +spin_lock (&inode->i_lock); +/* The walk restarts here: don't retry leftovers right away */ +if (!mapping_empty (&inode->i_data)) + inode->i_state |=I_REFERENCED ;inode_unpin_lru_isolating (inode); +spin_unlock (&inode->i_lock);spin_lock (lru_lock);return LRU_RETRY ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 605/670 amdkfd: Fix memory availability double accounting of kfd pinned objects
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Phillips <[email protected]>
[ Upstream commit 16df12d7158fb55f20d6e985abd1996cbabab9f8 ]
Pinned objects that are not kfd objects reduce the total vram available to kfd, so we subtract the total size of pinned objects from kdf vram availability. However this double counts objects pinned by kfd itself, because they are counted both as used and pinned. So track the total size of objects pinned by kfd and add it back to kfd availability to remove the double accounting.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -103,6 +103,7 @@ struct amdgpu_kfd_dev {struct kfd_dev *dev;int64_t vram_used[MAX_XCP ];uint64_t vram_used_aligned[MAX_XCP ]; +atomic64_t vram_pinned;bool init_complete;struct work_struct reset_work;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +11 -0
@@ -1500,6 +1500,11 @@ static int amdgpu_amdkfd_gpuvm_pin_bo(struct amdgpu_bo *bo, u32 domain)pr_err ("Error in Pinning BO to domain: %d\n" , domain);amdgpu_bo_sync_wait (bo,AMDGPU_FENCE_OWNER_KFD , false); + +if (!ret && bo->tbo.resource->mem_type ==TTM_PL_VRAM ) +atomic64_add (amdgpu_bo_size (bo), + &amdgpu_ttm_adev (bo->tbo.bdev)->kfd.vram_pinned); + out:amdgpu_bo_unreserve (bo);return ret;
@@ -1522,6 +1527,11 @@ static void amdgpu_amdkfd_gpuvm_unpin_bo(struct amdgpu_bo *bo)return ;amdgpu_bo_unpin (bo); + +if (bo->tbo.resource->mem_type ==TTM_PL_VRAM ) +atomic64_sub (amdgpu_bo_size (bo), + &amdgpu_ttm_adev (bo->tbo.bdev)->kfd.vram_pinned); +amdgpu_bo_unreserve (bo); }
@@ -1681,6 +1691,7 @@ size_t amdgpu_amdkfd_get_available_memory(struct amdgpu_device *adev, vram_available =KFD_XCP_MEMORY_SIZE (adev, xcp_id) - adev->kfd.vram_used_aligned[xcp_id] -atomic64_read (&adev->vram_pin_size) + +atomic64_read (&adev->kfd.vram_pinned) - reserved_for_pt - reserved_for_ras;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 606/670 fuse: dont drop destination page cache on a zero byte copy reply
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joanne Koong <[email protected]>
[ Upstream commit f7585e1ce3418ec282485854b3d8d31c6a961e37 ]
__fuse_copy_file_range() clears the destination page cache after the server replies:
truncate_inode_pages_range(inode_out->i_mapping, ALIGN_DOWN(pos_out, PAGE_SIZE), ALIGN(pos_out + bytes_copied, PAGE_SIZE) - 1);
A server may legitimately reply that it copied nothing, eg if the source file turns out to be shorter than the size the kernel has cached for it.
If pos_out is 0 as well, the end of the range is ALIGN(0, PAGE_SIZE) - 1, which is -1. lend is a uoff_t and truncate_inode_pages_range() takes -1 as its end of file sentinel, so rather than clearing nothing it drops every folio in the destination mapping.
That is not only a cache drop. truncate_cleanup_folio() calls folio_cancel_dirty(), and fuse_writeback_range() only wrote back [pos_out, pos_out + len - 1], so dirty data elsewhere in the destination file is discarded without ever reaching the server.
Skip the call when the server copied nothing, since there is nothing stale to clear in that case.
--- fs/fuse/file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/fuse/file.c +5 -3
@@ -3348,9 +3348,11 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,if (err) goto out; -truncate_inode_pages_range (inode_out->i_mapping, -ALIGN_DOWN (pos_out,PAGE_SIZE ), -ALIGN (pos_out + outarg.size,PAGE_SIZE ) -1 ); +if (outarg.size) +truncate_inode_pages_range (inode_out->i_mapping, +ALIGN_DOWN (pos_out,PAGE_SIZE ), +ALIGN (pos_out + outarg.size, +PAGE_SIZE ) -1 );file_update_time (file_out);fuse_write_update_attr (inode_out, pos_out + outarg.size, outarg.size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 607/670 mm/vma: dont leak the commit charge on mmap failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit aa09311c40f6d3aa6037065e17d257ffa48b9402 ]
Patch series "mm: various (urgent?) fixes", v1.
Here are various MM fixes. The majority was reported by Josef at Anthrophic, the remainder was found while reviewing/overhauling them.
Two issues/fixes reported are not included, as we are discussing (better) alternatives on the list already.
I left most of the original commit messages as schloppy as they are: I don't particularly care as long as the code is in good shape and as long as they are not actively wrong. But I (and Mike) could not be stopped from overhauling at least some of them.
While I don't think there is anything too critical in here, I think this is a good opportunity to see how fast we can get pre-screened/pre-reviewed fixes upstream that might be security-related.
The majority are hugetlb + uffd issues, that are not actually that relevant for most installations. But all things that should just get fixed. Some uffd fixes need proper follow ups to fix some more of the root causes of leftover UFFD PTE bits (or proof that there are none remaining).
This patch (of 10):
When an accountable mapping replaces existing mappings (MAP_FIXED), __mmap_setup() only charges the difference between the size of the new mapping and the VM_ACCOUNT pages it replaces. It then zeroes vms->nr_accounted so that unmapping the old VMAs does not return their charge, which now backs the new mapping.
If the operation fails after that point, the error path returns map->charged, i.e. only the difference. By then vms_clean_up_area() has zapped the page tables and closed the old VMAs, so vms_abort_munmap_vmas() cannot reattach them. It leaves a gap and finishes the unmap with vms_complete_munmap_vmas(), which uncharges vms->nr_accounted == 0 pages. The old VMAs are gone, the new one was never created, and the charge of the old ones is never returned, not even when the process exits.
No privilege is needed to hit this, only a file whose mmap hook fails, for example a socket (sock_no_mmap() returns -ENODEV):
p = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); mmap(p, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, socket_fd, 0);
Every iteration adds len to Committed_AS for good. With vm.overcommit_memory=2 this lets any user make all further accountable allocations in the system fail with -ENOMEM.
Once the new mapping has taken over the charge of the mappings it replaces, it owns the charge for all of its pages. Record that in map->charged, so that the error path returns all of it.
A failure in __mmap_setup() itself is not affected: it happens before the charge is taken over and the old VMAs are reattached with their charge intact.
Original fix generated by an LLM and sent in private by Josef.
--- mm/mmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
mm/mmap.c +7 -4
@@ -1415,14 +1415,17 @@ static unsigned long __mmap_region(struct file *file, unsigned long addr,* Private writable mapping: check memory availability */ if (accountable_mapping (file, vm_flags)) { - charged = pglen; - charged -= vms.nr_accounted; -if (charged) { - error =security_vm_enough_memory_mm (mm, charged); +const unsigned long uncharged = pglen - vms.nr_accounted; + +/* Charge only what's not already charged by mappings we replace. */ +if (uncharged) { + error =security_vm_enough_memory_mm (mm, uncharged);if (error) goto abort_munmap; } +/* Our new mapping owns the entire charge now. */ + charged = pglen; vms.nr_accounted =0 ; vm_flags |=VM_ACCOUNT ; vmg.flags = vm_flags;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 608/670 mm/hugetlb: charge folios to the target mms memcg
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinmeng Zhou <[email protected]>
[ Upstream commit c2deb1356d82c9d54bd2fcf1241cc97eb66fd81f ]
HugeTLB folios are currently charged to the memcg of the allocating task. This gives the wrong result when a userfaultfd handler populates a HugeTLB VMA that belongs to another process. The UFFDIO_COPY ioctl operates on the userfaultfd context's mm, but get_mem_cgroup_from_current() charges the folio to the handler's memcg instead.
This can be reproduced by placing the faulting process and its userfaultfd handler in different memory cgroups. Have the target process register a HugeTLB mapping with userfaultfd, trigger a missing fault, and let the handler resolve it with UFFDIO_COPY. The hugepage usage is then reported in the handler's memory.current instead of the target's.
The generic userfaultfd population path avoids this problem by charging folios to dst_vma->vm_mm.
Pass the target mm through hugetlb_alloc_folio() and charge the folio by using get_mem_cgroup_from_mm(). This preserves the existing charge timing and error handling while making HugeTLB userfaultfd population consistent with the generic path.
--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
@@ -3043,7 +3043,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,bool deferred_reserve;gfp_t gfp =htlb_alloc_mask (h) | __GFP_RETRY_MAYFAIL; - memcg =get_mem_cgroup_from_current (); + memcg =get_mem_cgroup_from_mm (vma->vm_mm); memcg_charge_ret =mem_cgroup_hugetlb_try_charge (memcg, gfp, nr_pages);if (memcg_charge_ret == -ENOMEM ) {mem_cgroup_put (memcg);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 609/670 ASoC: hdac_hda: Allocate the private data at codec driver bind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 7d357eae973a1e1933f81f55aa1b3b4e3064570f ]
The SOF HDA code allocates struct hdac_hda_priv and stores it as drvdata of the codec device before the codec driver is bound. The driver core clears drvdata on unbind, so after unbinding the codec driver via sysfs a subsequent bind dereferences a NULL pointer in hdac_hda_dev_probe().
All information in the private data can be derived from the codec device itself, so allocate and set it up in hdac_hda_dev_probe() as a device managed resource, which is released on unbind.
Remove the allocation from SOF, keeping the check for iDisp codecs without display audio component.
Stable-dep-of: 08a44bde821d ("ASoC: hdac_hda: Restore the codec device type on unbind")
--- sound/soc/codecs/hdac_hda.c | 13 ++++++++++++- sound/soc/sof/intel/hda-codec.c | 23 ++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-)
sound/soc/codecs/hdac_hda.c +12 -1
@@ -637,10 +637,21 @@ static const struct snd_soc_component_driver hdac_hda_hdmi_codec = {static int hdac_hda_dev_probe (struct hdac_device *hdev) { -struct hdac_hda_priv *hda_pvt =dev_get_drvdata (&hdev->dev); +struct hdac_hda_priv *hda_pvt;struct hdac_ext_link *hlink;int ret; + hda_pvt =devm_kzalloc (&hdev->dev,sizeof (*hda_pvt),GFP_KERNEL ); +if (!hda_pvt) +return -ENOMEM ; + + hda_pvt->codec =dev_to_hda_codec (&hdev->dev); + hda_pvt->dev_index = hdev->addr; +/* Intel iDisp (HDMI/DP) codec */ +if (((hdev->vendor_id >>16 ) &0xFFFF ) ==0x8086 ) + hda_pvt->need_display_power = true; +dev_set_drvdata (&hdev->dev, hda_pvt); +/* hold the ref while we probe */ hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {
sound/soc/sof/intel/hda-codec.c +4 -19
@@ -15,8 +15,6 @@#include "hda.h" #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC ) -#include "../../codecs/hdac_hda.h" -#define CODEC_PROBE_RETRIES 3#define IDISP_VID_INTEL 0x80860000
@@ -148,7 +146,6 @@ static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr, i/* probe individual codec */ static int hda_codec_probe (struct snd_sof_dev *sdev,int address) { -struct hdac_hda_priv *hda_priv;struct hda_bus *hbus =sof_to_hbus (sdev);struct hda_codec *codec; u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) |
@@ -168,27 +165,15 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)dev_dbg (sdev->dev,"HDA codec #%d probed OK: response: %x\n" , address, resp); - hda_priv =devm_kzalloc (sdev->dev,sizeof (*hda_priv),GFP_KERNEL ); -if (!hda_priv) -return -ENOMEM ; - codec =hda_codec_device_init (&hbus->core, address,HDA_DEV_LEGACY ); ret =PTR_ERR_OR_ZERO (codec);if (ret <0 )return ret; - hda_priv->codec = codec; - hda_priv->dev_index = address; -dev_set_drvdata (&codec->core.dev, hda_priv); - -if ((resp &0xFFFF0000 ) ==IDISP_VID_INTEL ) { -if (!hbus->core.audio_component) { -dev_dbg (sdev->dev, -"iDisp hw present but no driver\n" ); - ret = -ENOENT ; - goto out; - } - hda_priv->need_display_power = true; +if ((resp &0xFFFF0000 ) ==IDISP_VID_INTEL && !hbus->core.audio_component) { +dev_dbg (sdev->dev,"iDisp hw present but no driver\n" ); + ret = -ENOENT ; + goto out; }if (is_generic_config (hbus))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 610/670 ASoC: hdac_hda: Restore the codec device type on unbind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 08a44bde821d4fe22c0b6e63da04b3c59ac243a8 ]
hdac_hda_codec_probe() changes the type of the codec device to HDA_DEV_ASOC to prevent snd_hda_codec_unregister() from unregistering the device when the card is freed.
The type is never restored, and hda_bus_match() requires the device and driver types to be equal. After unbinding the codec driver via sysfs the HDA_DEV_LEGACY codec drivers no longer match the device and bind fails with -ENODEV.
Restore HDA_DEV_LEGACY with a device managed action registered before the component, so it runs after the component and the card are gone.
--- sound/soc/codecs/hdac_hda.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/codecs/hdac_hda.c +12 -0
@@ -635,6 +635,13 @@ static const struct snd_soc_component_driver hdac_hda_hdmi_codec = { .endianness = 1, }; +static void hdac_hda_restore_dev_type (void *data) +{ +struct hdac_device *hdev = data; + + hdev->type =HDA_DEV_LEGACY ; +} +static int hdac_hda_dev_probe (struct hdac_device *hdev) {struct hdac_hda_priv *hda_pvt;
@@ -652,6 +659,11 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) hda_pvt->need_display_power = true;dev_set_drvdata (&hdev->dev, hda_pvt); +/* Allow the legacy codec driver to match again after unbind */ + ret =devm_add_action (&hdev->dev, hdac_hda_restore_dev_type, hdev); +if (ret) +return ret; +/* hold the ref while we probe */ hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 611/670 mm/zswap: publish the initial pool with list_add_rcu()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longlong Xia <[email protected]>
[ Upstream commit c1dd5e24a82d19bff8eef50ba8205d4776584aff ]
zswap_setup() publishes the pool on the zswap_pools list with a plain list_add(), but the list is walked by concurrent RCU readers holding nothing but rcu_read_lock() through zswap_total_pages(), e.g. /proc/meminfo and the shrinker count path.
CPU 0 (writer) CPU 1 (reader)
-------------- --------------
zswap_pool_create():
pool->zs_pool = zs_create_pool(); (1)
list_add() -> __list_add():
WRITE_ONCE(zswap_pools.next,
&pool->list); (2) zswap_total_pages():
pool = READ_ONCE( (a)
zswap_pools.next);
zs_get_total_pages( (b)
pool->zs_pool);If (2) becomes visible to CPU 1 before (1), CPU 1 finds the pool at (a) but dereferences a wild pointer at (b). Publish the node with list_add_rcu().
--- mm/zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
@@ -1778,7 +1778,7 @@ static int zswap_setup(void)if (pool) {pr_info ("loaded using pool %s/%s\n" , pool->tfm_name,zpool_get_type (pool->zpool)); -list_add (&pool->list, &zswap_pools); +list_add_rcu (&pool->list, &zswap_pools); zswap_has_pool = true; }else {pr_err ("pool creation failed\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 612/670 mm/page_isolation: fix UBSAN shift-out-of-bounds warning
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Xi <[email protected]>
[ Upstream commit eba0e6297edd60a85bc96ff5cfb734d066af62dd ]
Patch series "mm/page_isolation: fix UBSAN shift-out-of-bounds in isolate_single_pageblock", v3.
Patch 1 fixes a UBSAN shift-out-of-bounds warning in the PageBuddy branch of isolate_single_pageblock() triggered by concurrent buddy allocation.
Patch 2 addresses the same class of issue in the PageCompound branch, where racy compound_order() and compound_head() reads could lead to out-of-range shifts or incorrect page skipping.
This patch (of 2):
A contig-range allocation racing with buddy allocation on the adjacent pageblock can trigger:
UBSAN: shift-out-of-bounds in mm/page_isolation.c:393:15 shift exponent -749042176 is negative Call trace: isolate_single_pageblock start_isolate_page_range alloc_contig_frozen_range_noprof alloc_contig_range_noprof
isolate_single_pageblock() first calls set_migratetype_isolate() with zone->lock held, which marks the pageblock MIGRATE_ISOLATE and moves any free page straddling the boundary out of the way. Once the lock is dropped, it scans the MAX_ORDER_NR_PAGES-aligned window [start_pfn, boundary_pfn) locklessly, only to skip the free pages already handled above and to detect in-use pages straddling the boundary. Since this scan only reads page state to decide how far to skip and returns -EBUSY on a straddling in-use page, it does not take the lock.
The window also covers the adjacent pageblock, whose free pages stay on the normal movable/CMA freelist and can be allocated concurrently. So after the scan observes PageBuddy(page), another CPU can allocate the page, leaving a stale value in page->private that makes "1 << order" shift out of range.
Use buddy_order_unsafe() with READ_ONCE to read the order, and validate it is within MAX_PAGE_ORDER before shifting to prevent UBSAN warnings.
Since pageblock_isolate_and_move_free_pages() already handles free pages straddling boundary_pfn under zone->lock, bail out with -EBUSY instead of VM_WARN_ON_ONCE() when a PageBuddy page appears to cross the boundary during the lockless scan.
--- mm/page_isolation.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
mm/page_isolation.c +12 -6
@@ -376,13 +376,19 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, }if (PageBuddy (page)) { -int order =buddy_order (page); +unsigned int order =buddy_order_unsafe (page); -/* move_freepages_block_isolate() handled this */ -VM_WARN_ON_ONCE (pfn + (1 << order) > boundary_pfn); - - pfn +=1UL << order; -continue ; +/* buddy_order_unsafe() is racy. Validate the order before shifting. */ +if (order <=MAX_PAGE_ORDER && +/* +* move_freepages_block_isolate() splits +* cross-boundary PageBuddy, verify it. +*/ + pfn + (1UL << order) <= boundary_pfn) { + pfn +=1UL << order; +continue ; + } + goto failed; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 613/670 fs: dont lose inodes that another LRU walker is isolating
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaos Karaolidis <[email protected]>
[ Upstream commit 8dc4116041e2b377e5e1b62ba98b37636f9f3968 ]
When inode_lru_isolate() finds an unused inode that still has page cache, it sets I_LRU_ISOLATING, drops i_lock and the list_lru lock, invalidates the page cache, clears the flag again and returns LRU_RETRY so that the restarted walk can free the inode.
Another walker of the same list can reach the inode in that window. It sees a non-zero i_state and takes the inode off the LRU, as it would an inode that is in use. Page cache deletion requeues the inode once the mapping is shrinkable, so this is harmless if it happens before the last deletion. If it happens after, nothing puts the inode
back: it stays in memory, unused, clean and without page cache, out of reach of the shrinker and of drop_caches, until it is looked up again or the filesystem is unmounted.
Before commit 2a0629834cd8 ("vfs: Don't evict inode under the inode lru traversing context") the pin was an i_count reference, and the final iput() put the inode back on the LRU.
Skip inodes that are being isolated and leave them to the walker that pinned them, which restarts its walk once it has unpinned them.
The window is reached by any unused inode with page cache on CONFIG_HIGHMEM kernels, and otherwise by inodes whose page cache is a single shadow entry at index 0. On an i386 HIGHMEM guest, eight concurrent "echo 2 > /proc/sys/vm/drop_caches" over 2000 freshly read one-page ext4 files leave roughly 400 of the inodes off the LRU per round; on x86_64, with the files' pages first evicted through memory.reclaim, 3 to 4 per round. With this patch, none in either case.
--- fs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/inode.c +6 -0
@@ -889,6 +889,12 @@ static enum lru_status inode_lru_isolate(struct list_head *item,if (!spin_trylock (&inode->i_lock))return LRU_SKIP ; +/* Another walker is dropping its page cache, leave it to that one */ +if (inode->i_state &I_LRU_ISOLATING ) { +spin_unlock (&inode->i_lock); +return LRU_SKIP ; + } +/* * Inodes can get referenced, redirtied, or repopulated while * they're already on the LRU, and this can make them
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 614/670 LoongArch: Fix one-shot limitation for perf hardware breakpoints
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit 5e0b00fd000a53a5428fed6c96be74019bd0ad17 ]
In breakpoint_handler() and watchpoint_handler(), the code disables the hardware slot by executing update_bp_registers(regs, 0, ...). This design forces the active hardware breakpoint configuration to be wiped out upon its first hit, turning standard perf hardware breakpoints into "one-shot" events.
Furthermore, while the ptrace single-step path in do_watch() executes a hardware single-step skip mechanism to advance the PC, the standard perf path lacks any mechanism to bypass the original triggering instruction.
To maintain the long-term persistence of hardware breakpoints for perf usage, eliminate the disruptive calls to update_bp_registers() within the handler loops to keep the breakpoint configuration enabled.
Concurrently, execute a single, unified register write outside the loop to atomize the state transition and explicitly enforce the hardware skip mechanism once per exception return, ensuring the processor safely steps forward without lockups.
Meanwhile, in order to prevent status contamination during single-core context switches or cross-core thread migrations, the hardware register skip state of the previous thread is saved first. Then, the skip state is restored and its software skip flag is also cleared only if the next thread has the skip flag; otherwise, 0 is written to clear the FWPS and MWPS registers, which explicitly clears the skip bit according to the architectural specification.
Additionally, explicitly clear hbp_break_skip and hbp_watch_skip inside ptrace_hw_copy_thread() which is called by copy_thread() during the task creation. This guarantees that a newly cloned child task starts with a clean slate.
Here is a user-space reproducer to demonstrate the issue.
(1) Test program (test_perf_continuous.c):
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <linux/perf_event.h>
#include <linux/hw_breakpoint.h>
static int var = 0;
int main(void)
{
size_t count = 0;
struct perf_event_attr attr = {
.type = PERF_TYPE_BREAKPOINT,
.size = sizeof(attr),
.bp_type = HW_BREAKPOINT_W,
.bp_addr = (unsigned long)&var,
.bp_len = HW_BREAKPOINT_LEN_1,
.exclude_kernel = 1,
};
int fd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
asm volatile("st.b %1, %0" : "=m"(var) : "r"(11) : "memory");
asm volatile("st.b %1, %0" : "=m"(var) : "r"(22) : "memory");
asm volatile("st.b %1, %0" : "=m"(var) : "r"(33) : "memory");
ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
read(fd, &count, sizeof(size_t));
printf("Watchpoint counts: expected = 3, actual = %zu\n", count);
close(fd);
return 0;
}(2) Test steps:
$ gcc test_perf_continuous.c -o test_perf_continuous $ ./test_perf_continuous
(3) Test results:
Without this patch:
Watchpoint counts: expected = 3, actual = 1
With this patch:
Watchpoint counts: expected = 3, actual = 3
--- arch/loongarch/include/asm/hw_breakpoint.h | 4 +-- arch/loongarch/include/asm/loongarch.h | 3 ++ arch/loongarch/include/asm/processor.h | 1 + arch/loongarch/include/asm/switch_to.h | 2 +- arch/loongarch/kernel/hw_breakpoint.c | 39 +++++++++++++++++++--- 5 files changed, 41 insertions(+), 8 deletions(-)
arch/loongarch/include/asm/hw_breakpoint.h +2 -2
@@ -121,12 +121,12 @@ bool watchpoint_handler(struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT extern void ptrace_hw_copy_thread (struct task_struct *task); -extern void hw_breakpoint_thread_switch (struct task_struct *next); +extern void hw_breakpoint_thread_switch (struct task_struct *prev,struct task_struct *next);#else static inline void ptrace_hw_copy_thread (struct task_struct *task) { } -static inline void hw_breakpoint_thread_switch (struct task_struct *next) +static inline void hw_breakpoint_thread_switch (struct task_struct *prev,struct task_struct *next) { }#endif
arch/loongarch/include/asm/loongarch.h +3 -0
@@ -1069,6 +1069,9 @@#define CSR_FWPS_SKIP_SHIFT 16#define CSR_FWPS_SKIP (_ULCAST_(1) << CSR_FWPS_SKIP_SHIFT) +#define CSR_MWPS_SKIP_SHIFT 16 +#define CSR_MWPS_SKIP (_ULCAST_(1) << CSR_MWPS_SKIP_SHIFT) +/* * CSR_ECFG IM */
arch/loongarch/include/asm/processor.h +1 -0
@@ -138,6 +138,7 @@ struct thread_struct {struct loongarch_lbt lbt;/* Also conditionally copied */ /* Hardware breakpoints pinned to this task. */ +bool hbp_break_skip, hbp_watch_skip;struct perf_event *hbp_break[LOONGARCH_MAX_BRP ];struct perf_event *hbp_watch[LOONGARCH_MAX_WRP ]; };
arch/loongarch/include/asm/switch_to.h +1 -1
@@ -36,7 +36,7 @@ extern asmlinkage struct task_struct *__switch_to(struct task_struct *prev,do { \lose_fpu_inatomic (1 , prev); \lose_lbt_inatomic (1 , prev); \ -hw_breakpoint_thread_switch (next); \ +hw_breakpoint_thread_switch (prev, next); \ (last) =__switch_to (prev, next,task_thread_info (next), \__builtin_return_address (0 ),__builtin_frame_address (0 )); \ }while (0 )
arch/loongarch/kernel/hw_breakpoint.c +34 -5
@@ -156,6 +156,9 @@ static int hw_breakpoint_slot_setup(struct perf_event **slots, int max_slots,void ptrace_hw_copy_thread (struct task_struct *tsk) { + tsk->thread.hbp_break_skip =0 ; + tsk->thread.hbp_watch_skip =0 ; +memset (tsk->thread.hbp_break,0 ,sizeof (tsk->thread.hbp_break));memset (tsk->thread.hbp_watch,0 ,sizeof (tsk->thread.hbp_watch)); }
@@ -485,6 +488,7 @@ NOKPROBE_SYMBOL(update_bp_registers);bool breakpoint_handler (struct pt_regs *regs) {int i; +unsigned int clear_mask =0 ;bool need_sigtrap = false;struct perf_event *bp, **slots;
@@ -500,11 +504,13 @@ bool breakpoint_handler(struct pt_regs *regs)if (bp->attr.sigtrap) need_sigtrap = true; -csr_write32 (0x1 << i,LOONGARCH_CSR_FWPS ); -update_bp_registers (regs,0 ,0 ); + clear_mask |= (0x1 << i); } } +if (clear_mask) +csr_write32 (clear_mask |CSR_FWPS_SKIP ,LOONGARCH_CSR_FWPS ); +return need_sigtrap; }NOKPROBE_SYMBOL (breakpoint_handler);
@@ -512,6 +518,7 @@ NOKPROBE_SYMBOL(breakpoint_handler);bool watchpoint_handler (struct pt_regs *regs) {int i; +unsigned int clear_mask =0 ;bool need_sigtrap = false;struct perf_event *wp, **slots;
@@ -527,11 +534,13 @@ bool watchpoint_handler(struct pt_regs *regs)if (wp->attr.sigtrap) need_sigtrap = true; -csr_write32 (0x1 << i,LOONGARCH_CSR_MWPS ); -update_bp_registers (regs,0 ,1 ); + clear_mask |= (0x1 << i); } } +if (clear_mask) +csr_write32 (clear_mask |CSR_MWPS_SKIP ,LOONGARCH_CSR_MWPS ); +return need_sigtrap; }NOKPROBE_SYMBOL (watchpoint_handler);
@@ -555,7 +564,7 @@ static int __init arch_hw_breakpoint_init(void) }arch_initcall (arch_hw_breakpoint_init); -void hw_breakpoint_thread_switch (struct task_struct *next) +void hw_breakpoint_thread_switch (struct task_struct *prev,struct task_struct *next) {u64 addr, mask;struct pt_regs *regs =task_pt_regs (next);
@@ -567,6 +576,26 @@ void hw_breakpoint_thread_switch(struct task_struct *next)csr_write32 (CSR_FWPS_SKIP ,LOONGARCH_CSR_FWPS ); regs->csr_prmd |=CSR_PRMD_PWE ; }else { +unsigned int fwps =csr_read32 (LOONGARCH_CSR_FWPS ); +unsigned int mwps =csr_read32 (LOONGARCH_CSR_MWPS ); + + prev->thread.hbp_break_skip = !!(fwps &CSR_FWPS_SKIP ); + prev->thread.hbp_watch_skip = !!(mwps &CSR_MWPS_SKIP ); + +if (!next->thread.hbp_break_skip) +csr_write32 (0 ,LOONGARCH_CSR_FWPS ); +else { +csr_write32 (CSR_FWPS_SKIP ,LOONGARCH_CSR_FWPS ); + next->thread.hbp_break_skip =0 ; + } + +if (!next->thread.hbp_watch_skip) +csr_write32 (0 ,LOONGARCH_CSR_MWPS ); +else { +csr_write32 (CSR_MWPS_SKIP ,LOONGARCH_CSR_MWPS ); + next->thread.hbp_watch_skip =0 ; + } +/* Update breakpoints */ update_bp_registers (regs,1 ,0 );/* Update watchpoints */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 615/670 stackdepot: stop preallocating after the final pool
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Caleb Kan <[email protected]>
[ Upstream commit 8f56ea8e0706d92774603260779c7032f03ef3ac ]
depot_init_pool() decides whether another pool is needed before it increments pools_num. When it registers the last allowed pool, pools_num is still one below stack_max_pools, so the existing comparison clears new_pool.
With new_pool cleared, stack_depot_save_flags() can allocate another order-2 pool after a lookup miss. depot_keep_new_pool() retains its pointer in the global new_pool, so the allocation is not lost. However, pools_num has already reached stack_max_pools, and depot_init_pool() rejects every attempt to register the pool. It remains allocated and unusable until reboot. The non-NULL pointer prevents later saves from allocating more spare pools.
Account for the pool being registered in the limit check so registering the final pool installs STACK_DEPOT_POISON and prevents the extra allocation.
--- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c +1 -1
@@ -273,7 +273,7 @@ static bool depot_init_pool(void **prealloc)* NULL; do not reset to NULL if we have reached the maximum number of * pools. */ -if (pools_num <DEPOT_MAX_POOLS ) +if (pools_num +1 <DEPOT_MAX_POOLS )WRITE_ONCE (new_pool,NULL );else WRITE_ONCE (new_pool,STACK_DEPOT_POISON );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 616/670 ocfs2: fix oob in __ocfs2_find_path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit e0b0f2834c9bec51b1068de5cf5e10c7519143eb ]
syzbot constructed a corrupted image, which resulted in el->l_count from the b-tree extent block being 0. Since the length of the l_recs array depends on l_count, reading its member e_blkno triggered the out-of-bounds access reported by syzbot in [1].
The loop terminates when l_count is 0, similar to when next_free is 0.
[1]
UBSAN: array-index-out-of-bounds in fs/ocfs2/alloc.c:1838:11 index 0 is out of range for type 'struct ocfs2_extent_rec[] __counted_by(l_count)' (aka 'struct ocfs2_extent_rec[]') Call Trace: __ocfs2_find_path+0x606/0xa40 fs/ocfs2/alloc.c:1838 ocfs2_find_leaf+0xab/0x1c0 fs/ocfs2/alloc.c:1946 ocfs2_get_clusters_nocache+0x172/0xc60 fs/ocfs2/extent_map.c:418 ocfs2_get_clusters+0x505/0xa70 fs/ocfs2/extent_map.c:631 ocfs2_extent_map_get_blocks+0x202/0x6a0 fs/ocfs2/extent_map.c:678 ocfs2_read_virt_blocks+0x286/0x930 fs/ocfs2/extent_map.c:1001 ocfs2_read_dir_block fs/ocfs2/dir.c:521 [inline] ocfs2_find_entry_el fs/ocfs2/dir.c:728 [inline] ocfs2_find_entry+0x3e4/0x2090 fs/ocfs2/dir.c:1120 ocfs2_find_files_on_disk+0xdf/0x310 fs/ocfs2/dir.c:2023 ocfs2_lookup_ino_from_name+0x52/0x100 fs/ocfs2/dir.c:2045 _ocfs2_get_system_file_inode fs/ocfs2/sysfile.c:136 [inline] ocfs2_get_system_file_inode+0x326/0x770 fs/ocfs2/sysfile.c:112 ocfs2_init_global_system_inodes+0x319/0x660 fs/ocfs2/super.c:461 ocfs2_initialize_super fs/ocfs2/super.c:2196 [inline] ocfs2_fill_super+0x4432/0x65b0 fs/ocfs2/super.c:993 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1691 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline]
Stable-dep-of: 6193ce7896af ("ocfs2: fix array out of bound access in __ocfs2_find_path()")
--- fs/ocfs2/alloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/ocfs2/alloc.c +5 -4
@@ -1811,14 +1811,15 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci, ret = -EROFS ; goto out; } -if (le16_to_cpu (el->l_next_free_rec) ==0 ) { +if (!el->l_next_free_rec || !el->l_count) {ocfs2_error (ocfs2_metadata_cache_get_super (ci), -"Owner %llu has empty extent list at depth %u\n" , +"Owner %llu has empty extent list at depth %u\n" +"(next free=%u count=%u)\n" , (unsigned long long )ocfs2_metadata_cache_owner (ci), -le16_to_cpu (el->l_tree_depth)); +le16_to_cpu (el->l_tree_depth), +le16_to_cpu (el->l_next_free_rec),le16_to_cpu (el->l_count)); ret = -EROFS ; goto out; - }for (i =0 ; i <le16_to_cpu (el->l_next_free_rec) -1 ; i++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 617/670 ocfs2: fix array out of bound access in __ocfs2_find_path()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giorgi Kobakhia <[email protected]>
[ Upstream commit 6193ce7896afb52a321a0063c8b6a45e477a84e2 ]
__ocfs2_find_path() walks down the extent tree and records path by calling find_path_ins(), which appends entry to path->p_node[]. It only has 5 spots.
A corrupted ocfs2 image whose extent block is pointing to itself causes __ocfs2_find_path() descent endlessly, writing past the end of path->p_node[] array.
UBSAN: array-index-out-of-bounds in fs/ocfs2/alloc.c:677:14 index 5 is out of range for type 'ocfs2_path_item [5]' Call Trace: <TASK> find_path_ins (fs/ocfs2/alloc.c:677 fs/ocfs2/alloc.c:1914) __ocfs2_find_path.constprop.0 (fs/ocfs2/alloc.c:1882) ocfs2_commit_truncate (fs/ocfs2/alloc.c:1924 fs/ocfs2/alloc.c:7286) ocfs2_truncate_file (fs/ocfs2/file.c:515) ocfs2_setattr (fs/ocfs2/file.c:1224) notify_change (fs/attr.c:556) do_truncate (fs/open.c:68) do_ftruncate (fs/open.c:194 (discriminator 1)) ksys_ftruncate (fs/open.c:206) __x64_sys_ftruncate (fs/open.c:211 fs/open.c:209 fs/open.c:209)
Commit a406aff8c051 ("ocfs2: validate l_tree_depth to avoid out-of-bounds access") already restricts el->l_tree_depth to be less than OCFS2_MAX_PATH_DEPTH, which is equal to 5. However, does not handle the infinite descent case.
Check if the el->l_tree_depth decreases on each descent. Maximum descents are restricted to 4 and the path->p_node[] array does not overflow.
--- fs/ocfs2/alloc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ocfs2/alloc.c +6 -3
@@ -1796,6 +1796,7 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci,int i, ret =0 ;u32 range;u64 blkno; +u32 prev_depth =OCFS2_MAX_PATH_DEPTH ;struct buffer_head *bh =NULL ;struct ocfs2_extent_block *eb;struct ocfs2_extent_list *el;
@@ -1803,14 +1804,16 @@ static int __ocfs2_find_path(struct ocfs2_caching_info *ci, el = root_el;while (el->l_tree_depth) { -if (unlikely (le16_to_cpu (el->l_tree_depth) >=OCFS2_MAX_PATH_DEPTH )) { +if (unlikely (le16_to_cpu (el->l_tree_depth) >= prev_depth)) {ocfs2_error (ocfs2_metadata_cache_get_super (ci), -"Owner %llu has invalid tree depth %u in extent list\n" , +"Owner %llu has invalid tree depth %u in extent list (max %u)\n" , (unsigned long long )ocfs2_metadata_cache_owner (ci), -le16_to_cpu (el->l_tree_depth)); +le16_to_cpu (el->l_tree_depth), prev_depth -1 ); ret = -EROFS ; goto out; } + prev_depth =le16_to_cpu (el->l_tree_depth); +if (!el->l_next_free_rec || !el->l_count) {ocfs2_error (ocfs2_metadata_cache_get_super (ci), "Owner %llu has empty extent list at depth %u\n"
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 618/670 PCI: cadence: Store the core controller in platform drvdata
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linmao Li <[email protected]>
[ Upstream commit cfe96ce583c51bf6e034d4038c652a1e8227867c ]
cdns_plat_pcie_probe() stores a struct cdns_plat_pcie pointer with platform_set_drvdata(). cdns_plat_pcie_shutdown() and the callbacks in cdns_pcie_pm_ops retrieve the same pointer with dev_get_drvdata() but use it as a struct cdns_pcie pointer. This makes them read phy_count and phy beyond the wrapper.
struct cdns_plat_pcie only contains a pointer to struct cdns_pcie. Drop the redundant wrapper and store the struct cdns_pcie pointer directly.
--- .../controller/cadence/pcie-cadence-plat.c | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-plat.c +11 -22
@@ -14,14 +14,6 @@#define CDNS_PLAT_CPU_TO_BUS_ADDR 0x0FFFFFFF -/** -* struct cdns_plat_pcie - private data for this PCIe platform driver -* @pcie: Cadence PCIe controller -*/ -struct cdns_plat_pcie { -struct cdns_pcie *pcie; -}; -struct cdns_plat_pcie_of_data {bool is_rc; };
@@ -40,9 +32,9 @@ static const struct cdns_pcie_ops cdns_plat_ops = {static int cdns_plat_pcie_probe (struct platform_device *pdev) {const struct cdns_plat_pcie_of_data *data; -struct cdns_plat_pcie *cdns_plat_pcie;struct device *dev = &pdev->dev;struct pci_host_bridge *bridge; +struct cdns_pcie *pcie;struct cdns_pcie_ep *ep;struct cdns_pcie_rc *rc;int phy_count;
@@ -56,11 +48,6 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) is_rc = data->is_rc;pr_debug (" Started %s with is_rc: %d\n" , __func__, is_rc); - cdns_plat_pcie =devm_kzalloc (dev,sizeof (*cdns_plat_pcie),GFP_KERNEL ); -if (!cdns_plat_pcie) -return -ENOMEM ; - -platform_set_drvdata (pdev, cdns_plat_pcie);if (is_rc) {if (!IS_ENABLED (CONFIG_PCIE_CADENCE_PLAT_HOST ))return -ENODEV ;
@@ -72,9 +59,9 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) rc =pci_host_bridge_priv (bridge); rc->pcie.dev = dev; rc->pcie.ops = &cdns_plat_ops; - cdns_plat_pcie->pcie = &rc->pcie; + pcie = &rc->pcie; - ret =cdns_pcie_init_phy (dev, cdns_plat_pcie->pcie); + ret =cdns_pcie_init_phy (dev, pcie);if (ret) {dev_err (dev,"failed to init phy\n" );return ret;
@@ -99,9 +86,9 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) ep->pcie.dev = dev; ep->pcie.ops = &cdns_plat_ops; - cdns_plat_pcie->pcie = &ep->pcie; + pcie = &ep->pcie; - ret =cdns_pcie_init_phy (dev, cdns_plat_pcie->pcie); + ret =cdns_pcie_init_phy (dev, pcie);if (ret) {dev_err (dev,"failed to init phy\n" );return ret;
@@ -119,18 +106,20 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) goto err_init; } +platform_set_drvdata (pdev, pcie); +return 0 ; err_init: err_get_sync:pm_runtime_put_sync (dev);pm_runtime_disable (dev); -cdns_pcie_disable_phy (cdns_plat_pcie->pcie); - phy_count = cdns_plat_pcie->pcie->phy_count; +cdns_pcie_disable_phy (pcie); + phy_count = pcie->phy_count;while (phy_count--) -device_link_del (cdns_plat_pcie->pcie->link[phy_count]); +device_link_del (pcie->link[phy_count]); -return 0 ; +return ret; }static void cdns_plat_pcie_shutdown (struct platform_device *pdev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 619/670 media: qcom: camss: vfe: Move common code into vfe core
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Depeng Shao <[email protected]>
[ Upstream commit 10693fed125d26ce6beb52aee66ea6f02f949206 ]
Some v4l2 buffer related logic functions can be moved to vfe core as common code, then the vfe driver of different hw version can reuse them, this also can avoid adding duplicate code for new version supporting.
Stable-dep-of: fc02156a3efb ("media: qcom: camss: vfe-17x: Fix write master selection for RDI lines")
--- .../media/platform/qcom/camss/camss-vfe-17x.c | 112 +------ .../media/platform/qcom/camss/camss-vfe-4-1.c | 9 - .../media/platform/qcom/camss/camss-vfe-4-7.c | 11 - .../media/platform/qcom/camss/camss-vfe-4-8.c | 11 - .../media/platform/qcom/camss/camss-vfe-480.c | 274 ++---------------- drivers/media/platform/qcom/camss/camss-vfe.c | 268 +++++++++++++++++ drivers/media/platform/qcom/camss/camss-vfe.h | 58 +++- 7 files changed, 361 insertions(+), 382 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe-17x.c +4 -108
@@ -14,8 +14,6 @@#include "camss.h" #include "camss-vfe.h" -#define VFE_HW_VERSION (0x000) -#define VFE_GLOBAL_RESET_CMD (0x018)#define GLOBAL_RESET_CMD_CORE BIT(0)#define GLOBAL_RESET_CMD_CAMIF BIT(1)
@@ -176,20 +174,6 @@#define VFE_BUS_WM_FRAME_INC (n) (0x2258 + (n) * 0x100)#define VFE_BUS_WM_BURST_LIMIT (n) (0x225c + (n) * 0x100) -static u32 vfe_hw_version (struct vfe_device *vfe) -{ -u32 hw_version =readl_relaxed (vfe->base +VFE_HW_VERSION ); - -u32 gen = (hw_version >>28 ) &0xF ; -u32 rev = (hw_version >>16 ) &0xFFF ; -u32 step = hw_version &0xFFFF ; - -dev_dbg (vfe->camss->dev,"VFE HW Version = %u.%u.%u\n" , - gen, rev, step); - -return hw_version; -} -static inline void vfe_reg_set (struct vfe_device *vfe,u32 reg,u32 set_bits) {u32 bits =readl_relaxed (vfe->base + reg);
@@ -437,62 +421,6 @@ static int vfe_get_output(struct vfe_line *line)return -EINVAL ; } -static int vfe_enable_output (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); -struct vfe_output *output = &line->output; -const struct vfe_hw_ops *ops = vfe->res->hw_ops; -struct media_entity *sensor; -unsigned long flags; -unsigned int frame_skip =0 ; -unsigned int i; - - sensor =camss_find_sensor (&line->subdev.entity); -if (sensor) { -struct v4l2_subdev *subdev =media_entity_to_v4l2_subdev (sensor); - -v4l2_subdev_call (subdev, sensor, g_skip_frames, &frame_skip); -/* Max frame skip is 29 frames */ -if (frame_skip >VFE_FRAME_DROP_VAL -1 ) - frame_skip =VFE_FRAME_DROP_VAL -1 ; - } - -spin_lock_irqsave (&vfe->output_lock, flags); - - ops->reg_update_clear (vfe, line->id); - -if (output->state >VFE_OUTPUT_RESERVED ) { -dev_err (vfe->camss->dev,"Output is not in reserved state %d\n" , - output->state); -spin_unlock_irqrestore (&vfe->output_lock, flags); -return -EINVAL ; - } - -WARN_ON (output->gen2.active_num); - - output->state =VFE_OUTPUT_ON ; - - output->sequence =0 ; - output->wait_reg_update =0 ; -reinit_completion (&output->reg_update); - -vfe_wm_start (vfe, output->wm_idx[0 ], line); - -for (i =0 ; i <2 ; i++) { - output->buf[i] =vfe_buf_get_pending (output); -if (!output->buf[i]) -break ; - output->gen2.active_num++; -vfe_wm_update (vfe, output->wm_idx[0 ], output->buf[i]->addr[0 ], line); - } - - ops->reg_update (vfe, line->id); - -spin_unlock_irqrestore (&vfe->output_lock, flags); - -return 0 ; -} -/* * vfe_enable - Enable streaming on VFE line * @line: VFE line
@@ -517,7 +445,7 @@ static int vfe_enable(struct vfe_line *line)if (ret <0 ) goto error_get_output; - ret =vfe_enable_output (line); + ret =vfe_enable_output_v2 (line);if (ret <0 ) goto error_enable_output;
@@ -626,40 +554,6 @@ static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm)spin_unlock_irqrestore (&vfe->output_lock, flags); } -/* -* vfe_queue_buffer - Add empty buffer -* @vid: Video device structure -* @buf: Buffer to be enqueued -* -* Add an empty buffer - depending on the current number of buffers it will be -* put in pending buffer queue or directly given to the hardware to be filled. -* -* Return 0 on success or a negative error code otherwise -*/ -static int vfe_queue_buffer (struct camss_video *vid, -struct camss_buffer *buf) -{ - struct vfe_line *line = container_of(vid, struct vfe_line, video_out); -struct vfe_device *vfe =to_vfe (line); -struct vfe_output *output; -unsigned long flags; - - output = &line->output; - -spin_lock_irqsave (&vfe->output_lock, flags); - -if (output->state ==VFE_OUTPUT_ON && output->gen2.active_num <2 ) { - output->buf[output->gen2.active_num++] = buf; -vfe_wm_update (vfe, output->wm_idx[0 ], buf->addr[0 ], line); - }else { -vfe_buf_add_pending (output, buf); - } - -spin_unlock_irqrestore (&vfe->output_lock, flags); - -return 0 ; -} -static const struct vfe_isr_ops vfe_isr_ops_170 = { .reset_ack = vfe_isr_reset_ack, .halt_ack = vfe_isr_halt_ack,
@@ -670,7 +564,7 @@ static const struct vfe_isr_ops vfe_isr_ops_170 = { };static const struct camss_video_ops vfe_video_ops_170 = { - .queue_buffer = vfe_queue_buffer, + .queue_buffer = vfe_queue_buffer_v2, .flush_buffers = vfe_flush_buffers, };
@@ -694,5 +588,7 @@ const struct vfe_hw_ops vfe_ops_170 = { .vfe_enable = vfe_enable, .vfe_halt = vfe_halt, .violation_read = vfe_violation_read, + .vfe_wm_start = vfe_wm_start, .vfe_wm_stop = vfe_wm_stop, + .vfe_wm_update = vfe_wm_update, };
drivers/media/platform/qcom/camss/camss-vfe-4-1.c +0 -9
@@ -210,15 +210,6 @@#define MSM_VFE_VFE0_UB_SIZE 1023#define MSM_VFE_VFE0_UB_SIZE_RDI (MSM_VFE_VFE0_UB_SIZE / 3) -static u32 vfe_hw_version (struct vfe_device *vfe) -{ -u32 hw_version =readl_relaxed (vfe->base +VFE_0_HW_VERSION ); - -dev_dbg (vfe->camss->dev,"VFE HW Version = 0x%08x\n" , hw_version); - -return hw_version; -} -static u16 vfe_get_ub_size (u8 vfe_id) {if (vfe_id ==0 )
drivers/media/platform/qcom/camss/camss-vfe-4-7.c +0 -11
@@ -18,8 +18,6 @@#include "camss-vfe-gen1.h" -#define VFE_0_HW_VERSION 0x000 -#define VFE_0_GLOBAL_RESET_CMD 0x018#define VFE_0_GLOBAL_RESET_CMD_CORE BIT(0)#define VFE_0_GLOBAL_RESET_CMD_CAMIF BIT(1)
@@ -254,15 +252,6 @@#define MSM_VFE_VFE1_UB_SIZE 1535#define MSM_VFE_VFE1_UB_SIZE_RDI (MSM_VFE_VFE1_UB_SIZE / 3) -static u32 vfe_hw_version (struct vfe_device *vfe) -{ -u32 hw_version =readl_relaxed (vfe->base +VFE_0_HW_VERSION ); - -dev_dbg (vfe->camss->dev,"VFE HW Version = 0x%08x\n" , hw_version); - -return hw_version; -} -static u16 vfe_get_ub_size (u8 vfe_id) {if (vfe_id ==0 )
drivers/media/platform/qcom/camss/camss-vfe-4-8.c +0 -11
@@ -17,8 +17,6 @@#include "camss-vfe.h" #include "camss-vfe-gen1.h" -#define VFE_0_HW_VERSION 0x000 -#define VFE_0_GLOBAL_RESET_CMD 0x018#define VFE_0_GLOBAL_RESET_CMD_CORE BIT(0)#define VFE_0_GLOBAL_RESET_CMD_CAMIF BIT(1)
@@ -247,15 +245,6 @@#define MSM_VFE_VFE1_UB_SIZE 1535#define MSM_VFE_VFE1_UB_SIZE_RDI (MSM_VFE_VFE1_UB_SIZE / 3) -static u32 vfe_hw_version (struct vfe_device *vfe) -{ -u32 hw_version =readl_relaxed (vfe->base +VFE_0_HW_VERSION ); - -dev_dbg (vfe->camss->dev,"VFE HW Version = 0x%08x\n" , hw_version); - -return hw_version; -} -static inline void vfe_reg_clr (struct vfe_device *vfe,u32 reg,u32 clr_bits) {u32 bits =readl_relaxed (vfe->base + reg);
drivers/media/platform/qcom/camss/camss-vfe-480.c +32 -242
341 lines not on this page · raw message
drivers/media/platform/qcom/camss/camss-vfe.c +268 -0
280 lines not on this page · raw message
drivers/media/platform/qcom/camss/camss-vfe.h +57 -1
75 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 620/670 media: qcom: camss: vfe-17x: Fix write master selection for RDI lines
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hitesh Patel <[email protected]>
[ Upstream commit fc02156a3efb747b724a490cc50e1ad8c28a3b23 ]
On the gen2 VFE bus there is no crossbar between the RDI paths and the bus write masters: RDI n is served by write master n. The common vfe_get_output_v2() reflects this by mapping line->id to write master line->id, and every gen2 VFE except 17x uses it.
The 17x code kept its own vfe_get_output(), which reserves whichever write master is free first. That happens to be the right one as long as a single line streams and it is RDI0. As soon as two lines of the same VFE stream, for instance two virtual channels demultiplexed by the CSID to RDI0 and RDI1, the second line to start is given the write master of the other RDI. Both write masters are then programmed with the buffer address and frame size of the wrong line. The frames are truncated to the smaller of the two buffers and the SMMU faults on the larger one.
Use vfe_get_output_v2() on 17x like the other gen2 VFEs and drop the duplicate. This also removes an error path that released output->wm_idx[0] before it had been assigned.
The gen1 VFEs are not affected: they have a bus crossbar and any write master can serve any line, so vfe_reserve_wm() is correct there.
--- .../media/platform/qcom/camss/camss-vfe-17x.c | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe-17x.c +1 -40
@@ -382,45 +382,6 @@ static int vfe_halt(struct vfe_device *vfe)return 0 ; } -static int vfe_get_output (struct vfe_line *line) -{ -struct vfe_device *vfe =to_vfe (line); -struct vfe_output *output; -unsigned long flags; -int wm_idx; - -spin_lock_irqsave (&vfe->output_lock, flags); - - output = &line->output; -if (output->state >VFE_OUTPUT_RESERVED ) { -dev_err (vfe->camss->dev,"Output is running\n" ); - goto error; - } - - output->wm_num =1 ; - - wm_idx =vfe_reserve_wm (vfe, line->id); -if (wm_idx <0 ) { -dev_err (vfe->camss->dev,"Can not reserve wm\n" ); - goto error_get_wm; - } - output->wm_idx[0 ] = wm_idx; - - output->drop_update_idx =0 ; - -spin_unlock_irqrestore (&vfe->output_lock, flags); - -return 0 ; - -error_get_wm: -vfe_release_wm (vfe, output->wm_idx[0 ]); - output->state =VFE_OUTPUT_OFF ; -error: -spin_unlock_irqrestore (&vfe->output_lock, flags); - -return -EINVAL ; -} -/* * vfe_enable - Enable streaming on VFE line * @line: VFE line
@@ -441,7 +402,7 @@ static int vfe_enable(struct vfe_line *line)mutex_unlock (&vfe->stream_lock); - ret =vfe_get_output (line); + ret =vfe_get_output_v2 (line);if (ret <0 ) goto error_get_output;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 621/670 iomap: dont mark unwritten parts of a folio uptodate
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit a4193b4af359db84b2cdf3a040752861984c636b ]
For a buffered write into a hole, an unwritten or new extent, or past EOF __iomap_write_begin() zeroes the parts of the blocks outside of the write and then marks the blocks uptodate. That includes the range of the write itself which still holds whatever was in the folio before. It only becomes valid once the copy from userspace has filled it in.
But the copy can come up short and __iomap_write_end() only rejects a short copy if the folio isn't uptodate. If the zeroed blocks were all that was missing the folio is uptodate by then, the short copy is accepted, and the rest of the range is exposed to readers and can end up on disk. A source buffer that ends in an unmapped page is enough:
ftruncate(fd, 4096);
pwrite(fd, p, 3000, 100); /* 16 bytes at p, then PROT_NONE */
pread(fd, buf, 4096, 0);The write returns 16 and the read returns 2984 bytes of whatever was in that page before. If other blocks of the folio aren't uptodate the short copy is rejected but the zeroed blocks keep their uptodate bits and the retry with the copied length leaves the same bytes behind.
Only mark blocks uptodate in __iomap_write_begin() after reading them. __iomap_write_end() marks the zeroed blocks uptodate once the copy has succeeded and rejects a short copy.
Willy reported this back in 2024 (cf. [1]) and Zhang Yi posted the same fix (cf. [2]) but it never got merged.
[1]: https://lore.kernel.org/all/[email protected]
[2]: https://lore.kernel.org/all/[email protected]
--- fs/iomap/buffered-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/iomap/buffered-io.c +2 -1
@@ -760,6 +760,7 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,if (iomap_block_needs_zeroing (iter, block_start)) {if (WARN_ON_ONCE (iter->flags &IOMAP_UNSHARE ))return -EIO ; +/* uptodate once copied, see __iomap_write_end() */ folio_zero_segments (folio, poff, from, to, poff + plen); }else {int status;
@@ -771,8 +772,8 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, poff, plen, srcmap);if (status)return status; +iomap_set_range_uptodate (folio, poff, plen); } -iomap_set_range_uptodate (folio, poff, plen); }while ((block_start += plen) < block_end);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 622/670 f2fs: fix to invalidate curseg if change_curseg() fails
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 e74476ad8162c1facc74b74ce2d1372492df872e ]
Our consistency stress test (fsstress + fio + atomic write workers + "f2fs_io shutdown 1") triggers below kernel BUG:
F2FS-fs (vdd): Stopped filesystem due to reason: 0
------------[ cut here ]------------ kernel BUG at fs/f2fs/segment.c:3989! Oops: invalid opcode: 0000 [#1] SMP KASAN PTI Workqueue: writeback wb_workfn (flush-253:48) RIP: 0010:f2fs_allocate_data_block+0x257a/0x38e0 Call Trace: <TASK> do_write_block+0x155/0xc10 f2fs_outplace_write_data+0x192/0x340 f2fs_do_write_data_page+0xc57/0x1880 f2fs_write_single_data_page+0xda9/0x15a0 f2fs_write_cache_pages+0x973/0x1f20 __f2fs_write_data_pages+0x6c4/0x1890 do_writepages+0x21e/0x560 __writeback_single_inode+0x119/0x11b0 writeback_sb_inodes+0x67d/0x17a0 wb_writeback+0x207/0x820 wb_workfn+0x128/0xc30 process_one_work+0x925/0x1600 worker_thread+0x60a/0xff0 kthread+0x35f/0x460 ret_from_fork+0x474/0x7e0 ret_from_fork_asm+0x1a/0x30 </TASK>
The BUG is f2fs_bug_on(sbi, curseg->next_blkoff >= BLKS_PER_SEG(sbi)) in f2fs_allocate_data_block(), next_blkoff was 512.
The root cause is a race in between atomic write commit and shutdown as below:
Thread A (commit atomic write) Thread B (shutdown) Thread C (writeback)
- f2fs_ioc_commit_atomic_write
- f2fs_commit_atomic_write
- __f2fs_commit_atomic_write
- __replace_atomic_write_block
- f2fs_replace_block
- __f2fs_replace_block
- f2fs_ioc_shutdown
- f2fs_do_shutdown
: F2FS_GOING_DOWN_METASYNC
- f2fs_sync_fs
- f2fs_write_single_data_page : pass f2fs_cp_error() check
- f2fs_stop_checkpoint
: set CP_ERROR_FLAG
- change_curseg
- reset_curseg
: curseg->segno = new_segno
: curseg->alloc_type = SSR
: curseg->next_blkoff = __next_free_blkoff()
which is BLKS_PER_SEG if there is no free
slot in new_segno
- f2fs_get_sum_cache
: return -EIO due to f2fs_cp_error()
: return error w/o restoring curseg
: goto out_unlock, skip restoring
old segno, blkoff and alloc_type
- f2fs_do_write_data_page
- f2fs_outplace_write_data
- do_write_block
- f2fs_allocate_data_block : curseg->segno is valid : f2fs_bug_on(next_blkoff >= BLKS_PER_SEG)
Since commit 86f33603f8c5 ("f2fs: handle errors of f2fs_get_meta_page_nofail"), change_curseg() can fail after the curseg has already been switched to the new segment, then the curseg is left in an inconsistent state: it points to a segment which may have no free slot, its summary block is zeroed, and the caller can not restore it. Subsequent block allocation on the curseg will trigger the BUG. Moreover, the writeback thread dies with curseg_lock, curseg_mutex and sentry_lock held, so the commit, shutdown and other I/O threads hang in D state.
Since change_curseg() only fails once CP_ERROR_FLAG is set, no checkpoint will be committed afterward, let's invalidate the curseg via reset_curseg_fields() on failure, as new_curseg() does for -ENOSPC, then f2fs_allocate_data_block() will fail with -ENOSPC on the curseg instead of triggering BUG, and do_write_block() can handle the error since CP_ERROR_FLAG has been set.
--- fs/f2fs/segment.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/segment.c +1 -0
@@ -2970,6 +2970,7 @@ static int change_curseg(struct f2fs_sb_info *sbi, int type)if (IS_ERR (sum_page)) {/* GC won't be able to use stale summary pages by cp_error */ memset (curseg->sum_blk,0 ,SUM_ENTRY_SIZE ); +reset_curseg_fields (curseg);return PTR_ERR (sum_page); } sum_node = (struct f2fs_summary_block *)page_address (sum_page);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 623/670 LoongArch: Dont init & online empty nodes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
[ Upstream commit 87c6d144bc7bbed0c4573848b9c92006edca7848 ]
Don't init & online empty nodes without any CPU cores (and memory), in this way "lscpu" will not display confusing empty nodes.
Modify fake_numa_init() to make sure at least Node-0 isn't empty for the FDT booting case.
--- arch/loongarch/kernel/numa.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/loongarch/kernel/numa.c +6 -2
@@ -318,6 +318,8 @@ static int __init fake_numa_init(void)phys_addr_t start =memblock_start_of_DRAM ();phys_addr_t end =memblock_end_of_DRAM () -1 ; +set_cpuid_to_node (0 ,0 ); +early_numa_add_cpu (0 ,0 );node_set (0 , numa_nodes_parsed);pr_info ("Faking a node at [mem %pap-%pap]\n" , &start, &end);
@@ -353,8 +355,10 @@ int __init init_numa_memory(void)return -EINVAL ;for_each_node_mask (node, node_possible_map) { -node_mem_init (node); -node_set_online (node); +if (!cpumask_empty (&cpus_on_node[node])) { +node_mem_init (node); +node_set_online (node); + } } max_low_pfn =PHYS_PFN (memblock_end_of_DRAM ());
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 624/670 media: serial_ir: Fix race condition where timer can be re-armed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <[email protected]>
[ Upstream commit d74ac4016ba64cb3b20f395511d0b18025ca0ba9 ]
Ensure the timer cannot be re-armed.
--- drivers/media/rc/serial_ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/serial_ir.c +1 -1
@@ -798,7 +798,7 @@ static int __init serial_ir_init_module(void) static void __exit serial_ir_exit_module(void) { -del_timer_sync (&serial_ir.timeout_timer); +timer_shutdown_sync (&serial_ir.timeout_timer);serial_ir_exit (); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 625/670 nvme-tcp: validate the TLS handshake timeout
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <[email protected]>
[ Upstream commit 799203afd298b1f8e9ee49815eb38f775f211299 ]
tls_handshake_timeout is writable but stored as a signed int. Multiplying the value by MSEC_PER_SEC and HZ therefore uses signed arithmetic.
With HZ=1000, setting it to 2147484 overflows both multiplications. If the handshake request is accepted and its completion remains pending, schedule_timeout() reports a wrong timeout value with a stack dump and returns zero. The handshake then fails immediately with -ETIMEDOUT, while the handshake agent was given about 24.9 days. Negative values such as -1 have the same kernel-side effect.
Store the parameter as an unsigned int and reject values that cannot be represented both by tls_handshake_args::ta_timeout_ms and by a safe jiffies delay. Take one snapshot so a concurrent parameter update cannot give the handshake agent and completion wait different timeouts. Document the accepted range for built-in use.
wait_for_completion_interruptible_timeout() returns the remaining jiffies as a long after a successful completion. Keep that result in a long because an accepted timeout can exceed INT_MAX jiffies on 64-bit systems.
Negative and oversized values now fail with -EINVAL. Keep zero valid, preserving the existing immediate-timeout behavior.
--- .../admin-guide/kernel-parameters.txt | 5 +++ drivers/nvme/host/tcp.c | 34 ++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +5 -0
@@ -4214,6 +4214,11 @@ This can be set from sysctl after boot. See Documentation/admin-guide/sysctl/vm.rst for details. + nvme_tcp.tls_handshake_timeout= + [NVME] NVMe/TCP host TLS handshake timeout in seconds. + Valid values range from 0 to the smaller of + UINT_MAX / 1000 and MAX_JIFFY_OFFSET / HZ. Default: 10 + ohci1394_dma=early [HW,EARLY] enable debugging via the ohci1394 driver. See Documentation/core-api/debugging-via-ohci1394.rst for more info.
drivers/nvme/host/tcp.c +26 -8
@@ -6,6 +6,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> #include <linux/init.h> +#include <linux/jiffies.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/key.h>
@@ -47,9 +48,24 @@ MODULE_PARM_DESC(wq_unbound, "Use unbound workqueue for nvme-tcp IO context (def/* * TLS handshake timeout */ -static int tls_handshake_timeout =10 ; +static unsigned int tls_handshake_timeout =10 ;#ifdef CONFIG_NVME_TCP_TLS -module_param (tls_handshake_timeout, int,0644 ); +static int tls_handshake_timeout_set (const char *val, +const struct kernel_param *kp) +{ +return param_set_uint_minmax (val, kp,0 , + min_t(unsigned long, UINT_MAX / MSEC_PER_SEC, +MAX_JIFFY_OFFSET /HZ )); +} + +static const struct kernel_param_ops tls_handshake_timeout_ops = { + .set = tls_handshake_timeout_set, + .get = param_get_uint, +}; + +module_param_cb (tls_handshake_timeout, &tls_handshake_timeout_ops, + &tls_handshake_timeout,0644 ); +__MODULE_PARM_TYPE (tls_handshake_timeout,"uint" );MODULE_PARM_DESC (tls_handshake_timeout,"nvme TLS handshake timeout in seconds (default 10)" );#endif
@@ -1946,8 +1962,10 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl, {int qid =nvme_tcp_queue_id (queue);int ret; +long wait_ret;struct tls_handshake_args args; -unsigned long tmo = tls_handshake_timeout *HZ ; +unsigned int timeout =READ_ONCE (tls_handshake_timeout); +unsigned long tmo = (unsigned long )timeout *HZ ;key_serial_t keyring =nvme_keyring_id (); dev_dbg(nctrl->device, "queue %d: start TLS with key %x\n",
@@ -1961,7 +1979,7 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,if (nctrl->opts->keyring) keyring =key_serial (nctrl->opts->keyring); args.ta_keyring = keyring; - args.ta_timeout_ms = tls_handshake_timeout *1000 ; + args.ta_timeout_ms = timeout *MSEC_PER_SEC ; queue->tls_err = -EOPNOTSUPP ;init_completion (&queue->tls_complete); ret =tls_client_hello_psk (&args,GFP_KERNEL );
@@ -1970,10 +1988,10 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl, qid, ret);return ret; } - ret =wait_for_completion_interruptible_timeout (&queue->tls_complete, tmo); -if (ret <=0 ) { -if (ret ==0 ) - ret = -ETIMEDOUT ; + wait_ret =wait_for_completion_interruptible_timeout (&queue->tls_complete, + tmo); +if (wait_ret <=0 ) { + ret = wait_ret <0 ? -ERESTARTSYS : -ETIMEDOUT ; dev_err(nctrl->device, "queue %d: TLS handshake failed, error %d\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 626/670 gpiolib: cdev: dont set GPIOD_FLAG_IS_OUT
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Ambrozewicz <[email protected]>
[ Upstream commit 974d2712cb15014019595799b3ed68fef5fe9695 ]
When a line is requested or reconfigured through the v2 uAPI, gpio_v2_line_config_flags_to_desc_flags() copies the requested configuration into the descriptor flags, GPIOD_FLAG_IS_OUT included, before gpiod_direction_input_nonotify() or gpiod_direction_output_nonotify() asks the driver for the direction. If the driver refuses, for instance with -EOPNOTSUPP from .direction_input() for a line that can only be an output, the ioctl fails but the flag keeps the refused direction. gpiod_free_commit() does not touch GPIOD_FLAG_IS_OUT, so this outlives the failed request, and GPIO_V2_GET_LINEINFO_IOCTL reports the line as an input while the hardware still drives it, until a request without direction flags makes gpiod_request_commit() read the direction back from the driver:
GPIO_V2_GET_LINE_IOCTL, line 0, input: -EOPNOTSUPP GPIO_V2_GET_LINEINFO_IOCTL, line 0: input GPIO_V2_GET_LINE_IOCTL, line 0, no direction: ok GPIO_V2_GET_LINEINFO_IOCTL, line 0: output
GPIO_V2_LINE_SET_CONFIG_IOCTL updates the flags in the same order. There the line stays requested, and since commit 92ac7de3175e ("gpiolib: don't allow setting values on input lines") GPIO_V2_LINE_SET_VALUES_IOCTL on it then fails with -EPERM, though the line is still an output. A line whose driver refuses to make it an output is likewise reported as one.
gpiod_direction_input_nonotify() and gpiod_direction_output_nonotify() set or clear GPIOD_FLAG_IS_OUT themselves once the driver has accepted the direction, emulated open drain and open source included, and nothing between the copy and those calls reads the flag. Leave it to them, as the v1 uAPI already does.
The other flags that the helper copies stay as they are. Active low, drive and bias are what gpiod_direction_*() applies, drive and bias possibly before the driver refuses the direction; edges and event clock are the character device's own. None of them is read back from the driver, so there is no earlier state that is more accurate to go back to. A failed request releases the line, which clears them, and a failed reconfiguration leaves the line, like the lines before it, with what was applied up to the failure.
Reproduced under QEMU with a test GPIO chip whose line 0 refuses input and line 1 refuses output: both refused requests and both refused reconfigurations leave the line info with the refused direction, and setting the value of the reconfigured output fails with -EPERM. With this change the line info shows the direction of the hardware in all four cases and setting the value works. First seen on real hardware with v6.12.
--- drivers/gpio/gpiolib-cdev.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpio/gpiolib-cdev.c +0 -5
@@ -1367,11 +1367,6 @@ static void gpio_v2_line_config_flags_to_desc_flags(u64 flags,assign_bit (FLAG_ACTIVE_LOW , flagsp, flags &GPIO_V2_LINE_FLAG_ACTIVE_LOW ); -if (flags &GPIO_V2_LINE_FLAG_OUTPUT ) -set_bit (FLAG_IS_OUT , flagsp); -else if (flags &GPIO_V2_LINE_FLAG_INPUT ) -clear_bit (FLAG_IS_OUT , flagsp); -assign_bit (FLAG_EDGE_RISING , flagsp, flags &GPIO_V2_LINE_FLAG_EDGE_RISING ); assign_bit(FLAG_EDGE_FALLING, flagsp,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 627/670 panic: use panic_try_start() in nmi_panic()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinchao Wang <[email protected]>
[ Upstream commit 6b69c7ef96f1afc7b426195087f7488f1510c2a4 ]
nmi_panic() duplicated the logic to claim panic_cpu with atomic_try_cmpxchg. This is already wrapped in panic_try_start().
Replace the open-coded logic with panic_try_start(), and use panic_on_other_cpu() for the fallback path.
This removes duplication and keeps panic handling code consistent.
Stable-dep-of: 75eb687ff2bc ("panic: flatten nmi_panic control flow")
--- kernel/panic.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
kernel/panic.c +2 -8
@@ -248,15 +248,9 @@ EXPORT_SYMBOL(panic_on_other_cpu);*/ void nmi_panic (struct pt_regs *regs,const char *msg) { -int old_cpu, this_cpu; - - old_cpu =PANIC_CPU_INVALID ; - this_cpu =raw_smp_processor_id (); - -/* atomic_try_cmpxchg updates old_cpu on failure */ -if (atomic_try_cmpxchg (&panic_cpu, &old_cpu, this_cpu)) +if (panic_try_start ())panic ("%s" , msg); -else if (old_cpu != this_cpu) +else if (panic_on_other_cpu ())nmi_panic_self_stop (regs); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 628/670 panic: flatten nmi_panic control flow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bradley Morgan <[email protected]>
[ Upstream commit 75eb687ff2bcec9fba31bbe266e5f91e5c283efe ]
panic() is __noreturn, so the else after panic_try_start() is dead. Drop it so the force_cpu path can be added cleanly on top.
--- kernel/panic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/panic.c +2 -1
@@ -250,7 +250,8 @@ void nmi_panic(struct pt_regs *regs, const char *msg) {if (panic_try_start ())panic ("%s" , msg); -else if (panic_on_other_cpu ()) + +if (panic_on_other_cpu ())nmi_panic_self_stop (regs); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 629/670 kernel/panic.c: format kernel-doc comments
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sravan Kumar Gundu <[email protected]>
[ Upstream commit 85915c6cabf74d1f693fd09d95c25d838b82c840 ]
kernel-doc function comment don't follows documentation commenting style misinterpreting arguments description with function description.
Please see latest docs generated before applying this patch
https://docs.kernel.org/driver-api/basics.html#c.panic
Stable-dep-of: ed9e4c1ff15d ("panic: restore variable arguments to nmi_panic()")
--- kernel/panic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/panic.c +3 -5
@@ -325,12 +325,10 @@ static void panic_other_cpus_shutdown(bool crash_kexec) }/** -* panic - halt the system -* @fmt: The text string to print +* panic - halt the system +* @fmt: The text string to print * -* Display a message, then perform cleanups. -* -* This function never returns. +* Display a message, then perform cleanups. This function never returns. */ void panic (const char *fmt, ...) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 630/670 panic: Add vpanic()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
[ Upstream commit 3f045de7f557850ca6b3632c6d45c2cdaf948694 ]
vpanic() is useful for implementing runtime verification reactors. Add it.
Stable-dep-of: ed9e4c1ff15d ("panic: restore variable arguments to nmi_panic()")
--- include/linux/panic.h | 3 +++ kernel/panic.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/panic.h +3 -0
@@ -3,6 +3,7 @@#define _LINUX_PANIC_H#include <linux/compiler_attributes.h> +#include <linux/stdarg.h> #include <linux/types.h> struct pt_regs ;
@@ -10,6 +11,8 @@ struct pt_regs;extern long (*panic_blink)(int state); __printf(1, 2)void panic (const char *fmt, ...)__noreturn __cold ; +__printf(1, 0) +void vpanic (const char *fmt,va_list args)__noreturn __cold ;void nmi_panic (struct pt_regs *regs,const char *msg);void check_panic_on_warn (const char *origin);extern void oops_enter (void );
kernel/panic.c +12 -4
@@ -327,13 +327,13 @@ static void panic_other_cpus_shutdown(bool crash_kexec)/** * panic - halt the system * @fmt: The text string to print +* @args: Arguments for the format string * * Display a message, then perform cleanups. This function never returns. */ -void panic (const char *fmt, ...) +void vpanic (const char *fmt,va_list args) {static char buf[1024 ]; -va_list args;long i, i_next =0 , len;int state =0 ;int old_cpu, this_cpu;
@@ -384,9 +384,7 @@ void panic(const char *fmt, ...)console_verbose ();bust_spinlocks (1 ); -va_start (args, fmt); len =vscnprintf (buf,sizeof (buf), fmt, args); -va_end (args);if (len && buf[len -1 ] =='\n' ) buf[len -1 ] ='\0' ;
@@ -523,7 +521,17 @@ void panic(const char *fmt, ...)mdelay (PANIC_TIMER_STEP ); } } +EXPORT_SYMBOL (vpanic); +/* Identical to vpanic(), except it takes variadic arguments instead of va_list */ +void panic (const char *fmt, ...) +{ +va_list args; + +va_start (args, fmt); +vpanic (fmt, args); +va_end (args); +}EXPORT_SYMBOL (panic);#define TAINT_FLAG (taint, _c_true, _c_false, _module) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 631/670 watchdog/hpwdt: Refine hpwdt message for UV platform
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Wahl <[email protected]>
[ Upstream commit d8207d1e9a36b1a8a461581b2d4073ea28335603 ]
The watchdog hardware the hpwdt driver uses was added to the UV platform for UV_5, but the logging mentioned by this driver was not added to the BIOS. When the watchdog fires, the printed message had the administrators and developers looking for non-existent log files, and confused about whether a watchdog actually tripped.
Change the message that prints on UV platforms so it doesn't send the user looking for non-existent logs.
To aid in any future debugging, include all 8 bits of the NMISTAT register in the output, not just the two bits being used to determine this was "mynmi". And provide names to the bits in NMISTAT so the code is easier to understand.
Stable-dep-of: ed9e4c1ff15d ("panic: restore variable arguments to nmi_panic()")
--- drivers/watchdog/hpwdt.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/watchdog/hpwdt.c +15 -7
@@ -22,6 +22,7 @@#include <linux/watchdog.h> #ifdef CONFIG_HPWDT_NMI_DECODING #include <asm/nmi.h> +#include <asm/uv/uv.h> #endif #include <linux/crash_dump.h>
@@ -158,24 +159,31 @@ static int hpwdt_set_pretimeout(struct watchdog_device *wdd, unsigned int req)return 0 ; } -static int hpwdt_my_nmi (void ) -{ -return ioread8 (hpwdt_nmistat) &0x6 ; -} +#define NMISTAT_EASR BIT(0) +#define NMISTAT_EWDOG BIT(1) +#define NMISTAT_RTRAP BIT(2) +#define NMISTAT_DBELL BIT(3) +#define NMISTAT_EMSWDG BIT(4) +#define NMISTAT_GPI BIT(5) +#define NMISTAT_NMIOUT BIT(7)/* * NMI Handler */ static int hpwdt_pretimeout (unsigned int ulReason,struct pt_regs *regs) { -unsigned int mynmi =hpwdt_my_nmi (); -static char panic_msg[] = +u8 nmistat =ioread8 (hpwdt_nmistat); +bool mynmi = (nmistat & (NMISTAT_EWDOG |NMISTAT_RTRAP )) !=0 ; +static char panic_msg_default[] ="00: An NMI occurred. Depending on your system the reason " "for the NMI is logged in any one of the following resources:\n" "1. Integrated Management Log (IML)\n" "2. OA Syslog\n" "3. OA Forward Progress Log\n" "4. iLO Event Log" ; +static char panic_msg_uv[] = +"00: A watchdog NMI occurred." ; +char *panic_msg =is_uv_system () ? panic_msg_uv : panic_msg_default;if (ulReason ==NMI_UNKNOWN && !mynmi)return NMI_DONE ;
@@ -189,7 +197,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)hpwdt_ping_ticks (SECS_TO_TICKS (val)); } -hex_byte_pack (panic_msg, mynmi); +hex_byte_pack (panic_msg, nmistat);nmi_panic (regs, panic_msg);return NMI_HANDLED ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 632/670 panic: restore variable arguments to nmi_panic()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bradley Morgan <[email protected]>
[ Upstream commit ed9e4c1ff15d5b935f467811541ca0aa6e49c5d0 ]
nmi_panic() used to accept variable arguments until commit ebc41f20d77f ("panic: change nmi_panic from macro to function") flattened it to a final message string. vpanic() did not exist back then, so the function had to format through panic("%s", msg).
Bring the variable arguments back and format with vpanic() directly. The next patch makes nmi_panic() try the panic_force_cpu= redirect before claiming panic_cpu. panic_try_force_cpu() needs to print the message but it is used also by panic() which accepts variable argument list. The string could be formatted only when a CPU gets assigned to process the redirection. Otherwise, there might be a race when writing to the panic_force_buf.
No current caller passes a string with format specifiers. The closest one is hpwdt_pretimeout(), which builds panic_msg with hex_byte_pack() and has only two variants, both plain strings. But the new __printf() annotation on nmi_panic() would warn with -Wformat-security there because the buffer is passed directly as the format argument, so switch it to nmi_panic(regs, "%s", panic_msg).
--- drivers/watchdog/hpwdt.c | 2 +- include/linux/panic.h | 3 ++- kernel/panic.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-)
drivers/watchdog/hpwdt.c +1 -1
@@ -198,7 +198,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs) }hex_byte_pack (panic_msg, nmistat); -nmi_panic (regs, panic_msg); +nmi_panic (regs,"%s" , panic_msg);return NMI_HANDLED ; }
include/linux/panic.h +2 -1
@@ -13,7 +13,8 @@ __printf(1, 2)void panic (const char *fmt, ...)__noreturn __cold ; __printf(1, 0)void vpanic (const char *fmt,va_list args)__noreturn __cold ; -void nmi_panic (struct pt_regs *regs,const char *msg); +__printf(2, 3) +void nmi_panic (struct pt_regs *regs,const char *fmt, ...);void check_panic_on_warn (const char *origin);extern void oops_enter (void );extern void oops_exit (void );
kernel/panic.c +8 -2
@@ -246,13 +246,19 @@ EXPORT_SYMBOL(panic_on_other_cpu);* nmi_panic_self_stop() which can provide architecture dependent code such * as saving register state for crash dump. */ -void nmi_panic (struct pt_regs *regs,const char *msg) +void nmi_panic (struct pt_regs *regs,const char *fmt, ...) { +va_list args; + +va_start (args, fmt); +if (panic_try_start ()) -panic ("%s" , msg); +vpanic (fmt, args);if (panic_on_other_cpu ())nmi_panic_self_stop (regs); + +va_end (args); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 633/670 ACPI: APEI: accumulate the queued flag across error sections
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit f341307a14895e5da056fb419a31ef7fb534ab18 ]
ghes_do_proc() walks every error section of a CPER record, and ghes_handle_arm_hw_error() walks every error-info entry of an ARM processor section. Both assign to "queued" instead of OR-ing into it, so only the last iteration counts: a later section or entry that queues no memory-failure work clears the flag an earlier one set.
Instead of reassigning the variable at every time, just do an OR, so, if there was a single match, it will return "queued" as set.
The comment above the check says "If no memory failure
work is queued", which is the semantics this patch implements. I.e, only SIGBUS if there are queue was not handled at all. If we want to SIGBUS if any event was not handled/queued at all, we will need something more sophisticated.
--- drivers/acpi/apei/ghes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/apei/ghes.c +3 -3
@@ -583,7 +583,7 @@ static bool ghes_handle_arm_hw_error(struct acpi_hest_generic_data *gdata,* and don't filter out 'corrected' error here. */ if (is_cache && has_pa) { - queued =ghes_do_memory_failure (err_info->physical_fault_addr, flags); + queued |=ghes_do_memory_failure (err_info->physical_fault_addr, flags); p += err_info->length;continue ; }
@@ -809,11 +809,11 @@ static bool ghes_do_proc(struct ghes *ghes,atomic_notifier_call_chain (&ghes_report_chain, sev, mem_err);arch_apei_report_mem_error (sev, mem_err); - queued =ghes_handle_memory_failure (gdata, sev, sync); + queued |=ghes_handle_memory_failure (gdata, sev, sync); }else if (guid_equal (sec_type, &CPER_SEC_PCIE )) {ghes_handle_aer (gdata); }else if (guid_equal (sec_type, &CPER_SEC_PROC_ARM )) { - queued =ghes_handle_arm_hw_error (gdata, sev, sync); + queued |=ghes_handle_arm_hw_error (gdata, sev, sync); }else if (guid_equal (sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID )) {struct cxl_cper_event_rec *rec =acpi_hest_get_payload (gdata);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 634/670 posix-timers: Report zero remaining time for disarmed SIGEV_NONE timers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hung-Jui Lin <[email protected]>
[ Upstream commit 141a27750ec3d91ad9d1ad1764ebb5e51b963478 ]
SIGEV_NONE timers are never queued. common_timer_get() emulates their expiry by computing the remaining time from the stored expiry value. Because an armed SIGEV_NONE oneshot timer is not queued, its it_status stays POSIX_TIMER_DISARMED. So common_timer_get() cannot use it_status to skip a disarmed SIGEV_NONE timer and evaluates the stored expiry value for all SIGEV_NONE timers.
Disarming a timer with timer_settime() and a zero it_value cancels the timer and sets it_status to POSIX_TIMER_DISARMED, but leaves the expiry value unchanged. As a consequence, timer_gettime() on a disarmed SIGEV_NONE timer reports the remaining time of the previous arming until that time has passed, instead of zero as POSIX requires for a disarmed timer. Example with a CLOCK_MONOTONIC timer armed with it_value = 10ms and it_interval = 100ms, then disarmed with an all-zero itimerspec:
armed: it_value = 0.009999000 it_interval = 0.100000000
disarmed: it_value = 0.008700792 it_interval = 0.000000000
SIGEV_SIGNAL timers and SIGEV_NONE CPU timers report zero in the same situation. All clocks which use common_timer_get() are affected, including the alarm timer clocks.
Mark SIGEV_NONE timers as POSIX_TIMER_ARMED when they are armed, so that common_timer_get() returns early for every disarmed timer. Forward SIGEV_NONE interval timers in common_timer_get() regardless of it_status, as they are never queued and therefore never forwarded by the expiry code.
After the change the disarmed timer above reports zero. Armed SIGEV_NONE oneshot and interval timers on CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_BOOTTIME and CLOCK_BOOTTIME_ALARM still report their remaining time, and the posix_timers selftest passes.
--- kernel/time/posix-timers.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
kernel/time/posix-timers.c +11 -11
@@ -656,16 +656,8 @@ void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)if (iv) { cur_setting->it_interval =ktime_to_timespec64 (iv); }else if (!timr->it_active) { -/* -* SIGEV_NONE oneshot timers are never queued and therefore -* timr->it_active is always false. The check below -* vs. remaining time will handle this case. -* -* For all other timers there is nothing to update here, so -* return. -*/ -if (!sig_none) -return ; +/* Nothing to update for a disarmed timer */ +return ; } now = kc->clock_get_ktime (timr->it_clock);
@@ -916,7 +908,15 @@ int common_timer_set(struct k_itimer *timr, int flags, sigev_none = timr->it_sigev_notify ==SIGEV_NONE ; kc->timer_arm (timr, expires, flags &TIMER_ABSTIME , sigev_none); - timr->it_active = !sigev_none; +/* +* SIGEV_NONE timers are not queued, but mark them armed +* so that common_timer_get() can tell them apart from +* disarmed timers. An expired SIGEV_NONE timer stays +* armed, which is harmless: common_timer_get() reports +* zero remaining time for it and it never reaches the +* signal delivery code. +*/ + timr->it_active =1 ;return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 635/670 dax: fix wrong error code returned from dax_dedupe_file_range_compare()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianyun Gao <[email protected]>
[ Upstream commit 9b036546a02c6c9a5133f9c1e93503896595c6ba ]
When dax_range_compare_iter() returns a negative error code (e.g. -EIO), dax_dedupe_file_range_compare() incorrectly returns 'ret' which holds the positive return value from iomap_iter() indicating more iterations remain. This positive value leaks to the caller, where vfs_dedupe_file_range() interprets it as success (bytes_deduped = len), causing userspace to incorrectly believe deduplication completed.
Return 'status' instead to propagate the actual error code.
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dax.c +1 -1
@@ -2067,7 +2067,7 @@ int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff, compared =dax_range_compare_iter (&src_iter, &dst_iter,min (src_iter.len, dst_iter.len), same);if (compared <0 ) -return ret; +return compared; src_iter.processed = dst_iter.processed = compared; }return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 636/670 mm/huge_memory: split huge PUDs when adjusting VMA boundaries
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand (Arm) <[email protected]>
[ Upstream commit 23e570927421d569fdc510d5f3f29542a43eeda5 ]
PFN mappings such as VFIO PCI BAR mappings can use PUD leaves while allowing VMA splits at page granularity. However, vma_adjust_trans_huge() only handles PMDs.
After faulting a writable PUD-sized VFIO BAR mapping, changing its first page to read-only with mprotect() makes the PMD walk treat the PUD leaf as a PMD table. Applying MADV_DONTFORK to the first PMD-sized chunk leaves the PUD spanning two VMAs: the PMD-aligned boundary skips splitting.
Walk the page tables once at each adjusted boundary and split a huge PUD or PMD leaf as needed. Handle PUD leaves even when the boundary is PMD-aligned.
--- mm/huge_memory.c | 70 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 10 deletions(-)
mm/huge_memory.c +60 -10
@@ -2988,16 +2988,66 @@ void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,__split_huge_pmd (vma, pmd, address, freeze, folio); } -static inline void split_huge_pmd_if_needed (struct vm_area_struct *vma,unsigned long address) +static bool pud_split_required (struct vm_area_struct *vma, +unsigned long address) { +if (!IS_ENABLED (CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD )) +return false; +if (IS_ALIGNED (address,HPAGE_PUD_SIZE )) +return false;/* -* If the new address isn't hpage aligned and it could previously -* contain an hugepage: check if we need to split an huge pmd. +* Only selected VMAs support mapping PUDs for now. Lift the +* restriction once this changes. */ -if (!IS_ALIGNED (address,HPAGE_PMD_SIZE ) && -range_in_vma (vma,ALIGN_DOWN (address,HPAGE_PMD_SIZE ), -ALIGN (address,HPAGE_PMD_SIZE ))) -split_huge_pmd_address (vma, address, false,NULL ); +if (!vma_is_dax (vma) && !(vma->vm_flags & (VM_PFNMAP |VM_MIXEDMAP ))) +return false; +return range_in_vma (vma,ALIGN_DOWN (address,HPAGE_PUD_SIZE ), +ALIGN (address,HPAGE_PUD_SIZE )); +} + +static bool pmd_split_required (struct vm_area_struct *vma, +unsigned long address) +{ +if (IS_ALIGNED (address,HPAGE_PMD_SIZE )) +return false; + +return range_in_vma (vma,ALIGN_DOWN (address,HPAGE_PMD_SIZE ), +ALIGN (address,HPAGE_PMD_SIZE )); +} + +static void split_huge_leaf (struct vm_area_struct *vma, +unsigned long address) +{ +const bool split_pud =pud_split_required (vma, address); +const bool split_pmd =pmd_split_required (vma, address); +pgd_t *pgd; +p4d_t *p4d; +pud_t *pud; +pmd_t *pmd; + +/* +* mmap, VMA and rmap write locks protect the walk; the split helpers +* take the page table locks. +*/ +if (!split_pud && !split_pmd) +return ; + + pgd =pgd_offset (vma->vm_mm, address); +if (!pgd_present (*pgd)) +return ; + + p4d =p4d_offset (pgd, address); +if (!p4d_present (*p4d)) +return ; + + pud =pud_offset (p4d, address); +if (pud_leaf (*pud)) +__split_huge_pud (vma, pud, address); +if (!split_pmd || !pud_present (*pud)) +return ; + + pmd =pmd_offset (pud, address); +__split_huge_pmd (vma, pmd, address, false,NULL ); } void vma_adjust_trans_huge(struct vm_area_struct *vma,
@@ -3006,10 +3056,10 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, long adjust_next) {/* Check if we need to split start first. */ -split_huge_pmd_if_needed (vma, start); +split_huge_leaf (vma, start);/* Check if we need to split end next. */ -split_huge_pmd_if_needed (vma, end); +split_huge_leaf (vma, end);/* * If we're also updating the next vma vm_start,
@@ -3019,7 +3069,7 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma,struct vm_area_struct *next =find_vma (vma->vm_mm, vma->vm_end);unsigned long nstart = next->vm_start; nstart += adjust_next; -split_huge_pmd_if_needed (next, nstart); +split_huge_leaf (next, nstart); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 637/670 mm/mremap: correctly uncharge accountable VMAs in error path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes (ARM) <[email protected]>
[ Upstream commit 65e722a74df992719676ead85a9e93fb2b5a0983 ]
The mremap error path is a fragile and unwieldy beast - it reverses the page table move then updates vma_remap_struct state to swap VMA, length and address between old and new VMAs in copy_vma_and_data().
If the mremap() operation didn't specify MREMAP_DONTUNMAP then its caller, move_vma(), invokes unmap_source_vma(), which unmaps the new VMA rather than the old one.
For accountable VMAs when MREMAP_DONTUNMAP is not specified, unmap_source_vma() unsets VMA_ACCOUNT_BIT during this unmap in order that only the delta of a VMA expansion is charged (performed by vrm_calc_charge() earlier).
Therefore nothing uncharges the expanded VMA size, and there is a permanent leak in global Committed_AS.
Resolve the issue by uncharging when MREMAP_DONTUNMAP is not specified.
--- mm/mremap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
mm/mremap.c +15 -0
@@ -782,6 +782,21 @@ static unsigned long move_vma(struct vm_area_struct *vma,*/ move_page_tables (new_vma, new_addr, vma, old_addr, moved_len, true, false); + +/* +* When the error path completes, the new VMA will be +* unmapped rather than the old one. +* +* When an accountable move is being performed, this unmapping +* will not uncharge any expansion, so do that now. +* +* A move is accountable if the VMA is accountable and +* MREMAP_DONTUNMAP is not specified, so only do so if the +* latter is true. +*/ +if (vm_flags &VM_ACCOUNT && !(flags &MREMAP_DONTUNMAP )) +vm_unacct_memory (to_account >>PAGE_SHIFT ); + vma = new_vma; old_len = new_len; old_addr = new_addr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 638/670 PCI: dwc: Set DMA_BYPASS bit in outbound IATU CTRL2 register
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Kumar <[email protected]>
[ Upstream commit efadda401c5c8e2390ba66508eba154dbd0db5a9 ]
An outbound iATU region matches any local (AXI/application-side) address that falls within its Base/Limit window and rewrites it to the PCIe-side address programmed in that region's Target Address Registers before the transaction goes out on the link. This matching does not distinguish CPU-initiated transactions from ones issued by the internal DMA engine (eDMA/HDMA).
Example: outbound region 0 is programmed with Base/Limit covering local addresses 0x8000_0000-0x8000_0FFF and Target 0x1_0000_0000, for CPU-initiated accesses. The DMA engine is later given a descriptor whose destination is the host address 0x8000_0080, which happens to fall inside region 0's Base/Limit range. The iATU matches the DMA transaction against region 0 too and rewrites it to 0x1_0000_0080 instead of passing 0x8000_0080 through unchanged. The transaction then lands on the wrong host address, causing data corruption or an IOMMU fault when the rewritten address has no valid mapping.
Set the DMA_BYPASS bit (bit 27) in PCIE_ATU_REGION_CTRL2 when programming outbound iATU regions so only CPU/AXI-initiated transactions are matched against the region; DMA engine transactions bypass the translation and go out on the PCIe link with their original address.
--- drivers/pci/controller/dwc/pcie-designware.c | 2 ++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 3 insertions(+)
drivers/pci/controller/dwc/pcie-designware.c +2 -0
@@ -514,6 +514,8 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci,/* The data-less messages only for now */ val |=PCIE_ATU_INHIBIT_PAYLOAD | atu->code; } + if (dw_pcie_ver_is_ge(pci, 460A)) + val |=PCIE_ATU_DMA_BYPASS ;dw_pcie_writel_atu_ob (pci, atu->index,PCIE_ATU_REGION_CTRL2 , val);/*
drivers/pci/controller/dwc/pcie-designware.h +1 -0
@@ -173,6 +173,7 @@#define PCIE_ATU_REGION_CTRL2 0x004#define PCIE_ATU_ENABLE BIT(31)#define PCIE_ATU_BAR_MODE_ENABLE BIT(30) +#define PCIE_ATU_DMA_BYPASS BIT(27)#define PCIE_ATU_INHIBIT_PAYLOAD BIT(22)#define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19)#define PCIE_ATU_LOWER_BASE 0x008
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 639/670 clk: nuvoton: ma35d1: Keep the clock count in the driver
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 26ec588063d9b6c70773b8729372e2bf6d3ea95a ]
The number of clocks is not a binding since this is a value that can change. As such, in order to support the missing watchdog clocks and allow the deprecation and removal of CLK_MAX_IDX from the bindings, we need to switch to a local definition first.
Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks")
--- drivers/clk/nuvoton/clk-ma35d1.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/nuvoton/clk-ma35d1.c +3 -2
@@ -17,6 +17,7 @@static DEFINE_SPINLOCK (ma35d1_lock);#define PLL_MAX_NUM 5 +#define MA35D1_CLK_COUNT 236/* Clock Control Registers Offset */ #define REG_CLK_PWRCTL 0x00
@@ -467,12 +468,12 @@ static int ma35d1_clocks_probe(struct platform_device *pdev)int ret; ma35d1_hw_data =devm_kzalloc (dev, -struct_size (ma35d1_hw_data, hws,CLK_MAX_IDX ), +struct_size (ma35d1_hw_data, hws,MA35D1_CLK_COUNT ),GFP_KERNEL );if (!ma35d1_hw_data)return -ENOMEM ; - ma35d1_hw_data->num =CLK_MAX_IDX ; + ma35d1_hw_data->num =MA35D1_CLK_COUNT ; hws = ma35d1_hw_data->hws; clk_base =devm_platform_ioremap_resource (pdev,0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 640/670 dt-bindings: clock: ma35d1: Drop CLK_MAX_IDX define
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 653738db38c7c7f0fb959a7870f9461cf4987825 ]
Drop CLK_MAX_IDX define of MA35D1 include. This is not a binding and should not be placed here. Value is defined in the user driver.
Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks")
--- include/dt-bindings/clock/nuvoton,ma35d1-clk.h | 1 - 1 file changed, 1 deletion(-)
include/dt-bindings/clock/nuvoton,ma35d1-clk.h +0 -1
@@ -248,6 +248,5 @@#define ADC_GATE 233#define EADC_DIV 234#define EADC_GATE 235 -#define CLK_MAX_IDX 236#endif /* __DT_BINDINGS_CLOCK_NUVOTON_MA35D1_CLK_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 641/670 dt-bindings: clock: ma35d1: Add missing WDT/WWDT parent clocks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 8c7453cb0b01bee47ec2f902a9ac1872d3b77f3d ]
The WDT and WWDT muxes have PCLK3/4096 and PCLK4/4096 among their possible parents, but these fixed factor clocks are currently not defined, even though they are needed to properly describe the clock tree. Add them to the bindings.
Stable-dep-of: 1dc3871ce7ec ("clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks")
--- include/dt-bindings/clock/nuvoton,ma35d1-clk.h | 2 ++ 1 file changed, 2 insertions(+)
include/dt-bindings/clock/nuvoton,ma35d1-clk.h +2 -0
@@ -248,5 +248,7 @@#define ADC_GATE 233#define EADC_DIV 234#define EADC_GATE 235 +#define PCLK3_DIV4096 236 +#define PCLK4_DIV4096 237#endif /* __DT_BINDINGS_CLOCK_NUVOTON_MA35D1_CLK_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 642/670 clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 1dc3871ce7ec819030c22297f8960c61cc42a990 ]
The WDT and WWDT muxes list PCLK3/4096 and PCLK4/4096 among their possible parents, but the driver never registers the corresponding clocks, so these parents could never be used.
Add pclk3_div4096 and pclk4_div4096 as fixed factor children of pclk3 and pclk4 and expose them through the clock provider.
--- drivers/clk/nuvoton/clk-ma35d1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/nuvoton/clk-ma35d1.c +3 -1
@@ -17,7 +17,7 @@static DEFINE_SPINLOCK (ma35d1_lock);#define PLL_MAX_NUM 5 -#define MA35D1_CLK_COUNT 236 +#define MA35D1_CLK_COUNT 238/* Clock Control Registers Offset */ #define REG_CLK_PWRCTL 0x00
@@ -544,6 +544,8 @@ static int ma35d1_clocks_probe(struct platform_device *pdev) hws[HCLK3 ] =ma35d1_clk_fixed_factor (dev,"hclk3" ,"sysclk1_mux" ,1 ,2 ); hws[PCLK3 ] =ma35d1_clk_fixed_factor (dev,"pclk3" ,"sysclk1_mux" ,1 ,2 ); hws[PCLK4 ] =ma35d1_clk_fixed_factor (dev,"pclk4" ,"sysclk1_mux" ,1 ,2 ); + hws[PCLK3_DIV4096 ] =ma35d1_clk_fixed_factor (dev,"pclk3_div4096" ,"pclk3" ,1 ,4096 ); + hws[PCLK4_DIV4096 ] =ma35d1_clk_fixed_factor (dev,"pclk4_div4096" ,"pclk4" ,1 ,4096 ); hws[USBPHY0 ] =ma35d1_clk_fixed ("usbphy0" ,480000000 ); hws[USBPHY1 ] =ma35d1_clk_fixed ("usbphy1" ,480000000 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 643/670 f2fs: release a removed xattr node in roll-forward recovery
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daeho Jeong <[email protected]>
[ Upstream commit f5924de8867c09206ba631b9faed63862ec00a10 ]
When xattrs shrink enough to fit in the inline xattr area, write_all_xattrs() truncates the xattr node and clears i_xattr_nid. If the file is then fsynced without a checkpoint, only the inode block is written, with i_xattr_nid of 0.
Roll-forward recovery starts from the checkpointed inode, whose i_xattr_nid still points to the old xattr node. f2fs_recover_inline_xattr() copies only the inline xattr area, and f2fs_update_inode() writes the old i_xattr_nid back. So the inode keeps the stale xattr node:
- The node block is never released, and fsck reports "nonzero bytes in xattr space after end of list".
- If the inline xattr list ends exactly at the end of the inline area, its terminator is read from the stale node, and the removed xattrs come back after recovery.
When the fsynced inode has no xattr node but the checkpointed one has, release the old xattr node as truncate_node() does: check its block address, invalidate the block and drop its node cache, which may still be dirty.
--- fs/f2fs/node.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
fs/f2fs/node.c +39 -0
@@ -2779,6 +2779,45 @@ int f2fs_recover_inline_xattr(struct inode *inode, struct page *page)f2fs_wait_on_page_writeback (ipage,NODE , true, true);memcpy (dst_addr, src_addr, inline_size); update_inode: +/* +* The xattr node of the checkpoint was removed before fsync, e.g. the +* xattrs became small enough to fit inline. Release it as well, or +* the inode keeps pointing to the stale xattrs. +*/ +if (!ri->i_xattr_nid &&F2FS_I (inode)->i_xattr_nid) { +struct f2fs_sb_info *sbi =F2FS_I_SB (inode); +struct node_info ni; +int err; + + err =f2fs_get_node_info (sbi,F2FS_I (inode)->i_xattr_nid, + &ni, false); +if (err) { +f2fs_put_page (ipage,1 ); +return err; + } + +if (ni.blk_addr !=NEW_ADDR && + !f2fs_is_valid_blkaddr (sbi, ni.blk_addr, +DATA_GENERIC_ENHANCE )) { +f2fs_err_ratelimited (sbi, +"nat entry is corrupted, run fsck to fix it, ino:%u, nid:%u, blkaddr:%u" , + ni.ino, ni.nid, ni.blk_addr); +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_handle_error (sbi,ERROR_INCONSISTENT_NAT ); +f2fs_put_page (ipage,1 ); +return -EFSCORRUPTED ; + } + +f2fs_invalidate_blocks (sbi, ni.blk_addr); +dec_valid_node_count (sbi, inode, false); +set_node_addr (sbi, &ni,NULL_ADDR , false); +/* drop the cached xattr node, which may be dirty */ +truncate_inode_pages_range (NODE_MAPPING (sbi), +F2FS_BLK_TO_BYTES ((loff_t )ni.nid), +F2FS_BLK_END_BYTES ((loff_t )ni.nid)); +f2fs_i_xnid_write (inode,0 ); + } +f2fs_update_inode (inode, ipage);f2fs_put_page (ipage,1 );return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 644/670 Input: always accept EV_SYN in input_event()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit c1d13bfdb9c75c2885d10332174a887349eb0b51 ]
Commit 0cd587735205 ("Input: preallocate memory to hold event values") moved allocation of dev->vals into input_allocate_device(), which caused input core to accumulate events reported while seeding initial device state before input_register_device().
However, because EV_SYN is only set in dev->evbit during input_register_device() (and some drivers also overwrite dev->evbit directly before registration), any EV_SYN/SYN_REPORT events sent before registration were dropped by is_event_supported(), leaving those seeded events stuck in dev->vals until the next SYN_REPORT after registration.
Always accept EV_SYN in input_event() and input_inject_event() without checking dev->evbit so input_sync() flushes dev->vals as intended.
--- drivers/input/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/input.c +2 -2
@@ -392,7 +392,7 @@ void input_event(struct input_dev *dev, {unsigned long flags; -if (is_event_supported (type, dev->evbit,EV_MAX )) { +if (type ==EV_SYN ||is_event_supported (type, dev->evbit,EV_MAX )) {spin_lock_irqsave (&dev->event_lock, flags);input_handle_event (dev, type, code, value);
@@ -419,7 +419,7 @@ void input_inject_event(struct input_handle *handle,struct input_handle *grab;unsigned long flags; -if (is_event_supported (type, dev->evbit,EV_MAX )) { +if (type ==EV_SYN ||is_event_supported (type, dev->evbit,EV_MAX )) {spin_lock_irqsave (&dev->event_lock, flags);rcu_read_lock ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 645/670 media: ipu6: Fix firmware config leak on stream start
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <[email protected]>
[ Upstream commit d3d9bc694fe087c672c3ad5871984dc45cd9f425 ]
ipu6_isys_fwcom_cfg_init() runs on every first stream start and allocates the firmware config and queue configs with devm, so each STREAMON/STREAMOFF cycle leaks them. They are only needed until ipu6_fw_com_prepare() has copied them, so free them right after. Also check the return value, an allocation failure would otherwise make ipu6_fw_com_prepare() dereference a NULL queue config.
--- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 29 ++++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/media/pci/intel/ipu6/ipu6-fw-isys.c +19 -10
@@ -218,7 +218,6 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys,unsigned int max_send_queues, max_sram_blocks, max_devq_size;struct ipu6_fw_syscom_queue_config *input_queue_cfg;struct ipu6_fw_syscom_queue_config *output_queue_cfg; -struct device *dev = &isys->adev->auxdev.dev;int type_proxy =IPU6_FW_ISYS_QUEUE_TYPE_PROXY ;int type_dev =IPU6_FW_ISYS_QUEUE_TYPE_DEV ;int type_msg =IPU6_FW_ISYS_QUEUE_TYPE_MSG ;
@@ -228,7 +227,6 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys,struct ipu6_fw_isys_fw_config *isys_fw_cfg;u32 num_in_message_queues;unsigned int max_streams; -unsigned int size;unsigned int i; max_streams = isys->pdata->ipdata->max_streams;
@@ -236,7 +234,7 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys, max_sram_blocks = isys->pdata->ipdata->max_sram_blocks; max_devq_size = isys->pdata->ipdata->max_devq_size; num_in_message_queues =clamp (num_streams,1U , max_streams); - isys_fw_cfg =devm_kzalloc (dev,sizeof (*isys_fw_cfg),GFP_KERNEL ); + isys_fw_cfg =kzalloc_obj (*isys_fw_cfg);if (!isys_fw_cfg)return -ENOMEM ;
@@ -248,15 +246,14 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys, isys_fw_cfg->num_recv_queues[type_dev] =0 ; isys_fw_cfg->num_recv_queues[type_msg] =1 ; - size =sizeof (*input_queue_cfg) * max_send_queues; - input_queue_cfg =devm_kzalloc (dev, size,GFP_KERNEL ); + input_queue_cfg =kzalloc_objs (*input_queue_cfg, max_send_queues);if (!input_queue_cfg) -return -ENOMEM ; + goto err_free_fw_cfg; - size =sizeof (*output_queue_cfg) *IPU6_N_MAX_RECV_QUEUES ; - output_queue_cfg =devm_kzalloc (dev, size,GFP_KERNEL ); + output_queue_cfg =kzalloc_objs (*output_queue_cfg, +IPU6_N_MAX_RECV_QUEUES );if (!output_queue_cfg) -return -ENOMEM ; + goto err_free_input_queue_cfg; fwcom->input = input_queue_cfg; fwcom->output = output_queue_cfg;
@@ -319,6 +316,13 @@ static int ipu6_isys_fwcom_cfg_init(struct ipu6_isys *isys, fwcom->specific_size =sizeof (*isys_fw_cfg);return 0 ; + +err_free_input_queue_cfg: +kfree (input_queue_cfg); +err_free_fw_cfg: +kfree (isys_fw_cfg); + +return -ENOMEM ; }int ipu6_fw_isys_init (struct ipu6_isys *isys,unsigned int num_streams)
@@ -332,10 +336,15 @@ int ipu6_fw_isys_init(struct ipu6_isys *isys, unsigned int num_streams) };int ret; -ipu6_isys_fwcom_cfg_init (isys, &fwcom, num_streams); + ret =ipu6_isys_fwcom_cfg_init (isys, &fwcom, num_streams); +if (ret) +return ret; isys->fwcom =ipu6_fw_com_prepare (&fwcom, isys->adev, isys->pdata->base); +kfree (fwcom.specific_addr); +kfree (fwcom.output); +kfree (fwcom.input);if (!isys->fwcom) {dev_err (dev,"isys fw com prepare failed\n" );return -EIO ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 646/670 mm/vma: avoid broken uffd merge on mremap
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes (ARM) <[email protected]>
[ Upstream commit 68cb098eadda190783f8f8bdf9fe764df59f7d32 ]
Userfaultfd often causes unexpected interactions within mm, and does so at the intersection of uffd, mremap() and VMA merging.
When an mremap of a VMA occurs, copy_vma_and_data() calls mremap_userfaultfd_prep() to notify uffd of this.
However, mremap_userfaultfd_prep() simply drops the UFFD context for the VMA if the user did not register it for remap, i.e. didn't specify the UFFD_FEATURE_EVENT_REMAP flag.
This is OK for the VMA itself, as upon page table move, move_ptes() clears UFFD page table flags, using vma_has_uffd_without_event_remap() to determine whether to do so.
However, this doesn't account for merging with adjacent VMAs, whose page tables won't have received this treatment, and thus latent UFFD markers will be left around.
Worse, it'll break UFFD for any VMAs it is merged with. This is very surprising behaviour for a user, who will then simply not receive UFFD events for VMAs they ought to.
Resolve the issue by explicitly checking for this case via vma_has_uffd_without_event_remap() in vma_merge_copied_range(), the merge function explicitly designated for mremap() operations.
Also update the userland VMA tests accordingly.
--- mm/vma.c | 5 ++++- tools/testing/vma/vma_internal.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
mm/vma.c +4 -1
@@ -1694,7 +1694,10 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, faulted_in_anon_vma = true; } - new_vma =vma_merge_new_range (&vmg); +/* If not registered for remap, uffd context will be cleared. */ + new_vma =NULL ; +if (!vma_has_uffd_without_event_remap (vma)) + new_vma =vma_merge_new_range (&vmg);if (new_vma) {/*
tools/testing/vma/vma_internal.h +2 -0
@@ -605,6 +605,8 @@ static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma,return true; } +#define vma_has_uffd_without_event_remap (vma) false +static inline bool anon_vma_name_eq (struct anon_vma_name *anon_name1,struct anon_vma_name *anon_name2) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 647/670 ALSA: aloop: Use guard() for mutex locks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit ebd9b6c91d4e345b7ded4b56567c46267a45d961 ]
Replace the manual mutex lock/unlock pairs with guard() for code simplification.
Only code refactoring, and no behavior change.
Stable-dep-of: ded106036984 ("ALSA: aloop: Don't constrain playback params in notify mode")
--- sound/drivers/aloop.c | 83 +++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 50 deletions(-)
sound/drivers/aloop.c +33 -50
@@ -532,13 +532,12 @@ static int loopback_prepare(struct snd_pcm_substream *substream) dpcm->pcm_salign = salign; dpcm->pcm_period_size =frames_to_bytes (runtime, runtime->period_size); -mutex_lock (&dpcm->loopback->cable_lock); +guard (mutex)(&dpcm->loopback->cable_lock);if (!(cable->valid & ~(1 << substream->stream)) || (get_setup (dpcm)->notify && substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ))params_change (substream); cable->valid |=1 << substream->stream; -mutex_unlock (&dpcm->loopback->cable_lock);return 0 ; }
@@ -979,9 +978,8 @@ static int loopback_hw_free(struct snd_pcm_substream *substream)struct loopback_pcm *dpcm = runtime->private_data;struct loopback_cable *cable = dpcm->cable; -mutex_lock (&dpcm->loopback->cable_lock); +guard (mutex)(&dpcm->loopback->cable_lock); cable->valid &= ~(1 << substream->stream); -mutex_unlock (&dpcm->loopback->cable_lock);return 0 ; }
@@ -1001,10 +999,10 @@ static int rule_format(struct snd_pcm_hw_params *params,struct snd_mask m;snd_mask_none (&m); -mutex_lock (&dpcm->loopback->cable_lock); - m.bits[0 ] = (u_int32_t )cable->hw.formats; - m.bits[1 ] = (u_int32_t)(cable->hw.formats >>32 ); -mutex_unlock (&dpcm->loopback->cable_lock); + scoped_guard(mutex, &dpcm->loopback->cable_lock) { + m.bits[0 ] = (u_int32_t )cable->hw.formats; + m.bits[1 ] = (u_int32_t)(cable->hw.formats >>32 ); + }return snd_mask_refine (hw_param_mask (params, rule->var), &m); }
@@ -1015,10 +1013,10 @@ static int rule_rate(struct snd_pcm_hw_params *params,struct loopback_cable *cable = dpcm->cable;struct snd_interval t; -mutex_lock (&dpcm->loopback->cable_lock); - t.min = cable->hw.rate_min; - t.max = cable->hw.rate_max; -mutex_unlock (&dpcm->loopback->cable_lock); + scoped_guard(mutex, &dpcm->loopback->cable_lock) { + t.min = cable->hw.rate_min; + t.max = cable->hw.rate_max; + } t.openmin = t.openmax =0 ; t.integer =0 ;return snd_interval_refine (hw_param_interval (params, rule->var), &t);
@@ -1031,10 +1029,10 @@ static int rule_channels(struct snd_pcm_hw_params *params,struct loopback_cable *cable = dpcm->cable;struct snd_interval t; -mutex_lock (&dpcm->loopback->cable_lock); - t.min = cable->hw.channels_min; - t.max = cable->hw.channels_max; -mutex_unlock (&dpcm->loopback->cable_lock); + scoped_guard(mutex, &dpcm->loopback->cable_lock) { + t.min = cable->hw.channels_min; + t.max = cable->hw.channels_max; + } t.openmin = t.openmax =0 ; t.integer =0 ;return snd_interval_refine (hw_param_interval (params, rule->var), &t);
@@ -1047,10 +1045,10 @@ static int rule_period_bytes(struct snd_pcm_hw_params *params,struct loopback_cable *cable = dpcm->cable;struct snd_interval t; -mutex_lock (&dpcm->loopback->cable_lock); - t.min = cable->hw.period_bytes_min; - t.max = cable->hw.period_bytes_max; -mutex_unlock (&dpcm->loopback->cable_lock); + scoped_guard(mutex, &dpcm->loopback->cable_lock) { + t.min = cable->hw.period_bytes_min; + t.max = cable->hw.period_bytes_max; + } t.openmin =0 ; t.openmax =0 ; t.integer =0 ;
@@ -1264,12 +1262,10 @@ static int loopback_open(struct snd_pcm_substream *substream)int err =0 ;int dev =get_cable_index (substream); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); dpcm =kzalloc (sizeof (*dpcm),GFP_KERNEL ); -if (!dpcm) { - err = -ENOMEM ; - goto unlock; - } +if (!dpcm) +return -ENOMEM ; dpcm->loopback = loopback; dpcm->substream = substream;
@@ -1354,7 +1350,6 @@ static int loopback_open(struct snd_pcm_substream *substream)free_cable (substream);kfree (dpcm); } -mutex_unlock (&loopback->cable_lock);return err; }
@@ -1366,9 +1361,8 @@ static int loopback_close(struct snd_pcm_substream *substream)if (dpcm->cable->ops->close_substream) err = dpcm->cable->ops->close_substream (dpcm); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock);free_cable (substream); -mutex_unlock (&loopback->cable_lock);return err; }
@@ -1419,11 +1413,10 @@ static int loopback_rate_shift_get(struct snd_kcontrol *kcontrol, {struct loopback *loopback =snd_kcontrol_chip (kcontrol); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); ucontrol->value.integer.value[0 ] = loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].rate_shift; -mutex_unlock (&loopback->cable_lock);return 0 ; }
@@ -1439,14 +1432,13 @@ static int loopback_rate_shift_put(struct snd_kcontrol *kcontrol, val =80000 ;if (val >120000 ) val =120000 ; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock);if (val != loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].rate_shift) { loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].rate_shift = val; change =1 ; } -mutex_unlock (&loopback->cable_lock);return change; }
@@ -1455,11 +1447,10 @@ static int loopback_notify_get(struct snd_kcontrol *kcontrol, {struct loopback *loopback =snd_kcontrol_chip (kcontrol); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); ucontrol->value.integer.value[0 ] = loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].notify; -mutex_unlock (&loopback->cable_lock);return 0 ; }
@@ -1471,14 +1462,13 @@ static int loopback_notify_put(struct snd_kcontrol *kcontrol,int change =0 ; val = ucontrol->value.integer.value[0 ] ?1 :0 ; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock);if (val != loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].notify) { loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].notify = val; change =1 ; } -mutex_unlock (&loopback->cable_lock);return change; }
@@ -1490,14 +1480,13 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,unsigned int val =0 ; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^1 ];if (cable !=NULL ) {unsigned int running = cable->running ^ cable->pause; val = (running & (1 <<SNDRV_PCM_STREAM_PLAYBACK )) ?1 :0 ; } -mutex_unlock (&loopback->cable_lock); ucontrol->value.integer.value[0 ] = val;return 0 ; }
@@ -1540,11 +1529,10 @@ static int loopback_rate_get(struct snd_kcontrol *kcontrol, {struct loopback *loopback =snd_kcontrol_chip (kcontrol); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); ucontrol->value.integer.value[0 ] = loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].rate; -mutex_unlock (&loopback->cable_lock);return 0 ; }
@@ -1564,11 +1552,10 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol, {struct loopback *loopback =snd_kcontrol_chip (kcontrol); -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); ucontrol->value.integer.value[0 ] = loopback->setup[kcontrol->id.subdevice] [kcontrol->id.device].channels; -mutex_unlock (&loopback->cable_lock);return 0 ; }
@@ -1586,12 +1573,11 @@ static int loopback_access_get(struct snd_kcontrol *kcontrol,struct loopback *loopback =snd_kcontrol_chip (kcontrol);snd_pcm_access_t access; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); access = loopback->setup[kcontrol->id.subdevice][kcontrol->id.device].access; ucontrol->value.enumerated.item[0 ] = !is_access_interleaved (access); -mutex_unlock (&loopback->cable_lock);return 0 ; }
@@ -1759,12 +1745,11 @@ static void print_cable_info(struct snd_info_entry *entry,struct loopback *loopback = entry->private_data;int sub, num; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock); num = entry->name[strlen (entry->name)-1 ]; num = num =='0' ?0 :1 ;for (sub =0 ; sub <MAX_PCM_SUBSTREAMS ; sub++)print_substream_info (buffer, loopback, sub, num); -mutex_unlock (&loopback->cable_lock); }static int loopback_cable_proc_new (struct loopback *loopback,int cidx)
@@ -1793,10 +1778,9 @@ static void print_timer_source_info(struct snd_info_entry *entry, {struct loopback *loopback = entry->private_data; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock);snd_iprintf (buffer,"%s\n" , loopback->timer_source ? loopback->timer_source :"" ); -mutex_unlock (&loopback->cable_lock); } static void change_timer_source_info(struct snd_info_entry *entry,
@@ -1805,10 +1789,9 @@ static void change_timer_source_info(struct snd_info_entry *entry,struct loopback *loopback = entry->private_data;char line[64 ]; -mutex_lock (&loopback->cable_lock); +guard (mutex)(&loopback->cable_lock);if (!snd_info_get_line (buffer, line,sizeof (line)))loopback_set_timer_source (loopback,strim (line)); -mutex_unlock (&loopback->cable_lock); }static int loopback_timer_source_proc_new (struct loopback *loopback)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 648/670 ALSA: aloop: Dont constrain playback params in notify mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrik Enquist <[email protected]>
[ Upstream commit ded106036984a9dd766e7e1451b02e2d15c81438 ]
With notify enabled (the pcm_notify module parameter or the "PCM Notify" control), the playback side of a cable may change format, rate and channels while a capture is running. loopback_check_format() then stops the capture and notifies the "PCM Slave" controls, so that the capture application can reopen with the new parameters. For this reason loopback_open() still gives a notify mode playback the unconstrained loopback_pcm_hardware.
Since commit 898dfe4687f4 ("ALSA: aloop: Fix racy hw constraints adjustment") the hw rules refine against the shared cable->hw instead of the substream's own runtime->hw. This pins the playback side to the parameters of an open capture whatever the notify setting is. A player probing the device sees only the capture's rate, format and channels, and the format change path in loopback_check_format() can't be reached by a new playback.
Skip the format, rate and channels rules for the playback substream when notify is enabled. Skip the period bytes rule as well: with a sound timer source, params_change() already takes the period size from a notify mode playback, and keeping the old capture's period bytes leaves a playback at another rate with a period that doesn't match the timer. The capture side stays constrained to the cable parameters.
The capture stop this makes reachable again was hardened by commit 826af7fa62e3 ("ALSA: aloop: Fix racy access at PCM trigger") and commit e5c33cdc6f40 ("ALSA: aloop: Fix peer runtime UAF during format-change stop"), which need to be applied first when backporting.
Reproducer, with notify enabled on the cable:
arecord -D hw:Loopback,1,0 -r 44100 -f S32_LE -c 2 /dev/null & aplay -D hw:Loopback,0,0 96k.wav
Before: aplay is forced to 44100 Hz and the capture keeps running.
After: aplay runs at 96000 Hz, the capture is stopped and "PCM Slave Rate" reports 96000.
--- sound/drivers/aloop.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/drivers/aloop.c +20 -0
@@ -991,6 +991,18 @@ static unsigned int get_cable_index(struct snd_pcm_substream *substream)return !substream->stream; } +/* +* In notify mode the playback side may change format, rate, channels and, +* with a sound timer, the period size. A running capture that no longer +* matches is stopped by loopback_check_format(). +* call in loopback->cable_lock +*/ +static bool loopback_playback_unconstrained (struct loopback_pcm *dpcm) +{ +return dpcm->substream->stream ==SNDRV_PCM_STREAM_PLAYBACK && +get_notify (dpcm); +} +static int rule_format (struct snd_pcm_hw_params *params,struct snd_pcm_hw_rule *rule) {
@@ -1000,6 +1012,8 @@ static int rule_format(struct snd_pcm_hw_params *params,snd_mask_none (&m); scoped_guard(mutex, &dpcm->loopback->cable_lock) { +if (loopback_playback_unconstrained (dpcm)) +return 0 ; m.bits[0 ] = (u_int32_t )cable->hw.formats; m.bits[1 ] = (u_int32_t)(cable->hw.formats >>32 ); }
@@ -1014,6 +1028,8 @@ static int rule_rate(struct snd_pcm_hw_params *params,struct snd_interval t; scoped_guard(mutex, &dpcm->loopback->cable_lock) { +if (loopback_playback_unconstrained (dpcm)) +return 0 ; t.min = cable->hw.rate_min; t.max = cable->hw.rate_max; }
@@ -1030,6 +1046,8 @@ static int rule_channels(struct snd_pcm_hw_params *params,struct snd_interval t; scoped_guard(mutex, &dpcm->loopback->cable_lock) { +if (loopback_playback_unconstrained (dpcm)) +return 0 ; t.min = cable->hw.channels_min; t.max = cable->hw.channels_max; }
@@ -1046,6 +1064,8 @@ static int rule_period_bytes(struct snd_pcm_hw_params *params,struct snd_interval t; scoped_guard(mutex, &dpcm->loopback->cable_lock) { +if (loopback_playback_unconstrained (dpcm)) +return 0 ; t.min = cable->hw.period_bytes_min; t.max = cable->hw.period_bytes_max; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 649/670 iommufd/iova_bitmap: Ensure that iova_bitmap_set() handles the full IOVA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <[email protected]>
[ Upstream commit e21952d72b4740f08a272d694cca223b6b0099ca ]
Generally userspace is going to step the dirty bitmap through the IOVA space. However if the bitmap ends in the middle of a large PTE this is problematic. The first step will clear the dirty bit and report dirty to the end of its bitmap while the second step will see the clear'd dirty and report clean for the start of the bitmap. If it happens this ends up losing dirties.
Further this function is missing bounds checking so if this does happen ther is a good chance it will write memory beyond what the userspace was expecting.
Return an error code if this illegal condition happens.
--- drivers/iommu/iommufd/io_pagetable.c | 2 +- drivers/iommu/iommufd/iova_bitmap.c | 19 ++++++++++++++++++- include/uapi/linux/iommufd.h | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-)
drivers/iommu/iommufd/io_pagetable.c +1 -1
@@ -505,7 +505,7 @@ iommu_read_and_clear_dirty(struct iommu_domain *domain, arg.iopt = iopt; arg.domain = domain; arg.dirty = &dirty; -iova_bitmap_for_each (iter, &arg, __iommu_read_and_clear_dirty); + ret =iova_bitmap_for_each (iter, &arg, __iommu_read_and_clear_dirty);if (!(flags &IOMMU_DIRTY_NO_CLEAR ))iommu_iotlb_sync (domain, &gather);
drivers/iommu/iommufd/iova_bitmap.c +18 -1
@@ -116,6 +116,9 @@ struct iova_bitmap {/* length of the IOVA range for the whole bitmap */ size_t length; + +/* first error encountered while recording dirty IOVAs */ +int err; };/*
@@ -384,7 +387,9 @@ static int iova_bitmap_advance_to(struct iova_bitmap *bitmap,int iova_bitmap_for_each (struct iova_bitmap *bitmap,void *opaque,iova_bitmap_fn_t fn) { -return fn (bitmap, bitmap->iova, bitmap->length, opaque); +int ret =fn (bitmap, bitmap->iova, bitmap->length, opaque); + +return ret ? ret : bitmap->err; }EXPORT_SYMBOL_NS_GPL (iova_bitmap_for_each,IOMMUFD );
@@ -404,6 +409,18 @@ void iova_bitmap_set(struct iova_bitmap *bitmap,struct iova_bitmap_map *mapped = &bitmap->mapped;unsigned long cur_bit, last_bit, last_page_idx; +/* +* If the range cannot be recorded then the system call returns failure. +* This is to prevent loosing dirties if userspace is expecting to step +* the bitmap through the IOVA space. +*/ +if (!length || length > bitmap->length || iova < bitmap->iova || + iova - bitmap->iova > bitmap->length - length) { +if (!bitmap->err) + bitmap->err = -EPROTO ; +return ; + } + update_indexes:if (unlikely (!iova_bitmap_mapped_range (mapped, iova, length))) {
include/uapi/linux/iommufd.h +6 -0
@@ -621,6 +621,12 @@ enum iommufd_hwpt_get_dirty_bitmap_flags {* Walk the IOMMU pagetables for a given IOVA range to return a bitmap * with the dirty IOVAs. In doing so it will also by default clear any * dirty bit metadata set in the IOPTE. +* +* The IOVA range given must fully enclose any IOPTE. If the range starts or +* ends inside a dirty IOPTE then the ioctl will fail. This avoids partially +* reporting a dirty range. +* +* On failure the dirty state becomes unknown and the userspace must restart. */ struct iommu_hwpt_get_dirty_bitmap {__u32 size;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 650/670 hwmon: (coretemp) Return -ENODATA for invalid temperature readings
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
[ Upstream commit f63aaa529cbc73146ff0d52235e5479042285cae ]
IA32_THERM_STATUS and IA32_PACKAGE_THERM_STATUS have a valid bit, bit 31. The Intel SDM documents it only for the former, but the package register implements it too: x86_pkg_temp_thermal has required it since commit f1a18a105660 ("Thermal: CPU Package temperature thermal").
This driver checked the bit for both registers as well, until commit bf6ea084ebb5 ("hwmon: (coretemp) Do not return -EAGAIN for low temperatures") made it ignore the bit because some CPUs clear it while the temperature is too low to be measured. Since then, temp%d_input reports such a reading as a real temperature. Userspace cannot tell it apart from a genuinely low one.
Fail the read with -ENODATA while the CPU reports the reading as invalid. On a CPU that clears the bit, reading temp%d_input now fails where it used to return a low value. sensors(1) shows N/A in its place.
--- Documentation/hwmon/coretemp.rst | 3 +++ drivers/hwmon/coretemp.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
Documentation/hwmon/coretemp.rst +3 -0
@@ -47,6 +47,9 @@ All Sysfs entries are named with their core_id (represented here by 'X'). ================= ======================================================== tempX_input Core temperature (in millidegrees Celsius). + Reading fails with -ENODATA while the CPU reports the + temperature as invalid. Some CPUs do this when the + temperature is too low to be measured. tempX_max All cooling devices should be turned on (on Core2). tempX_crit Maximum junction temperature (in millidegrees Celsius). tempX_crit_alarm Set when Out-of-spec bit is set, never clears.
drivers/hwmon/coretemp.c +15 -6
@@ -61,6 +61,8 @@ enum coretemp_attr_index {/* * Per-Core Temperature Data +* @temp_valid: Whether the CPU reported @temp as valid. @temp is not +* reported when this is false. * @tjmax: The static tjmax value when tjmax cannot be retrieved from * IA32_TEMPERATURE_TARGET MSR. * @last_updated: The time when the current temperature value was updated
@@ -73,6 +75,7 @@ enum coretemp_attr_index {*/ struct temp_data {int temp; +bool temp_valid;int tjmax;unsigned long last_updated;unsigned int cpu;
@@ -397,7 +400,8 @@ static ssize_t show_temp(struct device *dev, {u32 eax, edx; struct temp_data *tdata = container_of(devattr, struct temp_data, sd_attrs[ATTR_TEMP]); -int tjmax; +int tjmax, temp; +bool valid;mutex_lock (&tdata->update_lock);
@@ -406,17 +410,22 @@ static ssize_t show_temp(struct device *dev,if (time_after (jiffies, tdata->last_updated +HZ )) {rdmsr_on_cpu (tdata->cpu, tdata->status_reg, &eax, &edx);/* -* Ignore the valid bit. In all observed cases the register -* value is either low or zero if the valid bit is 0. -* Return it instead of reporting an error which doesn't -* really help at all. +* Bit 31 indicates whether the reading is valid. Some CPUs +* clear it while the temperature is too low to be measured. +* Such a reading is not a temperature. Do not report it. */ + tdata->temp_valid = (eax >>31 ) &1 ; tdata->temp = tjmax - ((eax >>16 ) &0xff ) *1000 ; tdata->last_updated = jiffies; } + valid = tdata->temp_valid; + temp = tdata->temp;mutex_unlock (&tdata->update_lock); -return sprintf (buf,"%d\n" , tdata->temp); + +if (!valid) +return -ENODATA ; +return sprintf (buf,"%d\n" , temp); }static int create_core_attrs (struct temp_data *tdata,struct device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 651/670 crypto: omap - add omap_sham_unregister_algs helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit c3494e6fbb35579a131de11369b658a59b1323e5 ]
Add a new helper omap_sham_unregister_algs() and replace two for loops in omap_sham_probe() and omap_sham_remove(), which also ensure ->registered is reset to 0.
Stable-dep-of: be51ea091c65 ("crypto: omap-sham - fix crypto engine cleanup")
--- drivers/crypto/omap-sham.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/crypto/omap-sham.c +16 -11
@@ -2045,6 +2045,20 @@ static const struct attribute_group omap_sham_attr_group = { .attrs = omap_sham_attrs, }; +static void omap_sham_unregister_algs (const struct omap_sham_pdata *pdata) +{ +struct omap_sham_algs_info *alg_info; +int i; + +for (i = pdata->algs_info_size -1 ; i >=0 ; i--) { + alg_info = &pdata->algs_info[i]; + +crypto_engine_unregister_ahashes (alg_info->algs_list, + alg_info->registered); + alg_info->registered =0 ; + } +} +static int omap_sham_probe (struct platform_device *pdev) {struct omap_sham_dev *dd;
@@ -2168,10 +2182,7 @@ static int omap_sham_probe(struct platform_device *pdev)return 0 ; err_algs: -for (i = dd->pdata->algs_info_size -1 ; i >=0 ; i--) -for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) -crypto_engine_unregister_ahash ( - &dd->pdata->algs_info[i].algs_list[j]); +omap_sham_unregister_algs (dd->pdata); err_engine_start:crypto_engine_exit (dd->engine); err_engine:
@@ -2192,19 +2203,13 @@ static int omap_sham_probe(struct platform_device *pdev)static void omap_sham_remove (struct platform_device *pdev) {struct omap_sham_dev *dd; -int i, j; dd =platform_get_drvdata (pdev);spin_lock_bh (&sham.lock);list_del (&dd->list);spin_unlock_bh (&sham.lock); -for (i = dd->pdata->algs_info_size -1 ; i >=0 ; i--) -for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) { -crypto_engine_unregister_ahash ( - &dd->pdata->algs_info[i].algs_list[j]); - dd->pdata->algs_info[i].registered--; - } +omap_sham_unregister_algs (dd->pdata);cancel_work_sync (&dd->done_task);pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 652/670 crypto: omap-sham - fix crypto engine cleanup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit be51ea091c6563158531e8c74e040552fdb1e28c ]
omap_sham_probe() allocates and starts a crypto engine, but the remove path does not call the matching crypto_engine_exit(). The probe failure path already performs this cleanup.
crypto_engine_alloc_init() creates a kthread worker for processing requests. Without crypto_engine_exit() during driver removal, the worker is left running after the device is removed.
Call crypto_engine_exit() after unregistering the algorithms and before tearing down the remaining request handling resources. This stops the engine and destroys its worker.
This issue was found by manual code inspection.
--- drivers/crypto/omap-sham.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/omap-sham.c +1 -0
@@ -2210,6 +2210,7 @@ static void omap_sham_remove(struct platform_device *pdev)list_del (&dd->list);spin_unlock_bh (&sham.lock);omap_sham_unregister_algs (dd->pdata); +crypto_engine_exit (dd->engine);cancel_work_sync (&dd->done_task);pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 653/670 ALSA: usb-audio: rename QUIRK_FLAG_MIXER_MIN_MUTE to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cryolitia PukNgae <[email protected]>
[ Upstream commit ace1817ab49b3f92b3e965caa63b4a78e69266cd ]
As a preparation of introduction QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE
Also make it printing an info while applying
Stable-dep-of: 874323b68c93 ("ALSA: usb-audio: Add mic resolution quirk for Logitech Webcam C200")
--- sound/usb/mixer_quirks.c | 7 +++++-- sound/usb/quirks.c | 20 ++++++++++---------- sound/usb/usbaudio.h | 4 ++-- 3 files changed, 17 insertions(+), 14 deletions(-)
sound/usb/mixer_quirks.c +5 -2
@@ -4501,9 +4501,12 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, }/* lowest playback value is muted on some devices */ -if (mixer->chip->quirk_flags &QUIRK_FLAG_MIXER_MIN_MUTE ) -if (strstr (kctl->id.name,"Playback" )) +if (mixer->chip->quirk_flags &QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ) +if (strstr (kctl->id.name,"Playback" )) { +usb_audio_info (mixer->chip, +"applying playback min mute quirk\n" ); cval->min_mute =1 ; + }/* ALSA-ify some Plantronics headset control names */ if (USB_ID_VENDOR(mixer->chip->usb_id) == 0x047f &&
sound/usb/quirks.c +10 -10
@@ -2202,9 +2202,9 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x0556 ,0x0014 ,/* Phoenix Audio TMX320VC */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0572 ,0x1b08 ,/* Conexant Systems (Rockwell), Inc. */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x0572 ,0x1b09 ,/* Conexant Systems (Rockwell), Inc. */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x05a3 ,0x9420 ,/* ELP HD USB Camera */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x05a7, 0x1020, /* Bose Companion 5 */
@@ -2254,15 +2254,15 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x0b0e ,0x0349 ,/* Jabra 550a */ QUIRK_FLAG_CTL_MSG_DELAY_1M ),DEVICE_FLG (0x0bda ,0x498a ,/* Realtek Semiconductor Corp. */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x0c45 ,0x6340 ,/* Sonix HD USB Camera */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0c45 ,0x636b ,/* Microdia JP001 USB Camera */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0d8c ,0x000c ,/* C-Media */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x0d8c ,0x0014 ,/* C-Media */ -QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ QUIRK_FLAG_FIXED_RATE ), DEVICE_FLG(0x0ecb, 0x2125, /* JBL Quantum650 Wireless */
@@ -2274,7 +2274,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x1101 ,0x0003 ,/* Audioengine D1 */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x12d1 ,0x3a07 ,/* Huawei Technologies Co., Ltd. */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
@@ -2320,7 +2320,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x1901 ,0x0191 ,/* GE B850V3 CP2114 audio interface */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x19f7 ,0x0003 ,/* RODE NT-USB */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x1bcf, 0x2281, /* HD Webcam */
@@ -2378,7 +2378,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x2912 ,0x30c8 ,/* Audioengine D1 */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x2a70 ,0x1881 ,/* OnePlus Technology (Shenzhen) Co., Ltd. BE02T */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x2b53 ,0x0023 ,/* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB ), DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */
@@ -2390,7 +2390,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x2d95 ,0x8021 ,/* VIVO USB-C-XE710 HEADSET */ QUIRK_FLAG_CTL_MSG_DELAY_1M ),DEVICE_FLG (0x2d99 ,0x0026 ,/* HECATE G2 GAMING HEADSET */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x2fc6 ,0xf0b7 ,/* iBasso DC07 Pro */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), DEVICE_FLG(0x30be, 0x0101, /* Schiit Hel */
@@ -2398,7 +2398,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x3255 ,0x0000 ,/* Luxman D-10X */ QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY ),DEVICE_FLG (0x339b ,0x3a07 ,/* Synaptics HONOR USB-C HEADSET */ -QUIRK_FLAG_MIXER_MIN_MUTE ), +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x413c ,0xa506 ,/* Dell AE515 sound bar */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x534d, 0x0021, /* MacroSilicon MS2100/MS2106 */
sound/usb/usbaudio.h +2 -2
@@ -196,7 +196,7 @@ extern bool snd_usb_skip_validation;* for the given endpoint. * QUIRK_FLAG_MIC_RES_16 and QUIRK_FLAG_MIC_RES_384 * Set the fixed resolution for Mic Capture Volume (mostly for webcams) -* QUIRK_FLAG_MIXER_MIN_MUTE +* QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE * Set minimum volume control value as mute for devices where the lowest * playback value represents muted state instead of minimum audible volume */
@@ -225,6 +225,6 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_FIXED_RATE (1U << 21)#define QUIRK_FLAG_MIC_RES_16 (1U << 22)#define QUIRK_FLAG_MIC_RES_384 (1U << 23) -#define QUIRK_FLAG_MIXER_MIN_MUTE (1U << 24) +#define QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE (1U << 24)#endif /* __USBAUDIO_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 654/670 ALSA: usb-audio: add volume quirks for MS LifeChat LX-3000
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 9af61fc91486c7ba93cf1ec3bd381978cac8308c ]
ID 045e:070f Microsoft Corp. LifeChat LX-3000 Headset has muted minimum Speaker Playback Volume, and 4 amixer steps were observed to produce 1 actual volume step.
Apply min_mute quirk and correct res=48 -> 4*48.
Tested with the device.
Stable-dep-of: 874323b68c93 ("ALSA: usb-audio: Add mic resolution quirk for Logitech Webcam C200")
--- sound/usb/mixer.c | 8 ++++++++ sound/usb/quirks.c | 2 ++ 2 files changed, 10 insertions(+)
sound/usb/mixer.c +8 -0
@@ -1156,6 +1156,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, }break ; +case USB_ID (0x045e ,0x070f ):/* MS LifeChat LX-3000 Headset */ +if (!strcmp (kctl->id.name,"Speaker Playback Volume" )) { +usb_audio_info (chip, +"set volume quirk for MS LifeChat LX-3000\n" ); + cval->res =192 ; + } +break ; +case USB_ID (0x0471 ,0x0101 ):case USB_ID (0x0471 ,0x0104 ):case USB_ID (0x0471 ,0x0105 ):
sound/usb/quirks.c +2 -0
@@ -2158,6 +2158,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x045e ,0x083c ,/* MS USB Link headset */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_CTL_MSG_DELAY |QUIRK_FLAG_DISABLE_AUTOSUSPEND ), +DEVICE_FLG (0x045e ,0x070f ,/* MS LifeChat LX-3000 Headset */ +QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ),DEVICE_FLG (0x046d ,0x0807 ,/* Logitech Webcam C500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), DEVICE_FLG(0x046d, 0x0808, /* Logitech Webcam C600 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 655/670 ALSA: usb-audio: Add mic resolution quirk for Logitech Webcam C200
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Kaloudoff <[email protected]>
[ Upstream commit 874323b68c93c6808e034dc0113681e822e6fb42 ]
The C200 (046d:0802) reports a mic capture volume range of 1536..7680 with a resolution of 1 (6144 steps), triggering "Warning! Unlikely big volume step count (=6144), linear volume or wrong cval->res?" at probe and exposing a uselessly fine-grained mixer control. This is the same firmware behavior as the other UVC-era Logitech webcams already carrying QUIRK_FLAG_MIC_RES_384 (C500, C600, C210, C270, C310, C510, C525, ...), so apply the same
quirk: CTL_MSG_DELAY_1M (which the Logitech VENDOR_FLG would provide if the device-specific entry did not short-circuit the lookup) plus MIC_RES_384.
Verified on real hardware: with the quirk the warning disappears and the driver logs "set resolution quirk: cval->res = 384".
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2160,6 +2160,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_DISABLE_AUTOSUSPEND),DEVICE_FLG (0x045e ,0x070f ,/* MS LifeChat LX-3000 Headset */ QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE ), +DEVICE_FLG (0x046d ,0x0802 ,/* Logitech Webcam C200 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ),DEVICE_FLG (0x046d ,0x0807 ,/* Logitech Webcam C500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), DEVICE_FLG(0x046d, 0x0808, /* Logitech Webcam C600 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 656/670 power: supply: ltc2941: Fix of_node reference leak in ltc294x_i2c_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 09a29213bf15630e85a375478832b074b2cfc5c8 ]
ltc294x_i2c_probe() takes a reference on the device node with of_node_get(), but never drops it, so the reference leaks on every return path, including the success path.
The node is only used to read the battery properties and to set info->supply_desc.name, so release it after its last use and also on the lltc,resistor-sense error path.
--- drivers/power/supply/ltc2941-battery-gauge.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/power/supply/ltc2941-battery-gauge.c +5 -1
@@ -464,9 +464,11 @@ static int ltc294x_i2c_probe(struct i2c_client *client)/* r_sense can be negative, when sense+ is connected to the battery * instead of the sense-. This results in reversed measurements. */ ret =of_property_read_u32 (np,"lltc,resistor-sense" , &r_sense); -if (ret <0 ) +if (ret <0 ) { +of_node_put (np);return dev_err_probe (&client->dev, ret,"Could not find lltc,resistor-sense in devicetree\n" ); + } info->r_sense = r_sense; ret = of_property_read_u32(np, "lltc,prescaler-exponent",
@@ -477,6 +479,8 @@ static int ltc294x_i2c_probe(struct i2c_client *client) prescaler_exp =LTC2941_MAX_PRESCALER_EXP ; } +of_node_put (np); +if (info->id ==LTC2943_ID ) {if (prescaler_exp >LTC2943_MAX_PRESCALER_EXP ) prescaler_exp =LTC2943_MAX_PRESCALER_EXP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 657/670 Input: xpad - add GameSir Nova Lite support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Orlando <[email protected]>
[ Upstream commit 2e6f2e5799f328ca0879dad14d7f3709c7f7496b ]
Add vendor and product ID for GameSir Nova Lite (0x3537:0x1040) in XInput mode to enable force feedback rumble support.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -432,6 +432,7 @@ static const struct xpad_device { { 0x3537, 0x1004, "GameSir T4 Kaleid", 0, XTYPE_XBOX360 }, { 0x3537, 0x100f, "GameSir Nova 2 Lite", 0, XTYPE_XBOX360 }, { 0x3537, 0x1010, "GameSir G7 SE", 0, XTYPE_XBOXONE }, + { 0x3537, 0x1040, "GameSir Nova Lite", 0, XTYPE_XBOX360 }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0x413d, 0x2104, "Black Shark Green Ghost Gamepad", 0, XTYPE_XBOX360 }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 658/670 power: supply: core: introduce power_supply_for_each_psy()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 9029409d1a250da19f1086ab1113752411c5163d ]
All existing callers of power_supply_for_each_device() want to iterate over 'struct power_supply', not 'struct device'.
The power_supply_for_each_device() forces each caller to duplicate the logic to go from one to the other.
Introduce power_supply_for_each_psy() to simplify the callers.
Stable-dep-of: 6bd80f22c764 ("power: supply: core: Honor supplied-from with CONFIG_OF=y")
--- drivers/power/supply/power_supply_core.c | 24 ++++++++++++++++++++++++ include/linux/power_supply.h | 1 + 2 files changed, 25 insertions(+)
drivers/power/supply/power_supply_core.c +24 -0
@@ -122,6 +122,30 @@ int power_supply_for_each_device(void *data, int (*fn)(struct device *dev, void }EXPORT_SYMBOL_GPL (power_supply_for_each_device); +struct psy_for_each_psy_cb_data { +int (*fn)(struct power_supply *psy,void *data); +void *data; +}; + +static int psy_for_each_psy_cb (struct device *dev,void *data) +{ +struct psy_for_each_psy_cb_data *cb_data = data; +struct power_supply *psy =dev_get_drvdata (dev); + +return cb_data->fn (psy, cb_data->data); +} + +int power_supply_for_each_psy (void *data,int (*fn)(struct power_supply *psy,void *data)) +{ +struct psy_for_each_psy_cb_data cb_data = { + .fn = fn, + .data = data, + }; + +return power_supply_for_each_device (&cb_data, psy_for_each_psy_cb); +} +EXPORT_SYMBOL_GPL (power_supply_for_each_psy); +void power_supply_changed (struct power_supply *psy) {unsigned long flags;
include/linux/power_supply.h +1 -0
@@ -892,6 +892,7 @@ extern int power_supply_powers(struct power_supply *psy, struct device *dev);extern void *power_supply_get_drvdata (struct power_supply *psy);extern int power_supply_for_each_device (void *data,int (*fn)(struct device *dev,void *data)); +extern int power_supply_for_each_psy (void *data,int (*fn)(struct power_supply *psy,void *data));static inline bool power_supply_is_amp_property (enum power_supply_property psp) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 659/670 power: supply: core: use power_supply_for_each_psy()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 68abaf7323ae857db7ec56a174b7bbf5fc687d47 ]
Simplify the callbacks by removing the need to convert a 'struct device' into a 'struct power_supply'.
Stable-dep-of: 6bd80f22c764 ("power: supply: core: Honor supplied-from with CONFIG_OF=y")
--- drivers/power/supply/power_supply_core.c | 36 ++++++++++-------------- 1 file changed, 15 insertions(+), 21 deletions(-)
drivers/power/supply/power_supply_core.c +15 -21
@@ -66,10 +66,9 @@ static bool __power_supply_is_supplied_by(struct power_supply *supplier,return false; } -static int __power_supply_changed_work (struct device *dev,void *data) +static int __power_supply_changed_work (struct power_supply *pst,void *data) {struct power_supply *psy = data; -struct power_supply *pst =dev_get_drvdata (dev);if (__power_supply_is_supplied_by (psy, pst)) {if (pst->desc->external_power_changed)
@@ -98,7 +97,7 @@ static void power_supply_changed_work(struct work_struct *work)if (likely (psy->changed)) { psy->changed = false;spin_unlock_irqrestore (&psy->changed_lock, flags); -power_supply_for_each_device (psy, __power_supply_changed_work); +power_supply_for_each_psy (psy, __power_supply_changed_work);power_supply_update_leds (psy);blocking_notifier_call_chain (&power_supply_notifier,PSY_EVENT_PROP_CHANGED , psy);
@@ -190,11 +189,10 @@ static void power_supply_deferred_register_work(struct work_struct *work) }#ifdef CONFIG_OF -static int __power_supply_populate_supplied_from (struct device *dev, +static int __power_supply_populate_supplied_from (struct power_supply *epsy,void *data) {struct power_supply *psy = data; -struct power_supply *epsy =dev_get_drvdata (dev);struct device_node *np;int i =0 ;
@@ -221,20 +219,19 @@ static int power_supply_populate_supplied_from(struct power_supply *psy) {int error; - error =power_supply_for_each_device (psy, __power_supply_populate_supplied_from); + error =power_supply_for_each_psy (psy, __power_supply_populate_supplied_from);dev_dbg (&psy->dev,"%s %d\n" , __func__, error);return error; } -static int __power_supply_find_supply_from_node (struct device *dev, +static int __power_supply_find_supply_from_node (struct power_supply *epsy,void *data) {struct device_node *np = data; -struct power_supply *epsy =dev_get_drvdata (dev); -/* returning non-zero breaks out of power_supply_for_each_device loop */ +/* returning non-zero breaks out of power_supply_for_each_psy loop */ if (epsy->of_node == np)return 1 ;
@@ -246,16 +243,16 @@ static int power_supply_find_supply_from_node(struct device_node *supply_node)int error;/* -* power_supply_for_each_device() either returns its own errors or values +* power_supply_for_each_psy() either returns its own errors or values * returned by __power_supply_find_supply_from_node(). * * __power_supply_find_supply_from_node() will return 0 (no match) * or 1 (match). * -* We return 0 if power_supply_for_each_device() returned 1, -EPROBE_DEFER if +* We return 0 if power_supply_for_each_psy() returned 1, -EPROBE_DEFER if * it returned 0, or error as returned by it. */ - error =power_supply_for_each_device (supply_node, __power_supply_find_supply_from_node); + error =power_supply_for_each_psy (supply_node, __power_supply_find_supply_from_node);return error ? (error ==1 ?0 : error) : -EPROBE_DEFER ; }
@@ -335,10 +332,9 @@ struct psy_am_i_supplied_data {unsigned int count; }; -static int __power_supply_am_i_supplied (struct device *dev,void *_data) +static int __power_supply_am_i_supplied (struct power_supply *epsy,void *_data) {union power_supply_propval ret = {0 ,}; -struct power_supply *epsy =dev_get_drvdata (dev);struct psy_am_i_supplied_data *data = _data;if (__power_supply_is_supplied_by (epsy, data->psy)) {
@@ -356,7 +352,7 @@ int power_supply_am_i_supplied(struct power_supply *psy)struct psy_am_i_supplied_data data = { psy,0 };int error; - error =power_supply_for_each_device (&data, __power_supply_am_i_supplied); + error =power_supply_for_each_psy (&data, __power_supply_am_i_supplied);dev_dbg (&psy->dev,"%s count %u err %d\n" , __func__, data.count, error);
@@ -367,10 +363,9 @@ int power_supply_am_i_supplied(struct power_supply *psy) }EXPORT_SYMBOL_GPL (power_supply_am_i_supplied); -static int __power_supply_is_system_supplied (struct device *dev,void *data) +static int __power_supply_is_system_supplied (struct power_supply *psy,void *data) {union power_supply_propval ret = {0 ,}; -struct power_supply *psy =dev_get_drvdata (dev);unsigned int *count = data;if (!psy->desc->get_property (psy,POWER_SUPPLY_PROP_SCOPE , &ret))
@@ -391,7 +386,7 @@ int power_supply_is_system_supplied(void)int error;unsigned int count =0 ; - error =power_supply_for_each_device (&count, __power_supply_is_system_supplied); + error =power_supply_for_each_psy (&count, __power_supply_is_system_supplied);/* * If no system scope power class device was found at all, most probably we
@@ -410,9 +405,8 @@ struct psy_get_supplier_prop_data {union power_supply_propval *val; }; -static int __power_supply_get_supplier_property (struct device *dev,void *_data) +static int __power_supply_get_supplier_property (struct power_supply *epsy,void *_data) { -struct power_supply *epsy =dev_get_drvdata (dev);struct psy_get_supplier_prop_data *data = _data;if (__power_supply_is_supplied_by (epsy, data->psy))
@@ -437,7 +431,7 @@ int power_supply_get_property_from_supplier(struct power_supply *psy,* This function is not intended for use with a supply with multiple * suppliers, we simply pick the first supply to report the psp. */ - ret =power_supply_for_each_device (&data, __power_supply_get_supplier_property); + ret =power_supply_for_each_psy (&data, __power_supply_get_supplier_property);if (ret <0 )return ret;if (ret ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 660/670 power: supply: core: get rid of of_node
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Reichel <[email protected]>
[ Upstream commit 134254038739a6c6ecb7548a2f895d89a0dc9d2a ]
This removes .of_node from 'struct power_supply', since there is already a copy in .dev.of_node and there is no need to have two copies.
Stable-dep-of: 6bd80f22c764 ("power: supply: core: Honor supplied-from with CONFIG_OF=y")
--- drivers/power/supply/power_supply_core.c | 17 ++++++++--------- include/linux/power_supply.h | 1 - 2 files changed, 8 insertions(+), 10 deletions(-)
drivers/power/supply/power_supply_core.c +8 -9
@@ -197,11 +197,11 @@ static int __power_supply_populate_supplied_from(struct power_supply *epsy,int i =0 ; do { - np = of_parse_phandle(psy->of_node, "power-supplies", i++); + np = of_parse_phandle(psy->dev.of_node, "power-supplies", i++); if (!np) break; - if (np == epsy->of_node) { + if (np == epsy->dev.of_node) { dev_dbg(&psy->dev, "%s: Found supply : %s\n", psy->desc->name, epsy->desc->name); psy->supplied_from[i-1] = (char *)epsy->desc->name;
@@ -232,7 +232,7 @@ static int __power_supply_find_supply_from_node(struct power_supply *epsy,struct device_node *np = data;/* returning non-zero breaks out of power_supply_for_each_psy loop */ -if (epsy->of_node == np) +if (epsy->dev.of_node == np)return 1 ;return 0 ;
@@ -267,13 +267,13 @@ static int power_supply_check_supplies(struct power_supply *psy)return 0 ;/* No device node found, nothing to do */ -if (!psy->of_node) +if (!psy->dev.of_node)return 0 ; do { int ret; - np = of_parse_phandle(psy->of_node, "power-supplies", cnt++); + np = of_parse_phandle(psy->dev.of_node, "power-supplies", cnt++); if (!np) break;
@@ -598,8 +598,8 @@ int power_supply_get_battery_info(struct power_supply *psy,const __be32 *list;u32 min_max[2 ]; -if (psy->of_node) { - battery_np =of_parse_phandle (psy->of_node,"monitored-battery" ,0 ); +if (psy->dev.of_node) { + battery_np =of_parse_phandle (psy->dev.of_node,"monitored-battery" ,0 );if (!battery_np)return -ENODEV ;
@@ -1384,9 +1384,8 @@ __power_supply_register(struct device *parent,if (cfg) { dev->groups = cfg->attr_grp; psy->drv_data = cfg->drv_data; - psy->of_node = + dev->of_node = cfg->fwnode ?to_of_node (cfg->fwnode) : cfg->of_node; - dev->of_node = psy->of_node; psy->supplied_to = cfg->supplied_to; psy->num_supplicants = cfg->num_supplicants; }
include/linux/power_supply.h +0 -1
@@ -289,7 +289,6 @@ struct power_supply {char **supplied_from;size_t num_supplies; -struct device_node *of_node;/* Driver private data */ void *drv_data;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 661/670 power: supply: core: Honor supplied-from with CONFIG_OF=y
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Casciano <[email protected]>
[ Upstream commit 6bd80f22c764fe8c56c62c118387f86a3ca98cff ]
The supplied-from device property is the name-based counterpart to firmware-node power-supplies references. It was added for non-DT platforms, but its parser is compiled only when CONFIG_OF is disabled. CONFIG_OF is a global kernel option, so x86 systems commonly enable it even when individual power supplies are described by software nodes.
Consequently, these consumers never populate supplied_from and supplier notifications do not reach their external_power_changed() callbacks. On a Lenovo Yoga Book YB1-X91L, ftrace showed the Whiskey Cove supplier notification running without invoking the BQ25892 callback, leaving the input current limit at its boot-time value.
Use a single power_supply_check_supplies() implementation for all configurations. Preserve firmware-node power-supplies references as the preferred firmware description and use the name-based supplied-from property only when no references are specified. Continue to honor an explicitly provided supplied_from list first and propagate errors from specified firmware references.
With the fix, ftrace shows the BQ25892 callback on hotplug. A boot-offline test changes its input current limit from 500 mA to 2 A.
--- drivers/power/supply/power_supply_core.c | 90 ++++++++++++------------ 1 file changed, 45 insertions(+), 45 deletions(-)
drivers/power/supply/power_supply_core.c +45 -45
@@ -188,7 +188,35 @@ static void power_supply_deferred_register_work(struct work_struct *work)mutex_unlock (&psy->dev.parent->mutex); } -#ifdef CONFIG_OF +static int power_supply_check_supplies_by_name (struct power_supply *psy) +{ +struct device *parent = psy->dev.parent; +int nval, ret; + +if (!parent) +return 0 ; + + nval =device_property_string_array_count (parent,"supplied-from" ); +if (nval <=0 ) +return 0 ; + + psy->supplied_from =devm_kmalloc_array (&psy->dev, nval, +sizeof (*psy->supplied_from), +GFP_KERNEL ); +if (!psy->supplied_from) +return -ENOMEM ; + + ret =device_property_read_string_array (parent,"supplied-from" , + (const char **)psy->supplied_from, + nval); +if (ret <0 ) +return ret; + + psy->num_supplies = nval; + +return 0 ; +} +static int __power_supply_populate_supplied_from (struct power_supply *epsy,void *data) {
@@ -259,73 +287,45 @@ static int power_supply_find_supply_from_node(struct device_node *supply_node)static int power_supply_check_supplies (struct power_supply *psy) { -struct device_node *np; -int cnt =0 ; +struct of_phandle_args args; +int cnt, ret;/* If there is already a list honor it */ if (psy->supplied_from && psy->num_supplies >0 )return 0 ; -/* No device node found, nothing to do */ -if (!psy->dev.of_node) -return 0 ; - -do { -int ret; +for (cnt =0 ; psy->dev.of_node; cnt++) { + ret =of_parse_phandle_with_fixed_args (psy->dev.of_node, +"power-supplies" ,0 , cnt, &args); +if (ret) { +if (ret != -ENOENT ) +return ret; - np =of_parse_phandle (psy->dev.of_node,"power-supplies" , cnt++); -if (!np)break ; + } - ret =power_supply_find_supply_from_node (np); -of_node_put (np); + ret =power_supply_find_supply_from_node (args.np); +of_node_put (args.np);if (ret) {dev_dbg (&psy->dev,"Failed to find supply!\n" );return ret; } - }while (np); + } -/* Missing valid "power-supplies" entries */ -if (cnt ==1 ) -return 0 ; +/* Fall back to the name-based property if no references were specified. */ +if (!cnt) +return power_supply_check_supplies_by_name (psy);/* All supplies found, allocate char * array for filling */ psy->supplied_from =devm_kcalloc (&psy->dev, - cnt -1 ,sizeof (*psy->supplied_from), + cnt,sizeof (*psy->supplied_from),GFP_KERNEL );if (!psy->supplied_from)return -ENOMEM ;return power_supply_populate_supplied_from (psy); } -#else -static int power_supply_check_supplies (struct power_supply *psy) -{ -int nval, ret; - -if (!psy->dev.parent) -return 0 ; - - nval =device_property_string_array_count (psy->dev.parent,"supplied-from" ); -if (nval <=0 ) -return 0 ; - - psy->supplied_from =devm_kmalloc_array (&psy->dev, nval, -sizeof (char *),GFP_KERNEL ); -if (!psy->supplied_from) -return -ENOMEM ; - - ret =device_property_read_string_array (psy->dev.parent, -"supplied-from" , (const char **)psy->supplied_from, nval); -if (ret <0 ) -return ret; - - psy->num_supplies = nval; - -return 0 ; -} -#endif struct psy_am_i_supplied_data {struct power_supply *psy;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 662/670 fbdev: nvidia: Convert to managed PCI and ioremap API
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shixiong Ou <[email protected]>
[ Upstream commit a41961f364bc7aee1611796e7ab5bd687708d770 ]
Fix missing pci_disable_device() in probe and remove.
Use pcim_enable_device(), pcim_request_all_regions(), devm_ioremap() and devm_ioremap_wc() to replace manual resource management. Remove all pci_release_regions() and iounmap() calls.
Stable-dep-of: 8710af6a3520 ("fbdev: nvidia: Release write-combining handle on probe failure")
--- drivers/video/fbdev/nvidia/nvidia.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/video/fbdev/nvidia/nvidia.c +6 -13
@@ -1288,7 +1288,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)NVTRACE_ENTER ();assert (pd !=NULL ); -if (pci_enable_device (pd)) { +if (pcim_enable_device (pd)) { printk(KERN_ERR PFX "cannot enable PCI device\n");return -ENODEV ; }
@@ -1301,7 +1301,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) nvidiafb_fix.mmio_start =pci_resource_start (pd,0 ); nvidiafb_fix.mmio_len =pci_resource_len (pd,0 ); -REGS =ioremap (nvidiafb_fix.mmio_start, nvidiafb_fix.mmio_len); +REGS =devm_ioremap (&pd->dev, nvidiafb_fix.mmio_start, nvidiafb_fix.mmio_len);if (!REGS ) { printk(KERN_ERR PFX "cannot ioremap MMIO base\n");return -ENODEV ;
@@ -1329,7 +1329,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)if (info->pixmap.addr ==NULL ) goto err_out_kfree; -if (pci_request_regions (pd,"nvidiafb" )) { +if (pcim_request_all_regions (pd,"nvidiafb" )) { printk(KERN_ERR PFX "cannot request PCI regions\n"); goto err_out_enable; }
@@ -1354,7 +1354,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)sprintf (nvidiafb_fix.id,"NV%x" , (pd->device &0x0ff0 ) >>4 );if (NVCommonSetup (info)) - goto err_out_free_base0; + goto err_out_enable; par->FbAddress = nvidiafb_fix.smem_start; par->FbMapSize = par->RamAmountKBytes *1024 ;
@@ -1374,8 +1374,8 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; par->CursorStart = par->FbUsableSize + (32 *1024 ); - info->screen_base =ioremap_wc (nvidiafb_fix.smem_start, - par->FbMapSize); + info->screen_base =devm_ioremap_wc (&pd->dev, nvidiafb_fix.smem_start, + par->FbMapSize); info->screen_size = par->FbUsableSize; nvidiafb_fix.smem_len = par->RamAmountKBytes *1024 ;
@@ -1419,19 +1419,15 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)return 0 ; err_out_iounmap_fb: -iounmap (info->screen_base);fb_destroy_modelist (&info->modelist); err_out_free_base1:fb_destroy_modedb (info->monspecs.modedb);nvidia_delete_i2c_busses (par); -err_out_free_base0: -pci_release_regions (pd); err_out_enable:kfree (info->pixmap.addr); err_out_kfree:framebuffer_release (info); err_out: -iounmap (REGS );return -ENODEV ; }
@@ -1446,11 +1442,8 @@ static void nvidiafb_remove(struct pci_dev *pd)unregister_framebuffer (info);arch_phys_wc_del (par->wc_cookie); -iounmap (info->screen_base);fb_destroy_modedb (info->monspecs.modedb);nvidia_delete_i2c_busses (par); -iounmap (par->REGS); -pci_release_regions (pd);kfree (info->pixmap.addr);framebuffer_release (info);NVTRACE_LEAVE ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 663/670 fbdev: nvidia: Release write-combining handle on probe failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 8710af6a35201a6d01b5af8f7e4bad29cc40467f ]
Failures in nvidia_set_fbinfo() or register_framebuffer() leave the handle from arch_phys_wc_add() allocated. Release it in the shared error path, as nvidiafb_remove() already does on normal removal.
The missing cleanup was already present in the initial Git import, when the driver used mtrr_add() directly.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/video/fbdev/nvidia/nvidia.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/nvidia/nvidia.c +1 -0
@@ -1419,6 +1419,7 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)return 0 ; err_out_iounmap_fb: +arch_phys_wc_del (par->wc_cookie);fb_destroy_modelist (&info->modelist); err_out_free_base1:fb_destroy_modedb (info->monspecs.modedb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 664/670 platform/x86/amd/pmf: Add AMDI0112 ACPI ID
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 325bcc126cf7a512a0e2da0efddad665f69badac ]
The AMDI0112 ID is used to bind the PMF driver to some platforms. It doesn't have any Linux side code changes relative to the most similar AMDI0105.
--- drivers/platform/x86/amd/pmf/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/amd/pmf/core.c +1 -0
@@ -467,6 +467,7 @@ static const struct acpi_device_id amd_pmf_acpi_ids[] = { {"AMDI0105", 0}, {"AMDI0107", 0}, {"AMDI0108", 0}, + {"AMDI0112", 0}, { } };MODULE_DEVICE_TABLE (acpi, amd_pmf_acpi_ids);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 665/670 power: supply: qcom_battmgr: Notify charger supplies of online changes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brandon Williams <[email protected]>
[ Upstream commit 87fd20da8ca8bacdaa9bff5860167f208077dc51 ]
On SC8280XP and X1E80100 the AC, USB and wireless supplies take their online state from the charging source in the battery status response. The firmware sends no notification for those supplies when the charging source changes, and the driver only announces the battery, so userspace never learns that the charger was plugged in or out. UPower keeps the state it read at startup: a laptop booted on the charger never goes on battery.
Call power_supply_changed() for a supply whose online state changes when a status response is parsed. A supply that is not registered yet, when the battery is read during probe, reports its state when it registers.
Tested on a Microsoft Surface Pro 11 (X1E80100): after restarting UPower on the charger, unplugging now sets OnBattery, and plugging in clears it.
--- drivers/power/supply/qcom_battmgr.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/power/supply/qcom_battmgr.c +23 -3
@@ -998,6 +998,23 @@ static unsigned int qcom_battmgr_sc8280xp_convert_temp(unsigned int temperature)return DIV_ROUND_CLOSEST (temperature,10 ); } +/* +* The charger supplies' online state comes from the battery status response, +* and the firmware sends no notification of its own when it changes, so +* announce the change here. A supply that is not registered yet announces its +* state when it is. +*/ +static void qcom_battmgr_sc8280xp_set_online (struct power_supply *psy, +bool *online,bool value) +{ +if (*online == value) +return ; + + *online = value; +if (psy) +power_supply_changed (psy); +} +static void qcom_battmgr_sc8280xp_callback (struct qcom_battmgr *battmgr,const struct qcom_battmgr_message *resp,size_t len)
@@ -1067,9 +1084,12 @@ static void qcom_battmgr_sc8280xp_callback(struct qcom_battmgr *battmgr, battmgr->status.temperature =qcom_battmgr_sc8280xp_convert_temp (le32_to_cpu (resp->status.temperature)); source =le32_to_cpu (resp->status.charging_source); - battmgr->ac.online = source ==BATTMGR_CHARGING_SOURCE_AC ; - battmgr->usb.online = source ==BATTMGR_CHARGING_SOURCE_USB ; - battmgr->wireless.online = source ==BATTMGR_CHARGING_SOURCE_WIRELESS ; +qcom_battmgr_sc8280xp_set_online (battmgr->ac_psy, &battmgr->ac.online, + source ==BATTMGR_CHARGING_SOURCE_AC ); +qcom_battmgr_sc8280xp_set_online (battmgr->usb_psy, &battmgr->usb.online, + source ==BATTMGR_CHARGING_SOURCE_USB ); +qcom_battmgr_sc8280xp_set_online (battmgr->wls_psy, &battmgr->wireless.online, + source ==BATTMGR_CHARGING_SOURCE_WIRELESS );break ;case BATTMGR_BAT_DISCHARGE_TIME : battmgr->status.discharge_time =le32_to_cpu (resp->time);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 666/670 lib/tests: extend cmdline KUnit with next_arg() tests
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuvam Pandey <[email protected]>
[ Upstream commit dcc8a57815534e3844f342b28ecfb6e626a816a0 ]
The cmdline KUnit suite covers get_option() and get_options(), but it does not exercise next_arg().
Extend the suite with one test for a quoted value containing spaces and one regression test for a bare quote token after a normal parameter.
The regression test covers the bare quote token path fixed by commit 9847f21225c4 ("lib/cmdline: avoid page fault in next_arg").
Stable-dep-of: 5d72266218b1 ("lib/cmdline: fix get_options() count and overflow with large ranges")
--- lib/cmdline_kunit.c | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
lib/cmdline_kunit.c +62 -0
@@ -139,11 +139,73 @@ static void cmdline_test_range(struct kunit *test) }while (++i <ARRAY_SIZE (cmdline_test_range_strings)); } +static void cmdline_test_next_arg_quoted_value (struct kunit *test) +{ +char in[] ="foo=\"bar baz\" qux=1" ; +char *next, *param, *val; + + next =next_arg (in, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"foo" ); +KUNIT_ASSERT_NOT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, val,"bar baz" ); +KUNIT_EXPECT_STREQ (test, next,"qux=1" ); + + next =next_arg (next, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"qux" ); +KUNIT_ASSERT_NOT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, val,"1" ); +KUNIT_EXPECT_STREQ (test, next,"" ); +} + +static void cmdline_test_next_arg_bare_quote_regression (struct kunit *test) +{ +char in[] ="foo=bar \"" ; +char *next, *param, *val; + + next =next_arg (in, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"foo" ); +KUNIT_ASSERT_NOT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, val,"bar" ); +KUNIT_EXPECT_STREQ (test, next,"\"" ); + +/* This hits the i == 0 quoted-token case fixed by 9847f21225c4. */ + next =next_arg (next, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"" ); +KUNIT_EXPECT_PTR_EQ (test, val,NULL ); +KUNIT_EXPECT_STREQ (test, next,"" ); +} + +static void cmdline_test_next_arg_mixed_tokens (struct kunit *test) +{ +char in[] ="bbb= jjj kkk=\"a=b\"" ; +char *next, *param, *val; + + next =next_arg (in, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"bbb" ); +KUNIT_ASSERT_NOT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, val,"" ); +KUNIT_EXPECT_STREQ (test, next,"jjj kkk=\"a=b\"" ); + + next =next_arg (next, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"jjj" ); +KUNIT_EXPECT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, next,"kkk=\"a=b\"" ); + + next =next_arg (next, ¶m, &val); +KUNIT_EXPECT_STREQ (test, param,"kkk" ); +KUNIT_ASSERT_NOT_NULL (test, val); +KUNIT_EXPECT_STREQ (test, val,"a=b" ); +KUNIT_EXPECT_STREQ (test, next,"" ); +} +static struct kunit_case cmdline_test_cases[] = {KUNIT_CASE (cmdline_test_noint),KUNIT_CASE (cmdline_test_lead_int),KUNIT_CASE (cmdline_test_tail_int),KUNIT_CASE (cmdline_test_range), +KUNIT_CASE (cmdline_test_next_arg_quoted_value), +KUNIT_CASE (cmdline_test_next_arg_bare_quote_regression), +KUNIT_CASE (cmdline_test_next_arg_mixed_tokens), {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 667/670 lib/cmdline: fix get_options() count and overflow with large ranges
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armaan Sandhu <[email protected]>
[ Upstream commit 5d72266218b1c4dd2917f1df2b86f3b0e0a605c9 ]
get_range() stops writing once the array is full, but get_options() still advances its index by the whole range. So "1-100" parsed into four ints reports 99 numbers, and a range like "0-2147483647" wraps the index negative and writes outside the array.
Stop once a range fills the array, bail out in validation mode before the count overflows, and saturate the range length in get_range(). Add KUnit cases; without the fix "0-2147483647" panics the test kernel.
Only root can supply this input, so this is a robustness fix.
--- lib/cmdline.c | 13 ++++++++++++- lib/cmdline_kunit.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-)
lib/cmdline.c +12 -1
@@ -11,6 +11,7 @@#include <linux/export.h> #include <linux/kernel.h> +#include <linux/overflow.h> #include <linux/string.h> #include <linux/ctype.h>
@@ -26,7 +27,9 @@ static int get_range(char **str, int *pint, int n) (*str)++; upper_range =simple_strtol ((*str),NULL ,0 ); - inc_counter = upper_range - *pint; +/* Keep the sign of the result when the difference doesn't fit */ +if (check_sub_overflow (upper_range, *pint, &inc_counter)) + inc_counter = upper_range < *pint ?-1 :INT_MAX ;for (x = *pint; n && x < upper_range; x++, n--) *pint++ = x;return inc_counter;
@@ -122,6 +125,14 @@ char *get_options(const char *str, int nints, int *ints) range_nums =get_range ((char **)&str, pint, n);if (range_nums <0 )break ; +/* The range didn't fit, so the array is full */ +if (!validate && range_nums > n) { + i = nints; +break ; + } +/* Leave room for the upper number of the range */ +if (range_nums >=INT_MAX - i) +break ;/* * Decrement the result by one to leave out the * last number in the range. The next iteration
lib/cmdline_kunit.c +39 -0
@@ -139,6 +139,44 @@ static void cmdline_test_range(struct kunit *test) }while (++i <ARRAY_SIZE (cmdline_test_range_strings)); } +static const struct { +const char *in; +int parsed[4 ]; +int validated; +} cmdline_test_range_overflow_cases[] = { + {"1-100" , {3 ,1 ,2 ,3 , },100 , }, + {"1,5-100,7" , {3 ,1 ,5 ,6 , },98 , }, + {"1-2147483646" , {3 ,1 ,2 ,3 , },2147483646 , }, + {"0-2147483647" , {3 ,0 ,1 ,2 , },0 , }, + {"-5-2147483647" , {3 ,-5 ,-4 ,-3 , },0 , }, + {"2147483647--5" , {0 ,2147483647 , },0 , }, + {"1,0-2147483647" , {3 ,1 ,0 ,1 , },1 , }, +}; + +static void cmdline_test_range_overflow (struct kunit *test) +{ +unsigned int i, j; + +for (i =0 ; i <ARRAY_SIZE (cmdline_test_range_overflow_cases); i++) { +const char *in = cmdline_test_range_overflow_cases[i].in; +const int *e = cmdline_test_range_overflow_cases[i].parsed; +/* Two guard elements past the array handed to get_options() */ +int r[ARRAY_SIZE (cmdline_test_range_overflow_cases[0 ].parsed) +2 ]; +int n; + +memset (r,0 ,sizeof (r)); +get_options (in,ARRAY_SIZE (r) -2 , r); +for (j =0 ; j <ARRAY_SIZE (r) -2 ; j++) +KUNIT_EXPECT_EQ_MSG (test, r[j], e[j],"Pattern: %s at %u" , in, j); +for (; j <ARRAY_SIZE (r); j++) +KUNIT_EXPECT_EQ_MSG (test, r[j],0 ,"Pattern: %s out of bound at %u" , in, j); + +get_options (in,0 , &n); +KUNIT_EXPECT_EQ_MSG (test, n, cmdline_test_range_overflow_cases[i].validated, +"Pattern: %s (validated)" , in); + } +} +static void cmdline_test_next_arg_quoted_value (struct kunit *test) {char in[] ="foo=\"bar baz\" qux=1" ;
@@ -203,6 +241,7 @@ static struct kunit_case cmdline_test_cases[] = {KUNIT_CASE (cmdline_test_lead_int),KUNIT_CASE (cmdline_test_tail_int),KUNIT_CASE (cmdline_test_range), +KUNIT_CASE (cmdline_test_range_overflow),KUNIT_CASE (cmdline_test_next_arg_quoted_value),KUNIT_CASE (cmdline_test_next_arg_bare_quote_regression), KUNIT_CASE(cmdline_test_next_arg_mixed_tokens),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 668/670 ASoC: amd: yc: Add DMI quirk for HP OmniBook 3 Laptop 16-by0xxx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gianluca Balboni <[email protected]>
[ Upstream commit 1e73257dff33ff851af60d5bb00d73893a8b6dc8 ]
The HP OmniBook 3 Laptop 16-by0xxx (board ID 8EE3) has an internal DMIC connected to the AMD ACP6x audio coprocessor. The BIOS does not set the AcpDmicConnected _DSD property or the _WOV method, and the board is missing from yc_acp_quirk_table[], so acp6x_probe() returns -ENODEV and no DMIC capture device is registered.
Add a DMI quirk entry for this model to enable ACP DMIC support.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -675,6 +675,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, "8EE3"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 669/670 ALSA: hda/realtek: Enable mute LEDs on HP OmniBook X Flip 14-fm0xxx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: José Miguel Castellanos Valladolid <[email protected]>
[ Upstream commit c80286aaa4acd52f9bd0b0d4914d2069fe6ba3a8 ]
The HP OmniBook X Flip Laptop 14-fm0xxx (subsystem ID 0x103c8d9f, ALC245 with two CS35L41 amplifiers over I2C) is currently handled by ALC287_FIXUP_CS35L41_I2C_2. That binds the amplifiers but does not set up the mute LEDs, so neither the speaker mute key LED nor the microphone mute key LED lights up under Linux. With that fixup the codec GPIOs stay disabled (IO[0..2] enable=0).
Switch the entry to ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS, which chains cs35l41_fixup_i2c_two with ALC245_FIXUP_HP_X360_MUTE_LEDS. This keeps the amplifier setup and adds the speaker mute LED through the ALC245 COEF register and the mic mute LED through codec GPIO2. It is the same fixup already used for the 17 Turbine OmniBook 7 DIS (0x103c8d9c).
Tested on the affected laptop with v7.2.11 using the equivalent ALC245_FIXUP_HP_ENVY_X360_15_FH0XXX fixup, which has the identical cs35l41_fixup_i2c_two + ALC245_FIXUP_HP_X360_MUTE_LEDS chain: hda::mute and hda::micmute LED class devices appear and both key LEDs light up when muting.
--- sound/pci/hda/patch_realtek.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +8 -1
@@ -8212,6 +8212,7 @@ enum {ALC287_FIXUP_LEGION_16ACHG6 ,ALC287_FIXUP_CS35L41_I2C_2 ,ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED , +ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS ,ALC287_FIXUP_CS35L41_I2C_4 ,ALC245_FIXUP_CS35L41_SPI_1 , ALC245_FIXUP_CS35L41_SPI_2,
@@ -10414,6 +10415,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC285_FIXUP_HP_MUTE_LED, }, + [ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs35l41_fixup_i2c_two, + .chained = true, + .chain_id = ALC245_FIXUP_HP_X360_MUTE_LEDS, + }, [ALC287_FIXUP_CS35L41_I2C_4] = { .type = HDA_FIXUP_FUNC, .v.func = cs35l41_fixup_i2c_four,
@@ -11219,7 +11226,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8d9c ,"HP 17 Turbine OmniBook 7 DIS" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8d9d ,"HP 17 Turbine OmniBook X UMA" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8d9e ,"HP 17 Turbine OmniBook X DIS" ,ALC287_FIXUP_CS35L41_I2C_2 ), -SND_PCI_QUIRK (0x103c ,0x8d9f ,"HP 14 Cadet (x360)" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8d9f ,"HP 14 Cadet (x360)" ,ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x8da0 ,"HP 16 Clipper OmniBook 7(X360)" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8da1 ,"HP 16 Clipper OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8da7, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 670/670 media: qcom: camss: vfe: suppress VFE version log spam
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit b6fafb3941fa0f065def304d44d6c3c6d6ac0f64 ]
A recent commit refactored the printing of the VFE hardware version, but (without it being mentioned) also changed the log level from debug to info.
This results in several hundred lines of repeated log spam during boot and use, for example, on the Lenovo ThinkPad X13s:
qcom-camss ac5a000.camss: VFE:1 HW Version = 1.2.2 qcom-camss ac5a000.camss: VFE:0 HW Version = 1.2.2 qcom-camss ac5a000.camss: VFE:2 HW Version = 1.2.2 qcom-camss ac5a000.camss: VFE:2 HW Version = 1.2.2 qcom-camss ac5a000.camss: VFE:3 HW Version = 1.2.2 qcom-camss ac5a000.camss: VFE:5 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:6 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:4 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:5 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:6 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:7 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:7 HW Version = 1.3.0 qcom-camss ac5a000.camss: VFE:7 HW Version = 1.3.0 ...
Suppress the version logging by demoting to debug level again.
--- drivers/media/platform/qcom/camss/camss-vfe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +2 -2
@@ -425,8 +425,8 @@ u32 vfe_hw_version(struct vfe_device *vfe)u32 rev = (hw_version >>HW_VERSION_REVISION ) &0xFFF ;u32 step = (hw_version >>HW_VERSION_STEPPING ) &0xFFFF ; -dev_info (vfe->camss->dev,"VFE:%d HW Version = %u.%u.%u\n" , - vfe->id, gen, rev, step); +dev_dbg (vfe->camss->dev,"VFE:%d HW Version = %u.%u.%u\n" , + vfe->id, gen, rev, step);return hw_version; }
Signature · 1 line
2.53.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 Sun, 15 Nov 2026 15:36:17 +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.118-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
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 Sun, 15 Nov 2026 15:36:17 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.118-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
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman wrote on Fri, Nov 13, 2026 at 10:42:44AM -0500:
Quoted 5 lines
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 8 lines
Responses should be made by Sun, 15 Nov 2026 15:36:17 +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.118-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.
Tested 8ea1fd6d2bee ("Linux 6.12.118-rc1") on:
- arm i.MX6ULL (Armadillo 640)
- arm64 i.MX8MP (Armadillo G4)
- arm64 i.MX8ULP (Armadillo IoT A9E)
No obvious regression in dmesg or basic tests:
(BTW I had missed a BT regression (Failed to start listening:getsockopt(L2CAP_OPTIONS): Not supported (95)) in 6.12.114, already fixed by 6.12.117, so tests will now include basic BT test from now on...)
Signature · 1 line
Dominique Martinet
Quoted 7 lines · On Fri, 13 Nov 2026 10:42:44 -0500 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 Sun, 15 Nov 2026 15:36:17 +0000. Anything received after that time might be too late.
This rc kernel passes DAMON functionality test [1] on my test machine.
[1] https://github.com/damonitor/damon-tests/tree/next/corr
Thanks,
SJ
[...]
# Librecast Test Results
044/044 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.12.118-rc1-g8ea1fd6d2bee #1 SMP PREEMPT_DYNAMIC Sat Nov 14 07:22:16 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 8 lines · On Fri, 13 Nov 2026 10:42:44 -0500 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 Sun, 15 Nov 2026 15:36:17 +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
Am 13.11.2026 um 16:42 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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-2697v2 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 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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.
Built, booted, and tested on hardware for x86_64:
- Intel N100
No regressions found.
Thanks!
Sean
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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 Sun, 15 Nov 2026 15:36:17 +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.118-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!
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.118 release. There are 670 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