5.10.227-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 457/518 clk: bcm: bcm53573: fix OF node leak in init
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f92d67e23b8caa81f6322a2bad1d633b00ca000e ]
Driver code is leaking OF node reference from of_get_parent() in bcm53573_ilp_init(). Usage of of_get_parent() is not needed in the first place, because the parent node will not be freed while we are processing given node (triggered by CLK_OF_DECLARE()). Thus fix the leak by accessing parent directly, instead of of_get_parent().
--- drivers/clk/bcm/clk-bcm53573-ilp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm53573-ilp.c +1 -1
@@ -112,7 +112,7 @@ static void bcm53573_ilp_init(struct device_node *np) goto err_free_ilp; } - ilp->regmap =syscon_node_to_regmap (of_get_parent (np)); + ilp->regmap =syscon_node_to_regmap (np->parent);if (IS_ERR (ilp->regmap)) { err =PTR_ERR (ilp->regmap); goto err_free_ilp;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 458/518 PCI: Add ACS quirk for Qualcomm SA8775P
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subramanian Ananthanarayanan <[email protected]>
[ Upstream commit 026f84d3fa62d215b11cbeb5a5d97df941e93b5c ]
The Qualcomm SA8775P root ports don't advertise an ACS capability, but they do provide ACS-like features to disable peer transactions and validate bus numbers in requests.
Thus, add an ACS quirk for the SA8775P.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -4920,6 +4920,8 @@ static const struct pci_dev_acs_enabled {/* QCOM QDF2xxx root ports */ { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs }, +/* QCOM SA8775P root port */ + { PCI_VENDOR_ID_QCOM, 0x0115, pci_quirk_qcom_rp_acs },/* HXT SD4800 root ports. The ACS design is same as QCOM QDF2xxx */ { PCI_VENDOR_ID_HXT, 0x0401, pci_quirk_qcom_rp_acs }, /* Intel PCH root ports */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 459/518 i2c: i801: Use a different adapter-name for IDF adapters
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 43457ada98c824f310adb7bd96bd5f2fcd9a3279 ]
On chipsets with a second 'Integrated Device Function' SMBus controller use a different adapter-name for the second IDF adapter.
This allows platform glue code which is looking for the primary i801 adapter to manually instantiate i2c_clients on to differentiate between the 2.
This allows such code to find the primary i801 adapter by name, without needing to duplicate the PCI-ids to feature-flags mapping from i2c-i801.c.
--- drivers/i2c/busses/i2c-i801.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-i801.c +8 -1
@@ -1895,8 +1895,15 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)i801_add_tco (priv); +/* +* adapter.name is used by platform code to find the main I801 adapter +* to instantiante i2c_clients, do not change. +*/ snprintf (priv->adapter.name,sizeof (priv->adapter.name), -"SMBus I801 adapter at %04lx" , priv->smba); +"SMBus %s adapter at %04lx" , + (priv->features &FEATURE_IDF ) ?"I801 IDF" :"I801" , + priv->smba); + err =i2c_add_adapter (&priv->adapter);if (err) {platform_device_unregister (priv->tco_pdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 460/518 PCI: Mark Creative Labs EMU20k2 INTx masking as broken
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
[ Upstream commit 2910306655a7072640021563ec9501bfa67f0cb1 ]
Per user reports, the Creative Labs EMU20k2 (Sound Blaster X-Fi Titanium Series) generates spurious interrupts when used with vfio-pci unless DisINTx masking support is disabled.
Thus, quirk the device to mark INTx masking as broken.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -3454,6 +3454,8 @@ DECLARE_PCI_FIXUP_FINAL(0x1814, 0x0601, /* Ralink RT2800 802.11n PCI */ quirk_broken_intx_masking);DECLARE_PCI_FIXUP_FINAL (0x1b7c ,0x0004 ,/* Ceton InfiniTV4 */ quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_CREATIVE ,PCI_DEVICE_ID_CREATIVE_20K2 , + quirk_broken_intx_masking);/* * Realtek RTL8169 PCI Gigabit Ethernet Controller (rev 10)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 461/518 ntb: ntb_hw_switchtec: Fix use after free vulnerability in switchtec_ntb_remove due to race condition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaixin Wang <[email protected]>
[ Upstream commit e51aded92d42784313ba16c12f4f88cc4f973bbb ]
In the switchtec_ntb_add function, it can call switchtec_ntb_init_sndev function, then &sndev->check_link_status_work is bound with check_link_status_work. switchtec_ntb_link_notification may be called to start the work.
If we remove the module which will call switchtec_ntb_remove to make cleanup, it will free sndev through kfree(sndev), while the work mentioned above will be used. The sequence of operations that may lead to a UAF bug is as follows:
CPU0 CPU1
| check_link_status_work
switchtec_ntb_remove |
kfree(sndev); |
| if (sndev->link_force_down)
| // use sndevFix it by ensuring that the work is canceled before proceeding with the cleanup in switchtec_ntb_remove.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 1 + 1 file changed, 1 insertion(+)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +1 -0
@@ -1558,6 +1558,7 @@ static void switchtec_ntb_remove(struct device *dev,switchtec_ntb_deinit_db_msg_irq (sndev);switchtec_ntb_deinit_shared_mw (sndev);switchtec_ntb_deinit_crosslink (sndev); +cancel_work_sync (&sndev->check_link_status_work);kfree (sndev);dev_info (dev,"ntb device unregistered\n" ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 462/518 media: videobuf2-core: clear memory related fields in __vb2_plane_dmabuf_put()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunke Cao <[email protected]>
[ Upstream commit 6a9c97ab6b7e85697e0b74e86062192a5ffffd99 ]
Clear vb2_plane's memory related fields in __vb2_plane_dmabuf_put(), including bytesused, length, fd and data_offset.
Remove the duplicated code in __prepare_dmabuf().
--- drivers/media/common/videobuf2/videobuf2-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/common/videobuf2/videobuf2-core.c +4 -4
@@ -301,6 +301,10 @@ static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p) p->mem_priv =NULL ; p->dbuf =NULL ; p->dbuf_mapped =0 ; + p->bytesused =0 ; + p->length =0 ; + p->m.fd =0 ; + p->data_offset =0 ; }/*
@@ -1278,10 +1282,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb)/* Release previously acquired memory if present */ __vb2_plane_dmabuf_put (vb, &vb->planes[plane]); - vb->planes[plane].bytesused =0 ; - vb->planes[plane].length =0 ; - vb->planes[plane].m.fd =0 ; - vb->planes[plane].data_offset =0 ;/* Acquire each plane's memory */ mem_priv = call_ptr_memop(vb, attach_dmabuf,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 463/518 clk: imx: Remove CLK_SET_PARENT_GATE for DRAM mux for i.MX7D
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit a54c441b46a0745683c2eef5a359d22856d27323 ]
For i.MX7D DRAM related mux clock, the clock source change should ONLY be done done in low level asm code without accessing DRAM, and then calling clk API to sync the HW clock status with clk tree, it should never touch real clock source switch via clk API, so CLK_SET_PARENT_GATE flag should NOT be added, otherwise, DRAM's clock parent will be disabled when DRAM is active, and system will hang.
--- drivers/clk/imx/clk-imx7d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx7d.c +2 -2
@@ -498,9 +498,9 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) hws[IMX7D_ENET_AXI_ROOT_SRC ] =imx_clk_hw_mux2_flags ("enet_axi_src" , base +0x8900 ,24 ,3 , enet_axi_sel,ARRAY_SIZE (enet_axi_sel),CLK_SET_PARENT_GATE ); hws[IMX7D_NAND_USDHC_BUS_ROOT_SRC ] =imx_clk_hw_mux2_flags ("nand_usdhc_src" , base +0x8980 ,24 ,3 , nand_usdhc_bus_sel,ARRAY_SIZE (nand_usdhc_bus_sel),CLK_SET_PARENT_GATE ); hws[IMX7D_DRAM_PHYM_ROOT_SRC ] =imx_clk_hw_mux2_flags ("dram_phym_src" , base +0x9800 ,24 ,1 , dram_phym_sel,ARRAY_SIZE (dram_phym_sel),CLK_SET_PARENT_GATE ); - hws[IMX7D_DRAM_ROOT_SRC ] =imx_clk_hw_mux2_flags ("dram_src" , base +0x9880 ,24 ,1 , dram_sel,ARRAY_SIZE (dram_sel),CLK_SET_PARENT_GATE ); + hws[IMX7D_DRAM_ROOT_SRC ] =imx_clk_hw_mux2 ("dram_src" , base +0x9880 ,24 ,1 , dram_sel,ARRAY_SIZE (dram_sel)); hws[IMX7D_DRAM_PHYM_ALT_ROOT_SRC ] =imx_clk_hw_mux2_flags ("dram_phym_alt_src" , base +0xa000 ,24 ,3 , dram_phym_alt_sel,ARRAY_SIZE (dram_phym_alt_sel),CLK_SET_PARENT_GATE ); - hws[IMX7D_DRAM_ALT_ROOT_SRC ] =imx_clk_hw_mux2_flags ("dram_alt_src" , base +0xa080 ,24 ,3 , dram_alt_sel,ARRAY_SIZE (dram_alt_sel),CLK_SET_PARENT_GATE ); + hws[IMX7D_DRAM_ALT_ROOT_SRC ] =imx_clk_hw_mux2 ("dram_alt_src" , base +0xa080 ,24 ,3 , dram_alt_sel,ARRAY_SIZE (dram_alt_sel)); hws[IMX7D_USB_HSIC_ROOT_SRC ] =imx_clk_hw_mux2_flags ("usb_hsic_src" , base +0xa100 ,24 ,3 , usb_hsic_sel,ARRAY_SIZE (usb_hsic_sel),CLK_SET_PARENT_GATE ); hws[IMX7D_PCIE_CTRL_ROOT_SRC ] =imx_clk_hw_mux2_flags ("pcie_ctrl_src" , base +0xa180 ,24 ,3 , pcie_ctrl_sel,ARRAY_SIZE (pcie_ctrl_sel),CLK_SET_PARENT_GATE ); hws[IMX7D_PCIE_PHY_ROOT_SRC ] =imx_clk_hw_mux2_flags ("pcie_phy_src" , base +0xa200 ,24 ,3 , pcie_phy_sel,ARRAY_SIZE (pcie_phy_sel),CLK_SET_PARENT_GATE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 464/518 usb: chipidea: udc: enable suspend interrupt after usb reset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit e4fdcc10092fb244218013bfe8ff01c55d54e8e4 ]
Currently, suspend interrupt is enabled before pullup enable operation. This will cause a suspend interrupt assert right after pullup DP. This suspend interrupt is meaningless, so this will ignore such interrupt by enable it after usb reset completed.
--- drivers/usb/chipidea/udc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/chipidea/udc.c +7 -1
@@ -83,7 +83,7 @@ static int hw_device_state(struct ci_hdrc *ci, u32 dma)hw_write (ci,OP_ENDPTLISTADDR , ~0 , dma);/* interrupt, error, port change, reset, sleep/suspend */ hw_write (ci,OP_USBINTR , ~0 , - USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); + USBi_UI|USBi_UEI|USBi_PCI|USBi_URI); }else {hw_write (ci,OP_USBINTR , ~0 ,0 ); }
@@ -862,6 +862,7 @@ __releases(ci->lock) __acquires(ci->lock) {int retval; +u32 intr;spin_unlock (&ci->lock);if (ci->gadget.speed !=USB_SPEED_UNKNOWN )
@@ -875,6 +876,11 @@ __acquires(ci->lock)if (retval) goto done; +/* clear SLI */ +hw_write (ci,OP_USBSTS , USBi_SLI, USBi_SLI); + intr =hw_read (ci,OP_USBINTR , ~0 ); +hw_write (ci,OP_USBINTR , ~0 , intr | USBi_SLI); + ci->status =usb_ep_alloc_request (&ci->ep0in->ep,GFP_ATOMIC );if (ci->status ==NULL ) retval = -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 465/518 usb: dwc2: Adjust the timing of USB Driver Interrupt Registration in the Crashkernel Scenario
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Shao <[email protected]>
[ Upstream commit 4058c39bd176daf11a826802d940d86292a6b02b ]
The issue is that before entering the crash kernel, the DWC USB controller did not perform operations such as resetting the interrupt mask bits. After entering the crash kernel,before the USB interrupt handler registration was completed while loading the DWC USB driver,an GINTSTS_SOF interrupt was received.This triggered the misroute_irq process within the GIC handling framework,ultimately leading to the misrouting of the interrupt,causing it to be handled by the wrong interrupt handler and resulting in the issue.
Summary:In a scenario where the kernel triggers a panic and enters the crash kernel,it is necessary to ensure that the interrupt mask bit is not enabled before the interrupt registration is complete. If an interrupt reaches the CPU at this moment,it will certainly not be handled correctly,especially in cases where this interrupt is reported frequently.
Please refer to the Crashkernel dmesg information as follows (the message on line 3 was added before devm_request_irq is called by the dwc2_driver_probe function):
[ 5.866837][ T1] dwc2 JMIC0010:01: supply vusb_d not found, using dummy regulator [ 5.874588][ T1] dwc2 JMIC0010:01: supply vusb_a not found, using dummy regulator [ 5.882335][ T1] dwc2 JMIC0010:01: before devm_request_irq irq: [71], gintmsk[0xf300080e], gintsts[0x04200009] [ 5.892686][ C0] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-jmnd1.2_RC #18 [ 5.900327][ C0] Hardware name: CMSS HyperCard4-25G/HyperCard4-25G, BIOS 1.6.4 Jul 8 2024 [ 5.908836][ C0] Call trace: [ 5.911965][ C0] dump_backtrace+0x0/0x1f0 [ 5.916308][ C0] show_stack+0x20/0x30 [ 5.920304][ C0] dump_stack+0xd8/0x140 [ 5.924387][ C0] pcie_xxx_handler+0x3c/0x1d8 [ 5.930121][ C0] __handle_irq_event_percpu+0x64/0x1e0 [ 5.935506][ C0] handle_irq_event+0x80/0x1d0 [ 5.940109][ C0] try_one_irq+0x138/0x174 [ 5.944365][ C0] misrouted_irq+0x134/0x140 [ 5.948795][ C0] note_interrupt+0x1d0/0x30c [ 5.953311][ C0] handle_irq_event+0x13c/0x1d0 [ 5.958001][ C0] handle_fasteoi_irq+0xd4/0x260 [ 5.962779][ C0] __handle_domain_irq+0x88/0xf0 [ 5.967555][ C0] gic_handle_irq+0x9c/0x2f0 [ 5.971985][ C0] el1_irq+0xb8/0x140 [ 5.975807][ C0] __setup_irq+0x3dc/0x7cc [ 5.980064][ C0] request_threaded_irq+0xf4/0x1b4 [ 5.985015][ C0] devm_request_threaded_irq+0x80/0x100 [ 5.990400][ C0] dwc2_driver_probe+0x1b8/0x6b0 [ 5.995178][ C0] platform_drv_probe+0x5c/0xb0 [ 5.999868][ C0] really_probe+0xf8/0x51c [ 6.004125][ C0] driver_probe_device+0xfc/0x170 [ 6.008989][ C0] device_driver_attach+0xc8/0xd0 [ 6.013853][ C0] __driver_attach+0xe8/0x1b0 [ 6.018369][ C0] bus_for_each_dev+0x7c/0xdc [ 6.022886][ C0] driver_attach+0x2c/0x3c [ 6.027143][ C0] bus_add_driver+0xdc/0x240 [ 6.031573][ C0] driver_register+0x80/0x13c [ 6.036090][ C0] __platform_driver_register+0x50/0x5c [ 6.041476][ C0] dwc2_platform_driver_init+0x24/0x30 [ 6.046774][ C0] do_one_initcall+0x50/0x25c [ 6.051291][ C0] do_initcall_level+0xe4/0xfc [ 6.055894][ C0] do_initcalls+0x80/0xa4 [ 6.060064][ C0] kernel_init_freeable+0x198/0x240 [ 6.065102][ C0] kernel_init+0x1c/0x12c
--- drivers/usb/dwc2/platform.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/usb/dwc2/platform.c +14 -12
@@ -441,18 +441,6 @@ static int dwc2_driver_probe(struct platform_device *dev)spin_lock_init (&hsotg->lock); - hsotg->irq =platform_get_irq (dev,0 ); -if (hsotg->irq <0 ) -return hsotg->irq; - -dev_dbg (hsotg->dev,"registering common handler for irq%d\n" , - hsotg->irq); - retval =devm_request_irq (hsotg->dev, hsotg->irq, - dwc2_handle_common_intr,IRQF_SHARED , -dev_name (hsotg->dev), hsotg); -if (retval) -return retval; - hsotg->vbus_supply =devm_regulator_get_optional (hsotg->dev,"vbus" );if (IS_ERR (hsotg->vbus_supply)) { retval =PTR_ERR (hsotg->vbus_supply);
@@ -496,6 +484,20 @@ static int dwc2_driver_probe(struct platform_device *dev)if (retval) goto error; + hsotg->irq =platform_get_irq (dev,0 ); +if (hsotg->irq <0 ) { + retval = hsotg->irq; + goto error; + } + +dev_dbg (hsotg->dev,"registering common handler for irq%d\n" , + hsotg->irq); + retval =devm_request_irq (hsotg->dev, hsotg->irq, + dwc2_handle_common_intr,IRQF_SHARED , +dev_name (hsotg->dev), hsotg); +if (retval) + goto error; +/* * For OTG cores, set the force mode bits to reflect the value * of dr_mode. Force mode bits should not be touched at any
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 466/518 virtio_pmem: Check device status before requesting flush
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Chen <[email protected]>
[ Upstream commit e25fbcd97cf52c3c9824d44b5c56c19673c3dd50 ]
If a pmem device is in a bad status, the driver side could wait for host ack forever in virtio_pmem_flush(), causing the system to hang.
So add a status check in the beginning of virtio_pmem_flush() to return early if the device is not activated.
Message-Id: <[email protected]>
--- drivers/nvdimm/nd_virtio.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/nvdimm/nd_virtio.c +9 -0
@@ -44,6 +44,15 @@ static int virtio_pmem_flush(struct nd_region *nd_region)unsigned long flags;int err, err1; +/* +* Don't bother to submit the request to the device if the device is +* not activated. +*/ +if (vdev->config->get_status (vdev) &VIRTIO_CONFIG_S_NEEDS_RESET ) { +dev_info (&vdev->dev,"virtio pmem device needs a reset\n" ); +return -EIO ; + } +might_sleep (); req_data =kmalloc (sizeof (*req_data),GFP_KERNEL );if (!req_data)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 467/518 tools/iio: Add memory allocation failure check for trigger_name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <[email protected]>
[ Upstream commit 3c6b818b097dd6932859bcc3d6722a74ec5931c1 ]
Added a check to handle memory allocation failure for trigger_name and return -ENOMEM.
--- tools/iio/iio_generic_buffer.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/iio/iio_generic_buffer.c +4 -0
@@ -479,6 +479,10 @@ int main(int argc, char **argv)return -ENOMEM ; } trigger_name =malloc (IIO_MAX_NAME_LENGTH ); +if (!trigger_name) { + ret = -ENOMEM ; + goto error; + } ret =read_sysfs_string ("name" , trig_dev_name, trigger_name);free (trig_dev_name);if (ret <0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 468/518 driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit c0fd973c108cdc22a384854bc4b3e288a9717bb2 ]
Return -EIO instead of 0 for below erroneous bus attribute operations:
- read a bus attribute without show().
- write a bus attribute without store().
--- drivers/base/bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/bus.c +4 -2
@@ -104,7 +104,8 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr, {struct bus_attribute *bus_attr =to_bus_attr (attr);struct subsys_private *subsys_priv =to_subsys_private (kobj); -ssize_t ret =0 ; +/* return -EIO for reading a bus attribute without show() */ +ssize_t ret = -EIO ;if (bus_attr->show) ret = bus_attr->show (subsys_priv->bus, buf);
@@ -116,7 +117,8 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr, {struct bus_attribute *bus_attr =to_bus_attr (attr);struct subsys_private *subsys_priv =to_subsys_private (kobj); -ssize_t ret =0 ; +/* return -EIO for writing a bus attribute without store() */ +ssize_t ret = -EIO ;if (bus_attr->store) ret = bus_attr->store (subsys_priv->bus, buf, count);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 469/518 drm/amd/display: Check null pointer before dereferencing se
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
[ Upstream commit ff599ef6970ee000fa5bc38d02fa5ff5f3fc7575 ]
[WHAT & HOW]
se is null checked previously in the same function, indicating it might be null; therefore, it must be checked when used again.
This fixes 1 FORWARD_NULL issue reported by Coverity.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
@@ -1258,7 +1258,7 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc,if (crtc_timing->pix_clk_100hz != pix_clk_100hz)return false; -if (!se->funcs->dp_get_pixel_format) +if (!se || !se->funcs->dp_get_pixel_format)return false; if (!se->funcs->dp_get_pixel_format(
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 470/518 fbdev: sisfb: Fix strbuf array overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Shumilin <[email protected]>
[ Upstream commit 9cf14f5a2746c19455ce9cb44341b5527b5e19c3 ]
The values of the variables xres and yres are placed in strbuf. These variables are obtained from strbuf1.
The strbuf1 array contains digit characters
and a space if the array contains non-digit characters. Then, when executing sprintf(strbuf, "%ux%ux8", xres, yres); more than 16 bytes will be written to strbuf.
It is suggested to increase the size of the strbuf array to 24.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/video/fbdev/sis/sis_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sis/sis_main.c +1 -1
@@ -183,7 +183,7 @@ static void sisfb_search_mode(char *name, bool quiet) {unsigned int j =0 , xres =0 , yres =0 , depth =0 , rate =0 ;int i =0 ; -char strbuf[16 ], strbuf1[20 ]; +char strbuf[24 ], strbuf1[20 ];char *nameptr = name;/* We don't know the hardware specs yet and there is no ivideo */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 471/518 RDMA/rxe: Fix seg fault in rxe_comp_queue_pkt
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
commit 2b23b6097303ed0ba5f4bc036a1c07b6027af5c6 upstream.
In rxe_comp_queue_pkt() an incoming response packet skb is enqueued to the resp_pkts queue and then a decision is made whether to run the completer task inline or schedule it. Finally the skb is dereferenced to bump a 'hw' performance counter. This is wrong because if the completer task is already running in a separate thread it may have already processed the skb and freed it which can cause a seg fault. This has been observed infrequently in testing at high scale.
This patch fixes this by changing the order of enqueuing the packet until after the counter is accessed.
[Sherry: bp to fix CVE-2024-38544. Fix conflict due to missing commit:dccb23f6c312 ("RDMA/rxe: Split rxe_run_task() into two subroutines") which is not necessary to backport]
--- drivers/infiniband/sw/rxe/rxe_comp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +3 -3
@@ -123,12 +123,12 @@ void rxe_comp_queue_pkt(struct rxe_qp *q {int must_sched; -skb_queue_tail (&qp->resp_pkts, skb); - - must_sched =skb_queue_len (&qp->resp_pkts) >1 ; + must_sched =skb_queue_len (&qp->resp_pkts) >0 ;if (must_sched !=0 )rxe_counter_inc (SKB_TO_PKT (skb)->rxe,RXE_CNT_COMPLETER_SCHED ); +skb_queue_tail (&qp->resp_pkts, skb); +rxe_run_task (&qp->comp.task, must_sched); }
Greg Kroah-Hartman
maintainerPATCH 472/518 NFSD: Mark filecache "down" if init fails
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit dc0d0f885aa422f621bc1c2124133eff566b0bc8 ]
NeilBrown says:
Quoted 4 lines
The handling of
NFSD_FILE_CACHE_UPis strange.nfsd_file_cache_init()sets it, but doesn't clear it on failure. So ifnfsd_file_cache_init()fails for some reason,nfsd_file_cache_shutdown()would still try to clean up if it was called.
--- fs/nfsd/filecache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/filecache.c +3 -1
@@ -717,7 +717,7 @@ nfsd_file_cache_init(void) ret =rhltable_init (&nfsd_file_rhltable, &nfsd_file_rhash_params);if (ret) -return ret; + goto out; ret = -ENOMEM ; nfsd_filecache_wq =alloc_workqueue ("nfsd_filecache" ,0 ,0 );
@@ -769,6 +769,8 @@ nfsd_file_cache_init(void)INIT_DELAYED_WORK (&nfsd_filecache_laundrette, nfsd_file_gc_worker); out: +if (ret) +clear_bit (NFSD_FILE_CACHE_UP , &nfsd_file_flags);return ret; out_notifier:lease_unregister_notifier (&nfsd_file_lease_notifier);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 473/518 ice: fix VLAN replay after reset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Ertman <[email protected]>
[ Upstream commit 0eae2c136cb624e4050092feb59f18159b4f2512 ]
There is a bug currently when there are more than one VLAN defined and any reset that affects the PF is initiated, after the reset rebuild no traffic will pass on any VLAN but the last one created.
This is caused by the iteration though the VLANs during replay each clearing the vsi_map bitmap of the VSI that is being replayed. The problem is that during rhe replay, the pointer to the vsi_map bitmap is used by each successive vlan to determine if it should be replayed on this VSI.
The logic was that the replay of the VLAN would replace the bit in the map before the next VLAN would iterate through. But, since the replay copies the old bitmap pointer to filt_replay_rules and creates a new one for the recreated VLANS, it does not do this, and leaves the old bitmap broken to be used to replay the remaining VLANs.
Since the old bitmap will be cleaned up in post replay cleanup, there is no need to alter it and break following VLAN replay, so don't clear the bit.
--- drivers/net/ethernet/intel/ice/ice_switch.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +0 -2
@@ -2789,8 +2789,6 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,if (!itr->vsi_list_info || !test_bit (vsi_handle, itr->vsi_list_info->vsi_map))continue ; -/* Clearing it so that the logic can add it back */ -clear_bit (vsi_handle, itr->vsi_list_info->vsi_map); f_entry.fltr_info.vsi_handle = vsi_handle; f_entry.fltr_info.fltr_act =ICE_FWD_TO_VSI ;/* update the src in case it is VSI num */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 474/518 SUNRPC: Fix integer overflow in decode_rc_list()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 6dbf1f341b6b35bcc20ff95b6b315e509f6c5369 ]
The math in "rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)" could have an integer overflow. Add bounds checking on rc_list->rcl_nrefcalls to fix that.
--- fs/nfs/callback_xdr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/callback_xdr.c +2 -0
@@ -372,6 +372,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr, rc_list->rcl_nrefcalls =ntohl (*p++);if (rc_list->rcl_nrefcalls) { +if (unlikely (rc_list->rcl_nrefcalls > xdr->buf->len)) + goto out; p =xdr_inline_decode (xdr, rc_list->rcl_nrefcalls *2 *sizeof (uint32_t ));if (unlikely (p ==NULL ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 475/518 NFSv4: Prevent NULL-pointer dereference in nfs42_complete_copies()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanjun Zhang <[email protected]>
[ Upstream commit a848c29e3486189aaabd5663bc11aea50c5bd144 ]
On the node of an NFS client, some files saved in the mountpoint of the NFS server were copied to another location of the same NFS server. Accidentally, the nfs42_complete_copies() got a NULL-pointer dereference crash with the following syslog:
[232064.838881] NFSv4: state recovery failed for open file nfs/pvc-12b5200d-cd0f-46a3-b9f0-af8f4fe0ef64.qcow2, error = -116 [232064.839360] NFSv4: state recovery failed for open file nfs/pvc-12b5200d-cd0f-46a3-b9f0-af8f4fe0ef64.qcow2, error = -116 [232066.588183] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058 [232066.588586] Mem abort info: [232066.588701] ESR = 0x0000000096000007 [232066.588862] EC = 0x25: DABT (current EL), IL = 32 bits [232066.589084] SET = 0, FnV = 0 [232066.589216] EA = 0, S1PTW = 0 [232066.589340] FSC = 0x07: level 3 translation fault [232066.589559] Data abort info: [232066.589683] ISV = 0, ISS = 0x00000007 [232066.589842] CM = 0, WnR = 0 [232066.589967] user pgtable: 64k pages, 48-bit VAs, pgdp=00002000956ff400 [232066.590231] [0000000000000058] pgd=08001100ae100003, p4d=08001100ae100003, pud=08001100ae100003, pmd=08001100b3c00003, pte=0000000000000000 [232066.590757] Internal error: Oops: 96000007 [#1] SMP [232066.590958] Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm vhost_net vhost vhost_iotlb tap tun ipt_rpfilter xt_multiport ip_set_hash_ip ip_set_hash_net xfrm_interface xfrm6_tunnel tunnel4 tunnel6 esp4 ah4 wireguard libcurve25519_generic veth xt_addrtype xt_set nf_conntrack_netlink ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_bitmap_port ip_set_hash_ipport dummy ip_set ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs iptable_filter sch_ingress nfnetlink_cttimeout vport_gre ip_gre ip_tunnel gre vport_geneve geneve vport_vxlan vxlan ip6_udp_tunnel udp_tunnel openvswitch nf_conncount dm_round_robin dm_service_time dm_multipath xt_nat xt_MASQUERADE nft_chain_nat nf_nat xt_mark xt_conntrack xt_comment nft_compat nft_counter nf_tables nfnetlink ocfs2 ocfs2_nodemanager ocfs2_stackglue iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ipmi_ssif nbd overlay 8021q garp mrp bonding tls rfkill sunrpc ext4 mbcache jbd2 [232066.591052] vfat fat cas_cache cas_disk ses enclosure scsi_transport_sas sg acpi_ipmi ipmi_si ipmi_devintf ipmi_msghandler ip_tables vfio_pci vfio_pci_core vfio_virqfd vfio_iommu_type1 vfio dm_mirror dm_region_hash dm_log dm_mod nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 br_netfilter bridge stp llc fuse xfs libcrc32c ast drm_vram_helper qla2xxx drm_kms_helper syscopyarea crct10dif_ce sysfillrect ghash_ce sysimgblt sha2_ce fb_sys_fops cec sha256_arm64 sha1_ce drm_ttm_helper ttm nvme_fc igb sbsa_gwdt nvme_fabrics drm nvme_core i2c_algo_bit i40e scsi_transport_fc megaraid_sas aes_neon_bs [232066.596953] CPU: 6 PID: 4124696 Comm: 10.253.166.125- Kdump: loaded Not tainted 5.15.131-9.cl9_ocfs2.aarch64 #1 [232066.597356] Hardware name: Great Wall .\x93\x8e...RF6260 V5/GWMSSE2GL1T, BIOS T656FBE_V3.0.18 2024-01-06 [232066.597721] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [232066.598034] pc : nfs4_reclaim_open_state+0x220/0x800 [nfsv4] [232066.598327] lr : nfs4_reclaim_open_state+0x12c/0x800 [nfsv4] [232066.598595] sp : ffff8000f568fc70 [232066.598731] x29: ffff8000f568fc70 x28: 0000000000001000 x27: ffff21003db33000 [232066.599030] x26: ffff800005521ae0 x25: ffff0100f98fa3f0 x24: 0000000000000001 [232066.599319] x23: ffff800009920008 x22: ffff21003db33040 x21: ffff21003db33050 [232066.599628] x20: ffff410172fe9e40 x19: ffff410172fe9e00 x18: 0000000000000000 [232066.599914] x17: 0000000000000000 x16: 0000000000000004 x15: 0000000000000000 [232066.600195] x14: 0000000000000000 x13: ffff800008e685a8 x12: 00000000eac0c6e6 [232066.600498] x11: 0000000000000000 x10: 0000000000000008 x9 : ffff8000054e5828 [232066.600784] x8 : 00000000ffffffbf x7 : 0000000000000001 x6 : 000000000a9eb14a [232066.601062] x5 : 0000000000000000 x4 : ffff70ff8a14a800 x3 : 0000000000000058 [232066.601348] x2 : 0000000000000001 x1 : 54dce46366daa6c6 x0 : 0000000000000000 [232066.601636] Call trace: [232066.601749] nfs4_reclaim_open_state+0x220/0x800 [nfsv4] [232066.601998] nfs4_do_reclaim+0x1b8/0x28c [nfsv4] [232066.602218] nfs4_state_manager+0x928/0x10f0 [nfsv4] [232066.602455] nfs4_run_state_manager+0x78/0x1b0 [nfsv4] [232066.602690] kthread+0x110/0x114 [232066.602830] ret_from_fork+0x10/0x20 [232066.602985] Code: 1400000d f9403f20 f9402e61 91016003 (f9402c00) [232066.603284] SMP: stopping secondary CPUs [232066.606936] Starting crashdump kernel... [232066.607146] Bye!
Analysing the vmcore, we know that nfs4_copy_state listed by destination nfs_server->ss_copies was added by the field copies in handle_async_copy(), and we found a waiting copy process with the stack as:
PID: 3511963 TASK: ffff710028b47e00 CPU: 0 COMMAND: "cp"
#0 [ffff8001116ef740] __switch_to at ffff8000081b92f4
#1 [ffff8001116ef760] __schedule at ffff800008dd0650
#2 [ffff8001116ef7c0] schedule at ffff800008dd0a00
#3 [ffff8001116ef7e0] schedule_timeout at ffff800008dd6aa0
#4 [ffff8001116ef860] __wait_for_common at ffff800008dd166c
#5 [ffff8001116ef8e0] wait_for_completion_interruptible at ffff800008dd1898 #6 [ffff8001116ef8f0] handle_async_copy at ffff8000055142f4 [nfsv4]
#7 [ffff8001116ef970] _nfs42_proc_copy at ffff8000055147c8 [nfsv4]
#8 [ffff8001116efa80] nfs42_proc_copy at ffff800005514cf0 [nfsv4]
#9 [ffff8001116efc50] __nfs4_copy_file_range.constprop.0 at ffff8000054ed694 [nfsv4]
The NULL-pointer dereference was due to nfs42_complete_copies() listed the nfs_server->ss_copies by the field ss_copies of nfs4_copy_state. So the nfs4_copy_state address ffff0100f98fa3f0 was offset by 0x10 and the data accessed through this pointer was also incorrect. Generally, the ordered list nfs4_state_owner->so_states indicate open(O_RDWR) or open(O_WRITE) states are reclaimed firstly by nfs4_reclaim_open_state(). When destination state reclaim is failed with NFS_STATE_RECOVERY_FAILED and copies are not deleted in nfs_server->ss_copies, the source state may be passed to the nfs42_complete_copies() process earlier, resulting in this crash scene finally. To solve this issue, we add a list_head nfs_server->ss_src_copies for a server-to-server copy specially.
--- fs/nfs/client.c | 1 + fs/nfs/nfs42proc.c | 2 +- fs/nfs/nfs4state.c | 2 +- include/linux/nfs_fs_sb.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
fs/nfs/client.c +1 -0
@@ -927,6 +927,7 @@ struct nfs_server *nfs_alloc_server(void)INIT_LIST_HEAD (&server->layouts);INIT_LIST_HEAD (&server->state_owners_lru);INIT_LIST_HEAD (&server->ss_copies); +INIT_LIST_HEAD (&server->ss_src_copies);atomic_set (&server->active,0 );
fs/nfs/nfs42proc.c +1 -1
@@ -210,7 +210,7 @@ static int handle_async_copy(struct nfs42_copy_res *res,if (dst_server != src_server) {spin_lock (&src_server->nfs_client->cl_lock); -list_add_tail (©->src_copies, &src_server->ss_copies); +list_add_tail (©->src_copies, &src_server->ss_src_copies);spin_unlock (&src_server->nfs_client->cl_lock); }
fs/nfs/nfs4state.c +1 -1
@@ -1596,7 +1596,7 @@ static void nfs42_complete_copies(struct nfs4_state_owner *sp, struct nfs4_statecomplete (©->completion); } } -list_for_each_entry (copy, &sp->so_server->ss_copies, src_copies) { +list_for_each_entry (copy, &sp->so_server->ss_src_copies, src_copies) {if ((test_bit (NFS_CLNT_SRC_SSC_COPY_STATE , &state->flags) && !nfs4_stateid_match_other (&state->stateid, ©->parent_src_state->stateid)))
include/linux/nfs_fs_sb.h +1 -0
@@ -230,6 +230,7 @@ struct nfs_server {struct list_head layouts;struct list_head delegations;struct list_head ss_copies; +struct list_head ss_src_copies;unsigned long mig_gen;unsigned long mig_status;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 476/518 net: phy: dp83869: fix memory corruption when enabling fiber
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo van Lil <[email protected]>
[ Upstream commit a842e443ca8184f2dc82ab307b43a8b38defd6a5 ]
When configuring the fiber port, the DP83869 PHY driver incorrectly calls linkmode_set_bit() with a bit mask (1 << 10) rather than a bit number (10). This corrupts some other memory location -- in case of arm64 the priv pointer in the same structure.
Since the advertising flags are updated from supported at the end of the function the incorrect line isn't needed at all and can be removed.
--- drivers/net/phy/dp83869.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/phy/dp83869.c +0 -1
@@ -610,7 +610,6 @@ static int dp83869_configure_fiber(struct phy_device *phydev, phydev->supported);linkmode_set_bit (ETHTOOL_LINK_MODE_FIBRE_BIT , phydev->supported); -linkmode_set_bit (ADVERTISED_FIBRE , phydev->advertising);if (dp83869->mode ==DP83869_RGMII_1000_BASE ) { linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 477/518 tcp: fix to allow timestamp undo if no retransmits were sent
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit e37ab7373696e650d3b6262a5b882aadad69bb9e ]
Fix the TCP loss recovery undo logic in tcp_packet_delayed() so that it can trigger undo even if TSQ prevents a fast recovery episode from reaching tcp_retransmit_skb().
Geumhwan Yu <[email protected]> recently reported that after this commit from 2019:
commit bc9f38c8328e ("tcp: avoid unconditional congestion window undo on SYN retransmit")
...and before this fix we could have buggy scenarios like the following:
+ Due to reordering, a TCP connection receives some SACKs and enters a spurious fast recovery.
+ TSQ prevents all invocations of tcp_retransmit_skb(), because many skbs are queued in lower layers of the sending machine's network stack; thus tp->retrans_stamp remains 0.
+ The connection receives a TCP timestamp ECR value echoing a timestamp before the fast recovery, indicating that the fast recovery was spurious.
+ The connection fails to undo the spurious fast recovery because tp->retrans_stamp is 0, and thus tcp_packet_delayed() returns false, due to the new logic in the 2019 commit: commit bc9f38c8328e ("tcp:
avoid unconditional congestion window undo on SYN retransmit")
This fix tweaks the logic to be more similar to the tcp_packet_delayed() logic before bc9f38c8328e, except that we take care not to be fooled by the FLAG_SYN_ACKED code path zeroing out tp->retrans_stamp (the bug noted and fixed by Yuchung in bc9f38c8328e).
Note that this returns the high-level behavior of tcp_packet_delayed() to again match the comment for the function, which says: "Nothing was retransmitted or returned timestamp is less than timestamp of the first retransmission." Note that this comment is in the original 2005-04-16 Linux git commit, so this is evidently long-standing behavior.
--- net/ipv4/tcp_input.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +16 -2
@@ -2423,8 +2423,22 @@ static bool tcp_skb_spurious_retrans(const struct tcp_sock *tp,*/ static inline bool tcp_packet_delayed (const struct tcp_sock *tp) { -return tp->retrans_stamp && -tcp_tsopt_ecr_before (tp, tp->retrans_stamp); +const struct sock *sk = (const struct sock *)tp; + +if (tp->retrans_stamp && +tcp_tsopt_ecr_before (tp, tp->retrans_stamp)) +return true;/* got echoed TS before first retransmission */ + +/* Check if nothing was retransmitted (retrans_stamp==0), which may +* happen in fast recovery due to TSQ. But we ignore zero retrans_stamp +* in TCP_SYN_SENT, since when we set FLAG_SYN_ACKED we also clear +* retrans_stamp even if we had retransmitted the SYN. +*/ +if (!tp->retrans_stamp &&/* no record of a retransmit/SYN? */ + sk->sk_state !=TCP_SYN_SENT )/* not the FLAG_SYN_ACKED case? */ +return true;/* nothing was retransmitted */ + +return false; }/* Undo procedures. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 478/518 tcp: fix tcp_enter_recovery() to zero retrans_stamp when its safe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit b41b4cbd9655bcebcce941bef3601db8110335be ]
Fix tcp_enter_recovery() so that if there are no retransmits out then we zero retrans_stamp when entering fast recovery. This is necessary to fix two buggy behaviors.
Currently a non-zero retrans_stamp value can persist across multiple back-to-back loss recovery episodes. This is because we generally only clears retrans_stamp if we are completely done with loss recoveries, and get to tcp_try_to_open() and find !tcp_any_retrans_done(sk). This behavior causes two bugs:
(1) When a loss recovery episode (CA_Loss or CA_Recovery) is followed immediately by a new CA_Recovery, the retrans_stamp value can persist and can be a time before this new CA_Recovery episode starts. That means that timestamp-based undo will be using the wrong retrans_stamp (a value that is too old) when comparing incoming TS ecr values to retrans_stamp to see if the current fast recovery episode can be undone.
(2) If there is a roughly minutes-long sequence of back-to-back fast recovery episodes, one after another (e.g. in a shallow-buffered or policed bottleneck), where each fast recovery successfully makes forward progress and recovers one window of sequence space (but leaves at least one retransmit in flight at the end of the recovery), followed by several RTOs, then the ETIMEDOUT check may be using the wrong retrans_stamp (a value set at the start of the first fast recovery in the sequence). This can cause a very premature ETIMEDOUT, killing the connection prematurely.
This commit changes the code to zero retrans_stamp when entering fast recovery, when this is known to be safe (no retransmits are out in the network). That ensures that when starting a fast recovery episode, and it is safe to do so, retrans_stamp is set when we send the fast retransmit packet. That addresses both bug (1) and bug (2) by ensuring that (if no retransmits are out when we start a fast recovery) we use the initial fast retransmit of this fast recovery as the time value for undo and ETIMEDOUT calculations.
This makes intuitive sense, since the start of a new fast recovery episode (in a scenario where no lost packets are out in the network) means that the connection has made forward progress since the last RTO or fast recovery, and we should thus "restart the clock" used for both undo and ETIMEDOUT logic.
Note that if when we start fast recovery there *are* retransmits out in the network, there can still be undesirable (1)/(2) issues. For example, after this patch we can still have the (1) and (2) problems in cases like this:
+ round 1: sender sends flight 1
+ round 2: sender receives SACKs and enters fast recovery 1, retransmits some packets in flight 1 and then sends some new data as flight 2
+ round 3: sender receives some SACKs for flight 2, notes losses, and retransmits some packets to fill the holes in flight 2
+ fast recovery has some lost retransmits in flight 1 and continues for one or more rounds sending retransmits for flight 1 and flight 2
+ fast recovery 1 completes when snd_una reaches high_seq at end of flight 1
+ there are still holes in the SACK scoreboard in flight 2, so we enter fast recovery 2, but some retransmits in the flight 2 sequence range are still in flight (retrans_out > 0), so we can't execute the new retrans_stamp=0 added here to clear retrans_stamp
It's not yet clear how to fix these remaining (1)/(2) issues in an efficient way without breaking undo behavior, given that retrans_stamp is currently used for undo and ETIMEDOUT. Perhaps the optimal (but expensive) strategy would be to set retrans_stamp to the timestamp of the earliest outstanding retransmit when entering fast recovery. But at least this commit makes things better.
Note that this does not change the semantics of retrans_stamp; it simply makes retrans_stamp accurate in some cases where it was not before:
(1) Some loss recovery, followed by an immediate entry into a fast recovery, where there are no retransmits out when entering the fast recovery.
(2) When a TFO server has a SYNACK retransmit that sets retrans_stamp, and then the ACK that completes the 3-way handshake has SACK blocks that trigger a fast recovery. In this case when entering fast recovery we want to zero out the retrans_stamp from the TFO SYNACK retransmit, and set the retrans_stamp based on the timestamp of the fast recovery.
We introduce a tcp_retrans_stamp_cleanup() helper, because this two-line sequence already appears in 3 places and is about to appear in 2 more as a result of this bug fix patch series. Once this bug fix patches series in the net branch makes it into the net-next branch we'll update the 3 other call sites to use the new helper.
This is a long-standing issue. The Fixes tag below is chosen to be the oldest commit at which the patch will apply cleanly, which is from Linux v3.5 in 2012.
--- net/ipv4/tcp_input.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/ipv4/tcp_input.c +13 -0
@@ -2472,6 +2472,16 @@ static bool tcp_any_retrans_done(const struct sock *sk)return false; } +/* If loss recovery is finished and there are no retransmits out in the +* network, then we clear retrans_stamp so that upon the next loss recovery +* retransmits_timed_out() and timestamp-undo are using the correct value. +*/ +static void tcp_retrans_stamp_cleanup (struct sock *sk) +{ +if (!tcp_any_retrans_done (sk)) +tcp_sk (sk)->retrans_stamp =0 ; +} +static void DBGUNDO (struct sock *sk,const char *msg) {#if FASTRETRANS_DEBUG >1
@@ -2808,6 +2818,9 @@ void tcp_enter_recovery(struct sock *sk, bool ece_ack)struct tcp_sock *tp =tcp_sk (sk);int mib_idx; +/* Start the clock with our fast retransmit, for undo and ETIMEDOUT. */ +tcp_retrans_stamp_cleanup (sk); +if (tcp_is_reno (tp)) mib_idx =LINUX_MIB_TCPRENORECOVERY ;else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 479/518 netfilter: br_netfilter: fix panic with metadata_dst skb
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Roulin <[email protected]>
[ Upstream commit f9ff7665cd128012868098bbd07e28993e314fdb ]
Fix a kernel panic in the br_netfilter module when sending untagged traffic via a VxLAN device.
This happens during the check for fragmentation in br_nf_dev_queue_xmit.
It is dependent on:
1) the br_netfilter module being loaded;
2) net.bridge.bridge-nf-call-iptables set to 1;
3) a bridge with a VxLAN (single-vxlan-device) netdevice as a bridge port;
4) untagged frames with size higher than the VxLAN MTU forwarded/flooded
When forwarding the untagged packet to the VxLAN bridge port, before the netfilter hooks are called, br_handle_egress_vlan_tunnel is called and changes the skb_dst to the tunnel dst. The tunnel_dst is a metadata type of dst, i.e., skb_valid_dst(skb) is false, and metadata->dst.dev is NULL.
Then in the br_netfilter hooks, in br_nf_dev_queue_xmit, there's a check for frames that needs to be fragmented: frames with higher MTU than the VxLAN device end up calling br_nf_ip_fragment, which in turns call ip_skb_dst_mtu.
The ip_dst_mtu tries to use the skb_dst(skb) as if it was a valid dst with valid dst->dev, thus the crash.
This case was never supported in the first place, so drop the packet instead.
PING 10.0.0.2 (10.0.0.2) from 0.0.0.0 h1-eth0: 2000(2028) bytes of data.
[ 176.291791] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000110 [ 176.292101] Mem abort info: [ 176.292184] ESR = 0x0000000096000004 [ 176.292322] EC = 0x25: DABT (current EL), IL = 32 bits [ 176.292530] SET = 0, FnV = 0 [ 176.292709] EA = 0, S1PTW = 0 [ 176.292862] FSC = 0x04: level 0 translation fault [ 176.293013] Data abort info: [ 176.293104] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 [ 176.293488] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 176.293787] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 176.293995] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000043ef5000 [ 176.294166] [0000000000000110] pgd=0000000000000000, p4d=0000000000000000 [ 176.294827] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP [ 176.295252] Modules linked in: vxlan ip6_udp_tunnel udp_tunnel veth br_netfilter bridge stp llc ipv6 crct10dif_ce [ 176.295923] CPU: 0 PID: 188 Comm: ping Not tainted 6.8.0-rc3-g5b3fbd61b9d1 #2 [ 176.296314] Hardware name: linux,dummy-virt (DT) [ 176.296535] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 176.296808] pc : br_nf_dev_queue_xmit+0x390/0x4ec [br_netfilter] [ 176.297382] lr : br_nf_dev_queue_xmit+0x2ac/0x4ec [br_netfilter] [ 176.297636] sp : ffff800080003630 [ 176.297743] x29: ffff800080003630 x28: 0000000000000008 x27: ffff6828c49ad9f8 [ 176.298093] x26: ffff6828c49ad000 x25: 0000000000000000 x24: 00000000000003e8 [ 176.298430] x23: 0000000000000000 x22: ffff6828c4960b40 x21: ffff6828c3b16d28 [ 176.298652] x20: ffff6828c3167048 x19: ffff6828c3b16d00 x18: 0000000000000014 [ 176.298926] x17: ffffb0476322f000 x16: ffffb7e164023730 x15: 0000000095744632 [ 176.299296] x14: ffff6828c3f1c880 x13: 0000000000000002 x12: ffffb7e137926a70 [ 176.299574] x11: 0000000000000001 x10: ffff6828c3f1c898 x9 : 0000000000000000 [ 176.300049] x8 : ffff6828c49bf070 x7 : 0008460f18d5f20e x6 : f20e0100bebafeca [ 176.300302] x5 : ffff6828c7f918fe x4 : ffff6828c49bf070 x3 : 0000000000000000 [ 176.300586] x2 : 0000000000000000 x1 : ffff6828c3c7ad00 x0 : ffff6828c7f918f0 [ 176.300889] Call trace: [ 176.301123] br_nf_dev_queue_xmit+0x390/0x4ec [br_netfilter] [ 176.301411] br_nf_post_routing+0x2a8/0x3e4 [br_netfilter] [ 176.301703] nf_hook_slow+0x48/0x124 [ 176.302060] br_forward_finish+0xc8/0xe8 [bridge] [ 176.302371] br_nf_hook_thresh+0x124/0x134 [br_netfilter] [ 176.302605] br_nf_forward_finish+0x118/0x22c [br_netfilter] [ 176.302824] br_nf_forward_ip.part.0+0x264/0x290 [br_netfilter] [ 176.303136] br_nf_forward+0x2b8/0x4e0 [br_netfilter] [ 176.303359] nf_hook_slow+0x48/0x124 [ 176.303803] __br_forward+0xc4/0x194 [bridge] [ 176.304013] br_flood+0xd4/0x168 [bridge] [ 176.304300] br_handle_frame_finish+0x1d4/0x5c4 [bridge] [ 176.304536] br_nf_hook_thresh+0x124/0x134 [br_netfilter] [ 176.304978] br_nf_pre_routing_finish+0x29c/0x494 [br_netfilter] [ 176.305188] br_nf_pre_routing+0x250/0x524 [br_netfilter] [ 176.305428] br_handle_frame+0x244/0x3cc [bridge] [ 176.305695] __netif_receive_skb_core.constprop.0+0x33c/0xecc [ 176.306080] __netif_receive_skb_one_core+0x40/0x8c [ 176.306197] __netif_receive_skb+0x18/0x64 [ 176.306369] process_backlog+0x80/0x124 [ 176.306540] __napi_poll+0x38/0x17c [ 176.306636] net_rx_action+0x124/0x26c [ 176.306758] __do_softirq+0x100/0x26c [ 176.307051] ____do_softirq+0x10/0x1c [ 176.307162] call_on_irq_stack+0x24/0x4c [ 176.307289] do_softirq_own_stack+0x1c/0x2c [ 176.307396] do_softirq+0x54/0x6c [ 176.307485] __local_bh_enable_ip+0x8c/0x98 [ 176.307637] __dev_queue_xmit+0x22c/0xd28 [ 176.307775] neigh_resolve_output+0xf4/0x1a0 [ 176.308018] ip_finish_output2+0x1c8/0x628 [ 176.308137] ip_do_fragment+0x5b4/0x658 [ 176.308279] ip_fragment.constprop.0+0x48/0xec [ 176.308420] __ip_finish_output+0xa4/0x254 [ 176.308593] ip_finish_output+0x34/0x130 [ 176.308814] ip_output+0x6c/0x108 [ 176.308929] ip_send_skb+0x50/0xf0 [ 176.309095] ip_push_pending_frames+0x30/0x54 [ 176.309254] raw_sendmsg+0x758/0xaec [ 176.309568] inet_sendmsg+0x44/0x70 [ 176.309667] __sys_sendto+0x110/0x178 [ 176.309758] __arm64_sys_sendto+0x28/0x38 [ 176.309918] invoke_syscall+0x48/0x110 [ 176.310211] el0_svc_common.constprop.0+0x40/0xe0 [ 176.310353] do_el0_svc+0x1c/0x28 [ 176.310434] el0_svc+0x34/0xb4 [ 176.310551] el0t_64_sync_handler+0x120/0x12c [ 176.310690] el0t_64_sync+0x190/0x194 [ 176.311066] Code: f9402e61 79402aa2 927ff821 f9400023 (f9408860) [ 176.315743] ---[ end trace 0000000000000000 ]--- [ 176.316060] Kernel panic - not syncing: Oops: Fatal exception in interrupt [ 176.316371] Kernel Offset: 0x37e0e3000000 from 0xffff800080000000 [ 176.316564] PHYS_OFFSET: 0xffff97d780000000 [ 176.316782] CPU features: 0x0,88000203,3c020000,0100421b [ 176.317210] Memory Limit: none [ 176.317527] ---[ end Kernel panic - not syncing: Oops: Fatal
Exception in interrupt ]---\
--- net/bridge/br_netfilter_hooks.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bridge/br_netfilter_hooks.c +5 -0
@@ -33,6 +33,7 @@#include <net/ip.h> #include <net/ipv6.h> #include <net/addrconf.h> +#include <net/dst_metadata.h> #include <net/route.h> #include <net/netfilter/br_netfilter.h> #include <net/netns/generic.h>
@@ -753,6 +754,10 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buffreturn br_dev_queue_push_xmit (net, sk, skb); } +/* Fragmentation on metadata/template dst is not supported */ +if (unlikely (!skb_valid_dst (skb))) + goto drop; +/* This is wrong! We should preserve the original fragment * boundaries by preserving frag_list rather than refragmenting. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 480/518 Bluetooth: RFCOMM: FIX possible deadlock in rfcomm_sk_state_change
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 08d1914293dae38350b8088980e59fbc699a72fe ]
rfcomm_sk_state_change attempts to use sock_lock so it must never be called with it locked but rfcomm_sock_ioctl always attempt to lock it causing the following trace:
======================================================
WARNING: possible circular locking dependency detected
6.8.0-syzkaller-08951-gfe46a7dd189e #0 Not tainted
------------------------------------------------------
syz-executor386/5093 is trying to acquire lock:ffff88807c396258 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1671 [inline] ffff88807c396258 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at: rfcomm_sk_state_change+0x5b/0x310 net/bluetooth/rfcomm/sock.c:73
but task is already holding lock:ffff88807badfd28 (&d->lock){+.+.}-{3:3}, at: __rfcomm_dlc_close+0x226/0x6a0 net/bluetooth/rfcomm/core.c:491
--- net/bluetooth/rfcomm/sock.c | 2 -- 1 file changed, 2 deletions(-)
net/bluetooth/rfcomm/sock.c +0 -2
@@ -871,9 +871,7 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lonif (err == -ENOIOCTLCMD ) {#ifdef CONFIG_BT_RFCOMM_TTY -lock_sock (sk); err =rfcomm_dev_ioctl (sk, cmd, (void __user *) arg); -release_sock (sk);#else err = -EOPNOTSUPP ;#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 481/518 net: phy: bcm84881: Fix some error handling paths
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 9234a2549cb6ac038bec36cc7c084218e9575513 ]
If phy_read_mmd() fails, the error code stored in 'bmsr' should be returned instead of 'val' which is likely to be 0.
--- drivers/net/phy/bcm84881.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/bcm84881.c +2 -2
@@ -120,7 +120,7 @@ static int bcm84881_aneg_done(struct phy_device *phydev) bmsr =phy_read_mmd (phydev,MDIO_MMD_AN ,MDIO_AN_C22 +MII_BMSR );if (bmsr <0 ) -return val; +return bmsr;return !!(val &MDIO_AN_STAT1_COMPLETE ) && !!(bmsr &BMSR_ANEGCOMPLETE );
@@ -146,7 +146,7 @@ static int bcm84881_read_status(struct phy_device *phydev) bmsr =phy_read_mmd (phydev,MDIO_MMD_AN ,MDIO_AN_C22 +MII_BMSR );if (bmsr <0 ) -return val; +return bmsr; phydev->autoneg_complete = !!(val &MDIO_AN_STAT1_COMPLETE ) && !!(bmsr &BMSR_ANEGCOMPLETE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 482/518 net: dsa: b53: fix jumbo frame mtu check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 42fb3acf6826c6764ba79feb6e15229b43fd2f9f ]
JMS_MIN_SIZE is the full ethernet frame length, while mtu is just the data payload size. Comparing these two meant that mtus between 1500 and 1518 did not trigger enabling jumbo frames.
So instead compare the set mtu ETH_DATA_LEN, which is equal to JMS_MIN_SIZE - ETH_HLEN - ETH_FCS_LEN;
Also do a check that the requested mtu is actually greater than the minimum length, else we do not need to enable jumbo frames.
In practice this only introduced a very small range of mtus that did not work properly. Newer chips allow 2000 byte large frames by default, and older chips allow 1536 bytes long, which is equivalent to an mtu of 1514. So effectivly only mtus of 1515~1517 were broken.
--- drivers/net/dsa/b53/b53_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +1 -1
@@ -2183,7 +2183,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)if (!dsa_is_cpu_port (ds, port))return 0 ; - enable_jumbo = (mtu >=JMS_MIN_SIZE ); + enable_jumbo = (mtu >ETH_DATA_LEN ); allow_10_100 = (dev->chip_id ==BCM583XX_DEVICE_ID );return b53_set_jumbo (dev, enable_jumbo, allow_10_100);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 483/518 net: dsa: b53: fix max MTU for 1g switches
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 680a8217dc00dc7e7da57888b3c053289b60eb2b ]
JMS_MAX_SIZE is the ethernet frame length, not the MTU, which is payload without ethernet headers.
According to the datasheets maximum supported frame length for most gigabyte swithes is 9720 bytes, so convert that to the expected MTU when using VLAN tagged frames.
--- drivers/net/dsa/b53/b53_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +4 -1
@@ -27,6 +27,7 @@#include <linux/phylink.h> #include <linux/etherdevice.h> #include <linux/if_bridge.h> +#include <linux/if_vlan.h> #include <net/dsa.h> #include "b53_regs.h"
@@ -224,6 +225,8 @@ static const struct b53_mib_desc b53_mibs_58xx[] = {#define B53_MIBS_58XX_SIZE ARRAY_SIZE(b53_mibs_58xx) +#define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) +static int b53_do_vlan_op (struct b53_device *dev,u8 op) {unsigned int i;
@@ -2191,7 +2194,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)static int b53_get_max_mtu (struct dsa_switch *ds,int port) { -return JMS_MAX_SIZE ; +return B53_MAX_MTU ; }static const struct dsa_switch_ops b53_switch_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 484/518 net: dsa: b53: fix max MTU for BCM5325/BCM5365
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit ca8c1f71c10193c270f772d70d34b15ad765d6a8 ]
BCM5325/BCM5365 do not support jumbo frames, so we should not report a jumbo frame mtu for them. But they do support so called "oversized" frames up to 1536 bytes long by default, so report an appropriate MTU.
--- drivers/net/dsa/b53/b53_common.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/dsa/b53/b53_common.c +6 -0
@@ -225,6 +225,7 @@ static const struct b53_mib_desc b53_mibs_58xx[] = {#define B53_MIBS_58XX_SIZE ARRAY_SIZE(b53_mibs_58xx) +#define B53_MAX_MTU_25 (1536 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)#define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)static int b53_do_vlan_op (struct b53_device *dev,u8 op)
@@ -2194,6 +2195,11 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)static int b53_get_max_mtu (struct dsa_switch *ds,int port) { +struct b53_device *dev = ds->priv; + +if (is5325 (dev) ||is5365 (dev)) +return B53_MAX_MTU_25 ; +return B53_MAX_MTU ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 485/518 net: dsa: b53: allow lower MTUs on BCM5325/5365
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit e4b294f88a32438baf31762441f3dd1c996778be ]
While BCM5325/5365 do not support jumbo frames, they do support slightly oversized frames, so do not error out if requesting a supported MTU for them.
--- drivers/net/dsa/b53/b53_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +1 -1
@@ -2182,7 +2182,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)bool allow_10_100;if (is5325 (dev) ||is5365 (dev)) -return -EOPNOTSUPP ; +return 0 ;if (!dsa_is_cpu_port (ds, port))return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 486/518 net: dsa: b53: fix jumbo frames on 10/100 ports
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 2f3dcd0d39affe5b9ba1c351ce0e270c8bdd5109 ]
All modern chips support and need the 10_100 bit set for supporting jumbo frames on 10/100 ports, so instead of enabling it only for 583XX enable it for everything except bcm63xx, where the bit is writeable, but does nothing.
Tested on BCM53115, where jumbo frames were dropped at 10/100 speeds without the bit set.
--- drivers/net/dsa/b53/b53_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +1 -1
@@ -2188,7 +2188,7 @@ static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)return 0 ; enable_jumbo = (mtu >ETH_DATA_LEN ); - allow_10_100 = (dev->chip_id ==BCM583XX_DEVICE_ID ); + allow_10_100 = !is63xx (dev);return b53_set_jumbo (dev, enable_jumbo, allow_10_100); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 487/518 gpio: aspeed: Add the flush write to ensure the write complete.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <[email protected]>
[ Upstream commit 1bb5a99e1f3fd27accb804aa0443a789161f843c ]
Performing a dummy read ensures that the register write operation is fully completed, mitigating any potential bus delays that could otherwise impact the frequency of bitbang usage. E.g., if the JTAG application uses GPIO to control the JTAG pins (TCK, TMS, TDI, TDO, and TRST), and the application sets the TCK clock to 1 MHz, the GPIO's high/low transitions will rely on a delay function to ensure the clock frequency does not exceed 1 MHz. However, this can lead to rapid toggling of the GPIO because the write operation is POSTed and does not wait for a bus acknowledgment.
--- drivers/gpio/gpio-aspeed.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpio/gpio-aspeed.c +2 -0
@@ -404,6 +404,8 @@ static void __aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset, gpio->dcache[GPIO_BANK (offset)] = reg;iowrite32 (reg, addr); +/* Flush write */ +ioread32 (addr); } static void aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 488/518 gpio: aspeed: Use devm_clk api to manage clock source
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <[email protected]>
[ Upstream commit a6191a3d18119184237f4ee600039081ad992320 ]
Replace of_clk_get with devm_clk_get_enabled to manage the clock source.
--- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-aspeed.c +1 -1
@@ -1159,7 +1159,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)if (!gpio_id)return -EINVAL ; - gpio->clk =of_clk_get (pdev->dev.of_node,0 ); + gpio->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (gpio->clk)) {dev_warn (&pdev->dev,"Failed to get clock from devicetree, debouncing disabled\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 489/518 igb: Do not bring the device up after non-fatal error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
[ Upstream commit 330a699ecbfc9c26ec92c6310686da1230b4e7eb ]
Commit 004d25060c78 ("igb: Fix igb_down hung on surprise removal") changed igb_io_error_detected() to ignore non-fatal pcie errors in order to avoid hung task that can happen when igb_down() is called multiple times. This caused an issue when processing transient non-fatal errors. igb_io_resume(), which is called after igb_io_error_detected(), assumes that device is brought down by igb_io_error_detected() if the interface is up. This resulted in panic with stacktrace below.
[ T3256] igb 0000:09:00.0 haeth0: igb: haeth0 NIC Link is Down
[ T292] pcieport 0000:00:1c.5: AER: Uncorrected (Non-Fatal) error received: 0000:09:00.0 [ T292] igb 0000:09:00.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID) [ T292] igb 0000:09:00.0: device [8086:1537] error status/mask=00004000/00000000 [ T292] igb 0000:09:00.0: [14] CmpltTO [ 200.105524,009][ T292] igb 0000:09:00.0: AER: TLP Header: 00000000 00000000 00000000 00000000 [ T292] pcieport 0000:00:1c.5: AER: broadcast error_detected message [ T292] igb 0000:09:00.0: Non-correctable non-fatal error reported. [ T292] pcieport 0000:00:1c.5: AER: broadcast mmio_enabled message [ T292] pcieport 0000:00:1c.5: AER: broadcast resume message [ T292] ------------[ cut here ]------------ [ T292] kernel BUG at net/core/dev.c:6539! [ T292] invalid opcode: 0000 [#1] PREEMPT SMP [ T292] RIP: 0010:napi_enable+0x37/0x40 [ T292] Call Trace: [ T292] <TASK> [ T292] ? die+0x33/0x90 [ T292] ? do_trap+0xdc/0x110 [ T292] ? napi_enable+0x37/0x40 [ T292] ? do_error_trap+0x70/0xb0 [ T292] ? napi_enable+0x37/0x40 [ T292] ? napi_enable+0x37/0x40 [ T292] ? exc_invalid_op+0x4e/0x70 [ T292] ? napi_enable+0x37/0x40 [ T292] ? asm_exc_invalid_op+0x16/0x20 [ T292] ? napi_enable+0x37/0x40 [ T292] igb_up+0x41/0x150 [ T292] igb_io_resume+0x25/0x70 [ T292] report_resume+0x54/0x70 [ T292] ? report_frozen_detected+0x20/0x20 [ T292] pci_walk_bus+0x6c/0x90 [ T292] ? aer_print_port_info+0xa0/0xa0 [ T292] pcie_do_recovery+0x22f/0x380 [ T292] aer_process_err_devices+0x110/0x160 [ T292] aer_isr+0x1c1/0x1e0 [ T292] ? disable_irq_nosync+0x10/0x10 [ T292] irq_thread_fn+0x1a/0x60 [ T292] irq_thread+0xe3/0x1a0 [ T292] ? irq_set_affinity_notifier+0x120/0x120 [ T292] ? irq_affinity_notify+0x100/0x100 [ T292] kthread+0xe2/0x110 [ T292] ? kthread_complete_and_exit+0x20/0x20 [ T292] ret_from_fork+0x2d/0x50 [ T292] ? kthread_complete_and_exit+0x20/0x20 [ T292] ret_from_fork_asm+0x11/0x20 [ T292] </TASK>
To fix this issue igb_io_resume() checks if the interface is running and the device is not down this means igb_io_error_detected() did not bring the device down and there is no need to bring it up.
--- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +4 -0
@@ -9536,6 +9536,10 @@ static void igb_io_resume(struct pci_dev *pdev)struct igb_adapter *adapter =netdev_priv (netdev);if (netif_running (netdev)) { +if (!test_bit (__IGB_DOWN, &adapter->state)) { +dev_dbg (&pdev->dev,"Resuming from non-fatal error, do nothing.\n" ); +return ; + }if (igb_up (adapter)) {dev_err (&pdev->dev,"igb_up failed after reset\n" );return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 490/518 net/sched: accept TCA_STAB only for root qdisc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3cb7cf1540ddff5473d6baeb530228d19bc97b8a ]
Most qdiscs maintain their backlog using qdisc_pkt_len(skb) on the assumption it is invariant between the enqueue() and dequeue() handlers.
Unfortunately syzbot can crash a host rather easily using a TBF + SFQ combination, with an STAB on SFQ [1]
We can't support TCA_STAB on arbitrary level, this would require to maintain per-qdisc storage.
[1]
[ 88.796496] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 88.798611] #PF: supervisor read access in kernel mode [ 88.799014] #PF: error_code(0x0000) - not-present page [ 88.799506] PGD 0 P4D 0 [ 88.799829] Oops: Oops: 0000 [#1] SMP NOPTI [ 88.800569] CPU: 14 UID: 0 PID: 2053 Comm: b371744477 Not tainted 6.12.0-rc1-virtme #1117 [ 88.801107] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 88.801779] RIP: 0010:sfq_dequeue (net/sched/sch_sfq.c:272 net/sched/sch_sfq.c:499) sch_sfq [ 88.802544] Code: 0f b7 50 12 48 8d 04 d5 00 00 00 00 48 89 d6 48 29 d0 48 8b 91 c0 01 00 00 48 c1 e0 03 48 01 c2 66 83 7a 1a 00 7e c0 48 8b 3a <4c> 8b 07 4c 89 02 49 89 50 08 48 c7 47 08 00 00 00 00 48 c7 07 00
All code
========
0: 0f b7 50 12 movzwl 0x12(%rax),%edx
4: 48 8d 04 d5 00 00 00 lea 0x0(,%rdx,8),%rax
b: 00
c: 48 89 d6 mov %rdx,%rsi f: 48 29 d0 sub %rdx,%rax 12: 48 8b 91 c0 01 00 00 mov 0x1c0(%rcx),%rdx 19: 48 c1 e0 03 shl $0x3,%rax 1d: 48 01 c2 add %rax,%rdx 20: 66 83 7a 1a 00 cmpw $0x0,0x1a(%rdx) 25: 7e c0 jle 0xffffffffffffffe7 27: 48 8b 3a mov (%rdx),%rdi 2a:* 4c 8b 07 mov (%rdi),%r8 <-- trapping instruction 2d: 4c 89 02 mov %r8,(%rdx) 30: 49 89 50 08 mov %rdx,0x8(%r8) 34: 48 c7 47 08 00 00 00 movq $0x0,0x8(%rdi) 3b: 00 3c: 48 rex.W 3d: c7 .byte 0xc7 3e: 07 (bad) ...
Code starting with the faulting instruction
===========================================
0: 4c 8b 07 mov (%rdi),%r8 3: 4c 89 02 mov %r8,(%rdx) 6: 49 89 50 08 mov %rdx,0x8(%r8) a: 48 c7 47 08 00 00 00 movq $0x0,0x8(%rdi) 11: 00 12: 48 rex.W 13: c7 .byte 0xc7 14: 07 (bad) ... [ 88.803721] RSP: 0018:ffff9a1f892b7d58 EFLAGS: 00000206 [ 88.804032] RAX: 0000000000000000 RBX: ffff9a1f8420c800 RCX: ffff9a1f8420c800 [ 88.804560] RDX: ffff9a1f81bc1440 RSI: 0000000000000000 RDI: 0000000000000000 [ 88.805056] RBP: ffffffffc04bb0e0 R08: 0000000000000001 R09: 00000000ff7f9a1f [ 88.805473] R10: 000000000001001b R11: 0000000000009a1f R12: 0000000000000140 [ 88.806194] R13: 0000000000000001 R14: ffff9a1f886df400 R15: ffff9a1f886df4ac [ 88.806734] FS: 00007f445601a740(0000) GS:ffff9a2e7fd80000(0000) knlGS:0000000000000000 [ 88.807225] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 88.807672] CR2: 0000000000000000 CR3: 000000050cc46000 CR4: 00000000000006f0 [ 88.808165] Call Trace: [ 88.808459] <TASK> [ 88.808710] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434) [ 88.809261] ? page_fault_oops (arch/x86/mm/fault.c:715) [ 88.809561] ? exc_page_fault (./arch/x86/include/asm/irqflags.h:26 ./arch/x86/include/asm/irqflags.h:87 ./arch/x86/include/asm/irqflags.h:147 arch/x86/mm/fault.c:1489 arch/x86/mm/fault.c:1539) [ 88.809806] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623) [ 88.810074] ? sfq_dequeue (net/sched/sch_sfq.c:272 net/sched/sch_sfq.c:499) sch_sfq [ 88.810411] sfq_reset (net/sched/sch_sfq.c:525) sch_sfq [ 88.810671] qdisc_reset (./include/linux/skbuff.h:2135 ./include/linux/skbuff.h:2441 ./include/linux/skbuff.h:3304 ./include/linux/skbuff.h:3310 net/sched/sch_generic.c:1036) [ 88.810950] tbf_reset (./include/linux/timekeeping.h:169 net/sched/sch_tbf.c:334) sch_tbf [ 88.811208] qdisc_reset (./include/linux/skbuff.h:2135 ./include/linux/skbuff.h:2441 ./include/linux/skbuff.h:3304 ./include/linux/skbuff.h:3310 net/sched/sch_generic.c:1036) [ 88.811484] netif_set_real_num_tx_queues (./include/linux/spinlock.h:396 ./include/net/sch_generic.h:768 net/core/dev.c:2958) [ 88.811870] __tun_detach (drivers/net/tun.c:590 drivers/net/tun.c:673) [ 88.812271] tun_chr_close (drivers/net/tun.c:702 drivers/net/tun.c:3517) [ 88.812505] __fput (fs/file_table.c:432 (discriminator 1)) [ 88.812735] task_work_run (kernel/task_work.c:230) [ 88.813016] do_exit (kernel/exit.c:940) [ 88.813372] ? trace_hardirqs_on (kernel/trace/trace_preemptirq.c:58 (discriminator 4)) [ 88.813639] ? handle_mm_fault (./arch/x86/include/asm/irqflags.h:42 ./arch/x86/include/asm/irqflags.h:97 ./arch/x86/include/asm/irqflags.h:155 ./include/linux/memcontrol.h:1022 ./include/linux/memcontrol.h:1045 ./include/linux/memcontrol.h:1052 mm/memory.c:5928 mm/memory.c:6088) [ 88.813867] do_group_exit (kernel/exit.c:1070) [ 88.814138] __x64_sys_exit_group (kernel/exit.c:1099) [ 88.814490] x64_sys_call (??:?) [ 88.814791] do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1)) [ 88.815012] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) [ 88.815495] RIP: 0033:0x7f44560f1975
--- include/net/sch_generic.h | 1 - net/sched/sch_api.c | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/sch_generic.h +0 -1
@@ -830,7 +830,6 @@ static inline void qdisc_calculate_pkt_len(struct sk_buff *skb,static inline int qdisc_enqueue (struct sk_buff *skb,struct Qdisc *sch,struct sk_buff **to_free) { -qdisc_calculate_pkt_len (skb, sch);return sch->enqueue (skb, sch, to_free); }
net/sched/sch_api.c +6 -1
@@ -589,7 +589,6 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb, pkt_len =1 ;qdisc_skb_cb (skb)->pkt_len = pkt_len; } -EXPORT_SYMBOL (__qdisc_calculate_pkt_len);void qdisc_warn_nonwc (const char *txt,struct Qdisc *qdisc) {
@@ -1119,6 +1118,12 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,return -EINVAL ; } +if (new && + !(parent->flags &TCQ_F_MQROOT ) && +rcu_access_pointer (new->stab)) { +NL_SET_ERR_MSG (extack,"STAB not supported on a non root" ); +return -EINVAL ; + } err = cops->graft (parent, cl, new, &old, extack);if (err)return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 491/518 net: ibm: emac: mal: fix wrong goto
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 08c8acc9d8f3f70d62dd928571368d5018206490 ]
dcr_map is called in the previous if and therefore needs to be unmapped.
--- drivers/net/ethernet/ibm/emac/mal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/mal.c +1 -1
@@ -576,7 +576,7 @@ static int mal_probe(struct platform_device *ofdev)printk (KERN_ERR "%pOF: Support for 405EZ not enabled!\n" , ofdev->dev.of_node); err = -ENODEV ; - goto fail; + goto fail_unmap;#endif }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 492/518 sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 4d5c70e6155d5eae198bade4afeab3c1b15073b6 ]
If hashing fails in sctp_listen_start(), the socket remains in the LISTENING state, even though it was not added to the hash table. This can lead to a scenario where a socket appears to be listening without actually being accessible.
This patch ensures that if the hashing operation fails, the sk_state is set back to CLOSED before returning an error.
Note that there is no need to undo the autobind operation if hashing fails, as the bind port can still be used for next listen() call on the same socket.
--- net/sctp/socket.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
net/sctp/socket.c +13 -5
@@ -8273,6 +8273,7 @@ static int sctp_listen_start(struct sock *sk, int backlog)struct sctp_endpoint *ep = sp->ep;struct crypto_shash *tfm =NULL ;char alg[32 ]; +int err;/* Allocate HMAC for generating cookie. */ if (!sp->hmac && sp->sctp_hmac_alg) {
@@ -8300,18 +8301,25 @@ static int sctp_listen_start(struct sock *sk, int backlog)inet_sk_set_state (sk,SCTP_SS_LISTENING );if (!ep->base.bind_addr.port) {if (sctp_autobind (sk)) { -inet_sk_set_state (sk,SCTP_SS_CLOSED ); -return -EAGAIN ; + err = -EAGAIN ; + goto err; } }else {if (sctp_get_port (sk,inet_sk (sk)->inet_num)) { -inet_sk_set_state (sk,SCTP_SS_CLOSED ); -return -EADDRINUSE ; + err = -EADDRINUSE ; + goto err; } }WRITE_ONCE (sk->sk_max_ack_backlog, backlog); -return sctp_hash_endpoint (ep); + err =sctp_hash_endpoint (ep); +if (err) + goto err; + +return 0 ; +err: +inet_sk_set_state (sk,SCTP_SS_CLOSED ); +return err; }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 493/518 net: Add l3mdev index to flow struct and avoid oif reset for port devices
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit 40867d74c374b235e14d839f3a77f26684feefe5 ]
The fundamental premise of VRF and l3mdev core code is binding a socket to a device (l3mdev or netdev with an L3 domain) to indicate L3 scope. Legacy code resets flowi_oif to the l3mdev losing any original port device binding. Ben (among others) has demonstrated use cases where the original port device binding is important and needs to be retained. This patch handles that by adding a new entry to the common flow struct that can indicate the l3mdev index for later rule and table matching avoiding the need to reset flowi_oif.
In addition to allowing more use cases that require port device binds, this patch brings a few datapath simplications:
1. l3mdev_fib_rule_match is only called when walking fib rules and always after l3mdev_update_flow. That allows an optimization to bail early for non-VRF type uses cases when flowi_l3mdev is not set. Also, only that index needs to be checked for the FIB table id.
2. l3mdev_update_flow can be called with flowi_oif set to a l3mdev (e.g., VRF) device. By resetting flowi_oif only for this case the FLOWI_FLAG_SKIP_NH_OIF flag is not longer needed and can be removed, removing several checks in the datapath. The flowi_iif path can be simplified to only be called if the it is not loopback (loopback can not be assigned to an L3 domain) and the l3mdev index is not already set.
3. Avoid another device lookup in the output path when the fib lookup returns a reject failure.
Note: 2 functional tests for local traffic with reject fib rules are updated to reflect the new direct failure at FIB lookup time for ping rather than the failure on packet path. The current code fails like this:
HINT: Fails since address on vrf device is out of device scope
COMMAND: ip netns exec ns-A ping -c1 -w1 -I eth1 172.16.3.1
ping: Warning: source address might be selected on device other than: eth1 PING 172.16.3.1 (172.16.3.1) from 172.16.3.1 eth1: 56(84) bytes of data.
--- 172.16.3.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
where the test now directly fails:
HINT: Fails since address on vrf device is out of device scope
COMMAND: ip netns exec ns-A ping -c1 -w1 -I eth1 172.16.3.1
ping: connect: No route to host
Stable-dep-of: 05ef7055debc ("netfilter: fib: check correct rtable in vrf setups")
--- drivers/net/vrf.c | 7 ++-- include/net/flow.h | 6 +++- net/ipv4/fib_frontend.c | 7 ++-- net/ipv4/fib_semantics.c | 2 +- net/ipv4/fib_trie.c | 7 ++-- net/ipv4/route.c | 4 +-- net/ipv4/xfrm4_policy.c | 4 +-- net/ipv6/ip6_output.c | 3 +- net/ipv6/route.c | 12 ------- net/ipv6/xfrm6_policy.c | 3 +- net/l3mdev/l3mdev.c | 43 +++++++++-------------- tools/testing/selftests/net/fcnal-test.sh | 2 +- 12 files changed, 37 insertions(+), 63 deletions(-)
drivers/net/vrf.c +3 -4
@@ -470,14 +470,13 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,memset (&fl6,0 ,sizeof (fl6));/* needed to match OIF rule */ - fl6.flowi6_oif = dev->ifindex; + fl6.flowi6_l3mdev = dev->ifindex; fl6.flowi6_iif =LOOPBACK_IFINDEX ; fl6.daddr = iph->daddr; fl6.saddr = iph->saddr; fl6.flowlabel =ip6_flowinfo (iph); fl6.flowi6_mark = skb->mark; fl6.flowi6_proto = iph->nexthdr; - fl6.flowi6_flags =FLOWI_FLAG_SKIP_NH_OIF ; dst =ip6_dst_lookup_flow (net,NULL , &fl6,NULL );if (IS_ERR (dst) || dst == dst_null)
@@ -550,10 +549,10 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,memset (&fl4,0 ,sizeof (fl4));/* needed to match OIF rule */ - fl4.flowi4_oif = vrf_dev->ifindex; + fl4.flowi4_l3mdev = vrf_dev->ifindex; fl4.flowi4_iif =LOOPBACK_IFINDEX ; fl4.flowi4_tos =RT_TOS (ip4h->tos); - fl4.flowi4_flags =FLOWI_FLAG_ANYSRC |FLOWI_FLAG_SKIP_NH_OIF ; + fl4.flowi4_flags =FLOWI_FLAG_ANYSRC ; fl4.flowi4_proto = ip4h->protocol; fl4.daddr = ip4h->daddr; fl4.saddr = ip4h->saddr;
include/net/flow.h +5 -1
@@ -29,6 +29,7 @@ struct flowi_tunnel {struct flowi_common {int flowic_oif;int flowic_iif; +int flowic_l3mdev;__u32 flowic_mark;__u8 flowic_tos;__u8 flowic_scope;
@@ -36,7 +37,6 @@ struct flowi_common {__u8 flowic_flags;#define FLOWI_FLAG_ANYSRC 0x01#define FLOWI_FLAG_KNOWN_NH 0x02 -#define FLOWI_FLAG_SKIP_NH_OIF 0x04__u32 flowic_secid;kuid_t flowic_uid;__u32 flowic_multipath_hash;
@@ -66,6 +66,7 @@ struct flowi4 {struct flowi_common __fl_common;#define flowi4_oif __fl_common.flowic_oif#define flowi4_iif __fl_common.flowic_iif +#define flowi4_l3mdev __fl_common.flowic_l3mdev#define flowi4_mark __fl_common.flowic_mark#define flowi4_tos __fl_common.flowic_tos#define flowi4_scope __fl_common.flowic_scope
@@ -99,6 +100,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, { fl4->flowi4_oif = oif; fl4->flowi4_iif =LOOPBACK_IFINDEX ; + fl4->flowi4_l3mdev =0 ; fl4->flowi4_mark = mark; fl4->flowi4_tos = tos; fl4->flowi4_scope = scope;
@@ -129,6 +131,7 @@ struct flowi6 {struct flowi_common __fl_common;#define flowi6_oif __fl_common.flowic_oif#define flowi6_iif __fl_common.flowic_iif +#define flowi6_l3mdev __fl_common.flowic_l3mdev#define flowi6_mark __fl_common.flowic_mark#define flowi6_scope __fl_common.flowic_scope#define flowi6_proto __fl_common.flowic_proto
@@ -159,6 +162,7 @@ struct flowi { } u;#define flowi_oif u.__fl_common.flowic_oif#define flowi_iif u.__fl_common.flowic_iif +#define flowi_l3mdev u.__fl_common.flowic_l3mdev#define flowi_mark u.__fl_common.flowic_mark#define flowi_tos u.__fl_common.flowic_tos#define flowi_scope u.__fl_common.flowic_scope
net/ipv4/fib_frontend.c +3 -4
@@ -290,7 +290,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)bool vmark = in_dev &&IN_DEV_SRC_VMARK (in_dev);struct flowi4 fl4 = { .flowi4_iif =LOOPBACK_IFINDEX , - .flowi4_oif =l3mdev_master_ifindex_rcu (dev), + .flowi4_l3mdev =l3mdev_master_ifindex_rcu (dev), .daddr =ip_hdr (skb)->saddr, .flowi4_tos =ip_hdr (skb)->tos &IPTOS_RT_MASK , .flowi4_scope = scope,
@@ -352,9 +352,8 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,bool dev_match; fl4.flowi4_oif =0 ; - fl4.flowi4_iif =l3mdev_master_ifindex_rcu (dev); -if (!fl4.flowi4_iif) - fl4.flowi4_iif = oif ? :LOOPBACK_IFINDEX ; + fl4.flowi4_l3mdev =l3mdev_master_ifindex_rcu (dev); + fl4.flowi4_iif = oif ? :LOOPBACK_IFINDEX ; fl4.daddr = src; fl4.saddr = dst; fl4.flowi4_tos = tos;
net/ipv4/fib_semantics.c +1 -1
@@ -2268,7 +2268,7 @@ void fib_select_multipath(struct fib_result *res, int hash)void fib_select_path (struct net *net,struct fib_result *res,struct flowi4 *fl4,const struct sk_buff *skb) { -if (fl4->flowi4_oif && !(fl4->flowi4_flags &FLOWI_FLAG_SKIP_NH_OIF )) +if (fl4->flowi4_oif) goto check_saddr;#ifdef CONFIG_IP_ROUTE_MULTIPATH
net/ipv4/fib_trie.c +2 -5
@@ -1384,11 +1384,8 @@ bool fib_lookup_good_nhc(const struct fib_nh_common *nhc, int fib_flags, !(fib_flags & FIB_LOOKUP_IGNORE_LINKSTATE))return false; -if (!(flp->flowi4_flags &FLOWI_FLAG_SKIP_NH_OIF )) { -if (flp->flowi4_oif && - flp->flowi4_oif != nhc->nhc_oif) -return false; - } +if (flp->flowi4_oif && flp->flowi4_oif != nhc->nhc_oif) +return false;return true; }
net/ipv4/route.c +2 -2
@@ -2200,6 +2200,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,/* * Now we are ready to route packet. */ + fl4.flowi4_l3mdev =0 ; fl4.flowi4_oif =0 ; fl4.flowi4_iif = dev->ifindex; fl4.flowi4_mark = skb->mark;
@@ -2676,8 +2677,7 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, res->fi =NULL ; res->table =NULL ;if (fl4->flowi4_oif && - (ipv4_is_multicast (fl4->daddr) || - !netif_index_is_l3_master (net, fl4->flowi4_oif))) { + (ipv4_is_multicast (fl4->daddr) || !fl4->flowi4_l3mdev)) {/* Apparently, routing tables are wrong. Assume, that the destination is on link.
net/ipv4/xfrm4_policy.c +1 -3
@@ -28,13 +28,11 @@ static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4,memset (fl4,0 ,sizeof (*fl4)); fl4->daddr = daddr->a4; fl4->flowi4_tos = tos; - fl4->flowi4_oif =l3mdev_master_ifindex_by_index (net, oif); + fl4->flowi4_l3mdev =l3mdev_master_ifindex_by_index (net, oif); fl4->flowi4_mark = mark;if (saddr) fl4->saddr = saddr->a4; - fl4->flowi4_flags =FLOWI_FLAG_SKIP_NH_OIF ; - rt =__ip_route_output_key (net, fl4);if (!IS_ERR (rt))return &rt->dst;
net/ipv6/ip6_output.c +1 -2
@@ -1067,8 +1067,7 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,#ifdef CONFIG_IPV6_SUBTREES ip6_rt_check(&rt->rt6i_src, &fl6->saddr, np->saddr_cache) || #endif - (!(fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF) && - (fl6->flowi6_oif && fl6->flowi6_oif != dst->dev->ifindex))) { + (fl6->flowi6_oif && fl6->flowi6_oif != dst->dev->ifindex)) {dst_release (dst); dst =NULL ; }
net/ipv6/route.c +0 -12
@@ -1207,9 +1207,6 @@ INDIRECT_CALLABLE_SCOPE struct rt6_info *ip6_pol_route_lookup(struct net *net,struct fib6_node *fn;struct rt6_info *rt; -if (fl6->flowi6_flags &FLOWI_FLAG_SKIP_NH_OIF ) - flags &= ~RT6_LOOKUP_F_IFACE ; -rcu_read_lock (); fn =fib6_node_lookup (&table->tb6_root, &fl6->daddr, &fl6->saddr); restart:
@@ -2183,9 +2180,6 @@ int fib6_table_lookup(struct net *net, struct fib6_table *table, int oif, fn =fib6_node_lookup (&table->tb6_root, &fl6->daddr, &fl6->saddr); saved_fn = fn; -if (fl6->flowi6_flags &FLOWI_FLAG_SKIP_NH_OIF ) - oif =0 ; - redo_rt6_select:rt6_select (net, fn, oif, res, strict);if (res->f6i == net->ipv6.fib6_null_entry) {
@@ -2932,12 +2926,6 @@ INDIRECT_CALLABLE_SCOPE struct rt6_info *__ip6_route_redirect(struct net *net,struct fib6_info *rt;struct fib6_node *fn; -/* l3mdev_update_flow overrides oif if the device is enslaved; in -* this case we must match on the real ingress device, so reset it -*/ -if (fl6->flowi6_flags &FLOWI_FLAG_SKIP_NH_OIF ) - fl6->flowi6_oif = skb->dev->ifindex; -/* Get the "current" route for this destination and * check if the redirect has come from appropriate router. *
net/ipv6/xfrm6_policy.c +1 -2
@@ -33,8 +33,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif,int err;memset (&fl6,0 ,sizeof (fl6)); - fl6.flowi6_oif =l3mdev_master_ifindex_by_index (net, oif); - fl6.flowi6_flags =FLOWI_FLAG_SKIP_NH_OIF ; + fl6.flowi6_l3mdev =l3mdev_master_ifindex_by_index (net, oif); fl6.flowi6_mark = mark;memcpy (&fl6.daddr, daddr,sizeof (fl6.daddr));if (saddr)
net/l3mdev/l3mdev.c +17 -26
73 lines not on this page · raw message
tools/testing/selftests/net/fcnal-test.sh +1 -1
@@ -741,7 +741,7 @@ ipv4_ping_vrf() log_start show_hint "Fails since address on vrf device is out of device scope" run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a} - log_test_addr ${a} $? 1 "ping local, device bind" + log_test_addr ${a} $? 2 "ping local, device bind" done #
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 494/518 netfilter: rpfilter/fib: Populate flowic_l3mdev field
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit acc641ab95b66b813c1ce856c377a2bbe71e7f52 ]
Use the introduced field for correct operation with VRF devices instead of conditionally overwriting flowic_oif. This is a partial revert of commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake"), implementing a simpler solution.
Stable-dep-of: 05ef7055debc ("netfilter: fib: check correct rtable in vrf setups")
--- net/ipv4/netfilter/ipt_rpfilter.c | 2 +- net/ipv4/netfilter/nft_fib_ipv4.c | 2 +- net/ipv6/netfilter/ip6t_rpfilter.c | 9 +++------ net/ipv6/netfilter/nft_fib_ipv6.c | 5 ++--- 4 files changed, 7 insertions(+), 11 deletions(-)
net/ipv4/netfilter/ipt_rpfilter.c +1 -1
@@ -78,7 +78,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) flow.flowi4_mark = info->flags &XT_RPFILTER_VALID_MARK ? skb->mark :0 ; flow.flowi4_tos = iph->tos &IPTOS_RT_MASK ; flow.flowi4_scope =RT_SCOPE_UNIVERSE ; - flow.flowi4_oif =l3mdev_master_ifindex_rcu (xt_in (par)); + flow.flowi4_l3mdev =l3mdev_master_ifindex_rcu (xt_in (par));return rpfilter_lookup_reverse (xt_net (par), &flow,xt_in (par), info->flags) ^ invert; }
net/ipv4/netfilter/nft_fib_ipv4.c +1 -1
@@ -84,7 +84,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, oif =NULL ;if (priv->flags &NFTA_FIB_F_IIF ) - fl4.flowi4_oif =l3mdev_master_ifindex_rcu (oif); + fl4.flowi4_l3mdev =l3mdev_master_ifindex_rcu (oif);if (nft_hook (pkt) ==NF_INET_PRE_ROUTING &&nft_fib_is_loopback (pkt->skb,nft_in (pkt))) {
net/ipv6/netfilter/ip6t_rpfilter.c +3 -6
@@ -37,6 +37,7 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,bool ret = false;struct flowi6 fl6 = { .flowi6_iif =LOOPBACK_IFINDEX , + .flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev), .flowlabel = (* (__be32 *) iph) &IPV6_FLOWINFO_MASK , .flowi6_proto = iph->nexthdr, .daddr = iph->saddr,
@@ -55,9 +56,7 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,if (rpfilter_addr_linklocal (&iph->saddr)) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6.flowi6_oif = dev->ifindex; -/* Set flowi6_oif for vrf devices to lookup route in l3mdev domain. */ - }else if (netif_is_l3_master (dev) ||netif_is_l3_slave (dev) || - (flags &XT_RPFILTER_LOOSE ) ==0 ) + }else if ((flags &XT_RPFILTER_LOOSE ) ==0 ) fl6.flowi6_oif = dev->ifindex; rt = (void *)ip6_route_lookup (net, &fl6, skb, lookup_flags);
@@ -72,9 +71,7 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb, goto out; } -if (rt->rt6i_idev->dev == dev || -l3mdev_master_ifindex_rcu (rt->rt6i_idev->dev) == dev->ifindex || - (flags &XT_RPFILTER_LOOSE )) +if (rt->rt6i_idev->dev == dev || (flags &XT_RPFILTER_LOOSE )) ret = true; out:ip6_rt_put (rt);
net/ipv6/netfilter/nft_fib_ipv6.c +2 -3
@@ -37,9 +37,8 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,if (ipv6_addr_type (&fl6->daddr) &IPV6_ADDR_LINKLOCAL ) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6->flowi6_oif =get_ifindex (dev ? dev : pkt->skb->dev); - }else if ((priv->flags &NFTA_FIB_F_IIF ) && - (netif_is_l3_master (dev) ||netif_is_l3_slave (dev))) { - fl6->flowi6_oif = dev->ifindex; + }else if (priv->flags &NFTA_FIB_F_IIF ) { + fl6->flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev); }if (ipv6_addr_type (&fl6->saddr) &IPV6_ADDR_UNICAST )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 495/518 netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit 1fcc064b305a1aadeff0d4bff961094d27660acd ]
Currently netfilter's rpfilter and fib modules implicitely initialise ->flowic_uid with 0. This is normally the root UID. However, this isn't the case in user namespaces, where user ID 0 is mapped to a different kernel UID. By initialising ->flowic_uid with sock_net_uid(), we get the root UID of the user namespace, thus keeping the same behaviour whether or not we're running in a user namepspace.
Note, this is similar to commit 8bcfd0925ef1 ("ipv4: add missing initialization for flowi4_uid"), which fixed the rp_filter sysctl.
Stable-dep-of: 05ef7055debc ("netfilter: fib: check correct rtable in vrf setups")
--- net/ipv4/netfilter/ipt_rpfilter.c | 1 + net/ipv4/netfilter/nft_fib_ipv4.c | 1 + net/ipv6/netfilter/ip6t_rpfilter.c | 1 + net/ipv6/netfilter/nft_fib_ipv6.c | 2 ++ 4 files changed, 5 insertions(+)
net/ipv4/netfilter/ipt_rpfilter.c +1 -0
@@ -79,6 +79,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) flow.flowi4_tos = iph->tos &IPTOS_RT_MASK ; flow.flowi4_scope =RT_SCOPE_UNIVERSE ; flow.flowi4_l3mdev =l3mdev_master_ifindex_rcu (xt_in (par)); + flow.flowi4_uid =sock_net_uid (xt_net (par),NULL );return rpfilter_lookup_reverse (xt_net (par), &flow,xt_in (par), info->flags) ^ invert; }
net/ipv4/netfilter/nft_fib_ipv4.c +1 -0
@@ -65,6 +65,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,struct flowi4 fl4 = { .flowi4_scope =RT_SCOPE_UNIVERSE , .flowi4_iif =LOOPBACK_IFINDEX , + .flowi4_uid =sock_net_uid (nft_net (pkt),NULL ), };const struct net_device *oif;const struct net_device *found;
net/ipv6/netfilter/ip6t_rpfilter.c +1 -0
@@ -40,6 +40,7 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb, .flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev), .flowlabel = (* (__be32 *) iph) & IPV6_FLOWINFO_MASK, .flowi6_proto = iph->nexthdr, + .flowi6_uid = sock_net_uid(net, NULL), .daddr = iph->saddr, };int lookup_flags;
net/ipv6/netfilter/nft_fib_ipv6.c +2 -0
@@ -62,6 +62,7 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,struct flowi6 fl6 = { .flowi6_iif =LOOPBACK_IFINDEX , .flowi6_proto = pkt->tprot, + .flowi6_uid =sock_net_uid (nft_net (pkt),NULL ), };u32 ret =0 ;
@@ -159,6 +160,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,struct flowi6 fl6 = { .flowi6_iif =LOOPBACK_IFINDEX , .flowi6_proto = pkt->tprot, + .flowi6_uid =sock_net_uid (nft_net (pkt),NULL ), };struct rt6_info *rt;int lookup_flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 496/518 netfilter: fib: check correct rtable in vrf setups
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 05ef7055debc804e8083737402127975e7244fc4 ]
We need to init l3mdev unconditionally, else main routing table is searched and incorrect result is returned unless strict (iif keyword) matching is requested.
Next patch adds a selftest for this.
--- net/ipv4/netfilter/nft_fib_ipv4.c | 4 +--- net/ipv6/netfilter/nft_fib_ipv6.c | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-)
net/ipv4/netfilter/nft_fib_ipv4.c +1 -3
@@ -66,6 +66,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, .flowi4_scope = RT_SCOPE_UNIVERSE, .flowi4_iif = LOOPBACK_IFINDEX, .flowi4_uid = sock_net_uid(nft_net(pkt), NULL), + .flowi4_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), };const struct net_device *oif;const struct net_device *found;
@@ -84,9 +85,6 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,else oif =NULL ; -if (priv->flags &NFTA_FIB_F_IIF ) - fl4.flowi4_l3mdev =l3mdev_master_ifindex_rcu (oif); -if (nft_hook (pkt) ==NF_INET_PRE_ROUTING &&nft_fib_is_loopback (pkt->skb,nft_in (pkt))) {nft_fib_store_result (dest, priv,nft_in (pkt));
net/ipv6/netfilter/nft_fib_ipv6.c +3 -2
@@ -37,8 +37,6 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,if (ipv6_addr_type (&fl6->daddr) &IPV6_ADDR_LINKLOCAL ) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6->flowi6_oif =get_ifindex (dev ? dev : pkt->skb->dev); - }else if (priv->flags &NFTA_FIB_F_IIF ) { - fl6->flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev); }if (ipv6_addr_type (&fl6->saddr) &IPV6_ADDR_UNICAST )
@@ -71,6 +69,8 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,else if (priv->flags &NFTA_FIB_F_OIF ) dev =nft_out (pkt); + fl6.flowi6_l3mdev =l3mdev_master_ifindex_rcu (dev); +nft_fib6_flowi_init (&fl6, priv, pkt, dev, iph);if (dev &&nf_ipv6_chk_addr (nft_net (pkt), &fl6.daddr, dev, true))
@@ -161,6 +161,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs, .flowi6_iif = LOOPBACK_IFINDEX, .flowi6_proto = pkt->tprot, .flowi6_uid = sock_net_uid(nft_net(pkt), NULL), + .flowi6_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), };struct rt6_info *rt;int lookup_flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 497/518 ppp: fix ppp_async_encode() illegal access
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 40dddd4b8bd08a69471efd96107a4e1c73fabefc ]
syzbot reported an issue in ppp_async_encode() [1]
In this case, pppoe_sendmsg() is called with a zero size. Then ppp_async_encode() is called with an empty skb.
BUG: KMSAN: uninit-value in ppp_async_encode drivers/net/ppp/ppp_async.c:545 [inline] BUG: KMSAN: uninit-value in ppp_async_push+0xb4f/0x2660 drivers/net/ppp/ppp_async.c:675 ppp_async_encode drivers/net/ppp/ppp_async.c:545 [inline] ppp_async_push+0xb4f/0x2660 drivers/net/ppp/ppp_async.c:675 ppp_async_send+0x130/0x1b0 drivers/net/ppp/ppp_async.c:634 ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2280 [inline] ppp_input+0x1f1/0xe60 drivers/net/ppp/ppp_generic.c:2304 pppoe_rcv_core+0x1d3/0x720 drivers/net/ppp/pppoe.c:379 sk_backlog_rcv+0x13b/0x420 include/net/sock.h:1113 __release_sock+0x1da/0x330 net/core/sock.c:3072 release_sock+0x6b/0x250 net/core/sock.c:3626 pppoe_sendmsg+0x2b8/0xb90 drivers/net/ppp/pppoe.c:903 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4092 [inline] slab_alloc_node mm/slub.c:4135 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4187 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] sock_wmalloc+0xfe/0x1a0 net/core/sock.c:2732 pppoe_sendmsg+0x3a7/0xb90 drivers/net/ppp/pppoe.c:867 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 1 UID: 0 PID: 5411 Comm: syz.1.14 Not tainted 6.12.0-rc1-syzkaller-00165-g360c1f1f24c6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
--- drivers/net/ppp/ppp_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp/ppp_async.c +1 -1
@@ -552,7 +552,7 @@ ppp_async_encode(struct asyncppp *ap)* and 7 (code-reject) must be sent as though no options * had been negotiated. */ - islcp = proto ==PPP_LCP &&1 <= data[2 ] && data[2 ] <=7 ; + islcp = proto ==PPP_LCP && count >=3 &&1 <= data[2 ] && data[2 ] <=7 ;if (i ==0 ) {if (islcp)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 498/518 slip: make slhc_remember() more robust against malicious packets
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7d3fce8cbe3a70a1c7c06c9b53696be5d5d8dd5c ]
syzbot found that slhc_remember() was missing checks against malicious packets [1].
slhc_remember() only checked the size of the packet was at least 20, which is not good enough.
We need to make sure the packet includes the IPv4 and TCP header that are supposed to be carried.
Add iph and th pointers to make the code more readable.
[1]
BUG: KMSAN: uninit-value in slhc_remember+0x2e8/0x7b0 drivers/net/slip/slhc.c:666 slhc_remember+0x2e8/0x7b0 drivers/net/slip/slhc.c:666 ppp_receive_nonmp_frame+0xe45/0x35e0 drivers/net/ppp/ppp_generic.c:2455 ppp_receive_frame drivers/net/ppp/ppp_generic.c:2372 [inline] ppp_do_recv+0x65f/0x40d0 drivers/net/ppp/ppp_generic.c:2212 ppp_input+0x7dc/0xe60 drivers/net/ppp/ppp_generic.c:2327 pppoe_rcv_core+0x1d3/0x720 drivers/net/ppp/pppoe.c:379 sk_backlog_rcv+0x13b/0x420 include/net/sock.h:1113 __release_sock+0x1da/0x330 net/core/sock.c:3072 release_sock+0x6b/0x250 net/core/sock.c:3626 pppoe_sendmsg+0x2b8/0xb90 drivers/net/ppp/pppoe.c:903 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4091 [inline] slab_alloc_node mm/slub.c:4134 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4186 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:587 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1322 [inline] sock_wmalloc+0xfe/0x1a0 net/core/sock.c:2732 pppoe_sendmsg+0x3a7/0xb90 drivers/net/ppp/pppoe.c:867 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:744 ____sys_sendmsg+0x903/0xb60 net/socket.c:2602 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2656 __sys_sendmmsg+0x3c1/0x960 net/socket.c:2742 __do_sys_sendmmsg net/socket.c:2771 [inline] __se_sys_sendmmsg net/socket.c:2768 [inline] __x64_sys_sendmmsg+0xbc/0x120 net/socket.c:2768 x64_sys_call+0xb6e/0x3ba0 arch/x86/include/generated/asm/syscalls_64.h:308 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 0 UID: 0 PID: 5460 Comm: syz.2.33 Not tainted 6.12.0-rc2-syzkaller-00006-g87d6aab2389e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
--- drivers/net/slip/slhc.c | 57 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 23 deletions(-)
drivers/net/slip/slhc.c +34 -23
@@ -643,46 +643,57 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)int slhc_remember (struct slcompress *comp,unsigned char *icp,int isize) { -struct cstate *cs; -unsigned ihl; - +const struct tcphdr *th;unsigned char index; +struct iphdr *iph; +struct cstate *cs; +unsigned int ihl; -if (isize <20 ) { -/* The packet is shorter than a legal IP header */ +/* The packet is shorter than a legal IP header. +* Also make sure isize is positive. +*/ +if (isize < (int )sizeof (struct iphdr )) { +runt: comp->sls_i_runt++; -return slhc_toss ( comp ); +return slhc_toss (comp); } + iph = (struct iphdr *)icp;/* Peek at the IP header's IHL field to find its length */ - ihl = icp[0 ] &0xf ; -if (ihl <20 /4 ){ -/* The IP header length field is too small */ - comp->sls_i_runt++; -return slhc_toss ( comp ); - } - index = icp[9 ]; - icp[9 ] =IPPROTO_TCP ; + ihl = iph->ihl; +/* The IP header length field is too small, +* or packet is shorter than the IP header followed +* by minimal tcp header. +*/ +if (ihl <5 || isize < ihl *4 +sizeof (struct tcphdr )) + goto runt; + + index = iph->protocol; + iph->protocol =IPPROTO_TCP ;if (ip_fast_csum (icp, ihl)) {/* Bad IP header checksum; discard */ comp->sls_i_badcheck++; -return slhc_toss ( comp ); +return slhc_toss (comp); } -if (index > comp->rslot_limit) { +if (index > comp->rslot_limit) { comp->sls_i_error++;return slhc_toss (comp); } - + th = (struct tcphdr *)(icp + ihl *4 ); +if (th->doff <sizeof (struct tcphdr ) /4 ) + goto runt; +if (isize < ihl *4 + th->doff *4 ) + goto runt;/* Update local state */ cs = &comp->rstate[comp->recv_current = index]; comp->flags &=~SLF_TOSS ; -memcpy (&cs->cs_ip,icp,20 ); -memcpy (&cs->cs_tcp,icp + ihl*4 ,20 ); +memcpy (&cs->cs_ip, iph,sizeof (*iph)); +memcpy (&cs->cs_tcp, th,sizeof (*th));if (ihl >5 ) -memcpy (cs->cs_ipopt, icp +sizeof (struct iphdr ), (ihl -5 ) *4 ); -if (cs->cs_tcp.doff >5 ) -memcpy (cs->cs_tcpopt, icp + ihl*4 +sizeof (struct tcphdr ), (cs->cs_tcp.doff -5 ) *4 ); - cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2 ; +memcpy (cs->cs_ipopt, &iph[1 ], (ihl -5 ) *4 ); +if (th->doff >5 ) +memcpy (cs->cs_tcpopt, &th[1 ], (th->doff -5 ) *4 ); + cs->cs_hsize = ihl*2 + th->doff*2 ; cs->initialized = true;/* Put headers back on packet * Neither header checksum is recalculated
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 499/518 resource: fix region_intersects() vs add_memory_driver_managed()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
commit b4afe4183ec77f230851ea139d91e5cf2644c68b upstream.
On a system with CXL memory, the resource tree (/proc/iomem) related to CXL memory may look like something as follows.
490000000-50fffffff : CXL Window 0
490000000-50fffffff : region0
490000000-50fffffff : dax0.0
490000000-50fffffff : System RAM (kmem)Because drivers/dax/kmem.c calls add_memory_driver_managed() during onlining CXL memory, which makes "System RAM (kmem)" a descendant of "CXL Window X". This confuses region_intersects(), which expects all "System RAM" resources to be at the top level of iomem_resource. This can lead to bugs.
For example, when the following command line is executed to write some memory in CXL memory range via /dev/mem,
$ dd if=data of=/dev/mem bs=$((1 << 10)) seek=$((0x490000000 >> 10)) count=1 dd: error writing '/dev/mem': Bad address 1+0 records in 0+0 records out 0 bytes copied, 0.0283507 s, 0.0 kB/s
the command fails as expected. However, the error code is wrong. It should be "Operation not permitted" instead of "Bad address". More seriously, the /dev/mem permission checking in devmem_is_allowed() passes incorrectly. Although the accessing is prevented later because ioremap() isn't allowed to map system RAM, it is a potential security issue. During command executing, the following warning is reported in the kernel log for calling ioremap() on system RAM.
ioremap on RAM at 0x0000000490000000 - 0x0000000490000fff
WARNING: CPU: 2 PID: 416 at arch/x86/mm/ioremap.c:216 __ioremap_caller.constprop.0+0x131/0x35d Call Trace: memremap+0xcb/0x184 xlate_dev_mem_ptr+0x25/0x2f write_mem+0x94/0xfb vfs_write+0x128/0x26d ksys_write+0xac/0xfe do_syscall_64+0x9a/0xfd entry_SYSCALL_64_after_hwframe+0x4b/0x53
The details of command execution process are as follows. In the above resource tree, "System RAM" is a descendant of "CXL Window 0" instead of a top level resource. So, region_intersects() will report no System RAM resources in the CXL memory region incorrectly, because it only checks the top level resources. Consequently, devmem_is_allowed() will return 1 (allow access via /dev/mem) for CXL memory region incorrectly. Fortunately, ioremap() doesn't allow to map System RAM and reject the access.
So, region_intersects() needs to be fixed to work correctly with the resource tree with "System RAM" not at top level as above. To fix it, if we found a unmatched resource in the top level, we will continue to search matched resources in its descendant resources. So, we will not miss any matched resources in resource tree anymore.
In the new implementation, an example resource tree
|------------- "CXL Window 0" ------------| |-- "System RAM" --|
will behave similar as the following fake resource tree for region_intersects(, IORESOURCE_SYSTEM_RAM, ),
|-- "System RAM" --||-- "CXL Window 0a" --|
Where "CXL Window 0a" is part of the original "CXL Window 0" that isn't covered by "System RAM".
--- kernel/resource.c | 58 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 8 deletions(-)
kernel/resource.c +50 -8
@@ -539,21 +539,63 @@ EXPORT_SYMBOL_GPL(page_is_ram);int region_intersects (resource_size_t start,size_t size,unsigned long flags,unsigned long desc) { -struct resource res; +resource_size_t ostart, oend;int type =0 ;int other =0 ; -struct resource *p; +struct resource *p, *dp; +bool is_type, covered; +struct resource res; res.start = start; res.end = start + size -1 ;read_lock (&resource_lock);for (p = iomem_resource.child; p ; p = p->sibling) { -bool is_type = (((p->flags & flags) == flags) && - ((desc ==IORES_DESC_NONE ) || - (desc == p->desc))); - -if (resource_overlaps (p, &res)) - is_type ? type++ : other++; +if (!resource_overlaps (p, &res)) +continue ; + is_type = (p->flags & flags) == flags && + (desc ==IORES_DESC_NONE || desc == p->desc); +if (is_type) { + type++; +continue ; + } +/* +* Continue to search in descendant resources as if the +* matched descendant resources cover some ranges of 'p'. +* +* |------------- "CXL Window 0" ------------| +* |-- "System RAM" --| +* +* will behave similar as the following fake resource +* tree when searching "System RAM". +* +* |-- "System RAM" --||-- "CXL Window 0a" --| +*/ + covered = false; + ostart =max (res.start, p->start); + oend =min (res.end, p->end); +for (dp = p->child; dp; dp =next_resource (dp, false)) { +if (!resource_overlaps (dp, &res)) +continue ; + is_type = (dp->flags & flags) == flags && + (desc ==IORES_DESC_NONE || desc == dp->desc); +if (is_type) { + type++; +/* +* Range from 'ostart' to 'dp->start' +* isn't covered by matched resource. +*/ +if (dp->start > ostart) +break ; +if (dp->end >= oend) { + covered = true; +break ; + } +/* Remove covered range */ + ostart =max (ostart, dp->end +1 ); + } + } +if (!covered) + other++; }read_unlock (&resource_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 500/518 hwmon: (tmp513) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 193bc02c664999581a1f38c152f379fce91afc0c ]
0-day reports:
drivers/hwmon/tmp513.c:162:21: error:
variable 'tmp51x_regmap_config' has initializer but incomplete type
162 | static const struct regmap_config tmp51x_regmap_config = {
| ^
struct regmap_config is only available if REGMAP is enabled. Add the missing Kconfig dependency to fix the problem.
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -1866,6 +1866,7 @@ config SENSORS_TMP421 config SENSORS_TMP513 tristate "Texas Instruments TMP513 and compatibles" depends on I2C + select REGMAP_I2C help If you say yes here you get support for Texas Instruments TMP512, and TMP513 temperature and power supply sensor chips.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 501/518 hwmon: (adm9240) Add missing dependency on REGMAP_I2C
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit 14849a2ec175bb8a2280ce20efe002bb19f1e274 ]
This driver requires REGMAP_I2C to be selected in order to get access to regmap_config and devm_regmap_init_i2c. Add the missing dependency.
Message-ID: <[email protected]>
--- drivers/hwmon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/Kconfig +1 -0
@@ -178,6 +178,7 @@ config SENSORS_ADM9240 tristate "Analog Devices ADM9240 and compatibles" depends on I2C select HWMON_VID + select REGMAP_I2C help If you say yes here you get support for Analog Devices ADM9240, Dallas DS1780, National Semiconductor LM81 sensor chips.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 502/518 HID: plantronics: Workaround for an unexcepted opposite volume key
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wade Wang <[email protected]>
commit 87b696209007b7c4ef7bdfe39ea0253404a43770 upstream.
Some Plantronics headset as the below send an unexcept opposite volume key's HID report for each volume key press after 200ms, like unecepted Volume Up Key following Volume Down key pressed by user. This patch adds a quirk to hid-plantronics for these devices, which will ignore the second unexcepted opposite volume key if it happens within 220ms from the last one that was handled.
Plantronics EncorePro 500 Series (047f:431e)
Plantronics Blackwire_3325 Series (047f:430c)The patch was tested on the mentioned model, it shouldn't affect other models, however, this quirk might be needed for them too. Auto-repeat (when a key is held pressed) is not affected per test result.
--- drivers/hid/hid-ids.h | 2 ++ drivers/hid/hid-plantronics.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
drivers/hid/hid-ids.h +2 -0
@@ -963,6 +963,8 @@#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES 0xc057#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES 0xc058 +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES 0x430c +#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES 0x431e#define USB_VENDOR_ID_PANASONIC 0x04da#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
drivers/hid/hid-plantronics.c +23 -0
@@ -38,8 +38,10 @@ (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)#define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0) +#define PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS BIT(1)#define PLT_DOUBLE_KEY_TIMEOUT 5/* ms */ +#define PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT 220/* ms */ struct plt_drv_data {unsigned long device_type;
@@ -137,6 +139,21 @@ static int plantronics_event(struct hid_ drv_data->last_volume_key_ts = cur_ts; } +if (drv_data->quirks &PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS ) { +unsigned long prev_ts, cur_ts; + +/* Usages are filtered in plantronics_usages. */ + +if (!value)/* Handle key presses only. */ +return 0 ; + + prev_ts = drv_data->last_volume_key_ts; + cur_ts = jiffies; +if (jiffies_to_msecs (cur_ts - prev_ts) <=PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT ) +return 1 ;/* Ignore the followed opposite volume key. */ + + drv_data->last_volume_key_ts = cur_ts; + }return 0 ; }
@@ -210,6 +227,12 @@ static const struct hid_device_id plantr {HID_USB_DEVICE (USB_VENDOR_ID_PLANTRONICS , USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES), .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, + USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES), + .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, + USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES), + .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, { } };
Greg Kroah-Hartman
maintainerPATCH 503/518 Revert "usb: yurex: Replace snprintf() with the safer scnprintf() variant"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 71c717cd8a2e180126932cc6851ff21c1d04d69a upstream.
This reverts commit 86b20af11e84c26ae3fde4dcc4f490948e3f8035.
This patch leads to passing 0 to simple_read_from_buffer() as a fifth argument, turning the read method into a nop. The change is fundamentally flawed, as it breaks the driver.
--- drivers/usb/misc/yurex.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/usb/misc/yurex.c +8 -11
@@ -34,8 +34,6 @@#define YUREX_BUF_SIZE 8#define YUREX_WRITE_TIMEOUT (HZ*2) -#define MAX_S64_STRLEN 20/* {-}922337203685477580{7,8} */ -/* table of devices that work with this driver */ static struct usb_device_id yurex_table[] = { {USB_DEVICE (YUREX_VENDOR_ID ,YUREX_PRODUCT_ID ) },
@@ -402,7 +400,8 @@ static ssize_t yurex_read(struct file *f {struct usb_yurex *dev;int len =0 ; -char in_buffer[MAX_S64_STRLEN ]; +char in_buffer[20 ]; +unsigned long flags; dev = file->private_data;
@@ -412,16 +411,14 @@ static ssize_t yurex_read(struct file *freturn -ENODEV ; } -if (WARN_ON_ONCE (dev->bbu >S64_MAX || dev->bbu <S64_MIN )) { -mutex_unlock (&dev->io_mutex); -return -EIO ; - } - -spin_lock_irq (&dev->lock); -scnprintf (in_buffer,MAX_S64_STRLEN ,"%lld\n" , dev->bbu); -spin_unlock_irq (&dev->lock); +spin_lock_irqsave (&dev->lock, flags); + len =snprintf (in_buffer,20 ,"%lld\n" , dev->bbu); +spin_unlock_irqrestore (&dev->lock, flags);mutex_unlock (&dev->io_mutex); +if (WARN_ON_ONCE (len >=sizeof (in_buffer))) +return -EIO ; +return simple_read_from_buffer (buffer, count, ppos, in_buffer, len); }
Greg Kroah-Hartman
maintainerPATCH 504/518 usb: dwc3: core: Stop processing of pending events if controller is halted
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
commit 0d410e8913f5cffebcca79ffdd596009d4a13a28 upstream.
This commit addresses an issue where events were being processed when the controller was in a halted state. To fix this issue by stop processing the events as the event count was considered stale or invalid when the controller was halted.
--- drivers/usb/dwc3/core.c | 22 +++++++++++++++++++--- drivers/usb/dwc3/core.h | 4 ---- drivers/usb/dwc3/gadget.c | 11 ----------- 3 files changed, 19 insertions(+), 18 deletions(-)
drivers/usb/dwc3/core.c +19 -3
@@ -457,6 +457,7 @@ static int dwc3_alloc_event_buffers(struint dwc3_event_buffers_setup (struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +u32 reg;if (!dwc->ev_buf)return 0 ;
@@ -469,8 +470,10 @@ int dwc3_event_buffers_setup(struct dwc3 upper_32_bits(evt->dma));dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_SIZE (evt->length)); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg);return 0 ; }
@@ -497,7 +500,10 @@ void dwc3_event_buffers_cleanup(struct ddwc3_writel (dwc->regs,DWC3_GEVNTADRHI (0 ),0 );dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_INTMASK |DWC3_GEVNTSIZ_SIZE (0 )); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); + +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg); }static int dwc3_alloc_scratch_buffers (struct dwc3 *dwc)
@@ -1899,7 +1905,11 @@ static int dwc3_runtime_resume(struct deswitch (dwc->current_dr_role) {case DWC3_GCTL_PRTCAP_DEVICE : -dwc3_gadget_process_pending_events (dwc); +if (dwc->pending_events) { +pm_runtime_put (dwc->dev); + dwc->pending_events = false; +enable_irq (dwc->irq_gadget); + }break ;case DWC3_GCTL_PRTCAP_HOST :default :
@@ -1986,6 +1996,12 @@ static void dwc3_complete(struct devicestatic const struct dev_pm_ops dwc3_dev_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (dwc3_suspend, dwc3_resume) .complete = dwc3_complete, + +/* +* Runtime suspend halts the controller on disconnection. It relies on +* platforms with custom connection notification to start the controller +* again. +*/ SET_RUNTIME_PM_OPS (dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) };
drivers/usb/dwc3/core.h +0 -4
@@ -1532,7 +1532,6 @@ static inline void dwc3_otg_host_init(st#if !IS_ENABLED (CONFIG_USB_DWC3_HOST )int dwc3_gadget_suspend (struct dwc3 *dwc);int dwc3_gadget_resume (struct dwc3 *dwc); -void dwc3_gadget_process_pending_events (struct dwc3 *dwc);#else static inline int dwc3_gadget_suspend (struct dwc3 *dwc) {
@@ -1544,9 +1543,6 @@ static inline int dwc3_gadget_resume(str return 0; } -static inline void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -}#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */ #if IS_ENABLED (CONFIG_USB_DWC3_ULPI )
drivers/usb/dwc3/gadget.c +0 -11
@@ -4093,14 +4093,3 @@ err1: err0:return ret; } - -void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -if (dwc->pending_events) { -dwc3_interrupt (dwc->irq_gadget, dwc->ev_buf); -dwc3_thread_interrupt (dwc->irq_gadget, dwc->ev_buf); -pm_runtime_put (dwc->dev); - dwc->pending_events = false; -enable_irq (dwc->irq_gadget); - } -}
Greg Kroah-Hartman
maintainerPATCH 505/518 usb: xhci: Fix problem with xhci resume from suspend
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Alberto Reguero <[email protected]>
commit d44238d8254a36249d576c96473269dbe500f5e4 upstream.
I have a ASUS PN51 S mini pc that has two xhci devices. One from AMD, and other from ASMEDIA. The one from ASMEDIA have problems when resume from suspend, and keep broken until unplug the power cord. I use this kernel parameter: xhci-hcd.quirks=128 and then it works ok. I make a path to reset only the ASMEDIA xhci.
--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci-pci.c +5 -0
@@ -71,6 +71,7 @@#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242#define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142 +#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242static const char hcd_name[] ="xhci_hcd" ;
@@ -324,6 +325,10 @@ static void xhci_pci_quirks(struct devic pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; +if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && + pdev->device ==PCI_DEVICE_ID_ASMEDIA_3042_XHCI ) + xhci->quirks |=XHCI_RESET_ON_RESUME ; +if (pdev->vendor ==PCI_VENDOR_ID_TI && pdev->device ==0x8241 ) xhci->quirks |=XHCI_LIMIT_ENDPOINT_INTERVAL_7 ;
Greg Kroah-Hartman
maintainerPATCH 506/518 usb: storage: ignore bogus device raised by JieLi BR21 USB sound chip
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
commit a6555cb1cb69db479d0760e392c175ba32426842 upstream.
JieLi tends to use SCSI via USB Mass Storage to implement their own proprietary commands instead of implementing another USB interface. Enumerating it as a generic mass storage device will lead to a Hardware Error sense key get reported.
Ignore this bogus device to prevent appearing a unusable sdX device file.
--- drivers/usb/storage/unusual_devs.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/storage/unusual_devs.h +11 -0
@@ -2412,6 +2412,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE), +/* +* Reported by Icenowy Zheng <[email protected]> +* This is an interface for vendor-specific cryptic commands instead +* of real USB storage device. +*/ +UNUSUAL_DEV (0xe5b7 ,0x0811 ,0x0100 ,0x0100 , +"ZhuHai JieLi Technology" , +"JieLi BR21" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_IGNORE_DEVICE ), +/* Reported by Andrew Simmons <[email protected]> */ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, "DataStor",
Greg Kroah-Hartman
maintainerPATCH 507/518 hid: intel-ish-hid: Fix uninitialized variable rv in ish_fw_xfer_direct_dma
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: SurajSonawane2415 <[email protected]>
commit d41bff05a61fb539f21e9bf0d39fac77f457434e upstream.
Fix the uninitialized symbol 'rv' in the function ish_fw_xfer_direct_dma to resolve the following warning from the smatch tool:drivers/hid/intel-ish-hid/ishtp-fw-loader.c:714 ish_fw_xfer_direct_dma()
error: uninitialized symbol 'rv'.
Initialize 'rv' to 0 to prevent undefined behavior from uninitialized access.
--- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp-fw-loader.c +1 -1
@@ -630,7 +630,7 @@ static int ish_fw_xfer_direct_dma(structconst struct firmware *fw, const struct shim_fw_info fw_info) { - int rv; + int rv = 0;void *dma_buf;dma_addr_t dma_buf_phy;u32 fragment_offset, fragment_size, payload_max_size;
Greg Kroah-Hartman
maintainerPATCH 508/518 net: Fix an unsafe loop on the list
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Kovaleva <[email protected]>
commit 1dae9f1187189bc09ff6d25ca97ead711f7e26f9 upstream.
The kernel may crash when deleting a genetlink family if there are still listeners for that family:
Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [c000000000c080bc] netlink_update_socket_mc+0x3c/0xc0 LR [c000000000c0f764] __netlink_clear_multicast_users+0x74/0xc0 Call Trace: __netlink_clear_multicast_users+0x74/0xc0 genl_unregister_family+0xd4/0x2d0
Change the unsafe loop on the list to a safe one, because inside the loop there is an element removal from this list.
--- include/net/sock.h | 2 ++ net/netlink/af_netlink.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/net/sock.h +2 -0
@@ -834,6 +834,8 @@ static inline void sk_add_bind_node(stru hlist_for_each_entry_safe(__sk, tmp, list, sk_node)#define sk_for_each_bound (__sk, list) \ hlist_for_each_entry(__sk, list, sk_bind_node) +#define sk_for_each_bound_safe (__sk, tmp, list) \ + hlist_for_each_entry_safe(__sk, tmp, list, sk_bind_node)/** * sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset
net/netlink/af_netlink.c +2 -1
@@ -2155,8 +2155,9 @@ void __netlink_clear_multicast_users(str {struct sock *sk;struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; +struct hlist_node *tmp; -sk_for_each_bound (sk, &tbl->mc_list) +sk_for_each_bound_safe (sk, tmp, &tbl->mc_list)netlink_update_socket_mc (nlk_sk (sk), group,0 ); }
Greg Kroah-Hartman
maintainerPATCH 509/518 net: dsa: lan9303: ensure chip reset and wait for READY status
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anatolij Gustschin <[email protected]>
commit 5c14e51d2d7df49fe0d4e64a12c58d2542f452ff upstream.
Accessing device registers seems to be not reliable, the chip revision is sometimes detected wrongly (0 instead of expected 1).
Ensure that the chip reset is performed via reset GPIO and then wait for 'Device Ready' status in HW_CFG register before doing any register initializations.
--- drivers/net/dsa/lan9303-core.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/net/dsa/lan9303-core.c +29 -0
@@ -6,6 +6,7 @@#include <linux/module.h> #include <linux/gpio/consumer.h> #include <linux/regmap.h> +#include <linux/iopoll.h> #include <linux/mutex.h> #include <linux/mii.h> #include <linux/phy.h>
@@ -819,6 +820,8 @@ static void lan9303_handle_reset(structif (!chip->reset_gpio)return ; +gpiod_set_value_cansleep (chip->reset_gpio,1 ); +if (chip->reset_duration !=0 )msleep (chip->reset_duration);
@@ -844,8 +847,34 @@ static int lan9303_disable_processing(ststatic int lan9303_check_device (struct lan9303 *chip) {int ret; +int err;u32 reg; +/* In I2C-managed configurations this polling loop will clash with +* switch's reading of EEPROM right after reset and this behaviour is +* not configurable. While lan9303_read() already has quite long retry +* timeout, seems not all cases are being detected as arbitration error. +* +* According to datasheet, EEPROM loader has 30ms timeout (in case of +* missing EEPROM). +* +* Loading of the largest supported EEPROM is expected to take at least +* 5.9s. +*/ + err =read_poll_timeout (lan9303_read, ret, + !ret && reg &LAN9303_HW_CFG_READY , +20000 ,6000000 , false, + chip->regmap,LAN9303_HW_CFG , ®); +if (ret) { +dev_err (chip->dev,"failed to read HW_CFG reg: %pe\n" , +ERR_PTR (ret)); +return ret; + } +if (err) { +dev_err (chip->dev,"HW_CFG not ready: 0x%08x\n" , reg); +return err; + } + ret =lan9303_read (chip->regmap,LAN9303_CHIP_REV , ®);if (ret) { dev_err(chip->dev, "failed to read chip revision register: %d\n",
Greg Kroah-Hartman
maintainerPATCH 510/518 nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Maman <[email protected]>
commit 835745a377a4519decd1a36d6b926e369b3033e2 upstream.
The nouveau_dmem_copy_one function ensures that the copy push command is sent to the device firmware but does not track whether it was executed successfully.
In the case of a copy error (e.g., firmware or hardware failure), the copy push command will be sent via the firmware channel, and nouveau_dmem_copy_one will likely report success, leading to the migrate_to_ram function returning a dirty HIGH_USER page to the user.
This can result in a security vulnerability, as a HIGH_USER page that may contain sensitive or corrupted data could be returned to the user.
To prevent this vulnerability, we allocate a zero page. Thus, in case of an error, a non-dirty (zero) page will be returned to the user.
--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +1 -1
@@ -149,7 +149,7 @@ static vm_fault_t nouveau_dmem_fault_copif (!spage || !(args->src[0 ] &MIGRATE_PFN_MIGRATE ))return 0 ; - dpage =alloc_page_vma (GFP_HIGHUSER , vmf->vma, vmf->address); + dpage =alloc_page_vma (GFP_HIGHUSER | __GFP_ZERO, vmf->vma, vmf->address);if (!dpage)return VM_FAULT_SIGBUS ;lock_page (dpage);
Greg Kroah-Hartman
maintainerPATCH 511/518 net: geneve: add missing netlink policy and size for IFLA_GENEVE_INNER_PROTO_INHERIT
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eyal Birger <[email protected]>
commit 36c2e31ad25bd087756b8db9584994d1d80c236b upstream.
Add missing netlink attribute policy and size calculation. Also enable strict validation from this new attribute onwards.
--- drivers/net/geneve.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/geneve.c +3 -0
@@ -1277,6 +1277,7 @@ static void geneve_setup(struct net_devi }static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX +1 ] = { + [IFLA_GENEVE_UNSPEC ] = { .strict_start_type =IFLA_GENEVE_INNER_PROTO_INHERIT }, [IFLA_GENEVE_ID ] = { .type =NLA_U32 }, [IFLA_GENEVE_REMOTE] = { .len = sizeof_field(struct iphdr, daddr) }, [IFLA_GENEVE_REMOTE6 ] = { .len =sizeof (struct in6_addr ) },
@@ -1290,6 +1291,7 @@ static const struct nla_policy geneve_po [IFLA_GENEVE_UDP_ZERO_CSUM6_RX] = { .type = NLA_U8 }, [IFLA_GENEVE_TTL_INHERIT] = { .type = NLA_U8 }, [IFLA_GENEVE_DF] = { .type = NLA_U8 }, + [IFLA_GENEVE_INNER_PROTO_INHERIT] = { .type = NLA_FLAG }, }; static int geneve_validate(struct nlattr *tb[], struct nlattr *data[],
@@ -1795,6 +1797,7 @@ static size_t geneve_get_size(const strunla_total_size (sizeof (__u8)) +/* IFLA_GENEVE_UDP_ZERO_CSUM6_TX */ nla_total_size (sizeof (__u8)) +/* IFLA_GENEVE_UDP_ZERO_CSUM6_RX */ nla_total_size (sizeof (__u8)) +/* IFLA_GENEVE_TTL_INHERIT */ +nla_total_size (0 ) +/* IFLA_GENEVE_INNER_PROTO_INHERIT */ 0 ; }
Greg Kroah-Hartman
maintainerPATCH 512/518 xfrm: Pass flowi_oif or l3mdev as oif to xfrm_dst_lookup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
commit 748b82c23e25310fec54e1eff2cb63936f391b24 upstream.
The commit referenced in the Fixes tag no longer changes the flow oif to the l3mdev ifindex. A xfrm use case was expecting the flowi_oif to be the VRF if relevant and the change broke that test. Update xfrm_bundle_create to pass oif if set and any potential flowi_l3mdev if oif is not set.
--- net/xfrm/xfrm_policy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +3 -1
@@ -2595,12 +2595,14 @@ static struct dst_entry *xfrm_bundle_creif (xfrm[i]->props.mode !=XFRM_MODE_TRANSPORT ) {__u32 mark =0 ; +int oif;if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) mark =xfrm_smark_get (fl->flowi_mark, xfrm[i]); family = xfrm[i]->props.family; - dst =xfrm_dst_lookup (xfrm[i], tos, fl->flowi_oif, + oif = fl->flowi_oif ? : fl->flowi_l3mdev; + dst =xfrm_dst_lookup (xfrm[i], tos, oif, &saddr, &daddr, family, mark); err =PTR_ERR (dst);if (IS_ERR (dst))
Greg Kroah-Hartman
maintainerPATCH 513/518 net: Handle l3mdev in ip_tunnel_init_flow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
commit db53cd3d88dc328dea2e968c9c8d3b4294a8a674 upstream.
Ido reported that the commit referenced in the Fixes tag broke a gre use case with dummy devices. Add a check to ip_tunnel_init_flow to see if the oif is an l3mdev port and if so set the oif to 0 to avoid the oif comparison in fib_lookup_good_nhc.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c | 2 +- include/net/ip_tunnels.h | 11 +++++++++-- net/ipv4/ip_gre.c | 4 ++-- net/ipv4/ip_tunnel.c | 9 +++++---- 4 files changed, 17 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c +1 -1
@@ -422,7 +422,7 @@ mlxsw_sp_span_gretap4_route(const struct parms =mlxsw_sp_ipip_netdev_parms4 (to_dev);ip_tunnel_init_flow (&fl4, parms.iph.protocol, *daddrp, *saddrp, -0 ,0 , parms.link, tun->fwmark,0 ); +0 ,0 ,dev_net (to_dev), parms.link, tun->fwmark,0 ); rt =ip_route_output_key (tun->net, &fl4);if (IS_ERR (rt))
include/net/ip_tunnels.h +9 -2
@@ -240,11 +240,18 @@ static inline __be32 tunnel_id_to_key32(static inline void ip_tunnel_init_flow (struct flowi4 *fl4,int proto,__be32 daddr,__be32 saddr, -__be32 key,__u8 tos,int oif, +__be32 key,__u8 tos, +struct net *net,int oif,__u32 mark,__u32 tun_inner_hash) {memset (fl4,0 ,sizeof (*fl4)); - fl4->flowi4_oif = oif; + +if (oif) { + fl4->flowi4_l3mdev =l3mdev_master_upper_ifindex_by_index_rcu (net, oif); +/* Legacy VRF/l3mdev use case */ + fl4->flowi4_oif = fl4->flowi4_l3mdev ?0 : oif; + } + fl4->daddr = daddr; fl4->saddr = saddr; fl4->flowi4_tos = tos;
net/ipv4/ip_gre.c +2 -2
@@ -608,8 +608,8 @@ static int gre_fill_metadata_dst(struct key = &info->key;ip_tunnel_init_flow (&fl4,IPPROTO_GRE , key->u.ipv4.dst, key->u.ipv4.src,tunnel_id_to_key32 (key->tun_id), - key->tos & ~INET_ECN_MASK ,0 , skb->mark, -skb_get_hash (skb)); + key->tos & ~INET_ECN_MASK ,dev_net (dev),0 , + skb->mark,skb_get_hash (skb)); rt =ip_route_output_key (dev_net (dev), &fl4);if (IS_ERR (rt))return PTR_ERR (rt);
net/ipv4/ip_tunnel.c +5 -4
@@ -294,8 +294,8 @@ static int ip_tunnel_bind_dev(struct netip_tunnel_init_flow (&fl4, iph->protocol, iph->daddr, iph->saddr, tunnel->parms.o_key, -RT_TOS (iph->tos), tunnel->parms.link, - tunnel->fwmark,0 ); +RT_TOS (iph->tos),dev_net (dev), + tunnel->parms.link, tunnel->fwmark,0 ); rt =ip_route_output_key (tunnel->net, &fl4);if (!IS_ERR (rt)) {
@@ -597,7 +597,7 @@ void ip_md_tunnel_xmit(struct sk_buff *s }ip_tunnel_init_flow (&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src,tunnel_id_to_key32 (key->tun_id),RT_TOS (tos), -0 , skb->mark,skb_get_hash (skb)); +dev_net (dev),0 , skb->mark,skb_get_hash (skb));if (tunnel->encap.type !=TUNNEL_ENCAP_NONE ) goto tx_error;
@@ -753,7 +753,8 @@ void ip_tunnel_xmit(struct sk_buff *skb, }ip_tunnel_init_flow (&fl4, protocol, dst, tnl_params->saddr, - tunnel->parms.o_key,RT_TOS (tos), tunnel->parms.link, + tunnel->parms.o_key,RT_TOS (tos), +dev_net (dev), tunnel->parms.link, tunnel->fwmark,skb_get_hash (skb));if (ip_tunnel_encap (skb, tunnel, &protocol, &fl4) <0 )
Greg Kroah-Hartman
maintainerPATCH 514/518 net: seg6: fix seg6_lookup_any_nexthop() to handle VRFs using flowi_l3mdev
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <[email protected]>
commit a3bd2102e464202b58d57390a538d96f57ffc361 upstream.
Commit 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") adds a new entry (flowi_l3mdev) in the common flow struct used for indicating the l3mdev index for later rule and table matching.
The l3mdev_update_flow() has been adapted to properly set the flowi_l3mdev based on the flowi_oif/flowi_iif. In fact, when a valid flowi_iif is supplied to the l3mdev_update_flow(), this function can update the flowi_l3mdev entry only if it has not yet been set (i.e., the flowi_l3mdev entry is equal to 0).
The SRv6 End.DT6 behavior in VRF mode leverages a VRF device in order to force the routing lookup into the associated routing table. This routing operation is performed by seg6_lookup_any_nextop() preparing a flowi6 data structure used by ip6_route_input_lookup() which, in turn, (indirectly) invokes l3mdev_update_flow().
However, seg6_lookup_any_nexthop() does not initialize the new flowi_l3mdev entry which is filled with random garbage data. This prevents l3mdev_update_flow() from properly updating the flowi_l3mdev with the VRF index, and thus SRv6 End.DT6 (VRF mode)/DT46 behaviors are broken.
This patch correctly initializes the flowi6 instance allocated and used by seg6_lookup_any_nexhtop(). Specifically, the entire flowi6 instance is wiped out: in case new entries are added to flowi/flowi6 (as happened with the flowi_l3mdev entry), we should no longer have incorrectly initialized values. As a result of this operation, the value of flowi_l3mdev is also set to 0.
The proposed fix can be tested easily. Starting from the commit referenced in the Fixes, selftests [1],[2] indicate that the SRv6 End.DT6 (VRF mode)/DT46 behaviors no longer work correctly. By applying this patch, those behaviors are back to work properly again.
[1] - tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh
[2] - tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh
--- net/ipv6/seg6_local.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/seg6_local.c +1 -0
@@ -163,6 +163,7 @@ seg6_lookup_any_nexthop(struct sk_buff *struct flowi6 fl6;int dev_flags =0 ; +memset (&fl6,0 ,sizeof (fl6)); fl6.flowi6_iif = skb->dev->ifindex; fl6.daddr = nhaddr ? *nhaddr : hdr->daddr; fl6.saddr = hdr->saddr;
Greg Kroah-Hartman
maintainerPATCH 515/518 net: vrf: determine the dst using the original ifindex for multicast
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antoine Tenart <[email protected]>
commit f2575c8f404911da83f25b688e12afcf4273e640 upstream.
Multicast packets received on an interface bound to a VRF are marked as belonging to the VRF and the skb device is updated to point to the VRF device itself. This was fine even when a route was associated to a device as when performing a fib table lookup 'oif' in fib6_table_lookup (coming from 'skb->dev->ifindex' in ip6_route_input) was set to 0 when FLOWI_FLAG_SKIP_NH_OIF was set.
With commit 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") this is not longer true and multicast traffic is not received on the original interface.
Instead of adding back a similar check in fib6_table_lookup determine the dst using the original ifindex for multicast VRF traffic. To make things consistent across the function do the above for all strict packets, which was the logic before commit 6f12fa775530 ("vrf: mark skb for multicast or link-local as enslaved to VRF"). Note that reverting to this behavior should be fine as the change was about marking packets belonging to the VRF, not about their dst.
--- drivers/net/vrf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/vrf.c +3 -3
@@ -1336,8 +1336,8 @@ static struct sk_buff *vrf_ip6_rcv(struc/* loopback, multicast & non-ND link-local traffic; do not push through * packet taps again. Reset pkt_type for upper layers to process skb. -* For strict packets with a source LLA, determine the dst using the -* original ifindex. +* For non-loopback strict packets, determine the dst using the original +* ifindex. */ if (skb->pkt_type ==PACKET_LOOPBACK || (need_strict && !is_ndisc)) { skb->dev = vrf_dev;
@@ -1346,7 +1346,7 @@ static struct sk_buff *vrf_ip6_rcv(strucif (skb->pkt_type ==PACKET_LOOPBACK ) skb->pkt_type =PACKET_HOST ; -else if (ipv6_addr_type (&ipv6_hdr (skb)->saddr) &IPV6_ADDR_LINKLOCAL ) +else vrf_ip6_input_dst (skb, vrf_dev, orig_iif); goto out;
Greg Kroah-Hartman
maintainerPATCH 516/518 netfilter: ip6t_rpfilter: Fix regression with VRF interfaces
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
commit efb056e5f1f0036179b2f92c1c15f5ea7a891d70 upstream.
When calling ip6_route_lookup() for the packet arriving on the VRF interface, the result is always the real (slave) interface. Expect this when validating the result.
--- net/ipv6/netfilter/ip6t_rpfilter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/netfilter/ip6t_rpfilter.c +3 -1
@@ -72,7 +72,9 @@ static bool rpfilter_lookup_reverse6(str goto out; } -if (rt->rt6i_idev->dev == dev || (flags &XT_RPFILTER_LOOSE )) +if (rt->rt6i_idev->dev == dev || +l3mdev_master_ifindex_rcu (rt->rt6i_idev->dev) == dev->ifindex || + (flags &XT_RPFILTER_LOOSE )) ret = true; out:ip6_rt_put (rt);
Greg Kroah-Hartman
maintainerPATCH 517/518 ext4: fix warning in ext4_dio_write_end_io()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 619f75dae2cf117b1d07f27b046b9ffb071c4685 upstream.
The syzbot has reported that it can hit the warning in ext4_dio_write_end_io() because i_size < i_disksize. Indeed the reproducer creates a race between DIO IO completion and truncate expanding the file and thus ext4_dio_write_end_io() sees an inconsistent inode state where i_disksize is already updated but i_size is not updated yet. Since we are careful when setting up DIO write and consider it extending (and thus performing the IO synchronously with i_rwsem held exclusively) whenever it goes past either of i_size or i_disksize, we can use the same test during IO completion without risking entering ext4_handle_inode_extension() without i_rwsem held. This way we make it obvious both i_size and i_disksize are large enough when we report DIO completion without relying on unreliable WARN_ON.
--- fs/ext4/file.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/ext4/file.c +8 -6
@@ -323,9 +323,10 @@ static void ext4_inode_extension_cleanupreturn ; }/* -* If i_disksize got extended due to writeback of delalloc blocks while -* the DIO was running we could fail to cleanup the orphan list in -* ext4_handle_inode_extension(). Do it now. +* If i_disksize got extended either due to writeback of delalloc +* blocks or extending truncate while the DIO was running we could fail +* to cleanup the orphan list in ext4_handle_inode_extension(). Do it +* now. */ if (!list_empty (&EXT4_I (inode)->i_orphan) && inode->i_nlink) {handle_t *handle =ext4_journal_start (inode,EXT4_HT_INODE ,2 );
@@ -360,10 +361,11 @@ static int ext4_dio_write_end_io(struct* blocks. But the code in ext4_iomap_alloc() is careful to use * zeroed/unwritten extents if this is possible; thus we won't leave * uninitialized blocks in a file even if we didn't succeed in writing -* as much as we intended. +* as much as we intended. Also we can race with truncate or write +* expanding the file so we have to be a bit careful here. */ -WARN_ON_ONCE (i_size_read (inode) <READ_ONCE (EXT4_I (inode)->i_disksize)); -if (pos + size <=READ_ONCE (EXT4_I (inode)->i_disksize)) +if (pos + size <=READ_ONCE (EXT4_I (inode)->i_disksize) && + pos + size <=i_size_read (inode))return size;return ext4_handle_inode_extension (inode, pos, size); }
Greg Kroah-Hartman
maintainerPATCH 518/518 RDMA/hns: Fix uninitialized variable
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yixing Liu <[email protected]>
commit 2a38c0f10e6d7d28e06ff1eb1f350804c4850275 upstream.
A random value will be returned if the condition below is not met, so it needs to be initialized.
--- drivers/infiniband/hw/hns/hns_roce_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_mr.c +1 -1
@@ -832,7 +832,7 @@ int hns_roce_mtr_map(struct hns_roce_devstruct ib_device *ibdev = &hr_dev->ib_dev;struct hns_roce_buf_region *r;unsigned int i, mapped_cnt; -int ret; +int ret =0 ;/* * Only use the first page address as root ba when hopnum is 0, this
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.227 release. There are 518 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 17 Oct 2024 12:37:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.227-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
A larger set of clang-19 builds failed on arm, i386 and x86 due to following stable-rc linux-5.10.y.
And gcc-13 and gcc-12 builds passed.
List of build regressions,
* arm, build
- clang-19-at91_dt_defconfig
- clang-19-axm55xx_defconfig
- clang-19-bcm2835_defconfig
- clang-19-clps711x_defconfig
- clang-19-davinci_all_defconfig
- clang-19-defconfig
...
* x86_64, build
- clang-19-lkftconfig
- clang-19-lkftconfig-kcsan
- clang-19-lkftconfig-no-kselftest-frag
- clang-19-x86_64_defconfig
- clang-nightly-lkftconfig-kselftest
The bisect points to,
da1084f5722a9a46bdcadc09429dc4b56ac31de4
i2c: Add i2c_get_match_data()
[ Upstream commit 564d73c4d9201526bd976b9379d2aaf1a7133e84 ]
Build log:
-----------drivers/i2c/i2c-core-base.c:101:31: error: passing 'const struct device *' to parameter of type 'struct device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
101 | data = device_get_match_data(&client->dev);
| ^~~~~~~~~~~~include/linux/property.h:382:50: note: passing argument to parameter 'dev' here
382 | const void *device_get_match_data(struct device *dev);
| ^
1 error generated.
Build link,
-------
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.226-519-g5807510dd577/testrun/25457427/suite/build/test/clang-19-vexpress_defconfig/log
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2nTXZNd4wRQOyppVvH0kgAPF6cE/
Build history:
----------
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.226-519-g5807510dd577/testrun/25457427/suite/build/test/clang-19-vexpress_defconfig/history/
metadata:
----
git describe: v5.10.226-519-g5807510dd577
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git sha: 5807510dd5773e507a5ba5ca98fce623d87256a0
kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2nTXZNd4wRQOyppVvH0kgAPF6cE/config
build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2nTXZNd4wRQOyppVvH0kgAPF6cE/
toolchain: clang-19
config: defconfig
arch: arm, arm64, i386 and x86
Steps to reproduce:
-------
# tuxmake --runtime podman --target-arch arm --toolchain clang-19 --kconfig vexpress_defconfig LLVM=1 LLVM_IAS=0
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 43 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.227 release. There are 518 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 17 Oct 2024 12:37:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.227-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
A larger set of clang-19 builds failed on arm, i386 and x86 due to following stable-rc linux-5.10.y.
And gcc-13 and gcc-12 builds passed.
List of build regressions,
* arm, build
- clang-19-at91_dt_defconfig
- clang-19-axm55xx_defconfig
- clang-19-bcm2835_defconfig
- clang-19-clps711x_defconfig
- clang-19-davinci_all_defconfig
- clang-19-defconfig
...*
x86_64, build
- clang-19-lkftconfig
- clang-19-lkftconfig-kcsan
- clang-19-lkftconfig-no-kselftest-frag
- clang-19-x86_64_defconfig
- clang-nightly-lkftconfig-kselftest
Quoted 6 lines
The bisect points to,
da1084f5722a9a46bdcadc09429dc4b56ac31de4
i2c: Addi2c_get_match_data()[ Upstream commit 564d73c4d9201526bd976b9379d2aaf1a7133e84 ]
Thanks, commit aade55c86033 ("device property: Add const qualifier to device_get_match_data() parameter") was missing, I've queued that up now.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.227 release. There are 518 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 17 Oct 2024 12:37:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.227-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.227 release. There are 518 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 17 Oct 2024 12:37:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.227-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.10:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
67 tests: 67 pass, 0 failLinux version: 5.10.227-rc1-g5807510dd577
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.227 release. There are 518 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 17 Oct 2024 12:37:45 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.227-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
Hi,
Please find the KernelCI report below :-
OVERVIEW
Builds: 24 passed, 1 failed
Boot tests: 52 passed, 2 failed
CI systems: maestro
REVISION
Commit
name:
hash: 5807510dd5773e507a5ba5ca98fce623d87256a0
Checked out from
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
BUILDS
Failures
- x86_64 (x86_64_defconfig)
Build detail: https://kcidb.kernelci.org/d/build/build?var-datasource=edquppk2ghfcwc&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-id=maestro:670e6dd25c0f1c2335e57199&var-test-path=boot&orgId=1
Build error: drivers/i2c/i2c-core-base.c:101:31: error: passing 'const struct device *' to parameter of type 'struct device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] data = device_get_match_data(&client->dev);
BOOT TESTS
Failures
- i386 (defconfig)
Error detail: [ 15.624317] BUG: kernel NULL pointer dereference, address: 00000000
Build error: https://kcidb.kernelci.org/d/test/test?var-datasource=edquppk2ghfcwc&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-id=maestro:670e713c5c0f1c2335e57a48&orgId=1
- i386 (defconfig)
Error detail: [ 15.008295] BUG: kernel NULL pointer dereference, address: 00000000
Build error: https://kcidb.kernelci.org/d/test/test?var-datasource=edquppk2ghfcwc&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-id=maestro:670e71405c0f1c2335e57a4e&orgId=1
See complete and up-to-date report at:
https://kcidb.kernelci.org/d/revision/revision?orgId=1&var-datasource=edquppk2ghfcwc&var-git_commit_hash=5807510dd5773e507a5ba5ca98fce623d87256a0&var-patchset_hash=&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-test_path=boot
Thanks,
KernelCI team