6.18.61-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 258/1005 exfat: write moved entry before removing source
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yichong Chen <[email protected]>
[ Upstream commit 896fcc93574fd511ee04a4110e8ea59d6d8d43d7 ]
exfat_move_file() removes the old directory entry before the new entry has been written. If writing the new entry fails, rename returns an error after the source entry has already been marked deleted.
Write the new entry first, then remove the old entry and update the cached inode location. This keeps the source entry intact if creating the destination entry fails.
--- fs/exfat/namei.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/exfat/namei.c +5 -5
@@ -1156,11 +1156,6 @@ static int exfat_move_file(struct inode *parent_inode,exfat_init_ext_entry (&new_es, num_new_entries, p_uniname, &mov_es, num_extra_entries); -exfat_remove_entries (parent_inode, &mov_es,ES_IDX_FILE , false); - - ei->dir = newdir; - ei->entry = newentry; - ret =exfat_put_dentry_set (&new_es,IS_DIRSYNC (parent_inode));if (ret) {/* Best-effort delete to avoid duplicate entries */
@@ -1174,6 +1169,11 @@ static int exfat_move_file(struct inode *parent_inode, goto put_mov_es; } +exfat_remove_entries (parent_inode, &mov_es,ES_IDX_FILE , false); + + ei->dir = newdir; + ei->entry = newentry; +return exfat_put_dentry_set (&mov_es,IS_DIRSYNC (parent_inode)); put_mov_es:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 259/1005 remoteproc: Force shutdown during device removal
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit 4059c64d78b5d543dabae332922e763b4c95c79e ]
rproc_del() is subjected to the reference counted shutdown path, as such a remoteproc with more than one reference will be left running as its resources are released underneath it.
Refactor the shutdown path such that the reference count value is ignored when called from rproc_del().
--- drivers/remoteproc/remoteproc_core.c | 57 +++++++++++++++------------- 1 file changed, 31 insertions(+), 26 deletions(-)
drivers/remoteproc/remoteproc_core.c +31 -26
@@ -1993,28 +1993,7 @@ int rproc_boot(struct rproc *rproc) }EXPORT_SYMBOL (rproc_boot); -/** -* rproc_shutdown() - power off the remote processor -* @rproc: the remote processor -* -* Power off a remote processor (previously booted with rproc_boot()). -* -* In case @rproc is still being used by an additional user(s), then -* this function will just decrement the power refcount and exit, -* without really powering off the device. -* -* Every call to rproc_boot() must (eventually) be accompanied by a call -* to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug. -* -* Notes: -* - we're not decrementing the rproc's refcount, only the power refcount. -* which means that the @rproc handle stays valid even after rproc_shutdown() -* returns, and users can still use it with a subsequent rproc_boot(), if -* needed. -* -* Return: 0 on success, and an appropriate error value otherwise -*/ -int rproc_shutdown (struct rproc *rproc) +static int __rproc_shutdown (struct rproc *rproc,bool force) {struct device *dev = &rproc->dev;bool crashed;
@@ -2034,9 +2013,10 @@ int rproc_shutdown(struct rproc *rproc) } crashed = rproc->state ==RPROC_CRASHED ; -/* if the remote proc is still needed, bail out */ -if (!atomic_dec_and_test (&rproc->power)) +if (!atomic_dec_and_test (&rproc->power) && !force) { +/* The remote processor is still needed by another user. */ goto out; + } ret =rproc_stop (rproc, crashed);if (ret) {
@@ -2060,6 +2040,32 @@ int rproc_shutdown(struct rproc *rproc)mutex_unlock (&rproc->lock);return ret; } + +/** +* rproc_shutdown() - power off the remote processor +* @rproc: the remote processor +* +* Power off a remote processor (previously booted with rproc_boot()). +* +* In case @rproc is still being used by an additional user(s), then +* this function will just decrement the power refcount and exit, +* without really powering off the device. +* +* Every call to rproc_boot() must (eventually) be accompanied by a call +* to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug. +* +* Notes: +* - we're not decrementing the rproc's refcount, only the power refcount. +* which means that the @rproc handle stays valid even after rproc_shutdown() +* returns, and users can still use it with a subsequent rproc_boot(), if +* needed. +* +* Return: 0 on success, and an appropriate error value otherwise +*/ +int rproc_shutdown (struct rproc *rproc) +{ +return __rproc_shutdown (rproc, false); +}EXPORT_SYMBOL (rproc_shutdown);/**
@@ -2626,8 +2632,7 @@ int rproc_del(struct rproc *rproc)if (cancel_work_sync (&rproc->crash_handler))pm_relax (rproc->dev.parent); -/* TODO: make sure this works with rproc->power > 1 */ -rproc_shutdown (rproc); +__rproc_shutdown (rproc, true);rproc_delete_debug_dir (rproc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 260/1005 iommu/tegra241-cmdqv: Rate-limit the error ISRs log message
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
[ Upstream commit a86c36163c9722545d27e92bdad8418fdcaa8b1d ]
tegra241_cmdqv_isr() logs the error-map registers on every error interrupt. A malfunctioning device, or a guest deliberately faulting its own VCMDQs, can raise these interrupts rapidly, and the unconditional dev_warn() then floods the kernel log.
Rate-limit the message with dev_warn_ratelimited(), and pass the error-map registers straight to it so their four MMIO reads run only when the limiter prints, instead of building the string on every interrupt.
--- drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +7 -9
@@ -350,21 +350,19 @@ static irqreturn_t tegra241_cmdqv_isr(int irq, void *devid) {struct tegra241_cmdqv *cmdqv = (struct tegra241_cmdqv *)devid;void __iomem *reg_vintf_map =REG_CMDQV (cmdqv,VINTF_ERR_MAP ); -char err_str[256 ];u64 vintf_map;/* Use readl_relaxed() as register addresses are not 64-bit aligned */ vintf_map = (u64 )readl_relaxed (reg_vintf_map +0x4 ) <<32 | (u64 )readl_relaxed (reg_vintf_map); -snprintf (err_str,sizeof (err_str), -"vintf_map: %016llx, vcmdq_map %08x:%08x:%08x:%08x" , vintf_map, -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (3 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (2 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (1 ))), -readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (0 )))); - -dev_warn (cmdqv->dev,"unexpected error reported. %s\n" , err_str); +dev_warn_ratelimited ( + cmdqv->dev, +"unexpected error reported. vintf_map: %016llx, vcmdq_map %08x:%08x:%08x:%08x\n" , + vintf_map,readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (3 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (2 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (1 ))), +readl_relaxed (REG_CMDQV (cmdqv,CMDQ_ERR_MAP (0 ))));/* Handle VINTF0 and its LVCMDQs */ if (vintf_map &BIT_ULL (0 )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 261/1005 clk: imx: imx8qxp: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit cd21fdcbef3fb32136f72075ab668b075423b3f6 ]
The driver has a match table for the of bus wired into its driver structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the driver registration structure, and the missing module alias publication.
--- drivers/clk/imx/clk-imx8qxp.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/imx/clk-imx8qxp.c +1 -0
@@ -337,6 +337,7 @@ static const struct of_device_id imx8qxp_match[] = { { .compatible = "fsl,imx8qm-clk", &imx_clk_scu_rsrc_imx8qm, }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, imx8qxp_match);static struct platform_driver imx8qxp_clk_driver = { .driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 262/1005 clk: imx: imx8qxp-lpcg: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit e89485455ac49925565061733c0d73d568333fc0 ]
The driver has a match table for the of bus wired into its driver structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the driver registration structure, and the missing module alias publication.
--- drivers/clk/imx/clk-imx8qxp-lpcg.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/imx/clk-imx8qxp-lpcg.c +1 -0
@@ -354,6 +354,7 @@ static const struct of_device_id imx8qxp_lpcg_match[] = { { .compatible = "fsl,imx8qxp-lpcg", NULL }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, imx8qxp_lpcg_match);static struct platform_driver imx8qxp_lpcg_clk_driver = { .driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 263/1005 media: cx88: fix memory leak in cx8802_register_driver() error path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Changcheng <[email protected]>
[ Upstream commit e228b8b1a5b47a72b265671dc6d864c0da5528d0 ]
In cx8802_register_driver(), when drv->probe(driver) fails (non-zero), the allocated cx8802_driver struct is freed neither in the else branch nor later in cx8802_unregister_driver() (which only frees entries that were added to dev->drvlist on success). Each failed probe leaks the driver struct.
Add kfree(driver) in the else branch to fix the leak.
--- drivers/media/pci/cx88/cx88-mpeg.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/cx88/cx88-mpeg.c +1 -0
@@ -640,6 +640,7 @@ int cx8802_register_driver(struct cx8802_driver *drv)list_add_tail (&driver->drvlist, &dev->drvlist); }else {pr_err ("cx8802 probe failed, err = %d\n" , err); +kfree (driver); }mutex_unlock (&drv->core->lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 264/1005 clk: mediatek: mt6735-vdecsys: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 096ab64a0e69460bfb3557d09e17d2933280a1c6 ]
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication.
--- drivers/clk/mediatek/clk-mt6735-vdecsys.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt6735-vdecsys.c +1 -0
@@ -63,6 +63,7 @@ static const struct of_device_id of_match_mt6735_vdecsys[] = { { .compatible = "mediatek,mt6735-vdecsys", .data = &vdecsys_clks }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, of_match_mt6735_vdecsys);static struct platform_driver clk_mt6735_vdecsys = { .probe = mtk_clk_simple_probe,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 265/1005 clk: mediatek: mt6735-vencsys: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 36cf8d279ff90835f4b002dec28eedb059554842 ]
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication.
--- drivers/clk/mediatek/clk-mt6735-vencsys.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt6735-vencsys.c +1 -0
@@ -37,6 +37,7 @@ static const struct of_device_id of_match_mt6735_vencsys[] = { { .compatible = "mediatek,mt6735-vencsys", .data = &vencsys_clks }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, of_match_mt6735_vencsys);static struct platform_driver clk_mt6735_vencsys = { .probe = mtk_clk_simple_probe,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 266/1005 clk: tegra: support 48MHz clock for pll_p_out1
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
[ Upstream commit 46e31d69a547530fbef499bde888b6bb45a1deac ]
UEFI on Surface2 sets pll_p_out1 to 48MHz which is not supported by kernel and causes BUG() early on. Add 48MHz clock support for pll_p_out1.
--- drivers/clk/tegra/clk-pll.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-pll.c +1 -0
@@ -575,6 +575,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,break ;case 9600000 :case 28800000 : +case 48000000 :/* * PLL_P_OUT1 rate is not listed in PLLA table */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 267/1005 clk: clocking-wizard: fix clock difference detection
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Foster <[email protected]>
[ Upstream commit 006ba909c240b832c876b7aed29c6beec9d1f5e5 ]
--- drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/xilinx/clk-xlnx-clock-wizard.c +1 -1
@@ -406,7 +406,7 @@ static int clk_wzrd_get_divisors(struct clk_hw *hw, unsigned long rate,if (o < omin || o > omax)continue ; freq =DIV_ROUND_CLOSEST_ULL (vco_freq, o); - diff = freq - rate; + diff =abs (freq - rate);if (diff < best_diff) { best_diff = diff; divider->m = m >>3 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 268/1005 ata: ata_generic: Dont store pci_device_id
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Guo <[email protected]>
[ Upstream commit 4f3075f629077a8cb3d3455c794a1f4a8fc8b43e ]
pci_device_id is not guaranteed to live longer than probe due to presence of dynamic ID. All information apart from driver_data can be easily retrieved from pci_dev, so just store driver_data.
--- drivers/ata/ata_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/ata_generic.c +3 -3
@@ -51,11 +51,11 @@ enum {static int generic_set_mode (struct ata_link *link,struct ata_device **unused) {struct ata_port *ap = link->ap; -const struct pci_device_id *id = ap->host->private_data; +unsigned long driver_data = (unsigned long )ap->host->private_data;int dma_enabled =0 ;struct ata_device *dev; -if (id->driver_data &ATA_GEN_FORCE_DMA ) { +if (driver_data &ATA_GEN_FORCE_DMA ) { dma_enabled =0xff ; }else if (ap->ioaddr.bmdma_addr) {/* Bits 5 and 6 indicate if DMA is active on master/slave */
@@ -206,7 +206,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_idreturn rc;pcim_pin_device (dev); } -return ata_pci_bmdma_init_one (dev, ppi, &generic_sht, (void *)id,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &generic_sht, (void *)id->driver_data,0 ); }static const struct pci_device_id ata_generic[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 269/1005 i2c: qup: Propagate clock enable failures
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a477626332800942f463d76aa48db0c47f1dfd18 ]
The QUP I2C driver treats the core and iface clocks as required resources, but qup_i2c_enable_clocks() ignores clk_prepare_enable() failures. Probe can then continue to register the I2C adapter, and runtime/system resume can return success, even when a required clock transition failed.
Make the helper return an error, unwind a partially enabled clock, and propagate failures from probe and resume paths.
--- drivers/i2c/busses/i2c-qup.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-qup.c +24 -7
@@ -1657,10 +1657,21 @@ static const struct i2c_adapter_quirks qup_i2c_quirks_v2 = { .flags = I2C_AQ_NO_ZERO_LEN, }; -static void qup_i2c_enable_clocks (struct qup_i2c_dev *qup) +static int qup_i2c_enable_clocks (struct qup_i2c_dev *qup) { -clk_prepare_enable (qup->clk); -clk_prepare_enable (qup->pclk); +int ret; + + ret =clk_prepare_enable (qup->clk); +if (ret) +return ret; + + ret =clk_prepare_enable (qup->pclk); +if (ret) { +clk_disable_unprepare (qup->clk); +return ret; + } + +return 0 ; }static void qup_i2c_disable_clocks (struct qup_i2c_dev *qup)
@@ -1823,7 +1834,9 @@ static int qup_i2c_probe(struct platform_device *pdev) ret =PTR_ERR (qup->pclk); goto fail_dma; } -qup_i2c_enable_clocks (qup); + ret =qup_i2c_enable_clocks (qup); +if (ret) + goto fail_dma; src_clk_freq =clk_get_rate (qup->clk); } qup->src_clk_freq = src_clk_freq;
@@ -1975,8 +1988,7 @@ static int qup_i2c_pm_resume_runtime(struct device *device)struct qup_i2c_dev *qup =dev_get_drvdata (device);dev_dbg (device,"pm_runtime: resuming...\n" ); -qup_i2c_enable_clocks (qup); -return 0 ; +return qup_i2c_enable_clocks (qup); }static int qup_i2c_suspend (struct device *device)
@@ -1988,7 +2000,12 @@ static int qup_i2c_suspend(struct device *device)static int qup_i2c_resume (struct device *device) { -qup_i2c_pm_resume_runtime (device); +int ret; + + ret =qup_i2c_pm_resume_runtime (device); +if (ret) +return ret; +pm_request_autosuspend (device);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 270/1005 scsi: smartpqi: Add new PCI device-ids
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Strahan <[email protected]>
[ Upstream commit 1a220e6e87a31c2572cd07ff47023e5cd92ac80f ]
All PCI ID entries in Hex.
Add PCI IDs for Hurray Data controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
9005 / 028f / 207d / 4246
9005 / 028f / 207d / 4256
9005 / 028f / 207d / 4356
9005 / 028f / 207d / 4940
9005 / 028f / 207d / 4a46Add PCI IDs for ZTE controllers:
VID / DID / SVID / SDID
---- ---- ---- ----
9005 / 028f / 1cf2 / 5451
9005 / 028f / 1cf2 / 5452
9005 / 028f / 1cf2 / 5453Add PCI ID for Ramaxel controller:
VID / DID / SVID / SDID
---- ---- ---- ----
9005 / 028f / 1f3f / 0670--- drivers/scsi/smartpqi/smartpqi_init.c | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +36 -0
@@ -10152,10 +10152,30 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x207d ,0x4240 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x207d ,0x4246 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x207d ,0x4256 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x207d ,0x4356 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x207d ,0x4840 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x207d ,0x4940 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x207d ,0x4a46 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_ADVANTECH ,0x8312 )
@@ -10340,6 +10360,18 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1cf2 ,0x544f ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1cf2 ,0x5451 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1cf2 ,0x5452 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1cf2 ,0x5453 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1cf2 ,0x54da )
@@ -10380,6 +10412,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1f3f ,0x0610 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1f3f ,0x0670 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_LENOVO ,0x0220 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 271/1005 drm/amdkfd: Fix signal reset event
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amber Lin <[email protected]>
[ Upstream commit b38f9b6ffdfc86d5aff36881d9e8028c79bc98c9 ]
When a mode reset happens, driver needs to notify the process on that GPU a reset event is happening. The existing code assumes the process is using the GPU that is getting mode reset, which is not always true. For example, on a 8G system, the process may be only using GPU 0~4 but a mode 2 reset is resetting the all 8 GPUs connected by XGMI. Trying to find a process on GPU 5~7 will fail, which is fine and should skip the event signal.
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +8 -9
@@ -1287,6 +1287,8 @@ void kfd_signal_reset_event(struct kfd_node *dev)struct kfd_event *ev;unsigned int temp;uint32_t id, idx; +int user_gpu_id; +struct kfd_process_device *pdd;int reset_cause =atomic_read (&dev->sram_ecc_flag) ?KFD_HW_EXCEPTION_ECC :KFD_HW_EXCEPTION_GPU_HANG ;
@@ -1302,17 +1304,14 @@ void kfd_signal_reset_event(struct kfd_node *dev) idx =srcu_read_lock (&kfd_processes_srcu);hash_for_each_rcu (kfd_processes_table, temp, p, kfd_processes) { -int user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); -struct kfd_process_device *pdd =kfd_get_process_device_data (dev, p); - -if (unlikely (user_gpu_id == -EINVAL )) { -WARN_ONCE (1 ,"Could not get user_gpu_id from dev->id:%x\n" , dev->id); + pdd =kfd_get_process_device_data (dev, p); +if (!pdd) +/* no process is using this device */ continue ; - } + user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id); -if (unlikely (!pdd)) { -WARN_ONCE (1 ,"Could not get device data from process pid:%d\n" , - p->lead_thread->pid); +if (unlikely (user_gpu_id == -EINVAL )) { +WARN_ONCE (1 ,"Could not get user_gpu_id from dev->id:%d\n" , dev->id);continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 272/1005 drm/amd/display: Fix rounding errors in CalculatePrefetchSchedule
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Stewart <[email protected]>
[ Upstream commit fa0300333db07ca4ad56c9879f155faafd3f7079 ]
[why]
Rounding errors were causing mode validation to fail in some cases when it should not. (IE. Increasing fclk from a lower value could lead to validation failure, which should not happen.)
--- .../dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +6 -3
@@ -5554,7 +5554,8 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch +2 * (p->PixelPTEBytesPerRow * p->HostVMInefficiencyFactor + p->meta_row_bytes + tdlut_row_bytes) + *p->prefetch_sw_bytes) / (*p->Tpre_rounded - *p->Tno_bw); - s->Tsw_est1 = *p->prefetch_sw_bytes / s->prefetch_bw1; +/* due to rounding, VM can clamp to +1/4, Row can clamp to +2/4, giving SW less time */ + s->Tsw_est1 = *p->prefetch_sw_bytes / s->prefetch_bw1 -3.0 * s->LineTime /4.0 ; }else s->prefetch_bw1 =0 ;
@@ -5578,7 +5579,8 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratchif (*p->Tpre_rounded - *p->Tno_bw -2.0 * s->Tr0_trips_rounded >0 ) { s->prefetch_bw2 = (vm_bytes * p->HostVMInefficiencyFactor + *p->prefetch_sw_bytes) / (*p->Tpre_rounded - *p->Tno_bw -2.0 * s->Tr0_trips_rounded); - s->Tsw_est2 = *p->prefetch_sw_bytes / s->prefetch_bw2; +/* due to rounding, VM can clamp to +1/4 */ + s->Tsw_est2 = *p->prefetch_sw_bytes / s->prefetch_bw2 -1.0 * s->LineTime /4.0 ; }else s->prefetch_bw2 =0 ;
@@ -5592,7 +5594,8 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratchif (*p->Tpre_rounded - s->Tvm_trips_rounded >0 ) { s->prefetch_bw3 = (2 * (p->PixelPTEBytesPerRow * p->HostVMInefficiencyFactor + p->meta_row_bytes + tdlut_row_bytes) + *p->prefetch_sw_bytes) / (*p->Tpre_rounded - s->Tvm_trips_rounded); - s->Tsw_est3 = *p->prefetch_sw_bytes / s->prefetch_bw3; +/* due to rounding, Row can clamp to +2/4 */ + s->Tsw_est3 = *p->prefetch_sw_bytes / s->prefetch_bw3 -2.0 * s->LineTime /4.0 ; }else s->prefetch_bw3 =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 273/1005 arm64/runtime-const: Use aarch64_insn_patch_text_nosync() for patching
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: K Prateek Nayak <[email protected]>
[ Upstream commit a6690350a4ae7558b39d15fcc776c4d1ab5bbf39 ]
The current scheme to directly patch the kernel text for runtime constants runs into the following issue with futex adapted to using runtime constants on arm64:
Unable to handle kernel write to read-only memory at virtual address ...
The pc points to the *p assignment in the following call chain:
futex_init()
runtime_const_init(shift, __futex_shift)
__runtime_fixup_shift()
*p = cpu_to_le32(insn);which suggests that core_initcall() is too late to patch the kernel text directly unlike the "d_hash_shift" which is initialized during vfs_caches_init_early() before the protections are in place.
Use aarch64_insn_patch_text_nosync() to patch the runtime constants instead of doing it directly to allow runtime_const_init() slightly later into the boot.
Since aarch64_insn_patch_text_nosync() calls caches_clean_inval_pou() internally, __runtime_fixup_caches() ends up being redundant. runtime_const_init() are rare and the overheads of multiple calls to caches_clean_inval_pou() instead of batching them together should be negligible in practice.
The cpu_to_le32() conversion of instruction isn't necessary since it is handled later in the aarch64_insn_patch_text_nosync() call-chain:
aarch64_insn_patch_text_nosync(addr, insn)
aarch64_insn_write(addr, insn)
__aarch64_insn_write(addr, cpu_to_le32(insn))Sashiko noted that aarch64_insn_patch_text_nosync() does not expect a lm_alias() address and Catalin suggested it is safe to drop the lm_alias() for runtime patching since the kernel text is readable. The address passed to fixup function is interpreted as a __le32 and dereferenced as is to read the opcode at the patch site.
No functional changes are intended.
--- arch/arm64/include/asm/runtime-const.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
arch/arm64/include/asm/runtime-const.h +5 -12
@@ -3,6 +3,7 @@#define _ASM_RUNTIME_CONST_H#include <asm/cacheflush.h> +#include <asm/text-patching.h> /* Sigh. You can still run arm64 in BE mode */ #include <asm/byteorder.h>
@@ -46,34 +47,26 @@ static inline void __runtime_fixup_16(__le32 *p, unsigned int val)u32 insn =le32_to_cpu (*p); insn &=0xffe0001f ; insn |= (val &0xffff ) <<5 ; - *p =cpu_to_le32 (insn); -} - -static inline void __runtime_fixup_caches (void *where,unsigned int insns) -{ -unsigned long va = (unsigned long )where; -caches_clean_inval_pou (va, va +4 *insns); +aarch64_insn_patch_text_nosync (p, insn); }static inline void __runtime_fixup_ptr (void *where,unsigned long val) { -__le32 *p =lm_alias (where); +__le32 *p = where;__runtime_fixup_16 (p, val);__runtime_fixup_16 (p+1 , val >>16 );__runtime_fixup_16 (p+2 , val >>32 );__runtime_fixup_16 (p+3 , val >>48 ); -__runtime_fixup_caches (where,4 ); }/* Immediate value is 6 bits starting at bit #16 */ static inline void __runtime_fixup_shift (void *where,unsigned long val) { -__le32 *p =lm_alias (where); +__le32 *p = where;u32 insn =le32_to_cpu (*p); insn &=0xffc0ffff ; insn |= (val &63 ) <<16 ; - *p =cpu_to_le32 (insn); -__runtime_fixup_caches (where,1 ); +aarch64_insn_patch_text_nosync (p, insn); } static inline void runtime_const_fixup(void (*fn)(void *, unsigned long),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 274/1005 exfat: clean up new entry on add entry failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yichong Chen <[email protected]>
[ Upstream commit 0901a71e8cff5c60dd464529cba2ed30a2ab0a3f ]
exfat_add_entry() initializes a new directory entry set before writing it with exfat_put_dentry_set(). If the write fails, mkdir/create returns an error but a partially written entry may be left behind.
For non-zero-size directories, the failure also happens after a cluster has been allocated for the new directory. Clean up the new entry best-effort, and free the newly allocated directory cluster only when the cleanup writeback succeeds. This avoids freeing a cluster that may still be referenced by an on-disk entry if the cleanup fails.
--- fs/exfat/namei.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/exfat/namei.c +16 -1
@@ -476,6 +476,7 @@ static int exfat_add_entry(struct inode *inode, const char *path,struct exfat_entry_set_cache es;int clu_size =0 ;unsigned int start_clu =EXFAT_FREE_CLUSTER ; +bool dir_allocated = false; ret =exfat_resolve_path (inode, path, &uniname);if (ret)
@@ -502,6 +503,7 @@ static int exfat_add_entry(struct inode *inode, const char *path, } start_clu = clu.dir; clu_size = sbi->cluster_size; + dir_allocated = true; }/* update the directory entry */
@@ -512,8 +514,21 @@ static int exfat_add_entry(struct inode *inode, const char *path,exfat_init_ext_entry (&es, num_entries, &uniname,NULL ,0 ); ret =exfat_put_dentry_set (&es,IS_DIRSYNC (inode)); -if (ret) +if (ret) { +int cleanup_ret; + + cleanup_ret =exfat_get_dentry_set (&es, sb, &info->dir, + dentry,ES_ALL_ENTRIES ); +if (!cleanup_ret) { +exfat_remove_entries (inode, &es,ES_IDX_FILE , false); + cleanup_ret =exfat_put_dentry_set (&es, +IS_DIRSYNC (inode)); + } + +if (!cleanup_ret && dir_allocated) +exfat_free_cluster (inode, &clu); goto out; + } info->entry = dentry; info->flags =ALLOC_NO_FAT_CHAIN ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 275/1005 ALSA: hda/conexant: Add NULL check for dc_mode_path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
[ Upstream commit 273806f38ce95c95c288a03d3de1e423cd3e5543 ]
snd_hda_add_new_path() returns NULL when no path exists between the given NIDs, but olpc_xo_update_mic_pins() passes dc_mode_path straight to snd_hda_activate_path() which dereferences it without checking. Add the missing NULL guards, same as the local path variable already has in the same function.
--- sound/hda/codecs/conexant.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/hda/codecs/conexant.c +4 -2
@@ -457,7 +457,8 @@ static void olpc_xo_update_mic_pins(struct hda_codec *codec)if (!spec->dc_enable) {/* disable DC bias path and pin for port F */ update_mic_pin (codec,0x1e ,0 ); -snd_hda_activate_path (codec, spec->dc_mode_path, false, false); +if (spec->dc_mode_path) +snd_hda_activate_path (codec, spec->dc_mode_path, false, false);/* update port B (ext mic) and C (int mic) */ /* OLPC defers mic widget control until when capture is
@@ -493,7 +494,8 @@ static void olpc_xo_update_mic_pins(struct hda_codec *codec)update_mic_pin (codec,0x1b ,0 );/* enable DC bias path and pin */ update_mic_pin (codec,0x1e , spec->recording ?PIN_IN :0 ); -snd_hda_activate_path (codec, spec->dc_mode_path, true, false); +if (spec->dc_mode_path) +snd_hda_activate_path (codec, spec->dc_mode_path, true, false); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 276/1005 drm/msm: Move nr_cmds initialization
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 9ee2884ed58e6b39da35732146446d5930e4746b ]
Previously if we entered an error path between these two points, we could leak the relocs tables due to submit->nr_cmds still being zero.
In practice, relocs are disallowed on a6xx+, and non-ancient userspace will not use relocs on earlier gens unless running on an ancient kernel. But userspace could use this to trigger a memory leak.
Patchwork: https://patchwork.freedesktop.org/patch/743085/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/msm_gem_submit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_gem_submit.c +3 -2
@@ -260,6 +260,9 @@ static int submit_lookup_cmds(struct msm_gem_submit *submit, ret = -ENOMEM ; goto out; } + + submit->nr_cmds = i +1 ; + ret =copy_from_user (submit->cmd[i].relocs, userptr, sz);if (ret) { ret = -EFAULT ;
@@ -717,8 +720,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; } - submit->nr_cmds = args->nr_cmds; -idr_preload (GFP_KERNEL );spin_lock (&queue->idr_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 277/1005 drm/msm: Fix barriers accessing ctx vm
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit ae88499d71ce80ecd25c055eddddace108266321 ]
Don't rely on store ordering to protect us from caller seeing a partially initialized vm.
Patchwork: https://patchwork.freedesktop.org/patch/743079/
Message-ID: <[email protected]>
--- drivers/gpu/drm/msm/msm_drv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +7 -6
@@ -226,18 +226,19 @@ struct drm_gpuvm *msm_context_vm(struct drm_device *dev, struct msm_context *ctx {static DEFINE_MUTEX (init_lock);struct msm_drm_private *priv = dev->dev_private; +struct drm_gpuvm *vm =smp_load_acquire (&ctx->vm);/* Once ctx->vm is created it is valid for the lifetime of the context: */ -if (ctx->vm) -return ctx->vm; +if (vm) +return vm; + +guard (mutex)(&init_lock); -mutex_lock (&init_lock);if (!ctx->vm) { - ctx->vm =msm_gpu_create_private_vm ( + vm =msm_gpu_create_private_vm ( priv->gpu, current, !ctx->userspace_managed_vm); - +smp_store_release (&ctx->vm, vm); } -mutex_unlock (&init_lock);return ctx->vm; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 278/1005 platform/x86: dell-smbios-wmi: Fix chardev resource management
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 41427211f663c6eb36986ca2ea68d7e87aac52e9 ]
When unbinding the WMI driver while a userspace application has an open file descriptor for the character device, a UAF occurs:
KASAN: slab-use-after-free in _copy_to_user from platform/x86/dell-smbios-wmi
The reason for this is that even after calling misc_deregister(), userspace appications can still call read() and/or ioctl() on open file descriptors associated with the already unregistered character device. This causes a UAF by attempting to access the already freed state container of the WMI driver.
Fix this by no longer storing the state container inside filp->private_data. Instead retrieve the state container using get_first_smbios_priv() and return -ENODEV if the state container does not exist anymore.
--- drivers/platform/x86/dell/dell-smbios-wmi.c | 67 +++++++++++---------- 1 file changed, 34 insertions(+), 33 deletions(-)
drivers/platform/x86/dell/dell-smbios-wmi.c +34 -33
@@ -6,6 +6,7 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/cleanup.h> #include <linux/device.h> #include <linux/dmi.h> #include <linux/fs.h>
@@ -13,14 +14,13 @@#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mutex.h> +#include <linux/rwsem.h> #include <linux/uaccess.h> #include <linux/wmi.h> #include <uapi/linux/wmi.h> #include "dell-smbios.h" #include "dell-wmi-descriptor.h" -static DEFINE_MUTEX (call_mutex); -static DEFINE_MUTEX (list_mutex);static int wmi_supported;struct misc_bios_flags_structure {
@@ -32,6 +32,7 @@ struct misc_bios_flags_structure {#define DELL_WMI_SMBIOS_GUID "A80593CE-A997-11DA-B012-B622A1EF5492"struct wmi_smbios_priv { +struct mutex call_lock;/* Protects the content of the SMBIOS buffer */ struct dell_wmi_smbios_buffer *buf;struct list_head list;struct wmi_device *wdev;
@@ -39,6 +40,8 @@ struct wmi_smbios_priv {u64 req_buf_size;struct miscdevice char_dev; }; + +static DECLARE_RWSEM (list_lock);/* Protects access to wmi_list */ static LIST_HEAD (wmi_list);static inline struct wmi_smbios_priv *get_first_smbios_priv (void )
@@ -93,40 +96,35 @@ static int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)size_t size;int ret; -mutex_lock (&call_mutex); +guard (rwsem_read)(&list_lock); + priv =get_first_smbios_priv (); -if (!priv) { - ret = -ENODEV ; - goto out_wmi_call; - } +if (!priv) +return -ENODEV ; size =sizeof (struct calling_interface_buffer ); difference = priv->req_buf_size -sizeof (u64) - size; +guard (mutex)(&priv->call_lock); +memset (&priv->buf->ext,0 , difference);memcpy (&priv->buf->std, buffer, size); ret =run_smbios_call (priv->wdev);memcpy (buffer, &priv->buf->std, size); -out_wmi_call: -mutex_unlock (&call_mutex);return ret; } -static int dell_smbios_wmi_open (struct inode *inode,struct file *filp) +static ssize_t dell_smbios_wmi_read (struct file *filp,char __user *buffer,size_t length, +loff_t *offset) {struct wmi_smbios_priv *priv; - priv = container_of(filp->private_data, struct wmi_smbios_priv, char_dev); - filp->private_data = priv; +guard (rwsem_read)(&list_lock); -return nonseekable_open (inode, filp); -} - -static ssize_t dell_smbios_wmi_read (struct file *filp,char __user *buffer,size_t length, -loff_t *offset) -{ -struct wmi_smbios_priv *priv = filp->private_data; + priv =get_first_smbios_priv (); +if (!priv) +return -ENODEV ;return simple_read_from_buffer (buffer, length, offset, &priv->req_buf_size,sizeof (priv->req_buf_size));
@@ -173,22 +171,24 @@ static long dell_smbios_wmi_do_ioctl(struct wmi_smbios_priv *priv,static long dell_smbios_wmi_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct dell_wmi_smbios_buffer __user *input = (struct dell_wmi_smbios_buffer __user *)arg; -struct wmi_smbios_priv *priv = filp->private_data; -long ret; +struct wmi_smbios_priv *priv;if (cmd !=DELL_WMI_SMBIOS_CMD )return -ENOIOCTLCMD ; -mutex_lock (&call_mutex); - ret =dell_smbios_wmi_do_ioctl (priv, input); -mutex_unlock (&call_mutex); +guard (rwsem_read)(&list_lock); -return ret; + priv =get_first_smbios_priv (); +if (!priv) +return -ENODEV ; + +guard (mutex)(&priv->call_lock); + +return dell_smbios_wmi_do_ioctl (priv, input); }static const struct file_operations dell_smbios_wmi_fops = { .owner =THIS_MODULE , - .open = dell_smbios_wmi_open, .read = dell_smbios_wmi_read, .unlocked_ioctl = dell_smbios_wmi_ioctl, .compat_ioctl = compat_ptr_ioctl,
@@ -260,6 +260,10 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context)if (!priv->buf)return -ENOMEM ; + ret =devm_mutex_init (&wdev->dev, &priv->call_lock); +if (ret) +return ret; + ret =dell_smbios_wmi_register_chardev (priv);if (ret)return ret;
@@ -268,9 +272,8 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context)if (ret)return ret; -mutex_lock (&list_mutex); +guard (rwsem_write)(&list_lock);list_add_tail (&priv->list, &wmi_list); -mutex_unlock (&list_mutex);return 0 ; }
@@ -279,12 +282,10 @@ static void dell_smbios_wmi_remove(struct wmi_device *wdev) {struct wmi_smbios_priv *priv =dev_get_drvdata (&wdev->dev); -mutex_lock (&call_mutex); -mutex_lock (&list_mutex); -list_del (&priv->list); -mutex_unlock (&list_mutex);dell_smbios_unregister_device (&wdev->dev); -mutex_unlock (&call_mutex); + +guard (rwsem_write)(&list_lock); +list_del (&priv->list); }static const struct wmi_device_id dell_smbios_wmi_id_table[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 279/1005 s390/mm: Add missing mm check to do_secure_storage_access()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 7cf227b2707ed0129018c283ffc8f893945586db ]
Similar like the normal exception handler the secure storage access exception handler needs to verify if mm is not NULL, which may happen with kernel threads.
--- arch/s390/mm/fault.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/s390/mm/fault.c +2 -3
@@ -404,9 +404,9 @@ void do_secure_storage_access(struct pt_regs *regs) {union teid teid = { .val = regs->int_parm_long };unsigned long addr =get_fault_address (regs); +struct mm_struct *mm = current->mm;struct vm_area_struct *vma;struct folio_walk fw; -struct mm_struct *mm;struct folio *folio;int rc;
@@ -448,9 +448,8 @@ void do_secure_storage_access(struct pt_regs *regs)if (rc)return handle_fault_error_nolock (regs,0 ); }else { -if (faulthandler_disabled ()) +if (faulthandler_disabled () || !mm)return handle_fault_error_nolock (regs,0 ); - mm = current->mm;mmap_read_lock (mm); vma =find_vma (mm, addr);if (!vma)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 280/1005 s390/mm: Fix handling of vmalloc area in do_secure_storage_access()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit a2e5a9d853e015bc876399eb18435aa88101c60a ]
Secure storage access exceptions in vmalloc area need to be handled separately since virt_to_phys() does not work on such addresses. Given that there cannot be a valid access let such exceptions fail immediately. The kernel will either fixup or crash.
--- arch/s390/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/mm/fault.c +2 -0
@@ -433,6 +433,8 @@ void do_secure_storage_access(struct pt_regs *regs)panic ("Unexpected PGM 0x3d with TEID bit 61=0" ); }if (is_kernel_fault (regs)) { +if (is_vmalloc_addr ((void *)addr)) +return handle_fault_error_nolock (regs,0 ); folio =virt_to_folio ((void *)addr);if (unlikely (!folio_try_get (folio)))return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 281/1005 drm/panel-edp: Add BOE NE140QDM-NX2
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiji Wang <[email protected]>
[ Upstream commit 354b9c43d36ce9b41e48b2d67c5d9b953a0e9d64 ]
Add timing from datasheet for BOE NE140QDM-NX2.
edid-decode (hex):
00 ff ff ff ff ff ff 00 09 e5 f2 0a 00 00 00 00 20 1f 01 04 a5 1e 13 78 03 ee 96 a3 54 4c 99 26 0f 4e 51 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 60 d2 00 a0 a0 40 32 60 30 20 35 00 2e bd 10 00 00 18 c8 9d 00 a0 a0 40 32 60 30 20 35 00 2e bd 10 00 00 18 00 00 00 fd 00 30 78 c6 c6 36 01 0a 20 20 20 20 20 20 00 00 00 fe 00 4e 45 31 34 30 51 44 4d 2d 4e 58 32 20 01 f8
70 13 79 00 00 03 01 14 30 69 00 05 ff 09 9f 00 2f 00 1f 00 3f 06 31 00 02 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4d 90
--- drivers/gpu/drm/panel/panel-edp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-edp.c +1 -0
@@ -1989,6 +1989,7 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0a6a , &delay_200_500_e80,"NV140WUM-N44" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0ac5 , &delay_200_500_e50,"NV116WHM-N4C" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0ae8 , &delay_200_500_e50_p2e80,"NV140WUM-N41" ), +EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0af2 , &delay_200_500_e50_p2e80,"NE140QDM-NX2" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0b09 , &delay_200_500_e50_po2e200,"NV140FHM-NZ" ),EDP_PANEL_ENTRY ('B' ,'O' ,'E' ,0x0b1e , &delay_200_500_e80,"NE140QDM-N6A" ), EDP_PANEL_ENTRY('B', 'O', 'E', 0x0b34, &delay_200_500_e80_d50, "NV122WUM-N41"),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 282/1005 soc: mediatek: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit ec762057868d70d474a9816e9c293c2ef801c3c9 ]
The driver has an OF match table wired to .of_match_table, but does not export the table with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE(of, ...) entry so module alias information is generated for OF based module autoloading.
This is a source-level fix. It does not claim dynamic hardware reproduction; the evidence is the driver-owned match table, its use by the platform driver, and the missing module alias publication.
--- drivers/soc/mediatek/mtk-dvfsrc.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/mediatek/mtk-dvfsrc.c +1 -0
@@ -562,6 +562,7 @@ static const struct of_device_id mtk_dvfsrc_of_match[] = { { .compatible = "mediatek,mt8195-dvfsrc", .data = &mt8195_data }, {/* sentinel */ } }; +MODULE_DEVICE_TABLE (of, mtk_dvfsrc_of_match);static struct platform_driver mtk_dvfsrc_driver = { .probe = mtk_dvfsrc_probe,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 283/1005 exfat: free new directory cluster if zeroing fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yichong Chen <[email protected]>
[ Upstream commit ce12a39bed483008683438962b3a605374e6f803 ]
exfat_alloc_new_dir() allocates a cluster for a new directory before zeroing it. If exfat_zeroed_cluster() fails, the function returns the error but leaves the allocated cluster in use.
Free the newly allocated cluster before returning the zeroing error.
--- fs/exfat/dir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/exfat/dir.c +7 -1
@@ -310,7 +310,13 @@ int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu)if (ret)return ret; -return exfat_zeroed_cluster (inode, clu->dir); + ret =exfat_zeroed_cluster (inode, clu->dir); +if (ret) { +exfat_free_cluster (inode, clu); +return ret; + } + +return 0 ; }int exfat_calc_num_entries (struct exfat_uni_name *p_uniname)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 284/1005 ALSA: hda/realtek: add missing NULL check for codec->bus->pci
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Song <[email protected]>
[ Upstream commit 3b36ac93739e7b119a30affaee9c2dd41f24efbb ]
In alc269_probe(), codec->bus->pci is dereferenced without a NULL check for the ALC236 vendor ID case. Add the missing check, consistent with the existing pattern used elsewhere in the same function.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -8451,6 +8451,7 @@ static int alc269_probe(struct hda_codec *codec, const struct hda_device_id *id) spec->init_hook = alc256_init; spec->gen.mixer_nid =0 ;/* ALC256 does not have any loopback mixer path */ if (codec->core.vendor_id ==0x10ec0236 && + codec->bus->pci && codec->bus->pci->vendor !=PCI_VENDOR_ID_AMD ) spec->en_3kpull_low = false;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 285/1005 fs/ntfs3: Fix memory leak in indx_find_sort()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 194491be54e1c9e4d29d3ee777b05ff031c4b670 ]
When popping a level from the index lookup stack, indx_find_sort() frees the struct indx_node but not the index buffer it owns. Every call that descends and then pops a level leaks that allocation.
Free n->index before freeing the node itself.
--- fs/ntfs3/index.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/index.c +1 -0
@@ -1325,6 +1325,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,/* Pop one level. */ if (n) {fnd_pop (fnd); +kfree (n->index);kfree (n); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 286/1005 mfd: ipaq-micro: Fix out-of-bounds stack read in ipaq_micro_str
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit da3a98c941753255418616d249e5b40db0927c26 ]
ipaq_micro_str() decodes a UTF-16LE string into an ASCII string. It copies characters to a stack buffer retstr, but fails to null-terminate it. When kstrdup() is called on retstr, it can read past the buffer into uninitialized stack memory, potentially leaking stack contents.
Fix this by initializing retstr to zero.
--- drivers/mfd/ipaq-micro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ipaq-micro.c +1 -1
@@ -221,7 +221,7 @@ static void ipaq_micro_eeprom_read(struct ipaq_micro *micro,static char *ipaq_micro_str (u8 *wchar,u8 len) { -char retstr[256 ]; +char retstr[256 ] = {0 };u8 i;for (i =0 ; i < len /2 ; i++)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 287/1005 ALSA: hda/realtek: add missing error checks for COEF index reads in alc269
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Song <[email protected]>
[ Upstream commit 5b106b40ed22098f2bc049efb645148d038444bd ]
alc_read_coef_idx() and alc_read_coefex_idx() can return -1 on error via snd_hda_codec_read(). Several codec initialization and shutdown functions save these return values and later write them back to hardware registers without checking for errors, potentially corrupting COEF register state on a read failure.
Add error checks in:
- alc282_init() and alc282_shutup(): check coef78 before write-back
- alc285_hp_init(): check coef38/coef0d/coef36 before update, check val before write-back, and break polling loop on error
- alc294_hp_init(): break polling loop on read error
--- sound/hda/codecs/realtek/alc269.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
sound/hda/codecs/realtek/alc269.c +14 -8
@@ -296,7 +296,8 @@ static void alc282_init(struct hda_codec *codec)msleep (100 );/* Headphone capless set to normal mode */ -alc_write_coef_idx (codec,0x78 , coef78); +if (coef78 !=-1 ) +alc_write_coef_idx (codec,0x78 , coef78); }static void alc282_shutup (struct hda_codec *codec)
@@ -333,7 +334,8 @@ static void alc282_shutup(struct hda_codec *codec)alc_auto_setup_eapd (codec, false);alc_shutup_pins (codec); -alc_write_coef_idx (codec,0x78 , coef78); +if (coef78 !=-1 ) +alc_write_coef_idx (codec,0x78 , coef78); }static const struct coef_fw alc283_coefs[] = {
@@ -585,15 +587,19 @@ static void alc285_hp_init(struct hda_codec *codec)alc_write_coefex_idx (codec,0x58 ,0x00 ,0xf888 );/* HP depop procedure start */ val =alc_read_coefex_idx (codec,0x58 ,0x00 ); -for (i =0 ; i <20 && val &0x8000 ; i++) { +for (i =0 ; i <20 && val !=-1 && val &0x8000 ; i++) {msleep (50 ); val =alc_read_coefex_idx (codec,0x58 ,0x00 ); }/* Wait for depop procedure finish */ -alc_write_coefex_idx (codec,0x58 ,0x00 , val);/* write back the result */ -alc_update_coef_idx (codec,0x38 ,1 <<4 , coef38); -alc_update_coef_idx (codec,0x0d ,0x110 , coef0d); -alc_update_coef_idx (codec,0x36 ,3 <<13 , coef36); +if (val !=-1 ) +alc_write_coefex_idx (codec,0x58 ,0x00 , val);/* write back the result */ +if (coef38 !=-1 ) +alc_update_coef_idx (codec,0x38 ,1 <<4 , coef38); +if (coef0d !=-1 ) +alc_update_coef_idx (codec,0x0d ,0x110 , coef0d); +if (coef36 !=-1 ) +alc_update_coef_idx (codec,0x36 ,3 <<13 , coef36);msleep (50 );alc_update_coef_idx (codec,0x4a ,1 <<15 ,0 );
@@ -858,7 +864,7 @@ static void alc294_hp_init(struct hda_codec *codec)/* Wait for depop procedure finish */ val =alc_read_coefex_idx (codec,0x58 ,0x01 ); -for (i =0 ; i <20 && val &0x0080 ; i++) { +for (i =0 ; i <20 && val !=-1 && val &0x0080 ; i++) {msleep (50 ); val =alc_read_coefex_idx (codec,0x58 ,0x01 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 288/1005 mfd: axp20x: Preserve other control bits when powering off
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Proshkin <[email protected]>
[ Upstream commit 3756bf05c963563f1325af105356541882dd5899 ]
axp20x_power_off() triggers shutdown by writing AXP20X_OFF (BIT(7)) to the power-off control register with regmap_write(), which rewrites the whole register and clears other control bits in it.
On the AXP221/AXP223 (and the register-compatible AXP228) - that register also holds the CHGLED auto-control bit.
Clearing it during an orderly shutdown disables the hardware charge indicator, so the charge LED stays dark while the board is powered off and charging. Other variants keep unrelated configuration in the same register too.
Set only the power-off bit with regmap_set_bits() and leave the rest of the register untouched. The shutdown register is readable on every variant, so the read-modify-write should be safe.
Tested on a ClockworkPi uConsole (Raspberry Pi Compute Module 4, AXP228, which enumerates as AXP221): register AXP20X_OFF_CTRL reads 0x08 at runtime, so the old code left it 0x80 whereas setting only BIT(7) leaves 0x88. Writing 0x88 at power-off enables the charge LED while still powering off the PMIC.
--- drivers/mfd/axp20x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/axp20x.c +1 -1
@@ -1250,7 +1250,7 @@ static int axp20x_power_off(struct sys_off_data *data)break ; } -regmap_write (axp20x->regmap, shutdown_reg,AXP20X_OFF ); +regmap_set_bits (axp20x->regmap, shutdown_reg,AXP20X_OFF );/* Give capacitors etc. time to drain to avoid kernel panic msg. */ mdelay (500 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 289/1005 regulator: rt6245: Restore state on enable failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit e95a0a309ca02bf26dc937cdeb3fe2a235c65f63 ]
Currently, if regcache_sync() fails after the enable GPIO has been asserted, the driver returns with enable_gpio still set high and regcache_cache_only() left disabled. This leaves the device state inconsistent with the disabled state, where the enable GPIO is low and cache_only is enabled.
On failure, restore the original state by setting cache_only back to true and driving the enable GPIO low before returning the error.
--- drivers/regulator/rt6245-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/rt6245-regulator.c +4 -1
@@ -49,8 +49,11 @@ static int rt6245_enable(struct regulator_dev *rdev)regcache_cache_only (regmap, false); ret =regcache_sync (regmap); -if (ret) +if (ret) { +regcache_cache_only (regmap, true); +gpiod_direction_output (priv->enable_gpio,0 );return ret; + } priv->enable_state = true;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 290/1005 md/raid5: complete discard bios while reshape is active
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Genjian Zhang <[email protected]>
[ Upstream commit 85764f475f3b3abd956bf8eaeaa643b367676cf4 ]
make_discard_request() returns without completing the bio when reshape is in progress. Discard callers block in submit_bio_wait() waiting for a completion that never arrives. The caller hangs in uninterruptible sleep, and this does not resolve when reshape finishes.
Complete the bio with BLK_STS_AGAIN so userspace can retry after reshape, consistent with the existing policy of not processing discard during reshape.
Tested on a loop-backed RAID5 array during mdadm --grow: without this patch, blkdiscard hangs in bio_await() and remains in uninterruptible sleep after md reports "reshape done"; with this patch it returns -EAGAIN instead.
--- drivers/md/raid5.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/raid5.c +6 -2
@@ -5707,8 +5707,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi)int stripe_sectors;if (mddev->reshape_position != MaxSector) -/* Skip discard while reshape is happening */ -return ; + goto complete_again; stripe_sectors = conf->chunk_sectors * (conf->raid_disks - conf->max_degraded);
@@ -5786,6 +5785,11 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) }bio_endio (bi); +return ; + +complete_again: +/* Skip discard while reshape is happening */ +bio_endio_status (bi,BLK_STS_AGAIN ); } static bool ahead_of_reshape(struct mddev *mddev, sector_t sector,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 291/1005 romfs: detect hard link cycles
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: 이상호 <[email protected]>
[ Upstream commit d30b5a954e0a4dcc16bba9c310c13709a6169a52 ]
romfs_iget() follows on-disk hard link entries until it reaches a non-hard link inode:
pos = be32_to_cpu(ri.spec) & ROMFH_MASK;
The target position is image-controlled, and the loop does not detect cycles. A crafted romfs image can make the root inode a hard link. The hard link can point back to itself and leave mount(2) spinning in the kernel.
Reject excessive hard link indirection with -ELOOP. Normal romfs images do not need long hard link chains. This bounds corrupted-image traversal. Propagate romfs_iget() errors from lookup because hard link traversal can now fail with -ELOOP.
--- fs/romfs/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/romfs/super.c +8 -0
@@ -240,6 +240,8 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,if ((be32_to_cpu (ri.next) &ROMFH_TYPE ) ==ROMFH_HRD ) offset =be32_to_cpu (ri.spec) &ROMFH_MASK ; inode =romfs_iget (dir->i_sb, offset); +if (IS_ERR (inode)) +return ERR_CAST (inode);break ; }
@@ -262,6 +264,8 @@ static const struct inode_operations romfs_dir_inode_operations = { .lookup = romfs_lookup, }; +#define ROMFS_MAX_HARDLINK_DEPTH 64 +/* * get a romfs inode based on its position in the image (which doubles as the * inode number)
@@ -273,6 +277,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)struct inode *i;unsigned long nlen;unsigned nextfh; +unsigned int depth =0 ;int ret;umode_t mode;
@@ -289,6 +294,9 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)if ((nextfh &ROMFH_TYPE ) !=ROMFH_HRD )break ; +if (++depth >ROMFS_MAX_HARDLINK_DEPTH ) +return ERR_PTR (-ELOOP ); + pos =be32_to_cpu (ri.spec) &ROMFH_MASK ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 292/1005 nvmem: brcm_nvram: reject empty NVRAM partition
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit fde46579cf8872138b296349c2bd8a3cd3f132e2 ]
If the partition is completely erased (all padding bytes), the trimming loop reduces data_len to 0. devm_kzalloc(dev, 0, GFP_KERNEL) returns ZERO_SIZE_PTR ((void *)16), which is non-NULL and bypasses the NULL check. The subsequent cast of priv->data to struct brcm_nvram_header * and dereference of header->magic causes a page fault on address 0x10.
Reject data_len smaller than the header before allocating.
--- drivers/nvmem/brcm_nvram.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvmem/brcm_nvram.c +5 -0
@@ -84,6 +84,11 @@ static int brcm_nvram_copy_data(struct brcm_nvram *priv, struct platform_device }WARN (priv->data_len >SZ_128K ,"Unexpected (big) NVRAM size: %zu B\n" , priv->data_len); +if (priv->data_len <sizeof (struct brcm_nvram_header )) { +dev_err (priv->dev,"NVRAM data too small (%zu)\n" , priv->data_len); +return -EINVAL ; + } + priv->data =devm_kzalloc (priv->dev, priv->data_len,GFP_KERNEL );if (!priv->data)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 293/1005 nvmem: brcm_nvram: fix out-of-bounds access on malformed flash data
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit a67e2c323a47a2254ed3472b5e4c53abac20f116 ]
The length check in brcm_nvram_parse() validated header->len against priv->nvmem_size (the full partition size) instead of priv->data_len (the actual allocated data buffer). A malformed flash partition with header->len between the two would pass the check, causing brcm_nvram_add_cells() to read and write priv->data[len - 1] beyond the heap allocation.
Also add a minimum bound: len < sizeof(*header) could underflow the data[len - 1] access.
Fix both bounds by rejecting len outside [sizeof(*header), priv->data_len].
--- drivers/nvmem/brcm_nvram.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/nvmem/brcm_nvram.c +7 -3
@@ -192,9 +192,13 @@ static int brcm_nvram_parse(struct brcm_nvram *priv) } len =le32_to_cpu (header->len); -if (len > priv->nvmem_size) { -dev_err (dev,"NVRAM length (%zd) exceeds mapped size (%zd)\n" , len, - priv->nvmem_size); +if (len <sizeof (*header)) { +dev_err (dev,"NVRAM length (%zd) too small\n" , len); +return -EINVAL ; + } +if (len > priv->data_len) { +dev_err (dev,"NVRAM length (%zd) exceeds data size (%zd)\n" , len, + priv->data_len);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 294/1005 virtio_console: take a kref in find_port_by_vq() to fix port UAF
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hari Mishal <[email protected]>
[ Upstream commit 18dd0b4e489e4f0e3b748cf36ccb909c75a3efab ]
find_port_by_vq() returns a raw struct port pointer without taking a reference on it, unlike find_port_by_devt_in_portdev() which does. find_port_by_vq()'s only two callers, in_intr() and out_intr(), run as virtqueue interrupt callbacks, entirely independent of and possibly concurrently with unplug_port(), which itself runs from a workqueue when the host sends a VIRTIO_CONSOLE_PORT_REMOVE control message.
unplug_port() removes the port from portdev->ports under ports_lock, then later drops its last reference with kref_put(), freeing it via remove_port(). find_port_by_vq() also walks portdev->ports under ports_lock, so if it finds the port still on the list, the list removal, and therefore the eventual kref_put(), has not happened yet, and taking a reference at that point is always safe. Without doing so, in_intr()/out_intr() can be left holding a pointer to a port that unplug_port() frees on another core before they are done using it.
Both triggers are host-controlled as the host decides when to send the PORT_REMOVE control message and when to kick the port's data vq. So a malicious backend could race the two on purpose, without any guest side cooperation. The freed object is a generic kmalloc allocation containing a wait_queue_head_t, which in_intr()/out_intr() pass to wake_up_interruptible() after touching the stale pointer. wake_up_interruptible() invokes a function pointer read out of the wait queue's entries. If the freed slab slot is reclaimed with attacker influenced content before that call, then this is an arbitrary function call primitive rather than just undefined behaviour.
Take a reference in find_port_by_vq() while still holding ports_lock, matching find_port_by_devt_in_portdev(), and release it in in_intr() and out_intr() once they are done with the port.
--- drivers/char/virtio_console.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/char/virtio_console.c +12 -1
@@ -304,6 +304,12 @@ static struct port *find_port_by_id(struct ports_device *portdev, u32 id)return port; } +/* +* Finds a port by the virtqueue and returns a pointer to struct port +* with the reference count incremented. +* +* Callers MUST decrement it when finished. +*/ static struct port *find_port_by_vq (struct ports_device *portdev,struct virtqueue *vq) {
@@ -312,8 +318,10 @@ static struct port *find_port_by_vq(struct ports_device *portdev,spin_lock_irqsave (&portdev->ports_lock, flags);list_for_each_entry (port, &portdev->ports, list) -if (port->in_vq == vq || port->out_vq == vq) +if (port->in_vq == vq || port->out_vq == vq) { +kref_get (&port->kref); goto out; + } port =NULL ; out:spin_unlock_irqrestore (&portdev->ports_lock, flags);
@@ -1706,6 +1714,7 @@ static void out_intr(struct virtqueue *vq) }wake_up_interruptible (&port->waitqueue); +kref_put (&port->kref, remove_port); }static void in_intr (struct virtqueue *vq)
@@ -1751,6 +1760,8 @@ static void in_intr(struct virtqueue *vq)if (is_console_port (port) &&hvc_poll (port->cons.hvc))hvc_kick (); + +kref_put (&port->kref, remove_port); }static void control_intr (struct virtqueue *vq)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 295/1005 wifi: mt76: mt7603: free beacon SKB on error
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Bauer <[email protected]>
[ Upstream commit 965cbdbdfbd37a659a05ff88e49c216975bd9d2e ]
The SKB containing the generated beacon is not freed when the beacon queue is deected stuck and scheduled for recovery.
Fixes potential memory leaks in case the beacon queue is detected stuck.
--- drivers/net/wireless/mediatek/mt76/mt7603/beacon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7603/beacon.c +2 -0
@@ -56,6 +56,7 @@ mt7603_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) FIELD_PREP(MT_DMA_FQCR0_TARGET_QID, MT_TX_HW_QUEUE_BCN));if (!mt76_poll (dev,MT_DMA_FQCR0 ,MT_DMA_FQCR0_BUSY ,0 ,5000 )) { dev->beacon_check =MT7603_WATCHDOG_TIMEOUT ; +dev_kfree_skb (skb); goto out; }
@@ -63,6 +64,7 @@ mt7603_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) FIELD_PREP(MT_DMA_FQCR0_TARGET_QID, MT_TX_HW_QUEUE_BMC));if (!mt76_poll (dev,MT_DMA_FQCR0 ,MT_DMA_FQCR0_BUSY ,0 ,5000 )) { dev->beacon_check =MT7603_WATCHDOG_TIMEOUT ; +dev_kfree_skb (skb); goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 296/1005 wifi: mt76: mt76x02: report rx FCS errors to mac80211
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devin Wittmayer <[email protected]>
[ Upstream commit ddae0bcb01e71c1184bb3f526f9622e31dc38f3b ]
When the fcsfail filter is enabled the hardware passes frames with a bad FCS up to the driver, but mt76x02_mac_process_rx() never checks MT_RXINFO_CRCERR and hands them to mac80211 without RX_FLAG_FAILED_FCS_CRC. In monitor mode the radiotap flags byte then never gets IEEE80211_RADIOTAP_F_BADFCS set and corrupted frames cannot be told apart from clean ones.
Set RX_FLAG_FAILED_FCS_CRC from the descriptor CRC error bit, matching mt7603, mt7615, mt7915, mt7921, mt7925 and mt7996.
--- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +3 -0
@@ -792,6 +792,9 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,if (rxinfo &MT_RXINFO_L2PAD ) pad_len +=2 ; +if (rxinfo &MT_RXINFO_CRCERR ) + status->flag |=RX_FLAG_FAILED_FCS_CRC ; +if (rxinfo &MT_RXINFO_DECRYPT ) { status->flag |=RX_FLAG_DECRYPTED ; status->flag |=RX_FLAG_MMIC_STRIPPED ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 297/1005 wifi: mt76: mt7915: configure noise floor reporting on reset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Bauer <[email protected]>
[ Upstream commit a92cd5dd792a63a5d8a72142835382d4edbe9933 ]
When performing a full system recovery of the MCU on a dual-phy platform, band 0 (usually 2.4GHz) stops reading correct noise floor data.
This is due to noise floor reporting only being configured correctly for the second device PHY.
Configure the respective registers correctly after restarting the MCU firmware to fix reported noise-floor values.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +7 -2
@@ -1292,6 +1292,7 @@ mt7915_mac_restart(struct mt7915_dev *dev)struct mt7915_phy *phy2;struct mt76_phy *ext_phy;struct mt76_dev *mdev = &dev->mt76; +bool run_main, run_ext;int i, ret; ext_phy = dev->mt76.phys[MT_BAND1 ];
@@ -1387,13 +1388,17 @@ mt7915_mac_restart(struct mt7915_dev *dev)mt7915_init_txpower (phy2); ret =mt7915_txbf_init (dev); -if (test_bit (MT76_STATE_RUNNING , &dev->mphy.state)) { + run_main =test_and_clear_bit (MT76_STATE_RUNNING , &dev->mphy.state); + run_ext = ext_phy && +test_and_clear_bit (MT76_STATE_RUNNING , &ext_phy->state); + +if (run_main) { ret =mt7915_run (dev->mphy.hw);if (ret) goto out; } -if (ext_phy &&test_bit (MT76_STATE_RUNNING , &ext_phy->state)) { +if (run_ext) { ret =mt7915_run (ext_phy->hw);if (ret) goto out;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 298/1005 wifi: mt76: mt7921: fix memory leak when skb_linearize fails in mcu rx event
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prashant Rahul <[email protected]>
[ Upstream commit 4361f1660101270611eb5dc39799f620b35f2e4d ]
The ownership of sk_buff skb is passed to mt7921_queue_rx_skb, each path inside it under the switch case handles cleaning of skb and it is true for mt7921_mcu_rx_event as well.
mt7921_mcu_rx_event, on a success path, either queues skb via mt76_mcu_rx_event or cleans it immediately inside mt7921_mcu_uni_rx_unsolicited_event.
However inside mt7921_mcu_rx_event, if skb_linearize fails, the function returns immediately and never bothers cleaning skb which leaks skb.
Since skb is fully owned at this point, it is safe to call dev_kfree_skb which fixes the leak.
Granted, the skb_linearize failure is rare as it can only fail under heavy memory usage, but at the same time, leaking memory under heavy memory usage can worsen the OOM condition.
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +3 -1
@@ -354,8 +354,10 @@ void mt7921_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff *skb) {struct mt76_connac2_mcu_rxd *rxd; -if (skb_linearize (skb)) +if (skb_linearize (skb)) { +dev_kfree_skb (skb);return ; + } rxd = (struct mt76_connac2_mcu_rxd *)skb->data;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 299/1005 wifi: mt76: mt7603: add 0x7592 EEPROM chip ID
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmed Naseef <[email protected]>
[ Upstream commit d16447d7470502e998d82e806ca7ed49d1baa853 ]
Some EcoNet based routers ship an on-flash EEPROM whose chip-id is 0x7592 instead of the expected 0x7603. The device probes as PCI 14c3:7603 and the hardware MT_HW_CHIPID register reports 0x7603, independent of the EEPROM value.
This is seen across multiple EcoNet EN751221 and EN7528 based devices (for example the Genexis Platinum 4410).
--- drivers/net/wireless/mediatek/mt76/mt7603/eeprom.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7603/eeprom.c +1 -0
@@ -142,6 +142,7 @@ static int mt7603_check_eeprom(struct mt76_dev *dev)case 0x7628 :case 0x7603 :case 0x7600 : +case 0x7592 :return 0 ;default :return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 300/1005 wifi: mt76: wed: fix kernel panic on non-DBDC MT7986
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <[email protected]>
[ Upstream commit 8a177dabeeead47dda4d4f91331282790eed0097 ]
In mt76_wed_init_rx_buf, it's hardcoded to use MT_RXQ_MAIN. But for non-DBDC MT7986 MT_RXQ_BAND1 is used for RX data queue which leads to kernel panic when attaching WED.
Use the correct RX queue by checking WED version and band_idx.
v2 and band 1 -> MT_RXQ_BAND1
Others -> MT_RXQ_MAIN
Kernel panic: Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000
Mem abort info:
ESR = 0x0000000096000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x05: level 1 translation fault
Data abort info:
ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
Internal error: Oops: 0000000096000005 [#1] SMP CPU: 1 UID: 0 PID: 925 Comm: kmodloader Tainted: G O 6.18.26 #0 NONE Tainted: [O]=OOT_MODULE Hardware name: Acer Connect Vero W6m (DT) pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : page_pool_alloc_frag_netmem+0x1c/0x1bc lr : page_pool_alloc_frag+0xc/0x34
sp : ffffffc081dab660
x29: ffffffc081dab660 x28: ffffffc081dabc60 x27: ffffff80091af040
x26: 0000008000000000 x25: ffffff80091a8898 x24: ffffff80091a5440
x23: 0000000000001000 x22: 0000000140000000 x21: ffffff80091a2040
x20: ffffff8003f1d780 x19: 0000000000000000 x18: 0000000000000020
x17: ffffffbfbf0ac000 x16: ffffffc080ee0000 x15: ffffff80049d47ca
x14: 000000000000037b x13: 000000000000037b x12: 0000000000000001
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffffff8003f1d7c0 x7 : 0000000000000000 x6 : ffffff8003f1d780 x5 : 0000000000000680 x4 : 0000000000000000 x3 : 0000000000002824 x2 : 0000000000000000 x1 : ffffffc081dab71c x0 : 0000000000000000
Call trace: page_pool_alloc_frag_netmem+0x1c/0x1bc (P) page_pool_alloc_frag+0xc/0x34 mt76_wed_init_rx_buf+0xf8/0x2ac [mt76] mtk_wed_start+0x79c/0x12ac mt7915_dma_start+0x274/0x63c [mt7915e] mt7915_dma_start+0x5b4/0x63c [mt7915e] mt7915_dma_init+0x49c/0x81c [mt7915e] mt7915_register_device+0x24c/0x530 [mt7915e] mt7915_mmio_probe+0x91c/0x1980 [mt7915e] platform_probe+0x58/0xa0 really_probe+0xb8/0x2a8 __driver_probe_device+0x74/0x118 driver_probe_device+0x3c/0xe0 __driver_attach+0x88/0x154 bus_for_each_dev+0x60/0xb0 driver_attach+0x20/0x28 bus_add_driver+0xdc/0x200 driver_register+0x64/0x118 __platform_driver_register+0x20/0x30 init_module+0x74/0x1000 [mt7915e] do_one_initcall+0x4c/0x1f8 do_init_module+0x50/0x210 load_module+0x15f8/0x1b10 __do_sys_init_module+0x1a8/0x260 __arm64_sys_init_module+0x18/0x20 invoke_syscall.constprop.0+0x4c/0xd0 do_el0_svc+0x3c/0xd0 el0_svc+0x18/0x60 el0t_64_sync_handler+0x98/0xdc el0t_64_sync+0x158/0x15c Code: aa0003f3 a9025bf5 a90363f7 d2820017 (b9400000)
--- drivers/net/wireless/mediatek/mt76/wed.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/wed.c +6 -1
@@ -33,10 +33,15 @@ u32 mt76_wed_init_rx_buf(struct mtk_wed_device *wed, int size) {struct mtk_wed_bm_desc *desc = wed->rx_buf_ring.desc;struct mt76_dev *dev =mt76_wed_to_dev (wed); -struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN ];struct mt76_txwi_cache *t =NULL ; +struct mt76_queue *q;int i; +if (wed->version ==2 && dev->phy.band_idx) + q = &dev->q_rx[MT_RXQ_BAND1 ]; +else + q = &dev->q_rx[MT_RXQ_MAIN ]; +for (i =0 ; i < size; i++) {dma_addr_t addr;u32 offset;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 301/1005 netfilter: conntrack: tcp: use UNACK timeout for non-closing RST packets
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minghao Zhang <[email protected]>
[ Upstream commit bf80e6802273a900311b44e47c9b1a59c6d2473c ]
Commit be0502a3f2e9 ("netfilter: conntrack: tcp: only close if RST matches exact sequence") keeps an established conntrack entry in ESTABLISHED when an in-window RST does not match the expected sequence number exactly, so the endpoint can validate the RST with a challenge ACK.
The timeout selection nevertheless uses the CLOSE timeout for every RST packet. The bug is that timeout selection is based on the packet type, not on the state transition result: even when RST validation keeps new_state in ESTABLISHED, the timeout is still forced to TCP_CONNTRACK_CLOSE.
Linux TCP independently rate limits challenge ACKs per socket. A second non-exact RST can therefore arrive after the first challenge ACK has restored the timeout but before the rate limit expires. The second RST lowers the timeout to 10 seconds again while the endpoint suppresses the second challenge ACK, allowing the conntrack entry to expire while both TCP endpoints remain established.
Using the ESTABLISHED timeout for such RSTs would avoid this short expiration window, but it could also retain stale entries for the five-day default because conntrack cannot reliably match the endpoint's exact TCP state.
Use the UNACK timeout for RST packets that leave the conntrack entry in TCP_CONNTRACK_ESTABLISHED. Exact-match RSTs and accepted RST packet trains still fall through to timeouts[new_state], which preserves the CLOSE timeout when conntrack accepts the RST as closing the flow.
This avoids the aggressive 10-second expiration window for non-exact RSTs while preserving the short timeout for RSTs that conntrack accepts as closing the flow.
--- net/netfilter/nf_conntrack_proto_tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +3 -2
@@ -1325,8 +1325,9 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,if (ct->proto.tcp.retrans >= tn->tcp_max_retrans && timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS ]) timeout = timeouts[TCP_CONNTRACK_RETRANS ]; -else if (unlikely (index ==TCP_RST_SET )) - timeout = timeouts[TCP_CONNTRACK_CLOSE ]; +else if (unlikely (index ==TCP_RST_SET && + new_state ==TCP_CONNTRACK_ESTABLISHED )) + timeout = timeouts[TCP_CONNTRACK_UNACK ];else if ((ct->proto.tcp.seen[0 ].flags | ct->proto.tcp.seen[1 ].flags) &IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK ])
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 302/1005 netfilter: nf_tables: call skb_valid_dst() before skb_dst()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 689db98e535bf8efb5bc9c36f4fd3de3bd715eb6 ]
When fetching the dst_entry from the skb, check if it valid, ie. this is not a template dst, for extensions that can be used from the netdev ingress and egress chains.
--- net/ipv4/netfilter/nf_reject_ipv4.c | 6 ++++-- net/ipv6/netfilter/nf_reject_ipv6.c | 8 ++++++-- net/netfilter/nft_meta.c | 6 ++++-- net/netfilter/nft_rt.c | 6 ++++-- net/netfilter/nft_xfrm.c | 9 ++++++++- 5 files changed, 26 insertions(+), 9 deletions(-)
net/ipv4/netfilter/nf_reject_ipv4.c +4 -2
@@ -8,6 +8,7 @@#include <net/tcp.h> #include <net/route.h> #include <net/dst.h> +#include <net/dst_metadata.h> #include <net/netfilter/ipv4/nf_reject.h> #include <linux/netfilter_ipv4.h> #include <linux/netfilter_bridge.h>
@@ -263,6 +264,7 @@ static int nf_reject_fill_skb_dst(struct sk_buff *skb_in)if (!dst)return -1 ; +skb_dst_drop (skb_in);skb_dst_set (skb_in, dst);return 0 ; }
@@ -279,7 +281,7 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb,if (!oth)return ; -if (!skb_dst (oldskb) &&nf_reject_fill_skb_dst (oldskb) <0 ) +if (!skb_valid_dst (oldskb) &&nf_reject_fill_skb_dst (oldskb) <0 )return ;if (skb_rtable (oldskb)->rt_flags & (RTCF_BROADCAST |RTCF_MULTICAST ))
@@ -352,7 +354,7 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)if (iph->frag_off &htons (IP_OFFSET ))return ; -if (!skb_dst (skb_in) &&nf_reject_fill_skb_dst (skb_in) <0 ) +if (!skb_valid_dst (skb_in) &&nf_reject_fill_skb_dst (skb_in) <0 )return ; if (skb_csum_unnecessary(skb_in) ||
net/ipv6/netfilter/nf_reject_ipv6.c +6 -2
@@ -8,6 +8,7 @@#include <net/ip6_route.h> #include <net/ip6_fib.h> #include <net/ip6_checksum.h> +#include <net/dst_metadata.h> #include <net/netfilter/ipv6/nf_reject.h> #include <linux/netfilter_ipv6.h> #include <linux/netfilter_bridge.h>
@@ -304,6 +305,7 @@ static int nf_reject6_fill_skb_dst(struct sk_buff *skb_in)if (!dst)return -1 ; +skb_dst_drop (skb_in);skb_dst_set (skb_in, dst);return 0 ; }
@@ -336,10 +338,12 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, fl6.fl6_sport = otcph->dest; fl6.fl6_dport = otcph->source; -if (!skb_dst (oldskb)) { +if (!skb_valid_dst (oldskb)) {nf_ip6_route (net, &dst,flowi6_to_flowi (&fl6), false);if (!dst)return ; + +skb_dst_drop (oldskb);skb_dst_set (oldskb, dst); }
@@ -440,7 +444,7 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in,if (hooknum ==NF_INET_LOCAL_OUT && skb_in->dev ==NULL ) skb_in->dev = net->loopback_dev; -if (!skb_dst (skb_in) &&nf_reject6_fill_skb_dst (skb_in) <0 ) +if (!skb_valid_dst (skb_in) &&nf_reject6_fill_skb_dst (skb_in) <0 )return ;icmpv6_send (skb_in,ICMPV6_DEST_UNREACH , code,0 );
net/netfilter/nft_meta.c +4 -2
@@ -20,6 +20,7 @@#include <net/dst.h> #include <net/ip.h> #include <net/sock.h> +#include <net/dst_metadata.h> #include <net/tcp_states.h> /* for TCP_TIME_WAIT */ #include <net/netfilter/nf_tables.h> #include <net/netfilter/nf_tables_core.h>
@@ -274,11 +275,12 @@ static bool nft_meta_get_eval_ifname(enum nft_meta_keys key, u32 *dest, static noinline boolnft_meta_get_eval_rtclassid (const struct sk_buff *skb,u32 *dest) { -const struct dst_entry *dst =skb_dst (skb); +const struct dst_entry *dst; -if (!dst) +if (!skb_valid_dst (skb))return false; + dst =skb_dst (skb); *dest = dst->tclassid;return true; }
net/netfilter/nft_rt.c +4 -2
@@ -8,6 +8,7 @@#include <linux/netfilter.h> #include <linux/netfilter/nf_tables.h> #include <net/dst.h> +#include <net/dst_metadata.h> #include <net/ip6_route.h> #include <net/route.h> #include <net/netfilter/nf_tables.h>
@@ -59,10 +60,11 @@ void nft_rt_get_eval(const struct nft_expr *expr,u32 *dest = ®s->data[priv->dreg];const struct dst_entry *dst; - dst =skb_dst (skb); -if (!dst) +if (!skb_valid_dst (skb)) goto err; + dst =skb_dst (skb); +switch (priv->key) {#ifdef CONFIG_IP_ROUTE_CLASSID case NFT_RT_CLASSID :
net/netfilter/nft_xfrm.c +8 -1
@@ -12,6 +12,7 @@#include <linux/netfilter/nf_tables.h> #include <net/netfilter/nf_tables_core.h> #include <net/netfilter/nf_tables.h> +#include <net/dst_metadata.h> #include <linux/in.h> #include <net/xfrm.h>
@@ -177,9 +178,15 @@ static void nft_xfrm_get_eval_out(const struct nft_xfrm *priv,struct nft_regs *regs, const struct nft_pktinfo *pkt) { - const struct dst_entry *dst = skb_dst(pkt->skb); + const struct dst_entry *dst;int i; +if (!skb_valid_dst (pkt->skb)) { + regs->verdict.code =NFT_BREAK ; +return ; + } + + dst =skb_dst (pkt->skb);for (i =0 ; dst && dst->xfrm; dst = ((const struct xfrm_dst *)dst)->child, i++) {if (i < priv->spnum)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 303/1005 perf: marvell: Cancel CN10K DDR PMU hrtimer on device remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit 7dbcb0268d1e2a1d3badb0c6e77ee70e550b1787 ]
cn10k_ddr_perf_remove() did not cancel the poll hrtimer before returning. If the device was unbound while perf events were still active the timer callback could run post-free.
To fix the issue by adding hrtimer_cancel() in remove().
--- drivers/perf/marvell_cn10k_ddr_pmu.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/perf/marvell_cn10k_ddr_pmu.c +6 -0
@@ -1088,6 +1088,12 @@ static void cn10k_ddr_perf_remove(struct platform_device *pdev) {struct cn10k_ddr_pmu *ddr_pmu =platform_get_drvdata (pdev); +/* +* Cancel the poll timer before further teardown so the handler +* cannot run after this function returns. +*/ +hrtimer_cancel (&ddr_pmu->hrtimer); +cpuhp_state_remove_instance_nocalls (CPUHP_AP_PERF_ARM_MARVELL_CN10K_DDR_ONLINE , &ddr_pmu->node);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 304/1005 wifi: ath11k: fix resource leak on error in ext IRQ setup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhaoJinming <[email protected]>
[ Upstream commit 8ab38bbac02298e3fb03008ed4a0227485c0fd62 ]
In ath11k_ahb_config_irq(), when a CE request_irq() fails, the function returns the error immediately without freeing the CE IRQs that were successfully registered in previous loop iterations. The probe error path does not call ath11k_ahb_free_irq() either, so the previously registered CE IRQ handlers remain attached to the interrupt lines and are never released.
In ath11k_ahb_config_ext_irq(), when an external request_irq() fails, the error is only logged and the loop continues. The function then returns 0 indicating success, leaving the device in a partially configured state where some external IRQs are not registered. This causes enable_irq()/disable_irq()/free_irq() to be called on unregistered IRQs during runtime and remove/shutdown, triggering WARN_ON(!desc->action), and missing interrupt handlers lead to data loss.
Additionally, if alloc_netdev_dummy() fails for a later IRQ group, the function returns -ENOMEM without freeing the ext IRQs and napi_ndev that were successfully set up for earlier groups.
Fix all three issues: propagate the error up to the caller and unwind all successfully registered IRQs and allocated resources on failure. Also move ab->irq_num[irq_idx] assignment after request_irq() succeeds in the ext IRQ path to match the CE IRQ path and avoid storing a stale IRQ number on failure.
--- drivers/net/wireless/ath/ath11k/ahb.c | 79 +++++++++++++++++++-------- 1 file changed, 55 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +55 -24
@@ -431,36 +431,44 @@ static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; } -static void ath11k_ahb_free_ext_irq (struct ath11k_base *ab) +static void ath11k_ahb_free_ext_irq_grp (struct ath11k_base *ab, +struct ath11k_ext_irq_grp *irq_grp) { -int i, j; - -for (i =0 ; i <ATH11K_EXT_IRQ_GRP_NUM_MAX ; i++) { -struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; +int j; -for (j =0 ; j < irq_grp->num_irq; j++) -free_irq (ab->irq_num[irq_grp->irqs[j]], irq_grp); +for (j =0 ; j < irq_grp->num_irq; j++) +free_irq (ab->irq_num[irq_grp->irqs[j]], irq_grp); -netif_napi_del (&irq_grp->napi); -free_netdev (irq_grp->napi_ndev); - } +netif_napi_del (&irq_grp->napi); +free_netdev (irq_grp->napi_ndev); } -static void ath11k_ahb_free_irq (struct ath11k_base *ab) +static void ath11k_ahb_free_ext_irq (struct ath11k_base *ab) { -int irq_idx;int i; -if (ab->hw_params.hybrid_bus_type) -return ath11k_pcic_free_irq (ab); +for (i =0 ; i <ATH11K_EXT_IRQ_GRP_NUM_MAX ; i++) +ath11k_ahb_free_ext_irq_grp (ab, &ab->ext_irq_grp[i]); +} -for (i =0 ; i < ab->hw_params.ce_count; i++) { +static void ath11k_ahb_free_ce_irqs (struct ath11k_base *ab,int max_idx) +{ +int irq_idx, i; + +for (i =0 ; i < max_idx; i++) {if (ath11k_ce_get_attr_flags (ab, i) &CE_ATTR_DIS_INTR )continue ; irq_idx =ATH11K_IRQ_CE0_OFFSET + i;free_irq (ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); } +} + +static void ath11k_ahb_free_irq (struct ath11k_base *ab) +{ +if (ab->hw_params.hybrid_bus_type) +return ath11k_pcic_free_irq (ab); +ath11k_ahb_free_ce_irqs (ab, ab->hw_params.ce_count);ath11k_ahb_free_ext_irq (ab); }
@@ -524,20 +532,25 @@ static irqreturn_t ath11k_ahb_ext_interrupt_handler(int irq, void *arg)static int ath11k_ahb_config_ext_irq (struct ath11k_base *ab) {struct ath11k_hw_params *hw = &ab->hw_params; +struct ath11k_ext_irq_grp *irq_grp;int i, j;int irq;int ret;for (i =0 ; i <ATH11K_EXT_IRQ_GRP_NUM_MAX ; i++) { -struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];u32 num_irq =0 ; + irq_grp = &ab->ext_irq_grp[i]; + irq_grp->ab = ab; irq_grp->grp_id = i; irq_grp->napi_ndev =alloc_netdev_dummy (0 ); -if (!irq_grp->napi_ndev) -return -ENOMEM ; +if (!irq_grp->napi_ndev) { + ret = -ENOMEM ; + irq_grp->num_irq =0 ; + goto err_request_irq; + }netif_napi_add (irq_grp->napi_ndev, &irq_grp->napi, ath11k_ahb_ext_grp_napi_poll);
@@ -585,14 +598,11 @@ static int ath11k_ahb_config_ext_irq(struct ath11k_base *ab) } } } - irq_grp->num_irq = num_irq; - -for (j =0 ; j < irq_grp->num_irq; j++) { +for (j =0 ; j < num_irq; j++) {int irq_idx = irq_grp->irqs[j]; irq =platform_get_irq_byname (ab->pdev, irq_name[irq_idx]); - ab->irq_num[irq_idx] = irq;irq_set_status_flags (irq,IRQ_NOAUTOEN |IRQ_DISABLE_UNLAZY ); ret = request_irq(irq, ath11k_ahb_ext_interrupt_handler, IRQF_TRIGGER_RISING,
@@ -600,11 +610,24 @@ static int ath11k_ahb_config_ext_irq(struct ath11k_base *ab)if (ret) {ath11k_err (ab,"failed request_irq for %d\n" , irq); + irq_grp->num_irq = j; +ath11k_ahb_free_ext_irq_grp (ab, irq_grp); + goto err_request_irq; } + ab->irq_num[irq_idx] = irq; } + + irq_grp->num_irq = num_irq; }return 0 ; + +err_request_irq: +for (i--; i >=0 ; i--) { + irq_grp = &ab->ext_irq_grp[i]; +ath11k_ahb_free_ext_irq_grp (ab, irq_grp); + } +return ret; }static int ath11k_ahb_config_irq (struct ath11k_base *ab)
@@ -629,16 +652,24 @@ static int ath11k_ahb_config_irq(struct ath11k_base *ab) ret =request_irq (irq, ath11k_ahb_ce_interrupt_handler,IRQF_TRIGGER_RISING , irq_name[irq_idx], ce_pipe); -if (ret) +if (ret) { +ath11k_err (ab,"failed request_irq for %d\n" , irq); +ath11k_ahb_free_ce_irqs (ab, i);return ret; + } ab->irq_num[irq_idx] = irq; }/* Configure external interrupts */ ret =ath11k_ahb_config_ext_irq (ab); +if (ret) { +ath11k_err (ab,"failed to configure ext irq: %d\n" , ret); +ath11k_ahb_free_ce_irqs (ab, ab->hw_params.ce_count); +return ret; + } -return ret; +return 0 ; } static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 305/1005 ASoC: SOF: Intel: mtl: Power down DSP if it is left enabled in pre_fw_run()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 31fd7a0bbfa4b7e8aff11f278e817664c6a5f68b ]
It is expected that the DSP is in power down state when the firmware boot is attempted.
If the DSP for any reason was left powered up then the DSP boot will fail since the ROM boot sequence might not be able to run.
Make sure that the DSP is off before proceeding to boot it up.
--- sound/soc/sof/intel/mtl.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
sound/soc/sof/intel/mtl.c +23 -0
@@ -236,6 +236,17 @@ int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable) }EXPORT_SYMBOL_NS (mtl_enable_interrupts,"SND_SOC_SOF_INTEL_MTL" ); +static bool mtl_dsp_is_enabled (struct snd_sof_dev *sdev) +{ +int val; + + val =snd_sof_dsp_read (sdev,HDA_DSP_BAR ,MTL_HFDSSCS ); +if (val &MTL_HFDSSCS_CPA_MASK ) +return true; + +return false; +} +/* pre fw run operations */ static int mtl_dsp_pre_fw_run (struct snd_sof_dev *sdev) {
@@ -249,6 +260,18 @@ static int mtl_dsp_pre_fw_run(struct snd_sof_dev *sdev)u32 dsppwrsts;const struct sof_intel_dsp_desc *chip; +/* Power down the DSP if it is left enabled to ensure clean boot state */ +if (mtl_dsp_is_enabled (sdev)) { +dev_dbg (sdev->dev,"powering down DSP first\n" ); + + ret =mtl_power_down_dsp (sdev); +if (ret <0 ) { +dev_warn (sdev->dev, +"%s: failed to power down already-enabled DSP\n" , __func__); +/* Continue anyway to attempt recovery */ + } + } + chip =get_chip_info (sdev->pdata);if (chip->hw_ip_version >SOF_INTEL_ACE_2_0 ) { dsppwrctl =PTL_HFPWRCTL2 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 306/1005 wifi: mt76: mt7615: fix NULL deref in mt7615_mac_set_rates
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 98aff74779da9f417386c589c36848e9c568f0f9 ]
mt7615_tx() falls back to the vif BSS wcid when mac80211 hands a frame over without a station, e.g. while a station is being torn down, and to the global wcid when there is no vif either. Both tx_prepare_skb implementations derive a mt7615_sta from that wcid unconditionally and, if the rate control probe flag is set, pass it to mt7615_mac_set_rates(), which dereferences the NULL vif backpointer of the per-vif embedded sta:
Unable to handle kernel read from unreadable memory at virtual address 0000000000000002 ... pc : mt7615_mac_set_rates lr : mt7615_tx_prepare_skb
Neither entry is rate controlled by mac80211: the embedded sta has an empty rate set, and for the global wcid the container_of does not yield a valid mt7615_sta at all. Only resolve the sta for wcids that belong to a station.
--- drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c | 5 +++-- drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c +3 -2
@@ -68,10 +68,11 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,int pid, id;u8 *txwi = (u8 *)txwi_ptr;struct mt76_txwi_cache *t; -struct mt7615_sta *msta; +struct mt7615_sta *msta =NULL ;void *txp; - msta = wcid ? container_of(wcid, struct mt7615_sta, wcid) : NULL; +if (wcid && wcid->sta) + msta = container_of(wcid, struct mt7615_sta, wcid);if (!wcid) wcid = &dev->mt76.global_wcid;
drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +3 -2
@@ -187,10 +187,11 @@ int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,struct sk_buff *skb = tx_info->skb;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_key_conf *key = info->control.hw_key; -struct mt7615_sta *msta; +struct mt7615_sta *msta =NULL ;int pad, err, pktid; - msta = wcid ? container_of(wcid, struct mt7615_sta, wcid) : NULL; +if (wcid && wcid->sta) + msta = container_of(wcid, struct mt7615_sta, wcid);if (!wcid) wcid = &dev->mt76.global_wcid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 307/1005 wifi: mt76: set the EOSP bit in the QoS header of the last released frame
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 0b8d2524716099ea4743fa65bc364f94b3106a31 ]
When the driver implements .release_buffered_frames, mac80211 leaves the U-APSD signalling entirely to the driver: "In this case it is also responsible for setting the EOSP flag in the QoS header of the frames" (include/net/mac80211.h). Only IEEE80211_TX_STATUS_EOSP was being set, which merely ends the service period inside mac80211, so on air the service period was never terminated. Clients that wait for EOSP before going back to doze keep the SP open and stop triggering, which stalls all downlink traffic for that station.
Set the wire EOSP bit on the last frame of a U-APSD service period. EOSP has no meaning for a PS-Poll response, so pass the release reason down and leave those frames alone.
--- drivers/net/wireless/mediatek/mt76/tx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/tx.c +12 -4
@@ -415,16 +415,23 @@ mt76_txq_dequeue(struct mt76_phy *phy, struct mt76_txq *mtxq)static void mt76_queue_ps_skb (struct mt76_phy *phy,struct ieee80211_sta *sta, -struct sk_buff *skb,bool last) +struct sk_buff *skb,bool last, +enum ieee80211_frame_release_type reason) {struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; info->control.flags |=IEEE80211_TX_CTRL_PS_RESPONSE ; -if (last) +if (last) { info->flags |=IEEE80211_TX_STATUS_EOSP |IEEE80211_TX_CTL_REQ_TX_STATUS ; +if (reason ==IEEE80211_FRAME_RELEASE_UAPSD && +ieee80211_is_data_qos (hdr->frame_control)) + *ieee80211_get_qos_ctl (hdr) |=IEEE80211_QOS_CTL_EOSP ; + } +mt76_skb_set_moredata (skb, !last);__mt76_tx_queue_skb (phy,MT_TXQ_PSD , skb, wcid, sta,NULL ); }
@@ -457,14 +464,15 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta, nframes--;if (last_skb) -mt76_queue_ps_skb (phy, sta, last_skb, false); +mt76_queue_ps_skb (phy, sta, last_skb, false, + reason); last_skb = skb; }while (nframes); }if (last_skb) { -mt76_queue_ps_skb (phy, sta, last_skb, true); +mt76_queue_ps_skb (phy, sta, last_skb, true, reason); dev->queue_ops->kick (dev, hwq); }else {ieee80211_sta_eosp (sta);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 308/1005 wifi: mt76: mt7603: fix U-APSD service period termination
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 697badc27a9b3b2a8d86092abeed767714f735a2 ]
Frames released from the driver PS queue were all tagged with MORE_DATA and none of them ever carried the EOSP bit, so from the client's point of view a U-APSD service period was started but never finished. Clients that keep their receiver on until EOSP arrives stop sending trigger frames, and all downlink traffic for that station stalls until they give up. ieee80211_sta_eosp() only cleared the service period state inside mac80211, which is why the mismatch went unnoticed.
Assign MORE_DATA per frame and set the wire EOSP bit on the last one. If the last released frame is a bufferable MMPDU it has no QoS control field to carry EOSP, so let mac80211 append a QoS-Null frame instead.
Also stop handing the remaining frame budget to mt76_release_buffered_frames() once frames have been released from the PS
queue: both would signal the end of the same service period. Releasing fewer frames than requested is allowed, and MORE_DATA tells the client to trigger again.
--- .../net/wireless/mediatek/mt76/mt7603/main.c | 74 ++++++++++++++++--- 1 file changed, 63 insertions(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7603/main.c +63 -11
@@ -423,13 +423,33 @@ mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)mt7603_ps_tx_list (dev, &list); } +static struct ieee80211_hdr * +mt7603_ps_skb_hdr (struct sk_buff *skb) +{ +return (struct ieee80211_hdr *)&skb->data[MT_TXD_SIZE ]; +} + +/* +* Buffered frames can be recycled into the PS queue by mt7603_filter_tx(), so +* both bits have to be assigned, not just set. +*/ static void -mt7603_ps_set_more_data (struct sk_buff *skb) +mt7603_ps_set_flags (struct sk_buff *skb,bool more_data,bool eosp) { -struct ieee80211_hdr *hdr; +struct ieee80211_hdr *hdr =mt7603_ps_skb_hdr (skb); + +if (more_data) + hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_MOREDATA ); +else + hdr->frame_control &= ~cpu_to_le16 (IEEE80211_FCTL_MOREDATA ); + +if (!ieee80211_is_data_qos (hdr->frame_control)) +return ; - hdr = (struct ieee80211_hdr *)&skb->data[MT_TXD_SIZE ]; - hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_MOREDATA ); +if (eosp) + *ieee80211_get_qos_ctl (hdr) |=IEEE80211_QOS_CTL_EOSP ; +else + *ieee80211_get_qos_ctl (hdr) &= ~IEEE80211_QOS_CTL_EOSP ; } static void
@@ -442,7 +462,10 @@ mt7603_release_buffered_frames(struct ieee80211_hw *hw,struct mt7603_dev *dev = hw->priv;struct mt7603_sta *msta = (struct mt7603_sta *)sta->drv_priv;struct sk_buff_head list; -struct sk_buff *skb, *tmp; +struct sk_buff *skb, *tmp, *last; +bool eosp_null, uapsd; +u16 pending =0 ; +u8 last_tid;__skb_queue_head_init (&list);
@@ -458,20 +481,49 @@ mt7603_release_buffered_frames(struct ieee80211_hw *hw,skb_set_queue_mapping (skb,MT_TXQ_PSD );__skb_unlink (skb, &msta->psq); -mt7603_ps_set_more_data (skb);__skb_queue_tail (&list, skb); nframes--; } + +skb_queue_walk (&msta->psq, skb) + pending |= BIT(skb->priority);spin_unlock_bh (&dev->ps_lock); -if (!skb_queue_empty (&list)) -ieee80211_sta_eosp (sta); + last =skb_peek_tail (&list); +if (!last) { +mt76_release_buffered_frames (hw, sta, tids, nframes, reason, + more_data); +return ; + } + +/* +* End the service period here instead of passing the remaining frame +* budget on to mt76_release_buffered_frames(), which would signal the +* end of the same service period a second time. +*/ + uapsd = reason ==IEEE80211_FRAME_RELEASE_UAPSD ; + more_data |= !!(pending & tids); + + skb_queue_walk(&list, skb) +mt7603_ps_set_flags (skb, skb != last || more_data, + skb == last && uapsd); + +/* +* EOSP lives in the QoS control field, so a bufferable MMPDU cannot +* terminate a U-APSD service period on its own. In that case mac80211 +* has to append a QoS-Null frame, which ends the SP through its tx +* status. +*/ + eosp_null = uapsd && + !ieee80211_is_data_qos (mt7603_ps_skb_hdr (last)->frame_control); + last_tid =__fls (tids);mt7603_ps_tx_list (dev, &list); -if (nframes) -mt76_release_buffered_frames (hw, sta, tids, nframes, reason, - more_data); +if (eosp_null) +ieee80211_send_eosp_nullfunc (sta, last_tid); +else +ieee80211_sta_eosp (sta); } static int
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 309/1005 wifi: mt76: mt7603: restore hardware PS buffering after a service period
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 636a883e2feef5e4ff95695d3c372ceff03960f5 ]
Releasing buffered frames has to turn off the PSE redirect for the station, otherwise the released frames are looped straight back into the driver PS queue. Nothing ever turns it back on: mt7603_sta_ps() only runs on an observed PM bit transition, and MT_WCID_FLAG_PS keeps mt76 from reporting the same state twice. After the first service period the hardware therefore treats a dozing station as awake and transmits at it directly, which is where the retry storms and the packet loss reported against U-APSD clients come from.
Re-arm hardware buffering from mt7603_mac_work() for every station that is still known to be asleep, once the PSD queue has drained and the released frames have passed the redirect stage. Frames that are still queued belong to the service period that was just served, so unlike on a sleep transition they must not be pulled back with mt7603_filter_tx().
Track the sleep state separately from the WTBL state, so a station that wakes up while the re-arm is pending is not put back to sleep.
--- .../net/wireless/mediatek/mt76/mt7603/mac.c | 73 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7603/main.c | 2 +- .../wireless/mediatek/mt76/mt7603/mt7603.h | 4 + 3 files changed, 72 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +67 -6
@@ -235,16 +235,17 @@ void mt7603_wtbl_set_smps(struct mt7603_dev *dev, struct mt7603_sta *sta, sta->smps = enabled; } -void mt7603_wtbl_set_ps (struct mt7603_dev *dev,struct mt7603_sta *sta, -bool enabled) +static void +__mt7603_wtbl_set_ps (struct mt7603_dev *dev,struct mt7603_sta *sta, +bool enabled,bool filter) {int idx = sta->wcid.idx;u32 addr; -spin_lock_bh (&dev->ps_lock); +lockdep_assert_held (&dev->ps_lock);if (sta->ps == enabled) - goto out; +return ; mt76_wr(dev, MT_PSE_RTA, FIELD_PREP(MT_PSE_RTA_TAG_ID, idx) |
@@ -255,7 +256,7 @@ void mt7603_wtbl_set_ps(struct mt7603_dev *dev, struct mt7603_sta *sta,mt76_poll (dev,MT_PSE_RTA ,MT_PSE_RTA_BUSY ,0 ,5000 ); -if (enabled) +if (enabled && filter)mt7603_filter_tx (dev, sta->vif->idx, idx, false); addr =mt7603_wtbl1_addr (idx);
@@ -264,8 +265,34 @@ void mt7603_wtbl_set_ps(struct mt7603_dev *dev, struct mt7603_sta *sta, enabled * MT_WTBL1_W3_POWER_SAVE);mt76_clear (dev,MT_WTBL1_OR ,MT_WTBL1_OR_PSM_WRITE ); sta->ps = enabled; +} -out: +void mt7603_wtbl_set_ps (struct mt7603_dev *dev,struct mt7603_sta *sta, +bool enabled) +{ +spin_lock_bh (&dev->ps_lock); +__mt7603_wtbl_set_ps (dev, sta, enabled, enabled); +spin_unlock_bh (&dev->ps_lock); +} + +void mt7603_wtbl_sta_ps (struct mt7603_dev *dev,struct mt7603_sta *sta,bool ps) +{ +spin_lock_bh (&dev->ps_lock); + sta->ps_sleeping = ps; +__mt7603_wtbl_set_ps (dev, sta, ps, ps); +spin_unlock_bh (&dev->ps_lock); +} + +void mt7603_wtbl_restore_ps (struct mt7603_dev *dev,struct mt7603_sta *sta) +{ +spin_lock_bh (&dev->ps_lock); +/* +* Frames that are already queued for the station belong to the service +* period that has just been served, so unlike on a sleep transition +* they must not be pulled back into the PS queue. +*/ +if (sta->ps_sleeping) +__mt7603_wtbl_set_ps (dev, sta, true, false);spin_unlock_bh (&dev->ps_lock); }
@@ -1816,6 +1843,39 @@ mt7603_false_cca_check(struct mt7603_dev *dev)mt7603_adjust_sensitivity (dev); } +/* +* Releasing buffered frames turns off the PSE redirect for a station, since +* the released frames would otherwise be looped back into the driver PS queue +* again. mac80211 never tells us when the service period is over, so hardware +* buffering has to be re-armed here for every station that is still known to +* be asleep. Waiting for the PSD queue to drain makes sure that the released +* frames have already passed the redirect stage. +*/ +static void +mt7603_mac_ps_check (struct mt7603_dev *dev) +{ +int i; + +if (dev->mphy.q_tx[MT_TXQ_PSD ]->queued) +return ; + +rcu_read_lock (); +for (i =0 ; i <MT7603_WTBL_STA ; i++) { +struct mt76_wcid *wcid =mt76_wcid_ptr (dev, i); +struct mt7603_sta *msta; + +if (!wcid || !wcid->sta) +continue ; + + msta = container_of(wcid, struct mt7603_sta, wcid); +if (msta->ps || !msta->ps_sleeping) +continue ; + +mt7603_wtbl_restore_ps (dev, msta); + } +rcu_read_unlock (); +} +void mt7603_mac_work (struct work_struct *work) { struct mt7603_dev *dev = container_of(work, struct mt7603_dev,
@@ -1830,6 +1890,7 @@ void mt7603_mac_work(struct work_struct *work) dev->mphy.mac_work_count++;mt76_update_survey (&dev->mphy);mt7603_edcca_check (dev); +mt7603_mac_ps_check (dev);for (i =0 , idx =0 ; i <2 ; i++) {u32 val =mt76_rr (dev,MT_TX_AGG_CNT (i));
drivers/net/wireless/mediatek/mt76/mt7603/main.c +1 -1
@@ -410,7 +410,7 @@ mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)struct sk_buff_head list;mt76_stop_tx_queues (&dev->mphy, sta, true); -mt7603_wtbl_set_ps (dev, msta, ps); +mt7603_wtbl_sta_ps (dev, msta, ps);if (ps)return ;
drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +4 -0
@@ -80,6 +80,7 @@ struct mt7603_sta {u8 smps;u8 ps; +u8 ps_sleeping; };struct mt7603_vif {
@@ -229,6 +230,9 @@ int mt7603_wtbl_set_key(struct mt7603_dev *dev, int wcid, struct ieee80211_key_conf *key);void mt7603_wtbl_set_ps (struct mt7603_dev *dev,struct mt7603_sta *sta,bool enabled); +void mt7603_wtbl_sta_ps (struct mt7603_dev *dev,struct mt7603_sta *sta, +bool ps); +void mt7603_wtbl_restore_ps (struct mt7603_dev *dev,struct mt7603_sta *sta);void mt7603_wtbl_set_smps (struct mt7603_dev *dev,struct mt7603_sta *sta,bool enabled);void mt7603_filter_tx (struct mt7603_dev *dev,int mac_idx,int idx,bool abort);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 310/1005 wifi: brcmfmac: Set DMA direction for msgbuf packet IDs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit f0ba5fd51ff23077ce66cb9be79d41a4b7c19c5e ]
brcmf_msgbuf_init_pktids() takes the DMA direction from its callers, but never stores it in the packet ID state. Since the state is zeroed, pktids->direction remains DMA_BIDIRECTIONAL for both the TX and RX packet ID pools.
All msgbuf packet ID map and unmap paths use pktids->direction. As a result, TX buffers requested with DMA_TO_DEVICE and RX buffers requested with DMA_FROM_DEVICE are mapped and unmapped as DMA_BIDIRECTIONAL instead.
Store the caller-provided direction when initializing the packet ID state.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -0
@@ -310,6 +310,7 @@ brcmf_msgbuf_init_pktids(u32 nr_array_entries, } pktids->array = array; pktids->array_size = nr_array_entries; + pktids->direction = direction;return pktids; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 311/1005 wifi: brcmfmac: validate msgbuf flowring IDs before use
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit 32856f39fefdc75bd253cab999f996750628648e ]
Firmware messages carry flow_ring_id values which brcmfmac converts to an internal flowid by subtracting BRCMF_H2D_MSGRING_FLOWRING_IDSTART. The resulting value is used as a bit index in txstatus_done_map and as an array index into msgbuf->flowrings and the flowring state.
Validate the firmware supplied flow_ring_id before using it. This prevents flow_ring_id values below BRCMF_H2D_MSGRING_FLOWRING_IDSTART from underflowing and rejects values outside msgbuf->max_flowrings.
In the tx status path, complete the packet with an error after removing a valid packet id so the skb is not leaked when the flow ring id is invalid.
--- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +40 -6
@@ -561,6 +561,28 @@ brcmf_msgbuf_remove_flowring(struct brcmf_msgbuf *msgbuf, u16 flowid)brcmf_flowring_delete (msgbuf->flow, flowid); } +static bool brcmf_msgbuf_get_flowid (struct brcmf_msgbuf *msgbuf, +u16 flow_ring_id,u16 *flowid) +{ +u32 id = flow_ring_id; + +if (id <BRCMF_H2D_MSGRING_FLOWRING_IDSTART ) { +bphy_err (msgbuf->drvr,"invalid flowring id %u\n" , + flow_ring_id); +return false; + } + + id -=BRCMF_H2D_MSGRING_FLOWRING_IDSTART ; +if (id >= msgbuf->max_flowrings) { +bphy_err (msgbuf->drvr,"invalid flowring id %u\n" , + flow_ring_id); +return false; + } + + *flowid = id; +return true; +} +static struct brcmf_msgbuf_work_item *brcmf_msgbuf_dequeue_work (struct brcmf_msgbuf *msgbuf)
@@ -881,17 +903,23 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf)struct msgbuf_tx_status *tx_status;u32 idx;struct sk_buff *skb; +u16 flow_ring_id;u16 flowid; tx_status = (struct msgbuf_tx_status *)buf; idx =le32_to_cpu (tx_status->msg.request_id) -1 ; - flowid =le16_to_cpu (tx_status->compl_hdr.flow_ring_id); - flowid -=BRCMF_H2D_MSGRING_FLOWRING_IDSTART ; + flow_ring_id =le16_to_cpu (tx_status->compl_hdr.flow_ring_id); skb =brcmf_msgbuf_get_pktid (msgbuf->drvr->bus_if->dev, msgbuf->tx_pktids, idx);if (!skb)return ; +if (!brcmf_msgbuf_get_flowid (msgbuf, flow_ring_id, &flowid)) { +brcmf_txfinalize (brcmf_get_ifp (msgbuf->drvr, tx_status->msg.ifidx), + skb, false); +return ; + } +set_bit (flowid, msgbuf->txstatus_done_map); commonring = msgbuf->flowrings[flowid];atomic_dec (&commonring->outstanding_tx);
@@ -1238,13 +1266,16 @@ brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,struct msgbuf_flowring_create_resp *flowring_create_resp;u16 status;u16 flowid; +u16 flow_ring_id; flowring_create_resp = (struct msgbuf_flowring_create_resp *)buf; - flowid =le16_to_cpu (flowring_create_resp->compl_hdr.flow_ring_id); - flowid -=BRCMF_H2D_MSGRING_FLOWRING_IDSTART ; + flow_ring_id =le16_to_cpu (flowring_create_resp->compl_hdr.flow_ring_id); status =le16_to_cpu (flowring_create_resp->compl_hdr.status); +if (!brcmf_msgbuf_get_flowid (msgbuf, flow_ring_id, &flowid)) +return ; +if (status) {bphy_err (drvr,"Flowring creation failed, code %d\n" , status);brcmf_msgbuf_remove_flowring (msgbuf, flowid);
@@ -1267,13 +1298,16 @@ brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,struct msgbuf_flowring_delete_resp *flowring_delete_resp;u16 status;u16 flowid; +u16 flow_ring_id; flowring_delete_resp = (struct msgbuf_flowring_delete_resp *)buf; - flowid =le16_to_cpu (flowring_delete_resp->compl_hdr.flow_ring_id); - flowid -=BRCMF_H2D_MSGRING_FLOWRING_IDSTART ; + flow_ring_id =le16_to_cpu (flowring_delete_resp->compl_hdr.flow_ring_id); status =le16_to_cpu (flowring_delete_resp->compl_hdr.status); +if (!brcmf_msgbuf_get_flowid (msgbuf, flow_ring_id, &flowid)) +return ; +if (status) {bphy_err (drvr,"Flowring deletion failed, code %d\n" , status);brcmf_flowring_delete (msgbuf->flow, flowid);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 312/1005 wifi: wilc1000: validate monitor transmit frame headers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mariano Baragiola <[email protected]>
[ Upstream commit 9d96e037ff90a2fc81a841b2002d500a5a4a5351 ]
wilc_wfi_mon_xmit() reads the radiotap length before ensuring that the fixed header is present. After stripping that header, it reads the frame type and all three 802.11 addresses without checking how much frame data remains.
A truncated monitor injection can therefore cause out-of-bounds reads. Validate the radiotap header first, use the common 802.11 helper to check the variable header length, and require a complete three-address header before using the addresses. This covers QoS and four-address data headers while rejecting short control headers that this path cannot classify.
--- drivers/net/wireless/microchip/wilc1000/mon.c | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/net/wireless/microchip/wilc1000/mon.c +25 -5
@@ -142,6 +142,9 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)static netdev_tx_t wilc_wfi_mon_xmit (struct sk_buff *skb,struct net_device *dev) { +struct ieee80211_radiotap_header_fixed *rtap_hdr; +struct ieee80211_hdr_3addr *hdr; +unsigned int hdr_len;u32 rtap_len, ret =0 ;struct wilc_wfi_mon_priv *mon_priv;struct sk_buff *skb2;
@@ -153,13 +156,26 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,if (!mon_priv)return -EFAULT ; +if (skb->len <sizeof (*rtap_hdr)) + goto drop; + + rtap_hdr = (void *)skb->data; +if (rtap_hdr->it_version) + goto drop; + rtap_len =ieee80211_get_radiotap_len (skb->data); -if (skb->len < rtap_len) -return -1 ; +if (rtap_len <sizeof (*rtap_hdr) || skb->len < rtap_len) + goto drop;skb_pull (skb, rtap_len); + hdr_len =ieee80211_get_hdrlen_from_skb (skb); +if (hdr_len <sizeof (*hdr)) + goto drop; -if (skb->data[0 ] ==0xc0 &&is_broadcast_ether_addr (&skb->data[4 ])) { + hdr = (void *)skb->data; + +if (ieee80211_is_deauth (hdr->frame_control) && +is_broadcast_ether_addr (hdr->addr1)) { skb2 =dev_alloc_skb (skb->len +sizeof (*cb_hdr));if (!skb2)return -ENOMEM ;
@@ -191,8 +207,8 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb, } skb->dev = mon_priv->real_ndev; -ether_addr_copy (srcadd, &skb->data[10 ]); -ether_addr_copy (bssid, &skb->data[16 ]); +ether_addr_copy (srcadd, hdr->addr2); +ether_addr_copy (bssid, hdr->addr3);/* * Identify if data or mgmt packet, if source address and bssid * fields are equal send it to mgmt frames handler
@@ -207,6 +223,10 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb, }return ret; + +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; }static const struct net_device_ops wilc_wfi_netdev_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 313/1005 ALSA: hda/realtek: Add quirk for ASUS VivoBook M515DA/X515DAP
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauricio Orozco <[email protected]>
[ Upstream commit a9fa2a016e805504223abf8c9b373ac9f7bfb9b3 ]
The ASUS VivoBook M515DA/X515DAP (subsystem ID 1043:1e3e) requires the ALC256_FIXUP_ASUS_MIC_NO_PRESENCE fixup to enable the internal microphone.
Without this quirk, the internal microphone captures only silence under Linux, while it works correctly under Windows.
The fix has been verified on real hardware.
Tested on an ASUS VivoBook M515DA/X515DAP running Linux Mint 22.3 with Ubuntu HWE kernel 7.0.0-28.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7196,6 +7196,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1264 ,"ASUS UM5606KA" ,ALC294_FIXUP_BASS_SPEAKER_15 ),SND_PCI_QUIRK (0x1043 ,0x1e02 ,"ASUS UX3402ZA" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1e10 ,"ASUS VivoBook X507UAR" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1043 ,0x1e3e ,"ASUS VivoBook M515DA/X515DAP" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1e11 ,"ASUS Zephyrus G15" ,ALC289_FIXUP_ASUS_GA502 ),SND_PCI_QUIRK (0x1043 ,0x1e12 ,"ASUS UM3402" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 314/1005 HID: logitech-hidpp: Add support for G502 X Plus USB mouse
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Hayhurst <[email protected]>
[ Upstream commit 6f4b44abe4ccdcfdab75c9493b8c7634fee37133 ]
The wireless dongle is already supported, this adds detection for the mouse in wired mode. Supports battery reporting.
--- drivers/hid/hid-logitech-hidpp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-logitech-hidpp.c +2 -0
@@ -4615,6 +4615,8 @@ static const struct hid_device_id hidpp_devices[] = { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC082) }, {/* Logitech G502 Lightspeed Wireless Gaming Mouse over USB */ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08D) }, + { /* Logitech G502 X Plus Wireless Gaming Mouse over USB */ + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC095) }, { /* Logitech G703 Gaming Mouse over USB */ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) }, { /* Logitech G703 Hero Gaming Mouse over USB */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 315/1005 HID: quirks: Add ALWAYS_POLL quirk for Beitong BTP-KP20D dongle
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <[email protected]>
[ Upstream commit bfff246b3a31cb45ec297ca5e2a77c1410b207ac ]
The BTP-KP20D dongle in Direct/HID mode (20dd:5159) re-enumerates every few seconds because usbhid never submits its interrupt-IN URB: no HID driver binds to the vendor-specific report descriptor, so the device is never opened, and the firmware treats the idle endpoint as a lost link.
Add HID_QUIRK_ALWAYS_POLL to keep the interrupt-IN URB submitted from probe time.
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -262,6 +262,9 @@#define USB_VENDOR_ID_BAANTO 0x2453#define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 +#define USB_VENDOR_ID_BEITONG 0x20dd +#define USB_DEVICE_ID_BEITONG_KP20D 0x5159 +#define USB_VENDOR_ID_BELKIN 0x050d#define USB_DEVICE_ID_FLIP_KVM 0x3201
drivers/hid/hid-quirks.c +1 -0
@@ -45,6 +45,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_BEITONG, USB_DEVICE_ID_BEITONG_KP20D), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 316/1005 HID: quirks: add ALWAYS_POLL quirk for AULA Mini 60 HE Pro Dongle
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuxiang Lin <[email protected]>
[ Upstream commit 2884e21b18613708f050ec75330b265dd07ecc03 ]
The AULA Mini 60 HE Pro wireless keyboard dongle (USB ID 0c45:fefe) becomes unresponsive after roughly one minute of idle. No error appears in dmesg; the only recovery is physically replugging the dongle.
This has been reproduced across kernels 6.8, 6.14 and 7.1.3.
Testing shows HID_QUIRK_ALWAYS_POLL alone resolves the issue, verified via usbhid.quirks=0x0c45:0xfefe:0x400.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -748,6 +748,7 @@#define USB_DEVICE_ID_JESS_YUREX 0x1010#define USB_DEVICE_ID_ASUS_MD_5112 0x5112#define USB_DEVICE_ID_REDRAGON_ASURA 0x760b +#define USB_DEVICE_ID_AULA_MINI_60_HE_PRO 0xfefe#define USB_VENDOR_ID_JESS2 0x0f30#define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111
drivers/hid/hid-quirks.c +2 -0
@@ -113,6 +113,8 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_1f4a), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_AULA_MINI_60_HE_PRO), + HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M506), HID_QUIRK_MULTI_INPUT },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 317/1005 HID: intel-ish-hid: ignore post-init ENUM_DEVICES from firmware
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wahid Khan <[email protected]>
[ Upstream commit f3f3f6df05226dfa220c4e603310dae94595060a ]
Some ISH firmware versions (observed on Tiger Lake LP, 8086:a0fc, GUID {33AECD58-B679-4E54-9BD9-A04D34F0C226}) periodically re-send an unsolicited HOSTIF_DM_ENUM_DEVICES response roughly every 79 seconds.
The current guard collapses two distinct cases into one condition:
if (!(response_flag) || init_done) -> bad packet + ish_hw_reset
This incorrectly treats a valid post-init firmware announcement as a corrupted packet, triggering an ISH soft-reset and a full ISHTP re-initialisation cycle on each occurrence (~1100 times per day on affected hardware).
Split the check: reject messages with no response flag as before, but simply discard valid ENUM_DEVICES messages that arrive after init is complete.
--- drivers/hid/intel-ish-hid/ishtp-hid-client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/intel-ish-hid/ishtp-hid-client.c +3 -2
@@ -113,8 +113,7 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,switch (recv_msg->hdr.command &CMD_MASK ) {case HOSTIF_DM_ENUM_DEVICES : -if ((!(recv_msg->hdr.command & ~CMD_MASK ) || - client_data->init_done)) { +if (!(recv_msg->hdr.command & ~CMD_MASK )) { ++client_data->bad_recv_cnt; report_bad_packet(hid_ishtp_cl, recv_msg, cur_pos,
@@ -122,6 +121,8 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,ish_hw_reset (ishtp_get_ishtp_device (hid_ishtp_cl));break ; } +if (client_data->init_done) +break ; client_data->hid_dev_count = (unsigned int )*payload;if (!client_data->hid_devices) client_data->hid_devices = devm_kcalloc(
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 318/1005 net/rds: dont use unpin_user_pages_dirty_lock() from atomic context
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
[ Upstream commit d100966325f782aa7775e5f0e8fb04f66f56308e ]
rds_rdma_free_op() and rds_atomic_free_op() are reached from the IB send completion path via
rds_ib_tasklet_fn_send()
rds_ib_send_cqe_handler()
rds_message_put()
rds_message_purge()
rds_rdma_free_op() / rds_atomic_free_op()which runs in tasklet (softirq) context. Both functions unpin the user pages of the op with unpin_user_pages_dirty_lock(), which uses set_page_dirty_lock() and thus may take the folio lock and sleep. Sleeping in softirq context is not allowed and can deadlock or crash.
Dirtying the pages with the non-sleeping set_page_dirty() instead would just trade one bug for another, as pointed out during review:
the pinned range can be file-backed. rds_pin_pages() pins with FOLL_LONGTERM, which refuses fs-dax but takes the page-cache pages of a MAP_SHARED file mapping just fine, and RDS does not restrict what memory the caller registers as an RDMA destination.
For a file-backed page, set_page_dirty() from a tasklet can take non-irq-safe filesystem locks (e.g. mapping->i_private_lock and inode->i_lock in block_dirty_folio()) and deadlock against the task it interrupted. Without the folio lock, it races with truncation clearing folio->mapping, which is the race set_page_dirty_lock() exists to close. The pre-pin_user_pages() version of this code dirtied pages that way from the tasklet, so that bug is older than the sleeping unpin.
The page dirtying therefore has to move to process context, not merely avoid the folio lock. When the final rds_message_put() runs in atomic context, rds_rdma_free_op() and rds_atomic_free_op() now leave the op's pages pinned and flag the op. Later, rds_message_put() hands the message to a work item that unpins the flagged ops' pages and frees the message from process context. Here, unpin_user_pages_dirty_lock() is safe outside the atomic context. Everything else keeps running in the caller's context exactly as
before: the rest of the purge - the zerocopy completion, the socket put and the MR reference drops - as well as RDMA writes, whose pages the remote side only reads and which unpin without dirtying, everything on rds_tcp, and final puts that already happen in process context (socket close, connection teardown).
Deferring only the unpin means the work item touches nothing but the pinned pages and the rds module's own memory: it cannot call back into a transport module, so it changes nothing about the transports' shutdown and unload ordering. rds_exit() drains any pending unpin work via destroy_workqueue(rds_wq) before the module goes away.
The Oracle UEK kernel avoids the sleeping unpin by calling set_page_dirty() directly from the tasklet, which is subject to the file-backed page problem above, so this deliberately does not follow UEK here.
--- net/rds/message.c | 26 +++++++++++++++++++++++++ net/rds/rdma.c | 49 ++++++++++++++++++++++++++++++++++++----------- net/rds/rds.h | 10 ++++++++++ 3 files changed, 74 insertions(+), 11 deletions(-)
net/rds/message.c +26 -0
@@ -180,6 +180,19 @@ static void rds_message_purge(struct rds_message *rm)kref_put (&rm->atomic.op_rdma_mr->r_kref, __rds_put_mr_final); } +static void rds_message_unpin_worker (struct work_struct *work) +{ + struct rds_message *rm = container_of(work, struct rds_message, + m_unpin_work); + +if (rm->rdma.op_unpin_deferred) +rds_rdma_op_unpin_pages (&rm->rdma); +if (rm->atomic.op_unpin_deferred) +rds_atomic_op_unpin_page (&rm->atomic); + +kfree (rm); +} +void rds_message_put (struct rds_message *rm) {rdsdebug ("put rm %p ref %d\n" , rm,refcount_read (&rm->m_refcount));
@@ -187,8 +200,21 @@ void rds_message_put(struct rds_message *rm)if (refcount_dec_and_test (&rm->m_refcount)) {BUG_ON (!list_empty (&rm->m_sock_item));BUG_ON (!list_empty (&rm->m_conn_item)); +rds_message_purge (rm); +/* A final put in atomic context cannot dirty the ops' +* user pages on unpin, so rds_rdma_free_op() and +* rds_atomic_free_op() deferred it. Finish the unpin, +* and the free, from process context. +*/ +if (rm->rdma.op_unpin_deferred || + rm->atomic.op_unpin_deferred) { +INIT_WORK (&rm->m_unpin_work, rds_message_unpin_worker); +queue_work (rds_wq, &rm->m_unpin_work); +return ; + } +kfree (rm); } }
net/rds/rdma.c +38 -11
73 lines not on this page · raw message
net/rds/rds.h +10 -0
@@ -424,6 +424,12 @@ struct rds_message {void *m_final_op; +/* Unpins the ops' user pages and frees the message from +* process context when the final put happens in atomic +* context: dirtying the pages on unpin can sleep. +*/ +struct work_struct m_unpin_work; + struct { struct rm_atomic_op { int op_type;
@@ -447,6 +453,7 @@ struct rds_message { unsigned int op_mapped:1; unsigned int op_silent:1; unsigned int op_active:1; + unsigned int op_unpin_deferred:1;struct scatterlist *op_sg;struct rds_notifier *op_notifier;
@@ -462,6 +469,7 @@ struct rds_message { unsigned int op_mapped:1; unsigned int op_silent:1; unsigned int op_active:1; + unsigned int op_unpin_deferred:1;unsigned int op_bytes;unsigned int op_nents;unsigned int op_count;
@@ -938,6 +946,8 @@ int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm, struct cmsghdr *cmsg);void rds_rdma_free_op (struct rm_rdma_op *ro);void rds_atomic_free_op (struct rm_atomic_op *ao); +void rds_rdma_op_unpin_pages (struct rm_rdma_op *ro); +void rds_atomic_op_unpin_page (struct rm_atomic_op *ao);void rds_rdma_send_complete (struct rds_message *rm,int wc_status);void rds_atomic_send_complete (struct rds_message *rm,int wc_status); int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 319/1005 net/rds: hold the socket while an rds_mr references it
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Håkon Bugge <[email protected]>
[ Upstream commit 9079adef042c1e7a6141dcdfd3041acd30607297 ]
Each rds_mr stores a bare back pointer to the socket that created it (mr->r_sock) but takes no reference on it. When the mr is destroyed it references the rs. Hence, provisions must be made to avoid the rs being destroyed before all mrs referencing it have been destroyed.
The MR itself is refcounted, and in-flight messages legitimately hold MR krefs that can outlive the socket: rds_release() drops the rb-tree references via rds_rdma_drop_keys(), but a send completion arriving afterwards drops the final message reference from the CQ handler and ends up in
rds_message_purge()
__rds_put_mr_final()
rds_destroy_mr() -> takes rs->rs_rdma_lockdereferencing a socket that may already have been freed.
Oracle UEK fixed the same use-after-free ("rds: Add proper refcnt when an RDS MR references an RDS Socket") after seeing crashes of the form:
PF: supervisor write access in kernel mode
_raw_spin_lock_irqsave+0x4a/0x6a __rds_put_mr_final+0x2c/0xe0 [rds] rds_message_purge+0x13c/0x150 [rds] rds_message_put+0x39/0x54 [rds] rds_ib_send_cqe_handler+0x147/0x3dd [rds_rdma]
To fix this, take a socket reference when an MR is created and drop it when the final MR kref goes away. The reference cycle is broken by rds_release(), which always runs rds_rdma_drop_keys() on close. So the socket reference held by an MR never prevents release, it only delays sk_free() until the last MR user is done.
The hold sits next to kref_init() at both allocation sites - __rds_rdma_map() and the on-demand-paging path in rds_cmsg_rdma_args() - so every MR owns exactly one socket reference from the moment it becomes kref-managed. For that to work on the ODP path, its get_mr() error handling is converted from a bare kfree() to kref_put(..., __rds_put_mr_final), with r_trans_private cleared first since it holds an ERR_PTR there; both sites then tear down through the same path and a future error-path change cannot silently leak or double-drop the reference.
[achender: port to net-next (sock_hold/sock_put in place of the UEK
rds_sock_addref/rds_sock_put helpers); also balance the reference on the rds_cmsg_rdma_args() ODP path and unify its error path with __rds_put_mr_final(); update commit message]
--- net/rds/rdma.c | 14 +++++++++++++- net/rds/rds.h | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-)
net/rds/rdma.c +13 -1
@@ -117,6 +117,7 @@ void __rds_put_mr_final(struct kref *kref) struct rds_mr *mr = container_of(kref, struct rds_mr, r_kref);rds_destroy_mr (mr); +sock_put (rds_rs_to_sk (mr->r_sock));kfree (mr); }
@@ -243,7 +244,11 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,kref_init (&mr->r_kref);RB_CLEAR_NODE (&mr->r_rb_node); mr->r_trans = rs->rs_transport; +/* The MR can outlive its socket: a socket reference is held +* until the final kref is dropped in __rds_put_mr_final(). +*/ mr->r_sock = rs; +sock_hold (rds_rs_to_sk (rs));if (args->flags &RDS_RDMA_USE_ONCE ) mr->r_use_once =1 ;
@@ -762,7 +767,12 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,RB_CLEAR_NODE (&local_odp_mr->r_rb_node);kref_init (&local_odp_mr->r_kref); local_odp_mr->r_trans = rs->rs_transport; +/* The MR can outlive its socket: a socket +* reference is held until the final kref is +* dropped in __rds_put_mr_final(). +*/ local_odp_mr->r_sock = rs; +sock_hold (rds_rs_to_sk (rs)); local_odp_mr->r_trans_private = rs->rs_transport->get_mr( NULL, 0, rs, &local_odp_mr->r_key, NULL,
@@ -771,7 +781,9 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, ret =PTR_ERR (local_odp_mr->r_trans_private);rdsdebug ("get_mr ret %d %p\"" , ret, local_odp_mr->r_trans_private); -kfree (local_odp_mr); + local_odp_mr->r_trans_private =NULL ; +kref_put (&local_odp_mr->r_kref, + __rds_put_mr_final); ret = -EOPNOTSUPP ; goto out_pages; }
net/rds/rds.h +4 -1
@@ -299,7 +299,10 @@ struct rds_mr { unsigned int r_invalidate:1; unsigned int r_write:1; -struct rds_sock *r_sock;/* back pointer to the socket that owns us */ +struct rds_sock *r_sock;/* socket that owns us; counted +* reference, dropped by +* __rds_put_mr_final() +*/ struct rds_transport *r_trans;void *r_trans_private; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 320/1005 net/rds: fix rds_message leak in the rds_send_xmit() drop path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sharath Srinivasan <[email protected]>
[ Upstream commit eb8a59a17f4a8b6f2afb4a8063e99dd96cc3fab0 ]
When rds_send_xmit() picks the next message off cp_send_queue it takes its own reference with rds_message_addref(). If the message then hits the never-retransmit check (RDS_MSG_FLUSH, or an RDMA op that was already retransmitted), it is moved to the local to_be_dropped list and that reference is dropped after the batch.
However, if RDS_MSG_ON_CONN has already been cleared, the message is not added to to_be_dropped and the reference taken above is never
dropped: cp_xmit_rm has not been set at this point, so the loop simply abandons rm and the rds_message (and everything it pins: pages, MRs, notifiers) leaks after an RDMA error.
The only other places that clear RDS_MSG_ON_CONN are rds_send_path_drop_acked() and rds_send_drop_to(), and both can run while rds_send_xmit() has dropped cp_lock between moving the message to cp_retrans and re-taking the lock in the never-retransmit check:rds_send_path_drop_acked() can ack away a message that already sat on cp_retrans - the RDS_MSG_RETRANSMITTED case above - and rds_send_drop_to() runs on socket close. Both unlink the message under cp_lock and put their own reference, leaving the xmit-path reference stranded.
Drop the reference directly in that case.
This mirrors Oracle UEK commit "net/rds: fix rds_message memleak in rds_send_xmit".
--- net/rds/send.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
net/rds/send.c +15 -3
@@ -288,9 +288,21 @@ int rds_send_xmit(struct rds_conn_path *cp) (rm->rdma.op_active && test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags))) {spin_lock_irqsave (&cp->cp_lock, flags); -if (test_and_clear_bit (RDS_MSG_ON_CONN , &rm->m_flags)) -list_move (&rm->m_conn_item, &to_be_dropped); -spin_unlock_irqrestore (&cp->cp_lock, flags); +if (test_and_clear_bit (RDS_MSG_ON_CONN , + &rm->m_flags)) { +/* our ref is put after the batch */ +list_move (&rm->m_conn_item, + &to_be_dropped); +spin_unlock_irqrestore (&cp->cp_lock, + flags); + }else { +/* already off the conn list; drop +* the ref taken above ourselves +*/ +spin_unlock_irqrestore (&cp->cp_lock, + flags); +rds_message_put (rm); + }continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 321/1005 net/rds: unpin MR pages with unpin_user_pages_dirty_lock()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
[ Upstream commit a507023e6ff1d0b4e7aac49b2f547fed0c21ea4e ]
The pages backing an RDS memory region are pinned in __rds_rdma_map() with rds_pin_pages(), which uses pin_user_pages_fast(): each page's refcount is biased by GUP_PIN_COUNTING_BIAS to account the pin. The scatterlist is then handed to the IB transport, and the transport releases the pages in __rds_ib_teardown_mr() with
set_page_dirty(page); put_page(page);
put_page() drops a single reference instead of removing the pin bias, so every MR teardown permanently strands the remaining references and the pages are never freed - a userspace-triggerable memory leak of up to RDS_MAX_MSG_SIZE per RDS_GET_MR/RDS_GET_MR_FOR_DEST call.
The conversion to the pin API updated the unpin sites in rdma.c but missed this one on the transport side. Release the pages with unpin_user_pages_dirty_lock(), which removes the pin bias and also dirties the page under the folio lock, closing the truncation race that a bare set_page_dirty() leaves open.
Dirtying under the folio lock can sleep, which is safe in every path that reaches __rds_ib_teardown_mr(): the registration-reuse path (rds_ib_map_frmr()) runs in syscall context, and the pool flush (rds_ib_unreg_frmr()) runs under pool->flush_lock, a mutex, and already sleeps in rds_ib_post_inv(). The WARN_ON that guarded the old irq-context set_page_dirty() case is dropped along with it.
--- net/rds/ib_rdma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/rds/ib_rdma.c +1 -3
@@ -251,9 +251,7 @@ void __rds_ib_teardown_mr(struct rds_ib_mr *ibmr)/* FIXME we need a way to tell a r/w MR * from a r/o MR */ -WARN_ON (!page->mapping &&irqs_disabled ()); -set_page_dirty (page); -put_page (page); +unpin_user_pages_dirty_lock (&page,1 , true); }kfree (ibmr->sg);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 322/1005 kconfig: abort rather than loop for ever on EOF
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Glass <[email protected]>
[ Upstream commit f915149f5cfbd0d4406ec0b0f57b1d2c8685ae55 ]
When a non-interactive 'make oldconfig' or 'syncconfig' meets a new int or hex symbol whose default cannot be applied, conf_string() reads a value from stdin. At end of file fgets() returns NULL, no value is set and the loop asks again. The result is an endless loop which fills the output until it exhausts memory, rather than a clean failure.
Detect this in conf_string(): if the value cannot be set and stdin is at end of file, stop with an error that names the symbol.
Note that a symbol with no default doesn't trigger this, since sym_calc_value() falls back to 0, which is accepted at end of file. The loop is triggered by a broken Kconfig file, with a default whose text fails sym_string_valid().
Such mistakes do creep in from time to time and are hard to debug, since the build fills the log with repeated prompts instead of pointing at the offending symbol. Some bad defaults draw a parse-time warning, but menu_validate_number() accepts a reference to any int or hex symbol, so a cross-type reference loops with no warning at all. For example, "0xff" is not a valid int value:
config HEXSYM
hex
default 0xff config VAL
int "Value"
default HEXSYM
Interactive use is unaffected, since feof() only becomes true once a read actually hits end of file: an invalid answer at a terminal still re-prompts, while Ctrl-D at such a prompt exits with the error instead of looping. bool and tristate symbols and choices already accept the default on an empty line, so they still take their defaults in a non-interactive build.
Tested with int and hex symbols carrying such defaults: with empty stdin, the code without this change produces around 190MB of repeated prompts within two seconds, while with the change it exits 1 naming the symbol. Piped and interactive (pty) sessions still re-prompt on an invalid answer and then accept a valid one. A new string symbol with no default still takes the empty string at end of file, since any text is valid for a string.
--- scripts/kconfig/conf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
scripts/kconfig/conf.c +17 -0
@@ -348,6 +348,23 @@ static int conf_string(struct menu *menu) }if (def &&sym_set_string_value (sym, def))return 0 ; + +/* +* A new int or hex symbol whose default fails validation +* cannot be set from an empty answer. When standard input is +* exhausted, as it is for a non-interactive oldconfig or +* syncconfig, re-asking would loop forever and grow the output +* until it exhausts memory. Stop with an error that names the +* symbol instead. String symbols accept any text, and bool and +* tristate symbols (conf_sym()) and choices (conf_choice()) +* accept the default on an empty line, so they are unaffected. +*/ +if (feof (stdin)) { +fprintf (stderr, +"\nerror: no value for new symbol '%s' at end of input\n" , + sym->name); +exit (1 ); + } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 323/1005 s390/dasd: Snapshot intrc before freeing the request block
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
[ Upstream commit dc3e3f7306cb74066f231251602b1be5aaec7bd8 ]
__dasd_cleanup_cqr() maps the completion result to a block status by reading cqr->intrc, but only after discipline->free_cp() has returned the request block to its memory pool (dasd_eckd_free_cp() ends in dasd_sfree_request()). On SMP another CPU can reallocate that block and overwrite cqr->intrc before it is read, completing the request with the wrong error. proc_bytes is already snapshotted before free_cp() for the same reason; do the same for intrc.
--- drivers/s390/block/dasd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/s390/block/dasd.c +8 -2
@@ -2736,17 +2736,23 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr)struct request *req;blk_status_t error =BLK_STS_OK ;unsigned int proc_bytes; -int status; +int status, intrc; req = (struct request *) cqr->callback_data;dasd_profile_end (cqr->block, cqr, req); +/* +* free_cp() returns the request block to its memory pool, so snapshot +* everything still needed from cqr before calling it - another CPU can +* reallocate and overwrite the block right after. +*/ proc_bytes = cqr->proc_bytes; + intrc = cqr->intrc; status = cqr->block->base->discipline->free_cp (cqr, req);if (status <0 ) error =errno_to_blk_status (status);else if (status ==0 ) { -switch (cqr->intrc) { +switch (intrc) {case -EPERM :/* * DASD doesn't implement SCSI/NVMe reservations, but it
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 324/1005 ALSA: hda/realtek: Add mute LED support for HP Pavilion 15-eh2xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Castaldini <[email protected]>
[ Upstream commit daf55a381dca9bda12cc8c3a47605698f2d560e9 ]
Add the subsystem ID 103c:8a0e to the ALC287 HP GPIO LED quirk table so the mute LED follows the speaker mute state.
Tested on HP Pavilion Laptop 15-eh2xxx with ALC287 codec. The mute LED now follows the speaker mute state.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6881,6 +6881,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x89e7 ,"HP Elite x2 G9" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8a05 ,"HP Dragonfly Folio G3 2-in-1" ,ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8a06 ,"HP Dragonfly Folio G3 2-in-1" ,ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8a0e ,"HP Pavilion Laptop 15-eh2xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8a0f ,"HP Pavilion 14-ec1xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8a1b ,"HP 255 15.6 inch G9 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), SND_PCI_QUIRK(0x103c, 0x8a1f, "HP Laptop 14s-dr5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 325/1005 ACPI: video: force native backlight on Acer Nitro AN515-46
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcos Paulo Medeiros <[email protected]>
[ Upstream commit 525ba51157ac6e1772b5412eae26b20dd7ef8bda ]
The Acer Nitro AN515-46 is a hybrid graphics laptop whose internal panel is driven by the AMD GPU (Radeon 680M); the discrete NVIDIA GPU only drives external outputs. The firmware nevertheless advertises the NVIDIA WMI EC backlight GUID, so the backlight type resolves to nvidia_wmi_ec. The nvidia-wmi-ec-backlight driver however fails to probe ("EC backlight control failed: AE_NOT_FOUND") and, since the backlight type is still nvidia_wmi_ec, amdgpu skips registering its own backlight device. The result is no backlight device at all, leaving the brightness keys and the desktop brightness slider non-functional.
Booting with acpi_backlight=native makes amdgpu register its backlight interface and brightness control works. Add a DMI quirk to use the native backlight on this model by default.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -917,6 +917,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-n0xxx"), }, }, + { + .callback = video_detect_force_native, + /* Acer Nitro AN515-46 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Nitro AN515-46"), + }, + },/* * x86 android tablets which directly control the backlight through
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 326/1005 wifi: mt76: mt7603: file buffered frames under the TID reported to mac80211
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 0bbd6c52dfff62b319963f54cd9370f9486e59d2 ]
The PS queue filed redirected frames under the TID taken from the TXD, while mac80211 was told about the TID taken from the QoS header, or TID 0 for anything that is not a QoS data frame. When the two disagree, mt7603_release_buffered_frames() skips the frame because it does not match the requested TIDs, so it stays in the PS queue until the station wakes up. Buffered MMPDUs hit this whenever they were sent on a non-zero TID.
Use one TID for both.
--- drivers/net/wireless/mediatek/mt76/mt7603/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7603/dma.c +1 -1
@@ -39,7 +39,6 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb) val =le32_to_cpu (txd[1 ]); idx =FIELD_GET (MT_TXD1_WLAN_IDX , val); - skb->priority =FIELD_GET (MT_TXD1_TID , val);if (idx >=MT7603_WTBL_STA -1 ) goto free;
@@ -72,6 +71,7 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb) hwq =MT_TX_HW_QUEUE_MGMT ; } + skb->priority = tid;ieee80211_sta_set_buffered (sta, tid, true); val =le32_to_cpu (txd[0 ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 327/1005 net: stmmac: raise TX completion interrupt at the end of an xmit burst
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Alvarado <[email protected]>
[ Upstream commit d21a374995df9d7cfd193427748a19dcc87956a9 ]
The TX mitigation logic only sets the Interrupt on Completion bit once every tx_coal_frames descriptors (STMMAC_TX_FRAMES = 25), with the tx_coal_timer hrtimer (STMMAC_COAL_TX_TIMER = 5000 us) as the only fallback. TX skbs are freed exclusively from the TX completion path, so any flow that keeps fewer than 25 frames in flight has all of its skbs held for up to 5 ms after transmission.
Paced flows never queue enough frames to reach the frame threshold:
TCP Small Queues caps the amount of unfreed data at roughly two pacing intervals worth, which at moderate pacing rates is only a couple of packets. Every small burst then stalls until the coalesce timer fires, and throughput collapses to approximately tsq_limit / tx_coal_timer regardless of link capacity.
This is easily reproducible with BBR, which paces its output and thus keeps only a few frames in flight at a time. On a YT6801 (dwmac-motorcomm) equipped Orange Pi 5 Pro, a BBR upload over a ~23 ms RTT path is capped at 5.24 Mbit/s, while CUBIC reaches 207 Mbit/s on the same path. BBR measures the stalled send rate as the path bandwidth and locks its estimate near the floor, so the connection never recovers. Lowering the coalesce settings with ethtool -C (tx-usecs 100 tx-frames 1) lifts the same transfer to 447 Mbit/s, confirming the mechanism.
Fix this by setting the IC bit on the last descriptor of every xmit burst, i.e. whenever netdev_xmit_more() reports that no further frames are pending in the current dequeue batch. Frame-based coalescing still applies within a burst, bulk traffic keeps batching through qdisc bulk dequeue and NAPI polling, and the coalesce timer becomes a pure fallback instead of the primary completion mechanism for lightly queued flows.
tx-frames 0 keeps its meaning of timer-based mitigation only.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -0
@@ -4400,6 +4400,8 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) set_ic = true; else if (!priv->tx_coal_frames[queue]) set_ic = false; + else if (!netdev_xmit_more()) + set_ic = true; else if (tx_packets > priv->tx_coal_frames[queue]) set_ic = true; else if ((tx_q->tx_count_frames %
@@ -4687,6 +4689,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) set_ic = true; else if (!priv->tx_coal_frames[queue]) set_ic = false; + else if (!netdev_xmit_more()) + set_ic = true; else if (tx_packets > priv->tx_coal_frames[queue]) set_ic = true; else if ((tx_q->tx_count_frames %
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 328/1005 net: usb: cdc_ether: add quirk for AMI BMC stale link events
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinhui Guo <[email protected]>
[ Upstream commit 089ca284afb0f3b2870a5ce41524cbc91ed350d4 ]
On AMD Genoa/Turin platforms the BMC-provided USB-Ethernet gadget (American Megatrends, VID 0x046b PID 0xffb0) intermittently fails to respond to ARP after AC cold boot. usbmon captures a stale NETWORK_CONNECTION(off) immediately followed by NETWORK_CONNECTION(on) on the interrupt endpoint (~130us apart) after enumeration. Because alloc_netdev() leaves __LINK_STATE_NOCARRIER cleared, netif_carrier_ok() returns true when the spurious OFF arrives, so usbnet_cdc_status() cannot recognise it as redundant and schedules EVENT_LINK_CHANGE. __handle_link_change() then calls unlink_urbs(), killing ~60 rx URBs whose payload has already been DMA'd into memory — xHCI trace confirms them completing as -ECONNRESET with non-zero residual length. rx_complete() drops these unconditionally. The following ON restores the carrier and re-submits URBs, but the ARP reply is already lost; the interface looks "up but silent" until ifdown/ifup.
Fix this by adding a device-specific quirk with FLAG_LINK_INTR set, which makes usbnet_probe() call netif_carrier_off() after bind. With initial carrier == OFF, usbnet_cdc_status() recognises the spurious OFF as matching the current state and drops it; the subsequent ON is the first real event and brings the link up cleanly without ever tearing down the rx queue. The scheduled link-change kevent is harmless because EVENT_DEV_OPEN is not yet set at probe time.
This is applied as a device-specific quirk rather than a change to the shared cdc_info driver_info because some CDC devices never send NETWORK_CONNECTION notifications; forcing carrier off for them would leave the link permanently DOWN. Restricting the change to this VID/PID keeps that class of device untouched.
Tested on Genoa and Turin across 100+ AC cold boot cycles; ping first-packet success rate went from intermittent to 100%.
--- drivers/net/usb/cdc_ether.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/usb/cdc_ether.c +16 -0
@@ -532,6 +532,16 @@ static const struct driver_info cdc_info = { .manage_power = usbnet_manage_power, }; +static const struct driver_info ami_bmc_info = { + .description ="AMI BMC USB Ethernet" , + .flags =FLAG_ETHER |FLAG_POINTTOPOINT |FLAG_LINK_INTR , + .bind = usbnet_cdc_bind, + .unbind = usbnet_cdc_unbind, + .status = usbnet_cdc_status, + .set_rx_mode = usbnet_cdc_update_filter, + .manage_power = usbnet_manage_power, +}; +static const struct driver_info zte_cdc_info = { .description ="ZTE CDC Ethernet Device" , .flags =FLAG_ETHER |FLAG_POINTTOPOINT ,
@@ -940,6 +950,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&wwan_info, +}, { +/* AMI BMC gadget */ +USB_DEVICE_AND_INTERFACE_INFO (0x046b ,0xffb0 ,USB_CLASS_COMM , +USB_CDC_SUBCLASS_ETHERNET , + USB_CDC_PROTO_NONE), + .driver_info = (unsigned long )&ami_bmc_info, }, {USB_INTERFACE_INFO (USB_CLASS_COMM ,USB_CDC_SUBCLASS_ETHERNET , USB_CDC_PROTO_NONE),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 329/1005 xsk: account ring allocations to memcg
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <[email protected]>
[ Upstream commit b0057c68df711bf6a62033c072ac61c4f9d3cbc1 ]
AF_XDP rings are allocated from setsockopt() and can be mapped into user space. The shared xskq_create() helper allocates the ring backing memory, but the user-controlled and long-lived allocation is not charged as kmem to the allocating memory cgroup.
The current implementation uses vmalloc_user(), which allocates the backing pages with GFP_KERNEL | __GFP_ZERO. Use the same VM_USERMAP vmalloc path, but pass GFP_KERNEL_ACCOUNT so the ring backing pages are attributed to memcg/kmem and can be constrained by existing cgroup memory limits. This keeps the existing zeroing and mmap semantics while avoiding AF_XDP-specific optmem or RLIMIT_MEMLOCK accounting.
--- net/xdp/xsk_queue.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/xdp/xsk_queue.c +11 -1
@@ -9,6 +9,8 @@#include <linux/vmalloc.h> #include <net/xdp_sock_drv.h> +#include <asm/shmparam.h> +#include "xsk_queue.h" static size_t xskq_get_ring_size (struct xsk_queue *q,bool umem_queue)
@@ -21,6 +23,14 @@ static size_t xskq_get_ring_size(struct xsk_queue *q, bool umem_queue)return struct_size (rxtx_ring, desc, q->nentries); } +static void *xskq_vmalloc_user (unsigned long size) +{ +return __vmalloc_node_range (size,SHMLBA ,VMALLOC_START ,VMALLOC_END , +GFP_KERNEL_ACCOUNT | __GFP_ZERO,PAGE_KERNEL , +VM_USERMAP ,NUMA_NO_NODE , +__builtin_return_address (0 )); +} +struct xsk_queue *xskq_create (u32 nentries,bool umem_queue) {struct xsk_queue *q;
@@ -46,7 +56,7 @@ struct xsk_queue *xskq_create(u32 nentries, bool umem_queue) size =PAGE_ALIGN (size); - q->ring =vmalloc_user (size); + q->ring =xskq_vmalloc_user (size);if (!q->ring) {kfree (q);return NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 330/1005 ALSA: hda/realtek: Enable mute LED on HP Laptop 15-dy0xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carl Quist <[email protected]>
[ Upstream commit eb2b516900f2cff6c931a0d664a625ee93855779 ]
The mute LED on the HP Laptop 15-dy0xxx (PCI SSID 103c:864f, Realtek ALC236) does not work, because the machine has no entry in the quirk table. No fixup is applied, so no mute LED classdev is registered and nothing ever drives the LED.
The LED is controlled by COEF index 0x07, bit 0. This was verified on the hardware with hda-verb: setting the bit lights the mute LED and clearing it turns the LED off.
hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x07
hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x1 # LED on
hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x200 # LED off
That is exactly what ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 configures, and the closely related HP Laptop 15-dw0xxx (103c:85f0) already uses it. Bit 9 (0x200) is set by default on this board and is preserved by the fixup's read-modify-write.
Tested on an HP Laptop 15-dy0xxx (SKU 7FU54UA#ABA, board 864F, BIOS F.40).
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -6772,6 +6772,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x860c ,"HP ZBook 17 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), +SND_PCI_QUIRK (0x103c ,0x864f ,"HP Laptop 15-dy0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x869d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 331/1005 ALSA: hda/realtek: Limit mic boost on Positivo N15RPE-S
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edson Juliano Drosdeck <[email protected]>
[ Upstream commit 253010acfc8ad908446347b30a613032d1517bb5 ]
The internal mic boost on the Positivo N15RPE-S is too high.
Fix this by applying the ALC269_FIXUP_LIMIT_INT_MIC_BOOST fixup to the machine to limit the gain.
--- sound/hda/codecs/realtek/alc269.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/codecs/realtek/alc269.c +1 -0
@@ -7646,6 +7646,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x2782 ,0x1705 ,"MEDION E15433" ,ALC269VC_FIXUP_INFINIX_Y4_MAX ),SND_PCI_QUIRK (0x2782 ,0x1707 ,"Vaio VJFE-ADL" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x2782 ,0x4900 ,"MEDION E15443" ,ALC233_FIXUP_MEDION_MTL_SPK ), +SND_PCI_QUIRK (0x2782 ,0xa128 ,"Positivo N15RPE-S" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ),SND_PCI_QUIRK (0x2782 ,0xa212 ,"Lunnen Ground 14" ,ALC269VC_FIXUP_LUNNEN_GROUND_14 ),SND_PCI_QUIRK (0x7017 ,0x2014 ,"Star Labs StarFighter" ,ALC233_FIXUP_STARLABS_STARFIGHTER ), SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 332/1005 opp: Use clk_get_optional() to avoid leaving opp_table->clk as an error pointer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Praveen Talari <[email protected]>
[ Upstream commit 84f05af0975c9f9c8ffee0361d6f7cbb1f289231 ]
_update_opp_table_clk() uses clk_get(dev, NULL) to acquire the device's clock. On platforms where the perf domain device has no Linux clock and is instead managed entirely by firmware via devm_pm_opp_of_add_table() (through of_genpd_add_provider_simple()/onecell()), clk_get() returns -ENOENT. That case is treated as valid (the OPP table can still have entries sourced from firmware), but opp_table->clk is left holding ERR_PTR(-ENOENT) rather than being reset to NULL:
opp_table->clk = clk_get(dev, NULL);
ret = PTR_ERR_OR_ZERO(opp_table->clk);
...
if (ret == -ENOENT) {
opp_table->clk_count = 1;
return opp_table; /* opp_table->clk is still ERR_PTR(-ENOENT) */
}Consumers that only check IS_ERR(opp_table->clk) treat this as a valid clk and pass it straight into the clk consumer API. In particular, dev_pm_opp_set_rate() calls clk_round_rate(opp_table->clk, target_freq), and clk_round_rate() only guards against a NULL clk, so it dereferences the error pointer to read clk->exclusive_count and crashes:
Unable to handle kernel NULL pointer dereference at virtual address 000000000000002e ... pc : clk_round_rate+0x3c/0x188 ... Call trace: clk_round_rate+0x3c/0x188 (P) dev_pm_opp_set_rate+0x114/0x33c
Rather than teaching every clk consumer API to special-case ERR_PTR(-ENOENT), fix it at the source: use clk_get_optional() instead of clk_get() in _update_opp_table_clk(), which already translates -ENOENT into a NULL clk. This documents that the clock is genuinely optional for such devices, and keeps opp_table->clk holding either a valid clk or NULL, never a lingering -ENOENT error pointer. _opp_config_clk_single() is only wired up via opp_table->config_clks when a clk was actually found, and every other opp_table->clk consumer already tolerates NULL through the standard clk API (which treats a NULL clk as a no-op), so no other call site needs to change.
--- drivers/opp/core.c | 54 +++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 30 deletions(-)
drivers/opp/core.c +24 -30
@@ -1579,8 +1579,6 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,struct opp_table *opp_table, bool getclk) { -int ret; -/* * Return early if we don't need to get clk or we have already done it * earlier.
@@ -1589,39 +1587,35 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, opp_table->clks)return opp_table; -/* Find clk for the device */ - opp_table->clk =clk_get (dev,NULL ); +/* +* There are few platforms which don't want the OPP core to manage +* device's clock settings. In such cases neither the platform +* provides the clks explicitly to us, nor the DT contains a valid +* clk entry. The OPP nodes in DT may still contain "opp-hz" property +* though, which we need to parse and allow the platform to find an +* OPP based on freq later on. +* +* This is a simple solution to take care of such corner cases, i.e. +* make the clk_count 1, which lets us allocate space for frequency +* in opp->rates and also parse the entries in DT. Use +* clk_get_optional() instead of clk_get() so opp_table->clk stays +* NULL for such devices, instead of holding an ERR_PTR(-ENOENT) that +* consumers must remember to special-case. +*/ + opp_table->clk =clk_get_optional (dev,NULL ); - ret =PTR_ERR_OR_ZERO (opp_table->clk); -if (!ret) { - opp_table->config_clks = _opp_config_clk_single; - opp_table->clk_count =1 ; -return opp_table; +if (IS_ERR (opp_table->clk)) { +dev_pm_opp_put_opp_table (opp_table); +dev_err_probe (dev,PTR_ERR (opp_table->clk),"Couldn't find clock\n" ); +return ERR_CAST (opp_table->clk); } -if (ret == -ENOENT ) { -/* -* There are few platforms which don't want the OPP core to -* manage device's clock settings. In such cases neither the -* platform provides the clks explicitly to us, nor the DT -* contains a valid clk entry. The OPP nodes in DT may still -* contain "opp-hz" property though, which we need to parse and -* allow the platform to find an OPP based on freq later on. -* -* This is a simple solution to take care of such corner cases, -* i.e. make the clk_count 1, which lets us allocate space for -* frequency in opp->rates and also parse the entries in DT. -*/ - opp_table->clk_count =1 ; - -dev_dbg (dev,"%s: Couldn't find clock: %d\n" , __func__, ret); -return opp_table; - } +if (opp_table->clk) + opp_table->config_clks = _opp_config_clk_single; -dev_pm_opp_put_opp_table (opp_table); -dev_err_probe (dev, ret,"Couldn't find clock\n" ); + opp_table->clk_count =1 ; -return ERR_PTR (ret); +return opp_table; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 333/1005 soundwire: dmi-quirks: Disable ghost Realtek on Asus Zenbook Duo
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit ca02ffd4975ca5249abf0cfb750a495d23b453ee ]
The Asus Zenbook Duo also has a Realtek device in the ACPI that doesn't exist in the physical hardware. This confuses the machine driver into attempting to create DAI links for the device. Add a quirk to remove this device.
--- drivers/soundwire/dmi-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/soundwire/dmi-quirks.c +7 -0
@@ -200,6 +200,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)ghost_realtek, }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUS" ), + DMI_MATCH(DMI_BOARD_NAME, "UX8407AA"), + }, + .driver_data = (void *)ghost_realtek, + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 334/1005 wifi: rsi: Fix types to appease CFI
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Hansson <[email protected]>
[ Upstream commit da308f6e471252ae5e8009dcea16bc5e9c9dc5dd ]
Avoids errors like:
CFI failure at kthread+0x124/0x1cc (target: rsi_coex_scheduler_thread+0x0/0x1b4 [redpine_91x]; expected type: 0x89fb613d)
As seen in the aforementioned error this was tested using the downstream redpine_91x driver found in the Librem 5's downstream source tree. However, it appears that this driver is a modified version of the rsi driver found in mainline Linux and as such I decided to port the changes here too.
--- drivers/net/wireless/rsi/rsi_91x_coex.c | 3 ++- drivers/net/wireless/rsi/rsi_91x_main.c | 7 ++++--- drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 3 ++- drivers/net/wireless/rsi/rsi_91x_usb_ops.c | 7 ++++--- drivers/net/wireless/rsi/rsi_common.h | 2 +- drivers/net/wireless/rsi/rsi_sdio.h | 2 +- drivers/net/wireless/rsi/rsi_usb.h | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-)
drivers/net/wireless/rsi/rsi_91x_coex.c +2 -1
@@ -50,8 +50,9 @@ static void rsi_coex_sched_tx_pkts(struct rsi_coex_ctrl_block *coex_cb) }while (coex_q !=RSI_COEX_Q_INVALID ); } -static void rsi_coex_scheduler_thread (struct rsi_common *common) +static int rsi_coex_scheduler_thread (void *data) { +struct rsi_common *common = data;struct rsi_coex_ctrl_block *coex_cb = common->coex_cb;u32 timeout =EVENT_WAIT_FOREVER ;
drivers/net/wireless/rsi/rsi_91x_main.c +4 -3
@@ -246,12 +246,13 @@ EXPORT_SYMBOL_GPL(rsi_read_pkt);/** * rsi_tx_scheduler_thread() - This function is a kernel thread to send the * packets to the device. -* @common: Pointer to the driver private structure. +* @data: Pointer to the driver private structure. * -* Return: None. +* Return: 0. */ -static void rsi_tx_scheduler_thread (struct rsi_common *common) +static int rsi_tx_scheduler_thread (void *data) { +struct rsi_common *common = data;struct rsi_hw *adapter = common->priv;u32 timeout =EVENT_WAIT_FOREVER ;
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +2 -1
@@ -62,8 +62,9 @@ int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word)static void rsi_rx_handler (struct rsi_hw *adapter); -void rsi_sdio_rx_thread (struct rsi_common *common) +int rsi_sdio_rx_thread (void *data) { +struct rsi_common *common = data;struct rsi_hw *adapter = common->priv;struct rsi_91x_sdiodev *sdev = adapter->rsi_dev;
drivers/net/wireless/rsi/rsi_91x_usb_ops.c +4 -3
@@ -21,12 +21,13 @@/** * rsi_usb_rx_thread() - This is a kernel thread to receive the packets from * the USB device. -* @common: Pointer to the driver private structure. +* @data: Pointer to the driver private structure. * -* Return: None. +* Return: 0. */ -void rsi_usb_rx_thread (struct rsi_common *common) +int rsi_usb_rx_thread (void *data) { +struct rsi_common *common = data;struct rsi_hw *adapter = common->priv;struct rsi_91x_usbdev *dev = adapter->rsi_dev;int status;
drivers/net/wireless/rsi/rsi_common.h +1 -1
@@ -58,7 +58,7 @@ static inline void rsi_reset_event(struct rsi_event *event)static inline int rsi_create_kthread (struct rsi_common *common,struct rsi_thread *thread, -void *func_ptr, +int (*func_ptr)(void *data),u8 *name) {init_completion (&thread->completion);
drivers/net/wireless/rsi/rsi_sdio.h +1 -1
@@ -134,5 +134,5 @@ int rsi_sdio_master_access_msword(struct rsi_hw *adapter, u16 ms_word);void rsi_sdio_ack_intr (struct rsi_hw *adapter,u8 int_bit);int rsi_sdio_determine_event_timeout (struct rsi_hw *adapter);int rsi_sdio_check_buffer_status (struct rsi_hw *adapter,u8 q_num); -void rsi_sdio_rx_thread (struct rsi_common *common); +int rsi_sdio_rx_thread (void *data);#endif
drivers/net/wireless/rsi/rsi_usb.h +1 -1
@@ -81,5 +81,5 @@ static inline int rsi_usb_event_timeout(struct rsi_hw *adapter) return EVENT_WAIT_FOREVER; } -void rsi_usb_rx_thread (struct rsi_common *common); +int rsi_usb_rx_thread (void *data);#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 335/1005 arm64: mm: fix accidental linear mapping of no-map reserved memory
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: liulhong617 <[email protected]>
[ Upstream commit 7ace06a01efaba1ec585630aa4c98ac39b38452a ]
When reserved-memory regions with the "no-map" property are not page-aligned, the kernel may accidentally map them into the linear mapping, contradicting the no-map semantics.
The root cause is a mismatch between /proc/iomem's address boundaries and the actual page table mapping boundaries:
1. /proc/iomem derives its ranges from memblock via memblock_region_reserved_base_pfn/memblock_region_reserved_end_pfn, which perform PFN rounding so the displayed boundaries are page-aligned. This gives the impression that the no-map region occupies whole pages.
2. However, memblock_mark_nomap() splits memblock.memory regions at exact byte boundaries (memblock_isolate_range preserves raw DT base/size with no alignment). When for_each_mem_range iterates the non-NOMAP regions adjacent to a no-map region, it returns start/end values that are NOT page-aligned — they are the precise byte boundaries from the memblock split.
3. These sub-page-aligned values are passed to
__create_pgd_mapping_locked(), which does:
phys &= PAGE_MASK;
addr = virt & PAGE_MASK;
end = PAGE_ALIGN(virt + size); The downward rounding of phys via PAGE_MASK extends the mapped range backward into the adjacent no-map region, effectively including no-map memory in the linear mapping.
For example, with 64K pages, reserved_region@A2000000 (base=0xA2000000, size=0x8000, no-map) causes for_each_mem_range to return start=0xA2008000 for the next mappable region. After phys &= PAGE_MASK, the actual mapping starts at 0xA2000000 — the entire no-map region is incorrectly mapped.
Fix this by rounding the mappable range inward to PAGE_SIZE boundaries before passing it to __map_memblock: start is rounded UP and end is rounded DOWN. This ensures the mapped area never overlaps with adjacent no-map regions. The cost is at most one page of unmapped gap at each boundary, which is preferable to violating no-map semantics.
--- arch/arm64/mm/mmu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/mm/mmu.c +14 -0
@@ -1179,6 +1179,20 @@ static void __init map_mem(pgd_t *pgdp)for_each_mem_range (i, &start, &end) {if (start >= end)break ; +/* +* for_each_mem_range may return sub-page-aligned boundaries +* after memblock_mark_nomap() splits regions at byte precision. +* __create_pgd_mapping_locked aligns phys down to PAGE_MASK, +* which could accidentally map no-map memory on the boundary. +* Round the mappable range inward: start UP, end DOWN, so +* that the mapped area never overlaps with adjacent no-map +* regions. The cost is at most one page of unmapped gap at +* each boundary. +*/ + start =PAGE_ALIGN (start); + end = end &PAGE_MASK ; +if (start >= end) +continue ;/* * The linear map must allow allocation tags reading/writing * if MTE is present. Otherwise, it has the same attributes as
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 336/1005 drm/amd/pm: derive stable PPT limits from PPTable
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Wang <[email protected]>
[ Upstream commit 25f4a46b0c8acd77c9065b50a1fe48af27d91fdf ]
GetPptLimit reports mutable PMFW runtime state. Using that value for static capabilities causes two externally visible problems:
- A userspace override changes the default reported through hwmon.
- A firmware reset changes the advertised minimum or maximum range.
Derive platform defaults and supported ranges from the driver PPTable for Sienna Cichlid, Navi10, Arcturus, and Aldebaran. Reserve PMFW queries for the effective current limit.
Runtime policy can no longer redefine immutable platform capabilities.
--- .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 25 ++++++++------- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 32 +++++++++++-------- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 28 +++++++++------- .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 8 +++-- 4 files changed, 53 insertions(+), 40 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +13 -12
@@ -1329,24 +1329,25 @@ static int arcturus_get_power_limit(struct smu_context *smu, uint32_t *min_power_limit) {PPTable_t *pptable = smu->smu_table.driver_pptable; -uint32_t power_limit; +uint32_t current_limit, default_limit; -if (smu_v11_0_get_current_power_limit (smu, &power_limit)) { -/* the last hope to figure out the ppt limit */ -if (!pptable) { -dev_err (smu->adev->dev,"Cannot get PPT limit due to pptable missing!" ); -return -EINVAL ; - } - power_limit = - pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0 ]; +if (!pptable) { +dev_err (smu->adev->dev, +"Cannot get PPT limit due to pptable missing!" ); +return -EINVAL ; } + default_limit = pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0 ]; + +if (smu_v11_0_get_current_power_limit (smu, ¤t_limit)) + current_limit = default_limit; +if (current_power_limit) - *current_power_limit = power_limit; + *current_power_limit = current_limit;if (default_power_limit) - *default_power_limit = power_limit; + *default_power_limit = default_limit;if (max_power_limit) - *max_power_limit = power_limit; + *max_power_limit = default_limit;/* * No lower bound is imposed on the limit. Any unreasonable limit set * will result in frequent throttling.
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +18 -14
@@ -2393,22 +2393,26 @@ static int navi10_get_power_limit(struct smu_context *smu, (struct smu_11_0_powerplay_table *)smu->smu_table.power_play_table;struct smu_11_0_overdrive_table *od_settings = smu->od_settings;PPTable_t *pptable = smu->smu_table.driver_pptable; -uint32_t power_limit, od_percent_upper =0 , od_percent_lower =0 ; +uint32_t current_limit, default_limit; +uint32_t od_percent_upper =0 , od_percent_lower =0 ; -if (smu_v11_0_get_current_power_limit (smu, &power_limit)) { -/* the last hope to figure out the ppt limit */ -if (!pptable) { -dev_err (smu->adev->dev,"Cannot get PPT limit due to pptable missing!" ); -return -EINVAL ; - } - power_limit = - pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0 ]; +if (!pptable) { +dev_err (smu->adev->dev, +"Cannot get PPT limit due to pptable missing!" ); +return -EINVAL ; } + default_limit = smu->adev->pm.ac_power ? + pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0 ] : + pptable->SocketPowerLimitDc[PPT_THROTTLER_PPT0 ]; + +if (smu_v11_0_get_current_power_limit (smu, ¤t_limit)) + current_limit = default_limit; +if (current_power_limit) - *current_power_limit = power_limit; + *current_power_limit = current_limit;if (default_power_limit) - *default_power_limit = power_limit; + *default_power_limit = default_limit;if (powerplay_table) { if (smu->od_enabled &&
@@ -2422,15 +2426,15 @@ static int navi10_get_power_limit(struct smu_context *smu, }dev_dbg (smu->adev->dev,"od percent upper:%d, od percent lower:%d (default power: %d)\n" , - od_percent_upper, od_percent_lower, power_limit); + od_percent_upper, od_percent_lower, default_limit);if (max_power_limit) { - *max_power_limit = power_limit * (100 + od_percent_upper); + *max_power_limit = default_limit * (100 + od_percent_upper); *max_power_limit /=100 ; }if (min_power_limit) { - *min_power_limit = power_limit * (100 - od_percent_lower); + *min_power_limit = default_limit * (100 - od_percent_lower); *min_power_limit /=100 ; }
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +16 -12
@@ -632,20 +632,24 @@ static int sienna_cichlid_get_power_limit(struct smu_context *smu,struct smu_11_0_7_powerplay_table *powerplay_table = (struct smu_11_0_7_powerplay_table *)smu->smu_table.power_play_table;struct smu_11_0_7_overdrive_table *od_settings = smu->od_settings; -uint32_t power_limit, od_percent_upper =0 , od_percent_lower =0 ; -uint16_t *table_member; +uint32_t current_limit, default_limit; +uint32_t od_percent_upper =0 , od_percent_lower =0 ; +u16 *power_limit_ac, *power_limit_dc; -GET_PPTABLE_MEMBER (SocketPowerLimitAc, &table_member); +GET_PPTABLE_MEMBER (SocketPowerLimitAc, &power_limit_ac); +GET_PPTABLE_MEMBER (SocketPowerLimitDc, &power_limit_dc); -if (smu_v11_0_get_current_power_limit (smu, &power_limit)) { - power_limit = - table_member[PPT_THROTTLER_PPT0 ]; - } + default_limit = smu->adev->pm.ac_power ? + power_limit_ac[PPT_THROTTLER_PPT0 ] : + power_limit_dc[PPT_THROTTLER_PPT0 ]; + +if (smu_v11_0_get_current_power_limit (smu, ¤t_limit)) + current_limit = default_limit;if (current_power_limit) - *current_power_limit = power_limit; + *current_power_limit = current_limit;if (default_power_limit) - *default_power_limit = power_limit; + *default_power_limit = default_limit;if (powerplay_table) { if (smu->od_enabled &&
@@ -659,15 +663,15 @@ static int sienna_cichlid_get_power_limit(struct smu_context *smu, }dev_dbg (smu->adev->dev,"od percent upper:%d, od percent lower:%d (default power: %d)\n" , - od_percent_upper, od_percent_lower, power_limit); + od_percent_upper, od_percent_lower, default_limit);if (max_power_limit) { - *max_power_limit = power_limit * (100 + od_percent_upper); + *max_power_limit = default_limit * (100 + od_percent_upper); *max_power_limit /=100 ; }if (min_power_limit) { - *min_power_limit = power_limit * (100 - od_percent_lower); + *min_power_limit = default_limit * (100 - od_percent_lower); *min_power_limit /=100 ; }return 0 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +6 -2
@@ -1281,8 +1281,12 @@ static int aldebaran_get_power_limit(struct smu_context *smu,if (current_power_limit) *current_power_limit = power_limit; -if (default_power_limit) - *default_power_limit = power_limit; +if (default_power_limit) { +if (pptable) + *default_power_limit = pptable->PptLimit; +else + *default_power_limit = power_limit; + }if (max_power_limit) {if (pptable)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 337/1005 HID: rmi: check report length before trimming sentinel bytes
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 28a3e326fad2451bdb66b747dd1f7ccbb900eed6 ]
rmi_check_sanity() trims trailing 0xff sentinel bytes, but its loop reads data[valid_size - 1] before checking that valid_size is non-zero.
Reverse the condition so the length is proved before the last byte is inspected.
--- drivers/hid/hid-rmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-rmi.c +1 -1
@@ -386,7 +386,7 @@ static int rmi_check_sanity(struct hid_device *hdev, u8 *data, int size)* such reports here. */ -while ((data[valid_size -1 ] ==0xff ) && valid_size >0 ) +while (valid_size >0 && data[valid_size -1 ] ==0xff ) valid_size--;return valid_size;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 338/1005 ext4: guard against NULL s_group_info in ext4_get_group_info
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junzhe Yu <[email protected]>
[ Upstream commit 8f3901fbb40745046e513226ad84e8b84492632d ]
Resend: previous attempt was rejected by vger for containing HTML.
==================================================================
ext4_mark_group_bitmap_corrupted() already treats a NULL return from ext4_get_group_info() as "nothing to do", but ext4_get_group_info() indexes s_group_info without checking whether the array exists.
During mount, fast-commit replay runs inside jbd2_journal_load() from ext4_load_and_init_journal(), which is before ext4_mb_init() allocates s_group_info. Replaying an FC UNLINK for an inode whose bitmap bit is already clear takes:
ext4_fc_replay_unlink -> iput -> ext4_evict_inode -> ext4_free_inode -> ext4_mark_group_bitmap_corrupted -> ext4_get_group_info
and faults on the NULL s_group_info base. Userspace only mounts a dirty ext4 image; this is a supported recovery path.
Return NULL when s_group_info (or the per-block grp_info row) is unset so the existing caller check is effective during early mount.
Tested on Linux v6.6.145 KASAN: crafted FC-unlink image previously triggered KASAN null-ptr-deref / panic in ext4_get_group_info; with this patch, mount succeeds (EXT4 "bit already cleared" may still log). Also observed on v6.6.144; still present on torvalds/linux as of f5098b6bae76 (2026-07-26).
A self-contained Docker/QEMU reproducer (craft + mount + patch verify) is available on request.
--- fs/ext4/balloc.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/balloc.c +4 -0
@@ -331,9 +331,13 @@ struct ext4_group_info *ext4_get_group_info(struct super_block *sb,if (unlikely (group >=EXT4_SB (sb)->s_groups_count))return NULL ; +if (unlikely (!EXT4_SB (sb)->s_group_info)) +return NULL ; indexv = group >> (EXT4_DESC_PER_BLOCK_BITS (sb)); indexh = group & ((EXT4_DESC_PER_BLOCK (sb)) -1 ); grp_info =sbi_array_rcu_deref (EXT4_SB (sb), s_group_info, indexv); +if (unlikely (!grp_info)) +return NULL ;return grp_info[indexh]; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 339/1005 ALSA: hda/realtek: Enable mute LEDs on HP Spectre x360 16-aa0xxx
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shang En Sim <[email protected]>
[ Upstream commit bfcdc1c0eaeae5525c726193568e8d638b2afdc0 ]
The HP Spectre x360 2-in-1 Laptop 16-aa0xxx with PCI subsystem ID 0x103c:0x8c17 only gets the CS35L41 amplifier setup from ALC287_FIXUP_CS35L41_I2C_2, so the speaker-mute and mic-mute keyboard LEDs do not work.
Use ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX like subsystem ID 0x8c16 so the mute LEDs work.
Tested on HP Spectre x360 2-in-1 Laptop 16-aa0xxx.
--- sound/hda/codecs/realtek/alc269.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/hda/codecs/realtek/alc269.c +1 -1
@@ -6969,7 +6969,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8bf0 ,"HP" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8c15 ,"HP Spectre x360 2-in-1 Laptop 14-eu0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX ),SND_PCI_QUIRK (0x103c ,0x8c16 ,"HP Spectre x360 2-in-1 Laptop 16-aa0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX ), -SND_PCI_QUIRK (0x103c ,0x8c17 ,"HP Spectre 16" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8c17 ,"HP Spectre x360 2-in-1 Laptop 16-aa0xxx" ,ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX ),SND_PCI_QUIRK (0x103c ,0x8c21 ,"HP Pavilion Plus Laptop 14-ey0XXX" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x8c2d ,"HP Victus 15-fa1xxx (MB 8C2D)" ,ALC245_FIXUP_HP_MUTE_LED_COEFBIT ), SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 340/1005 md/raid5: reject zero-sector reshape chunks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit a41bb2ee1aca486853e84920565e50c15f86fa5d ]
Sashiko reported that RAID5 can accept a reshape chunk size that becomes zero sectors. chunk_size_store() stores the sysfs byte value as n >> 9, so writing a value below 512 bytes sets mddev->new_chunk_sectors to zero. RAID5 then accepted that pending reshape geometry and raid5_start_reshape() installed it into conf->chunk_sectors, letting reshape code divide by zero.
Reject zero-sector chunks both in check_reshape(), where normal sysfs requests are validated, and in raid5_start_reshape(), so assembly/resume paths also cannot install zero chunk geometry.
Test script: in QEMU, create a plain three-disk RAID5 array with 64K chunks, write/read back a small pattern, write 1 to /sys/block/md0/md/chunk_size, add a fourth disk, and run mdadm --grow --raid-devices=4 --backup-file=... . The script scans dmesg for divide error/Oops/KASAN signatures.
Bad kernel, eb29914412c3:
echo 1 > /sys/block/md0/md/chunk_size mdadm --grow /dev/md0 --raid-devices=4 --backup-file=/root/md0-grow.bak
Oops: divide error: 0000 [#1] SMP KASAN NOPTI RIP: raid5_get_active_stripe+0x863/0xc10 Call Trace: raid5_sync_request md_do_sync md_thread Kernel panic - not syncing: Fatal exception
Fixed kernel: echo 1 > /sys/block/md0/md/chunk_size bash: echo: write
error: Invalid argument chunk_write_rc=1 grow_rc=skipped RESULT:REJECTED_ZERO_CHUNK_NO_OOPS
--- drivers/md/raid5.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/raid5.c +5 -0
@@ -8437,6 +8437,8 @@ static int check_reshape(struct mddev *mddev)return 0 ;/* nothing to do */ if (has_failed (conf))return -EINVAL ; +if (!mddev->new_chunk_sectors) +return -EINVAL ;if (mddev->delta_disks <0 && mddev->reshape_position == MaxSector) {/* We might be able to shrink, but the devices must * be made bigger first.
@@ -8480,6 +8482,9 @@ static int raid5_start_reshape(struct mddev *mddev)if (test_bit (MD_RECOVERY_RUNNING , &mddev->recovery))return -EBUSY ; +if (!mddev->new_chunk_sectors) +return -EINVAL ; +if (!check_stripe_cache (mddev))return -ENOSPC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 341/1005 md: skip bitmap accounting for empty write ranges
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 87c10252e3d6c28769d93bea9e6a9b592e5809d1 ]
mkfs.ext4 can submit zero-sector flush/FUA bios. These bios are WRITE bios for md_write_start() purposes, but they do not cover any data sector and must not dirty bitmap bits.
md bitmap accounting currently passes such bios to bitmap start_write(). For llbitmap this reaches llbitmap_start_write() with sectors == 0, which underflows the end chunk calculation.
Personality bitmap mapping can also turn a non-empty bio into an empty bitmap range when the requested sectors are outside the active bitmap geometry. Treat both cases as not started, so the completion path will not call end_write() for an empty range.
--- drivers/md/md.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/md/md.c +7 -2
@@ -9266,6 +9266,8 @@ static void md_bitmap_start(struct mddev *mddev, mddev->pers->bitmap_sector (mddev, &md_io_clone->offset, &md_io_clone->sectors); +if (!md_io_clone->sectors) +return ;fn (mddev, md_io_clone->offset, md_io_clone->sectors); }
@@ -9284,7 +9286,8 @@ static void md_end_clone_io(struct bio *bio)struct bio *orig_bio = md_io_clone->orig_bio;struct mddev *mddev = md_io_clone->mddev; -if (bio_data_dir (orig_bio) ==WRITE &&md_bitmap_enabled (mddev, false)) +if (bio_data_dir (orig_bio) ==WRITE && md_io_clone->sectors && +md_bitmap_enabled (mddev, false))md_bitmap_end (mddev, md_io_clone);if (bio->bi_status && !orig_bio->bi_status)
@@ -9308,12 +9311,14 @@ static void md_clone_bio(struct mddev *mddev, struct bio **bio) md_io_clone = container_of(clone, struct md_io_clone, bio_clone); md_io_clone->orig_bio = *bio; md_io_clone->mddev = mddev; + md_io_clone->sectors =0 ;if (blk_queue_io_stat (bdev->bd_disk->queue)) md_io_clone->start_time =bio_start_io_acct (*bio);else md_io_clone->start_time =0 ; -if (bio_data_dir (*bio) ==WRITE &&md_bitmap_enabled (mddev, false)) { +if (bio_data_dir (*bio) ==WRITE &&bio_sectors (*bio) && +md_bitmap_enabled (mddev, false)) { md_io_clone->offset = (*bio)->bi_iter.bi_sector; md_io_clone->sectors =bio_sectors (*bio); md_io_clone->rw =op_stat_group (bio_op (*bio));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 342/1005 md: add cond_resched() to md_do_sync()s skip path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunye Zhao <[email protected]>
[ Upstream commit 162eb5ba791f6260fdaabae75fa2df20134f67d8 ]
When sync_request() reports a skipped region (*skipped == 1), md_do_sync()'s main loop advances the cursor and takes an early continue:
j += sectors; ... if (last_check + window > io_sectors || j == max_sectors) continue;
If the personality returns a small span per call (raid10 recovery returns only 128 sectors), syncing a large, mostly clean array iterates this branch an enormous number of times without ever yielding the CPU. On a non-preemptive kernel the resync thread then trips the soft-lockup watchdog:
watchdog: BUG: soft lockup - CPU#149 stuck for 313s! [mdX_resync] md_bitmap_start_sync+0x6f/0xe0 raid10_sync_request+0x2c9/0x1530 [raid10] md_do_sync+0x810/0x1030 md_thread+0xa7/0x150
Add a cond_resched(). This does not reduce the wasted iterations; the excessive iteration count is a raid10 problem addressed separately.
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -9751,8 +9751,10 @@ void md_do_sync(struct md_thread *thread)*/ md_new_event (); -if (last_check + window > io_sectors || j == max_sectors) +if (last_check + window > io_sectors || j == max_sectors) { +cond_resched ();continue ; + } last_check = io_sectors; repeat:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 343/1005 tools/lib/thermal: Fix misplaced extern "C" closing brace
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Haufler <[email protected]>
[ Upstream commit cb0ec27efac2aaf92393ad563a35fb6f00d0a6cd ]
The public libthermal header opens the C++ 'extern "C" {' block inside the __LIBTHERMAL_H include guard, but places the closing brace after the guard has already ended:
#endif /* __LIBTHERMAL_H */ #ifdef __cplusplus } #endif
On a single inclusion the braces still balance, so the problem is invisible. On the second inclusion of the header in the same C++ translation unit the include guard skips the opening 'extern "C" {', while the closing '}' lives outside the guard and is emitted anyway. This leaves a stray '}' and breaks compilation for any C++ consumer that includes the header more than once.
Move the closing block inside the include guard so both halves of the 'extern "C"' declaration are guarded consistently.
--- tools/lib/thermal/include/thermal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/thermal/include/thermal.h +2 -2
@@ -175,8 +175,8 @@ LIBTHERMAL_API thermal_error_t thermal_sampling_handle(struct thermal_handler *t LIBTHERMAL_API int thermal_sampling_fd(struct thermal_handler *th); -#endif /* __LIBTHERMAL_H */ -#ifdef __cplusplus }#endif + +#endif /* __LIBTHERMAL_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 344/1005 selftests/ftrace: Force C locale in ftracetest
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rui Qi <[email protected]>
[ Upstream commit c13fcd3951dcc19524ce0b3e852844b16cd32b22 ]
Some ftracetest test cases parse command output by matching English field names. Tools such as readelf may localize their output via gettext, while ftracetest currently inherits the user locale from the environment.
If a translated field name is printed, parsing can fail even though the tested kernel behavior is unchanged. For example, add_remove_uprobe can fail to find the ELF entry point and then write a uprobe event with a missing offset.
Export LC_ALL=C in the top-level ftracetest runner so every test case gets stable command output by default.
--- tools/testing/selftests/ftrace/ftracetest | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/ftrace/ftracetest +3 -0
@@ -7,6 +7,9 @@ # Written by Masami Hiramatsu <[email protected]> # +# Keep command output parsing stable regardless of the user's locale. +export LC_ALL=C + usage() { # errno [message] [ ! -z "$2" ] && echo $2 echo "Usage: ftracetest [options] [testcase(s)] [testcase-directory(s)]"
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 345/1005 Bluetooth: btusb: Add USB ID 13d3:3625 for MediaTek MT7922
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Evgucci <[email protected]>
[ Upstream commit 849a3bf1489093996859ba0c3c1c0cd314d6ff96 ]
The IMC Networks MT7922 Bluetooth adapter with USB ID 13d3:3625 is not recognized as a MediaTek device because it is missing from the btusb device ID table. As a result, btmtk firmware loading is never triggered and the HCI reset command times out with -ETIMEDOUT.
Add the device with BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH flags, consistent with the neighboring 13d3:3627, 13d3:3628 and 13d3:3630 entries which use the same chip.
Tested on: MediaTek MT7922 (Wi-Fi 6E combo card, IMC Networks BT USB interface), kernel 7.0.11-arch1-1.
/sys/kernel/debug/usb/devices:
T: Bus=01 Lev=01 Prnt=01 Port=12 Cnt=03 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3625 Rev= 1.00 S: Manufacturer=MediaTek Inc. S: Product=Wireless_Device S: SerialNumber=000000000 C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA A: FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms I: If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=8a(I) Atr=03(Int.) MxPS= 64 Ivl=125us E: Ad=0a(O) Atr=03(Int.) MxPS= 64 Ivl=125us I:* If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=8a(I) Atr=03(Int.) MxPS= 512 Ivl=125us E: Ad=0a(O) Atr=03(Int.) MxPS= 512 Ivl=125us
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -788,6 +788,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3613), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3625), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3627), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3628), .driver_info = BTUSB_MEDIATEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 346/1005 Bluetooth: btusb: Add support for 1357:c123 Realtek 8852BE device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Zverev <[email protected]>
[ Upstream commit 335d7bd554a20f33acf762655cafe1089f7f5822 ]
Wiko Hi MateBook 14 Ryzen 200 laptops (DMI system-product-name "MNCA-XX", board "M1060") are equipped with an RTL8852BE Wi-Fi/BT combo chip (rtw89_8852be), whose Bluetooth radio enumerates as 1357:c123 instead of one of the already-supported 1358:c123 / 0bda:c123 identifiers, presumably due to OEM rebranding. Without a matching entry it only matches the generic USB Bluetooth class fallback, so the Realtek firmware/config (rtl8852btu_fw.bin / rtl8852btu_config.bin) is never loaded and the adapter cannot discover or connect to any device, even though hciconfig reports it as powered and scanning.
Device descriptor:
idVendor 0x1357
idProduct 0xc123
bcdDevice 0.00
iManufacturer 1 Realtek
iProduct 2 Bluetooth Radio
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
Adding the same BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH quirk already used for 1358:c123 and 0bda:c123 fixes firmware loading and normal operation.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -882,6 +882,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0bda, 0xc123), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x1357, 0xc123), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0cb5, 0xc547), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 347/1005 Bluetooth: hci_nokia: validate firmware packet bounds
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 45640627e3ddc5f4d3a0d08618a596a8c65d48a5 ]
nokia_setup_fw() walks a length-prefixed firmware stream and decodes HCI command packets from each record.
Check that each record fits in the remaining firmware image, that command records contain the HCI command header, and that the payload length is covered before submitting the command.
--- drivers/bluetooth/hci_nokia.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/bluetooth/hci_nokia.c +20 -0
@@ -354,9 +354,29 @@ static int nokia_setup_fw(struct hci_uart *hu)u16 opcode;struct sk_buff *skb; +if (pkt_size > fw_size -2 ) { + err = -EINVAL ; +dev_err (dev,"%s: Malformed firmware packet\n" , + hu->hdev->name); + goto done; + } +switch (pkt_type) {case HCI_COMMAND_PKT : +if (pkt_size <1 +HCI_COMMAND_HDR_SIZE ) { + err = -EINVAL ; +dev_err (dev,"%s: Malformed firmware command\n" , + hu->hdev->name); + goto done; + } + cmd = (struct hci_command_hdr *)(fw_ptr +3 ); +if (cmd->plen > pkt_size -1 -HCI_COMMAND_HDR_SIZE ) { + err = -EINVAL ; +dev_err (dev,"%s: Truncated firmware command\n" , + hu->hdev->name); + goto done; + } opcode =le16_to_cpu (cmd->opcode); skb = __hci_cmd_sync(hu->hdev, opcode, cmd->plen,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 348/1005 Bluetooth: btnxpuart: Fix use-after-free in probe error path
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Dongdong <[email protected]>
[ Upstream commit a2b3b4f00403a3a40c5627d1bf537c8fb166e221 ]
In nxp_serdev_probe(), if hci_register_dev() succeeds but ps_setup() fails, the error path jumps to 'probe_fail' which only calls hci_free_dev() and asserts the reset GPIO, but does NOT call hci_unregister_dev() first.
This leaves the HCI device registered in the system with its backing memory freed, leading to a use-after-free when userspace subsequently accesses the device (e.g. via hciconfig or bluetoothd).
Fix by adding a 'probe_fail_unregister' label that calls hci_unregister_dev() before falling through to the existing 'probe_fail' label. The original 'probe_fail' label is preserved for the case where hci_register_dev() itself fails (device was never registered, so no unregister is needed).
--- drivers/bluetooth/btnxpuart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bluetooth/btnxpuart.c +3 -1
@@ -1924,13 +1924,15 @@ static int nxp_serdev_probe(struct serdev_device *serdev) }if (ps_setup (hdev)) - goto probe_fail; + goto probe_fail_unregister;hci_devcd_register (hdev, nxp_coredump, nxp_coredump_hdr, nxp_coredump_notify);return 0 ; +probe_fail_unregister: +hci_unregister_dev (hdev); probe_fail:reset_control_assert (nxpdev->pdn);hci_free_dev (hdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 349/1005 Bluetooth: bfusb: validate received block boundaries
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Qiang <[email protected]>
[ Upstream commit 6afadcff79b157a4770c4e987a6005bff40a670b ]
The USB receive path trusts the block header to contain the required number of bytes and passes it to the reassembly routine. The routine also trusts a malformed HCI packet type and can append more data than the skb allocated from the advertised packet length. A malformed USB transfer can therefore cause out-of-bounds reads or an skb tail overwrite.
Validate block header availability, declared block size, packet type, and reassembly tailroom. Drop the partial frame on an invalid block.
--- drivers/bluetooth/bfusb.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
drivers/bluetooth/bfusb.c +34 -3
@@ -301,6 +301,11 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned chreturn -EILSEQ ; }break ; + +default : +bt_dev_err (data->hdev,"unknown packet type 0x%02x" , + pkt_type); +return -EILSEQ ; } skb =bt_skb_alloc (pkt_len,GFP_ATOMIC );
@@ -319,6 +324,13 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch } } +if (len >skb_tailroom (data->reassembly)) { +bt_dev_err (data->hdev,"block exceeds packet length" ); +kfree_skb (data->reassembly); + data->reassembly =NULL ; +return -EILSEQ ; + } +if (len >0 )skb_put_data (data->reassembly, buf, len);
@@ -353,6 +365,13 @@ static void bfusb_rx_complete(struct urb *urb)skb_put (skb, count);while (count) { +if (count <2 ) { +bt_dev_err (data->hdev,"short block header" ); +kfree_skb (data->reassembly); + data->reassembly =NULL ; +break ; + } + hdr = buf[0 ] | (buf[1 ] <<8 );if (hdr &0x4000 ) {
@@ -360,16 +379,28 @@ static void bfusb_rx_complete(struct urb *urb) count -=2 ; buf +=2 ; }else { +if (count <3 ) { +bt_dev_err (data->hdev,"short block header" ); +kfree_skb (data->reassembly); + data->reassembly =NULL ; +break ; + } + len = (buf[2 ] ==0 ) ?256 : buf[2 ]; count -=3 ; buf +=3 ; } -if (count < len) +if (count < len) {bt_dev_err (data->hdev,"block extends over URB buffer ranges" ); +kfree_skb (data->reassembly); + data->reassembly =NULL ; +break ; + } -if ((hdr &0xe1 ) ==0xc1 ) -bfusb_recv_block (data, hdr, buf, len); +if ((hdr &0xe1 ) ==0xc1 && +bfusb_recv_block (data, hdr, buf, len) <0 ) + data->hdev->stat.err_rx++; count -= len; buf += len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 350/1005 btrfs: fix memory barrier order in reloc_root_is_dead()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 6f1c97695a6e230ee15c9e052e1933bdccfd5fa3 ]
When we set a root's reloc_root to NULL, we do it like this:
static void clear_reloc_root(struct btrfs_root *root)
{
root->reloc_root = NULL;
/*
* Need barrier to ensure clear_bit() only happens after
* root->reloc_root = NULL. Pairs with have_reloc_root().
*/
smp_wmb();
clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
}So that a NULL reloc_root is always seen before seeing that the bit BTRFS_ROOT_DEAD_RELOC_TREE was cleared.
But on the read side we have:
static bool reloc_root_is_dead(const struct btrfs_root *root)
{
smp_rmb();
if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
return true;
return false;
}And then callers of reloc_root_is_dead() access root->reloc_root.
Because the read memory barrier is placed before testing the bit, the CPU is completely free to speculatively reorder those two loads. It can read root->reloc_root before it actually checks the dead tree bit.
Sashiko reported this as an existing problem in another patch review, see the link in the Link tag below.
Fix this by moving the read memory barrier to happen after testing the bit and update the comment to reflect current reality.
--- fs/btrfs/relocation.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/btrfs/relocation.c +6 -5
@@ -245,14 +245,15 @@ static struct btrfs_backref_node *walk_down_backref(static bool reloc_root_is_dead (const struct btrfs_root *root) { +if (test_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state)) +return true;/* -* Pair with set_bit/clear_bit in clean_dirty_subvols and -* btrfs_update_reloc_root. We need to see the updated bit before -* trying to access reloc_root +* Pairs with set_bit/clear_bit in clear_reloc_root() and +* btrfs_update_reloc_root(). We need to see the updated bit before +* trying to access root->reloc_root in our callers. */ smp_rmb (); -if (test_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state)) -return true; +return false; }
Signature · 1 line
2.53.0