6.17.4-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 270/371 rtc: interface: Ensure alarm irq is enabled when UIE is enabled
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
commit 9db26d5855d0374d4652487bfb5aacf40821c469 upstream.
When setting a normal alarm, user-space is responsible for using RTC_AIE_ON/RTC_AIE_OFF to control if alarm irq should be enabled.
But when RTC_UIE_ON is used, interrupts must be enabled so that the requested irq events are generated.
When RTC_UIE_OFF is used, alarm irq is disabled if there are no other alarms queued, so this commit brings symmetry to that.
--- drivers/rtc/interface.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rtc/interface.c +4 -0
@@ -594,6 +594,10 @@ int rtc_update_irq_enable(struct rtc_dev rtc->uie_rtctimer.node.expires =ktime_add (now, onesec); rtc->uie_rtctimer.period =ktime_set (1 ,0 ); err =rtc_timer_enqueue (rtc, &rtc->uie_rtctimer); +if (!err && rtc->ops && rtc->ops->alarm_irq_enable) + err = rtc->ops->alarm_irq_enable (rtc->dev.parent,1 ); +if (err) + goto out; }else {rtc_timer_remove (rtc, &rtc->uie_rtctimer); }
Greg Kroah-Hartman
maintainerPATCH 271/371 rtc: interface: Fix long-standing race when setting alarm
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
commit 795cda8338eab036013314dbc0b04aae728880ab upstream.
As described in the old comment dating back to
commit 6610e0893b8b ("RTC: Rework RTC code to use timerqueue for events") from 2010, we have been living with a race window when setting alarm with an expiry in the near future (i.e. next second).
With 1 second resolution, it can happen that the second ticks after the check for the timer having expired, but before the alarm is actually set. When this happen, no alarm IRQ is generated, at least not with some RTC chips (isl12022 is an example of this).
With UIE RTC timer being implemented on top of alarm irq, being re-armed every second, UIE will occasionally fail to work, as an alarm irq lost due to this race will stop the re-arming loop.
For now, I have limited the additional expiry check to only be done for alarms set to next seconds. I expect it should be good enough, although I don't know if we can now for sure that systems with loads could end up causing the same problems for alarms set 2 seconds or even longer in the future.
I haven't been able to reproduce the problem with this check in place.
--- drivers/rtc/interface.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/rtc/interface.c +23 -0
@@ -443,6 +443,29 @@ static int __rtc_set_alarm(struct rtc_deelse err = rtc->ops->set_alarm (rtc->dev.parent, alarm); +/* +* Check for potential race described above. If the waiting for next +* second, and the second just ticked since the check above, either +* +* 1) It ticked after the alarm was set, and an alarm irq should be +* generated. +* +* 2) It ticked before the alarm was set, and alarm irq most likely will +* not be generated. +* +* While we cannot easily check for which of these two scenarios we +* are in, we can return -ETIME to signal that the timer has already +* expired, which is true in both cases. +*/ +if ((scheduled - now) <=1 ) { + err =__rtc_read_time (rtc, &tm); +if (err) +return err; + now =rtc_tm_to_time64 (&tm); +if (scheduled <= now) +return -ETIME ; + } +trace_rtc_set_alarm (rtc_tm_to_time64 (&alarm->time), err);return err; }
Greg Kroah-Hartman
maintainerPATCH 272/371 rseq/selftests: Use weak symbol reference, not definition, to link with glibc
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit a001cd248ab244633c5fabe4f7c707e13fc1d1cc upstream.
Add "extern" to the glibc-defined weak rseq symbols to convert the rseq selftest's usage from weak symbol definitions to weak symbol _references_. Effectively re-defining the glibc symbols wreaks havoc when building with -fno-common, e.g. generates segfaults when running multi-threaded programs, as dynamically linked applications end up with multiple versions of the symbols.
Building with -fcommon, which until recently has the been the default for GCC and clang, papers over the bug by allowing the linker to resolve the weak/tentative definition to glibc's "real" definition.
Note, the symbol itself (or rather its address), not the value of the symbol, is set to 0/NULL for unresolved weak symbol references, as the symbol doesn't exist and thus can't have a value. Check for a NULL rseq size pointer to handle the scenario where the test is statically linked against a libc that doesn't support rseq in any capacity.
--- tools/testing/selftests/rseq/rseq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/rseq/rseq.c +4 -4
@@ -40,9 +40,9 @@* Define weak versions to play nice with binaries that are statically linked * against a libc that doesn't support registering its own rseq. */ -__weak ptrdiff_t __rseq_offset; -__weak unsigned int __rseq_size; -__weak unsigned int __rseq_flags; +extern __weak ptrdiff_t __rseq_offset; +extern __weak unsigned int __rseq_size; +extern __weak unsigned int __rseq_flags;static const ptrdiff_t *libc_rseq_offset_p = &__rseq_offset;static const unsigned int *libc_rseq_size_p = &__rseq_size;
@@ -209,7 +209,7 @@ void rseq_init(void)* libc not having registered a restartable sequence. Try to find the * symbols if that's the case. */ -if (!*libc_rseq_size_p) { +if (!libc_rseq_size_p || !*libc_rseq_size_p) { libc_rseq_offset_p =dlsym (RTLD_NEXT ,"__rseq_offset" ); libc_rseq_size_p =dlsym (RTLD_NEXT ,"__rseq_size" ); libc_rseq_flags_p =dlsym (RTLD_NEXT ,"__rseq_flags" );
Greg Kroah-Hartman
maintainerPATCH 273/371 PCI: xilinx-nwl: Fix ECAM programming
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nurminen <[email protected]>
commit 98a4f5b7359205ced1b6a626df3963bf7c5e5052 upstream.
When PCIe has been set up by the bootloader, the ecam_size field in the E_ECAM_CONTROL register already contains a value.
The driver previously programmed it to 0xc (for 16 busses; 16 MB), but bumped to 0x10 (for 256 busses; 256 MB) by the commit 2fccd11518f1 ("PCI:
xilinx-nwl: Modify ECAM size to enable support for 256 buses").
Regardless of what the bootloader has programmed, the driver ORs in a new maximal value without doing a proper RMW sequence. This can lead to problems.
For example, if the bootloader programs in 0xc and the driver uses 0x10, the ORed result is 0x1c, which is beyond the ecam_max_size limit of 0x10 (from E_ECAM_CAPABILITIES).
Avoid the problems by doing a proper RMW.
--- drivers/pci/controller/pcie-xilinx-nwl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pci/controller/pcie-xilinx-nwl.c +4 -3
@@ -718,9 +718,10 @@ static int nwl_pcie_bridge_init(struct nnwl_bridge_writel (pcie,nwl_bridge_readl (pcie,E_ECAM_CONTROL ) |E_ECAM_CR_ENABLE ,E_ECAM_CONTROL ); -nwl_bridge_writel (pcie,nwl_bridge_readl (pcie,E_ECAM_CONTROL ) | - (NWL_ECAM_MAX_SIZE <<E_ECAM_SIZE_SHIFT ), -E_ECAM_CONTROL ); + ecam_val =nwl_bridge_readl (pcie,E_ECAM_CONTROL ); + ecam_val &= ~E_ECAM_SIZE_LOC ; + ecam_val |=NWL_ECAM_MAX_SIZE <<E_ECAM_SIZE_SHIFT ; +nwl_bridge_writel (pcie, ecam_val,E_ECAM_CONTROL );nwl_bridge_writel (pcie,lower_32_bits (pcie->phys_ecam_base),E_ECAM_BASE_LO );
Greg Kroah-Hartman
maintainerPATCH 274/371 PCI: tegra: Convert struct tegra_msi mask_lock into raw spinlock
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 26fda92d3b56bf44a02bcb4001c5a5548e0ae8ee upstream.
The tegra_msi_irq_unmask() function may be called from a PCI driver request_threaded_irq() function. This triggers kernel/irq/manage.c __setup_irq() which locks raw spinlock &desc->lock descriptor lock and with that descriptor lock held, calls tegra_msi_irq_unmask().
Since the &desc->lock descriptor lock is a raw spinlock, and the tegra_msi .mask_lock is not a raw spinlock, this setup triggers 'BUG: Invalid wait context' with CONFIG_PROVE_RAW_LOCK_NESTING=y.
Use scoped_guard() to simplify the locking.
--- drivers/pci/controller/pci-tegra.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/pci/controller/pci-tegra.c +13 -14
@@ -14,6 +14,7 @@*/ #include <linux/clk.h> +#include <linux/cleanup.h> #include <linux/debugfs.h> #include <linux/delay.h> #include <linux/export.h>
@@ -270,7 +271,7 @@ struct tegra_msi {DECLARE_BITMAP (used,INT_PCI_MSI_NR );struct irq_domain *domain;struct mutex map_lock; -spinlock_t mask_lock; +raw_spinlock_t mask_lock;void *virt;dma_addr_t phys;int irq;
@@ -1581,14 +1582,13 @@ static void tegra_msi_irq_mask(struct irstruct tegra_msi *msi =irq_data_get_irq_chip_data (d);struct tegra_pcie *pcie =msi_to_pcie (msi);unsigned int index = d->hwirq /32 ; -unsigned long flags;u32 value; -spin_lock_irqsave (&msi->mask_lock, flags); - value =afi_readl (pcie,AFI_MSI_EN_VEC (index)); - value &= ~BIT (d->hwirq %32 ); -afi_writel (pcie, value,AFI_MSI_EN_VEC (index)); -spin_unlock_irqrestore (&msi->mask_lock, flags); + scoped_guard(raw_spinlock_irqsave, &msi->mask_lock) { + value =afi_readl (pcie,AFI_MSI_EN_VEC (index)); + value &= ~BIT (d->hwirq %32 ); +afi_writel (pcie, value,AFI_MSI_EN_VEC (index)); + } }static void tegra_msi_irq_unmask (struct irq_data *d)
@@ -1596,14 +1596,13 @@ static void tegra_msi_irq_unmask(structstruct tegra_msi *msi =irq_data_get_irq_chip_data (d);struct tegra_pcie *pcie =msi_to_pcie (msi);unsigned int index = d->hwirq /32 ; -unsigned long flags;u32 value; -spin_lock_irqsave (&msi->mask_lock, flags); - value =afi_readl (pcie,AFI_MSI_EN_VEC (index)); - value |=BIT (d->hwirq %32 ); -afi_writel (pcie, value,AFI_MSI_EN_VEC (index)); -spin_unlock_irqrestore (&msi->mask_lock, flags); + scoped_guard(raw_spinlock_irqsave, &msi->mask_lock) { + value =afi_readl (pcie,AFI_MSI_EN_VEC (index)); + value |=BIT (d->hwirq %32 ); +afi_writel (pcie, value,AFI_MSI_EN_VEC (index)); + } }static void tegra_compose_msi_msg (struct irq_data *data,struct msi_msg *msg)
@@ -1711,7 +1710,7 @@ static int tegra_pcie_msi_setup(struct tint err;mutex_init (&msi->map_lock); -spin_lock_init (&msi->mask_lock); +raw_spin_lock_init (&msi->mask_lock);if (IS_ENABLED (CONFIG_PCI_MSI )) { err =tegra_allocate_domains (msi);
Greg Kroah-Hartman
maintainerPATCH 275/371 PCI/sysfs: Ensure devices are powered for config reads
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit 48991e4935078b05f80616c75d1ee2ea3ae18e58 upstream.
The "max_link_width", "current_link_speed", "current_link_width", "secondary_bus_number", and "subordinate_bus_number" sysfs files all access config registers, but they don't check the runtime PM state. If the device is in D3cold or a parent bridge is suspended, we may see -EINVAL, bogus values, or worse, depending on implementation details.
Wrap these access in pci_config_pm_runtime_{get,put}() like most of the rest of the similar sysfs attributes.
Notably, "max_link_speed" does not access config registers; it returns a cached value since d2bd39c0456b ("PCI: Store all PCIe Supported Link Speeds").
--- drivers/pci/pci-sysfs.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +19 -1
@@ -201,8 +201,14 @@ static ssize_t max_link_width_show(struc struct device_attribute *attr, char *buf) { struct pci_dev *pdev = to_pci_dev(dev); +ssize_t ret; -return sysfs_emit (buf,"%u\n" ,pcie_get_width_cap (pdev)); +/* We read PCI_EXP_LNKCAP, so we need the device to be accessible. */ +pci_config_pm_runtime_get (pdev); + ret =sysfs_emit (buf,"%u\n" ,pcie_get_width_cap (pdev)); +pci_config_pm_runtime_put (pdev); + +return ret; }static DEVICE_ATTR_RO (max_link_width);
@@ -214,7 +220,10 @@ static ssize_t current_link_speed_show(sint err;enum pci_bus_speed speed; +pci_config_pm_runtime_get (pci_dev); err =pcie_capability_read_word (pci_dev,PCI_EXP_LNKSTA , &linkstat); +pci_config_pm_runtime_put (pci_dev); +if (err)return -EINVAL ;
@@ -231,7 +240,10 @@ static ssize_t current_link_width_show(su16 linkstat;int err; +pci_config_pm_runtime_get (pci_dev); err =pcie_capability_read_word (pci_dev,PCI_EXP_LNKSTA , &linkstat); +pci_config_pm_runtime_put (pci_dev); +if (err)return -EINVAL ;
@@ -247,7 +259,10 @@ static ssize_t secondary_bus_number_showu8 sec_bus;int err; +pci_config_pm_runtime_get (pci_dev); err =pci_read_config_byte (pci_dev,PCI_SECONDARY_BUS , &sec_bus); +pci_config_pm_runtime_put (pci_dev); +if (err)return -EINVAL ;
@@ -263,7 +278,10 @@ static ssize_t subordinate_bus_number_shu8 sub_bus;int err; +pci_config_pm_runtime_get (pci_dev); err =pci_read_config_byte (pci_dev,PCI_SUBORDINATE_BUS , &sub_bus); +pci_config_pm_runtime_put (pci_dev); +if (err)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 276/371 PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
commit 05703271c3cdcc0f2a8cf6ebdc45892b8ca83520 upstream.
Before disabling SR-IOV via config space accesses to the parent PF, sriov_disable() first removes the PCI devices representing the VFs.
Since commit 9d16947b7583 ("PCI: Add global pci_lock_rescan_remove()") such removal operations are serialized against concurrent remove and rescan using the pci_rescan_remove_lock. No such locking was ever added in sriov_disable() however. In particular when commit 18f9e9d150fc ("PCI/IOV: Factor out sriov_add_vfs()") factored out the PCI device removal into sriov_del_vfs() there was still no locking around the pci_iov_remove_virtfn() calls.
On s390 the lack of serialization in sriov_disable() may cause double remove and list corruption with the below (amended) trace being observed:
PSW: 0704c00180000000 0000000c914e4b38 (klist_put+56)
GPRS: 000003800313fb48 0000000000000000 0000000100000001 0000000000000001
00000000f9b520a8 0000000000000000 0000000000002fbd 00000000f4cc9480 0000000000000001 0000000000000000 0000000000000000 0000000180692828 00000000818e8000 000003800313fe2c 000003800313fb20 000003800313fad8
#0 [3800313fb20] device_del at c9158ad5c
#1 [3800313fb88] pci_remove_bus_device at c915105ba #2 [3800313fbd0] pci_iov_remove_virtfn at c9152f198 #3 [3800313fc28] zpci_iov_remove_virtfn at c90fb67c0 #4 [3800313fc60] zpci_bus_remove_device at c90fb6104 #5 [3800313fca0] __zpci_event_availability at c90fb3dca #6 [3800313fd08] chsc_process_sei_nt0 at c918fe4a2 #7 [3800313fd60] crw_collect_info at c91905822 #8 [3800313fe10] kthread at c90feb390
#9 [3800313fe68] __ret_from_fork at c90f6aa64 #10 [3800313fe98] ret_from_fork at c9194f3f2.
This is because in addition to sriov_disable() removing the VFs, the platform also generates hot-unplug events for the VFs. This being the reverse operation to the hotplug events generated by sriov_enable() and handled via pdev->no_vf_scan. And while the event processing takes pci_rescan_remove_lock and checks whether the struct pci_dev still exists, the lack of synchronization makes this checking racy.
Other races may also be possible of course though given that this lack of locking persisted so long observable races seem very rare. Even on s390 the list corruption was only observed with certain devices since the platform events are only triggered by config accesses after the removal, so as long as the removal finished synchronously they would not race. Either way the locking is missing so fix this by adding it to the sriov_del_vfs() helper.
Just like PCI rescan-remove, locking is also missing in sriov_add_vfs() including for the error case where pci_stop_and_remove_bus_device() is called without the PCI rescan-remove lock being held. Even in the non-error case, adding new PCI devices and buses should be serialized via the PCI rescan-remove lock. Add the necessary locking.
--- drivers/pci/iov.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/iov.c +5 -0
@@ -629,15 +629,18 @@ static int sriov_add_vfs(struct pci_devif (dev->no_vf_scan)return 0 ; +pci_lock_rescan_remove ();for (i =0 ; i < num_vfs; i++) { rc =pci_iov_add_virtfn (dev, i);if (rc) goto failed; } +pci_unlock_rescan_remove ();return 0 ; failed:while (i--)pci_iov_remove_virtfn (dev, i); +pci_unlock_rescan_remove ();return rc; }
@@ -762,8 +765,10 @@ static void sriov_del_vfs(struct pci_devstruct pci_sriov *iov = dev->sriov;int i; +pci_lock_rescan_remove ();for (i =0 ; i < iov->num_VFs; i++)pci_iov_remove_virtfn (dev, i); +pci_unlock_rescan_remove (); }static void sriov_disable (struct pci_dev *dev)
Greg Kroah-Hartman
maintainerPATCH 277/371 PCI/ERR: Fix uevent on failure to recover
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 1cbc5e25fb70e942a7a735a1f3d6dd391afc9b29 upstream.
Upon failure to recover from a PCIe error through AER, DPC or EDR, a uevent is sent to inform user space about disconnection of the bridge whose subordinate devices failed to recover.
However the bridge itself is not disconnected. Instead, a uevent should be sent for each of the subordinate devices.
Only if the "bridge" happens to be a Root Complex Event Collector or Integrated Endpoint does it make sense to send a uevent for it (because there are no subordinate devices).
Right now if there is a mix of subordinate devices with and without pci_error_handlers, a BEGIN_RECOVERY event is sent for those with pci_error_handlers but no FAILED_RECOVERY event is ever sent for them afterwards. Fix it.
--- drivers/pci/pcie/err.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/pci/pcie/err.c +7 -1
@@ -108,6 +108,12 @@ static int report_normal_detected(structreturn report_error_detected (dev, pci_channel_io_normal, data); } +static int report_perm_failure_detected (struct pci_dev *dev,void *data) +{ +pci_uevent_ers (dev,PCI_ERS_RESULT_DISCONNECT ); +return 0 ; +} +static int report_mmio_enabled (struct pci_dev *dev,void *data) {struct pci_driver *pdrv;
@@ -269,7 +275,7 @@ pci_ers_result_t pcie_do_recovery(struct failed:pci_walk_bridge (bridge, pci_pm_runtime_put,NULL ); -pci_uevent_ers (bridge,PCI_ERS_RESULT_DISCONNECT ); +pci_walk_bridge (bridge, report_perm_failure_detected,NULL );pci_info (bridge,"device recovery failed\n" );
Greg Kroah-Hartman
maintainerPATCH 278/371 PCI/AER: Fix missing uevent on recovery when a reset is requested
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
commit bbf7d0468d0da71d76cc6ec9bc8a224325d07b6b upstream.
Since commit 7b42d97e99d3 ("PCI/ERR: Always report current recovery status for udev") AER uses the result of error_detected() as parameter to pci_uevent_ers(). As pci_uevent_ers() however does not handle PCI_ERS_RESULT_NEED_RESET this results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treating PCI_ERS_RESULT_NEED_RESET as beginning recovery.
--- drivers/pci/pci-driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pci-driver.c +1 -0
@@ -1596,6 +1596,7 @@ void pci_uevent_ers(struct pci_dev *pdevswitch (err_type) {case PCI_ERS_RESULT_NONE :case PCI_ERS_RESULT_CAN_RECOVER : +case PCI_ERS_RESULT_NEED_RESET : envp[idx++] ="ERROR_EVENT=BEGIN_RECOVERY" ; envp[idx++] ="DEVICE_ONLINE=0" ;break ;
Greg Kroah-Hartman
maintainerPATCH 279/371 PCI/AER: Support errors introduced by PCIe r6.0
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 6633875250b38b18b8638cf01e695de031c71f02 upstream.
PCIe r6.0 defined five additional errors in the Uncorrectable Error Status, Mask and Severity Registers (PCIe r7.0 sec 7.8.4.2ff).
lspci has been supporting them since commit 144b0911cc0b ("ls-ecaps:
extend decode support for more fields for AER CE and UE status"):
https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/?id=144b0911cc0b
Amend the AER driver to recognize them as well, instead of logging them as "Unknown Error Bit".
--- drivers/pci/pcie/aer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/pcie/aer.c +6 -6
@@ -43,7 +43,7 @@#define AER_ERROR_SOURCES_MAX 128#define AER_MAX_TYPEOF_COR_ERRS 16/* as per PCI_ERR_COR_STATUS */ -#define AER_MAX_TYPEOF_UNCOR_ERRS 27/* as per PCI_ERR_UNCOR_STATUS*/ +#define AER_MAX_TYPEOF_UNCOR_ERRS 32/* as per PCI_ERR_UNCOR_STATUS*/ struct aer_err_source {u32 status;/* PCI_ERR_ROOT_STATUS */
@@ -525,11 +525,11 @@ static const char *aer_uncorrectable_err"AtomicOpBlocked" ,/* Bit Position 24 */ "TLPBlockedErr" ,/* Bit Position 25 */ "PoisonTLPBlocked" ,/* Bit Position 26 */ -NULL ,/* Bit Position 27 */ -NULL ,/* Bit Position 28 */ -NULL ,/* Bit Position 29 */ -NULL ,/* Bit Position 30 */ - NULL, /* Bit Position 31 */ +"DMWrReqBlocked" ,/* Bit Position 27 */ +"IDECheck" ,/* Bit Position 28 */ +"MisIDETLP" ,/* Bit Position 29 */ +"PCRC_CHECK" ,/* Bit Position 30 */ + "TLPXlatBlocked", /* Bit Position 31 */ }; static const char *aer_agent_string[] = {
Greg Kroah-Hartman
maintainerPATCH 280/371 PCI: Ensure relaxed tail alignment does not increase min_align
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
commit 6e460c3d611009a1d1c2c1f61c96578284a14fba upstream.
When using relaxed tail alignment for the bridge window, pbus_size_mem() also tries to minimize min_align, which can under certain scenarios end up increasing min_align from that found by calculate_mem_align().
Ensure min_align is not increased by the relaxed tail alignment.
Eventually, it would be better to add calculate_relaxed_head_align() similar to calculate_mem_align() which finds out what alignment can be used for the head without introducing any gaps into the bridge window to give flexibility on head address too. But that looks relatively complex so it requires much more testing than fixing the immediate problem causing a regression.
--- drivers/pci/setup-bus.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/pci/setup-bus.c +7 -4
@@ -1169,6 +1169,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,resource_size_t children_add_size =0 ;resource_size_t children_add_align =0 ;resource_size_t add_align =0 ; +resource_size_t relaxed_align;if (!b_res)return -ENOSPC ;
@@ -1246,8 +1247,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,if (bus->self && size0 && !pbus_upstream_space_available (bus, mask |IORESOURCE_PREFETCH , type, size0, min_align)) { - min_align =1ULL << (max_order +__ffs (SZ_1M )); - min_align =max (min_align, win_align); + relaxed_align =1ULL << (max_order +__ffs (SZ_1M )); + relaxed_align =max (relaxed_align, win_align); + min_align =min (min_align, relaxed_align); size0 =calculate_memsize (size, min_size,0 ,0 ,resource_size (b_res), win_align);pci_info (bus->self,"bridge window %pR to %pR requires relaxed alignment rules\n" , b_res, &bus->busn_res);
@@ -1261,8 +1263,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,if (bus->self && size1 && !pbus_upstream_space_available (bus, mask |IORESOURCE_PREFETCH , type, size1, add_align)) { - min_align =1ULL << (max_order +__ffs (SZ_1M )); - min_align =max (min_align, win_align); + relaxed_align =1ULL << (max_order +__ffs (SZ_1M )); + relaxed_align =max (relaxed_align, win_align); + min_align =min (min_align, relaxed_align); size1 =calculate_memsize (size, min_size, add_size, children_add_size,resource_size (b_res), win_align); pci_info(bus->self,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 281/371 PCI: Fix failure detection during resource resize
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
commit 31af09b3eaf3603870ce9fd5a7b6c8693129c4cf upstream.
Since 96336ec70264 ("PCI: Perform reset_resource() and build fail list in sync") the failed list is always built and returned to let the caller decide what to do with the failures. The caller may want to retry resource fitting and assignment and before that can happen, the resources should be restored to their original state (a reset effectively clears the struct resource), which requires returning them to the failed list so the original state remains stored in the associated struct pci_dev_resource.
Resource resizing is different from the ordinary resource fitting and assignment in that it only considers part of the resources. This means failures for other resource types are not relevant at all and should be ignored. As resize doesn't unassign such unrelated resources, those resources ending up in the failed list implies assignment of that resource must have failed before resize too. The check in pci_reassign_bridge_resources() to decide if the whole assignment is successful, however, is based on list emptiness which will cause false negatives when the failed list has resources with an unrelated type.
If the failed list is not empty, call pci_required_resource_failed() and extend it to be able to filter on specific resource types too (if provided).
Calling pci_required_resource_failed() at this point is slightly problematic because the resource itself is reset when the failed list is constructed in __assign_resources_sorted(). As a result, pci_resource_is_optional() does not have access to the original resource flags. This could be worked around by restoring and re-resetting the resource around the call to pci_resource_is_optional(), however, it shouldn't cause issue as resource resizing is meant for 64-bit prefetchable resources according to Christian König (see the Link which unfortunately doesn't point directly to Christian's reply because lore didn't store that email at all).
--- drivers/pci/setup-bus.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/pci/setup-bus.c +18 -8
@@ -28,6 +28,10 @@#include <linux/acpi.h> #include "pci.h" +#define PCI_RES_TYPE_MASK \ + (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH |\ + IORESOURCE_MEM_64) +unsigned int pci_flags;EXPORT_SYMBOL_GPL (pci_flags);
@@ -384,13 +388,19 @@ static bool pci_need_to_release(unsigned }/* Return: @true if assignment of a required resource failed. */ -static bool pci_required_resource_failed (struct list_head *fail_head) +static bool pci_required_resource_failed (struct list_head *fail_head, +unsigned long type) {struct pci_dev_resource *fail_res; + type &=PCI_RES_TYPE_MASK ; +list_for_each_entry (fail_res, fail_head, list) {int idx =pci_resource_num (fail_res->dev, fail_res->res); +if (type && (fail_res->flags &PCI_RES_TYPE_MASK ) != type) +continue ; +if (!pci_resource_is_optional (fail_res->dev, idx))return true; }
@@ -504,7 +514,7 @@ assign: }/* Without realloc_head and only optional fails, nothing more to do. */ -if (!pci_required_resource_failed (&local_fail_head) && +if (!pci_required_resource_failed (&local_fail_head,0 ) &&list_empty (realloc_head)) {list_for_each_entry (save_res, &save_head, list) {struct resource *res = save_res->res;
@@ -1707,10 +1717,6 @@ static void __pci_bridge_assign_resource } } -#define PCI_RES_TYPE_MASK \ - (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH |\ - IORESOURCE_MEM_64) -static void pci_bridge_release_resources (struct pci_bus *bus,unsigned long type) {
@@ -2449,8 +2455,12 @@ int pci_reassign_bridge_resources(structfree_list (&added);if (!list_empty (&failed)) { - ret = -ENOSPC ; - goto cleanup; +if (pci_required_resource_failed (&failed, type)) { + ret = -ENOSPC ; + goto cleanup; + } +/* Only resources with unrelated types failed (again) */ +free_list (&failed); }list_for_each_entry (dev_res, &saved, list) {
Greg Kroah-Hartman
maintainerPATCH 282/371 PCI: j721e: Fix module autoloading
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
commit 9a7f144e18dc5f037d85a0f0d99524a574331098 upstream.
Commit a2790bf81f0f ("PCI: j721e: Add support to build as a loadable module") added support to build the driver as a loadable module. However, it did not add MODULE_DEVICE_TABLE() which is required for autoloading the driver based on device table when it is built as a loadable module.
Fix it by adding MODULE_DEVICE_TABLE.
--- drivers/pci/controller/cadence/pci-j721e.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/cadence/pci-j721e.c +1 -0
@@ -440,6 +440,7 @@ static const struct of_device_id of_j721e_pcie_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, of_j721e_pcie_match);static int j721e_pcie_probe (struct platform_device *pdev) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 283/371 PCI: j721e: Fix programming sequence of "strap" settings
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
commit f842d3313ba179d4005096357289c7ad09cec575 upstream.
The Cadence PCIe Controller integrated in the TI K3 SoCs supports both Root-Complex and Endpoint modes of operation. The Glue Layer allows "strapping" the Mode of operation of the Controller, the Link Speed and the Link Width. This is enabled by programming the "PCIEn_CTRL" register (n corresponds to the PCIe instance) within the CTRL_MMR memory-mapped register space. The "reset-values" of the registers are also different depending on the mode of operation.
Since the PCIe Controller latches onto the "reset-values" immediately after being powered on, if the Glue Layer configuration is not done while the PCIe Controller is off, it will result in the PCIe Controller latching onto the wrong "reset-values". In practice, this will show up as a wrong representation of the PCIe Controller's capability structures in the PCIe Configuration Space. Some such capabilities which are supported by the PCIe Controller in the Root-Complex mode but are incorrectly latched onto as being unsupported are:
- Link Bandwidth Notification
- Alternate Routing ID (ARI) Forwarding Support
- Next capability offset within Advanced Error Reporting (AER) capability
Fix this by powering off the PCIe Controller before programming the "strap" settings and powering it on after that. The runtime PM APIs namely pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and increment the usage counter respectively, causing GENPD to power off and power on the PCIe Controller.
--- drivers/pci/controller/cadence/pci-j721e.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/pci/controller/cadence/pci-j721e.c +25 -0
@@ -284,6 +284,25 @@ static int j721e_pcie_ctrl_init(struct jif (!ret) offset = args.args[0 ]; +/* +* The PCIe Controller's registers have different "reset-values" +* depending on the "strap" settings programmed into the PCIEn_CTRL +* register within the CTRL_MMR memory-mapped register space. +* The registers latch onto a "reset-value" based on the "strap" +* settings sampled after the PCIe Controller is powered on. +* To ensure that the "reset-values" are sampled accurately, power +* off the PCIe Controller before programming the "strap" settings +* and power it on after that. The runtime PM APIs namely +* pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and +* increment the usage counter respectively, causing GENPD to power off +* and power on the PCIe Controller. +*/ + ret =pm_runtime_put_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power off PCIe Controller\n" ); +return ret; + } + ret =j721e_pcie_set_mode (pcie, syscon, offset);if (ret <0 ) {dev_err (dev,"Failed to set pci mode\n" );
@@ -302,6 +321,12 @@ static int j721e_pcie_ctrl_init(struct jreturn ret; } + ret =pm_runtime_get_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power on PCIe Controller\n" ); +return ret; + } +/* Enable ACSPCIE refclk output if the optional property exists */ syscon =syscon_regmap_lookup_by_phandle_optional (node,"ti,syscon-acspcie-proxy-ctrl" );
Greg Kroah-Hartman
maintainerPATCH 284/371 PCI: keystone: Use devm_request_irq() to free "ks-pcie-error-irq" on exit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
commit e51d05f523e43ce5d2bad957943a2b14f68078cd upstream.
Commit under Fixes introduced the IRQ handler for "ks-pcie-error-irq". The interrupt is acquired using "request_irq()" but is never freed if the driver exits due to an error. Although the section in the driver that invokes "request_irq()" has moved around over time, the issue hasn't been addressed until now.
Fix this by using "devm_request_irq()" which automatically frees the interrupt if the driver exits.
--- drivers/pci/controller/dwc/pci-keystone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-keystone.c +2 -2
@@ -1201,8 +1201,8 @@ static int ks_pcie_probe(struct platformif (irq <0 )return irq; - ret =request_irq (irq, ks_pcie_err_irq_handler,IRQF_SHARED , -"ks-pcie-error-irq" , ks_pcie); + ret =devm_request_irq (dev, irq, ks_pcie_err_irq_handler,IRQF_SHARED , +"ks-pcie-error-irq" , ks_pcie);if (ret <0 ) {dev_err (dev,"failed to request error IRQ %d\n" , irq);
Greg Kroah-Hartman
maintainerPATCH 285/371 PCI: rcar-gen4: Fix PHY initialization
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit d96ac5bdc52b271b4f8ac0670a203913666b8758 upstream.
R-Car V4H Reference Manual R19UH0186EJ0130 Rev.1.30 Apr. 21, 2025 page 4581 Figure 104.3b Initial Setting of PCIEC(example), middle of the figure indicates that fourth write into register 0x148 [2:0] is 0x3 or GENMASK(1, 0). The current code writes GENMASK(11, 0) which is a typo. Fix the typo.
--- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-rcar-gen4.c +1 -1
@@ -723,7 +723,7 @@ static int rcar_gen4_pcie_ltssm_control(rcar_gen4_pcie_phy_reg_update_bits (rcar,0x148 ,GENMASK (23 ,22 ),BIT (22 ));rcar_gen4_pcie_phy_reg_update_bits (rcar,0x148 ,GENMASK (18 ,16 ),GENMASK (17 ,16 ));rcar_gen4_pcie_phy_reg_update_bits (rcar,0x148 ,GENMASK (7 ,6 ),BIT (6 )); -rcar_gen4_pcie_phy_reg_update_bits (rcar,0x148 ,GENMASK (2 ,0 ),GENMASK (11 ,0 )); +rcar_gen4_pcie_phy_reg_update_bits (rcar,0x148 ,GENMASK (2 ,0 ),GENMASK (1 ,0 ));rcar_gen4_pcie_phy_reg_update_bits (rcar,0x1d4 ,GENMASK (16 ,15 ),GENMASK (16 ,15 ));rcar_gen4_pcie_phy_reg_update_bits (rcar,0x514 ,BIT (26 ),BIT (26 ));rcar_gen4_pcie_phy_reg_update_bits (rcar,0x0f8 ,BIT (16 ),0 );
Greg Kroah-Hartman
maintainerPATCH 286/371 PCI: rcar-host: Drop PMSR spinlock
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 0a8f173d9dad13930d5888505dc4c4fd6a1d4262 upstream.
The pmsr_lock spinlock used to be necessary to synchronize access to the PMSR register, because that access could have been triggered from either config space access in rcar_pcie_config_access() or an exception handler rcar_pcie_aarch32_abort_handler().
The rcar_pcie_aarch32_abort_handler() case is no longer applicable since commit 6e36203bc14c ("PCI: rcar: Use PCI_SET_ERROR_RESPONSE after read which triggered an exception"), which performs more accurate, controlled invocation of the exception, and a fixup.
This leaves rcar_pcie_config_access() as the only call site from which rcar_pcie_wakeup() is called. The rcar_pcie_config_access() can only be called from the controller struct pci_ops .read and .write callbacks, and those are serialized in drivers/pci/access.c using raw spinlock 'pci_lock' . It should be noted that CONFIG_PCI_LOCKLESS_CONFIG is never set on this platform.
Since the 'pci_lock' is a raw spinlock , and the 'pmsr_lock' is not a raw spinlock, this constellation triggers 'BUG: Invalid wait context' with CONFIG_PROVE_RAW_LOCK_NESTING=y .
Remove the pmsr_lock to fix the locking.
--- drivers/pci/controller/pcie-rcar-host.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/pci/controller/pcie-rcar-host.c +2 -11
@@ -52,20 +52,13 @@ struct rcar_pcie_host {int (*phy_init_fn)(struct rcar_pcie_host *host); }; -static DEFINE_SPINLOCK (pmsr_lock); -static int rcar_pcie_wakeup (struct device *pcie_dev,void __iomem *pcie_base) { -unsigned long flags;u32 pmsr, val;int ret =0 ; -spin_lock_irqsave (&pmsr_lock, flags); - -if (!pcie_base ||pm_runtime_suspended (pcie_dev)) { - ret = -EINVAL ; - goto unlock_exit; - } +if (!pcie_base ||pm_runtime_suspended (pcie_dev)) +return -EINVAL ; pmsr =readl (pcie_base +PMSR );
@@ -87,8 +80,6 @@ static int rcar_pcie_wakeup(struct devicwritel (L1FAEG |PMEL1RX , pcie_base +PMSR ); } -unlock_exit: -spin_unlock_irqrestore (&pmsr_lock, flags);return ret; }
Greg Kroah-Hartman
maintainerPATCH 287/371 PCI: rcar-host: Convert struct rcar_msi mask_lock into raw spinlock
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 5ed35b4d490d8735021cce9b715b62a418310864 upstream.
The rcar_msi_irq_unmask() function may be called from a PCI driver request_threaded_irq() function. This triggers kernel/irq/manage.c __setup_irq() which locks raw spinlock &desc->lock descriptor lock and with that descriptor lock held, calls rcar_msi_irq_unmask().
Since the &desc->lock descriptor lock is a raw spinlock, and the rcar_msi .mask_lock is not a raw spinlock, this setup triggers 'BUG: Invalid wait context' with CONFIG_PROVE_RAW_LOCK_NESTING=y.
Use scoped_guard() to simplify the locking.
--- drivers/pci/controller/pcie-rcar-host.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/pci/controller/pcie-rcar-host.c +13 -14
@@ -12,6 +12,7 @@*/ #include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/delay.h>
@@ -38,7 +39,7 @@ struct rcar_msi {DECLARE_BITMAP (used,INT_PCI_MSI_NR );struct irq_domain *domain;struct mutex map_lock; -spinlock_t mask_lock; +raw_spinlock_t mask_lock;int irq1;int irq2; };
@@ -602,28 +603,26 @@ static void rcar_msi_irq_mask(struct irq {struct rcar_msi *msi =irq_data_get_irq_chip_data (d);struct rcar_pcie *pcie = &msi_to_host (msi)->pcie; -unsigned long flags;u32 value; -spin_lock_irqsave (&msi->mask_lock, flags); - value =rcar_pci_read_reg (pcie,PCIEMSIIER ); - value &= ~BIT (d->hwirq); -rcar_pci_write_reg (pcie, value,PCIEMSIIER ); -spin_unlock_irqrestore (&msi->mask_lock, flags); + scoped_guard(raw_spinlock_irqsave, &msi->mask_lock) { + value =rcar_pci_read_reg (pcie,PCIEMSIIER ); + value &= ~BIT (d->hwirq); +rcar_pci_write_reg (pcie, value,PCIEMSIIER ); + } }static void rcar_msi_irq_unmask (struct irq_data *d) {struct rcar_msi *msi =irq_data_get_irq_chip_data (d);struct rcar_pcie *pcie = &msi_to_host (msi)->pcie; -unsigned long flags;u32 value; -spin_lock_irqsave (&msi->mask_lock, flags); - value =rcar_pci_read_reg (pcie,PCIEMSIIER ); - value |=BIT (d->hwirq); -rcar_pci_write_reg (pcie, value,PCIEMSIIER ); -spin_unlock_irqrestore (&msi->mask_lock, flags); + scoped_guard(raw_spinlock_irqsave, &msi->mask_lock) { + value =rcar_pci_read_reg (pcie,PCIEMSIIER ); + value |=BIT (d->hwirq); +rcar_pci_write_reg (pcie, value,PCIEMSIIER ); + } }static void rcar_compose_msi_msg (struct irq_data *data,struct msi_msg *msg)
@@ -736,7 +735,7 @@ static int rcar_pcie_enable_msi(struct rint err;mutex_init (&msi->map_lock); -spin_lock_init (&msi->mask_lock); +raw_spin_lock_init (&msi->mask_lock); err =of_address_to_resource (dev->of_node,0 , &res);if (err)
Greg Kroah-Hartman
maintainerPATCH 288/371 PCI: tegra194: Fix broken tegra_pcie_ep_raise_msi_irq()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit b640d42a6ac9ba01abe65ec34f7c73aaf6758ab8 upstream.
The pci_epc_raise_irq() supplies a MSI or MSI-X interrupt number in range (1-N), as per the pci_epc_raise_irq() kdoc, where N is 32 for MSI.
But tegra_pcie_ep_raise_msi_irq() incorrectly uses the interrupt number as the MSI vector. This causes wrong MSI vector to be triggered, leading to the failure of PCI endpoint Kselftest MSI_TEST test case.
To fix this issue, convert the interrupt number to MSI vector.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +2 -2
@@ -1955,10 +1955,10 @@ static int tegra_pcie_ep_raise_intx_irq(static int tegra_pcie_ep_raise_msi_irq (struct tegra_pcie_dw *pcie,u16 irq) { -if (unlikely (irq >31 )) +if (unlikely (irq >32 ))return -EINVAL ; -appl_writel (pcie,BIT (irq),APPL_MSI_CTRL_1 ); +appl_writel (pcie,BIT (irq -1 ),APPL_MSI_CTRL_1 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 289/371 PCI: tegra194: Handle errors in BPMP response
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
commit f8c9ad46b00453a8c075453f3745f8d263f44834 upstream.
The return value from tegra_bpmp_transfer() indicates the success or failure of the IPC transaction with BPMP. If the transaction succeeded, we also need to check the actual command's result code.
If we don't have error handling for tegra_bpmp_transfer(), we will set the pcie->ep_state to EP_STATE_ENABLED even when the tegra_bpmp_transfer() command fails. Thus, the pcie->ep_state will get out of sync with reality, and any further PERST# assert + deassert will be a no-op and will not trigger the hardware initialization sequence.
This is because pex_ep_event_pex_rst_deassert() checks the current pcie->ep_state, and does nothing if the current state is already EP_STATE_ENABLED.
Thus, it is important to have error handling for tegra_bpmp_transfer(), such that the pcie->ep_state can not get out of sync with reality, so that we will try to initialize the hardware not only during the first PERST# assert + deassert, but also during any succeeding PERST# assert + deassert.
One example where this fix is needed is when using a rock5b as host. During the initial PERST# assert + deassert (triggered by the bootloader on the rock5b) pex_ep_event_pex_rst_deassert() will get called, but for some unknown reason, the tegra_bpmp_transfer() call to initialize the PHY fails. Once Linux has been loaded on the rock5b, the PCIe driver will once again assert + deassert PERST#. However, without tegra_bpmp_transfer() error handling, this second PERST# assert + deassert will not trigger the hardware initialization sequence.
With tegra_bpmp_transfer() error handling, the second PERST# assert + deassert will once again trigger the hardware to be initialized and this time the tegra_bpmp_transfer() succeeds.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +16 -2
@@ -1214,6 +1214,7 @@ static int tegra_pcie_bpmp_set_ctrl_statstruct mrq_uphy_response resp;struct tegra_bpmp_message msg;struct mrq_uphy_request req; +int err;/* * Controller-5 doesn't need to have its state set by BPMP-FW in
@@ -1236,7 +1237,13 @@ static int tegra_pcie_bpmp_set_ctrl_stat msg.rx.data = &resp; msg.rx.size =sizeof (resp); -return tegra_bpmp_transfer (pcie->bpmp, &msg); + err =tegra_bpmp_transfer (pcie->bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; } static int tegra_pcie_bpmp_set_pll_state(struct tegra_pcie_dw *pcie,
@@ -1245,6 +1252,7 @@ static int tegra_pcie_bpmp_set_pll_statestruct mrq_uphy_response resp;struct tegra_bpmp_message msg;struct mrq_uphy_request req; +int err;memset (&req,0 ,sizeof (req));memset (&resp,0 ,sizeof (resp));
@@ -1264,7 +1272,13 @@ static int tegra_pcie_bpmp_set_pll_state msg.rx.data = &resp; msg.rx.size =sizeof (resp); -return tegra_bpmp_transfer (pcie->bpmp, &msg); + err =tegra_bpmp_transfer (pcie->bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; }static void tegra_pcie_downstream_dev_to_D0 (struct tegra_pcie_dw *pcie)
Greg Kroah-Hartman
maintainerPATCH 290/371 PCI: tegra194: Reset BARs when running in PCIe endpoint mode
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 42f9c66a6d0cc45758dab77233c5460e1cf003df upstream.
Tegra already defines all BARs except BAR0 as BAR_RESERVED. This is sufficient for pci-epf-test to not allocate backing memory and to not call set_bar() for those BARs. However, marking a BAR as BAR_RESERVED does not mean that the BAR gets disabled.
The host side driver, pci_endpoint_test, simply does an ioremap for all enabled BARs and will run tests against all enabled BARs, so it will run tests against the BARs marked as BAR_RESERVED.
After running the BAR tests (which will write to all enabled BARs), the inbound address translation is broken. This is because the tegra controller exposes the ATU Port Logic Structure in BAR4, so when BAR4 is written, the inbound address translation settings get overwritten.
To avoid this, implement the dw_pcie_ep_ops .init() callback and start off by disabling all BARs (pci-epf-test will later enable/configure BARs that are not defined as BAR_RESERVED).
This matches the behavior of other PCIe endpoint drivers: dra7xx, imx6, layerscape-ep, artpec6, dw-rockchip, qcom-ep, rcar-gen4, and uniphier-ep.
With this, the PCI endpoint kselftest test case CONSECUTIVE_BAR_TEST (which was specifically made to detect address translation issues) passes.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/controller/dwc/pcie-tegra194.c +10 -0
@@ -1955,6 +1955,15 @@ static irqreturn_t tegra_pcie_ep_pex_rstreturn IRQ_HANDLED ; } +static void tegra_pcie_ep_init (struct dw_pcie_ep *ep) +{ +struct dw_pcie *pci =to_dw_pcie_from_ep (ep); +enum pci_barno bar; + +for (bar =0 ; bar <PCI_STD_NUM_BARS ; bar++) +dw_pcie_ep_reset_bar (pci, bar); +}; +static int tegra_pcie_ep_raise_intx_irq (struct tegra_pcie_dw *pcie,u16 irq) {/* Tegra194 supports only INTA */
@@ -2031,6 +2040,7 @@ tegra_pcie_ep_get_features(struct dw_pci }static const struct dw_pcie_ep_ops pcie_ep_ops = { + .init = tegra_pcie_ep_init, .raise_irq = tegra_pcie_ep_raise_irq, .get_features = tegra_pcie_ep_get_features, };
Greg Kroah-Hartman
maintainerPATCH 291/371 PCI/pwrctrl: Fix device leak at registration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 39f9be6aba3ae4d6fdd4b8554f1184d054d7a713 upstream.
Make sure to drop the reference to the pwrctrl device taken by of_find_device_by_node() when registering a PCI device.
--- drivers/pci/bus.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/pci/bus.c +9 -5
@@ -361,11 +361,15 @@ void pci_bus_add_device(struct pci_dev ** before PCI client drivers. */ pdev =of_find_device_by_node (dn); -if (pdev &&of_pci_supply_present (dn)) { -if (!device_link_add (&dev->dev, &pdev->dev, -DL_FLAG_AUTOREMOVE_CONSUMER )) -pci_err (dev,"failed to add device link to power control device %s\n" , - pdev->name); +if (pdev) { +if (of_pci_supply_present (dn)) { +if (!device_link_add (&dev->dev, &pdev->dev, +DL_FLAG_AUTOREMOVE_CONSUMER )) { +pci_err (dev,"failed to add device link to power control device %s\n" , + pdev->name); + } + } +put_device (&pdev->dev); }if (!dn ||of_device_is_available (dn))
Greg Kroah-Hartman
maintainerPATCH 292/371 PCI/pwrctrl: Fix device and OF node leak at bus scan
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e24bbbe0780262a21fc8619fe99078a5b8d64b18 upstream.
Make sure to drop the references to the pwrctrl OF node and device taken by of_pci_find_child_device() and of_find_device_by_node() respectively when scanning the bus.
--- drivers/pci/probe.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/pci/probe.c +16 -3
@@ -2516,9 +2516,15 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, instruct device_node *np; np =of_pci_find_child_device (dev_of_node (&bus->dev), devfn); -if (!np ||of_find_device_by_node (np)) +if (!np)return NULL ; + pdev =of_find_device_by_node (np); +if (pdev) { +put_device (&pdev->dev); + goto err_put_of_node; + } +/* * First check whether the pwrctrl device really needs to be created or * not. This is decided based on at least one of the power supplies
@@ -2526,17 +2532,24 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in*/ if (!of_pci_supply_present (np)) {pr_debug ("PCI/pwrctrl: Skipping OF node: %s\n" , np->name); -return NULL ; + goto err_put_of_node; }/* Now create the pwrctrl device */ pdev =of_platform_device_create (np,NULL , &host->dev);if (!pdev) {pr_err ("PCI/pwrctrl: Failed to create pwrctrl device for node: %s\n" , np->name); -return NULL ; + goto err_put_of_node; } +of_node_put (np); +return pdev; + +err_put_of_node: +of_node_put (np); + + return NULL; }#else static struct platform_device *pci_pwrctrl_create_device (struct pci_bus *bus,int devfn)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 293/371 PCI/pwrctrl: Fix device leak at device stop
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit dc32e9346b26ba33e84ec3034a1e53a9733700f9 upstream.
Make sure to drop the reference to the pwrctrl device taken by of_find_device_by_node() when stopping a PCI device.
--- drivers/pci/remove.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/remove.c +2 -0
@@ -31,6 +31,8 @@ static void pci_pwrctrl_unregister(struct device *dev)return ;of_device_unregister (pdev); +put_device (&pdev->dev); +of_node_clear_flag (np,OF_POPULATED ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 294/371 spi: cadence-quadspi: Flush posted register writes before INDAC access
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
commit 29e0b471ccbd674d20d4bbddea1a51e7105212c5 upstream.
cqspi_indirect_read_execute() and cqspi_indirect_write_execute() first set the enable bit on APB region and then start reading/writing to the AHB region. On TI K3 SoCs these regions lie on different endpoints. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level.
It is possible for the AHB write to be executed before the APB write to enable the indirect controller, causing the transaction to be invalid and the write erroring out. Read back the APB region write before accessing the AHB region to make sure the write got flushed and the race condition is eliminated.
Message-ID: <[email protected]>
--- drivers/spi/spi-cadence-quadspi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-cadence-quadspi.c +3 -0
@@ -765,6 +765,7 @@ static int cqspi_indirect_read_execute(sreinit_completion (&cqspi->transfer_complete);writel (CQSPI_REG_INDIRECTRD_START_MASK , reg_base +CQSPI_REG_INDIRECTRD ); +readl (reg_base +CQSPI_REG_INDIRECTRD );/* Flush posted write. */ while (remaining >0 ) { if (use_irq &&
@@ -1091,6 +1092,8 @@ static int cqspi_indirect_write_execute(reinit_completion (&cqspi->transfer_complete);writel (CQSPI_REG_INDIRECTWR_START_MASK , reg_base +CQSPI_REG_INDIRECTWR ); +readl (reg_base +CQSPI_REG_INDIRECTWR );/* Flush posted write. */ +/* * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access * Controller programming sequence, couple of cycles of
Greg Kroah-Hartman
maintainerPATCH 295/371 spi: cadence-quadspi: Flush posted register writes before DAC access
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
commit 1ad55767e77a853c98752ed1e33b68049a243bd7 upstream.
cqspi_read_setup() and cqspi_write_setup() program the address width as the last step in the setup. This is likely to be immediately followed by a DAC region read/write. On TI K3 SoCs the DAC region is on a different endpoint from the register region. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level. It is possible that the DAC read/write goes through before the address width update goes through. In this situation if the previous command used a different address width the OSPI command is sent with the wrong number of address bytes, resulting in an invalid command and undefined behavior.
Read back the size register to make sure the write gets flushed before accessing the DAC region.
Message-ID: <[email protected]>
--- drivers/spi/spi-cadence-quadspi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-cadence-quadspi.c +2 -0
@@ -720,6 +720,7 @@ static int cqspi_read_setup(struct cqspi reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (op->addr.nbytes -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
@@ -1064,6 +1065,7 @@ static int cqspi_write_setup(struct cqsp reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (op->addr.nbytes -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 296/371 spi: cadence-quadspi: Fix cqspi_setup_flash()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Santhosh Kumar K <[email protected]>
commit 858d4d9e0a9d6b64160ef3c824f428c9742172c4 upstream.
The 'max_cs' stores the largest chip select number. It should only be updated when the current 'cs' is greater than existing 'max_cs'. So, fix the condition accordingly.
Also, return failure if there are no flash device declared.
Message-ID: <[email protected]>
--- drivers/spi/spi-cadence-quadspi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/spi/spi-cadence-quadspi.c +8 -5
@@ -1727,12 +1727,10 @@ static const struct spi_controller_mem_cstatic int cqspi_setup_flash (struct cqspi_st *cqspi) { -unsigned int max_cs = cqspi->num_chipselect -1 ;struct platform_device *pdev = cqspi->pdev;struct device *dev = &pdev->dev;struct cqspi_flash_pdata *f_pdata; -unsigned int cs; -int ret; +int ret, cs, max_cs =-1 ;/* Get flash device data */ for_each_available_child_of_node_scoped (dev->of_node, np) {
@@ -1745,10 +1743,10 @@ static int cqspi_setup_flash(struct cqspif (cs >= cqspi->num_chipselect) {dev_err (dev,"Chip select %d out of range.\n" , cs);return -EINVAL ; - }else if (cs < max_cs) { - max_cs = cs; } + max_cs =max_t (int, cs, max_cs); + f_pdata = &cqspi->f_pdata[cs]; f_pdata->cqspi = cqspi; f_pdata->cs = cs;
@@ -1758,6 +1756,11 @@ static int cqspi_setup_flash(struct cqspreturn ret; } +if (max_cs <0 ) { +dev_err (dev,"No flash device declared\n" ); +return -ENODEV ; + } + cqspi->num_chipselect = max_cs +1 ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 297/371 xfs: use deferred intent items for reaping crosslinked blocks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit cd32a0c0dcdf634f2e0e71f41c272e19dece6264 upstream.
When we're removing rmap records for crosslinked blocks, use deferred intent items so that we can try to free/unmap as many of the old data structure's blocks as we can in the same transaction as the commit.
--- fs/xfs/scrub/reap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/xfs/scrub/reap.c +5 -4
@@ -416,8 +416,6 @@ xreap_agextent_iter(trace_xreap_dispose_unmap_extent (pag_group (sc->sa.pag), agbno, *aglenp); - rs->force_roll = true; -if (rs->oinfo == &XFS_RMAP_OINFO_COW ) {/* * If we're unmapping CoW staging extents, remove the
@@ -426,11 +424,14 @@ xreap_agextent_iter(*/ xfs_refcount_free_cow_extent (sc->tp, false, fsbno, *aglenp); + rs->force_roll = true;return 0 ; } -return xfs_rmap_free (sc->tp, sc->sa.agf_bp, sc->sa.pag, agbno, - *aglenp, rs->oinfo); +xfs_rmap_free_extent (sc->tp, false, fsbno, *aglenp, + rs->oinfo->oi_owner); + rs->deferred++; +return 0 ; }trace_xreap_dispose_free_extent (pag_group (sc->sa.pag), agbno, *aglenp);
Greg Kroah-Hartman
maintainerPATCH 298/371 x86/fred: Remove ENDBR64 from FRED entry points
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Li (Intel) <[email protected]>
commit 3da01ffe1aeaa0d427ab5235ba735226670a80d9 upstream.
The FRED specification has been changed in v9.0 to state that there is no need for FRED event handlers to begin with ENDBR64, because in the presence of supervisor indirect branch tracking, FRED event delivery does not enter the WAIT_FOR_ENDBRANCH state.
As a result, remove ENDBR64 from FRED entry points.
Then add ANNOTATE_NOENDBR to indicate that FRED entry points will never be used for indirect calls to suppress an objtool warning.
This change implies that any indirect CALL/JMP to FRED entry points causes #CP in the presence of supervisor indirect branch tracking.
Credit goes to Jennifer Miller <[email protected]> and other contributors from Arizona State University whose research shows that placing ENDBR at entry points has negative value thus led to this change.
Note: This is obviously an incompatible change to the FRED architecture. But, it's OK because there no FRED systems out in the wild today. All production hardware and late pre-production hardware will follow the FRED v9 spec and be compatible with this approach.
[ dhansen: add note to changelog about incompatibility ]
--- arch/x86/entry/entry_64_fred.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry_64_fred.S +1 -1
@@ -16,7 +16,7 @@ .macro FRED_ENTER UNWIND_HINT_END_OF_STACK - ENDBR + ANNOTATE_NOENDBR PUSH_AND_CLEAR_REGS movq %rsp, %rdi /* %rdi -> pt_regs */ .endm
Greg Kroah-Hartman
maintainerPATCH 299/371 x86/umip: Check that the instruction opcode is at least two bytes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 32278c677947ae2f042c9535674a7fff9a245dd3 upstream.
When checking for a potential UMIP violation on #GP, verify the decoder found at least two opcode bytes to avoid false positives when the kernel encounters an unknown instruction that starts with 0f. Because the array of opcode.bytes is zero-initialized by insn_init(), peeking at bytes[1] will misinterpret garbage as a potential SLDT or STR instruction, and can incorrectly trigger emulation.
E.g. if a VPALIGNR instruction
62 83 c5 05 0f 08 ff vpalignr xmm17{k5},xmm23,XMMWORD PTR [r8],0xff
hits a #GP, the kernel emulates it as STR and squashes the #GP (and corrupts the userspace code stream).
Arguably the check should look for exactly two bytes, but no three byte opcodes use '0f 00 xx' or '0f 01 xx' as an escape, i.e. it should be impossible to get a false positive if the first two opcode bytes match '0f 00' or '0f 01'. Go with a more conservative check with respect to the existing code to minimize the chances of breaking userspace, e.g. due to decoder weirdness.
Analyzed by Nick Bray <[email protected]>.
--- arch/x86/kernel/umip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/umip.c +2 -2
@@ -156,8 +156,8 @@ static int identify_insn(struct insn *inif (!insn->modrm.nbytes)return -EINVAL ; -/* All the instructions of interest start with 0x0f. */ -if (insn->opcode.bytes[0 ] !=0xf ) +/* The instructions of interest have 2-byte opcodes: 0F 00 or 0F 01. */ +if (insn->opcode.nbytes <2 || insn->opcode.bytes[0 ] !=0xf )return -EINVAL ;if (insn->opcode.bytes[1 ] ==0x1 ) {
Greg Kroah-Hartman
maintainerPATCH 300/371 x86/umip: Fix decoding of register forms of 0F 01 (SGDT and SIDT aliases)
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 27b1fd62012dfe9d3eb8ecde344d7aa673695ecf upstream.
Filter out the register forms of 0F 01 when determining whether or not to emulate in response to a potential UMIP violation #GP, as SGDT and SIDT only accept memory operands. The register variants of 0F 01 are used to encode instructions for things like VMX and SGX, i.e. not checking the Mod field would cause the kernel to incorrectly emulate on #GP, e.g. due to a CPL violation on VMLAUNCH.
--- arch/x86/kernel/umip.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/umip.c +11 -0
@@ -163,8 +163,19 @@ static int identify_insn(struct insn *inif (insn->opcode.bytes[1 ] ==0x1 ) {switch (X86_MODRM_REG (insn->modrm.value)) {case 0 : +/* The reg form of 0F 01 /0 encodes VMX instructions. */ +if (X86_MODRM_MOD (insn->modrm.value) ==3 ) +return -EINVAL ; +return UMIP_INST_SGDT ;case 1 : +/* +* The reg form of 0F 01 /1 encodes MONITOR/MWAIT, +* STAC/CLAC, and ENCLS. +*/ +if (X86_MODRM_MOD (insn->modrm.value) ==3 ) +return -EINVAL ; +return UMIP_INST_SIDT ;case 4 :return UMIP_INST_SMSW ;
Greg Kroah-Hartman
maintainerPATCH 301/371 mptcp: pm: in-kernel: usable client side with C-flag
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 4b1ff850e0c1aacc23e923ed22989b827b9808f9 upstream.
When servers set the C-flag in their MP_CAPABLE to tell clients not to create subflows to the initial address and port, clients will likely not use their other endpoints. That's because the in-kernel path-manager uses the 'subflow' endpoints to create subflows only to the initial address and port.
If the limits have not been modified to accept ADD_ADDR, the client doesn't try to establish new subflows. If the limits accept ADD_ADDR, the routing routes will be used to select the source IP.
The C-flag is typically set when the server is operating behind a legacy Layer 4 load balancer, or using anycast IP address. Clients having their different 'subflow' endpoints setup, don't end up creating multiple subflows as expected, and causing some deployment issues.
A special case is then added here: when servers set the C-flag in the MPC and directly sends an ADD_ADDR, this single ADD_ADDR is accepted. The 'subflows' endpoints will then be used with this new remote IP and port. This exception is only allowed when the ADD_ADDR is sent immediately after the 3WHS, and makes the client switching to the 'fully established' mode. After that, 'select_local_address()' will not be able to find any subflows, because 'id_avail_bitmap' will be filled in mptcp_pm_create_subflow_or_signal_addr(), when switching to 'fully established' mode.
--- net/mptcp/pm.c | 7 +++++-- net/mptcp/pm_kernel.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- net/mptcp/protocol.h | 8 ++++++++ 3 files changed, 62 insertions(+), 3 deletions(-)
net/mptcp/pm.c +5 -2
@@ -617,9 +617,12 @@ void mptcp_pm_add_addr_received(const st }else {__MPTCP_INC_STATS (sock_net ((struct sock *)msk),MPTCP_MIB_ADDADDRDROP ); } -/* id0 should not have a different address */ +/* - id0 should not have a different address +* - special case for C-flag: linked to fill_local_addresses_vec() +*/ }else if ((addr->id ==0 && !mptcp_pm_is_init_remote_addr (msk, addr)) || - (addr->id >0 && !READ_ONCE (pm->accept_addr))) { + (addr->id >0 && !READ_ONCE (pm->accept_addr) && + !mptcp_pm_add_addr_c_flag_case (msk))) {mptcp_pm_announce_addr (msk, addr, true);mptcp_pm_add_addr_send_ack (msk); }else if (mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_RECEIVED )) {
net/mptcp/pm_kernel.c +49 -1
77 lines not on this page · raw message
net/mptcp/protocol.h +8 -0
@@ -1201,6 +1201,14 @@ static inline void mptcp_pm_close_subflospin_unlock_bh (&msk->pm.lock); } +static inline bool mptcp_pm_add_addr_c_flag_case (struct mptcp_sock *msk) +{ +return READ_ONCE (msk->pm.remote_deny_join_id0) && + msk->pm.local_addr_used ==0 && +mptcp_pm_get_add_addr_accept_max (msk) ==0 && + msk->pm.subflows <mptcp_pm_get_subflows_max (msk); +} +void mptcp_sockopt_sync_locked (struct mptcp_sock *msk,struct sock *ssk);static inline struct mptcp_ext *mptcp_get_ext (const struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 302/371 mptcp: reset blackhole on success with non-loopback ifaces
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 833d4313bc1e9e194814917d23e8874d6b651649 upstream.
When a first MPTCP connection gets successfully established after a blackhole period, 'active_disable_times' was supposed to be reset when this connection was done via any non-loopback interfaces.
Unfortunately, the opposite condition was checked: only reset when the connection was established via a loopback interface. Fixing this by simply looking at the opposite.
This is similar to what is done with TCP FastOpen, see tcp_fastopen_active_disable_ofo_check().
This patch is a follow-up of a previous discussion linked to commit 893c49a78d9f ("mptcp: Use __sk_dst_get() and dst_dev_rcu() in mptcp_active_enable()."), see [1].
--- net/mptcp/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/ctrl.c +1 -1
@@ -507,7 +507,7 @@ void mptcp_active_enable(struct sock *skrcu_read_lock (); dst =__sk_dst_get (sk); dev = dst ?dst_dev_rcu (dst) :NULL ; -if (dev && (dev->flags &IFF_LOOPBACK )) +if (!(dev && (dev->flags &IFF_LOOPBACK )))atomic_set (&pernet->active_disable_times,0 );rcu_read_unlock (); }
Greg Kroah-Hartman
maintainerPATCH 303/371 selftests: mptcp: join: validate C-flag + def limit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 008385efd05e04d8dff299382df2e8be0f91d8a0 upstream.
The previous commit adds an exception for the C-flag case. The 'mptcp_join.sh' selftest is extended to validate this case.
In this subtest, there is a typical CDN deployment with a client where MPTCP endpoints have been 'automatically' configured:
- the server set net.mptcp.allow_join_initial_addr_port=0
- the client has multiple 'subflow' endpoints, and the default limits:
not accepting ADD_ADDRs.
Without the parent patch, the client is not able to establish new subflows using its 'subflow' endpoints. The parent commit fixes that.
The 'Fixes' tag here below is the same as the one from the previous
commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +11 -0
@@ -3187,6 +3187,17 @@ deny_join_id0_tests() run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 fi + + # default limits, server deny join id 0 + signal + if reset_with_allow_join_id0 "default limits, server deny join id 0" 0 1; then + pm_nl_set_limits $ns1 0 2 + pm_nl_set_limits $ns2 0 2 + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal + pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow + pm_nl_add_endpoint $ns2 10.0.4.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr 2 2 2 + fi } fullmesh_tests()
Greg Kroah-Hartman
maintainerPATCH 304/371 s390/cio/ioasm: Fix __xsch() condition code handling
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit f0edc8f113a39d1c9f8cf83e865c32b0668d80e0 upstream.
For the __xsch() inline assembly the conversion to flag output macros is incomplete. Only the conditional shift of the return value was added, while the required changes to the inline assembly itself are missing.
If compiled with GCC versions before 14.2 this leads to a double shift of the cc output operand and therefore the returned value of __xsch() is incorrectly always zero, instead of the expected condition code.
--- drivers/s390/cio/ioasm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/s390/cio/ioasm.c +3 -4
@@ -253,11 +253,10 @@ static inline int __xsch(struct subchannel_id schid) asm volatile( " lgr 1,%[r1]\n" " xsch\n" -" ipm %[cc]\n" -" srl %[cc],28\n" - : [cc]"=&d" (ccode) + CC_IPM(cc) + : CC_OUT(cc, ccode) : [r1] "d" (r1) - :"cc" ,"1" ); + : CC_CLOBBER_LIST("1"));return CC_TRANSFORM (ccode); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 305/371 s390/dasd: enforce dma_alignment to ensure proper buffer validation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaehoon Kim <[email protected]>
commit 130e6de62107116eba124647116276266be0f84c upstream.
The block layer validates buffer alignment using the device's dma_alignment value. If dma_alignment is smaller than logical_block_size(bp_block) -1, misaligned buffer incorrectly pass validation and propagate to the lower-level driver.
This patch adjusts dma_alignment to be at least logical_block_size -1, ensuring that misalignment buffers are properly rejected at the block layer and do not reach the DASD driver unnecessarily.
--- drivers/s390/block/dasd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/s390/block/dasd.c +5 -0
@@ -334,6 +334,11 @@ static int dasd_state_basic_to_ready(str lim.max_dev_sectors = device->discipline->max_sectors (block); lim.max_hw_sectors = lim.max_dev_sectors; lim.logical_block_size = block->bp_block; +/* +* Adjust dma_alignment to match block_size - 1 +* to ensure proper buffer alignment checks in the block layer. +*/ + lim.dma_alignment = lim.logical_block_size -1 ;if (device->discipline->has_discard) {unsigned int max_bytes;
Greg Kroah-Hartman
maintainerPATCH 306/371 s390/dasd: Return BLK_STS_INVAL for EINVAL from do_dasd_request
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaehoon Kim <[email protected]>
commit 8f4ed0ce4857ceb444174503fc9058720d4faaa1 upstream.
Currently, if CCW request creation fails with -EINVAL, the DASD driver returns BLK_STS_IOERR to the block layer.
This can happen, for example, when a user-space application such as QEMU passes a misaligned buffer, but the original cause of the error is masked as a generic I/O error.
This patch changes the behavior so that -EINVAL is returned as BLK_STS_INVAL, allowing user space to properly detect alignment issues instead of interpreting them as I/O errors.
--- drivers/s390/block/dasd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/s390/block/dasd.c +7 -5
@@ -3119,12 +3119,14 @@ static blk_status_t do_dasd_request(stru PTR_ERR(cqr) == -ENOMEM || PTR_ERR(cqr) == -EAGAIN) { rc = BLK_STS_RESOURCE; - goto out; + } else if (PTR_ERR(cqr) == -EINVAL) { + rc = BLK_STS_INVAL; + } else { +DBF_DEV_EVENT (DBF_ERR , basedev, +"CCW creation failed (rc=%ld) on request %p" , +PTR_ERR (cqr), req); + rc =BLK_STS_IOERR ; } -DBF_DEV_EVENT (DBF_ERR , basedev, -"CCW creation failed (rc=%ld) on request %p" , -PTR_ERR (cqr), req); - rc =BLK_STS_IOERR ; goto out; }/*
Greg Kroah-Hartman
maintainerPATCH 307/371 s390: Add -Wno-pointer-sign to KBUILD_CFLAGS_DECOMPRESSOR
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit fa7a0a53eeb7e16402f82c3d5a9ef4bf5efe9357 upstream.
If the decompressor is compiled with clang this can lead to the following warning:
In file included from arch/s390/boot/startup.c:4:
...
In file included from ./include/linux/pgtable.h:6:./arch/s390/include/asm/pgtable.h:2065:48: warning: passing 'unsigned long *' to parameter of type
'long *' converts between pointers to integer types with different sign [-Wpointer-sign]
2065 | value = __atomic64_or_barrier(PGSTE_PCL_BIT, ptr);
Add -Wno-pointer-sign to the decompressor compile flags, like it is also done for the kernel. This is similar to what was done for x86 to address the same problem [1].
[1] commit dca5203e3fe2 ("x86/boot: Add -Wno-pointer-sign to KBUILD_CFLAGS")
--- arch/s390/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/s390/Makefile +1 -0
@@ -25,6 +25,7 @@ endif KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR +KBUILD_CFLAGS_DECOMPRESSOR += -Wno-pointer-sign KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding
Greg Kroah-Hartman
maintainerPATCH 308/371 slab: prevent warnings when slab obj_exts vector allocation fails
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suren Baghdasaryan <[email protected]>
commit 4038016397da5c1cebb10e7c85a36d06123724a8 upstream.
When object extension vector allocation fails, we set slab->obj_exts to OBJEXTS_ALLOC_FAIL to indicate the failure. Later, once the vector is successfully allocated, we will use this flag to mark codetag references stored in that vector as empty to avoid codetag warnings.
slab_obj_exts() used to retrieve the slab->obj_exts vector pointer checks slab->obj_exts for being either NULL or a pointer with MEMCG_DATA_OBJEXTS bit set. However it does not handle the case when slab->obj_exts equals OBJEXTS_ALLOC_FAIL. Add the missing condition to avoid extra warning.
--- mm/slab.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
mm/slab.h +6 -2
@@ -526,8 +526,12 @@ static inline struct slabobj_ext *slab_ounsigned long obj_exts =READ_ONCE (slab->obj_exts);#ifdef CONFIG_MEMCG -VM_BUG_ON_PAGE (obj_exts && !(obj_exts &MEMCG_DATA_OBJEXTS ), -slab_page (slab)); +/* +* obj_exts should be either NULL, a valid pointer with +* MEMCG_DATA_OBJEXTS bit set or be equal to OBJEXTS_ALLOC_FAIL. +*/ +VM_BUG_ON_PAGE (obj_exts && !(obj_exts &MEMCG_DATA_OBJEXTS ) && + obj_exts !=OBJEXTS_ALLOC_FAIL ,slab_page (slab));VM_BUG_ON_PAGE (obj_exts &MEMCG_DATA_KMEM ,slab_page (slab));#endif return (struct slabobj_ext *)(obj_exts & ~OBJEXTS_FLAGS_MASK );
Greg Kroah-Hartman
maintainerPATCH 309/371 slab: mark slab->obj_exts allocation failures unconditionally
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suren Baghdasaryan <[email protected]>
commit f7381b9116407ba2a429977c80ff8df953ea9354 upstream.
alloc_slab_obj_exts() should mark failed obj_exts vector allocations independent on whether the vector is being allocated for a new or an existing slab. Current implementation skips doing this for existing slabs. Fix this by marking failed allocations unconditionally.
--- mm/slub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/slub.c +1 -2
@@ -2034,8 +2034,7 @@ int alloc_slab_obj_exts(struct slab *sla slab_nid(slab));if (!vec) {/* Mark vectors which failed to allocate */ -if (new_slab) -mark_failed_objexts_alloc (slab); +mark_failed_objexts_alloc (slab);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 310/371 wifi: ath11k: HAL SRNG: dont deinitialize and re-initialize again
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
commit 32be3ca4cf78b309dfe7ba52fe2d7cc3c23c5634 upstream.
Don't deinitialize and reinitialize the HAL helpers. The dma memory is deallocated and there is high possibility that we'll not be able to get the same memory allocated from dma when there is high memory pressure.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03926.13-QCAHSPSWPL_V2_SILICONZ_CE-2.52297.6
--- drivers/net/wireless/ath/ath11k/core.c | 6 +----- drivers/net/wireless/ath/ath11k/hal.c | 16 ++++++++++++++++ drivers/net/wireless/ath/ath11k/hal.h | 1 + 3 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +1 -5
@@ -2215,14 +2215,10 @@ static int ath11k_core_reconfigure_on_crmutex_unlock (&ab->core_lock);ath11k_dp_free (ab); -ath11k_hal_srng_deinit (ab); +ath11k_hal_srng_clear (ab); ab->free_vdev_map = (1LL << (ab->num_radios *TARGET_NUM_VDEVS (ab))) -1 ; - ret =ath11k_hal_srng_init (ab); -if (ret) -return ret; -clear_bit (ATH11K_FLAG_CRASH_FLUSH , &ab->dev_flags); ret =ath11k_core_qmi_firmware_ready (ab);
drivers/net/wireless/ath/ath11k/hal.c +16 -0
@@ -1386,6 +1386,22 @@ void ath11k_hal_srng_deinit(struct ath11 }EXPORT_SYMBOL (ath11k_hal_srng_deinit); +void ath11k_hal_srng_clear (struct ath11k_base *ab) +{ +/* No need to memset rdp and wrp memory since each individual +* segment would get cleared in ath11k_hal_srng_src_hw_init() +* and ath11k_hal_srng_dst_hw_init(). +*/ +memset (ab->hal.srng_list,0 , +sizeof (ab->hal.srng_list)); +memset (ab->hal.shadow_reg_addr,0 , +sizeof (ab->hal.shadow_reg_addr)); + ab->hal.avail_blk_resource =0 ; + ab->hal.current_blk_index =0 ; + ab->hal.num_shadow_reg_configured =0 ; +} +EXPORT_SYMBOL (ath11k_hal_srng_clear); +void ath11k_hal_dump_srng_stats (struct ath11k_base *ab) {struct hal_srng *srng;
drivers/net/wireless/ath/ath11k/hal.h +1 -0
@@ -965,6 +965,7 @@ int ath11k_hal_srng_setup(struct ath11k_ struct hal_srng_params *params);int ath11k_hal_srng_init (struct ath11k_base *ath11k);void ath11k_hal_srng_deinit (struct ath11k_base *ath11k); +void ath11k_hal_srng_clear (struct ath11k_base *ab);void ath11k_hal_dump_srng_stats (struct ath11k_base *ab);void ath11k_hal_srng_get_shadow_config (struct ath11k_base *ab,u32 **cfg,u32 *len);
Greg Kroah-Hartman
maintainerPATCH 311/371 wifi: iwlwifi: Fix dentry reference leak in iwl_mld_add_link_debugfs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqian Lin <[email protected]>
commit ff46e2e7034c78489fa7a6bc35f7c9dd8ab82905 upstream.
The debugfs_lookup() function increases the dentry reference count. Add missing dput() call to release the reference when the "iwlmld" directory already exists.
--- drivers/net/wireless/intel/iwlwifi/mld/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mld/debugfs.c +5 -1
@@ -1001,8 +1001,12 @@ void iwl_mld_add_link_debugfs(struct ieee80211_hw *hw,* If not, this is a per-link dir of a MLO vif, add in it the iwlmld * dir. */ -if (!mld_link_dir) +if (!mld_link_dir) { mld_link_dir =debugfs_create_dir ("iwlmld" , dir); + }else { +/* Release the reference from debugfs_lookup */ +dput (mld_link_dir); + } } static ssize_t _iwl_dbgfs_fixed_rate_write(struct iwl_mld *mld, char *buf,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 312/371 wifi: rtw89: avoid possible TX wait initialization race
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit c24248ed78f33ea299ea61d105355ba47157d49f upstream.
The value of skb_data->wait indicates whether skb is passed on to the core mac80211 stack or released by the driver itself. Make sure that by the time skb is added to txwd queue and becomes visible to the completing side, it has already allocated and initialized TX wait related data (in case it's needed).
This is found by code review and addresses a possible race scenario described below:
Waiting thread Completing thread
rtw89_core_send_nullfunc()
rtw89_core_tx_write_link()
...
rtw89_pci_txwd_submit()
skb_data->wait = NULL
/* add skb to the queue */
skb_queue_tail(&txwd->queue, skb) /* another thread (e.g. rtw89_ops_tx) performs TX kick off for the same queue */
rtw89_pci_napi_poll()
...
rtw89_pci_release_txwd_skb()
/* get skb from the queue */
skb_unlink(skb, &txwd->queue)
rtw89_pci_tx_status()
rtw89_core_tx_wait_complete()
/* use incorrect skb_data->wait */ rtw89_core_tx_kick_off_and_wait()
/* assign skb_data->wait but too late */
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/core.c | 39 ++++++++++++++++-------------- drivers/net/wireless/realtek/rtw89/core.h | 3 +- drivers/net/wireless/realtek/rtw89/pci.c | 2 - 3 files changed, 24 insertions(+), 20 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +22 -17
@@ -1091,25 +1091,14 @@ void rtw89_core_tx_kick_off(struct rtw89 }int rtw89_core_tx_kick_off_and_wait (struct rtw89_dev *rtwdev,struct sk_buff *skb, -int qsel,unsigned int timeout) +struct rtw89_tx_wait_info *wait,int qsel, +unsigned int timeout) { -struct rtw89_tx_skb_data *skb_data =RTW89_TX_SKB_CB (skb); -struct rtw89_tx_wait_info *wait;unsigned long time_left;int ret =0 ;lockdep_assert_wiphy (rtwdev->hw->wiphy); - wait =kzalloc (sizeof (*wait),GFP_KERNEL ); -if (!wait) { -rtw89_core_tx_kick_off (rtwdev, qsel); -return 0 ; - } - -init_completion (&wait->completion); - wait->skb = skb; -rcu_assign_pointer (skb_data->wait, wait); -rtw89_core_tx_kick_off (rtwdev, qsel); time_left =wait_for_completion_timeout (&wait->completion,msecs_to_jiffies (timeout));
@@ -1172,10 +1161,12 @@ int rtw89_h2c_tx(struct rtw89_dev *rtwdestatic int rtw89_core_tx_write_link (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link,struct rtw89_sta_link *rtwsta_link, -struct sk_buff *skb,int *qsel,bool sw_mld) +struct sk_buff *skb,int *qsel,bool sw_mld, +struct rtw89_tx_wait_info *wait) {struct ieee80211_sta *sta =rtwsta_link_to_sta_safe (rtwsta_link);struct ieee80211_vif *vif =rtwvif_link_to_vif (rtwvif_link); +struct rtw89_tx_skb_data *skb_data =RTW89_TX_SKB_CB (skb);struct rtw89_vif *rtwvif = rtwvif_link->rtwvif;struct rtw89_core_tx_request tx_req = {};int ret;
@@ -1192,6 +1183,8 @@ static int rtw89_core_tx_write_link(strurtw89_core_tx_update_desc_info (rtwdev, &tx_req);rtw89_core_tx_wake (rtwdev, &tx_req); +rcu_assign_pointer (skb_data->wait, wait); + ret =rtw89_hci_tx_write (rtwdev, &tx_req);if (ret) {rtw89_err (rtwdev,"failed to transmit skb to HCI\n" );
@@ -1228,7 +1221,8 @@ int rtw89_core_tx_write(struct rtw89_dev } } -return rtw89_core_tx_write_link (rtwdev, rtwvif_link, rtwsta_link, skb, qsel, false); +return rtw89_core_tx_write_link (rtwdev, rtwvif_link, rtwsta_link, skb, qsel, false, +NULL ); }static __le32 rtw89_build_txwd_body0 (struct rtw89_tx_desc_info *desc_info)
@@ -3426,6 +3420,7 @@ int rtw89_core_send_nullfunc(struct rtw8struct ieee80211_vif *vif =rtwvif_link_to_vif (rtwvif_link);int link_id =ieee80211_vif_is_mld (vif) ? rtwvif_link->link_id :-1 ;struct rtw89_sta_link *rtwsta_link; +struct rtw89_tx_wait_info *wait;struct ieee80211_sta *sta;struct ieee80211_hdr *hdr;struct rtw89_sta *rtwsta;
@@ -3435,6 +3430,12 @@ int rtw89_core_send_nullfunc(struct rtw8if (vif->type !=NL80211_IFTYPE_STATION || !vif->cfg.assoc)return 0 ; + wait =kzalloc (sizeof (*wait),GFP_KERNEL ); +if (!wait) +return -ENOMEM ; + +init_completion (&wait->completion); +rcu_read_lock (); sta =ieee80211_find_sta (vif, vif->cfg.ap_addr);if (!sta) {
@@ -3449,6 +3450,8 @@ int rtw89_core_send_nullfunc(struct rtw8 goto out; } + wait->skb = skb; + hdr = (struct ieee80211_hdr *)skb->data;if (ps) hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PM );
@@ -3460,7 +3463,8 @@ int rtw89_core_send_nullfunc(struct rtw8 goto out; } - ret =rtw89_core_tx_write_link (rtwdev, rtwvif_link, rtwsta_link, skb, &qsel, true); + ret =rtw89_core_tx_write_link (rtwdev, rtwvif_link, rtwsta_link, skb, &qsel, true, + wait);if (ret) {rtw89_warn (rtwdev,"nullfunc transmit failed: %d\n" , ret);dev_kfree_skb_any (skb);
@@ -3469,10 +3473,11 @@ int rtw89_core_send_nullfunc(struct rtw8rcu_read_unlock (); -return rtw89_core_tx_kick_off_and_wait (rtwdev, skb, qsel, +return rtw89_core_tx_kick_off_and_wait (rtwdev, skb, wait, qsel, timeout); out:rcu_read_unlock (); +kfree (wait);return ret; }
drivers/net/wireless/realtek/rtw89/core.h +2 -1
@@ -7389,7 +7389,8 @@ int rtw89_h2c_tx(struct rtw89_dev *rtwde struct sk_buff *skb, bool fwdl);void rtw89_core_tx_kick_off (struct rtw89_dev *rtwdev,u8 qsel);int rtw89_core_tx_kick_off_and_wait (struct rtw89_dev *rtwdev,struct sk_buff *skb, -int qsel,unsigned int timeout); +struct rtw89_tx_wait_info *wait,int qsel, +unsigned int timeout);void rtw89_core_fill_txdesc (struct rtw89_dev *rtwdev,struct rtw89_tx_desc_info *desc_info,void *txdesc);
drivers/net/wireless/realtek/rtw89/pci.c +0 -2
@@ -1372,7 +1372,6 @@ static int rtw89_pci_txwd_submit(structstruct pci_dev *pdev = rtwpci->pdev;struct sk_buff *skb = tx_req->skb;struct rtw89_pci_tx_data *tx_data =RTW89_PCI_TX_SKB_CB (skb); -struct rtw89_tx_skb_data *skb_data =RTW89_TX_SKB_CB (skb);bool en_wd_info = desc_info->en_wd_info;u32 txwd_len;u32 txwp_len;
@@ -1388,7 +1387,6 @@ static int rtw89_pci_txwd_submit(struct } tx_data->dma = dma; -rcu_assign_pointer (skb_data->wait,NULL ); txwp_len =sizeof (*txwp_info); txwd_len = chip->txwd_body_size;
Greg Kroah-Hartman
maintainerPATCH 313/371 wifi: mt76: mt7925u: Add VID/PID for Netgear A9000
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Morrow <[email protected]>
commit f6159b2051e157550d7609e19d04471609c6050b upstream.
Add VID/PID 0846/9072 for recently released Netgear A9000.
--- drivers/net/wireless/mediatek/mt76/mt7925/usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/usb.c +3 -0
@@ -12,6 +12,9 @@static const struct usb_device_id mt7925u_device_table[] = { {USB_DEVICE_AND_INTERFACE_INFO (0x0e8d ,0x7925 ,0xff ,0xff ,0xff ), .driver_info = (kernel_ulong_t )MT7925_FIRMWARE_WM }, +/* Netgear, Inc. A9000 */ + {USB_DEVICE_AND_INTERFACE_INFO (0x0846 ,0x9072 ,0xff ,0xff ,0xff ), + .driver_info = (kernel_ulong_t )MT7925_FIRMWARE_WM }, { }, };
Greg Kroah-Hartman
maintainerPATCH 314/371 wifi: mt76: mt7921u: Add VID/PID for Netgear A7500
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Morrow <[email protected]>
commit fc6627ca8a5f811b601aea74e934cf8a048c88ac upstream.
Add VID/PID 0846/9065 for Netgear A7500.
--- drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/usb.c +3 -0
@@ -21,6 +21,9 @@ static const struct usb_device_id mt7921/* Netgear, Inc. [A8000,AXE3000] */ { USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9060, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)MT7921_FIRMWARE_WM }, + /* Netgear, Inc. A7500 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9065, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)MT7921_FIRMWARE_WM }, /* TP-Link TXE50UH */ { USB_DEVICE_AND_INTERFACE_INFO(0x35bc, 0x0107, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)MT7921_FIRMWARE_WM },
Greg Kroah-Hartman
maintainerPATCH 315/371 mm/thp: fix MTE tag mismatch when replacing zero-filled subpages
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lance Yang <[email protected]>
commit 1ce6473d17e78e3cb9a40147658231731a551828 upstream.
When both THP and MTE are enabled, splitting a THP and replacing its zero-filled subpages with the shared zeropage can cause MTE tag mismatch faults in userspace.
Remapping zero-filled subpages to the shared zeropage is unsafe, as the zeropage has a fixed tag of zero, which may not match the tag expected by the userspace pointer.
KSM already avoids this problem by using memcmp_pages(), which on arm64 intentionally reports MTE-tagged pages as non-identical to prevent unsafe merging.
As suggested by David[1], this patch adopts the same pattern, replacing the memchr_inv() byte-level check with a call to pages_identical(). This leverages existing architecture-specific logic to determine if a page is truly identical to the shared zeropage.
Having both the THP shrinker and KSM rely on pages_identical() makes the design more future-proof, IMO. Instead of handling quirks in generic code, we just let the architecture decide what makes two pages identical.
[1] https://lore.kernel.org/all/[email protected]
--- mm/huge_memory.c | 15 +++------------ mm/migrate.c | 8 +------- 2 files changed, 4 insertions(+), 19 deletions(-)
mm/huge_memory.c +3 -12
@@ -4115,32 +4115,23 @@ static unsigned long deferred_split_counstatic bool thp_underused (struct folio *folio) {int num_zero_pages =0 , num_filled_pages =0 ; -void *kaddr;int i;if (khugepaged_max_ptes_none ==HPAGE_PMD_NR -1 )return false;for (i =0 ; i <folio_nr_pages (folio); i++) { - kaddr =kmap_local_folio (folio, i *PAGE_SIZE ); -if (!memchr_inv (kaddr,0 ,PAGE_SIZE )) { - num_zero_pages++; -if (num_zero_pages > khugepaged_max_ptes_none) { -kunmap_local (kaddr); +if (pages_identical (folio_page (folio, i),ZERO_PAGE (0 ))) { +if (++num_zero_pages > khugepaged_max_ptes_none)return true; - } }else {/* * Another path for early exit once the number * of non-zero filled pages exceeds threshold. */ - num_filled_pages++; -if (num_filled_pages >=HPAGE_PMD_NR - khugepaged_max_ptes_none) { -kunmap_local (kaddr); +if (++num_filled_pages >=HPAGE_PMD_NR - khugepaged_max_ptes_none)return false; - } } -kunmap_local (kaddr); }return false; }
mm/migrate.c +1 -7
@@ -301,9 +301,7 @@ static bool try_to_map_unused_to_zeropag unsigned long idx) {struct page *page =folio_page (folio, idx); -bool contains_data;pte_t newpte; -void *addr;if (PageCompound (page))return false;
@@ -320,11 +318,7 @@ static bool try_to_map_unused_to_zeropag* this subpage has been non present. If the subpage is only zero-filled * then map it to the shared zeropage. */ - addr =kmap_local_page (page); - contains_data =memchr_inv (addr,0 ,PAGE_SIZE ); -kunmap_local (addr); - -if (contains_data) +if (!pages_identical (page,ZERO_PAGE (0 )))return false; newpte = pte_mkspecial(pfn_pte(my_zero_pfn(pvmw->address),
Greg Kroah-Hartman
maintainerPATCH 316/371 mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lance Yang <[email protected]>
commit 9658d698a8a83540bf6a6c80d13c9a61590ee985 upstream.
When splitting an mTHP and replacing a zero-filled subpage with the shared zeropage, try_to_map_unused_to_zeropage() currently drops several important PTE bits.
For userspace tools like CRIU, which rely on the soft-dirty mechanism for incremental snapshots, losing the soft-dirty bit means modified pages are missed, leading to inconsistent memory state after restore.
As pointed out by David, the more critical uffd-wp bit is also dropped. This breaks the userfaultfd write-protection mechanism, causing writes to be silently missed by monitoring applications, which can lead to data corruption.
Preserve both the soft-dirty and uffd-wp bits from the old PTE when creating the new zeropage mapping to ensure they are correctly tracked.
--- mm/migrate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
mm/migrate.c +10 -5
@@ -297,8 +297,7 @@ bool isolate_folio_to_list(struct folio }static bool try_to_map_unused_to_zeropage (struct page_vma_mapped_walk *pvmw, -struct folio *folio, -unsigned long idx) +struct folio *folio,pte_t old_pte,unsigned long idx) {struct page *page =folio_page (folio, idx);pte_t newpte;
@@ -307,7 +306,7 @@ static bool try_to_map_unused_to_zeropagreturn false;VM_BUG_ON_PAGE (!PageAnon (page), page);VM_BUG_ON_PAGE (!PageLocked (page), page); -VM_BUG_ON_PAGE (pte_present (ptep_get (pvmw->pte)), page); +VM_BUG_ON_PAGE (pte_present (old_pte), page);if (folio_test_mlocked (folio) || (pvmw->vma->vm_flags &VM_LOCKED ) ||mm_forbids_zeropage (pvmw->vma->vm_mm))
@@ -323,6 +322,12 @@ static bool try_to_map_unused_to_zeropag newpte =pte_mkspecial (pfn_pte (my_zero_pfn (pvmw->address), pvmw->vma->vm_page_prot)); + +if (pte_swp_soft_dirty (old_pte)) + newpte =pte_mksoft_dirty (newpte); +if (pte_swp_uffd_wp (old_pte)) + newpte =pte_mkuffd_wp (newpte); +set_pte_at (pvmw->vma->vm_mm, pvmw->address, pvmw->pte, newpte);dec_mm_counter (pvmw->vma->vm_mm,mm_counter (folio));
@@ -365,13 +370,13 @@ static bool remove_migration_pte(struct continue; }#endif + old_pte =ptep_get (pvmw.pte);if (rmap_walk_arg->map_unused_to_zeropage && -try_to_map_unused_to_zeropage (&pvmw, folio, idx)) +try_to_map_unused_to_zeropage (&pvmw, folio, old_pte, idx))continue ;folio_get (folio); pte =mk_pte (new,READ_ONCE (vma->vm_page_prot)); - old_pte =ptep_get (pvmw.pte); entry =pte_to_swp_entry (old_pte);if (!is_migration_entry_young (entry))
Greg Kroah-Hartman
maintainerPATCH 317/371 mm/page_alloc: only set ALLOC_HIGHATOMIC for __GPF_HIGH allocations
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 6a204d4b14c99232e05d35305c27ebce1c009840 upstream.
Commit 524c48072e56 ("mm/page_alloc: rename ALLOC_HIGH to ALLOC_MIN_RESERVE") is the start of a series that explains how __GFP_HIGH, which implies ALLOC_MIN_RESERVE, is going to be used instead of __GFP_ATOMIC for high atomic reserves.
Commit eb2e2b425c69 ("mm/page_alloc: explicitly record high-order atomic allocations in alloc_flags") introduced ALLOC_HIGHATOMIC for such allocations of order higher than 0. It still used __GFP_ATOMIC, though.
Then, commit 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves") just turned that check for !__GFP_DIRECT_RECLAIM, ignoring that high atomic reserves were expected to test for __GFP_HIGH.
This leads to high atomic reserves being added for high-order GFP_NOWAIT allocations and others that clear __GFP_DIRECT_RECLAIM, which is unexpected. Later, those reserves lead to 0-order allocations going to the slow path and starting reclaim.
Quoted 1 line
From
/proc/pagetypeinfo, without the patch:
Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA32, type HighAtomic 1 8 10 9 7 3 0 0 0 0 0 Node 0, zone Normal, type HighAtomic 64 20 12 5 0 0 0 0 0 0 0
With the patch:
Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA32, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -4408,7 +4408,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigif (!(gfp_mask & __GFP_NOMEMALLOC)) { alloc_flags |=ALLOC_NON_BLOCK ; -if (order >0 ) +if (order >0 && (alloc_flags &ALLOC_MIN_RESERVE )) alloc_flags |=ALLOC_HIGHATOMIC ; }
Greg Kroah-Hartman
maintainerPATCH 318/371 mm/hugetlb: early exit from hugetlb_pages_alloc_boot() when max_huge_pages=0
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
commit b322e88b3d553e85b4e15779491c70022783faa4 upstream.
Optimize hugetlb_pages_alloc_boot() to return immediately when max_huge_pages is 0, avoiding unnecessary CPU cycles and the below log message when hugepages aren't configured in the kernel command line.
[ 3.702280] HugeTLB: allocation took 0ms with hugepage_allocation_threads=32
--- mm/hugetlb.c | 3 +++ 1 file changed, 3 insertions(+)
mm/hugetlb.c +3 -0
@@ -3654,6 +3654,9 @@ static void __init hugetlb_hstate_alloc_return ; } +if (!h->max_huge_pages) +return ; +/* do node specific alloc */ if (hugetlb_hstate_alloc_pages_specific_nodes (h))return ;
Greg Kroah-Hartman
maintainerPATCH 319/371 mm/damon/vaddr: do not repeat pte_offset_map_lock() until success
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit b93af2cc8e036754c0d9970d9ddc47f43cc94b9f upstream.
DAMON's virtual address space operation set implementation (vaddr) calls pte_offset_map_lock() inside the page table walk callback function. This is for reading and writing page table accessed bits. If pte_offset_map_lock() fails, it retries by returning the page table walk callback function with ACTION_AGAIN.
pte_offset_map_lock() can continuously fail if the target is a pmd migration entry, though. Hence it could cause an infinite page table walk if the migration cannot be done until the page table walk is finished. This indeed caused a soft lockup when CPU hotplugging and DAMON were running in parallel.
Avoid the infinite loop by simply not retrying the page table walk. DAMON is promising only a best-effort accuracy, so missing access to such pages is no problem.
--- mm/damon/vaddr.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
mm/damon/vaddr.c +2 -6
@@ -328,10 +328,8 @@ static int damon_mkold_pmd_entry(pmd_t * } pte =pte_offset_map_lock (walk->mm, pmd, addr, &ptl); -if (!pte) { - walk->action =ACTION_AGAIN ; +if (!pte)return 0 ; - }if (!pte_present (ptep_get (pte))) goto out;damon_ptep_mkold (pte, walk->vma, addr);
@@ -481,10 +479,8 @@ regular_page:#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ pte =pte_offset_map_lock (walk->mm, pmd, addr, &ptl); -if (!pte) { - walk->action =ACTION_AGAIN ; +if (!pte)return 0 ; - } ptent =ptep_get (pte);if (!pte_present (ptent)) goto out;
Greg Kroah-Hartman
maintainerPATCH 320/371 mm/damon/lru_sort: use param_ctx for damon_attrs staging
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit e18190b7e97e9db6546390e6e0ceddae606892b2 upstream.
damon_lru_sort_apply_parameters() allocates a new DAMON context, stages user-specified DAMON parameters on it, and commits to running DAMON context at once, using damon_commit_ctx(). The code is, however, directly updating the monitoring attributes of the running context. And the attributes are over-written by later damon_commit_ctx() call. This means that the monitoring attributes parameters are not really working. Fix the wrong use of the parameter context.
--- mm/damon/lru_sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/lru_sort.c +1 -1
@@ -203,7 +203,7 @@ static int damon_lru_sort_apply_paramete goto out; } - err =damon_set_attrs (ctx, &damon_lru_sort_mon_attrs); + err =damon_set_attrs (param_ctx, &damon_lru_sort_mon_attrs);if (err) goto out;
Greg Kroah-Hartman
maintainerPATCH 321/371 nfsd: decouple the xprtsec policy check from check_nfsd_access()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
commit e4f574ca9c6dfa66695bb054ff5df43ecea873ec upstream.
A while back I had reported that an NFSv3 client could successfully mount using '-o xprtsec=none' an export that had been exported with 'xprtsec=tls:mtls'. By "successfully" I mean that the mount command would succeed and the mount would show up in /proc/mount. Attempting to do anything futher with the mount would be met with NFS3ERR_ACCES.
This was fixed (albeit accidentally) by commit bb4f07f2409c ("nfsd:
Fix NFSD_MAY_BYPASS_GSS and NFSD_MAY_BYPASS_GSS_ON_ROOT") and was subsequently re-broken by commit 0813c5f01249 ("nfsd: fix access checking for NLM under XPRTSEC policies").
Transport Layer Security isn't an RPC security flavor or pseudo-flavor, so we shouldn't be conflating them when determining whether the access checks can be bypassed. Split check_nfsd_access() into two helpers, and have __fh_verify() call the helpers directly since __fh_verify() has logic that allows one or both of the checks to be skipped. All other sites will continue to call check_nfsd_access().
--- fs/nfsd/export.c | 82 ++++++++++++++++++++++++++++++++++++++----------------- fs/nfsd/export.h | 3 ++ fs/nfsd/nfsfh.c | 24 +++++++++++++++- 3 files changed, 83 insertions(+), 26 deletions(-)
fs/nfsd/export.c +57 -25
@@ -1082,50 +1082,62 @@ static struct svc_export *exp_find(struc }/** -* check_nfsd_access - check if access to export is allowed. +* check_xprtsec_policy - check if access to export is allowed by the +* xprtsec policy * @exp: svc_export that is being accessed. -* @rqstp: svc_rqst attempting to access @exp (will be NULL for LOCALIO). -* @may_bypass_gss: reduce strictness of authorization check +* @rqstp: svc_rqst attempting to access @exp. +* +* Helper function for check_nfsd_access(). Note that callers should be +* using check_nfsd_access() instead of calling this function directly. The +* one exception is __fh_verify() since it has logic that may result in one +* or both of the helpers being skipped. * * Return values: * %nfs_ok if access is granted, or * %nfserr_wrongsec if access is denied */ -__be32 check_nfsd_access (struct svc_export *exp,struct svc_rqst *rqstp, -bool may_bypass_gss) +__be32 check_xprtsec_policy (struct svc_export *exp,struct svc_rqst *rqstp) { -struct exp_flavor_info *f, *end = exp->ex_flavors + exp->ex_nflavors; -struct svc_xprt *xprt; - -/* -* If rqstp is NULL, this is a LOCALIO request which will only -* ever use a filehandle/credential pair for which access has -* been affirmed (by ACCESS or OPEN NFS requests) over the -* wire. So there is no need for further checks here. -*/ -if (!rqstp) -return nfs_ok; - - xprt = rqstp->rq_xprt; +struct svc_xprt *xprt = rqstp->rq_xprt;if (exp->ex_xprtsec_modes &NFSEXP_XPRTSEC_NONE ) {if (!test_bit (XPT_TLS_SESSION , &xprt->xpt_flags)) - goto ok; +return nfs_ok; }if (exp->ex_xprtsec_modes &NFSEXP_XPRTSEC_TLS ) {if (test_bit (XPT_TLS_SESSION , &xprt->xpt_flags) && !test_bit (XPT_PEER_AUTH , &xprt->xpt_flags)) - goto ok; +return nfs_ok; }if (exp->ex_xprtsec_modes &NFSEXP_XPRTSEC_MTLS ) {if (test_bit (XPT_TLS_SESSION , &xprt->xpt_flags) &&test_bit (XPT_PEER_AUTH , &xprt->xpt_flags)) - goto ok; +return nfs_ok; } -if (!may_bypass_gss) - goto denied; +return nfserr_wrongsec; +} + +/** +* check_security_flavor - check if access to export is allowed by the +* security flavor +* @exp: svc_export that is being accessed. +* @rqstp: svc_rqst attempting to access @exp. +* @may_bypass_gss: reduce strictness of authorization check +* +* Helper function for check_nfsd_access(). Note that callers should be +* using check_nfsd_access() instead of calling this function directly. The +* one exception is __fh_verify() since it has logic that may result in one +* or both of the helpers being skipped. +* +* Return values: +* %nfs_ok if access is granted, or +* %nfserr_wrongsec if access is denied +*/ +__be32 check_security_flavor (struct svc_export *exp,struct svc_rqst *rqstp, +bool may_bypass_gss) +{ +struct exp_flavor_info *f, *end = exp->ex_flavors + exp->ex_nflavors; -ok:/* legacy gss-only clients are always OK: */ if (exp->ex_client == rqstp->rq_gssclient)return nfs_ok;
@@ -1167,10 +1179,30 @@ ok: } } -denied:return nfserr_wrongsec; } +/** +* check_nfsd_access - check if access to export is allowed. +* @exp: svc_export that is being accessed. +* @rqstp: svc_rqst attempting to access @exp. +* @may_bypass_gss: reduce strictness of authorization check +* +* Return values: +* %nfs_ok if access is granted, or +* %nfserr_wrongsec if access is denied +*/ +__be32 check_nfsd_access (struct svc_export *exp,struct svc_rqst *rqstp, +bool may_bypass_gss) +{ +__be32 status; + + status =check_xprtsec_policy (exp, rqstp); +if (status != nfs_ok) +return status; +return check_security_flavor (exp, rqstp, may_bypass_gss); +} +/* * Uses rq_client and rq_gssclient to find an export; uses rq_client (an * auth_unix client) if it's available and has secinfo information;
fs/nfsd/export.h +3 -0
@@ -101,6 +101,9 @@ struct svc_expkey {struct svc_cred ;int nfsexp_flags (struct svc_cred *cred,struct svc_export *exp); +__be32 check_xprtsec_policy (struct svc_export *exp,struct svc_rqst *rqstp); +__be32 check_security_flavor (struct svc_export *exp,struct svc_rqst *rqstp, +bool may_bypass_gss);__be32 check_nfsd_access (struct svc_export *exp,struct svc_rqst *rqstp,bool may_bypass_gss);
fs/nfsd/nfsfh.c +23 -1
@@ -364,10 +364,30 @@ __fh_verify(struct svc_rqst *rqstp,if (error) goto out; +/* +* If rqstp is NULL, this is a LOCALIO request which will only +* ever use a filehandle/credential pair for which access has +* been affirmed (by ACCESS or OPEN NFS requests) over the +* wire. Skip both the xprtsec policy and the security flavor +* checks. +*/ +if (!rqstp) + goto check_permissions; +if ((access &NFSD_MAY_NLM ) && (exp->ex_flags &NFSEXP_NOAUTHNLM ))/* NLM is allowed to fully bypass authentication */ goto out; +/* +* NLM is allowed to bypass the xprtsec policy check because lockd +* doesn't support xprtsec. +*/ +if (!(access &NFSD_MAY_NLM )) { + error =check_xprtsec_policy (exp, rqstp); +if (error) + goto out; + } +if (access &NFSD_MAY_BYPASS_GSS ) may_bypass_gss = true;/*
@@ -379,13 +399,15 @@ __fh_verify(struct svc_rqst *rqstp, && exp->ex_path.dentry == dentry) may_bypass_gss = true; - error =check_nfsd_access (exp, rqstp, may_bypass_gss); + error =check_security_flavor (exp, rqstp, may_bypass_gss);if (error) goto out; +/* During LOCALIO call to fh_verify will be called with a NULL rqstp */ if (rqstp)svc_xprt_set_valid (rqstp->rq_xprt); +check_permissions:/* Finally, check access permissions. */ error =nfsd_permission (cred, exp, dentry, access); out:
Greg Kroah-Hartman
maintainerPATCH 322/371 NFSD: Fix destination buffer size in nfsd4_ssc_setup_dul()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit ab1c282c010c4f327bd7addc3c0035fd8e3c1721 upstream.
Commit 5304877936c0 ("NFSD: Fix strncpy() fortify warning") replaced strncpy(,, sizeof(..)) with strlcpy(,, sizeof(..) - 1), but strlcpy() already guaranteed NUL-termination of the destination buffer and subtracting one byte potentially truncated the source string.
The incorrect size was then carried over in commit 72f78ae00a8e ("NFSD:
move from strlcpy with unused retval to strscpy") when switching from strlcpy() to strscpy().
Fix this off-by-one error by using the full size of the destination buffer again.
--- fs/nfsd/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4proc.c +1 -1
@@ -1498,7 +1498,7 @@ try_again:return 0 ; }if (work) { -strscpy (work->nsui_ipaddr, ipaddr,sizeof (work->nsui_ipaddr) -1 ); +strscpy (work->nsui_ipaddr, ipaddr,sizeof (work->nsui_ipaddr));refcount_set (&work->nsui_refcnt,2 ); work->nsui_busy = true;list_add_tail (&work->nsui_list, &nn->nfsd_ssc_mount_list);
Greg Kroah-Hartman
maintainerPATCH 323/371 nfsd: nfserr_jukebox in nlm_fopen should lead to a retry
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit a082e4b4d08a4a0e656d90c2c05da85f23e6d0c9 upstream.
When v3 NLM request finds a conflicting delegation, it triggers a delegation recall and nfsd_open fails with EAGAIN. nfsd_open then translates EAGAIN into nfserr_jukebox. In nlm_fopen, instead of returning nlm_failed for when there is a conflicting delegation, drop this NLM request so that the client retries. Once delegation is recalled and if a local lock is claimed, a retry would lead to nfsd returning a nlm_lck_blocked error or a successful nlm lock.
--- fs/nfsd/lockd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
fs/nfsd/lockd.c +15 -0
@@ -57,6 +57,21 @@ nlm_fopen(struct svc_rqst *rqstp, structswitch (nfserr) {case nfs_ok:return 0 ; +case nfserr_jukebox: +/* this error can indicate a presence of a conflicting +* delegation to an NLM lock request. Options are: +* (1) For now, drop this request and make the client +* retry. When delegation is returned, client's lock retry +* will complete. +* (2) NLM4_DENIED as per "spec" signals to the client +* that the lock is unavailable now but client can retry. +* Linux client implementation does not. It treats +* NLM4_DENIED same as NLM4_FAILED and errors the request. +* (3) For the future, treat this as blocked lock and try +* to callback when the delegation is returned but might +* not have a proper lock request to block on. +*/ + fallthrough;case nfserr_dropit:return nlm_drop_reply;case nfserr_stale:
Greg Kroah-Hartman
maintainerPATCH 324/371 media: iris: Call correct power off callback in cleanup path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 2fbb823a0744665fe6015bd03d435bd334ccecf7 upstream.
Driver implements different callbacks for the power off controller (.power_off_controller):
- iris_vpu_power_off_controller,
- iris_vpu33_power_off_controller,
The generic wrapper for handling power off - iris_vpu_power_off() - calls them via 'iris_platform_data->vpu_ops', so shall the cleanup code in iris_vpu_power_on().
This makes also sense if looking at caller of iris_vpu_power_on(), which unwinds also with the wrapper calling respective platfortm code (unwinds with iris_vpu_power_off()).
Otherwise power off sequence on the newer VPU3.3 in error path is not complete.
--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vpu_common.c +1 -1
@@ -359,7 +359,7 @@ int iris_vpu_power_on(struct iris_core *core)return 0 ; err_power_off_ctrl: -iris_vpu_power_off_controller (core); + core->iris_platform_data->vpu_ops->power_off_controller (core); err_unvote_icc:iris_unset_icc_bw (core); err:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 325/371 media: iris: Fix firmware reference leak and unmap memory after load
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 57429b0fddfe3cea21a56326576451a4a4c2019b upstream.
When we succeed loading the firmware, we don't want to hold on to the firmware pointer anymore, since it won't be freed anywhere else. The same applies for the mapped memory. Unmapping the memory is particularly important since the memory will be protected after the Iris firmware is started, so we need to make sure there will be no accidental access to this region (even if just a speculative one from the CPU).
Almost the same firmware loading code also exists in venus/firmware.c, there it is implemented correctly.
Fix this by dropping the early "return ret" and move the call of qcom_scm_pas_auth_and_reset() out of iris_load_fw_to_memory(). We should unmap the memory before bringing the firmware out of reset.
--- drivers/media/platform/qcom/iris/iris_firmware.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/media/platform/qcom/iris/iris_firmware.c +6 -9
@@ -60,16 +60,7 @@ static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name) ret =qcom_mdt_load (dev, firmware, fw_name, pas_id, mem_virt, mem_phys, res_size,NULL ); -if (ret) - goto err_mem_unmap; - ret =qcom_scm_pas_auth_and_reset (pas_id); -if (ret) - goto err_mem_unmap; - -return ret; - -err_mem_unmap:memunmap (mem_virt); err_release_fw:release_firmware (firmware);
@@ -94,6 +85,12 @@ int iris_fw_load(struct iris_core *core)return -ENOMEM ; } + ret =qcom_scm_pas_auth_and_reset (core->iris_platform_data->pas_id); +if (ret) { +dev_err (core->dev,"auth and reset failed: %d\n" , ret); +return ret; + } + ret = qcom_scm_mem_protect_video_var(cp_config->cp_start, cp_config->cp_size, cp_config->cp_nonpixel_start,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 326/371 media: iris: fix module removal if firmware download failed
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Armstrong <[email protected]>
commit fde38008fc4f43db8c17869491870df24b501543 upstream.
Fix remove if firmware failed to load:
qcom-iris aa00000.video-codec: Direct firmware load for qcom/vpu/vpu33_p4.mbn failed with error -2 qcom-iris aa00000.video-codec: firmware download failed
qcom-iris aa00000.video-codec: core init failed
then:
$ echo aa00000.video-codec > /sys/bus/platform/drivers/qcom-iris/unbind
Triggers:
genpd genpd:1:aa00000.video-codec: Runtime PM usage count underflow!
------------[ cut here ]------------ video_cc_mvs0_clk already disabled WARNING: drivers/clk/clk.c:1206 at clk_core_disable+0xa4/0xac, CPU#1: sh/542 <snip> pc : clk_core_disable+0xa4/0xac lr : clk_core_disable+0xa4/0xac <snip> Call trace: clk_core_disable+0xa4/0xac (P) clk_disable+0x30/0x4c iris_disable_unprepare_clock+0x20/0x48 [qcom_iris] iris_vpu_power_off_hw+0x48/0x58 [qcom_iris] iris_vpu33_power_off_hardware+0x44/0x230 [qcom_iris] iris_vpu_power_off+0x34/0x84 [qcom_iris] iris_core_deinit+0x44/0xc8 [qcom_iris] iris_remove+0x20/0x48 [qcom_iris] platform_remove+0x20/0x30 device_remove+0x4c/0x80 <snip> ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------ video_cc_mvs0_clk already unprepared WARNING: drivers/clk/clk.c:1065 at clk_core_unprepare+0xf0/0x110, CPU#2: sh/542 <snip> pc : clk_core_unprepare+0xf0/0x110 lr : clk_core_unprepare+0xf0/0x110 <snip> Call trace: clk_core_unprepare+0xf0/0x110 (P) clk_unprepare+0x2c/0x44 iris_disable_unprepare_clock+0x28/0x48 [qcom_iris] iris_vpu_power_off_hw+0x48/0x58 [qcom_iris] iris_vpu33_power_off_hardware+0x44/0x230 [qcom_iris] iris_vpu_power_off+0x34/0x84 [qcom_iris] iris_core_deinit+0x44/0xc8 [qcom_iris] iris_remove+0x20/0x48 [qcom_iris] platform_remove+0x20/0x30 device_remove+0x4c/0x80 <snip> ---[ end trace 0000000000000000 ]--- genpd genpd:0:aa00000.video-codec: Runtime PM usage count underflow! ------------[ cut here ]------------ gcc_video_axi0_clk already disabled WARNING: drivers/clk/clk.c:1206 at clk_core_disable+0xa4/0xac, CPU#4: sh/542 <snip> pc : clk_core_disable+0xa4/0xac lr : clk_core_disable+0xa4/0xac <snip> Call trace: clk_core_disable+0xa4/0xac (P) clk_disable+0x30/0x4c iris_disable_unprepare_clock+0x20/0x48 [qcom_iris] iris_vpu33_power_off_controller+0x17c/0x428 [qcom_iris] iris_vpu_power_off+0x48/0x84 [qcom_iris] iris_core_deinit+0x44/0xc8 [qcom_iris] iris_remove+0x20/0x48 [qcom_iris] platform_remove+0x20/0x30 device_remove+0x4c/0x80 <snip> ------------[ cut here ]------------ gcc_video_axi0_clk already unprepared WARNING: drivers/clk/clk.c:1065 at clk_core_unprepare+0xf0/0x110, CPU#4: sh/542 <snip> pc : clk_core_unprepare+0xf0/0x110 lr : clk_core_unprepare+0xf0/0x110 <snip> Call trace: clk_core_unprepare+0xf0/0x110 (P) clk_unprepare+0x2c/0x44 iris_disable_unprepare_clock+0x28/0x48 [qcom_iris] iris_vpu33_power_off_controller+0x17c/0x428 [qcom_iris] iris_vpu_power_off+0x48/0x84 [qcom_iris] iris_core_deinit+0x44/0xc8 [qcom_iris] iris_remove+0x20/0x48 [qcom_iris] platform_remove+0x20/0x30 device_remove+0x4c/0x80 <snip> ---[ end trace 0000000000000000 ]---
Skip deinit if initialization never succeeded.
--- drivers/media/platform/qcom/iris/iris_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_core.c +6 -4
@@ -15,10 +15,12 @@ void iris_core_deinit(struct iris_core *core)pm_runtime_resume_and_get (core->dev);mutex_lock (&core->lock); -iris_fw_unload (core); -iris_vpu_power_off (core); -iris_hfi_queues_deinit (core); - core->state =IRIS_CORE_DEINIT ; +if (core->state !=IRIS_CORE_DEINIT ) { +iris_fw_unload (core); +iris_vpu_power_off (core); +iris_hfi_queues_deinit (core); + core->state =IRIS_CORE_DEINIT ; + }mutex_unlock (&core->lock);pm_runtime_put_sync (core->dev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 327/371 media: iris: vpu3x: Add MNoC low power handshake during hardware power-off
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 93fad55aa996eef17a837ed95b1d621ef05d967b upstream.
Add the missing write to AON_WRAPPER_MVP_NOC_LPI_CONTROL before reading the LPI status register. Introduce a handshake loop to ensure MNoC enters low power mode reliably during VPU3 hardware power-off with timeout handling.
--- drivers/media/platform/qcom/iris/iris_vpu3x.c | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_vpu3x.c +30 -2
@@ -19,6 +19,9 @@#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C)#define REQ_POWER_DOWN_PREP BIT(0)#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60) +#define NOC_LPI_STATUS_DONE BIT(0)/* Indicates the NOC handshake is complete */ +#define NOC_LPI_STATUS_DENY BIT(1)/* Indicates the NOC handshake is denied */ +#define NOC_LPI_STATUS_ACTIVE BIT(2)/* Indicates the NOC is active */ #define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88)#define CORE_CLK_RUN 0x0
@@ -109,7 +112,9 @@ static void iris_vpu3_power_off_hardware(struct iris_core *core)static void iris_vpu33_power_off_hardware (struct iris_core *core) { +bool handshake_done = false, handshake_busy = false;u32 reg_val =0 , value, i; +u32 count =0 ;int ret;if (iris_vpu3x_hw_power_collapsed (core))
@@ -128,13 +133,36 @@ static void iris_vpu33_power_off_hardware(struct iris_core *core) goto disable_power; } +/* Retry up to 1000 times as recommended by hardware documentation */ +do { +/* set MNoC to low power */ +writel (REQ_POWER_DOWN_PREP , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + +udelay (15 ); + + value =readl (core->reg_base +AON_WRAPPER_MVP_NOC_LPI_STATUS ); + + handshake_done = value &NOC_LPI_STATUS_DONE ; + handshake_busy = value & (NOC_LPI_STATUS_DENY |NOC_LPI_STATUS_ACTIVE ); + +if (handshake_done || !handshake_busy) +break ; + +writel (0 , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + +udelay (15 ); + + }while (++count <1000 ); + +if (!handshake_done && handshake_busy) +dev_err (core->dev,"LPI handshake timeout\n" ); + ret =readl_poll_timeout (core->reg_base +AON_WRAPPER_MVP_NOC_LPI_STATUS , reg_val, reg_val &BIT (0 ),200 ,2000 );if (ret) goto disable_power; -/* set MNoC to low power, set PD_NOC_QREQ (bit 0) */ -writel (BIT (0 ), core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); +writel (0 , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL );writel (CORE_BRIDGE_SW_RESET |CORE_BRIDGE_HW_RESET_DISABLE , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 328/371 media: iris: Fix port streaming handling
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 4b67ef9b333ed645879b4b1a11e35e019ff4cfea upstream.
The previous check to block capture port streaming before output port was incorrect and caused some valid usecase to fail. While removing that check allows capture port to enter streaming independently, it also introduced firmware errors due to premature queuing of DPB buffers before the firmware session was fully started which happens only when streamon is called on output port.
Fix this by deferring DPB buffer queuing to the firmware until both capture and output are streaming and state is 'STREAMING'.
--- .../media/platform/qcom/iris/iris_buffer.c | 27 +++++++++++++++++++ .../media/platform/qcom/iris/iris_buffer.h | 1 + drivers/media/platform/qcom/iris/iris_vb2.c | 8 +++--- 3 files changed, 32 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_buffer.c +27 -0
@@ -334,6 +334,29 @@ int iris_queue_buffer(struct iris_inst *inst, struct iris_buffer *buf)return 0 ; } +int iris_queue_internal_deferred_buffers (struct iris_inst *inst,enum iris_buffer_type buffer_type) +{ +struct iris_buffer *buffer, *next; +struct iris_buffers *buffers; +int ret =0 ; + + buffers = &inst->buffers[buffer_type]; +list_for_each_entry_safe (buffer, next, &buffers->list, list) { +if (buffer->attr &BUF_ATTR_PENDING_RELEASE ) +continue ; +if (buffer->attr &BUF_ATTR_QUEUED ) +continue ; + +if (buffer->attr &BUF_ATTR_DEFERRED ) { + ret =iris_queue_buffer (inst, buffer); +if (ret) +return ret; + } + } + +return ret; +} +int iris_queue_internal_buffers (struct iris_inst *inst,u32 plane) {const struct iris_platform_data *platform_data = inst->core->iris_platform_data;
@@ -358,6 +381,10 @@ int iris_queue_internal_buffers(struct iris_inst *inst, u32 plane)continue ;if (buffer->attr &BUF_ATTR_QUEUED )continue ; +if (buffer->type ==BUF_DPB && inst->state !=IRIS_INST_STREAMING ) { + buffer->attr |=BUF_ATTR_DEFERRED ; +continue ; + } ret =iris_queue_buffer (inst, buffer);if (ret)return ret;
drivers/media/platform/qcom/iris/iris_buffer.h +1 -0
@@ -105,6 +105,7 @@ int iris_get_buffer_size(struct iris_inst *inst, enum iris_buffer_type buffer_tyvoid iris_get_internal_buffers (struct iris_inst *inst,u32 plane);int iris_create_internal_buffers (struct iris_inst *inst,u32 plane);int iris_queue_internal_buffers (struct iris_inst *inst,u32 plane); +int iris_queue_internal_deferred_buffers (struct iris_inst *inst,enum iris_buffer_type buffer_type);int iris_destroy_internal_buffer (struct iris_inst *inst,struct iris_buffer *buffer);int iris_destroy_all_internal_buffers (struct iris_inst *inst,u32 plane);int iris_destroy_dequeued_internal_buffers (struct iris_inst *inst,u32 plane);
drivers/media/platform/qcom/iris/iris_vb2.c +4 -4
@@ -173,9 +173,6 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count) inst =vb2_get_drv_priv (q); -if (V4L2_TYPE_IS_CAPTURE (q->type) && inst->state ==IRIS_INST_INIT ) -return 0 ; -mutex_lock (&inst->lock);if (inst->state ==IRIS_INST_ERROR ) { ret = -EBUSY ;
@@ -203,7 +200,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count) buf_type =iris_v4l2_type_to_driver (q->type); - ret =iris_queue_deferred_buffers (inst, buf_type); +if (inst->state ==IRIS_INST_STREAMING ) + ret =iris_queue_internal_deferred_buffers (inst,BUF_DPB ); +if (!ret) + ret =iris_queue_deferred_buffers (inst, buf_type);if (ret) goto error;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 329/371 media: iris: Fix buffer count reporting in internal buffer check
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit cba6aed4223e83ae0f2ed1c0f68d974fd62847bc upstream.
Initialize the count variable to zero before counting unreleased internal buffers in iris_check_num_queued_internal_buffers(). This prevents stale values from previous iterations and ensures accurate error reporting for each buffer type. Without this initialization, the count could accumulate across types, leading to incorrect log messages.
--- drivers/media/platform/qcom/iris/iris_vidc.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/qcom/iris/iris_vidc.c +1 -0
@@ -240,6 +240,7 @@ static void iris_check_num_queued_internfor (i =0 ; i < internal_buffer_count; i++) { buffers = &inst->buffers[internal_buf_type[i]]; + count =0 ;list_for_each_entry_safe (buf, next, &buffers->list, list) count++;if (count)
Greg Kroah-Hartman
maintainerPATCH 330/371 media: iris: Allow substate transition to load resources during output streaming
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 65f72c6a8d97c0cbdc785cb9a35dc358dee67959 upstream.
A client (e.g., GST for encoder) can initiate streaming on the capture port before the output port, causing the instance state to transition to OUTPUT_STREAMING. When streaming is subsequently started on the output port, the instance state advances to STREAMING, and the substate should transition to LOAD_RESOURCES.
Previously, the code blocked the substate transition to LOAD_RESOURCES if the instance state was OUTPUT_STREAMING. This update modifies the logic to permit the substate transition to LOAD_RESOURCES when the instance state is OUTPUT_STREAMING, thereby supporting this client streaming sequence.
--- drivers/media/platform/qcom/iris/iris_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_state.c +2 -1
@@ -122,7 +122,8 @@ static bool iris_inst_allow_sub_state(struct iris_inst *inst, enum iris_inst_subreturn false;case IRIS_INST_OUTPUT_STREAMING :if (sub_state & (IRIS_INST_SUB_DRC_LAST | -IRIS_INST_SUB_DRAIN_LAST |IRIS_INST_SUB_OUTPUT_PAUSE )) +IRIS_INST_SUB_DRAIN_LAST |IRIS_INST_SUB_OUTPUT_PAUSE | +IRIS_INST_SUB_LOAD_RESOURCES ))return true;return false;case IRIS_INST_STREAMING :
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 331/371 media: iris: Always destroy internal buffers on firmware release response
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 9cae3619e465dd1cdaa5a5ffbbaf4f41338b0022 upstream.
Currently, internal buffers are destroyed only if 'PENDING_RELEASE' flag is set when a release response is received from the firmware, which is incorrect. Internal buffers should always be destroyed when the firmware explicitly releases it, regardless of whether the 'PENDING_RELEASE' flag was set by the driver. This is specially important during force-stop scenarios, where the firmware may release buffers without driver marking them for release.
Fix this by removing the incorrect check and ensuring all buffers are properly cleaned up.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c +1 -4
@@ -424,7 +424,6 @@ static int iris_hfi_gen2_handle_release_internal_buffer(struct iris_inst *inst,struct iris_buffers *buffers = &inst->buffers[buf_type];struct iris_buffer *buf, *iter;bool found = false; -int ret =0 ;list_for_each_entry (iter, &buffers->list, list) {if (iter->device_addr == buffer->base_address) {
@@ -437,10 +436,8 @@ static int iris_hfi_gen2_handle_release_internal_buffer(struct iris_inst *inst,return -EINVAL ; buf->attr &= ~BUF_ATTR_QUEUED ; -if (buf->attr &BUF_ATTR_PENDING_RELEASE ) - ret =iris_destroy_internal_buffer (inst, buf); -return ret; +return iris_destroy_internal_buffer (inst, buf); } static int iris_hfi_gen2_handle_session_stop(struct iris_inst *inst,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 332/371 media: iris: Simplify session stop logic by relying on vb2 checks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 0fe10666d3b4d0757b7f4671892523855ee68cc8 upstream.
Remove earlier complex conditional checks in the non-streaming path that attempted to verify if stop was called on a plane that was previously started. These explicit checks are redundant, as vb2 already ensures that stop is only called on ports that have been started, maintaining correct buffer state management.
--- .../qcom/iris/iris_hfi_gen1_command.c | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +19 -23
@@ -184,11 +184,25 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane)u32 flush_type =0 ;int ret =0 ; -if ((V4L2_TYPE_IS_OUTPUT (plane) && - inst->state ==IRIS_INST_INPUT_STREAMING ) || - (V4L2_TYPE_IS_CAPTURE (plane) && - inst->state ==IRIS_INST_OUTPUT_STREAMING ) || - inst->state ==IRIS_INST_ERROR ) { +if (inst->state ==IRIS_INST_STREAMING ) { +if (V4L2_TYPE_IS_OUTPUT (plane)) + flush_type =HFI_FLUSH_ALL ; +else if (V4L2_TYPE_IS_CAPTURE (plane)) + flush_type =HFI_FLUSH_OUTPUT ; + +reinit_completion (&inst->flush_completion); + + flush_pkt.shdr.hdr.size =sizeof (struct hfi_session_flush_pkt ); + flush_pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_FLUSH ; + flush_pkt.shdr.session_id = inst->session_id; + flush_pkt.flush_type = flush_type; + + ret =iris_hfi_queue_cmd_write (core, &flush_pkt, flush_pkt.shdr.hdr.size); +if (!ret) { + inst->flush_responses_pending++; + ret =iris_wait_for_session_response (inst, true); + } + }else {reinit_completion (&inst->completion);iris_hfi_gen1_packet_session_cmd (inst, &pkt,HFI_CMD_SESSION_STOP ); ret =iris_hfi_queue_cmd_write (core, &pkt, pkt.shdr.hdr.size);
@@ -207,24 +221,6 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane) VB2_BUF_STATE_ERROR);iris_helper_buffers_done (inst,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ,VB2_BUF_STATE_ERROR ); - }else if (inst->state ==IRIS_INST_STREAMING ) { -if (V4L2_TYPE_IS_OUTPUT (plane)) - flush_type =HFI_FLUSH_ALL ; -else if (V4L2_TYPE_IS_CAPTURE (plane)) - flush_type =HFI_FLUSH_OUTPUT ; - -reinit_completion (&inst->flush_completion); - - flush_pkt.shdr.hdr.size =sizeof (struct hfi_session_flush_pkt ); - flush_pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_FLUSH ; - flush_pkt.shdr.session_id = inst->session_id; - flush_pkt.flush_type = flush_type; - - ret =iris_hfi_queue_cmd_write (core, &flush_pkt, flush_pkt.shdr.hdr.size); -if (!ret) { - inst->flush_responses_pending++; - ret =iris_wait_for_session_response (inst, true); - } }return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 333/371 media: iris: Update vbuf flags before v4l2_m2m_buf_done
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 8a432174ac263fb9dd93d232b99c84e430e6d6b5 upstream.
Update the vbuf flags appropriately in error cases before calling v4l2_m2m_buf_done(). Previously, the flag update was skippied in error scenario, which could result in incorrect state reporting for buffers.
--- drivers/media/platform/qcom/iris/iris_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_buffer.c +2 -2
@@ -651,6 +651,8 @@ int iris_vb2_buffer_done(struct iris_inst *inst, struct iris_buffer *buf) vb2 = &vbuf->vb2_buf; + vbuf->flags |= buf->flags; +if (buf->flags &V4L2_BUF_FLAG_ERROR ) { state =VB2_BUF_STATE_ERROR ;vb2_set_plane_payload (vb2,0 ,0 );
@@ -659,8 +661,6 @@ int iris_vb2_buffer_done(struct iris_inst *inst, struct iris_buffer *buf)return 0 ; } - vbuf->flags |= buf->flags; -if (V4L2_TYPE_IS_CAPTURE (type)) {vb2_set_plane_payload (vb2,0 , buf->data_size); vbuf->sequence = inst->sequence_cap++;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 334/371 media: iris: Send dummy buffer address for all codecs during drain
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit dec073dd8452e174a69db8444e0932e6b4f31c99 upstream.
Firmware can handle a dummy address for buffers with the EOS flag. To ensure consistent behavior across all codecs, update the drain command to always send a dummy buffer address.
This makes the drain handling uniform and avoids any codec specific assumptions.
--- drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +1 -2
@@ -397,8 +397,7 @@ static int iris_hfi_gen1_session_drain(s ip_pkt.shdr.hdr.pkt_type =HFI_CMD_SESSION_EMPTY_BUFFER ; ip_pkt.shdr.session_id = inst->session_id; ip_pkt.flags =HFI_BUFFERFLAG_EOS ; -if (inst->codec ==V4L2_PIX_FMT_VP9 ) - ip_pkt.packet_buffer =0xdeadb000 ; + ip_pkt.packet_buffer =0xdeadb000 ;return iris_hfi_queue_cmd_write (inst->core, &ip_pkt, ip_pkt.shdr.hdr.size); }
Greg Kroah-Hartman
maintainerPATCH 335/371 media: iris: Fix missing LAST flag handling during drain
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 8172f57746d68e5c3c743f725435d75c5a4db1ac upstream.
Improve drain handling by ensuring the LAST flag is attached to final capture buffer when drain response is received from the firmware.
Previously, the driver failed to attach the V4L2_BUF_FLAG_LAST flag when a drain response was received from the firmware, relying on userspace to mark the next queued buffer as LAST. This update fixes the issue by checking the pending drain status, attaching the LAST flag to the capture buffer received from the firmware (with EOS attached), and returning it to the V4L2 layer correctly.
--- drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c | 4 +--- drivers/media/platform/qcom/iris/iris_state.c | 2 +- drivers/media/platform/qcom/iris/iris_state.h | 1 + 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +1 -3
@@ -416,8 +416,6 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) inst->flush_responses_pending++;iris_inst_sub_state_change_drain_last (inst); - -return ; }if (iris_split_mode_enabled (inst) && pkt->stream_id ==0 ) {
@@ -462,7 +460,7 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) timestamp_us = (timestamp_us <<32 ) | timestamp_lo; }else {if (pkt->stream_id ==1 && !inst->last_buffer_dequeued) { -if (iris_drc_pending (inst)) { +if (iris_drc_pending (inst) ||iris_drain_pending (inst)) { flags |=V4L2_BUF_FLAG_LAST ; inst->last_buffer_dequeued = true; }
drivers/media/platform/qcom/iris/iris_state.c +1 -1
@@ -252,7 +252,7 @@ bool iris_drc_pending(struct iris_inst *inst) inst->sub_state &IRIS_INST_SUB_DRC_LAST ; } -static inline bool iris_drain_pending (struct iris_inst *inst) +bool iris_drain_pending (struct iris_inst *inst) {return inst->sub_state &IRIS_INST_SUB_DRAIN && inst->sub_state &IRIS_INST_SUB_DRAIN_LAST ;
drivers/media/platform/qcom/iris/iris_state.h +1 -0
@@ -141,5 +141,6 @@ int iris_inst_sub_state_change_drc_last(struct iris_inst *inst);int iris_inst_sub_state_change_pause (struct iris_inst *inst,u32 plane);bool iris_allow_cmd (struct iris_inst *inst,u32 cmd);bool iris_drc_pending (struct iris_inst *inst); +bool iris_drain_pending (struct iris_inst *inst);#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 336/371 media: iris: Fix format check for CAPTURE plane in try_fmt
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 2dbd2645c07df8de04ee37b24f2395800513391e upstream.
Previously, the format validation relied on an array of supported formats, which only listed formats for the OUTPUT plane. This caused failures when validating formats for the CAPTURE plane. Update the check to validate against the only supported format on the CAPTURE plane, which is NV12.
--- drivers/media/platform/qcom/iris/iris_vdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vdec.c +1 -1
@@ -158,7 +158,7 @@ int iris_vdec_try_fmt(struct iris_inst *inst, struct v4l2_format *f) }break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : -if (!fmt) { +if (f->fmt.pix_mp.pixelformat !=V4L2_PIX_FMT_NV12 ) { f_inst = inst->fmt_dst; f->fmt.pix_mp.pixelformat = f_inst->fmt.pix_mp.pixelformat; f->fmt.pix_mp.width = f_inst->fmt.pix_mp.width;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 337/371 media: iris: Allow stop on firmware only if start was issued.
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
commit 56a2d85ee8f9b994e5cd17039133218c57c5902b upstream.
For HFI Gen1, the instances substate is changed to LOAD_RESOURCES only when a START command is issues to the firmware. If STOP is called without a prior START, the firmware may reject the command and throw some erros.
Handle this by adding a substate check before issuing STOP command to the firmware.
--- drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +1 -1
@@ -202,7 +202,7 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane) inst->flush_responses_pending++; ret =iris_wait_for_session_response (inst, true); } - }else { + }else if (inst->sub_state &IRIS_INST_SUB_LOAD_RESOURCES ) {reinit_completion (&inst->completion);iris_hfi_gen1_packet_session_cmd (inst, &pkt,HFI_CMD_SESSION_STOP ); ret =iris_hfi_queue_cmd_write (core, &pkt, pkt.shdr.hdr.size);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 338/371 ext4: add ext4_sb_bread_nofail() helper function for ext4_free_branches()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit d8b90e6387a74bcb1714c8d1e6a782ff709de9a9 upstream.
The implicit __GFP_NOFAIL flag in ext4_sb_bread() was removed in commit 8a83ac54940d ("ext4: call bdev_getblk() from sb_getblk_gfp()"), meaning the function can now fail under memory pressure.
Most callers of ext4_sb_bread() propagate the error to userspace and do not remount the filesystem read-only. However, ext4_free_branches() handles ext4_sb_bread() failure by remounting the filesystem read-only.
This implies that an ext3 filesystem (mounted via the ext4 driver) could be forcibly remounted read-only due to a transient page allocation failure, which is unacceptable.
To mitigate this, introduce a new helper function, ext4_sb_bread_nofail(), which explicitly uses __GFP_NOFAIL, and use it in ext4_free_branches().
--- fs/ext4/ext4.h | 2 ++ fs/ext4/indirect.c | 2 +- fs/ext4/super.c | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-)
fs/ext4/ext4.h +2 -0
@@ -3144,6 +3144,8 @@ extern struct buffer_head *ext4_sb_bread sector_t block, blk_opf_t op_flags);extern struct buffer_head *ext4_sb_bread_unmovable (struct super_block *sb,sector_t block); +extern struct buffer_head *ext4_sb_bread_nofail (struct super_block *sb, +sector_t block);extern void ext4_read_bh_nowait (struct buffer_head *bh,blk_opf_t op_flags,bh_end_io_t *end_io,bool simu_fail); extern int ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags,
fs/ext4/indirect.c +1 -1
@@ -1025,7 +1025,7 @@ static void ext4_free_branches(handle_t }/* Go read the buffer for the next level down */ - bh =ext4_sb_bread (inode->i_sb, nr,0 ); + bh =ext4_sb_bread_nofail (inode->i_sb, nr);/* * A read failure? Report error and clear slot
fs/ext4/super.c +9 -0
@@ -265,6 +265,15 @@ struct buffer_head *ext4_sb_bread_unmovareturn __ext4_sb_bread_gfp (sb, block,0 , gfp); } +struct buffer_head *ext4_sb_bread_nofail (struct super_block *sb, +sector_t block) +{ +gfp_t gfp =mapping_gfp_constraint (sb->s_bdev->bd_mapping, + ~__GFP_FS) | __GFP_MOVABLE | __GFP_NOFAIL; + +return __ext4_sb_bread_gfp (sb, block,0 , gfp); +} +void ext4_sb_breadahead_unmovable (struct super_block *sb,sector_t block) { struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
Greg Kroah-Hartman
maintainerPATCH 339/371 ext4: fail unaligned direct IO write with EINVAL
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 963845748fe67125006859229487b45485564db7 upstream.
Commit bc264fea0f6f ("iomap: support incremental iomap_iter advances") changed the error handling logic in iomap_iter(). Previously any error from iomap_dio_bio_iter() got propagated to userspace, after this commit if ->iomap_end returns error, it gets propagated to userspace instead of an error from iomap_dio_bio_iter(). This results in unaligned writes to ext4 to silently fallback to buffered IO instead of erroring out.
Now returning ENOTBLK for DIO writes from ext4_iomap_end() seems unnecessary these days. It is enough to return ENOTBLK from ext4_iomap_begin() when we don't support DIO write for that particular file offset (due to hole).
Message-ID: <[email protected]>
--- fs/ext4/inode.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)
fs/ext4/inode.c +0 -35
@@ -3872,47 +3872,12 @@ static int ext4_iomap_overwrite_begin(struct inode *inode, loff_t offset,return ret; } -static inline bool ext4_want_directio_fallback (unsigned flags,ssize_t written) -{ -/* must be a directio to fall back to buffered */ -if ((flags & (IOMAP_WRITE |IOMAP_DIRECT )) != - (IOMAP_WRITE |IOMAP_DIRECT )) -return false; - -/* atomic writes are all-or-nothing */ -if (flags &IOMAP_ATOMIC ) -return false; - -/* can only try again if we wrote nothing */ -return written ==0 ; -} - -static int ext4_iomap_end (struct inode *inode,loff_t offset,loff_t length, -ssize_t written,unsigned flags,struct iomap *iomap) -{ -/* -* Check to see whether an error occurred while writing out the data to -* the allocated blocks. If so, return the magic error code for -* non-atomic write so that we fallback to buffered I/O and attempt to -* complete the remainder of the I/O. -* For non-atomic writes, any blocks that may have been -* allocated in preparation for the direct I/O will be reused during -* buffered I/O. For atomic write, we never fallback to buffered-io. -*/ -if (ext4_want_directio_fallback (flags, written)) -return -ENOTBLK ; - -return 0 ; -} -const struct iomap_ops ext4_iomap_ops = { .iomap_begin = ext4_iomap_begin, - .iomap_end = ext4_iomap_end, };const struct iomap_ops ext4_iomap_overwrite_ops = { .iomap_begin = ext4_iomap_overwrite_begin, - .iomap_end = ext4_iomap_end, }; static int ext4_iomap_begin_report(struct inode *inode, loff_t offset,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 340/371 ext4: verify orphan file size is not too big
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 0a6ce20c156442a4ce2a404747bb0fb05d54eeb3 upstream.
In principle orphan file can be arbitrarily large. However orphan replay needs to traverse it all and we also pin all its buffers in memory. Thus filesystems with absurdly large orphan files can lead to big amounts of memory consumed. Limit orphan file size to a sane value and also use kvmalloc() for allocating array of block descriptor structures to avoid large order allocations for sane but large orphan files.
Message-ID: <[email protected]>
--- fs/ext4/orphan.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/ext4/orphan.c +12 -1
@@ -583,9 +583,20 @@ int ext4_init_orphan_info(struct super_bext4_msg (sb,KERN_ERR ,"get orphan inode failed" );return PTR_ERR (inode); } +/* +* This is just an artificial limit to prevent corrupted fs from +* consuming absurd amounts of memory when pinning blocks of orphan +* file in memory. +*/ +if (inode->i_size >8 <<20 ) { +ext4_msg (sb,KERN_ERR ,"orphan file too big: %llu" , + (unsigned long long )inode->i_size); + ret = -EFSCORRUPTED ; + goto out_put; + } oi->of_blocks = inode->i_size >> sb->s_blocksize_bits; oi->of_csum_seed =EXT4_I (inode)->i_csum_seed; - oi->of_binfo =kmalloc_array (oi->of_blocks, + oi->of_binfo =kvmalloc_array (oi->of_blocks,sizeof (struct ext4_orphan_block ),GFP_KERNEL );if (!oi->of_binfo) {
Greg Kroah-Hartman
maintainerPATCH 341/371 ext4: increase i_disksize to offset + len in ext4_update_disksize_before_punch()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongjian Sun <[email protected]>
commit 9d80eaa1a1d37539224982b76c9ceeee736510b9 upstream.
After running a stress test combined with fault injection, we performed fsck -a followed by fsck -fn on the filesystem image. During the second pass, fsck -fn reported:
Inode 131512, end of extent exceeds allowed value
(logical block 405, physical block 1180540, len 2)
This inode was not in the orphan list. Analysis revealed the following call chain that leads to the inconsistency:
ext4_da_write_end()
//does not update i_disksize
ext4_punch_hole()
//truncate folio, keep size
ext4_page_mkwrite()
ext4_block_page_mkwrite()
ext4_block_write_begin()
ext4_get_block()
//insert written extent without update i_disksizejournal commit
echo 1 > /sys/block/xxx/device/delete
da-write path updates i_size but does not update i_disksize. Then ext4_punch_hole truncates the da-folio yet still leaves i_disksize unchanged(in the ext4_update_disksize_before_punch function, the condition offset + len < size is met). Then ext4_page_mkwrite sees ext4_nonda_switch return 1 and takes the nodioread_nolock path, the folio about to be written has just been punched out, and it’s offset sits beyond the current i_disksize. This may result in a written extent being inserted, but again does not update i_disksize. If the journal gets committed and then the block device is yanked, we might run into this. It should be noted that replacing ext4_punch_hole with ext4_zero_range in the call sequence may also trigger this issue, as neither will update i_disksize under these circumstances.
To fix this, we can modify ext4_update_disksize_before_punch to increase i_disksize to min(i_size, offset + len) when both i_size and (offset + len) are greater than i_disksize.
Message-ID: <[email protected]>
--- fs/ext4/inode.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/ext4/inode.c +8 -2
@@ -4252,7 +4252,11 @@ int ext4_can_truncate(struct inode *inod* We have to make sure i_disksize gets properly updated before we truncate * page cache due to hole punching or zero range. Otherwise i_disksize update * can get lost as it may have been postponed to submission of writeback but -* that will never happen after we truncate page cache. +* that will never happen if we remove the folio containing i_size from the +* page cache. Also if we punch hole within i_size but above i_disksize, +* following ext4_page_mkwrite() may mistakenly allocate written blocks over +* the hole and thus introduce allocated blocks beyond i_disksize which is +* not allowed (e2fsck would complain in case of crash). */ int ext4_update_disksize_before_punch (struct inode *inode,loff_t offset,loff_t len)
@@ -4263,9 +4267,11 @@ int ext4_update_disksize_before_punch(stloff_t size =i_size_read (inode);WARN_ON (!inode_is_locked (inode)); -if (offset > size || offset + len < size) +if (offset > size)return 0 ; +if (offset + len < size) + size = offset + len;if (EXT4_I (inode)->i_disksize >= size)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 342/371 ext4: correctly handle queries for metadata mappings
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ojaswin Mujoo <[email protected]>
commit 46c22a8bb4cb03211da1100d7ee4a2005bf77c70 upstream.
Currently, our handling of metadata is _ambiguous_ in some scenarios, that is, we end up returning unknown if the range only covers the mapping partially.
For example, in the following case:
$ xfs_io -c fsmap -d
0: 254:16 [0..7]: static fs metadata 8
1: 254:16 [8..15]: special 102:1 8
2: 254:16 [16..5127]: special 102:2 5112
3: 254:16 [5128..5255]: special 102:3 128
4: 254:16 [5256..5383]: special 102:4 128
5: 254:16 [5384..70919]: inodes 65536
6: 254:16 [70920..70967]: unknown 48
...
$ xfs_io -c fsmap -d 24 33
0: 254:16 [24..39]: unknown 16 <--- incomplete reporting
$ xfs_io -c fsmap -d 24 33 (With patch)
0: 254:16 [16..5127]: special 102:2 5112
This is because earlier in ext4_getfsmap_meta_helper, we end up ignoring any extent that starts before our queried range, but overlaps it. While the man page [1] is a bit ambiguous on this, this fix makes the output make more sense since we are anyways returning an "unknown" extent. This is also consistent to how XFS does it:
$ xfs_io -c fsmap -d
...
6: 254:16 [104..127]: free space 24
7: 254:16 [128..191]: inodes 64
...
$ xfs_io -c fsmap -d 137 150
0: 254:16 [128..191]: inodes 64 <-- full extent returned
[1] https://man7.org/linux/man-pages/man2/ioctl_getfsmap.2.html
Message-ID: <023f37e35ee280cd9baac0296cbadcbe10995cab.1757058211.git.ojaswin@linux.ibm.com>
--- fs/ext4/fsmap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/ext4/fsmap.c +9 -5
@@ -74,7 +74,8 @@ static int ext4_getfsmap_dev_compare(constatic bool ext4_getfsmap_rec_before_low_key (struct ext4_getfsmap_info *info,struct ext4_fsmap *rec) { -return rec->fmr_physical < info->gfi_low.fmr_physical; +return rec->fmr_physical + rec->fmr_length <= + info->gfi_low.fmr_physical; }/*
@@ -200,15 +201,18 @@ static int ext4_getfsmap_meta_helper(str ext4_group_first_block_no(sb, agno)); fs_end = fs_start +EXT4_C2B (sbi, len); -/* Return relevant extents from the meta_list */ +/* +* Return relevant extents from the meta_list. We emit all extents that +* partially/fully overlap with the query range +*/ list_for_each_entry_safe (p, tmp, &info->gfi_meta_list, fmr_list) { -if (p->fmr_physical < info->gfi_next_fsblk) { +if (p->fmr_physical + p->fmr_length <= info->gfi_next_fsblk) {list_del (&p->fmr_list);kfree (p);continue ; } -if (p->fmr_physical <= fs_start || - p->fmr_physical + p->fmr_length <= fs_end) { +if (p->fmr_physical <= fs_end && + p->fmr_physical + p->fmr_length > fs_start) {/* Emit the retained free extent record if present */ if (info->gfi_lastfree.fmr_owner) { error = ext4_getfsmap_helper(sb, info,
Greg Kroah-Hartman
maintainerPATCH 343/371 ext4: avoid potential buffer over-read in parse_apply_sb_mount_options()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 8ecb790ea8c3fc69e77bace57f14cf0d7c177bd8 upstream.
Unlike other strings in the ext4 superblock, we rely on tune2fs to make sure s_mount_opts is NUL terminated. Harden parse_apply_sb_mount_options() by treating s_mount_opts as a potential __nonstring.
Message-ID: <[email protected]>
--- fs/ext4/super.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
fs/ext4/super.c +5 -12
@@ -2469,7 +2469,7 @@ static int parse_apply_sb_mount_options( struct ext4_fs_context *m_ctx) {struct ext4_sb_info *sbi =EXT4_SB (sb); -char *s_mount_opts =NULL ; +char s_mount_opts[65 ];struct ext4_fs_context *s_ctx =NULL ;struct fs_context *fc =NULL ;int ret = -ENOMEM ;
@@ -2477,15 +2477,11 @@ static int parse_apply_sb_mount_options(if (!sbi->s_es->s_mount_opts[0 ])return 0 ; - s_mount_opts =kstrndup (sbi->s_es->s_mount_opts, -sizeof (sbi->s_es->s_mount_opts), -GFP_KERNEL ); -if (!s_mount_opts) -return ret; +strscpy_pad (s_mount_opts, sbi->s_es->s_mount_opts); fc =kzalloc (sizeof (struct fs_context ),GFP_KERNEL );if (!fc) - goto out_free; +return -ENOMEM ; s_ctx =kzalloc (sizeof (struct ext4_fs_context ),GFP_KERNEL );if (!s_ctx)
@@ -2517,11 +2513,8 @@ parse_failed: ret =0 ; out_free: -if (fc) { -ext4_fc_free (fc); -kfree (fc); - } -kfree (s_mount_opts); +ext4_fc_free (fc); +kfree (fc);return ret; }
Greg Kroah-Hartman
maintainerPATCH 344/371 ext4: fix an off-by-one issue during moving extents
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
commit 12e803c8827d049ae8f2c743ef66ab87ae898375 upstream.
During the movement of a written extent, mext_page_mkuptodate() is called to read data in the range [from, to) into the page cache and to update the corresponding buffers. Therefore, we should not wait on any buffer whose start offset is >= 'to'. Otherwise, it will return -EIO and fail the extents movement.
$ for i in `seq 3 -1 0`; \ do xfs_io -fs -c "pwrite -b 1024 $((i * 1024)) 1024" /mnt/foo; \ done $ umount /mnt && mount /dev/pmem1s /mnt # drop cache $ e4defrag /mnt/foo e4defrag 1.47.0 (5-Feb-2023) ext4 defragmentation for /mnt/foo [1/1]/mnt/foo: 0% [ NG ] Success: [0/1]
Message-ID: <[email protected]>
--- fs/ext4/move_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/move_extent.c +1 -1
@@ -225,7 +225,7 @@ static int mext_page_mkuptodate(struct f do { if (bh_offset(bh) + blocksize <= from) continue; - if (bh_offset(bh) > to) + if (bh_offset(bh) >= to) break; wait_on_buffer(bh); if (buffer_uptodate(bh))
Greg Kroah-Hartman
maintainerPATCH 345/371 ext4: guard against EA inode refcount underflow in xattr update
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmet Eray Karadag <[email protected]>
commit 57295e835408d8d425bef58da5253465db3d6888 upstream.
syzkaller found a path where ext4_xattr_inode_update_ref() reads an EA inode refcount that is already <= 0 and then applies ref_change (often -1). That lets the refcount underflow and we proceed with a bogus value, triggering errors like:
EXT4-fs error: EA inode <n> ref underflow: ref_count=-1 ref_change=-1 EXT4-fs warning: ea_inode dec ref err=-117
Make the invariant explicit: if the current refcount is non-positive, treat this as on-disk corruption, emit ext4_error_inode(), and fail the operation with -EFSCORRUPTED instead of updating the refcount. Delete the WARN_ONCE() as negative refcounts are now impossible; keep error reporting in ext4_error_inode().
This prevents the underflow and the follow-on orphan/cleanup churn.
Message-ID: <[email protected]>
--- fs/ext4/xattr.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/ext4/xattr.c +8 -7
@@ -1019,7 +1019,7 @@ static int ext4_xattr_inode_update_ref(h int ref_change) {struct ext4_iloc iloc; -s64 ref_count; +u64 ref_count;int ret;inode_lock_nested (ea_inode,I_MUTEX_XATTR );
@@ -1029,13 +1029,17 @@ static int ext4_xattr_inode_update_ref(h goto out; ref_count =ext4_xattr_inode_get_ref (ea_inode); +if ((ref_count ==0 && ref_change <0 ) || (ref_count ==U64_MAX && ref_change >0 )) { +ext4_error_inode (ea_inode, __func__, __LINE__,0 , +"EA inode %lu ref wraparound: ref_count=%lld ref_change=%d" , + ea_inode->i_ino, ref_count, ref_change); + ret = -EFSCORRUPTED ; + goto out; + } ref_count += ref_change;ext4_xattr_inode_set_ref (ea_inode, ref_count);if (ref_change >0 ) { -WARN_ONCE (ref_count <=0 ,"EA inode %lu ref_count=%lld" , - ea_inode->i_ino, ref_count); -if (ref_count ==1 ) {WARN_ONCE (ea_inode->i_nlink,"EA inode %lu i_nlink=%u" , ea_inode->i_ino, ea_inode->i_nlink);
@@ -1044,9 +1048,6 @@ static int ext4_xattr_inode_update_ref(hext4_orphan_del (handle, ea_inode); } }else { -WARN_ONCE (ref_count <0 ,"EA inode %lu ref_count=%lld" , - ea_inode->i_ino, ref_count); -if (ref_count ==0 ) { WARN_ONCE(ea_inode->i_nlink != 1, "EA inode %lu i_nlink=%u",
Greg Kroah-Hartman
maintainerPATCH 346/371 ext4: validate ea_ino and size in check_xattrs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit 44d2a72f4d64655f906ba47a5e108733f59e6f28 upstream.
During xattr block validation, check_xattrs() processes xattr entries without validating that entries claiming to use EA inodes have non-zero sizes. Corrupted filesystems may contain xattr entries where e_value_size is zero but e_value_inum is non-zero, indicating invalid xattr data.
Add validation in check_xattrs() to detect this corruption pattern early and return -EFSCORRUPTED, preventing invalid xattr entries from causing issues throughout the ext4 codebase.
Message-ID: <[email protected]>
--- fs/ext4/xattr.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/xattr.c +4 -0
@@ -251,6 +251,10 @@ check_xattrs(struct inode *inode, struct err_str ="invalid ea_ino" ; goto errout; } +if (ea_ino && !size) { + err_str ="invalid size in ea xattr" ; + goto errout; + }if (size >EXT4_XATTR_SIZE_MAX ) { err_str ="e_value size too large" ; goto errout;
Greg Kroah-Hartman
maintainerPATCH 347/371 ACPICA: Allow to skip Global Lock initialization
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit feb8ae81b2378b75a99c81d315602ac8918ed382 upstream.
Introduce acpi_gbl_use_global_lock, which allows to skip the Global Lock initialization. This is useful for systems without Global Lock (such as loong_arch), so as to avoid error messages during boot phase:
ACPI Error: Could not enable global_lock event (20240827/evxfevnt-182) ACPI Error: No response from Global Lock hardware, disabling lock (20240827/evglock-59)
--- drivers/acpi/acpica/evglock.c | 4 ++++ include/acpi/acpixf.h | 6 ++++++ 2 files changed, 10 insertions(+)
drivers/acpi/acpica/evglock.c +4 -0
@@ -42,6 +42,10 @@ acpi_status acpi_ev_init_global_lock_hanreturn_ACPI_STATUS (AE_OK ); } +if (!acpi_gbl_use_global_lock) { +return_ACPI_STATUS (AE_OK ); + } +/* Attempt installation of the global lock handler */ status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
include/acpi/acpixf.h +6 -0
@@ -214,6 +214,12 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data,ACPI_INIT_GLOBAL (u8, acpi_gbl_reduced_hardware, FALSE);/* +* ACPI Global Lock is mainly used for systems with SMM, so no-SMM systems +* (such as loong_arch) may not have and not use Global Lock. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_use_global_lock, TRUE); + +/* * Maximum timeout for While() loop iterations before forced method abort. * This mechanism is intended to prevent infinite loops during interpreter * execution within a host kernel.
Greg Kroah-Hartman
maintainerPATCH 348/371 ext4: free orphan info with kvfree
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 971843c511c3c2f6eda96c6b03442913bfee6148 upstream.
Orphan info is now getting allocated with kvmalloc_array(). Free it with kvfree() instead of kfree() to avoid complaints from mm.
Message-ID: <[email protected]>
--- fs/ext4/orphan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/orphan.c +2 -2
@@ -513,7 +513,7 @@ void ext4_release_orphan_info(struct supreturn ;for (i =0 ; i < oi->of_blocks; i++)brelse (oi->of_binfo[i].ob_bh); -kfree (oi->of_binfo); +kvfree (oi->of_binfo); } static struct ext4_orphan_block_tail *ext4_orphan_block_tail(
@@ -637,7 +637,7 @@ int ext4_init_orphan_info(struct super_b out_free:for (i--; i >=0 ; i--)brelse (oi->of_binfo[i].ob_bh); -kfree (oi->of_binfo); +kvfree (oi->of_binfo); out_put:iput (inode);return ret;
Greg Kroah-Hartman
maintainerPATCH 349/371 ipmi: Fix handling of messages with provided receive message pointer
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit e2c69490dda5d4c9f1bfbb2898989c8f3530e354 upstream.
Prior to commit b52da4054ee0 ("ipmi: Rework user message limit handling"), i_ipmi_request() used to increase the user reference counter if the receive message is provided by the caller of IPMI API functions. This is no longer the case. However, ipmi_free_recv_msg() is still called and decreases the reference counter. This results in the reference counter reaching zero, the user data pointer is released, and all kinds of interesting crashes are seen.
Fix the problem by increasing user reference counter if the receive message has been provided by the caller.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ipmi_msghandler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_msghandler.c +4 -1
@@ -2280,8 +2280,11 @@ static int i_ipmi_request(struct ipmi_usif (supplied_recv) { recv_msg = supplied_recv; recv_msg->user = user; -if (user) +if (user) {atomic_inc (&user->nr_msgs); +/* The put happens when the message is freed. */ +kref_get (&user->refcount); + } }else { recv_msg =ipmi_alloc_recv_msg (user);if (IS_ERR (recv_msg))
Greg Kroah-Hartman
maintainerPATCH 350/371 Squashfs: add additional inode sanity checking
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phillip Lougher <[email protected]>
[ Upstream commit 9ee94bfbe930a1b39df53fa2d7b31141b780eb5a ]
Patch series "Squashfs: performance improvement and a sanity check".
This patchset adds an additional sanity check when reading regular file inodes, and adds support for SEEK_DATA/SEEK_HOLE lseek() whence values.
This patch (of 2):
Add an additional sanity check when reading regular file inodes.
A regular file if the file size is an exact multiple of the filesystem block size cannot have a fragment. This is because by definition a fragment block stores tailends which are not a whole block in size.
Stable-dep-of: 9f1c14c1de1b ("Squashfs: reject negative file sizes in squashfs_read_inode()")
--- fs/squashfs/inode.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/squashfs/inode.c +18 -2
@@ -140,8 +140,17 @@ int squashfs_read_inode(struct inode *inif (err <0 ) goto failed_read; + inode->i_size =le32_to_cpu (sqsh_ino->file_size); frag =le32_to_cpu (sqsh_ino->fragment);if (frag !=SQUASHFS_INVALID_FRAG ) { +/* +* the file cannot have a fragment (tailend) and have a +* file size a multiple of the block size +*/ +if ((inode->i_size & (msblk->block_size -1 )) ==0 ) { + err = -EINVAL ; + goto failed_read; + } frag_offset =le32_to_cpu (sqsh_ino->offset); frag_size =squashfs_frag_lookup (sb, frag, &frag_blk);if (frag_size <0 ) {
@@ -155,7 +164,6 @@ int squashfs_read_inode(struct inode *in }set_nlink (inode,1 ); - inode->i_size =le32_to_cpu (sqsh_ino->file_size); inode->i_fop = &generic_ro_fops; inode->i_mode |=S_IFREG ; inode->i_blocks = ((inode->i_size -1 ) >>9 ) +1 ;
@@ -184,8 +192,17 @@ int squashfs_read_inode(struct inode *inif (err <0 ) goto failed_read; + inode->i_size =le64_to_cpu (sqsh_ino->file_size); frag =le32_to_cpu (sqsh_ino->fragment);if (frag !=SQUASHFS_INVALID_FRAG ) { +/* +* the file cannot have a fragment (tailend) and have a +* file size a multiple of the block size +*/ +if ((inode->i_size & (msblk->block_size -1 )) ==0 ) { + err = -EINVAL ; + goto failed_read; + } frag_offset =le32_to_cpu (sqsh_ino->offset); frag_size =squashfs_frag_lookup (sb, frag, &frag_blk);if (frag_size <0 ) {
@@ -200,7 +217,6 @@ int squashfs_read_inode(struct inode *in xattr_id =le32_to_cpu (sqsh_ino->xattr);set_nlink (inode,le32_to_cpu (sqsh_ino->nlink)); - inode->i_size =le64_to_cpu (sqsh_ino->file_size); inode->i_op = &squashfs_inode_ops; inode->i_fop = &generic_ro_fops; inode->i_mode |=S_IFREG ;
Greg Kroah-Hartman
maintainerPATCH 351/371 Squashfs: reject negative file sizes in squashfs_read_inode()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phillip Lougher <[email protected]>
[ Upstream commit 9f1c14c1de1bdde395f6cc893efa4f80a2ae3b2b ]
Syskaller reports a "WARNING in ovl_copy_up_file" in overlayfs.
This warning is ultimately caused because the underlying Squashfs file system returns a file with a negative file size.
This commit checks for a negative file size and returns EINVAL.
--- fs/squashfs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/squashfs/inode.c +4 -0
@@ -193,6 +193,10 @@ int squashfs_read_inode(struct inode *in goto failed_read; inode->i_size =le64_to_cpu (sqsh_ino->file_size); +if (inode->i_size <0 ) { + err = -EINVAL ; + goto failed_read; + } frag =le32_to_cpu (sqsh_ino->fragment);if (frag !=SQUASHFS_INVALID_FRAG ) {/*
Greg Kroah-Hartman
maintainerPATCH 352/371 mm/ksm: fix incorrect KSM counter handling in mm_struct during fork
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donet Tom <[email protected]>
[ Upstream commit 4d6fc29f36341d7795db1d1819b4c15fe9be7b23 ]
Patch series "mm/ksm: Fix incorrect accounting of KSM counters during fork", v3.
The first patch in this series fixes the incorrect accounting of KSM counters such as ksm_merging_pages, ksm_rmap_items, and the global ksm_zero_pages during fork.
The following patch add a selftest to verify the ksm_merging_pages counter was updated correctly during fork.
Test Results
============
Without the first patch
-----------------------
# [RUN] test_fork_ksm_merging_page_count
not ok 10 ksm_merging_page in child: 32
With the first patch
--------------------
# [RUN] test_fork_ksm_merging_page_count
ok 10 ksm_merging_pages is not inherited after fork
This patch (of 2):
Currently, the KSM-related counters in mm_struct, such as ksm_merging_pages, ksm_rmap_items, and ksm_zero_pages, are inherited by the child process during fork. This results in inconsistent accounting.
When a process uses KSM, identical pages are merged and an rmap item is created for each merged page. The ksm_merging_pages and ksm_rmap_items counters are updated accordingly. However, after a fork, these counters are copied to the child while the corresponding rmap items are not. As a result, when the child later triggers an unmerge, there are no rmap items present in the child, so the counters remain stale, leading to incorrect accounting.
A similar issue exists with ksm_zero_pages, which maintains both a global counter and a per-process counter. During fork, the per-process counter is inherited by the child, but the global counter is not incremented. Since the child also references zero pages, the global counter should be updated as well. Otherwise, during zero-page unmerge, both the global and per-process counters are decremented, causing the global counter to become inconsistent.
To fix this, ksm_merging_pages and ksm_rmap_items are reset to 0 during fork, and the global ksm_zero_pages counter is updated with the per-process ksm_zero_pages value inherited by the child. This ensures that KSM statistics remain accurate and reflect the activity of each process correctly.
--- include/linux/ksm.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/ksm.h +7 -1
@@ -56,8 +56,14 @@ static inline long mm_ksm_zero_pages(strstatic inline void ksm_fork (struct mm_struct *mm,struct mm_struct *oldmm) {/* Adding mm to ksm is best effort on fork. */ -if (test_bit (MMF_VM_MERGEABLE , &oldmm->flags)) +if (test_bit (MMF_VM_MERGEABLE , &oldmm->flags)) { +long nr_ksm_zero_pages =atomic_long_read (&mm->ksm_zero_pages); + + mm->ksm_merging_pages =0 ; + mm->ksm_rmap_items =0 ; +atomic_long_add (nr_ksm_zero_pages, &ksm_zero_pages);__ksm_enter (mm); + } }static inline int ksm_execve (struct mm_struct *mm)
Greg Kroah-Hartman
maintainerPATCH 353/371 media: mc: Clear minor number before put device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 8cfc8cec1b4da88a47c243a11f384baefd092a50 ]
The device minor should not be cleared after the device is released.
--- drivers/media/mc/mc-devnode.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/mc/mc-devnode.c +1 -5
@@ -50,11 +50,6 @@ static void media_devnode_release(struct {struct media_devnode *devnode =to_media_devnode (cd); -mutex_lock (&media_devnode_lock); -/* Mark device node number as free */ -clear_bit (devnode->minor, media_devnode_nums); -mutex_unlock (&media_devnode_lock); -/* Release media_devnode and perform other cleanups as needed. */ if (devnode->release) devnode->release (devnode);
@@ -281,6 +276,7 @@ void media_devnode_unregister(struct med/* Delete the cdev on this minor as well */ cdev_device_del (&devnode->cdev, &devnode->dev); devnode->media_dev =NULL ; +clear_bit (devnode->minor, media_devnode_nums);mutex_unlock (&media_devnode_lock);put_device (&devnode->dev);
Greg Kroah-Hartman
maintainerPATCH 354/371 arm64: dts: qcom: qcs615: add missing dt property in QUP SEs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viken Dadhaniya <[email protected]>
[ Upstream commit 6a5e9b9738a32229e2673d4eccfcbfe2ef3a1ab4 ]
Add the missing required-opps and operating-points-v2 properties to several I2C, SPI, and UART nodes in the QUP SEs.
--- arch/arm64/boot/dts/qcom/qcs615.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/qcs615.dtsi +6 -0
@@ -631,6 +631,7 @@ interconnect-names = "qup-core", "qup-config"; power-domains = <&rpmhpd RPMHPD_CX>; + operating-points-v2 = <&qup_opp_table>; status = "disabled"; };
@@ -654,6 +655,7 @@ "qup-config", "qup-memory"; power-domains = <&rpmhpd RPMHPD_CX>; + required-opps = <&rpmhpd_opp_low_svs>; dmas = <&gpi_dma0 0 1 QCOM_GPI_I2C>, <&gpi_dma0 1 1 QCOM_GPI_I2C>; dma-names = "tx",
@@ -681,6 +683,7 @@ "qup-config", "qup-memory"; power-domains = <&rpmhpd RPMHPD_CX>; + required-opps = <&rpmhpd_opp_low_svs>; dmas = <&gpi_dma0 0 2 QCOM_GPI_I2C>, <&gpi_dma0 1 2 QCOM_GPI_I2C>; dma-names = "tx",
@@ -703,6 +706,7 @@ interconnect-names = "qup-core", "qup-config"; power-domains = <&rpmhpd RPMHPD_CX>; + operating-points-v2 = <&qup_opp_table>; dmas = <&gpi_dma0 0 2 QCOM_GPI_SPI>, <&gpi_dma0 1 2 QCOM_GPI_SPI>; dma-names = "tx",
@@ -728,6 +732,7 @@ interconnect-names = "qup-core", "qup-config"; power-domains = <&rpmhpd RPMHPD_CX>; + operating-points-v2 = <&qup_opp_table>; status = "disabled"; };
@@ -751,6 +756,7 @@ "qup-config", "qup-memory"; power-domains = <&rpmhpd RPMHPD_CX>; + required-opps = <&rpmhpd_opp_low_svs>; dmas = <&gpi_dma0 0 3 QCOM_GPI_I2C>, <&gpi_dma0 1 3 QCOM_GPI_I2C>; dma-names = "tx",
Greg Kroah-Hartman
maintainerPATCH 355/371 ACPI: property: Disregard references in data-only subnode lists
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit d06118fe9b03426484980ed4c189a8c7b99fa631 ]
Data-only subnode links following the ACPI data subnode GUID in a _DSD package are expected to point to named objects returning _DSD-equivalent packages. If a reference to such an object is used in the target field of any of those links, that object will be evaluated in place (as a named object) and its return data will be embedded in the outer _DSD package.
For this reason, it is not expected to see a subnode link with the target field containing a local reference (that would mean pointing to a device or another object that cannot be evaluated in place and therefore cannot return a _DSD-equivalent package).
Accordingly, simplify the code parsing data-only subnode links to simply print a message when it encounters a local reference in the target field of one of those links.
Moreover, since acpi_nondev_subnode_data_ok() would only have one caller after the change above, fold it into that caller.
Stable-dep-of: baf60d5cb8bc ("ACPI: property: Do not pass NULL handles to acpi_attach_data()")
--- drivers/acpi/property.c | 51 ++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 29 deletions(-)
drivers/acpi/property.c +22 -29
@@ -124,32 +124,12 @@ static bool acpi_nondev_subnode_extract(return false; } -static bool acpi_nondev_subnode_data_ok (acpi_handle handle, -const union acpi_object *link, -struct list_head *list, -struct fwnode_handle *parent) -{ -struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER }; -acpi_status status; - - status =acpi_evaluate_object_typed (handle,NULL ,NULL , &buf, -ACPI_TYPE_PACKAGE ); -if (ACPI_FAILURE (status)) -return false; - -if (acpi_nondev_subnode_extract (buf.pointer, handle, link, list, - parent)) -return true; - -ACPI_FREE (buf.pointer); -return false; -} -static bool acpi_nondev_subnode_ok (acpi_handle scope,const union acpi_object *link,struct list_head *list,struct fwnode_handle *parent) { +struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER };acpi_handle handle;acpi_status status;
@@ -161,7 +141,17 @@ static bool acpi_nondev_subnode_ok(acpi_if (ACPI_FAILURE (status))return false; -return acpi_nondev_subnode_data_ok (handle, link, list, parent); + status =acpi_evaluate_object_typed (handle,NULL ,NULL , &buf, +ACPI_TYPE_PACKAGE ); +if (ACPI_FAILURE (status)) +return false; + +if (acpi_nondev_subnode_extract (buf.pointer, handle, link, list, + parent)) +return true; + +ACPI_FREE (buf.pointer); +return false; } static bool acpi_add_nondev_subnodes(acpi_handle scope,
@@ -174,7 +164,6 @@ static bool acpi_add_nondev_subnodes(acpfor (i =0 ; i < links->package.count; i++) {union acpi_object *link, *desc; -acpi_handle handle;bool result; link = &links->package.elements[i];
@@ -186,22 +175,26 @@ static bool acpi_add_nondev_subnodes(acpif (link->package.elements[0 ].type !=ACPI_TYPE_STRING )continue ; -/* The second one may be a string, a reference or a package. */ +/* The second one may be a string or a package. */ switch (link->package.elements[1 ].type) {case ACPI_TYPE_STRING : result =acpi_nondev_subnode_ok (scope, link, list, parent);break ; -case ACPI_TYPE_LOCAL_REFERENCE : - handle = link->package.elements[1 ].reference.handle; - result =acpi_nondev_subnode_data_ok (handle, link, list, - parent); -break ;case ACPI_TYPE_PACKAGE : desc = &link->package.elements[1 ]; result =acpi_nondev_subnode_extract (desc,NULL , link, list, parent);break ; +case ACPI_TYPE_LOCAL_REFERENCE : +/* +* It is not expected to see any local references in +* the links package because referencing a named object +* should cause it to be evaluated in place. +*/ +acpi_handle_info (scope,"subnode %s: Unexpected reference\n" , + link->package.elements[0 ].string.pointer); + fallthrough;default : result = false;break ;
Greg Kroah-Hartman
maintainerPATCH 356/371 ACPI: property: Add code comments explaining what is going on
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 737c3a09dcf69ba2814f3674947ccaec1861c985 ]
In some places in the ACPI device properties handling code, it is unclear why the code is what it is. Some assumptions are not documented and some pieces of code are based on knowledge that is not mentioned anywhere.
Add code comments explaining these things.
Stable-dep-of: baf60d5cb8bc ("ACPI: property: Do not pass NULL handles to acpi_attach_data()")
--- drivers/acpi/property.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-)
drivers/acpi/property.c +44 -2
@@ -108,7 +108,18 @@ static bool acpi_nondev_subnode_extract(if (handle)acpi_get_parent (handle, &scope); +/* +* Extract properties from the _DSD-equivalent package pointed to by +* desc and use scope (if not NULL) for the completion of relative +* pathname segments. +* +* The extracted properties will be held in the new data node dn. +*/ result =acpi_extract_properties (scope, desc, &dn->data); +/* +* Look for subnodes in the _DSD-equivalent package pointed to by desc +* and create child nodes of dn if there are any. +*/ if (acpi_enumerate_nondev_subnodes (scope, desc, &dn->data, &dn->fwnode)) result = true;
@@ -133,6 +144,12 @@ static bool acpi_nondev_subnode_ok(acpi_acpi_handle handle;acpi_status status; +/* +* If the scope is unknown, the _DSD-equivalent package being parsed +* was embedded in an outer _DSD-equivalent package as a result of +* direct evaluation of an object pointed to by a reference. In that +* case, using a pathname as the target object pointer is invalid. +*/ if (!scope)return false;
@@ -162,6 +179,10 @@ static bool acpi_add_nondev_subnodes(acpbool ret = false;int i; +/* +* Every element in the links package is expected to represent a link +* to a non-device node in a tree containing device-specific data. +*/ for (i =0 ; i < links->package.count; i++) {union acpi_object *link, *desc;bool result;
@@ -171,17 +192,38 @@ static bool acpi_add_nondev_subnodes(acpif (link->package.count !=2 )continue ; -/* The first one must be a string. */ +/* The first one (the key) must be a string. */ if (link->package.elements[0 ].type !=ACPI_TYPE_STRING )continue ; -/* The second one may be a string or a package. */ +/* The second one (the target) may be a string or a package. */ switch (link->package.elements[1 ].type) {case ACPI_TYPE_STRING : +/* +* The string is expected to be a full pathname or a +* pathname segment relative to the given scope. That +* pathname is expected to point to an object returning +* a package that contains _DSD-equivalent information. +*/ result =acpi_nondev_subnode_ok (scope, link, list, parent);break ;case ACPI_TYPE_PACKAGE : +/* +* This happens when a reference is used in AML to +* point to the target. Since the target is expected +* to be a named object, a reference to it will cause it +* to be avaluated in place and its return package will +* be embedded in the links package at the location of +* the reference. +* +* The target package is expected to contain _DSD- +* equivalent information, but the scope in which it +* is located in the original AML is unknown. Thus +* it cannot contain pathname segments represented as +* strings because there is no way to build full +* pathnames out of them. +*/ desc = &link->package.elements[1 ]; result =acpi_nondev_subnode_extract (desc,NULL , link, list, parent);
Greg Kroah-Hartman
maintainerPATCH 357/371 ACPI: property: Do not pass NULL handles to acpi_attach_data()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit baf60d5cb8bc6b85511c5df5f0ad7620bb66d23c ]
In certain circumstances, the ACPI handle of a data-only node may be NULL, in which case it does not make sense to attempt to attach that node to an ACPI namespace object, so update the code to avoid attempts to do so.
This prevents confusing and unuseful error messages from being printed.
Also document the fact that the ACPI handle of a data-only node may be NULL and when that happens in a code comment. In addition, make acpi_add_nondev_subnodes() print a diagnostic message for each data-only node with an unknown ACPI namespace scope.
--- drivers/acpi/property.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/property.c +12 -0
@@ -124,6 +124,10 @@ static bool acpi_nondev_subnode_extract( result = true;if (result) { +/* +* This will be NULL if the desc package is embedded in an outer +* _DSD-equivalent package and its scope cannot be determined. +*/ dn->handle = handle; dn->data.pointer = desc;list_add_tail (&dn->sibling, list);
@@ -224,6 +228,8 @@ static bool acpi_add_nondev_subnodes(acp* strings because there is no way to build full * pathnames out of them. */ +acpi_handle_debug (scope,"subnode %s: Unknown scope\n" , + link->package.elements[0 ].string.pointer); desc = &link->package.elements[1 ]; result =acpi_nondev_subnode_extract (desc,NULL , link, list, parent);
@@ -396,6 +402,9 @@ static void acpi_untie_nondev_subnodes(sstruct acpi_data_node *dn;list_for_each_entry (dn, &data->subnodes, sibling) { +if (!dn->handle) +continue ; +acpi_detach_data (dn->handle, acpi_nondev_subnode_tag);acpi_untie_nondev_subnodes (&dn->data);
@@ -410,6 +419,9 @@ static bool acpi_tie_nondev_subnodes(stracpi_status status;bool ret; +if (!dn->handle) +continue ; + status =acpi_attach_data (dn->handle, acpi_nondev_subnode_tag, dn);if (ACPI_FAILURE (status) && status !=AE_ALREADY_EXISTS ) {acpi_handle_err (dn->handle,"Can't tag data node\n" );
Greg Kroah-Hartman
maintainerPATCH 358/371 irqchip/sifive-plic: Avoid interrupt ID 0 handling during suspend/resume
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Zampieri <[email protected]>
[ Upstream commit f75e07bf5226da640fa99a0594687c780d9bace4 ]
According to the PLIC specification[1], global interrupt sources are assigned small unsigned integer identifiers beginning at the value 1. An interrupt ID of 0 is reserved to mean "no interrupt".
The current plic_irq_resume() and plic_irq_suspend() functions incorrectly start the loop from index 0, which accesses the register space for the reserved interrupt ID 0.
Change the loop to start from index 1, skipping the reserved interrupt ID 0 as per the PLIC specification.
This prevents potential undefined behavior when accessing the reserved register space during suspend/resume cycles.
--- drivers/irqchip/irq-sifive-plic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +4 -2
@@ -252,7 +252,8 @@ static int plic_irq_suspend(void) priv =per_cpu_ptr (&plic_handlers,smp_processor_id ())->priv; -for (i =0 ; i < priv->nr_irqs; i++) { +/* irq ID 0 is reserved */ +for (i =1 ; i < priv->nr_irqs; i++) {__assign_bit (i, priv->prio_save,readl (priv->regs +PRIORITY_BASE + i *PRIORITY_PER_ID )); }
@@ -283,7 +284,8 @@ static void plic_irq_resume(void) priv =per_cpu_ptr (&plic_handlers,smp_processor_id ())->priv; -for (i =0 ; i < priv->nr_irqs; i++) { +/* irq ID 0 is reserved */ +for (i =1 ; i < priv->nr_irqs; i++) { index =BIT_WORD (i);writel ((priv->prio_save[index] &BIT_MASK (i)) ?1 :0 , priv->regs +PRIORITY_BASE + i *PRIORITY_PER_ID );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 359/371 copy_file_range: limit size if in compat mode
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit f8f59a2c05dc16d19432e3154a9ac7bc385f4b92 ]
If the process runs in 32-bit compat mode, copy_file_range results can be in the in-band error range. In this case limit copy length to MAX_RW_COUNT to prevent a signed overflow.
--- fs/read_write.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/read_write.c +9 -5
@@ -1576,6 +1576,13 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,if (len ==0 )return 0 ; +/* +* Make sure return value doesn't overflow in 32bit compat mode. Also +* limit the size for all cases except when calling ->copy_file_range(). +*/ +if (splice || !file_out->f_op->copy_file_range ||in_compat_syscall ()) + len =min_t (size_t,MAX_RW_COUNT , len); +file_start_write (file_out);/*
@@ -1589,9 +1596,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in, len, flags); }else if (!splice && file_in->f_op->remap_file_range && samesb) { ret = file_in->f_op->remap_file_range (file_in, pos_in, - file_out, pos_out, -min_t (loff_t,MAX_RW_COUNT , len), -REMAP_FILE_CAN_SHORTEN ); + file_out, pos_out, len,REMAP_FILE_CAN_SHORTEN );/* fallback to splice */ if (ret <=0 ) splice = true;
@@ -1624,8 +1629,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,* to splicing from input file, while file_start_write() is held on * the output file on a different sb. */ - ret =do_splice_direct (file_in, &pos_in, file_out, &pos_out, -min_t (size_t, len,MAX_RW_COUNT ),0 ); + ret =do_splice_direct (file_in, &pos_in, file_out, &pos_out, len,0 ); done:if (ret >0 ) {fsnotify_access (file_in);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 360/371 minixfs: Verify inode mode when loading from disk
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 73861970938ad1323eb02bbbc87f6fbd1e5bacca ]
The inode mode loaded from corrupted disk can be invalid. Do like what commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk") does.
--- fs/minix/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/minix/inode.c +7 -1
@@ -492,8 +492,14 @@ void minix_set_inode(struct inode *inode, dev_t rdev) inode->i_op = &minix_symlink_inode_operations;inode_nohighmem (inode); inode->i_mapping->a_ops = &minix_aops; - }else + }else if (S_ISCHR (inode->i_mode) ||S_ISBLK (inode->i_mode) || +S_ISFIFO (inode->i_mode) ||S_ISSOCK (inode->i_mode)) {init_special_inode (inode, inode->i_mode, rdev); + }else { +printk (KERN_DEBUG "MINIX-fs: Invalid file type 0%04o for inode %lu.\n" , + inode->i_mode, inode->i_ino); +make_bad_inode (inode); + } }/*
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 361/371 pid: Add a judgment for ns null in pid_nr_ns
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: gaoxiang17 <[email protected]>
[ Upstream commit 006568ab4c5ca2309ceb36fa553e390b4aa9c0c7 ]
__task_pid_nr_ns
ns = task_active_pid_ns(current);
pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
if (pid && ns->level <= pid->level) {Sometimes null is returned for task_active_pid_ns. Then it will trigger kernel panic in pid_nr_ns.
For example:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058 Mem abort info: ESR = 0x0000000096000007 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x07: level 3 translation fault Data abort info: ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 39-bit VAs, pgdp=00000002175aa000 [0000000000000058] pgd=08000002175ab003, p4d=08000002175ab003, pud=08000002175ab003, pmd=08000002175be003, pte=0000000000000000 pstate: 834000c5 (Nzcv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __task_pid_nr_ns+0x74/0xd0 lr : __task_pid_nr_ns+0x24/0xd0 sp : ffffffc08001bd10 x29: ffffffc08001bd10 x28: ffffffd4422b2000 x27: 0000000000000001 x26: ffffffd442821168 x25: ffffffd442821000 x24: 00000f89492eab31 x23: 00000000000000c0 x22: ffffff806f5693c0 x21: ffffff806f5693c0 x20: 0000000000000001 x19: 0000000000000000 x18: 0000000000000000 x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 00000000023a1adc x14: 0000000000000003 x13: 00000000007ef6d8 x12: 001167c391c78800 x11: 00ffffffffffffff x10: 0000000000000000 x9 : 0000000000000001 x8 : ffffff80816fa3c0 x7 : 0000000000000000 x6 : 49534d702d535449 x5 : ffffffc080c4c2c0 x4 : ffffffd43ee128c8 x3 : ffffffd43ee124dc x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffffff806f5693c0 Call trace: __task_pid_nr_ns+0x74/0xd0 ... __handle_irq_event_percpu+0xd4/0x284 handle_irq_event+0x48/0xb0 handle_fasteoi_irq+0x160/0x2d8 generic_handle_domain_irq+0x44/0x60 gic_handle_irq+0x4c/0x114 call_on_irq_stack+0x3c/0x74 do_interrupt_handler+0x4c/0x84 el1_interrupt+0x34/0x58 el1h_64_irq_handler+0x18/0x24 el1h_64_irq+0x68/0x6c account_kernel_stack+0x60/0x144 exit_task_stack_account+0x1c/0x80 do_exit+0x7e4/0xaf8 ... get_signal+0x7bc/0x8d8 do_notify_resume+0x128/0x828 el0_svc+0x6c/0x70 el0t_64_sync_handler+0x68/0xbc el0t_64_sync+0x1a8/0x1ac Code: 35fffe54 911a02a8 f9400108 b4000128 (b9405a69) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Oops: Fatal exception in interrupt
--- kernel/pid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/pid.c +1 -1
@@ -491,7 +491,7 @@ pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)struct upid *upid;pid_t nr =0 ; -if (pid && ns->level <= pid->level) { +if (pid && ns && ns->level <= pid->level) { upid = &pid->numbers[ns->level];if (upid->ns == ns) nr = upid->nr;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 362/371 pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit abdfd4948e45c51b19162cf8b3f5003f8f53c9b9 ]
task_pid_vnr(another_task) will crash if the caller was already reaped. The pid_alive(current) check can't really help, the parent/debugger can call release_task() right after this check.
This also means that even task_ppid_nr_ns(current, NULL) is not safe, pid_alive() only ensures that it is safe to dereference ->real_parent.
Change __task_pid_nr_ns() to ensure ns != NULL.
--- kernel/pid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/pid.c +2 -1
@@ -514,7 +514,8 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,rcu_read_lock ();if (!ns) ns =task_active_pid_ns (current); - nr =pid_nr_ns (rcu_dereference (*task_pid_ptr (task, type)), ns); +if (ns) + nr =pid_nr_ns (rcu_dereference (*task_pid_ptr (task, type)), ns);rcu_read_unlock ();return nr;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 363/371 fs: Add initramfs_options to set initramfs mount options
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lichen Liu <[email protected]>
[ Upstream commit 278033a225e13ec21900f0a92b8351658f5377f2 ]
When CONFIG_TMPFS is enabled, the initial root filesystem is a tmpfs. By default, a tmpfs mount is limited to using 50% of the available RAM for its content. This can be problematic in memory-constrained environments, particularly during a kdump capture.
In a kdump scenario, the capture kernel boots with a limited amount of memory specified by the 'crashkernel' parameter. If the initramfs is large, it may fail to unpack into the tmpfs rootfs due to insufficient space. This is because to get X MB of usable space in tmpfs, 2*X MB of memory must be available for the mount. This leads to an OOM failure during the early boot process, preventing a successful crash dump.
This patch introduces a new kernel command-line parameter, initramfs_options, which allows passing specific mount options directly to the rootfs when it is first mounted. This gives users control over the rootfs behavior.
For example, a user can now specify initramfs_options=size=75% to allow the tmpfs to use up to 75% of the available memory. This can significantly reduce the memory pressure for kdump.
Consider a practical example:
To unpack a 48MB initramfs, the tmpfs needs 48MB of usable space. With the default 50% limit, this requires a memory pool of 96MB to be available for the tmpfs mount. The total memory requirement is therefore
approximately: 16MB (vmlinuz) + 48MB (loaded initramfs) + 48MB (unpacked kernel) + 96MB (for tmpfs) + 12MB (runtime overhead) ≈ 220MB.
By using initramfs_options=size=75%, the memory pool required for the 48MB tmpfs is reduced to 48MB / 0.75 = 64MB. This reduces the total memory requirement by 32MB (96MB - 64MB), allowing the kdump to succeed with a smaller crashkernel size, such as 192MB.
An alternative approach of reusing the existing rootflags parameter was considered. However, a new, dedicated initramfs_options parameter was chosen to avoid altering the current behavior of rootflags (which applies to the final root filesystem) and to prevent any potential regressions.
Also add documentation for the new kernel parameter "initramfs_options"
This approach is inspired by prior discussions and patches on the topic.
Ref: https://www.lightofdawn.org/blog/?viewDetailed=00128
Ref: https://landley.net/notes-2015.html#01-01-2015
Ref: https://lkml.org/lkml/2021/6/29/783
Ref: https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html#what-is-rootfs
--- Documentation/admin-guide/kernel-parameters.txt | 3 +++ fs/namespace.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +3 -0
@@ -6429,6 +6429,9 @@ rootflags= [KNL] Set root filesystem mount option string + initramfs_options= [KNL] + Specify mount options for for the initramfs mount. + rootfstype= [KNL] Set root filesystem type rootwait [KNL] Wait (indefinitely) for root device to show up.
fs/namespace.c +10 -1
@@ -65,6 +65,15 @@ static int __init set_mphash_entries(char *str) }__setup ("mphash_entries=" , set_mphash_entries); +static char *__initdata initramfs_options; +static int __init initramfs_options_setup (char *str) +{ + initramfs_options = str; +return 1 ; +} + +__setup ("initramfs_options=" , initramfs_options_setup); +static u64 event; static DEFINE_XARRAY_FLAGS(mnt_id_xa, XA_FLAGS_ALLOC);static DEFINE_IDA (mnt_group_ida);
@@ -6127,7 +6136,7 @@ static void __init init_mount_tree(void)struct mnt_namespace *ns;struct path root; - mnt =vfs_kern_mount (&rootfs_fs_type,0 ,"rootfs" ,NULL ); + mnt =vfs_kern_mount (&rootfs_fs_type,0 ,"rootfs" , initramfs_options);if (IS_ERR (mnt))panic ("Can't create rootfs" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 364/371 cramfs: Verify inode mode when loading from disk
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 7f9d34b0a7cb93d678ee7207f0634dbf79e47fe5 ]
The inode mode loaded from corrupted disk can be invalid. Do like what commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk") does.
--- fs/cramfs/inode.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/cramfs/inode.c +10 -1
@@ -116,9 +116,18 @@ static struct inode *get_cramfs_inode(struct super_block *sb,inode_nohighmem (inode); inode->i_data.a_ops = &cramfs_aops;break ; -default : +case S_IFCHR : +case S_IFBLK : +case S_IFIFO : +case S_IFSOCK :init_special_inode (inode, cramfs_inode->mode,old_decode_dev (cramfs_inode->size)); +break ; +default : +printk (KERN_DEBUG "CRAMFS: Invalid file type 0%04o for inode %lu.\n" , + inode->i_mode, inode->i_ino); +iget_failed (inode); +return ERR_PTR (-EIO ); } inode->i_mode = cramfs_inode->mode;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 365/371 nsfs: validate extensible ioctls
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit f8527a29f4619f74bc30a9845ea87abb9a6faa1e ]
Validate extensible ioctls stricter than we do now.
--- fs/nsfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nsfs.c +3 -1
@@ -169,9 +169,11 @@ static bool nsfs_ioctl_valid(unsigned int cmd)/* Extensible ioctls require some extra handling. */ switch (_IOC_NR (cmd)) {case _IOC_NR (NS_MNT_GET_INFO ): +return extensible_ioctl_valid (cmd,NS_MNT_GET_INFO ,MNT_NS_INFO_SIZE_VER0 );case _IOC_NR (NS_MNT_GET_NEXT ): +return extensible_ioctl_valid (cmd,NS_MNT_GET_NEXT ,MNT_NS_INFO_SIZE_VER0 );case _IOC_NR (NS_MNT_GET_PREV ): -return (_IOC_TYPE (cmd) ==_IOC_TYPE (cmd)); +return extensible_ioctl_valid (cmd,NS_MNT_GET_PREV ,MNT_NS_INFO_SIZE_VER0 ); }return false;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 366/371 mnt_ns_tree_remove(): DTRT if mnt_ns had never been added to mnt_ns_list
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 38f4885088fc5ad41b8b0a2a2cfc73d01e709e5c ]
Actual removal is done under the lock, but for checking if need to bother the lockless RB_EMPTY_NODE() is safe - either that namespace had never been added to mnt_ns_tree, in which case the the node will stay empty, or whoever had allocated it has called mnt_ns_tree_add() and it has already run to completion. After that point RB_EMPTY_NODE() will become false and will remain false, no matter what we do with other nodes in the tree.
--- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
@@ -196,7 +196,7 @@ static void mnt_ns_release_rcu(struct rcu_head *rcu)static void mnt_ns_tree_remove (struct mnt_namespace *ns) {/* remove from global mount namespace list */ -if (!is_anon_ns (ns)) { +if (!RB_EMPTY_NODE (&ns->mnt_ns_tree_node)) {mnt_ns_tree_write_lock ();rb_erase (&ns->mnt_ns_tree_node, &mnt_ns_tree);list_bidir_del_rcu (&ns->mnt_ns_list);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 367/371 writeback: Avoid softlockup when switching many inodes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 66c14dccd810d42ec5c73bb8a9177489dfd62278 ]
process_inode_switch_wbs_work() can be switching over 100 inodes to a different cgroup. Since switching an inode requires counting all dirty & under-writeback pages in the address space of each inode, this can take a significant amount of time. Add a possibility to reschedule after processing each inode to avoid softlockups.
--- fs/fs-writeback.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/fs-writeback.c +10 -1
@@ -502,6 +502,7 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)*/ down_read (&bdi->wb_switch_rwsem); + inodep = isw->inodes;/* * By the time control reaches here, RCU grace period has passed * since I_WB_SWITCH assertion and all wb stat update transactions
@@ -512,6 +513,7 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)* gives us exclusion against all wb related operations on @inode * including IO list manipulations and stat updates. */ +relock:if (old_wb < new_wb) {spin_lock (&old_wb->list_lock);spin_lock_nested (&new_wb->list_lock,SINGLE_DEPTH_NESTING );
@@ -520,10 +522,17 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)spin_lock_nested (&old_wb->list_lock,SINGLE_DEPTH_NESTING ); } -for (inodep = isw->inodes; *inodep; inodep++) { +while (*inodep) {WARN_ON_ONCE ((*inodep)->i_wb != old_wb);if (inode_do_switch_wbs (*inodep, old_wb, new_wb)) nr_switched++; + inodep++; +if (*inodep &&need_resched ()) { +spin_unlock (&new_wb->list_lock); +spin_unlock (&old_wb->list_lock); +cond_resched (); + goto relock; + } }spin_unlock (&new_wb->list_lock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 368/371 writeback: Avoid excessively long inode switching times
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 9a6ebbdbd41235ea3bc0c4f39e2076599b8113cc ]
With lazytime mount option enabled we can be switching many dirty inodes on cgroup exit to the parent cgroup. The numbers observed in practice when systemd slice of a large cron job exits can easily reach hundreds of thousands or millions. The logic in inode_do_switch_wbs() which sorts the inode into appropriate place in b_dirty list of the target wb however has linear complexity in the number of dirty inodes thus overall time complexity of switching all the inodes is quadratic leading to workers being pegged for hours consuming 100% of the CPU and switching inodes to the parent wb.
Simple reproducer of the issue:
FILES=10000
# Filesystem mounted with lazytime mount option
MNT=/mnt/
echo "Creating files and switching timestamps"
for (( j = 0; j < 50; j ++ )); do
mkdir $MNT/dir$j
for (( i = 0; i < $FILES; i++ )); do
echo "foo" >$MNT/dir$j/file$i
done
touch -a -t 202501010000 $MNT/dir$j/file* done
wait
echo "Syncing and flushing"
sync
echo 3 >/proc/sys/vm/drop_caches
echo "Reading all files from a cgroup"
mkdir /sys/fs/cgroup/unified/mycg1 || exit
echo $$ >/sys/fs/cgroup/unified/mycg1/cgroup.procs || exit
for (( j = 0; j < 50; j ++ )); do
cat /mnt/dir$j/file* >/dev/null &
done
wait
echo "Switching wbs"
# Now rmdir the cgroup after the script exitsWe need to maintain b_dirty list ordering to keep writeback happy so instead of sorting inode into appropriate place just append it at the end of the list and clobber dirtied_time_when. This may result in inode writeback starting later after cgroup switch however cgroup switches are rare so it shouldn't matter much. Since the cgroup had write access to the inode, there are no practical concerns of the possible DoS issues.
--- fs/fs-writeback.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
fs/fs-writeback.c +11 -10
@@ -445,22 +445,23 @@ static bool inode_do_switch_wbs(struct inode *inode,* Transfer to @new_wb's IO list if necessary. If the @inode is dirty, * the specific list @inode was on is ignored and the @inode is put on * ->b_dirty which is always correct including from ->b_dirty_time. -* The transfer preserves @inode->dirtied_when ordering. If the @inode -* was clean, it means it was on the b_attached list, so move it onto -* the b_attached list of @new_wb. +* If the @inode was clean, it means it was on the b_attached list, so +* move it onto the b_attached list of @new_wb. */ if (!list_empty (&inode->i_io_list)) { inode->i_wb = new_wb;if (inode->i_state &I_DIRTY_ALL ) { -struct inode *pos; - -list_for_each_entry (pos, &new_wb->b_dirty, i_io_list) -if (time_after_eq (inode->dirtied_when, - pos->dirtied_when)) -break ; +/* +* We need to keep b_dirty list sorted by +* dirtied_time_when. However properly sorting the +* inode in the list gets too expensive when switching +* many inodes. So just attach inode at the end of the +* dirty list and clobber the dirtied_time_when. +*/ + inode->dirtied_time_when = jiffies;inode_io_list_move_locked (inode, new_wb, - pos->i_io_list.prev); + &new_wb->b_dirty); }else {inode_cgwb_move_to_attached (inode, new_wb); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 369/371 iomap: error out on file IO when there is no inline_data buffer
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 6a96fb653b6481ec73e9627ade216b299e4de9ea ]
Return IO errors if an ->iomap_begin implementation returns an IOMAP_INLINE buffer but forgets to set the inline_data pointer. Filesystems should never do this, but we could help fs developers (me) fix their bugs by handling this more gracefully than crashing the kernel.
--- fs/iomap/buffered-io.c | 15 ++++++++++----- fs/iomap/direct-io.c | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-)
fs/iomap/buffered-io.c +10 -5
@@ -304,6 +304,9 @@ static int iomap_read_inline_data(const struct iomap_iter *iter,size_t size =i_size_read (iter->inode) - iomap->offset;size_t offset =offset_in_folio (folio, iomap->offset); +if (WARN_ON_ONCE (!iomap->inline_data)) +return -EIO ; +if (folio_test_uptodate (folio))return 0 ;
@@ -894,7 +897,7 @@ static bool __iomap_write_end(struct inode *inode, loff_t pos, size_t len,return true; } -static void iomap_write_end_inline (const struct iomap_iter *iter, +static bool iomap_write_end_inline (const struct iomap_iter *iter,struct folio *folio,loff_t pos,size_t copied) {const struct iomap *iomap = &iter->iomap;
@@ -903,12 +906,16 @@ static void iomap_write_end_inline(const struct iomap_iter *iter,WARN_ON_ONCE (!folio_test_uptodate (folio));BUG_ON (!iomap_inline_data_valid (iomap)); +if (WARN_ON_ONCE (!iomap->inline_data)) +return false; +flush_dcache_folio (folio); addr =kmap_local_folio (folio, pos);memcpy (iomap_inline_data (iomap, pos), addr, copied);kunmap_local (addr);mark_inode_dirty (iter->inode); +return true; }/*
@@ -921,10 +928,8 @@ static bool iomap_write_end(struct iomap_iter *iter, size_t len, size_t copied,const struct iomap *srcmap =iomap_iter_srcmap (iter);loff_t pos = iter->pos; -if (srcmap->type ==IOMAP_INLINE ) { -iomap_write_end_inline (iter, folio, pos, copied); -return true; - } +if (srcmap->type ==IOMAP_INLINE ) +return iomap_write_end_inline (iter, folio, pos, copied);if (srcmap->flags &IOMAP_F_BUFFER_HEAD ) {size_t bh_written;
fs/iomap/direct-io.c +3 -0
@@ -519,6 +519,9 @@ static int iomap_dio_inline_iter(struct iomap_iter *iomi, struct iomap_dio *dio)loff_t pos = iomi->pos;u64 copied; +if (WARN_ON_ONCE (!inline_data)) +return -EIO ; +if (WARN_ON_ONCE (!iomap_inline_data_valid (iomap)))return -EIO ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 370/371 pidfs: validate extensible ioctls
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 3c17001b21b9f168c957ced9384abe969019b609 ]
Validate extensible ioctls stricter than we do now.
--- fs/pidfs.c | 2 +- include/linux/fs.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
fs/pidfs.c +1 -1
@@ -440,7 +440,7 @@ static bool pidfs_ioctl_valid(unsigned int cmd)* erronously mistook the file descriptor for a pidfd. * This is not perfect but will catch most cases. */ -return (_IOC_TYPE (cmd) ==_IOC_TYPE (PIDFD_GET_INFO )); +return extensible_ioctl_valid (cmd,PIDFD_GET_INFO ,PIDFD_INFO_SIZE_VER0 ); }return false;
include/linux/fs.h +14 -0
@@ -4025,4 +4025,18 @@ static inline bool vfs_empty_path(int dfd, const char __user *path)int generic_atomic_write_valid (struct kiocb *iocb,struct iov_iter *iter); +static inline bool extensible_ioctl_valid (unsigned int cmd_a, +unsigned int cmd_b,size_t min_size) +{ +if (_IOC_DIR (cmd_a) !=_IOC_DIR (cmd_b)) +return false; +if (_IOC_TYPE (cmd_a) !=_IOC_TYPE (cmd_b)) +return false; +if (_IOC_NR (cmd_a) !=_IOC_NR (cmd_b)) +return false; +if (_IOC_SIZE (cmd_a) < min_size) +return false; +return true; +} +#endif /* _LINUX_FS_H */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 371/371 mount: handle NULL values in mnt_ns_release()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 6c7ca6a02f8f9549a438a08a23c6327580ecf3d6 ]
When calling in listmount() mnt_ns_release() may be passed a NULL pointer. Handle that case gracefully.
--- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
@@ -180,7 +180,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns)static void mnt_ns_release (struct mnt_namespace *ns) {/* keep alive for {list,stat}mount() */ -if (refcount_dec_and_test (&ns->passive)) { +if (ns &&refcount_dec_and_test (&ns->passive)) {fsnotify_mntns_delete (ns);put_user_ns (ns->user_ns);kfree (ns);
Signature · 1 line
2.51.0
Hi
no regressions here on x86_64 (RKL, Intel 11th Gen. CPU)
Thanks
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.17:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
120 tests: 120 pass, 0 failLinux version: 6.17.4-rc1-g396c6daa5f57
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra186-p3509-0000+p3636-0001, tegra194-p2972-0000,
tegra194-p3509-0000+p3668-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.17.4-rc1 on x86 and arm64 Azure VM.
Thanks,
Hardik
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
Build fails for RISC-V with:
In file included from ./include/linux/pgtable.h:6,
from ./include/linux/mm.h:31,
from arch/riscv/kernel/asm-offsets.c:8:./arch/riscv/include/asm/pgtable.h:963:21: error: redefinition of 'pudp_huge_get_and_clear'
963 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
| ^~~~~~~~~~~~~~~~~~~~~~~./arch/riscv/include/asm/pgtable.h:946:21: note: previous definition of 'pudp_huge_get_and_clear' with type 'pud_t(struct mm_struct *, long unsigned int, pud_t *)' 946 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
| ^~~~~~~~~~~~~~~~~~~~~~~
Reverting 06536c4857271eeb19d76dbb4af989e2654a94e0 riscv: use an atomic xchg in pudp_huge_get_and_clear() fixes the build.
The problem is that this patch was already applied to 6.17 just before release, so the function pudp_huge_get_and_clear() ends up being duplicated in the file.
Greg Kroah-Hartman
maintainerQuoted 34 lines · Ron Economos
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
Build fails for RISC-V with:
In file included from
./include/linux/pgtable.h:6,
from./include/linux/mm.h:31,
fromarch/riscv/kernel/asm-offsets.c:8:./arch/riscv/include/asm/pgtable.h:963:21: error: redefinition of 'pudp_huge_get_and_clear'
963 | static inlinepud_tpudp_huge_get_and_clear(structmm_struct*mm, | ^~~~~~~~~~~~~~~~~~~~~~~./arch/riscv/include/asm/pgtable.h:946:21: note: previous definition of 'pudp_huge_get_and_clear' with type 'pud_t(struct mm_struct *, long unsigned int, pud_t *)'
946 | static inlinepud_tpudp_huge_get_and_clear(structmm_struct*mm, | ^~~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Reverting
06536c4857271eeb19d76dbb4af989e2654a94e0riscv: use an atomic xchg inpudp_huge_get_and_clear()fixes the build.The problem is that this patch was already applied to 6.17 just before release, so the function
pudp_huge_get_and_clear()ends up being duplicated in the file.
Thanks, I'll go drop this patch now, thanks.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Am 17.10.2025 um 16:49 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.17.4 release. There are 371 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.17.4-rc1-g396c6daa5f57 #110 SMP PREEMPT_DYNAMIC Fri Oct 17 19:51:58 -00 2025 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Hey Greg
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
Build and boot tested 6.17.4-rc1 using qemu-x86_64. The kernel was successfully built and booted in a virtualized environment without any issues.
Build
kernel: 6.17.4-rc1
git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git commit: 396c6daa5f57fff4f0c5ab890c6bfe6ca31b3bba
Best regards
Dileep Malepu.
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +0000. Anything received after that time might be too late.
Hi Greg
6.17.4-rc1 compiles on x86_64 (Xeon E5-1620 v2, Slackware64-15.0), and boots & runs on x86_64 (AMD Ryzen 5 7520U, Slackware64-current). No regressions observed.
Quoted 8 lines · On Fri, 17 Oct 2025 16:49:35 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for arm and loongarch64:
Thanks!
Cheers,
Miguel
[2025-10-17 16:49] Greg Kroah-Hartman:
Quoted 5 lines
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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 7 lines
Responses should be made by Sun, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
I've applied all patches from the current version of stable-queue/queue-6.17 (commit id 11094dba5f8d0df69938f47f5edc5472ba790eca) applied on top of kernel 6.17.3, and compiled the result for x86_64 using GCC 15.2.1+r22+gc4e96a094636 and binutils 2.45+r29+g2b2e51a31ec7. The resulting kernel boots and runs without any discernible issues on various physical machines of mine (Ivy Bridge, Haswell, Kaby Lake, Coffee Lake) and in a Zen 2 VM and a bunch of Kaby Lake VMs.
Regards
Pascal
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.17.4 release. There are 371 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, 19 Oct 2025 14:50:59 +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.17.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.17.y
and the diffstat can be found below.thanks,
greg k-h
[ Apologies for the slight delay in sending the reports, due to the long weekend here in India.]
As other reported,
The riscv builds failed with clang-21 and gcc-14 on the stable rc 6.17.4-rc1
Build regressions: 6.17.4-rc1 riscv pgtable.h:963:21: error:
redefinition of 'pudp_huge_get_and_clear'
## Build errors
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:31,
from arch/riscv/kernel/asm-offsets.c:8:
arch/riscv/include/asm/pgtable.h:963:21: error: redefinition of
'pudp_huge_get_and_clear'
963 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
| ^~~~~~~~~~~~~~~~~~~~~~~arch/riscv/include/asm/pgtable.h:946:21: note: previous definition of 'pudp_huge_get_and_clear' with type 'pud_t(struct mm_struct *, long unsigned int, pud_t *)'
946 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
| ^~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:182:arch/riscv/kernel/asm-offsets.s] Error 1
## Build
* kernel: 6.17.4-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 396c6daa5f57fff4f0c5ab890c6bfe6ca31b3bba
* git describe: v6.17.3-372-g396c6daa5f57
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.17.y/build/v6.17.3-372-g396c6daa5f57
## Test Regressions (compared to v6.17.2-564-g99cf54e7bd2f)
* riscv, build
- clang-21-lkftconfig
- gcc-14-allmodconfig
- gcc-14-allyesconfig
- gcc-14-lkftconfig
- gcc-14-lkftconfig-libgpiod
## Metric Regressions (compared to v6.17.2-564-g99cf54e7bd2f)
## Test Fixes (compared to v6.17.2-564-g99cf54e7bd2f)
## Metric Fixes (compared to v6.17.2-564-g99cf54e7bd2f)
## Test result summary
total: 123725, pass: 104164, fail: 4205, skip: 15356, xfail: 0
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 139 total, 139 passed, 0 failed
* arm64: 57 total, 54 passed, 3 failed
* i386: 18 total, 18 passed, 0 failed
* mips: 34 total, 33 passed, 1 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 40 total, 39 passed, 1 failed
* riscv: 25 total, 19 passed, 6 failed
* s390: 22 total, 22 passed, 0 failed
* sh: 5 total, 5 passed, 0 failed
* sparc: 4 total, 3 passed, 1 failed
* x86_64: 49 total, 48 passed, 1 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mm
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-rust
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* kvm-unit-tests
* lava
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
* rt-tests-cyclicdeadline
* rt-tests-pi-stress
* rt-tests-pmqtest
* rt-tests-rt-migrate-test
* rt-tests-signaltest
--
Linaro LKFT
https://lkft.linaro.org