6.6.76-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 274/393 i3c: dw: Fix use-after-free in dw_i3c_master driver due to race condition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit b75439c945b94dd8a2b645355bdb56f948052601 ]
In dw_i3c_common_probe, &master->hj_work is bound with dw_i3c_hj_work. And dw_i3c_master_irq_handler can call dw_i3c_master_irq_handle_ibis function to start the work.
If we remove the module which will call dw_i3c_common_remove to make cleanup, it will free master->base through i3c_master_unregister while the work mentioned above will be used. The sequence of operations that may lead to a UAF bug is as follows:
CPU0 CPU1
| dw_i3c_hj_work
dw_i3c_common_remove |
i3c_master_unregister(&master->base) |
device_unregister(&master->dev) |
device_release |
//free master->base |
| i3c_master_do_daa(&master->base)
| //use master->baseFix it by ensuring that the work is canceled before proceeding with the cleanup in dw_i3c_common_remove.
--- drivers/i3c/master/dw-i3c-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/dw-i3c-master.c +1 -0
@@ -1528,6 +1528,7 @@ EXPORT_SYMBOL_GPL(dw_i3c_common_probe);void dw_i3c_common_remove (struct dw_i3c_master *master) { +cancel_work_sync (&master->hj_work);i3c_master_unregister (&master->base);reset_control_assert (master->core_rst);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/393 RDMA/mlx5: Fix indirect mkey ODP page count
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Guralnik <[email protected]>
[ Upstream commit 235f238402194a78ac5fb882a46717eac817e5d1 ]
Restrict the check for the number of pages handled during an ODP page fault to direct mkeys.
Perform the check right after handling the page fault and don't propagate the number of handled pages to callers.
Indirect mkeys and their associated direct mkeys can have different start addresses. As a result, the calculation of the number of pages to handle for an indirect mkey may not match the actual page fault handling done on the direct mkey.
For example:
A 4K sized page fault on a KSM mkey that has a start address that is not aligned to a page will result a calculation that assumes the number of pages required to handle are 2.
While the underlying MTT might be aligned will require fetching only a single page.
Thus, do the calculation and compare number of pages handled only per direct mkey.
--- drivers/infiniband/hw/mlx5/odp.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/infiniband/hw/mlx5/odp.c +15 -17
@@ -807,8 +807,7 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key)/* * Handle a single data segment in a page-fault WQE or RDMA region. * -* Returns number of OS pages retrieved on success. The caller may continue to -* the next data segment. +* Returns zero on success. The caller may continue to the next data segment. * Can return the following error codes: * -EAGAIN to designate a temporary error. The caller will abort handling the * page fault and resolve it.
@@ -821,7 +820,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, u32 *bytes_committed, u32 *bytes_mapped) { -int npages =0 , ret, i, outlen, cur_outlen =0 , depth =0 ; +int ret, i, outlen, cur_outlen =0 , depth =0 , pages_in_range;struct pf_frame *head =NULL , *frame;struct mlx5_ib_mkey *mmkey;struct mlx5_ib_mr *mr;
@@ -864,13 +863,20 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev,case MLX5_MKEY_MR : mr = container_of(mmkey, struct mlx5_ib_mr, mmkey); + pages_in_range = (ALIGN (io_virt + bcnt,PAGE_SIZE ) - + (io_virt &PAGE_MASK )) >> +PAGE_SHIFT ; ret =pagefault_mr (mr, io_virt, bcnt, bytes_mapped,0 , false);if (ret <0 ) goto end;mlx5_update_odp_stats (mr, faults, ret); - npages += ret; +if (ret < pages_in_range) { + ret = -EFAULT ; + goto end; + } + ret =0 ;break ;
@@ -961,7 +967,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev,kfree (out); *bytes_committed =0 ; -return ret ? ret : npages; +return ret; }/*
@@ -980,8 +986,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev,* the committed bytes). * @receive_queue: receive WQE end of sg list * -* Returns the number of pages loaded if positive, zero for an empty WQE, or a -* negative error code. +* Returns zero for success or a negative error code. */ static int pagefault_data_segments(struct mlx5_ib_dev *dev, struct mlx5_pagefault *pfault,
@@ -989,7 +994,7 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev, void *wqe_end, u32 *bytes_mapped, u32 *total_wqe_bytes, bool receive_queue) { - int ret = 0, npages = 0; + int ret = 0;u64 io_virt;__be32 key;u32 byte_count;
@@ -1046,10 +1051,9 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev, bytes_mapped);if (ret <0 )break ; - npages += ret; } -return ret <0 ? ret : npages; +return ret; }/*
@@ -1285,12 +1289,6 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,free_page ((unsigned long )wqe_start); } -static int pages_in_range (u64 address,u32 length) -{ -return (ALIGN (address + length,PAGE_SIZE ) - - (address &PAGE_MASK )) >>PAGE_SHIFT ; -} -static void mlx5_ib_mr_rdma_pfault_handler (struct mlx5_ib_dev *dev,struct mlx5_pagefault *pfault) {
@@ -1329,7 +1327,7 @@ static void mlx5_ib_mr_rdma_pfault_handler(struct mlx5_ib_dev *dev,if (ret == -EAGAIN ) {/* We're racing with an invalidation, don't prefetch */ prefetch_activated =0 ; - }else if (ret <0 ||pages_in_range (address, length) > ret) { + }else if (ret <0 ) {mlx5_ib_page_fault_resume (dev, pfault,1 );if (ret != -ENOENT ) mlx5_ib_dbg(dev, "PAGE FAULT error %d. QP 0x%x, type: 0x%x\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/393 of: reserved-memory: Do not make kmemleak ignore freed address
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit 29091a52562bca4d6e678dd8f0085dac119d6a21 ]
early_init_dt_alloc_reserved_memory_arch() will free address @base when suffers memblock_mark_nomap() error, but it still makes kmemleak ignore the freed address @base via kmemleak_ignore_phys().
That is unnecessary, besides, also causes unnecessary warning messages:
kmemleak_ignore_phys()
-> make_black_object()
-> paint_ptr()
-> kmemleak_warn() // warning message here.Fix by avoiding kmemleak_ignore_phys() when suffer the error.
--- drivers/of/of_reserved_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/of/of_reserved_mem.c +2 -1
@@ -50,7 +50,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,memblock_phys_free (base, size); } -kmemleak_ignore_phys (base); +if (!err) +kmemleak_ignore_phys (base);return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 277/393 efi: sysfb_efi: fix W=1 warnings when EFI is not set
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 19fdc68aa7b90b1d3d600e873a3e050a39e7663d ]
A build with W=1 fails because there are code and data that are not needed or used when CONFIG_EFI is not set. Move the "#ifdef CONFIG_EFI" block to earlier in the source file so that the unused code/data are not built.
drivers/firmware/efi/sysfb_efi.c:345:39: warning: ‘efifb_fwnode_ops’ defined but not used [-Wunused-const-variable=]
345 | static const struct fwnode_operations efifb_fwnode_ops = {
| ^~~~~~~~~~~~~~~~
drivers/firmware/efi/sysfb_efi.c:238:35: warning: ‘efifb_dmi_swap_width_height’ defined but not used [-Wunused-const-variable=]
238 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firmware/efi/sysfb_efi.c:188:35: warning: ‘efifb_dmi_system_table’ defined but not used [-Wunused-const-variable=]
188 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
| ^~~~~~~~~~~~~~~~~~~~~~--- drivers/firmware/efi/sysfb_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/sysfb_efi.c +1 -1
@@ -91,6 +91,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt) _ret_; \ }) +#ifdef CONFIG_EFI static int __init efifb_set_system (const struct dmi_system_id *id) {struct efifb_dmi_info *info = id->driver_data;
@@ -346,7 +347,6 @@ static const struct fwnode_operations efifb_fwnode_ops = { .add_links = efifb_add_links, }; -#ifdef CONFIG_EFI static struct fwnode_handle efifb_fwnode;__init void sysfb_apply_efi_quirks (void )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 278/393 RDMA/rxe: Fix the warning "__rxe_cleanup+0x12c/0x170 [rdma_rxe]"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit edc4ef0e0154096d6c0cf5e06af6fc330dbad9d1 ]
The Call Trace is as below:
"
<TASK> ? show_regs.cold+0x1a/0x1f ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] ? __warn+0x84/0xd0 ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] ? report_bug+0x105/0x180 ? handle_bug+0x46/0x80 ? exc_invalid_op+0x19/0x70 ? asm_exc_invalid_op+0x1b/0x20 ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] ? __rxe_cleanup+0x124/0x170 [rdma_rxe] rxe_destroy_qp.cold+0x24/0x29 [rdma_rxe] ib_destroy_qp_user+0x118/0x190 [ib_core] rdma_destroy_qp.cold+0x43/0x5e [rdma_cm] rtrs_cq_qp_destroy.cold+0x1d/0x2b [rtrs_core] rtrs_srv_close_work.cold+0x1b/0x31 [rtrs_server] process_one_work+0x21d/0x3f0 worker_thread+0x4a/0x3c0 ? process_one_work+0x3f0/0x3f0 kthread+0xf0/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
"
When too many rdma resources are allocated, rxe needs more time to handle these rdma resources. Sometimes with the current timeout, rxe can not release the rdma resources correctly.
Compared with other rdma drivers, a bigger timeout is used.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/sw/rxe/rxe_pool.c +5 -6
@@ -178,7 +178,6 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable) {struct rxe_pool *pool = elem->pool;struct xarray *xa = &pool->xa; -static int timeout =RXE_POOL_TIMEOUT ;int ret, err =0 ;void *xa_ret;
@@ -202,19 +201,19 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable)* return to rdma-core */ if (sleepable) { -if (!completion_done (&elem->complete) && timeout) { +if (!completion_done (&elem->complete)) { ret =wait_for_completion_timeout (&elem->complete, - timeout); +msecs_to_jiffies (50000 ));/* Shouldn't happen. There are still references to * the object but, rather than deadlock, free the * object or pass back to rdma-core. */ if (WARN_ON (!ret)) - err = -EINVAL ; + err = -ETIMEDOUT ; } }else { -unsigned long until = jiffies + timeout; +unsigned long until = jiffies +RXE_POOL_TIMEOUT ;/* AH objects are unique in that the destroy_ah verb * can be called in atomic context. This delay
@@ -226,7 +225,7 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable)mdelay (1 );if (WARN_ON (!completion_done (&elem->complete))) - err = -EINVAL ; + err = -ETIMEDOUT ; }if (pool->cleanup)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 279/393 iommufd/iova_bitmap: Fix shift-out-of-bounds in iova_bitmap_offset_to_index()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit e24c1551059268b37f6f40639883eafb281b8b9c ]
Resolve a UBSAN shift-out-of-bounds issue in iova_bitmap_offset_to_index() where shifting the constant "1" (of type int) by bitmap->mapped.pgshift (an unsigned long value) could result in undefined behavior.
The constant "1" defaults to a 32-bit "int", and when "pgshift" exceeds 31 (e.g., pgshift = 63) the shift operation overflows, as the result cannot be represented in a 32-bit type.
To resolve this, the constant is updated to "1UL", promoting it to an unsigned long type to match the operand's type.
--- drivers/vfio/iova_bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/iova_bitmap.c +1 -1
@@ -127,7 +127,7 @@ struct iova_bitmap {static unsigned long iova_bitmap_offset_to_index (struct iova_bitmap *bitmap,unsigned long iova) { -unsigned long pgsize =1 << bitmap->mapped.pgshift; +unsigned long pgsize =1UL << bitmap->mapped.pgshift;return iova / (BITS_PER_TYPE (*bitmap->bitmap) * pgsize); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 280/393 spi: omap2-mcspi: Correctly handle devm_clk_get_optional() errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit a07eb4f67ed085f32002a1af2b6073546d67de3f ]
devm_clk_get_optional() returns NULL for missing clocks and a PTR_ERR() if there is a clock but we fail to get it, but currently we only handle the latter case and do so as though the clock was missing. If we get an error back we should handle that as an error since the clock exists but we failed to get it, if we get NULL then the clock doesn't exist and we should handle that.
--- drivers/spi/spi-omap2-mcspi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/spi/spi-omap2-mcspi.c +8 -3
@@ -1521,10 +1521,15 @@ static int omap2_mcspi_probe(struct platform_device *pdev) } mcspi->ref_clk =devm_clk_get_optional_enabled (&pdev->dev,NULL ); -if (IS_ERR (mcspi->ref_clk)) - mcspi->ref_clk_hz =OMAP2_MCSPI_MAX_FREQ ; -else +if (IS_ERR (mcspi->ref_clk)) { + status =PTR_ERR (mcspi->ref_clk); +dev_err_probe (&pdev->dev, status,"Failed to get ref_clk" ); + goto free_ctlr; + } +if (mcspi->ref_clk) mcspi->ref_clk_hz =clk_get_rate (mcspi->ref_clk); +else + mcspi->ref_clk_hz =OMAP2_MCSPI_MAX_FREQ ; ctlr->max_speed_hz = mcspi->ref_clk_hz; ctlr->min_speed_hz = mcspi->ref_clk_hz >>15 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 281/393 media: rc: iguanair: handle timeouts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit b98d5000c50544f14bacb248c34e5219fbe81287 ]
In case of a timeout the IO must be cancelled or the next IO using the URB will fail and/or overwrite an operational URB.
The automatic bisection fails because it arrives
at a commit that correctly lets the test case run
without an error.
--- drivers/media/rc/iguanair.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/rc/iguanair.c +3 -1
@@ -194,8 +194,10 @@ static int iguanair_send(struct iguanair *ir, unsigned size)if (rc)return rc; -if (wait_for_completion_timeout (&ir->completion,TIMEOUT ) ==0 ) +if (wait_for_completion_timeout (&ir->completion,TIMEOUT ) ==0 ) { +usb_kill_urb (ir->urb_out);return -ETIMEDOUT ; + }return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 282/393 media: lmedm04: Handle errors for lme2510_int_read
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit a2836d3fe220220ff8c495ca9722f89cea8a67e7 ]
Add check for the return value of usb_pipe_endpoint() and usb_submit_urb() in order to catch the errors.
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +11 -1
@@ -373,6 +373,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)struct dvb_usb_device *d =adap_to_d (adap);struct lme2510_state *lme_int =adap_to_priv (adap);struct usb_host_endpoint *ep; +int ret; lme_int->lme_urb =usb_alloc_urb (0 ,GFP_KERNEL );
@@ -390,11 +391,20 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ ep =usb_pipe_endpoint (d->udev, lme_int->lme_urb->pipe); +if (!ep) { +usb_free_urb (lme_int->lme_urb); +return -ENODEV ; + }if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ); -usb_submit_urb (lme_int->lme_urb,GFP_KERNEL ); + ret =usb_submit_urb (lme_int->lme_urb,GFP_KERNEL ); +if (ret) { +usb_free_urb (lme_int->lme_urb); +return ret; + } +info ("INT Interrupt Service Started" );return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 283/393 PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit d4929755e4d02bd3de3ae5569dab69cb9502c54f ]
The devm_pci_epc_destroy() comment says destroys the EPC device, but it does not actually do that since devres_destroy() does not call devm_pci_epc_release(), and it also can not fully undo what the API devm_pci_epc_create() does, so it is faulty.
Fortunately, the faulty API has not been used by current kernel tree. Use devres_release() instead of devres_destroy() so the EPC device will be released.
--- drivers/pci/endpoint/pci-epc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/pci-epc-core.c +1 -1
@@ -808,7 +808,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc) {int r; - r =devres_destroy (dev, devm_pci_epc_release, devm_pci_epc_match, + r =devres_release (dev, devm_pci_epc_release, devm_pci_epc_match, epc);dev_WARN_ONCE (dev, r,"couldn't find PCI EPC resource\n" ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 284/393 media: marvell: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 11f68d2ba2e1521a608af773bf788e8cfa260f68 ]
Add check for the return value of clk_enable() to guarantee the success.
--- drivers/media/platform/marvell/mcam-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/platform/marvell/mcam-core.c +6 -1
@@ -935,7 +935,12 @@ static int mclk_enable(struct clk_hw *hw) ret =pm_runtime_resume_and_get (cam->dev);if (ret <0 )return ret; -clk_enable (cam->clk[0 ]); + ret =clk_enable (cam->clk[0 ]); +if (ret) { +pm_runtime_put (cam->dev); +return ret; + } +mcam_reg_write (cam,REG_CLKCTRL , (mclk_src <<29 ) | mclk_div);mcam_ctlr_power_up (cam);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 285/393 media: i2c: imx290: Register 0x3011 varies between imx327 and imx290
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit f2055c1d62d6dfd25a31d1d1923883f21305aea5 ]
Reviewing the datasheets, register 0x3011 is meant to be 0x02 on imx327 and 0x00 on imx290.
Move it out of the common registers, and set it appropriately in the sensor specific sections. (Included for imx290 to be explicit, rather than relying on the default value).
--- drivers/media/i2c/imx290.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/imx290.c +2 -1
@@ -269,7 +269,6 @@ static const struct cci_reg_sequence imx290_global_init_settings[] = { { IMX290_WINWV, 1097 }, { IMX290_XSOUTSEL, IMX290_XSOUTSEL_XVSOUTSEL_VSYNC | IMX290_XSOUTSEL_XHSOUTSEL_HSYNC }, - { CCI_REG8(0x3011), 0x02 }, { CCI_REG8(0x3012), 0x64 }, { CCI_REG8(0x3013), 0x00 }, };
@@ -277,6 +276,7 @@ static const struct cci_reg_sequence imx290_global_init_settings[] = {static const struct cci_reg_sequence imx290_global_init_settings_290[] = { {CCI_REG8 (0x300f ),0x00 }, {CCI_REG8 (0x3010 ),0x21 }, + {CCI_REG8 (0x3011 ),0x00 }, {CCI_REG8 (0x3016 ),0x09 }, {CCI_REG8 (0x3070 ),0x02 }, {CCI_REG8 (0x3071 ),0x11 },
@@ -330,6 +330,7 @@ static const struct cci_reg_sequence xclk_regs[][IMX290_NUM_CLK_REGS] = { };static const struct cci_reg_sequence imx290_global_init_settings_327[] = { + {CCI_REG8 (0x3011 ),0x02 }, {CCI_REG8 (0x309e ),0x4A }, {CCI_REG8 (0x309f ),0x4A }, {CCI_REG8 (0x313b ),0x61 },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/393 media: i2c: imx412: Add missing newline to prints
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit 33f4a7fba7229232e294f4794503283e44cd03f2 ]
Add trailing \n to dev_dbg and dev_err prints where missing.
--- drivers/media/i2c/imx412.c | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/media/i2c/imx412.c +21 -21
@@ -549,7 +549,7 @@ static int imx412_update_exp_gain(struct imx412 *imx412, u32 exposure, u32 gain) lpfr = imx412->vblank + imx412->cur_mode->height; -dev_dbg (imx412->dev,"Set exp %u, analog gain %u, lpfr %u" , +dev_dbg (imx412->dev,"Set exp %u, analog gain %u, lpfr %u\n" , exposure, gain, lpfr); ret =imx412_write_reg (imx412,IMX412_REG_HOLD ,1 ,1 );
@@ -596,7 +596,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_VBLANK : imx412->vblank = imx412->vblank_ctrl->val; -dev_dbg (imx412->dev,"Received vblank %u, new lpfr %u" , +dev_dbg (imx412->dev,"Received vblank %u, new lpfr %u\n" , imx412->vblank, imx412->vblank + imx412->cur_mode->height);
@@ -615,7 +615,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl) exposure = ctrl->val; analog_gain = imx412->again_ctrl->val; -dev_dbg (imx412->dev,"Received exp %u, analog gain %u" , +dev_dbg (imx412->dev,"Received exp %u, analog gain %u\n" , exposure, analog_gain); ret =imx412_update_exp_gain (imx412, exposure, analog_gain);
@@ -624,7 +624,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl)break ;default : -dev_err (imx412->dev,"Invalid control %d" , ctrl->id); +dev_err (imx412->dev,"Invalid control %d\n" , ctrl->id); ret = -EINVAL ; }
@@ -805,14 +805,14 @@ static int imx412_start_streaming(struct imx412 *imx412) ret =imx412_write_regs (imx412, reg_list->regs, reg_list->num_of_regs);if (ret) { -dev_err (imx412->dev,"fail to write initial registers" ); +dev_err (imx412->dev,"fail to write initial registers\n" );return ret; }/* Setup handler will write actual exposure and gain */ ret =__v4l2_ctrl_handler_setup (imx412->sd.ctrl_handler);if (ret) { -dev_err (imx412->dev,"fail to setup handler" ); +dev_err (imx412->dev,"fail to setup handler\n" );return ret; }
@@ -823,7 +823,7 @@ static int imx412_start_streaming(struct imx412 *imx412) ret =imx412_write_reg (imx412,IMX412_REG_MODE_SELECT ,1 ,IMX412_MODE_STREAMING );if (ret) { -dev_err (imx412->dev,"fail to start streaming" ); +dev_err (imx412->dev,"fail to start streaming\n" );return ret; }
@@ -904,7 +904,7 @@ static int imx412_detect(struct imx412 *imx412)return ret;if (val !=IMX412_ID ) { -dev_err (imx412->dev,"chip id mismatch: %x!=%x" , +dev_err (imx412->dev,"chip id mismatch: %x!=%x\n" ,IMX412_ID , val);return -ENXIO ; }
@@ -936,7 +936,7 @@ static int imx412_parse_hw_config(struct imx412 *imx412) imx412->reset_gpio =devm_gpiod_get_optional (imx412->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (imx412->reset_gpio)) { -dev_err (imx412->dev,"failed to get reset gpio %ld" , +dev_err (imx412->dev,"failed to get reset gpio %ld\n" ,PTR_ERR (imx412->reset_gpio));return PTR_ERR (imx412->reset_gpio); }
@@ -944,13 +944,13 @@ static int imx412_parse_hw_config(struct imx412 *imx412)/* Get sensor input clock */ imx412->inclk =devm_clk_get (imx412->dev,NULL );if (IS_ERR (imx412->inclk)) { -dev_err (imx412->dev,"could not get inclk" ); +dev_err (imx412->dev,"could not get inclk\n" );return PTR_ERR (imx412->inclk); } rate =clk_get_rate (imx412->inclk);if (rate !=IMX412_INCLK_RATE ) { -dev_err (imx412->dev,"inclk frequency mismatch" ); +dev_err (imx412->dev,"inclk frequency mismatch\n" );return -EINVAL ; }
@@ -975,14 +975,14 @@ static int imx412_parse_hw_config(struct imx412 *imx412)if (bus_cfg.bus.mipi_csi2.num_data_lanes !=IMX412_NUM_DATA_LANES ) {dev_err (imx412->dev, -"number of CSI2 data lanes %d is not supported" , +"number of CSI2 data lanes %d is not supported\n" , bus_cfg.bus.mipi_csi2.num_data_lanes); ret = -EINVAL ; goto done_endpoint_free; }if (!bus_cfg.nr_of_link_frequencies) { -dev_err (imx412->dev,"no link frequencies defined" ); +dev_err (imx412->dev,"no link frequencies defined\n" ); ret = -EINVAL ; goto done_endpoint_free; }
@@ -1040,7 +1040,7 @@ static int imx412_power_on(struct device *dev) ret =clk_prepare_enable (imx412->inclk);if (ret) { -dev_err (imx412->dev,"fail to enable inclk" ); +dev_err (imx412->dev,"fail to enable inclk\n" ); goto error_reset; }
@@ -1151,7 +1151,7 @@ static int imx412_init_controls(struct imx412 *imx412) imx412->hblank_ctrl->flags |=V4L2_CTRL_FLAG_READ_ONLY ;if (ctrl_hdlr->error) { -dev_err (imx412->dev,"control init failed: %d" , +dev_err (imx412->dev,"control init failed: %d\n" , ctrl_hdlr->error);v4l2_ctrl_handler_free (ctrl_hdlr);return ctrl_hdlr->error;
@@ -1188,7 +1188,7 @@ static int imx412_probe(struct i2c_client *client) ret =imx412_parse_hw_config (imx412);if (ret) { -dev_err (imx412->dev,"HW configuration is not supported" ); +dev_err (imx412->dev,"HW configuration is not supported\n" );return ret; }
@@ -1196,14 +1196,14 @@ static int imx412_probe(struct i2c_client *client) ret =imx412_power_on (imx412->dev);if (ret) { -dev_err (imx412->dev,"failed to power-on the sensor" ); +dev_err (imx412->dev,"failed to power-on the sensor\n" ); goto error_mutex_destroy; }/* Check module identity */ ret =imx412_detect (imx412);if (ret) { -dev_err (imx412->dev,"failed to find sensor: %d" , ret); +dev_err (imx412->dev,"failed to find sensor: %d\n" , ret); goto error_power_off; }
@@ -1213,7 +1213,7 @@ static int imx412_probe(struct i2c_client *client) ret =imx412_init_controls (imx412);if (ret) { -dev_err (imx412->dev,"failed to init controls: %d" , ret); +dev_err (imx412->dev,"failed to init controls: %d\n" , ret); goto error_power_off; }
@@ -1227,14 +1227,14 @@ static int imx412_probe(struct i2c_client *client) imx412->pad.flags =MEDIA_PAD_FL_SOURCE ; ret =media_entity_pads_init (&imx412->sd.entity,1 , &imx412->pad);if (ret) { -dev_err (imx412->dev,"failed to init entity pads: %d" , ret); +dev_err (imx412->dev,"failed to init entity pads: %d\n" , ret); goto error_handler_free; } ret =v4l2_async_register_subdev_sensor (&imx412->sd);if (ret <0 ) {dev_err (imx412->dev, -"failed to register async subdev: %d" , ret); +"failed to register async subdev: %d\n" , ret); goto error_media_entity; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/393 media: i2c: ov9282: Correct the exposure offset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit feaf4154d69657af2bf96e6e66cca794f88b1a61 ]
The datasheet lists that "Maximum exposure time is frame length -25 row periods, where frame length is set by registers {0x380E, 0x380F}".
However this driver had OV9282_EXPOSURE_OFFSET set to 12 which allowed that restriction to be violated, and would result in very under-exposed images.
Correct the offset.
--- drivers/media/i2c/ov9282.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov9282.c +1 -1
@@ -40,7 +40,7 @@/* Exposure control */ #define OV9282_REG_EXPOSURE 0x3500#define OV9282_EXPOSURE_MIN 1 -#define OV9282_EXPOSURE_OFFSET 12 +#define OV9282_EXPOSURE_OFFSET 25#define OV9282_EXPOSURE_STEP 1#define OV9282_EXPOSURE_DEFAULT 0x0282
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/393 media: mipi-csis: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 125ad1aeec77eb55273b420be6894b284a01e4b6 ]
Add check for the return value of clk_enable() to gurantee the success.
--- drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/samsung/exynos4-is/mipi-csis.c +8 -2
@@ -940,13 +940,19 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) state->supplies); goto unlock; } -clk_enable (state->clock[CSIS_CLK_GATE ]); + ret =clk_enable (state->clock[CSIS_CLK_GATE ]); +if (ret) { +phy_power_off (state->phy); +regulator_bulk_disable (CSIS_NUM_SUPPLIES , + state->supplies); + goto unlock; + } }if (state->flags &ST_STREAMING )s5pcsis_start_stream (state); state->flags &= ~ST_SUSPENDED ; - unlock: +unlock:mutex_unlock (&state->lock);return ret ? -EAGAIN :0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/393 media: camif-core: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 77ed2470ac09c2b0a33cf3f98cc51d18ba9ed976 ]
Add check for the return value of clk_enable() to gurantee the success.
--- .../media/platform/samsung/s3c-camif/camif-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/media/platform/samsung/s3c-camif/camif-core.c +11 -2
@@ -527,10 +527,19 @@ static void s3c_camif_remove(struct platform_device *pdev)static int s3c_camif_runtime_resume (struct device *dev) {struct camif_dev *camif =dev_get_drvdata (dev); +int ret; + + ret =clk_enable (camif->clock[CLK_GATE ]); +if (ret) +return ret; -clk_enable (camif->clock[CLK_GATE ]);/* null op on s3c244x */ -clk_enable (camif->clock[CLK_CAM ]); + ret =clk_enable (camif->clock[CLK_CAM ]); +if (ret) { +clk_disable (camif->clock[CLK_GATE ]); +return ret; + } +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/393 media: uvcvideo: Propagate buf->error to userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 87ce177654e388451850905a1d376658aebe8699 ]
Now we return VB2_BUF_STATE_DONE for valid and invalid frames. Propagate the correct value, so the user can know if the frame is valid or not via struct v4l2_buffer->flags.
--- drivers/media/usb/uvc/uvc_queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_queue.c +2 -1
@@ -483,7 +483,8 @@ static void uvc_queue_buffer_complete(struct kref *ref) buf->state = buf->error ?UVC_BUF_STATE_ERROR :UVC_BUF_STATE_DONE ;vb2_set_plane_payload (&buf->buf.vb2_buf,0 , buf->bytesused); -vb2_buffer_done (&buf->buf.vb2_buf,VB2_BUF_STATE_DONE ); +vb2_buffer_done (&buf->buf.vb2_buf, buf->error ?VB2_BUF_STATE_ERROR : +VB2_BUF_STATE_DONE ); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 291/393 mtd: rawnand: brcmnand: fix status read of brcmnand_waitfunc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: david regan <[email protected]>
[ Upstream commit 03271ea36ea7a58d30a4bde182eb2a0d46220467 ]
This change fixes an issue where an error return value may be mistakenly used as NAND status.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -0
@@ -2450,6 +2450,11 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,brcmnand_send_cmd (host,CMD_PROGRAM_PAGE ); status =brcmnand_waitfunc (chip); +if (status <0 ) { + ret = status; + goto out; + } +if (status &NAND_STATUS_FAIL ) {dev_info (ctrl->dev,"program failed at %llx\n" , (unsigned long long )addr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 292/393 mtd: hyperbus: hbmc-am654: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 59bd56760df17506bc2f828f19b40a2243edd0d0 ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak")
--- drivers/mtd/hyperbus/hbmc-am654.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mtd/hyperbus/hbmc-am654.c +2 -4
@@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev)return ret; } -static int am654_hbmc_remove (struct platform_device *pdev) +static void am654_hbmc_remove (struct platform_device *pdev) {struct am654_hbmc_priv *priv =platform_get_drvdata (pdev);struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv;
@@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev)if (dev_priv->rx_chan)dma_release_channel (dev_priv->rx_chan); - -return 0 ; }static const struct of_device_id am654_hbmc_dt_ids[] = {
@@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids);static struct platform_driver am654_hbmc_platform_driver = { .probe = am654_hbmc_probe, - .remove = am654_hbmc_remove, + .remove_new = am654_hbmc_remove, .driver = { .name ="hbmc-am654" , .of_match_table = am654_hbmc_dt_ids,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 293/393 mtd: hyperbus: hbmc-am654: fix an OF node reference leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit bf5821909eb9c7f5d07d5c6e852ead2c373c94a0 ]
In am654_hbmc_platform_driver, .remove() and the error path of .probe() do not decrement the refcount of an OF node obtained by
of_get_next_child(). Fix this by adding of_node_put() calls.
--- drivers/mtd/hyperbus/hbmc-am654.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/mtd/hyperbus/hbmc-am654.c +13 -6
@@ -174,26 +174,30 @@ static int am654_hbmc_probe(struct platform_device *pdev) priv->hbdev.np =of_get_next_child (np,NULL ); ret =of_address_to_resource (priv->hbdev.np,0 , &res);if (ret) -return ret; + goto put_node;if (of_property_read_bool (dev->of_node,"mux-controls" )) {struct mux_control *control =devm_mux_control_get (dev,NULL ); -if (IS_ERR (control)) -return PTR_ERR (control); +if (IS_ERR (control)) { + ret =PTR_ERR (control); + goto put_node; + } ret =mux_control_select (control,1 );if (ret) {dev_err (dev,"Failed to select HBMC mux\n" ); -return ret; + goto put_node; } priv->mux_ctrl = control; } priv->hbdev.map.size =resource_size (&res); priv->hbdev.map.virt =devm_ioremap_resource (dev, &res); -if (IS_ERR (priv->hbdev.map.virt)) -return PTR_ERR (priv->hbdev.map.virt); +if (IS_ERR (priv->hbdev.map.virt)) { + ret =PTR_ERR (priv->hbdev.map.virt); + goto disable_mux; + } priv->ctlr.dev = dev; priv->ctlr.ops = &am654_hbmc_ops;
@@ -226,6 +230,8 @@ static int am654_hbmc_probe(struct platform_device *pdev) disable_mux:if (priv->mux_ctrl)mux_control_deselect (priv->mux_ctrl); +put_node: +of_node_put (priv->hbdev.np);return ret; }
@@ -241,6 +247,7 @@ static void am654_hbmc_remove(struct platform_device *pdev)if (dev_priv->rx_chan)dma_release_channel (dev_priv->rx_chan); +of_node_put (priv->hbdev.np); }static const struct of_device_id am654_hbmc_dt_ids[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 294/393 media: nxp: imx8-isi: fix v4l2-compliance test errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Palcu <[email protected]>
[ Upstream commit 7b12ab055edef2f51733d155617a401a05237bcc ]
Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m device fails on the MMAP streaming tests, with the following messages:
fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY
fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node)
Apparently, the driver does not properly set the field member of vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which is against the guidelines.
--- drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c +3 -0
@@ -861,6 +861,7 @@ int mxc_isi_video_buffer_prepare(struct mxc_isi_dev *isi, struct vb2_buffer *vb2const struct mxc_isi_format_info *info, const struct v4l2_pix_format_mplane *pix) { + struct vb2_v4l2_buffer *v4l2_buf = to_vb2_v4l2_buffer(vb2);unsigned int i;for (i =0 ; i < info->mem_planes; i++) {
@@ -875,6 +876,8 @@ int mxc_isi_video_buffer_prepare(struct mxc_isi_dev *isi, struct vb2_buffer *vb2vb2_set_plane_payload (vb2, i, size); } + v4l2_buf->field = pix->field; +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 295/393 watchdog: rti_wdt: Fix an OF node leak in rti_wdt_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 143981aa63f33d469a55a55fd9fb81cd90109672 ]
rti_wdt_probe() does not release the OF node reference obtained by of_parse_phandle(). Add a of_node_put() call.
This was found by an experimental verification tool that I am developing. Due to the lack of the actual device, no runtime test was able to be performed.
--- drivers/watchdog/rti_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/rti_wdt.c +1 -0
@@ -301,6 +301,7 @@ static int rti_wdt_probe(struct platform_device *pdev) node =of_parse_phandle (pdev->dev.of_node,"memory-region" ,0 );if (node) { ret =of_address_to_resource (node,0 , &res); +of_node_put (node);if (ret) {dev_err (dev,"No memory address assigned to the region.\n" ); goto err_iomap;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 296/393 staging: media: imx: fix OF node leak in imx_media_add_of_subdevs()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 094f5c315f756b19198e6c401aa821ac0e868750 ]
imx_media_add_of_subdevs() calls of_parse_phandle() and passes the obtained node to imx_media_of_add_csi(). The passed node is used in v4l2_async_nf_add_fwnode(), which increments the refcount of the node. Therefore, while the current implementation only releases the node when imx_media_of_add_csi() fails, but should always release it. Call of_node_put() right after imx_media_of_add_csi().
--- drivers/staging/media/imx/imx-media-of.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/media/imx/imx-media-of.c +2 -6
@@ -54,22 +54,18 @@ int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,break ; ret =imx_media_of_add_csi (imxmd, csi_np); +of_node_put (csi_np);if (ret) {/* unavailable or already added is not an error */ if (ret == -ENODEV || ret == -EEXIST ) { -of_node_put (csi_np);continue ; }/* other error, can't continue */ - goto err_out; +return ret; } }return 0 ; - -err_out: -of_node_put (csi_np); -return ret; }EXPORT_SYMBOL_GPL (imx_media_add_of_subdevs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 297/393 media: dvb-usb-v2: af9035: fix ISO C90 compilation error on af9035_i2c_master_xfer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Desnes Nunes <[email protected]>
[ Upstream commit c36b9ad1a8add3c114e25fe167efa217a813b0c7 ]
This fixes a 'ISO C90 forbids mixed declarations and code' compilation error on af9035_i2c_master_xfer, which is caused by the sanity check added on user controlled msg[i], before declaring the demodulator register.
--- drivers/media/usb/dvb-usb-v2/af9035.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +12 -6
@@ -322,13 +322,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ret = -EOPNOTSUPP ; }else if ((msg[0 ].addr == state->af9033_i2c_addr[0 ]) || (msg[0 ].addr == state->af9033_i2c_addr[1 ])) { +/* demod access via firmware interface */ +u32 reg; +if (msg[0 ].len <3 || msg[1 ].len <1 ) { ret = -EOPNOTSUPP ; goto unlock; } -/* demod access via firmware interface */ -u32 reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | - msg[0 ].buf[2 ]; + + reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | + msg[0 ].buf[2 ];if (msg[0 ].addr == state->af9033_i2c_addr[1 ]) reg |=0x100000 ;
@@ -385,13 +388,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ret = -EOPNOTSUPP ; }else if ((msg[0 ].addr == state->af9033_i2c_addr[0 ]) || (msg[0 ].addr == state->af9033_i2c_addr[1 ])) { +/* demod access via firmware interface */ +u32 reg; +if (msg[0 ].len <3 ) { ret = -EOPNOTSUPP ; goto unlock; } -/* demod access via firmware interface */ -u32 reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | - msg[0 ].buf[2 ]; + + reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | + msg[0 ].buf[2 ];if (msg[0 ].addr == state->af9033_i2c_addr[1 ]) reg |=0x100000 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 298/393 PCI: rcar-ep: Fix incorrect variable used when calling devm_request_mem_region()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: King Dix <[email protected]>
[ Upstream commit 2d2da5a4c1b4509f6f7e5a8db015cd420144beb4 ]
The rcar_pcie_parse_outbound_ranges() uses the devm_request_mem_region() macro to request a needed resource. A string variable that lives on the stack is then used to store a dynamically computed resource name, which is then passed on as one of the macro arguments. This can lead to undefined behavior.
Depending on the current contents of the memory, the manifestations of errors may vary. One possible output may be as follows:
$ cat /proc/iomem 30000000-37ffffff : 38000000-3fffffff :
Sometimes, garbage may appear after the colon.
In very rare cases, if no NULL-terminator is found in memory, the system might crash because the string iterator will overrun which can lead to access of unmapped memory above the stack.
Thus, fix this by replacing outbound_name with the name of the previously requested resource. With the changes applied, the output will be as follows:
$ cat /proc/iomem 30000000-37ffffff : memory2 38000000-3fffffff : memory3
--- drivers/pci/controller/pcie-rcar-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-rcar-ep.c +1 -1
@@ -107,7 +107,7 @@ static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep, }if (!devm_request_mem_region (&pdev->dev, res->start,resource_size (res), - outbound_name)) { + res->name)) {dev_err (pcie->dev,"Cannot request memory region %s.\n" , outbound_name);return -EIO ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 299/393 PCI: imx6: Simplify clock handling by using clk_bulk*() function
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 6a40185838759cdae728ed79738680d798863ce7 ]
Refactor the clock handling logic. Add 'clk_names' define in drvdata. Use clk_bulk*() API to simplify the code.
Stable-dep-of: f068ffdd034c ("PCI: imx6: Skip controller_id generation logic for i.MX7D")
--- drivers/pci/controller/dwc/pci-imx6.c | 138 ++++++++++---------------- 1 file changed, 50 insertions(+), 88 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +50 -88
@@ -61,12 +61,16 @@ enum imx6_pcie_variants {#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1)#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX6_PCIE_MAX_CLKS 6 +struct imx6_pcie_drvdata {enum imx6_pcie_variants variant;enum dw_pcie_device_mode mode;u32 flags;int dbi_length;const char *gpr; +const char *const *clk_names; +const u32 clks_cnt; };struct imx6_pcie {
@@ -74,11 +78,7 @@ struct imx6_pcie {int reset_gpio;bool gpio_active_high;bool link_is_up; -struct clk *pcie_bus; -struct clk *pcie_phy; -struct clk *pcie_inbound_axi; -struct clk *pcie; -struct clk *pcie_aux; +struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS ];struct regmap *iomuxc_gpr;u16 msi_ctrl;u32 controller_id;
@@ -407,13 +407,18 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie)static int imx6_setup_phy_mpll (struct imx6_pcie *imx6_pcie) { -unsigned long phy_rate =clk_get_rate (imx6_pcie->pcie_phy); +unsigned long phy_rate =0 ;int mult, div;u16 val; +int i;if (!(imx6_pcie->drvdata->flags &IMX6_PCIE_FLAG_IMX6_PHY ))return 0 ; +for (i =0 ; i < imx6_pcie->drvdata->clks_cnt; i++) +if (strncmp (imx6_pcie->clks[i].id,"pcie_phy" ,8 ) ==0 ) + phy_rate =clk_get_rate (imx6_pcie->clks[i].clk); +switch (phy_rate) {case 125000000 :/*
@@ -550,19 +555,11 @@ static int imx6_pcie_attach_pd(struct device *dev)static int imx6_pcie_enable_ref_clk (struct imx6_pcie *imx6_pcie) { -struct dw_pcie *pci = imx6_pcie->pci; -struct device *dev = pci->dev;unsigned int offset;int ret =0 ;switch (imx6_pcie->drvdata->variant) {case IMX6SX : - ret =clk_prepare_enable (imx6_pcie->pcie_inbound_axi); -if (ret) { -dev_err (dev,"unable to enable pcie_axi clock\n" ); -break ; - } -regmap_update_bits (imx6_pcie->iomuxc_gpr,IOMUXC_GPR12 ,IMX6SX_GPR12_PCIE_TEST_POWERDOWN ,0 );break ;
@@ -589,12 +586,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)case IMX8MQ_EP :case IMX8MP :case IMX8MP_EP : - ret =clk_prepare_enable (imx6_pcie->pcie_aux); -if (ret) { -dev_err (dev,"unable to enable pcie_aux clock\n" ); -break ; - } - offset =imx6_pcie_grp_offset (imx6_pcie);/* * Set the over ride low and enabled
@@ -615,9 +606,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)static void imx6_pcie_disable_ref_clk (struct imx6_pcie *imx6_pcie) {switch (imx6_pcie->drvdata->variant) { -case IMX6SX : -clk_disable_unprepare (imx6_pcie->pcie_inbound_axi); -break ;case IMX6QP :case IMX6Q : regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
@@ -631,14 +619,6 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie)IMX7D_GPR12_PCIE_PHY_REFCLK_SEL , IMX7D_GPR12_PCIE_PHY_REFCLK_SEL);break ; -case IMX8MM : -case IMX8MM_EP : -case IMX8MQ : -case IMX8MQ_EP : -case IMX8MP : -case IMX8MP_EP : -clk_disable_unprepare (imx6_pcie->pcie_aux); -break ;default :break ; }
@@ -650,23 +630,9 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie)struct device *dev = pci->dev;int ret; - ret =clk_prepare_enable (imx6_pcie->pcie_phy); -if (ret) { -dev_err (dev,"unable to enable pcie_phy clock\n" ); + ret =clk_bulk_prepare_enable (imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); +if (ret)return ret; - } - - ret =clk_prepare_enable (imx6_pcie->pcie_bus); -if (ret) { -dev_err (dev,"unable to enable pcie_bus clock\n" ); - goto err_pcie_bus; - } - - ret =clk_prepare_enable (imx6_pcie->pcie); -if (ret) { -dev_err (dev,"unable to enable pcie clock\n" ); - goto err_pcie; - } ret =imx6_pcie_enable_ref_clk (imx6_pcie);if (ret) {
@@ -679,11 +645,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie)return 0 ; err_ref_clk: -clk_disable_unprepare (imx6_pcie->pcie); -err_pcie: -clk_disable_unprepare (imx6_pcie->pcie_bus); -err_pcie_bus: -clk_disable_unprepare (imx6_pcie->pcie_phy); +clk_bulk_disable_unprepare (imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks);return ret; }
@@ -691,9 +653,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie)static void imx6_pcie_clk_disable (struct imx6_pcie *imx6_pcie) {imx6_pcie_disable_ref_clk (imx6_pcie); -clk_disable_unprepare (imx6_pcie->pcie); -clk_disable_unprepare (imx6_pcie->pcie_bus); -clk_disable_unprepare (imx6_pcie->pcie_phy); +clk_bulk_disable_unprepare (imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); }static void imx6_pcie_assert_core_reset (struct imx6_pcie *imx6_pcie)
@@ -1253,6 +1213,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)struct device_node *node = dev->of_node;int ret;u16 val; +int i; imx6_pcie =devm_kzalloc (dev,sizeof (*imx6_pcie),GFP_KERNEL );if (!imx6_pcie)
@@ -1306,32 +1267,20 @@ static int imx6_pcie_probe(struct platform_device *pdev)return imx6_pcie->reset_gpio; } -/* Fetch clocks */ - imx6_pcie->pcie_bus =devm_clk_get (dev,"pcie_bus" ); -if (IS_ERR (imx6_pcie->pcie_bus)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie_bus), -"pcie_bus clock source missing or invalid\n" ); +if (imx6_pcie->drvdata->clks_cnt >=IMX6_PCIE_MAX_CLKS ) +return dev_err_probe (dev, -ENOMEM ,"clks_cnt is too big\n" ); - imx6_pcie->pcie =devm_clk_get (dev,"pcie" ); -if (IS_ERR (imx6_pcie->pcie)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie), -"pcie clock source missing or invalid\n" ); +for (i =0 ; i < imx6_pcie->drvdata->clks_cnt; i++) + imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + +/* Fetch clocks */ + ret =devm_clk_bulk_get (dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); +if (ret) +return ret;switch (imx6_pcie->drvdata->variant) { -case IMX6SX : - imx6_pcie->pcie_inbound_axi =devm_clk_get (dev, -"pcie_inbound_axi" ); -if (IS_ERR (imx6_pcie->pcie_inbound_axi)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie_inbound_axi), -"pcie_inbound_axi clock missing or invalid\n" ); -break ;case IMX8MQ :case IMX8MQ_EP : - imx6_pcie->pcie_aux =devm_clk_get (dev,"pcie_aux" ); -if (IS_ERR (imx6_pcie->pcie_aux)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie_aux), -"pcie_aux clock source missing or invalid\n" ); - fallthrough;case IMX7D :if (dbi_base->start ==IMX8MQ_PCIE2_BASE_ADDR ) imx6_pcie->controller_id =1 ;
@@ -1354,10 +1303,6 @@ static int imx6_pcie_probe(struct platform_device *pdev)case IMX8MM_EP :case IMX8MP :case IMX8MP_EP : - imx6_pcie->pcie_aux =devm_clk_get (dev,"pcie_aux" ); -if (IS_ERR (imx6_pcie->pcie_aux)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie_aux), -"pcie_aux clock source missing or invalid\n" ); imx6_pcie->apps_reset =devm_reset_control_get_exclusive (dev,"apps" );if (IS_ERR (imx6_pcie->apps_reset))
@@ -1373,14 +1318,6 @@ static int imx6_pcie_probe(struct platform_device *pdev)default :break ; } -/* Don't fetch the pcie_phy clock, if it has abstract PHY driver */ -if (imx6_pcie->phy ==NULL ) { - imx6_pcie->pcie_phy =devm_clk_get (dev,"pcie_phy" ); -if (IS_ERR (imx6_pcie->pcie_phy)) -return dev_err_probe (dev,PTR_ERR (imx6_pcie->pcie_phy), -"pcie_phy clock source missing or invalid\n" ); - } -/* Grab turnoff reset */ imx6_pcie->turnoff_reset =devm_reset_control_get_optional_exclusive (dev,"turnoff" );
@@ -1471,6 +1408,11 @@ static void imx6_pcie_shutdown(struct platform_device *pdev)imx6_pcie_assert_core_reset (imx6_pcie); } +static const char *const imx6q_clks[] = {"pcie_bus" ,"pcie" ,"pcie_phy" }; +static const char *const imx8mm_clks[] = {"pcie_bus" ,"pcie" ,"pcie_aux" }; +static const char *const imx8mq_clks[] = {"pcie_bus" ,"pcie" ,"pcie_phy" ,"pcie_aux" }; +static const char *const imx6sx_clks[] = {"pcie_bus" ,"pcie" ,"pcie_phy" ,"pcie_inbound_axi" }; +static const struct imx6_pcie_drvdata drvdata[] = { [IMX6Q ] = { .variant =IMX6Q ,
@@ -1478,6 +1420,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX6SX] = { .variant = IMX6SX,
@@ -1485,6 +1429,8 @@ static const struct imx6_pcie_drvdata drvdata[] = {IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6sx_clks, + .clks_cnt = ARRAY_SIZE(imx6sx_clks), }, [IMX6QP] = { .variant = IMX6QP,
@@ -1493,40 +1439,56 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX7D] = { .variant = IMX7D, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx7d-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX8MQ] = { .variant = IMX8MQ, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM] = { .variant = IMX8MM, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM_EP] = { .variant = IMX8MM_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP_EP] = { .variant = IMX8MP_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 300/393 PCI: imx6: Skip controller_id generation logic for i.MX7D
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhu <[email protected]>
[ Upstream commit f068ffdd034c93f0c768acdc87d4d2d7023c1379 ]
The i.MX7D only has one PCIe controller, so controller_id should always be
0. The previous code is incorrect although yielding the correct result.
Fix by removing "IMX7D" from the switch case branch.
--- drivers/pci/controller/dwc/pci-imx6.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/controller/dwc/pci-imx6.c +0 -1
@@ -1281,7 +1281,6 @@ static int imx6_pcie_probe(struct platform_device *pdev)switch (imx6_pcie->drvdata->variant) {case IMX8MQ :case IMX8MQ_EP : -case IMX7D :if (dbi_base->start ==IMX8MQ_PCIE2_BASE_ADDR ) imx6_pcie->controller_id =1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 301/393 PCI: endpoint: pci-epf-test: Set dma_chan_rx pointer to NULL on error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
[ Upstream commit b1b1f4b12969130c0a6ec0cf0299460cb01e799c ]
If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is freed.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/functions/pci-epf-test.c +1 -1
@@ -251,7 +251,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) fail_back_rx:dma_release_channel (epf_test->dma_chan_rx); - epf_test->dma_chan_tx =NULL ; + epf_test->dma_chan_rx =NULL ; fail_back_tx:dma_cap_zero (mask);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 302/393 PCI: endpoint: pci-epf-test: Fix check for DMA MEMCPY test
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 235c2b197a8de2887f13990094a3343d2392155b ]
Currently, if DMA MEMCPY test is requested by the host, and if the endpoint DMA controller supports DMA_PRIVATE, the test will fail. This is not correct since there is no check for DMA_MEMCPY capability and the DMA controller can support both DMA_PRIVATE and DMA_MEMCPY.
Fix the check and also reword the error message.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/endpoint/functions/pci-epf-test.c +2 -2
@@ -361,8 +361,8 @@ static void pci_epf_test_copy(struct pci_epf_test *epf_test,ktime_get_ts64 (&start);if (reg->flags &FLAG_USE_DMA ) { -if (epf_test->dma_private) { -dev_err (dev,"Cannot transfer data using DMA\n" ); +if (!dma_has_cap (DMA_MEMCPY , epf_test->dma_chan_tx->device->cap_mask)) { +dev_err (dev,"DMA controller doesn't support MEMCPY\n" ); ret = -EINVAL ; goto err_map_addr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 303/393 scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Menzel <[email protected]>
[ Upstream commit ad7c3c0cb8f61d6d5a48b83e62ca4a9fd2f26153 ]
Currently, the code does:
if (x == 0) {
x &= ~0x3;
x |= 0x1;
}Zeroing bits 0 and 1 of a variable that is 0 is not necessary. So directly set the variable to 1.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +1 -2
@@ -5638,8 +5638,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)if (!ioc->is_gen35_ioc && ioc->manu_pg11.EEDPTagMode ==0 ) {pr_err ("%s: overriding NVDATA EEDPTagMode setting\n" , ioc->name); - ioc->manu_pg11.EEDPTagMode &= ~0x3 ; - ioc->manu_pg11.EEDPTagMode |=0x1 ; + ioc->manu_pg11.EEDPTagMode =0x1 ;mpt3sas_config_set_manufacturing_pg11 (ioc, &mpi_reply, &ioc->manu_pg11); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 304/393 scsi: ufs: bsg: Delete bsg_dev when setting up bsg fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit fcf247deb3c3e1c6be5774e3fa03bbd018eff1a9 ]
We should remove the bsg device when bsg_setup_queue() fails to release the resources.
--- drivers/ufs/core/ufs_bsg.c | 1 + 1 file changed, 1 insertion(+)
drivers/ufs/core/ufs_bsg.c +1 -0
@@ -256,6 +256,7 @@ int ufs_bsg_probe(struct ufs_hba *hba) q =bsg_setup_queue (bsg_dev,dev_name (bsg_dev), ufs_bsg_request,NULL ,0 );if (IS_ERR (q)) { ret =PTR_ERR (q); +device_del (bsg_dev); goto out; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 305/393 ocfs2: mark dquot as inactive if failed to start trans while releasing dquot
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
[ Upstream commit 276c61385f6bc3223a5ecd307cf4aba2dfbb9a31 ]
While running fstests generic/329, the kernel workqueue quota_release_workfn is dead looping in calling ocfs2_release_dquot(). The ocfs2 state is already readonly but ocfs2_release_dquot wants to start a transaction but fails and returns.
=====================================================================
[ 2918.123602 ][ T275 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
[ 2918.124034 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:765
ERROR: status = -30
[ 2918.124452 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:795
ERROR: status = -30
[ 2918.124883 ][ T275 ] (kworker/u135:1,275,11):ocfs2_start_trans:357
ERROR: status = -30
[ 2918.125276 ][ T275 ] OCFS2: abort (device dm-0): ocfs2_start_trans:
Detected aborted journal
[ 2918.125710 ][ T275 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted.
=====================================================================
ocfs2_release_dquot() is much like dquot_release(), which is called by ext4 to handle similar situation. So here fix it by marking the dquot as inactive like what dquot_release() does.
--- fs/ocfs2/quota_global.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ocfs2/quota_global.c +5 -0
@@ -749,6 +749,11 @@ static int ocfs2_release_dquot(struct dquot *dquot) handle =ocfs2_start_trans (osb,ocfs2_calc_qdel_credits (dquot->dq_sb, dquot->dq_id.type));if (IS_ERR (handle)) { +/* +* Mark dquot as inactive to avoid endless cycle in +* quota_release_workfn(). +*/ +clear_bit (DQ_ACTIVE_B , &dquot->dq_flags); status =PTR_ERR (handle);mlog_errno (status); goto out_ilock;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 306/393 buffer: make folio_create_empty_buffers() return a buffer_head
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 3decb8564eff88a2533f83b01cec2cf9259c3eaf ]
Patch series "Finish the create_empty_buffers() transition", v2.
Pankaj recently added folio_create_empty_buffers() as the folio equivalent to create_empty_buffers(). This patch set finishes the conversion by first converting all remaining filesystems to call folio_create_empty_buffers(), then renaming it back to create_empty_buffers(). I took the opportunity to make a few simplifications like making folio_create_empty_buffers() return the head buffer and extracting get_nth_bh() from nilfs2.
A few of the patches in this series aren't directly related to create_empty_buffers(), but I saw them while I was working on this and thought they'd be easy enough to add to this series. Compile-tested only, other than ext4.
This patch (of 26):
Almost all callers want to know the first BH that was allocated for this folio. We already have that handy, so return it.
Stable-dep-of: 367a9bffabe0 ("nilfs2: protect access to buffers with no active references")
--- fs/buffer.c | 24 +++++++++++++----------- include/linux/buffer_head.h | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-)
fs/buffer.c +13 -11
@@ -1640,8 +1640,8 @@ EXPORT_SYMBOL(block_invalidate_folio);* block_dirty_folio() via private_lock. try_to_free_buffers * is already excluded via the folio lock. */ -void folio_create_empty_buffers (struct folio *folio,unsigned long blocksize, -unsigned long b_state) +struct buffer_head *folio_create_empty_buffers (struct folio *folio, +unsigned long blocksize,unsigned long b_state) {struct buffer_head *bh, *head, *tail;
@@ -1667,6 +1667,8 @@ void folio_create_empty_buffers(struct folio *folio, unsigned long blocksize, }folio_attach_private (folio, head);spin_unlock (&folio->mapping->private_lock); + +return head; }EXPORT_SYMBOL (folio_create_empty_buffers);
@@ -1768,13 +1770,15 @@ static struct buffer_head *folio_create_buffers(struct folio *folio, struct inode *inode, unsigned int b_state) { +struct buffer_head *bh; +BUG_ON (!folio_test_locked (folio)); -if (!folio_buffers (folio)) -folio_create_empty_buffers (folio, -1 <<READ_ONCE (inode->i_blkbits), - b_state); -return folio_buffers (folio); + bh =folio_buffers (folio); +if (!bh) + bh =folio_create_empty_buffers (folio, +1 <<READ_ONCE (inode->i_blkbits), b_state); +return bh; }/*
@@ -2678,10 +2682,8 @@ int block_truncate_page(struct address_space *mapping,return PTR_ERR (folio); bh =folio_buffers (folio); -if (!bh) { -folio_create_empty_buffers (folio, blocksize,0 ); - bh =folio_buffers (folio); - } +if (!bh) + bh =folio_create_empty_buffers (folio, blocksize,0 );/* Find the buffer that contains "offset" */ offset =offset_in_folio (folio, from);
include/linux/buffer_head.h +2 -2
@@ -203,8 +203,8 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, bool retry);void create_empty_buffers (struct page *,unsigned long ,unsigned long b_state); -void folio_create_empty_buffers (struct folio *folio,unsigned long blocksize, -unsigned long b_state); +struct buffer_head *folio_create_empty_buffers (struct folio *folio, +unsigned long blocksize,unsigned long b_state);void end_buffer_read_sync (struct buffer_head *bh,int uptodate);void end_buffer_write_sync (struct buffer_head *bh,int uptodate);void end_buffer_async_write (struct buffer_head *bh,int uptodate);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 307/393 nilfs2: convert nilfs_lookup_dirty_data_buffers to use folio_create_empty_buffers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 922b12eff0b293fc13ae4045c7d7264e18938878 ]
This function was already using a folio, so this update to the new API removes a single folio->page->folio conversion.
Stable-dep-of: 367a9bffabe0 ("nilfs2: protect access to buffers with no active references")
--- fs/nilfs2/segment.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/nilfs2/segment.c +3 -4
@@ -731,10 +731,9 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,continue ; } head =folio_buffers (folio); -if (!head) { -create_empty_buffers (&folio->page,i_blocksize (inode),0 ); - head =folio_buffers (folio); - } +if (!head) + head =folio_create_empty_buffers (folio, +i_blocksize (inode),0 );folio_unlock (folio); bh = head;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 308/393 nilfs2: protect access to buffers with no active references
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 367a9bffabe08c04f6d725032cce3d891b2b9e1a ]
nilfs_lookup_dirty_data_buffers(), which iterates through the buffers attached to dirty data folios/pages, accesses the attached buffers without locking the folios/pages.
For data cache, nilfs_clear_folio_dirty() may be called asynchronously when the file system degenerates to read only, so nilfs_lookup_dirty_data_buffers() still has the potential to cause use after free issues when buffers lose the protection of their dirty state midway due to this asynchronous clearing and are unintentionally freed by try_to_free_buffers().
Eliminate this race issue by adjusting the lock section in this function.
--- fs/nilfs2/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nilfs2/segment.c +3 -1
@@ -734,7 +734,6 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,if (!head) head =folio_create_empty_buffers (folio,i_blocksize (inode),0 ); -folio_unlock (folio); bh = head; do {
@@ -744,11 +743,14 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,list_add_tail (&bh->b_assoc_buffers, listp); ndirties++;if (unlikely (ndirties >= nlimit)) { +folio_unlock (folio);folio_batch_release (&fbatch);cond_resched ();return ndirties; } }while (bh = bh->b_this_page, bh != head); + +folio_unlock (folio); }folio_batch_release (&fbatch);cond_resched ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 309/393 module: Extend the preempt disabled section in dereference_symbol_descriptor().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit a145c848d69f9c6f32008d8319edaa133360dd74 ]
dereference_symbol_descriptor() needs to obtain the module pointer belonging to pointer in order to resolve that pointer.
The returned mod pointer is obtained under RCU-sched/ preempt_disable() guarantees and needs to be used within this section to ensure that the module is not removed in the meantime.
Extend the preempt_disable() section to also cover dereference_module_function_descriptor().
--- include/linux/kallsyms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kallsyms.h +1 -1
@@ -57,10 +57,10 @@ static inline void *dereference_symbol_descriptor(void *ptr)preempt_disable (); mod =__module_address ((unsigned long )ptr); -preempt_enable ();if (mod) ptr =dereference_module_function_descriptor (mod, ptr); +preempt_enable ();#endif return ptr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 310/393 driver core: class: Fix wild pointer dereferences in API class_dev_iter_next()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit e128f82f7006991c99a58114f70ef61e937b1ac1 ]
There are a potential wild pointer dereferences issue regarding APIs class_dev_iter_(init|next|exit)(), as explained by below typical usage:
// All members of @iter are wild pointers.
struct class_dev_iter iter;
// class_dev_iter_init(@iter, @class, ...) checks parameter @class for // potential class_to_subsys() error, and it returns void type and does // not initialize its output parameter @iter, so caller can not detect // the error and continues to invoke class_dev_iter_next(@iter) even if // @iter still contains wild pointers. class_dev_iter_init(&iter, ...);
// Dereference these wild pointers in @iter here once suffer the error. while (dev = class_dev_iter_next(&iter)) { ... };
// Also dereference these wild pointers here.class_dev_iter_exit(&iter);
Actually, all callers of these APIs have such usage pattern in kernel tree. Fix by:
- Initialize output parameter @iter by memset() in class_dev_iter_init() and give callers prompt by pr_crit() for the error.
- Check if @iter is valid in class_dev_iter_next().
--- drivers/base/class.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/base/class.c +8 -1
@@ -314,8 +314,12 @@ void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,struct subsys_private *sp =class_to_subsys (class);struct klist_node *start_knode =NULL ; -if (!sp) +memset (iter,0 ,sizeof (*iter)); +if (!sp) { +pr_crit ("%s: class %p was not registered yet\n" , + __func__, class);return ; + }if (start) start_knode = &start->p->knode_class;
@@ -342,6 +346,9 @@ struct device *class_dev_iter_next(struct class_dev_iter *iter)struct klist_node *knode;struct device *dev; +if (!iter->sp) +return NULL ; +while (1 ) { knode =klist_next (&iter->ki);if (!knode)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 311/393 serial: 8250: Adjust the timeout for FIFO mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit d91f98be26510f5f81ec66425bb0306d1ccd571a ]
After a console has written a record into UART_TX, it uses wait_for_xmitr() to wait until the data has been sent out before returning. However, wait_for_xmitr() will timeout after 10ms, regardless if the data has been transmitted or not.
For single bytes, this timeout is sufficient even at very slow baud rates, such as 1200bps. However, when FIFO mode is used, there may be 64 bytes pushed into the FIFO at once. At a baud rate of 115200bps, the 10ms timeout is still sufficient. But when using lower baud rates (such as 57600bps), the timeout is _not_ sufficient. This causes longer lines to be cut off, resulting in lost and horribly misformatted output on the console.
When using FIFO mode, take the number of bytes into account to determine an appropriate maximum timeout. Increasing the timeout does not affect performance since ideally the timeout never occurs.
--- drivers/tty/serial/8250/8250_port.c | 32 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_port.c +26 -6
@@ -2074,7 +2074,8 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state)serial8250_rpm_put (up); } -static void wait_for_lsr (struct uart_8250_port *up,int bits) +/* Returns true if @bits were set, false on timeout */ +static bool wait_for_lsr (struct uart_8250_port *up,int bits) {unsigned int status, tmout =10000 ;
@@ -2089,11 +2090,11 @@ static void wait_for_lsr(struct uart_8250_port *up, int bits)udelay (1 );touch_nmi_watchdog (); } + +return (tmout !=0 ); } -/* -* Wait for transmitter & holding register to empty -*/ +/* Wait for transmitter and holding register to empty with timeout */ static void wait_for_xmitr (struct uart_8250_port *up,int bits) {unsigned int tmout;
@@ -3350,6 +3351,16 @@ static void serial8250_console_restore(struct uart_8250_port *up)serial8250_out_MCR (up, up->mcr |UART_MCR_DTR |UART_MCR_RTS ); } +static void fifo_wait_for_lsr (struct uart_8250_port *up,unsigned int count) +{ +unsigned int i; + +for (i =0 ; i < count; i++) { +if (wait_for_lsr (up,UART_LSR_THRE )) +return ; + } +} +/* * Print a string to the serial port using the device FIFO *
@@ -3359,13 +3370,15 @@ static void serial8250_console_restore(struct uart_8250_port *up)static void serial8250_console_fifo_write (struct uart_8250_port *up,const char *s,unsigned int count) { -int i;const char *end = s + count;unsigned int fifosize = up->tx_loadsz; +unsigned int tx_count =0 ;bool cr_sent = false; +unsigned int i;while (s != end) { -wait_for_lsr (up,UART_LSR_THRE ); +/* Allow timeout for each byte of a possibly full FIFO */ +fifo_wait_for_lsr (up, fifosize);for (i =0 ; i < fifosize && s != end; ++i) {if (*s =='\n' && !cr_sent) {
@@ -3376,7 +3389,14 @@ static void serial8250_console_fifo_write(struct uart_8250_port *up, cr_sent = false; } } + tx_count = i; } + +/* +* Allow timeout for each byte written since the caller will only wait +* for UART_LSR_BOTH_EMPTY using the timeout of a single character +*/ +fifo_wait_for_lsr (up, tx_count); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 312/393 NFSv4.2: fix COPY_NOTIFY xdr buf size calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit e8380c2d06055665b3df6c03964911375d7f9290 ]
We need to include sequence size in the compound.
--- fs/nfs/nfs42xdr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/nfs42xdr.c +2 -0
@@ -144,9 +144,11 @@ decode_putfh_maxsz + \ decode_offload_cancel_maxsz)#define NFS4_enc_copy_notify_sz (compound_encode_hdr_maxsz + \ + encode_sequence_maxsz + \ encode_putfh_maxsz + \ encode_copy_notify_maxsz)#define NFS4_dec_copy_notify_sz (compound_decode_hdr_maxsz + \ + decode_sequence_maxsz + \ decode_putfh_maxsz + \ decode_copy_notify_maxsz)#define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 313/393 NFSv4.2: mark OFFLOAD_CANCEL MOVEABLE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 668135b9348c53fd205f5e07d11e82b10f31b55b ]
OFFLOAD_CANCEL should be marked MOVEABLE for when we need to move tasks off a non-functional transport.
--- fs/nfs/nfs42proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs42proc.c +1 -1
@@ -552,7 +552,7 @@ static int nfs42_do_offload_cancel_async(struct file *dst, .rpc_message = &msg, .callback_ops = &nfs42_offload_cancel_ops, .workqueue = nfsiod_workqueue, - .flags = RPC_TASK_ASYNC, + .flags = RPC_TASK_ASYNC | RPC_TASK_MOVEABLE, };int status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 314/393 LoongArch: Fix warnings during S3 suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
[ Upstream commit 26c0a2d93af55d30a46d5f45d3e9c42cde730168 ]
The enable_gpe_wakeup() function calls acpi_enable_all_wakeup_gpes(), and the later one may call the preempt_schedule_common() function, resulting in a thread switch and causing the CPU to be in an interrupt enabled state after the enable_gpe_wakeup() function returns, leading to the warnings as follow.
[ C0] WARNING: ... at kernel/time/timekeeping.c:845 ktime_get+0xbc/0xc8
[ C0] ...
[ C0] Call Trace:
[ C0] [<90000000002243b4>] show_stack+0x64/0x188
[ C0] [<900000000164673c>] dump_stack_lvl+0x60/0x88
[ C0] [<90000000002687e4>] __warn+0x8c/0x148
[ C0] [<90000000015e9978>] report_bug+0x1c0/0x2b0
[ C0] [<90000000016478e4>] do_bp+0x204/0x3b8
[ C0] [<90000000025b1924>] exception_handlers+0x1924/0x10000 [ C0] [<9000000000343bbc>] ktime_get+0xbc/0xc8
[ C0] [<9000000000354c08>] tick_sched_timer+0x30/0xb0
[ C0] [<90000000003408e0>] __hrtimer_run_queues+0x160/0x378 [ C0] [<9000000000341f14>] hrtimer_interrupt+0x144/0x388
[ C0] [<9000000000228348>] constant_timer_interrupt+0x38/0x48 [ C0] [<90000000002feba4>] __handle_irq_event_percpu+0x64/0x1e8 [ C0] [<90000000002fed48>] handle_irq_event_percpu+0x20/0x80 [ C0] [<9000000000306b9c>] handle_percpu_irq+0x5c/0x98
[ C0] [<90000000002fd4a0>] generic_handle_domain_irq+0x30/0x48 [ C0] [<9000000000d0c7b0>] handle_cpu_irq+0x70/0xa8
[ C0] [<9000000001646b30>] handle_loongarch_irq+0x30/0x48
[ C0] [<9000000001646bc8>] do_vint+0x80/0xe0
[ C0] [<90000000002aea1c>] finish_task_switch.isra.0+0x8c/0x2a8 [ C0] [<900000000164e34c>] __schedule+0x314/0xa48
[ C0] [<900000000164ead8>] schedule+0x58/0xf0
[ C0] [<9000000000294a2c>] worker_thread+0x224/0x498
[ C0] [<900000000029d2f0>] kthread+0xf8/0x108
[ C0] [<9000000000221f28>] ret_from_kernel_thread+0xc/0xa4
[ C0]
[ C0] ---[ end trace 0000000000000000 ]---
The root cause is acpi_enable_all_wakeup_gpes() uses a mutex to protect acpi_hw_enable_all_wakeup_gpes(), and acpi_ut_acquire_mutex() may cause a thread switch. Since there is no longer concurrent execution during loongarch_acpi_suspend(), we can call acpi_hw_enable_all_wakeup_gpes() directly in enable_gpe_wakeup().
The solution is similar to commit 22db06337f590d01 ("ACPI: sleep: Avoid breaking S3 wakeup due to might_sleep()").
--- arch/loongarch/power/platform.c | 2 +- drivers/acpi/acpica/achware.h | 2 -- include/acpi/acpixf.h | 1 + 3 files changed, 2 insertions(+), 3 deletions(-)
arch/loongarch/power/platform.c +1 -1
@@ -17,7 +17,7 @@ void enable_gpe_wakeup(void)if (acpi_gbl_reduced_hardware)return ; -acpi_enable_all_wakeup_gpes (); +acpi_hw_enable_all_wakeup_gpes (); }void enable_pci_wakeup (void )
drivers/acpi/acpica/achware.h +0 -2
@@ -103,8 +103,6 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,acpi_status acpi_hw_enable_all_runtime_gpes (void ); -acpi_status acpi_hw_enable_all_wakeup_gpes (void ); -u8 acpi_hw_check_all_gpes (acpi_handle gpe_skip_device,u32 gpe_skip_number); acpi_status
include/acpi/acpixf.h +1 -0
@@ -763,6 +763,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status *event_status)) ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_hw_disable_all_gpes(void)) +ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_hw_enable_all_wakeup_gpes(void)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 315/393 tools/bootconfig: Fix the wrong format specifier
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luo Yifan <[email protected]>
[ Upstream commit f6ab7384d554ba80ff4793259d75535874b366f5 ]
Use '%u' instead of '%d' for unsigned int.
--- tools/bootconfig/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/bootconfig/main.c +2 -2
@@ -226,7 +226,7 @@ static int load_xbc_from_initrd(int fd, char **buf)/* Wrong Checksum */ rcsum =xbc_calc_checksum (*buf, size);if (csum != rcsum) { -pr_err ("checksum error: %d != %d\n" , csum, rcsum); +pr_err ("checksum error: %u != %u\n" , csum, rcsum);return -EINVAL ; }
@@ -395,7 +395,7 @@ static int apply_xbc(const char *path, const char *xbc_path)xbc_get_info (&ret,NULL );printf ("\tNumber of nodes: %d\n" , ret);printf ("\tSize: %u bytes\n" , (unsigned int )size); -printf ("\tChecksum: %d\n" , (unsigned int )csum); +printf ("\tChecksum: %u\n" , (unsigned int )csum);/* TODO: Check the options by schema */ xbc_exit ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 316/393 xfrm: replay: Fix the update of replay_esn->oseq_hi for GSO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianbo Liu <[email protected]>
[ Upstream commit c05c5e5aa163f4682ca97a2f0536575fc7dbdecb ]
When skb needs GSO and wrap around happens, if xo->seq.low (seqno of the first skb segment) is before the last seq number but oseq (seqno of the last segment) is after it, xo->seq.low is still bigger than replay_esn->oseq while oseq is smaller than it, so the update of replay_esn->oseq_hi is missed for this case wrap around because of the change in the cited commit.
For example, if sending a packet with gso_segs=3 while old replay_esn->oseq=0xfffffffe, we calculate:
xo->seq.low = 0xfffffffe + 1 = 0x0xffffffff
oseq = 0xfffffffe + 3 = 0x1(oseq < replay_esn->oseq) is true, but (xo->seq.low < replay_esn->oseq) is false, so replay_esn->oseq_hi is not incremented.
To fix this issue, change the outer checking back for the update of replay_esn->oseq_hi. And add new checking inside for the update of packet's oseq_hi.
--- net/xfrm/xfrm_replay.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/xfrm/xfrm_replay.c +6 -4
@@ -714,10 +714,12 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff oseq +=skb_shinfo (skb)->gso_segs; } -if (unlikely (xo->seq.low < replay_esn->oseq)) { -XFRM_SKB_CB (skb)->seq.output.hi = ++oseq_hi; - xo->seq.hi = oseq_hi; - replay_esn->oseq_hi = oseq_hi; +if (unlikely (oseq < replay_esn->oseq)) { + replay_esn->oseq_hi = ++oseq_hi; +if (xo->seq.low < replay_esn->oseq) { +XFRM_SKB_CB (skb)->seq.output.hi = oseq_hi; + xo->seq.hi = oseq_hi; + }if (replay_esn->oseq_hi ==0 ) { replay_esn->oseq--; replay_esn->oseq_hi--;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 317/393 dmaengine: ti: edma: fix OF node reference leaks in edma_driver
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit e883c64778e5a9905fce955681f8ee38c7197e0f ]
The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but does not release the obtained OF nodes. Thus add a of_node_put() call.
This bug was found by an experimental verification tool that I am developing.
--- drivers/dma/ti/edma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ti/edma.c +1 -2
@@ -208,7 +208,6 @@ struct edma_desc {struct edma_cc ;struct edma_tc { -struct device_node *node;u16 id; };
@@ -2466,13 +2465,13 @@ static int edma_probe(struct platform_device *pdev)if (ret || i == ecc->num_tc)break ; - ecc->tc_list[i].node = tc_args.np; ecc->tc_list[i].id = i; queue_priority_mapping[i][1 ] = tc_args.args[0 ];if (queue_priority_mapping[i][1 ] > lowest_priority) { lowest_priority = queue_priority_mapping[i][1 ]; info->default_queue = i; } +of_node_put (tc_args.np); }/* See if we have optional dma-channel-mask array */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 318/393 xfrm: delete intermediate secpath entry in packet offload mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Cassen <[email protected]>
[ Upstream commit 600258d555f0710b9c47fb78d2d80a4aecd608cc ]
Packets handled by hardware have added secpath as a way to inform XFRM core code that this path was already handled. That secpath is not needed at all after policy is checked and it is removed later in the stack.
However, in the case of IP forwarding is enabled (/proc/sys/net/ipv4/ip_forward), that secpath is not removed and packets which already were handled are reentered to the driver TX path with xfrm_offload set.
The following kernel panic is observed in mlx5 in such case:
mlx5_core 0000:04:00.0 enp4s0f0np0: Link up
mlx5_core 0000:04:00.1 enp4s0f1np1: Link up
Initializing XFRM netlink socket
IPsec XFRM device driver
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor instruction fetch in kernel mode #PF: error_code(0x0010) - not-present page PGD 0 P4D 0 Oops: Oops: 0010 [#1] PREEMPT SMP CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc1-alex #3 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0018:ffffb87380003800 EFLAGS: 00010206 RAX: ffff8df004e02600 RBX: ffffb873800038d8 RCX: 00000000ffff98cf RDX: ffff8df00733e108 RSI: ffff8df00521fb80 RDI: ffff8df001661f00 RBP: ffffb87380003850 R08: ffff8df013980000 R09: 0000000000000010 R10: 0000000000000002 R11: 0000000000000002 R12: ffff8df001661f00 R13: ffff8df00521fb80 R14: ffff8df00733e108 R15: ffff8df011faf04e FS: 0000000000000000(0000) GS:ffff8df46b800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 0000000106384000 CR4: 0000000000350ef0 Call Trace: <IRQ> ? show_regs+0x63/0x70 ? __die_body+0x20/0x60 ? __die+0x2b/0x40 ? page_fault_oops+0x15c/0x550 ? do_user_addr_fault+0x3ed/0x870 ? exc_page_fault+0x7f/0x190 ? asm_exc_page_fault+0x27/0x30 mlx5e_ipsec_handle_tx_skb+0xe7/0x2f0 [mlx5_core] mlx5e_xmit+0x58e/0x1980 [mlx5_core] ? __fib_lookup+0x6a/0xb0 dev_hard_start_xmit+0x82/0x1d0 sch_direct_xmit+0xfe/0x390 __dev_queue_xmit+0x6d8/0xee0 ? __fib_lookup+0x6a/0xb0 ? internal_add_timer+0x48/0x70 ? mod_timer+0xe2/0x2b0 neigh_resolve_output+0x115/0x1b0 __neigh_update+0x26a/0xc50 neigh_update+0x14/0x20 arp_process+0x2cb/0x8e0 ? __napi_build_skb+0x5e/0x70 arp_rcv+0x11e/0x1c0 ? dev_gro_receive+0x574/0x820 __netif_receive_skb_list_core+0x1cf/0x1f0 netif_receive_skb_list_internal+0x183/0x2a0 napi_complete_done+0x76/0x1c0 mlx5e_napi_poll+0x234/0x7a0 [mlx5_core] __napi_poll+0x2d/0x1f0 net_rx_action+0x1a6/0x370 ? atomic_notifier_call_chain+0x3b/0x50 ? irq_int_handler+0x15/0x20 [mlx5_core] handle_softirqs+0xb9/0x2f0 ? handle_irq_event+0x44/0x60 irq_exit_rcu+0xdb/0x100 common_interrupt+0x98/0xc0 </IRQ> <TASK> asm_common_interrupt+0x27/0x40 RIP: 0010:pv_native_safe_halt+0xb/0x10 Code: 09 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 22 0f 1f 84 00 00 00 00 00 90 eb 07 0f 00 2d 7f e9 36 00 fb
40 00 83 ff 07 77 21 89 ff ff 24 fd 88 3d a1 bd 0f 21 f8
RSP: 0018:ffffffffbe603de8 EFLAGS: 00000202
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000f92f46680
RDX: 0000000000000037 RSI: 00000000ffffffff RDI: 00000000000518d4
RBP: ffffffffbe603df0 R08: 000000cd42e4dffb R09: ffffffffbe603d70
R10: 0000004d80d62680 R11: 0000000000000001 R12: ffffffffbe60bf40
R13: 0000000000000000 R14: 0000000000000000 R15: ffffffffbe60aff8
? default_idle+0x9/0x20 arch_cpu_idle+0x9/0x10 default_idle_call+0x29/0xf0 do_idle+0x1f2/0x240 cpu_startup_entry+0x2c/0x30 rest_init+0xe7/0x100 start_kernel+0x76b/0xb90 x86_64_start_reservations+0x18/0x30 x86_64_start_kernel+0xc0/0x110 ? setup_ghcb+0xe/0x130 common_startup_64+0x13e/0x141 </TASK> Modules linked in: esp4_offload esp4 xfrm_interface
xfrm6_tunnel tunnel4 tunnel6 xfrm_user xfrm_algo binfmt_misc intel_rapl_msr intel_rapl_common kvm_amd ccp kvm input_leds serio_raw qemu_fw_cfg sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua efi_pstore ip_tables x_tables autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq raid6_pq async_xor xor async_tx libcrc32c raid1 raid0 mlx5_core crct10dif_pclmul crc32_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel sha256_ssse3 sha1_ssse3 ahci mlxfw i2c_i801 libahci i2c_mux i2c_smbus psample virtio_rng pci_hyperv_intf aesni_intel crypto_simd cryptd
CR2: 0000000000000000
---[ end trace 0000000000000000 ]--- RIP: 0010:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0018:ffffb87380003800 EFLAGS: 00010206 RAX: ffff8df004e02600 RBX: ffffb873800038d8 RCX: 00000000ffff98cf RDX: ffff8df00733e108 RSI: ffff8df00521fb80 RDI: ffff8df001661f00 RBP: ffffb87380003850 R08: ffff8df013980000 R09: 0000000000000010 R10: 0000000000000002 R11: 0000000000000002 R12: ffff8df001661f00 R13: ffff8df00521fb80 R14: ffff8df00733e108 R15: ffff8df011faf04e FS: 0000000000000000(0000) GS:ffff8df46b800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 0000000106384000 CR4: 0000000000350ef0 Kernel panic - not syncing: Fatal exception in interrupt Kernel Offset: 0x3b800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
--- include/net/xfrm.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
include/net/xfrm.h +13 -3
@@ -1181,9 +1181,19 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,if (xo) { x =xfrm_input_state (skb); -if (x->xso.type ==XFRM_DEV_OFFLOAD_PACKET ) -return (xo->flags &CRYPTO_DONE ) && - (xo->status &CRYPTO_SUCCESS ); +if (x->xso.type ==XFRM_DEV_OFFLOAD_PACKET ) { +bool check = (xo->flags &CRYPTO_DONE ) && + (xo->status &CRYPTO_SUCCESS ); + +/* The packets here are plain ones and secpath was +* needed to indicate that hardware already handled +* them and there is no need to do nothing in addition. +* +* Consume secpath which was set by drivers. +*/ +secpath_reset (skb); +return check; + } } return __xfrm_check_nopolicy(net, skb, dir) ||
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 319/393 rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
[ Upstream commit 3ab8c5ed4f84fa20cd16794fe8dc31f633fbc70c ]
The nvmem interface supports variable buffer sizes, while the regmap interface operates with fixed-size storage. If an nvmem client uses a buffer size less than 4 bytes, regmap_read will write out of bounds as it expects the buffer to point at an unsigned int.
Fix this by using an intermediary unsigned int to hold the value.
--- drivers/rtc/rtc-pcf85063.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/rtc/rtc-pcf85063.c +10 -1
@@ -322,7 +322,16 @@ static const struct rtc_class_ops pcf85063_rtc_ops = {static int pcf85063_nvmem_read (void *priv,unsigned int offset,void *val,size_t bytes) { -return regmap_read (priv,PCF85063_REG_RAM , val); +unsigned int tmp; +int ret; + + ret =regmap_read (priv,PCF85063_REG_RAM , &tmp); +if (ret <0 ) +return ret; + + *(u8 *)val = tmp; + +return 0 ; } static int pcf85063_nvmem_write(void *priv, unsigned int offset,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 320/393 rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Wang <[email protected]>
[ Upstream commit 09471d8f5b390883eaf21b917c4bf3ced1b8a1df ]
The TOY_MATCH0_REG should be cleared to 0 in the RTC interrupt handler, otherwise the interrupt cannot be cleared, which will cause the loongson_rtc_isr() to be triggered multiple times.
The previous code cleared TOY_MATCH0_REG in the loongson_rtc_handler(), which is an ACPI interrupt. This did not prevent loongson_rtc_isr() from being triggered multiple times.
This commit moves the clearing of TOY_MATCH0_REG to the loongson_rtc_isr() to ensure that the interrupt is properly cleared.
--- drivers/rtc/rtc-loongson.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/rtc/rtc-loongson.c +8 -5
@@ -114,6 +114,13 @@ static irqreturn_t loongson_rtc_isr(int irq, void *id)struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id;rtc_update_irq (priv->rtcdev,1 ,RTC_AF |RTC_IRQF ); + +/* +* The TOY_MATCH0_REG should be cleared 0 here, +* otherwise the interrupt cannot be cleared. +*/ +regmap_write (priv->regmap,TOY_MATCH0_REG ,0 ); +return IRQ_HANDLED ; }
@@ -131,11 +138,7 @@ static u32 loongson_rtc_handler(void *id)writel (RTC_STS , priv->pm_base +PM1_STS_REG );spin_unlock (&priv->lock); -/* -* The TOY_MATCH0_REG should be cleared 0 here, -* otherwise the interrupt cannot be cleared. -*/ -return regmap_write (priv->regmap,TOY_MATCH0_REG ,0 ); +return ACPI_INTERRUPT_HANDLED ; }static int loongson_rtc_set_enabled (struct device *dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 321/393 ubifs: skip dumping tnc tree when zroot is null
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: pangliyuan <[email protected]>
[ Upstream commit bdb0ca39e0acccf6771db49c3f94ed787d05f2d7 ]
Clearing slab cache will free all znode in memory and make c->zroot.znode = NULL, then dumping tnc tree will access c->zroot.znode which cause null pointer dereference.
--- fs/ubifs/debug.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
fs/ubifs/debug.c +13 -9
@@ -946,16 +946,20 @@ void ubifs_dump_tnc(struct ubifs_info *c)pr_err ("\n" );pr_err ("(pid %d) start dumping TNC tree\n" , current->pid); - znode =ubifs_tnc_levelorder_next (c, c->zroot.znode,NULL ); - level = znode->level; -pr_err ("== Level %d ==\n" , level); -while (znode) { -if (level != znode->level) { - level = znode->level; -pr_err ("== Level %d ==\n" , level); +if (c->zroot.znode) { + znode =ubifs_tnc_levelorder_next (c, c->zroot.znode,NULL ); + level = znode->level; +pr_err ("== Level %d ==\n" , level); +while (znode) { +if (level != znode->level) { + level = znode->level; +pr_err ("== Level %d ==\n" , level); + } +ubifs_dump_znode (c, znode); + znode =ubifs_tnc_levelorder_next (c, c->zroot.znode, znode); } -ubifs_dump_znode (c, znode); - znode =ubifs_tnc_levelorder_next (c, c->zroot.znode, znode); + }else { +pr_err ("empty TNC tree in memory\n" ); }pr_err ("(pid %d) finish dumping TNC tree\n" , current->pid); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 322/393 regulator: core: Add missing newline character
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 155c569fa4c3b340fbf8571a0e42dd415c025377 ]
dev_err_probe() error messages need newline character.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -4876,7 +4876,7 @@ int _regulator_bulk_get(struct device *dev, int num_consumers, consumers[i].supply, get_type);if (IS_ERR (consumers[i].consumer)) { ret =dev_err_probe (dev,PTR_ERR (consumers[i].consumer), -"Failed to get supply '%s'" , +"Failed to get supply '%s'\n" , consumers[i].supply); consumers[i].consumer =NULL ; goto err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 323/393 net: hns3: fix oops when unload drivers paralleling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Shen <[email protected]>
[ Upstream commit 92e5995773774a3e70257e9c95ea03518268bea5 ]
When unload hclge driver, it tries to disable sriov first for each ae_dev node from hnae3_ae_dev_list. If user unloads hns3 driver at the time, because it removes all the ae_dev nodes, and it may cause oops.
But we can't simply use hnae3_common_lock for this. Because in the process flow of pci_disable_sriov(), it will trigger the remove flow of VF, which will also take hnae3_common_lock.
To fixes it, introduce a new mutex to protect the unload process.
--- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 15 +++++++++++++++ drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 ++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 ++ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 ++ .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 ++ 5 files changed, 23 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hnae3.c +15 -0
@@ -40,6 +40,21 @@ EXPORT_SYMBOL(hnae3_unregister_ae_algo_prepare);*/ static DEFINE_MUTEX (hnae3_common_lock); +/* ensure the drivers being unloaded one by one */ +static DEFINE_MUTEX (hnae3_unload_lock); + +void hnae3_acquire_unload_lock (void ) +{ +mutex_lock (&hnae3_unload_lock); +} +EXPORT_SYMBOL (hnae3_acquire_unload_lock); + +void hnae3_release_unload_lock (void ) +{ +mutex_unlock (&hnae3_unload_lock); +} +EXPORT_SYMBOL (hnae3_release_unload_lock); +static bool hnae3_client_match (enum hnae3_client_type client_type) { if (client_type == HNAE3_CLIENT_KNIC ||
drivers/net/ethernet/hisilicon/hns3/hnae3.h +2 -0
@@ -946,4 +946,6 @@ int hnae3_register_client(struct hnae3_client *client);void hnae3_set_client_init_flag (struct hnae3_client *client,struct hnae3_ae_dev *ae_dev,unsigned int inited); +void hnae3_acquire_unload_lock (void ); +void hnae3_release_unload_lock (void );#endif
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 -0
@@ -6008,9 +6008,11 @@ module_init(hns3_init_module);*/ static void __exit hns3_exit_module(void) { +hnae3_acquire_unload_lock ();pci_unregister_driver (&hns3_driver);hnae3_unregister_client (&client);hns3_dbg_unregister_debugfs (); +hnae3_release_unload_lock (); }module_exit (hns3_exit_module);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -0
@@ -12814,9 +12814,11 @@ static int __init hclge_init(void) static void __exit hclge_exit(void) { +hnae3_acquire_unload_lock ();hnae3_unregister_ae_algo_prepare (&ae_algo);hnae3_unregister_ae_algo (&ae_algo);destroy_workqueue (hclge_wq); +hnae3_release_unload_lock (); }module_init (hclge_init);module_exit (hclge_exit);
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2 -0
@@ -3345,8 +3345,10 @@ static int __init hclgevf_init(void) static void __exit hclgevf_exit(void) { +hnae3_acquire_unload_lock ();hnae3_unregister_ae_algo (&ae_algovf);destroy_workqueue (hclgevf_wq); +hnae3_release_unload_lock (); }module_init (hclgevf_init);module_exit (hclgevf_exit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 324/393 gpio: mxc: remove dead code after switch to DT-only
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
[ Upstream commit b049e7abe9001a780d58e78e3833dcceee22f396 ]
struct platform_device::id was only set by board code, but since i.MX became a devicetree-only platform, this will always be -1 (PLATFORM_DEVID_NONE).
Note: of_alias_get_id() returns a negative number on error and base treats all negative errors the same, so we need not add any additional error handling.
--- drivers/gpio/gpio-mxc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-mxc.c +1 -2
@@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev) port->gc.request = mxc_gpio_request; port->gc.free = mxc_gpio_free; port->gc.to_irq = mxc_gpio_to_irq; - port->gc.base = (pdev->id <0 ) ?of_alias_get_id (np,"gpio" ) *32 : - pdev->id *32 ; + port->gc.base =of_alias_get_id (np,"gpio" ) *32 ; err =devm_gpiochip_add_data (&pdev->dev, &port->gc, port);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 325/393 net: fec: implement TSO descriptor cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dheeraj Reddy Jonnalagadda <[email protected]>
[ Upstream commit 61dc1fd9205bc9d9918aa933a847b08e80b4dc20 ]
Implement cleanup of descriptors in the TSO error path of fec_enet_txq_submit_tso(). The cleanup
- Unmaps DMA buffers for data descriptors skipping TSO header
- Clears all buffer descriptors
- Handles extended descriptors by clearing cbd_esc when enabled
--- drivers/net/ethernet/freescale/fec_main.c | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +30 -1
@@ -821,6 +821,8 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,struct fec_enet_private *fep =netdev_priv (ndev);int hdr_len, total_len, data_left;struct bufdesc *bdp = txq->bd.cur; +struct bufdesc *tmp_bdp; +struct bufdesc_ex *ebdp;struct tso_t tso;unsigned int index =0 ;int ret;
@@ -894,7 +896,34 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,return 0 ; err_release: -/* TODO: Release all used data descriptors for TSO */ +/* Release all used data descriptors for TSO */ + tmp_bdp = txq->bd.cur; + +while (tmp_bdp != bdp) { +/* Unmap data buffers */ +if (tmp_bdp->cbd_bufaddr && + !IS_TSO_HEADER (txq,fec32_to_cpu (tmp_bdp->cbd_bufaddr))) +dma_unmap_single (&fep->pdev->dev, +fec32_to_cpu (tmp_bdp->cbd_bufaddr), +fec16_to_cpu (tmp_bdp->cbd_datlen), +DMA_TO_DEVICE ); + +/* Clear standard buffer descriptor fields */ + tmp_bdp->cbd_sc =0 ; + tmp_bdp->cbd_datlen =0 ; + tmp_bdp->cbd_bufaddr =0 ; + +/* Handle extended descriptor if enabled */ +if (fep->bufdesc_ex) { + ebdp = (struct bufdesc_ex *)tmp_bdp; + ebdp->cbd_esc =0 ; + } + + tmp_bdp =fec_enet_get_nextdesc (tmp_bdp, &txq->bd); + } + +dev_kfree_skb_any (skb); +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 326/393 ipmr: do not call mr_mfc_uses_dev() for unres entries
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 15a901361ec3fb1c393f91880e1cbf24ec0a88bd ]
syzbot found that calling mr_mfc_uses_dev() for unres entries would crash [1], because c->mfc_un.res.minvif / c->mfc_un.res.maxvif alias to "struct sk_buff_head unresolved", which contain two pointers.
This code never worked, lets remove it.
[1]
Unable to handle kernel paging request at virtual address ffff5fff2d536613 KASAN: maybe wild-memory-access in range [0xfffefff96a9b3098-0xfffefff96a9b309f] Modules linked in: CPU: 1 UID: 0 PID: 7321 Comm: syz.0.16 Not tainted 6.13.0-rc7-syzkaller-g1950a0af2d55 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] pc : mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 lr : mr_mfc_uses_dev net/ipv4/ipmr_base.c:289 [inline] lr : mr_table_dump+0x694/0x8b0 net/ipv4/ipmr_base.c:334 Call trace: mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] (P) mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 (P) mr_rtm_dumproute+0x254/0x454 net/ipv4/ipmr_base.c:382 ipmr_rtm_dumproute+0x248/0x4b4 net/ipv4/ipmr.c:2648 rtnl_dump_all+0x2e4/0x4e8 net/core/rtnetlink.c:4327 rtnl_dumpit+0x98/0x1d0 net/core/rtnetlink.c:6791 netlink_dump+0x4f0/0xbc0 net/netlink/af_netlink.c:2317 netlink_recvmsg+0x56c/0xe64 net/netlink/af_netlink.c:1973 sock_recvmsg_nosec net/socket.c:1033 [inline] sock_recvmsg net/socket.c:1055 [inline] sock_read_iter+0x2d8/0x40c net/socket.c:1125 new_sync_read fs/read_write.c:484 [inline] vfs_read+0x740/0x970 fs/read_write.c:565 ksys_read+0x15c/0x26c fs/read_write.c:708
--- net/ipv4/ipmr_base.c | 3 --- 1 file changed, 3 deletions(-)
net/ipv4/ipmr_base.c +0 -3
@@ -330,9 +330,6 @@ int mr_table_dump(struct mr_table *mrt, struct sk_buff *skb,list_for_each_entry (mfc, &mrt->mfc_unres_queue, list) {if (e < s_e) goto next_entry2; -if (filter->dev && - !mr_mfc_uses_dev (mrt, mfc, filter->dev)) - goto next_entry2; err =fill (mrt, skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, mfc,RTM_NEWROUTE , flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 327/393 PM: hibernate: Add error handling for syscore_suspend()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit e20a70c572539a486dbd91b225fa6a194a5e2122 ]
In hibernation_platform_enter(), the code did not check the return value of syscore_suspend(), potentially leading to a situation where syscore_resume() would be called even if syscore_suspend() failed. This could cause unpredictable behavior or system instability.
Modify the code sequence in question to properly handle errors returned by syscore_suspend(). If an error occurs in the suspend path, the code now jumps to label 'Enable_irqs' skipping the syscore_resume() call and only enabling interrupts after setting the system state to SYSTEM_RUNNING.
--- kernel/power/hibernate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/power/hibernate.c +6 -1
@@ -599,7 +599,11 @@ int hibernation_platform_enter(void)local_irq_disable (); system_state =SYSTEM_SUSPEND ; -syscore_suspend (); + + error =syscore_suspend (); +if (error) + goto Enable_irqs; +if (pm_wakeup_pending ()) { error = -EAGAIN ; goto Power_up;
@@ -611,6 +615,7 @@ int hibernation_platform_enter(void) Power_up:syscore_resume (); + Enable_irqs: system_state =SYSTEM_RUNNING ;local_irq_enable ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 328/393 iavf: allow changing VLAN state without calling PF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Swiatkowski <[email protected]>
[ Upstream commit ee7d79433d783346430ee32f28c9df44a88b3bb6 ]
First case:
Quoted 3 lines
ip l a l $VF name vlanx type vlan id 100
ip l d vlanx
ip l a l $VF name vlanx type vlan id 100
As workqueue can be execute after sometime, there is a window to have call trace like that:
- iavf_del_vlan
- iavf_add_vlan
- iavf_del_vlans (wq)
It means that our VLAN 100 will change the state from IAVF_VLAN_ACTIVE to IAVF_VLAN_REMOVE (iavf_del_vlan). After that in iavf_add_vlan state won't be changed because VLAN 100 is on the filter list. The final result is that the VLAN 100 filter isn't added in hardware (no iavf_add_vlans call).
To fix that change the state if the filter wasn't removed yet directly to active. It is save as IAVF_VLAN_REMOVE means that virtchnl message wasn't sent yet.
Second case:
Quoted 1 line
ip l a l $VF name vlanx type vlan id 100
Any type of VF reset ex. change trust
Quoted 3 lines
ip l s $PF vf $VF_NUM trust on
ip l d vlanx
ip l a l $VF name vlanx type vlan id 100
In case of reset iavf driver is responsible for readding all filters that are being used. To do that all VLAN filters state are changed to IAVF_VLAN_ADD. Here is even longer window for changing VLAN state from kernel side, as workqueue isn't called immediately. We can have call trace like that:
- changing to IAVF_VLAN_ADD (after reset)
- iavf_del_vlan (called from kernel ops)
- iavf_del_vlans (wq)
Not exsisitng VLAN filters will be removed from hardware. It isn't a bug, ice driver will handle it fine. However, we can have call trace like that:
- changing to IAVF_VLAN_ADD (after reset)
- iavf_del_vlan (called from kernel ops)
- iavf_add_vlan (called from kernel ops)
- iavf_del_vlans (wq)
With fix for previous case we end up with no VLAN filters in hardware. We have to remove VLAN filters if the state is IAVF_VLAN_ADD and delete VLAN was called. It is save as IAVF_VLAN_ADD means that virtchnl message wasn't sent yet.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +17 -2
@@ -801,6 +801,11 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, f->state =IAVF_VLAN_ADD ; adapter->num_vlan_filters++;iavf_schedule_aq_request (adapter,IAVF_FLAG_AQ_ADD_VLAN_FILTER ); + }else if (f->state ==IAVF_VLAN_REMOVE ) { +/* IAVF_VLAN_REMOVE means that VLAN wasn't yet removed. +* We can safely only change the state here. +*/ + f->state =IAVF_VLAN_ACTIVE ; } clearout:
@@ -821,8 +826,18 @@ static void iavf_del_vlan(struct iavf_adapter *adapter, struct iavf_vlan vlan) f =iavf_find_vlan (adapter, vlan);if (f) { - f->state =IAVF_VLAN_REMOVE ; -iavf_schedule_aq_request (adapter,IAVF_FLAG_AQ_DEL_VLAN_FILTER ); +/* IAVF_ADD_VLAN means that VLAN wasn't even added yet. +* Remove it from the list. +*/ +if (f->state ==IAVF_VLAN_ADD ) { +list_del (&f->list); +kfree (f); + adapter->num_vlan_filters--; + }else { + f->state =IAVF_VLAN_REMOVE ; +iavf_schedule_aq_request (adapter, +IAVF_FLAG_AQ_DEL_VLAN_FILTER ); + } }spin_unlock_bh (&adapter->mac_vlan_list_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 329/393 net: rose: fix timer races against user threads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5de7665e0a0746b5ad7943554b34db8f8614a196 ]
Rose timers only acquire the socket spinlock, without checking if the socket is owned by one user thread.
Add a check and rearm the timers if needed.
BUG: KASAN: slab-use-after-free in rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 Read of size 2 at addr ffff88802f09b82a by task swapper/0/0 CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc5-syzkaller-00172-gd1bf27c4e176 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 call_timer_fn+0x187/0x650 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2430 run_timer_base kernel/time/timer.c:2439 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2449 handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:561 __do_softirq kernel/softirq.c:595 [inline] invoke_softirq kernel/softirq.c:435 [inline] __irq_exit_rcu+0xf7/0x220 kernel/softirq.c:662 irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1049 </IRQ>
--- net/rose/rose_timer.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
net/rose/rose_timer.c +15 -0
@@ -122,6 +122,10 @@ static void rose_heartbeat_expiry(struct timer_list *t)struct rose_sock *rose =rose_sk (sk);bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &sk->sk_timer, jiffies +HZ /20 ); + goto out; + }switch (rose->state) {case ROSE_STATE_0 :/* Magic here: If we listen() and a new link dies before it
@@ -152,6 +156,7 @@ static void rose_heartbeat_expiry(struct timer_list *t) }rose_start_heartbeat (sk); +out:bh_unlock_sock (sk);sock_put (sk); }
@@ -162,6 +167,10 @@ static void rose_timer_expiry(struct timer_list *t)struct sock *sk = &rose->sock;bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &rose->timer, jiffies +HZ /20 ); + goto out; + }switch (rose->state) {case ROSE_STATE_1 :/* T1 */ case ROSE_STATE_4 :/* T2 */
@@ -182,6 +191,7 @@ static void rose_timer_expiry(struct timer_list *t) }break ; } +out:bh_unlock_sock (sk);sock_put (sk); }
@@ -192,6 +202,10 @@ static void rose_idletimer_expiry(struct timer_list *t)struct sock *sk = &rose->sock;bh_lock_sock (sk); +if (sock_owned_by_user (sk)) { +sk_reset_timer (sk, &rose->idletimer, jiffies +HZ /20 ); + goto out; + }rose_clear_queues (sk);rose_write_internal (sk,ROSE_CLEAR_REQUEST );
@@ -207,6 +221,7 @@ static void rose_idletimer_expiry(struct timer_list *t) sk->sk_state_change (sk);sock_set_flag (sk,SOCK_DEAD ); } +out:bh_unlock_sock (sk);sock_put (sk); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 330/393 net: netdevsim: try to close UDP port harness races
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 50bf398e1ceacb9a7f85bd3bdca065ebe5cb6159 ]
syzbot discovered that we remove the debugfs files after we free the netdev. Try to clean up the relevant dir while the device is still around.
--- drivers/net/netdevsim/netdevsim.h | 1 + drivers/net/netdevsim/udp_tunnels.c | 23 +++++++++++-------- .../drivers/net/netdevsim/udp_tunnel_nic.sh | 16 ++++++------- 3 files changed, 23 insertions(+), 17 deletions(-)
drivers/net/netdevsim/netdevsim.h +1 -0
@@ -121,6 +121,7 @@ struct netdevsim {u32 sleep;u32 __ports[2 ][NSIM_UDP_TUNNEL_N_PORTS ];u32 (*ports)[NSIM_UDP_TUNNEL_N_PORTS ]; +struct dentry *ddir;struct debugfs_u32_array dfs_ports[2 ]; } udp_ports;
drivers/net/netdevsim/udp_tunnels.c +14 -9
@@ -112,9 +112,11 @@ nsim_udp_tunnels_info_reset_write(struct file *file, const char __user *data,struct net_device *dev = file->private_data;struct netdevsim *ns =netdev_priv (dev); -memset (ns->udp_ports.ports,0 ,sizeof (ns->udp_ports.__ports));rtnl_lock (); -udp_tunnel_nic_reset_ntf (dev); +if (dev->reg_state ==NETREG_REGISTERED ) { +memset (ns->udp_ports.ports,0 ,sizeof (ns->udp_ports.__ports)); +udp_tunnel_nic_reset_ntf (dev); + }rtnl_unlock ();return count;
@@ -144,23 +146,23 @@ int nsim_udp_tunnels_info_create(struct nsim_dev *nsim_dev,else ns->udp_ports.ports = nsim_dev->udp_ports.__ports; -debugfs_create_u32 ("udp_ports_inject_error" ,0600 , - ns->nsim_dev_port->ddir, + ns->udp_ports.ddir =debugfs_create_dir ("udp_ports" , + ns->nsim_dev_port->ddir); + +debugfs_create_u32 ("inject_error" ,0600 , ns->udp_ports.ddir, &ns->udp_ports.inject_error); ns->udp_ports.dfs_ports[0 ].array = ns->udp_ports.ports[0 ]; ns->udp_ports.dfs_ports[0 ].n_elements =NSIM_UDP_TUNNEL_N_PORTS ; -debugfs_create_u32_array ("udp_ports_table0" ,0400 , - ns->nsim_dev_port->ddir, +debugfs_create_u32_array ("table0" ,0400 , ns->udp_ports.ddir, &ns->udp_ports.dfs_ports[0 ]); ns->udp_ports.dfs_ports[1 ].array = ns->udp_ports.ports[1 ]; ns->udp_ports.dfs_ports[1 ].n_elements =NSIM_UDP_TUNNEL_N_PORTS ; -debugfs_create_u32_array ("udp_ports_table1" ,0400 , - ns->nsim_dev_port->ddir, +debugfs_create_u32_array ("table1" ,0400 , ns->udp_ports.ddir, &ns->udp_ports.dfs_ports[1 ]); -debugfs_create_file ("udp_ports_reset" ,0200 , ns->nsim_dev_port->ddir, +debugfs_create_file ("reset" ,0200 , ns->udp_ports.ddir, dev, &nsim_udp_tunnels_info_reset_fops);/* Note: it's not normal to allocate the info struct like this!
@@ -196,6 +198,9 @@ int nsim_udp_tunnels_info_create(struct nsim_dev *nsim_dev,void nsim_udp_tunnels_info_destroy (struct net_device *dev) { +struct netdevsim *ns =netdev_priv (dev); + +debugfs_remove_recursive (ns->udp_ports.ddir);kfree (dev->udp_tunnel_nic_info); dev->udp_tunnel_nic_info =NULL ; }
tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh +8 -8
@@ -142,7 +142,7 @@ function pre_ethtool { } function check_table { - local path=$NSIM_DEV_DFS/ports/$port/udp_ports_table$1 + local path=$NSIM_DEV_DFS/ports/$port/udp_ports/table$1 local -n expected=$2 local last=$3
@@ -212,7 +212,7 @@ function check_tables { } function print_table { - local path=$NSIM_DEV_DFS/ports/$port/udp_ports_table$1 + local path=$NSIM_DEV_DFS/ports/$port/udp_ports/table$1 read -a have < $path tree $NSIM_DEV_DFS/
@@ -640,7 +640,7 @@ for port in 0 1; do NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up - echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error + echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports/inject_error msg="1 - create VxLANs v6" exp0=( 0 0 0 0 )
@@ -662,7 +662,7 @@ for port in 0 1; do new_geneve gnv0 20000 msg="2 - destroy GENEVE" - echo 2 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error + echo 2 > $NSIM_DEV_DFS/ports/$port/udp_ports/inject_error exp1=( `mke 20000 2` 0 0 0 ) del_dev gnv0
@@ -763,7 +763,7 @@ for port in 0 1; do msg="create VxLANs v4" new_vxlan vxlan0 10000 $NSIM_NETDEV - echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset + echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset check_tables msg="NIC device goes down"
@@ -774,7 +774,7 @@ for port in 0 1; do fi check_tables - echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset + echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset check_tables msg="NIC device goes up again"
@@ -788,7 +788,7 @@ for port in 0 1; do del_dev vxlan0 check_tables - echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset + echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset check_tables msg="destroy NIC"
@@ -895,7 +895,7 @@ msg="vacate VxLAN in overflow table" exp0=( `mke 10000 1` `mke 10004 1` 0 `mke 10003 1` ) del_dev vxlan2 -echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset +echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset check_tables msg="tunnels destroyed 2"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 331/393 vxlan: Fix uninit-value in vxlan_vnifilter_dump()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
[ Upstream commit 5066293b9b7046a906eff60e3949a887ae185a43 ]
KMSAN reported an uninit-value access in vxlan_vnifilter_dump() [1].
If the length of the netlink message payload is less than sizeof(struct tunnel_msg), vxlan_vnifilter_dump() accesses bytes beyond the message. This can lead to uninit-value access. Fix this by returning an error in such situations.
[1]
BUG: KMSAN: uninit-value in vxlan_vnifilter_dump+0x328/0x920 drivers/net/vxlan/vxlan_vnifilter.c:422 vxlan_vnifilter_dump+0x328/0x920 drivers/net/vxlan/vxlan_vnifilter.c:422 rtnl_dumpit+0xd5/0x2f0 net/core/rtnetlink.c:6786 netlink_dump+0x93e/0x15f0 net/netlink/af_netlink.c:2317 __netlink_dump_start+0x716/0xd60 net/netlink/af_netlink.c:2432 netlink_dump_start include/linux/netlink.h:340 [inline] rtnetlink_dump_start net/core/rtnetlink.c:6815 [inline] rtnetlink_rcv_msg+0x1256/0x14a0 net/core/rtnetlink.c:6882 netlink_rcv_skb+0x467/0x660 net/netlink/af_netlink.c:2542 rtnetlink_rcv+0x35/0x40 net/core/rtnetlink.c:6944 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0xed6/0x1290 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x1092/0x1230 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x330/0x3d0 net/socket.c:726 ____sys_sendmsg+0x7f4/0xb50 net/socket.c:2583 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2637 __sys_sendmsg net/socket.c:2669 [inline] __do_sys_sendmsg net/socket.c:2674 [inline] __se_sys_sendmsg net/socket.c:2672 [inline] __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2672 x64_sys_call+0x3878/0x3d90 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd9/0x1d0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4110 [inline] slab_alloc_node mm/slub.c:4153 [inline] kmem_cache_alloc_node_noprof+0x800/0xe80 mm/slub.c:4205 kmalloc_reserve+0x13b/0x4b0 net/core/skbuff.c:587 __alloc_skb+0x347/0x7d0 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1323 [inline] netlink_alloc_large_skb+0xa5/0x280 net/netlink/af_netlink.c:1196 netlink_sendmsg+0xac9/0x1230 net/netlink/af_netlink.c:1866 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x330/0x3d0 net/socket.c:726 ____sys_sendmsg+0x7f4/0xb50 net/socket.c:2583 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2637 __sys_sendmsg net/socket.c:2669 [inline] __do_sys_sendmsg net/socket.c:2674 [inline] __se_sys_sendmsg net/socket.c:2672 [inline] __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2672 x64_sys_call+0x3878/0x3d90 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd9/0x1d0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 0 UID: 0 PID: 30991 Comm: syz.4.10630 Not tainted 6.12.0-10694-gc44daa7e3c73 #29 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
--- drivers/net/vxlan/vxlan_vnifilter.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/vxlan/vxlan_vnifilter.c +5 -0
@@ -411,6 +411,11 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cbstruct tunnel_msg *tmsg;struct net_device *dev; +if (cb->nlh->nlmsg_len <nlmsg_msg_size (sizeof (struct tunnel_msg ))) { +NL_SET_ERR_MSG (cb->extack,"Invalid msg length" ); +return -EINVAL ; + } + tmsg =nlmsg_data (cb->nlh);if (tmsg->flags & ~TUNNEL_MSG_VALID_USER_FLAGS ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 332/393 net: davicom: fix UAF in dm9000_drv_remove
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 19e65c45a1507a1a2926649d2db3583ed9d55fd9 ]
dm is netdev private data and it cannot be
used after free_netdev() call. Using dm after free_netdev() can cause UAF bug. Fix it by moving free_netdev() at the end of the function.
This is similar to the issue fixed in commit ad297cd2db89 ("net: qcom/emac: fix UAF in emac_remove").
This bug is detected by our static analysis tool.
--- drivers/net/ethernet/davicom/dm9000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/davicom/dm9000.c +2 -1
@@ -1778,10 +1778,11 @@ dm9000_drv_remove(struct platform_device *pdev)unregister_netdev (ndev);dm9000_release_board (pdev, dm); -free_netdev (ndev);/* free device structure */ if (dm->power_supply)regulator_disable (dm->power_supply); +free_netdev (ndev);/* free device structure */ +dev_dbg (&pdev->dev,"released and freed device\n" );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 333/393 ptp: Properly handle compat ioctls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 19ae40f572a9ce1ade9954990af709a03fd37010 ]
Pointer arguments passed to ioctls need to pass through compat_ptr() to work correctly on s390; as explained in Documentation/driver-api/ioctl.rst. Detect compat mode at runtime and call compat_ptr() for those commands which do take pointer arguments.
--- drivers/ptp/ptp_chardev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ptp/ptp_chardev.c +4 -0
@@ -4,6 +4,7 @@* * Copyright (C) 2010 OMICRON electronics GmbH */ +#include <linux/compat.h> #include <linux/module.h> #include <linux/posix-clock.h> #include <linux/poll.h>
@@ -124,6 +125,9 @@ long ptp_ioctl(struct posix_clock *pc, ustruct timespec64 ts;int enable, err =0 ; +if (in_compat_syscall () && cmd !=PTP_ENABLE_PPS && cmd !=PTP_ENABLE_PPS2 ) + arg = (unsigned long )compat_ptr (arg); +switch (cmd) {case PTP_CLOCK_GETCAPS :
Greg Kroah-Hartman
maintainerPATCH 334/393 net: stmmac: Limit the number of MTL queues to hardware capability
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunihiko Hayashi <[email protected]>
[ Upstream commit f5fb35a3d6b36d378b2e2ecbfb9caa337d5428e6 ]
The number of MTL queues to use is specified by the parameter "snps,{tx,rx}-queues-to-use" from stmmac_platform layer.
However, the maximum numbers of queues are constrained by upper limits determined by the capability of each hardware feature. It's appropriate to limit the values not to exceed the upper limit values and display a warning message.
This only works if the hardware capability has the upper limit values.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +15 -0
@@ -7103,6 +7103,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv)if (priv->dma_cap.tsoen)dev_info (priv->device,"TSO supported\n" ); +if (priv->dma_cap.number_rx_queues && + priv->plat->rx_queues_to_use > priv->dma_cap.number_rx_queues) { +dev_warn (priv->device, +"Number of Rx queues (%u) exceeds dma capability\n" , + priv->plat->rx_queues_to_use); + priv->plat->rx_queues_to_use = priv->dma_cap.number_rx_queues; + } +if (priv->dma_cap.number_tx_queues && + priv->plat->tx_queues_to_use > priv->dma_cap.number_tx_queues) { +dev_warn (priv->device, +"Number of Tx queues (%u) exceeds dma capability\n" , + priv->plat->tx_queues_to_use); + priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues; + } + priv->hw->vlan_fail_q_en = (priv->plat->flags &STMMAC_FLAG_VLAN_FAIL_Q_EN ); priv->hw->vlan_fail_q = priv->plat->vlan_fail_q;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 335/393 net: stmmac: Limit FIFO size by hardware capability
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunihiko Hayashi <[email protected]>
[ Upstream commit 044f2fbaa2725696ecbf1f02ba7ab0a8ccb7e1ae ]
Tx/Rx FIFO size is specified by the parameter "{tx,rx}-fifo-depth" from stmmac_platform layer.
However, these values are constrained by upper limits determined by the capabilities of each hardware feature. There is a risk that the upper bits will be truncated due to the calculation, so it's appropriate to limit them to the upper limit values and display a warning message.
This only works if the hardware capability has the upper limit values.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +15 -0
@@ -7118,6 +7118,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv) priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues; } +if (priv->dma_cap.rx_fifo_size && + priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) { +dev_warn (priv->device, +"Rx FIFO size (%u) exceeds dma capability\n" , + priv->plat->rx_fifo_size); + priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size; + } +if (priv->dma_cap.tx_fifo_size && + priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) { +dev_warn (priv->device, +"Tx FIFO size (%u) exceeds dma capability\n" , + priv->plat->tx_fifo_size); + priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size; + } + priv->hw->vlan_fail_q_en = (priv->plat->flags &STMMAC_FLAG_VLAN_FAIL_Q_EN ); priv->hw->vlan_fail_q = priv->plat->vlan_fail_q;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 336/393 perf trace: Fix runtime error of index out of bounds
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Howard Chu <[email protected]>
[ Upstream commit c7b87ce0dd10b64b68a0b22cb83bbd556e28fe81 ]
libtraceevent parses and returns an array of argument fields, sometimes larger than RAW_SYSCALL_ARGS_NUM (6) because it includes "__syscall_nr", idx will traverse to index 6 (7th element) whereas sc->fmt->arg holds 6 elements max, creating an out-of-bounds access. This runtime error is found by UBsan. The error message:
$ sudo UBSAN_OPTIONS=print_stacktrace=1 ./perf trace -a --max-events=1
builtin-trace.c:1966:35: runtime error: index 6 out of bounds for type 'syscall_arg_fmt [6]'
#0 0x5c04956be5fe in syscall__alloc_arg_fmts /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:1966
#1 0x5c04956c0510 in trace__read_syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2110
#2 0x5c04956c372b in trace__syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2436
#3 0x5c04956d2f39 in trace__init_syscalls_bpf_prog_array_maps /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:3897
#4 0x5c04956d6d25 in trace__run /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:4335
#5 0x5c04956e112e in cmd_trace /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:5502
#6 0x5c04956eda7d in run_builtin /home/howard/hw/linux-perf/tools/perf/perf.c:351
#7 0x5c04956ee0a8 in handle_internal_command /home/howard/hw/linux-perf/tools/perf/perf.c:404
#8 0x5c04956ee37f in run_argv /home/howard/hw/linux-perf/tools/perf/perf.c:448
#9 0x5c04956ee8e9 in main /home/howard/hw/linux-perf/tools/perf/perf.c:556
#10 0x79eb3622a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x79eb3622a47a in __libc_start_main_impl ../csu/libc-start.c:360
#12 0x5c04955422d4 in _start (/home/howard/hw/linux-perf/tools/perf/perf+0x4e02d4) (BuildId: 5b6cab2d59e96a4341741765ad6914a4d784dbc6)0.000 ( 0.014 ms): Chrome_ChildIO/117244 write(fd: 238, buf: !, count: 1) = 1
--- tools/perf/builtin-trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +5 -1
@@ -1850,8 +1850,12 @@ static int trace__read_syscall_info(struct trace *trace, int id)return PTR_ERR (sc->tp_format); } +/* +* The tracepoint format contains __syscall_nr field, so it's one more +* than the actual number of syscall arguments. +*/ if (syscall__alloc_arg_fmts (sc,IS_ERR (sc->tp_format) ? -RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields)) +RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields -1 ))return -ENOMEM ; sc->args = sc->tp_format->format.fields;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 337/393 PM: sleep: Restore asynchronous device resume optimization
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 3e999770ac1c7c31a70685dd5b88e89473509e9c ]
Before commit 7839d0078e0d ("PM: sleep: Fix possible deadlocks in core system-wide PM code"), the resume of devices that were allowed to resume asynchronously was scheduled before starting the resume of the other devices, so the former did not have to wait for the latter unless functional dependencies were present.
Commit 7839d0078e0d removed that optimization in order to address a correctness issue, but it can be restored with the help of a new device power management flag, so do that now.
Stable-dep-of: 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of parents and children")
--- drivers/base/power/main.c | 117 +++++++++++++++++++++----------------- include/linux/pm.h | 1 + 2 files changed, 65 insertions(+), 53 deletions(-)
drivers/base/power/main.c +64 -53
@@ -579,7 +579,7 @@ bool dev_pm_skip_resume(struct device *dev) }/** -* __device_resume_noirq - Execute a "noirq resume" callback for given device. +* device_resume_noirq - Execute a "noirq resume" callback for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously.
@@ -587,7 +587,7 @@ bool dev_pm_skip_resume(struct device *dev)* The driver of @dev will not receive interrupts while this function is being * executed. */ -static void __device_resume_noirq (struct device *dev,pm_message_t state,bool async) +static void device_resume_noirq (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -674,16 +674,22 @@ static bool dpm_async_fn(struct device *dev, async_func_t func) {reinit_completion (&dev->power.completion); -if (!is_async (dev)) -return false; - -get_device (dev); +if (is_async (dev)) { + dev->power.async_in_progress = true; -if (async_schedule_dev_nocall (func, dev)) -return true; +get_device (dev); -put_device (dev); +if (async_schedule_dev_nocall (func, dev)) +return true; +put_device (dev); + } +/* +* Because async_schedule_dev_nocall() above has returned false or it +* has not been called at all, func() is not running and it is safe to +* update the async_in_progress flag without extra synchronization. +*/ + dev->power.async_in_progress = false;return false; }
@@ -691,18 +697,10 @@ static void async_resume_noirq(void *data, async_cookie_t cookie) {struct device *dev = data; -__device_resume_noirq (dev, pm_transition, true); +device_resume_noirq (dev, pm_transition, true);put_device (dev); } -static void device_resume_noirq (struct device *dev) -{ -if (dpm_async_fn (dev, async_resume_noirq)) -return ; - -__device_resume_noirq (dev, pm_transition, false); -} -static void dpm_noirq_resume_devices (pm_message_t state) {struct device *dev;
@@ -712,18 +710,28 @@ static void dpm_noirq_resume_devices(pm_message_t state)mutex_lock (&dpm_list_mtx); pm_transition = state; +/* +* Trigger the resume of "async" devices upfront so they don't have to +* wait for the "non-async" ones they don't depend on. +*/ +list_for_each_entry (dev, &dpm_noirq_list, power.entry) +dpm_async_fn (dev, async_resume_noirq); +while (!list_empty (&dpm_noirq_list)) { dev =to_device (dpm_noirq_list.next); -get_device (dev);list_move_tail (&dev->power.entry, &dpm_late_early_list); -mutex_unlock (&dpm_list_mtx); +if (!dev->power.async_in_progress) { +get_device (dev); -device_resume_noirq (dev); +mutex_unlock (&dpm_list_mtx); -put_device (dev); +device_resume_noirq (dev, state, false); -mutex_lock (&dpm_list_mtx); +put_device (dev); + +mutex_lock (&dpm_list_mtx); + } }mutex_unlock (&dpm_list_mtx);async_synchronize_full ();
@@ -747,14 +755,14 @@ void dpm_resume_noirq(pm_message_t state) }/** -* __device_resume_early - Execute an "early resume" callback for given device. +* device_resume_early - Execute an "early resume" callback for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously. * * Runtime PM is disabled for @dev while this function is being executed. */ -static void __device_resume_early (struct device *dev,pm_message_t state,bool async) +static void device_resume_early (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -820,18 +828,10 @@ static void async_resume_early(void *data, async_cookie_t cookie) {struct device *dev = data; -__device_resume_early (dev, pm_transition, true); +device_resume_early (dev, pm_transition, true);put_device (dev); } -static void device_resume_early (struct device *dev) -{ -if (dpm_async_fn (dev, async_resume_early)) -return ; - -__device_resume_early (dev, pm_transition, false); -} -/** * dpm_resume_early - Execute "early resume" callbacks for all devices. * @state: PM transition of the system being carried out.
@@ -845,18 +845,28 @@ void dpm_resume_early(pm_message_t state)mutex_lock (&dpm_list_mtx); pm_transition = state; +/* +* Trigger the resume of "async" devices upfront so they don't have to +* wait for the "non-async" ones they don't depend on. +*/ +list_for_each_entry (dev, &dpm_late_early_list, power.entry) +dpm_async_fn (dev, async_resume_early); +while (!list_empty (&dpm_late_early_list)) { dev =to_device (dpm_late_early_list.next); -get_device (dev);list_move_tail (&dev->power.entry, &dpm_suspended_list); -mutex_unlock (&dpm_list_mtx); +if (!dev->power.async_in_progress) { +get_device (dev); -device_resume_early (dev); +mutex_unlock (&dpm_list_mtx); -put_device (dev); +device_resume_early (dev, state, false); -mutex_lock (&dpm_list_mtx); +put_device (dev); + +mutex_lock (&dpm_list_mtx); + } }mutex_unlock (&dpm_list_mtx);async_synchronize_full ();
@@ -876,12 +886,12 @@ void dpm_resume_start(pm_message_t state)EXPORT_SYMBOL_GPL (dpm_resume_start);/** -* __device_resume - Execute "resume" callbacks for given device. +* device_resume - Execute "resume" callbacks for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously. */ -static void __device_resume (struct device *dev,pm_message_t state,bool async) +static void device_resume (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -975,18 +985,10 @@ static void async_resume(void *data, async_cookie_t cookie) {struct device *dev = data; -__device_resume (dev, pm_transition, true); +device_resume (dev, pm_transition, true);put_device (dev); } -static void device_resume (struct device *dev) -{ -if (dpm_async_fn (dev, async_resume)) -return ; - -__device_resume (dev, pm_transition, false); -} -/** * dpm_resume - Execute "resume" callbacks for non-sysdev devices. * @state: PM transition of the system being carried out.
@@ -1006,16 +1008,25 @@ void dpm_resume(pm_message_t state) pm_transition = state; async_error =0 ; +/* +* Trigger the resume of "async" devices upfront so they don't have to +* wait for the "non-async" ones they don't depend on. +*/ +list_for_each_entry (dev, &dpm_suspended_list, power.entry) +dpm_async_fn (dev, async_resume); +while (!list_empty (&dpm_suspended_list)) { dev =to_device (dpm_suspended_list.next);get_device (dev); -mutex_unlock (&dpm_list_mtx); +if (!dev->power.async_in_progress) { +mutex_unlock (&dpm_list_mtx); -device_resume (dev); +device_resume (dev, state, false); -mutex_lock (&dpm_list_mtx); +mutex_lock (&dpm_list_mtx); + }if (!list_empty (&dev->power.entry))list_move_tail (&dev->power.entry, &dpm_prepared_list);
include/linux/pm.h +1 -0
@@ -681,6 +681,7 @@ struct dev_pm_info { bool wakeup_path:1; bool syscore:1; bool no_pm_callbacks:1; /* Owned by the PM core */ + bool async_in_progress:1; /* Owned by the PM core */ unsigned int must_resume:1; /* Owned by the PM core */ unsigned int may_skip_resume:1; /* Set by subsystems */#else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 338/393 PM: sleep: Use bool for all 1-bit fields in struct dev_pm_info
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit b017500ab53c06441ff7d3a681484e37039b4f57 ]
For some 1-bit fields in struct dev_pm_info the data type is bool, while for some other 1-bit fields in there it is unsigned int, and these differences are somewhat arbitrary.
For consistency, change the data type of the latter to bool, so that all of the 1-bit fields in struct dev_pm_info fields are bool.
No intentional functional impact.
Stable-dep-of: 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of parents and children")
--- include/linux/pm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
include/linux/pm.h +15 -15
@@ -662,8 +662,8 @@ struct pm_subsys_data {struct dev_pm_info {pm_message_t power_state; -unsigned int can_wakeup:1 ; -unsigned int async_suspend:1 ; +bool can_wakeup:1 ; +bool async_suspend:1 ;bool in_dpm_list:1 ;/* Owned by the PM core */ bool is_prepared:1 ;/* Owned by the PM core */ bool is_suspended:1 ;/* Ditto */
@@ -682,10 +682,10 @@ struct dev_pm_info { bool syscore:1; bool no_pm_callbacks:1; /* Owned by the PM core */ bool async_in_progress:1; /* Owned by the PM core */ - unsigned int must_resume:1; /* Owned by the PM core */ - unsigned int may_skip_resume:1; /* Set by subsystems */ + bool must_resume:1; /* Owned by the PM core */ + bool may_skip_resume:1; /* Set by subsystems */#else - unsigned int should_wakeup:1; + bool should_wakeup:1;#endif #ifdef CONFIG_PM struct hrtimer suspend_timer;
@@ -696,17 +696,17 @@ struct dev_pm_info {atomic_t usage_count;atomic_t child_count; unsigned int disable_depth:3; - unsigned int idle_notification:1; - unsigned int request_pending:1; - unsigned int deferred_resume:1; - unsigned int needs_force_resume:1; - unsigned int runtime_auto:1; + bool idle_notification:1; + bool request_pending:1; + bool deferred_resume:1; + bool needs_force_resume:1; + bool runtime_auto:1; bool ignore_children:1; - unsigned int no_callbacks:1; - unsigned int irq_safe:1; - unsigned int use_autosuspend:1; - unsigned int timer_autosuspends:1; - unsigned int memalloc_noio:1; + bool no_callbacks:1; + bool irq_safe:1; + bool use_autosuspend:1; + bool timer_autosuspends:1; + bool memalloc_noio:1;unsigned int links_count;enum rpm_request request;enum rpm_status runtime_status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 339/393 PM: sleep: core: Synchronize runtime PM status of parents and children
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 3775fc538f535a7c5adaf11990c7932a0bd1f9eb ]
Commit 6e176bf8d461 ("PM: sleep: core: Do not skip callbacks in the resume phase") overlooked the case in which the parent of a device with DPM_FLAG_SMART_SUSPEND set did not use that flag and could be runtime- suspended before a transition into a system-wide sleep state. In that case, if the child is resumed during the subsequent transition from that state into the working state, its runtime PM status will be set to RPM_ACTIVE, but the runtime PM status of the parent will not be updated accordingly, even though the parent will be resumed too, because of the dev_pm_skip_suspend() check in device_resume_noirq().
Address this problem by tracking the need to set the runtime PM status to RPM_ACTIVE during system-wide resume transitions for devices with DPM_FLAG_SMART_SUSPEND set and all of the devices depended on by them.
--- drivers/base/power/main.c | 29 ++++++++++++++++++++--------- include/linux/pm.h | 1 + 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/base/power/main.c +20 -9
@@ -614,13 +614,15 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy* so change its status accordingly. * * Otherwise, the device is going to be resumed, so set its PM-runtime -* status to "active", but do that only if DPM_FLAG_SMART_SUSPEND is set -* to avoid confusing drivers that don't use it. +* status to "active" unless its power.set_active flag is clear, in +* which case it is not necessary to update its PM-runtime status. */ -if (skip_resume) +if (skip_resume) {pm_runtime_set_suspended (dev); -else if (dev_pm_skip_suspend (dev)) + }else if (dev->power.set_active) {pm_runtime_set_active (dev); + dev->power.set_active = false; + }if (dev->pm_domain) { info ="noirq power domain " ;
@@ -1170,18 +1172,24 @@ static pm_message_t resume_event(pm_message_t sleep_state)return PMSG_ON ; } -static void dpm_superior_set_must_resume (struct device *dev) +static void dpm_superior_set_must_resume (struct device *dev,bool set_active) {struct device_link *link;int idx; -if (dev->parent) +if (dev->parent) { dev->parent->power.must_resume = true; +if (set_active) + dev->parent->power.set_active = true; + } idx =device_links_read_lock (); -list_for_each_entry_rcu_locked (link, &dev->links.suppliers, c_node) +list_for_each_entry_rcu_locked (link, &dev->links.suppliers, c_node) { link->supplier->power.must_resume = true; +if (set_active) + link->supplier->power.set_active = true; + }device_links_read_unlock (idx); }
@@ -1257,8 +1265,11 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a dev->power.may_skip_resume)) dev->power.must_resume = true; -if (dev->power.must_resume) -dpm_superior_set_must_resume (dev); +if (dev->power.must_resume) { + dev->power.set_active = dev->power.set_active || +dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ); +dpm_superior_set_must_resume (dev, dev->power.set_active); + } Complete:complete_all (&dev->power.completion);
include/linux/pm.h +1 -0
@@ -683,6 +683,7 @@ struct dev_pm_info { bool no_pm_callbacks:1; /* Owned by the PM core */ bool async_in_progress:1; /* Owned by the PM core */ bool must_resume:1; /* Owned by the PM core */ + bool set_active:1; /* Owned by the PM core */ bool may_skip_resume:1; /* Set by subsystems */#else bool should_wakeup:1;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 340/393 Bluetooth: btnxpuart: Fix glitches seen in dual A2DP streaming
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neeraj Sanjay Kale <[email protected]>
[ Upstream commit 7de119bb79a63f6a1959b83117a98734914fb0b0 ]
This fixes a regression caused by previous commit for fixing truncated ACL data, which is causing some intermittent glitches when running two A2DP streams.
serdev_device_write_buf() is the root cause of the glitch, which is reverted, and the TX work will continue to write until the queue is empty.
This change fixes both issues. No A2DP streaming glitches or truncated ACL data issue observed.
--- drivers/bluetooth/btnxpuart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bluetooth/btnxpuart.c +1 -2
@@ -1280,13 +1280,12 @@ static void btnxpuart_tx_work(struct work_struct *work)while ((skb =nxp_dequeue (nxpdev))) { len =serdev_device_write_buf (serdev, skb->data, skb->len); -serdev_device_wait_until_sent (serdev,0 ); hdev->stat.byte_tx += len;skb_pull (skb, len);if (skb->len >0 ) {skb_queue_head (&nxpdev->txq, skb); -break ; +continue ; }switch (hci_skb_pkt_type (skb)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 341/393 vsock: Keep the binding until socket destruction
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit fcdd2242c0231032fc84e1404315c245ae56322a ]
Preserve sockets bindings; this includes both resulting from an explicit bind() and those implicitly bound through autobind during connect().
Prevents socket unbinding during a transport reassignment, which fixes a use-after-free:
1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (refcnt=2)
2. transport->release() calls vsock_remove_bound() without checking if sk was bound and moved to bound list (refcnt=1)
3. vsock_bind() assumes sk is in unbound list and before __vsock_insert_bound(vsock_bound_sockets()) calls __vsock_remove_bound() which does:
list_del_init(&vsk->bound_table); // nop
sock_put(&vsk->sk); // refcnt=0
BUG: KASAN: slab-use-after-free in __vsock_bind+0x62e/0x730 Read of size 4 at addr ffff88816b46a74c by task a.out/2057 dump_stack_lvl+0x68/0x90 print_report+0x174/0x4f6 kasan_report+0xb9/0x190 __vsock_bind+0x62e/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 __kasan_slab_alloc+0x85/0x90 kmem_cache_alloc_noprof+0x131/0x450 sk_prot_alloc+0x5b/0x220 sk_alloc+0x2c/0x870 __vsock_create.constprop.0+0x2e/0xb60 vsock_create+0xe4/0x420 __sock_create+0x241/0x650 __sys_socket+0xf2/0x1a0 __x64_sys_socket+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kmem_cache_free+0x1a1/0x590 __sk_destruct+0x388/0x5a0 __vsock_bind+0x5e1/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:25 refcount_warn_saturate+0xce/0x150 RIP: 0010:refcount_warn_saturate+0xce/0x150 __vsock_bind+0x66d/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: underflow; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:28 refcount_warn_saturate+0xee/0x150 RIP: 0010:refcount_warn_saturate+0xee/0x150 vsock_remove_bound+0x187/0x1e0 __vsock_release+0x383/0x4a0 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x359/0xa80 task_work_run+0x107/0x1d0 do_exit+0x847/0x2560 do_group_exit+0xb8/0x250 __x64_sys_exit_group+0x3a/0x50 x64_sys_call+0xfec/0x14f0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/vmw_vsock/af_vsock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +6 -2
@@ -336,7 +336,10 @@ EXPORT_SYMBOL_GPL(vsock_find_connected_socket);void vsock_remove_sock (struct vsock_sock *vsk) { -vsock_remove_bound (vsk); +/* Transport reassignment must not remove the binding. */ +if (sock_flag (sk_vsock (vsk),SOCK_DEAD )) +vsock_remove_bound (vsk); +vsock_remove_connected (vsk); }EXPORT_SYMBOL_GPL (vsock_remove_sock);
@@ -820,12 +823,13 @@ static void __vsock_release(struct sock *sk, int level)*/ lock_sock_nested (sk, level); +sock_orphan (sk); +if (vsk->transport) vsk->transport->release (vsk);else if (sock_type_connectible (sk->sk_type))vsock_remove_sock (vsk); -sock_orphan (sk); sk->sk_shutdown =SHUTDOWN_MASK ;skb_queue_purge (&sk->sk_receive_queue);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 342/393 vsock: Allow retrying on connect() failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit aa388c72113b7458127b709bdd7d3628af26e9b4 ]
sk_err is set when a (connectible) connect() fails. Effectively, this makes an otherwise still healthy SS_UNCONNECTED socket impossible to use for any subsequent connection attempts.
Clear sk_err upon trying to establish a connection.
--- net/vmw_vsock/af_vsock.c | 5 +++++ 1 file changed, 5 insertions(+)
net/vmw_vsock/af_vsock.c +5 -0
@@ -1457,6 +1457,11 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr,if (err <0 ) goto out; +/* sk_err might have been set as a result of an earlier +* (failed) connect attempt. +*/ + sk->sk_err =0 ; +/* Mark sock as connecting and set the error code to in * progress in case this is a non-blocking connect. */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 343/393 bgmac: reduce max frame size to support just MTU 1500
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 752e5fcc2e77358936d36ef8e522d6439372e201 ]
bgmac allocates new replacement buffer before handling each received frame. Allocating & DMA-preparing 9724 B each time consumes a lot of CPU time. Ideally bgmac should just respect currently set MTU but it isn't the case right now. For now just revert back to the old limited frame size.
This change bumps NAT masquerade speed by ~95%.
Since commit 8218f62c9c9b ("mm: page_frag: use initial zero offset for page_frag_alloc_align()"), the bgmac driver fails to open its network interface successfully and runs out of memory in the following call stack:
bgmac_open
-> bgmac_dma_init
-> bgmac_dma_rx_skb_for_slot
-> netdev_alloc_fragBGMAC_RX_ALLOC_SIZE = 10048 and PAGE_FRAG_CACHE_MAX_SIZE = 32768.
Eventually we land into __page_frag_alloc_align() with the following parameters across multiple successive calls:
__page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=0 __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=10048 __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=20096 __page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=30144
So in that case we do indeed have offset + fragsz (40192) > size (32768) and so we would eventually return NULL. Reverting to the older 1500 bytes MTU allows the network driver to be usable again.
--- drivers/net/ethernet/broadcom/bgmac.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bgmac.h +1 -2
@@ -328,8 +328,7 @@#define BGMAC_RX_FRAME_OFFSET 30/* There are 2 unused bytes between header and real data */ #define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ BGMAC_RX_FRAME_OFFSET) -/* Jumbo frame size with FCS */ -#define BGMAC_RX_MAX_FRAME_SIZE 9724 +#define BGMAC_RX_MAX_FRAME_SIZE 1536#define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE)#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 344/393 tcp: correct handling of extreme memory squeeze
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Maloy <[email protected]>
[ Upstream commit 8c670bdfa58e48abad1d5b6ca1ee843ca91f7303 ]
Testing with iperf3 using the "pasta" protocol splicer has revealed a problem in the way tcp handles window advertising in extreme memory squeeze situations.
Under memory pressure, a socket endpoint may temporarily advertise a zero-sized window, but this is not stored as part of the socket data. The reasoning behind this is that it is considered a temporary setting which shouldn't influence any further calculations.
However, if we happen to stall at an unfortunate value of the current window size, the algorithm selecting a new value will consistently fail to advertise a non-zero window once we have freed up enough memory. This means that this side's notion of the current window size is different from the one last advertised to the peer, causing the latter to not send any data to resolve the sitution.
The problem occurs on the iperf3 server side, and the socket in question is a completely regular socket with the default settings for the fedora40 kernel. We do not use SO_PEEK or SO_RCVBUF on the socket.
The following excerpt of a logging session, with own comments added, shows more in detail what is happening:
// tcp_v4_rcv(->)
// tcp_rcv_established(->)
[5201<->39222]: ==== Activating log @ net/ipv4/tcp_input.c/tcp_data_queue()/5257 ====
[5201<->39222]: tcp_data_queue(->)
[5201<->39222]: DROPPING skb [265600160..265665640], reason: SKB_DROP_REASON_PROTO_MEM
[rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184]
[copied_seq 259909392->260034360 (124968), unread 5565800, qlen 85, ofoq 0]
[OFO queue: gap: 65480, len: 0]
[5201<->39222]: tcp_data_queue(<-)
[5201<->39222]: __tcp_transmit_skb(->)
[tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160]
[5201<->39222]: tcp_select_window(->)
[5201<->39222]: (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_NOMEM) ? --> TRUE
[tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160]
returning 0[5201<->39222]: tcp_select_window(<-)
[5201<->39222]: ADVERTISING WIN 0, ACK_SEQ: 265600160
[5201<->39222]: [__tcp_transmit_skb(<-)
[5201<->39222]: tcp_rcv_established(<-)
[5201<->39222]: tcp_v4_rcv(<-)
// Receive queue is at 85 buffers and we are out of memory. // We drop the incoming buffer, although it is in sequence, and decide // to send an advertisement with a window of zero.
// We don't update tp->rcv_wnd and tp->rcv_wup accordingly, which means // we unconditionally shrink the window.
[5201<->39222]: tcp_recvmsg_locked(->)
[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160
[5201<->39222]: [new_win = 0, win_now = 131184, 2 * win_now = 262368]
[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0]
[5201<->39222]: NOT calling tcp_send_ack()
[tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160]
[5201<->39222]: __tcp_cleanup_rbuf(<-)
[rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184]
[copied_seq 260040464->260040464 (0), unread 5559696, qlen 85, ofoq 0]
returning 6104 bytes[5201<->39222]: tcp_recvmsg_locked(<-)
// After each read, the algorithm for calculating the new receive // window in __tcp_cleanup_rbuf() finds it is too small to advertise // or to update tp->rcv_wnd.
// Meanwhile, the peer thinks the window is zero, and will not send // any more data to trigger an update from the interrupt mode side.
[5201<->39222]: tcp_recvmsg_locked(->)
[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160
[5201<->39222]: [new_win = 262144, win_now = 131184, 2 * win_now = 262368]
[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0]
[5201<->39222]: NOT calling tcp_send_ack()
[tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160]
[5201<->39222]: __tcp_cleanup_rbuf(<-)
[rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184]
[copied_seq 260099840->260171536 (71696), unread 5428624, qlen 83, ofoq 0]
returning 131072 bytes[5201<->39222]: tcp_recvmsg_locked(<-)
// The above pattern repeats again and again, since nothing changes // between the reads.
[...]
[5201<->39222]: tcp_recvmsg_locked(->)
[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160
[5201<->39222]: [new_win = 262144, win_now = 131184, 2 * win_now = 262368]
[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0]
[5201<->39222]: NOT calling tcp_send_ack()
[tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160]
[5201<->39222]: __tcp_cleanup_rbuf(<-)
[rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184]
[copied_seq 265600160->265600160 (0), unread 0, qlen 0, ofoq 0]
returning 54672 bytes[5201<->39222]: tcp_recvmsg_locked(<-)
// The receive queue is empty, but no new advertisement has been sent. // The peer still thinks the receive window is zero, and sends nothing. // We have ended up in a deadlock situation.
Note that well behaved endpoints will send win0 probes, so the problem will not occur.
Furthermore, we have observed that in these situations this side may send out an updated 'th->ack_seq´ which is not stored in tp->rcv_wup as it should be. Backing ack_seq seems to be harmless, but is of course still wrong from a protocol viewpoint.
We fix this by updating the socket state correctly when a packet has been dropped because of memory exhaustion and we have to advertize a zero window.
Further testing shows that the connection recovers neatly from the squeeze situation, and traffic can continue indefinitely.
--- net/ipv4/tcp_output.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv4/tcp_output.c +6 -3
@@ -263,11 +263,14 @@ static u16 tcp_select_window(struct sock *sk)u32 cur_win, new_win;/* Make the window 0 if we failed to queue the data because we -* are out of memory. The window is temporary, so we don't store -* it on the socket. +* are out of memory. */ -if (unlikely (inet_csk (sk)->icsk_ack.pending &ICSK_ACK_NOMEM )) +if (unlikely (inet_csk (sk)->icsk_ack.pending &ICSK_ACK_NOMEM )) { + tp->pred_flags =0 ; + tp->rcv_wnd =0 ; + tp->rcv_wup = tp->rcv_nxt;return 0 ; + } cur_win =tcp_receive_window (tp); new_win =__tcp_select_window (sk);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 345/393 net: xdp: Disallow attaching device-bound programs in generic mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 3595599fa8360bb3c7afa7ee50c810b4a64106ea ]
Device-bound programs are used to support RX metadata kfuncs. These kfuncs are driver-specific and rely on the driver context to read the metadata. This means they can't work in generic XDP mode. However, there is no check to disallow such programs from being attached in generic mode, in which case the metadata kfuncs will be called in an invalid context, leading to crashes.
Fix this by adding a check to disallow attaching device-bound programs in generic mode.
--- net/core/dev.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/dev.c +4 -0
@@ -9346,6 +9346,10 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extackNL_SET_ERR_MSG (extack,"Program bound to different device" );return -EINVAL ; } +if (bpf_prog_is_dev_bound (new_prog->aux) && mode ==XDP_MODE_SKB ) { +NL_SET_ERR_MSG (extack,"Can't attach device-bound programs in generic mode" ); +return -EINVAL ; + }if (new_prog->expected_attach_type ==BPF_XDP_DEVMAP ) {NL_SET_ERR_MSG (extack,"BPF_XDP_DEVMAP programs can not be attached to a device" );return -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 346/393 net: sh_eth: Fix missing rtnl lock in suspend/resume path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit b95102215a8d0987789715ce11c0d4ec031cbfbe ]
Fix the suspend/resume path by ensuring the rtnl lock is held where required. Calls to sh_eth_close, sh_eth_open and wol operations must be performed under the rtnl lock to prevent conflicts with ongoing ndo operations.
--- drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +4 -0
@@ -3496,10 +3496,12 @@ static int sh_eth_suspend(struct device *dev)netif_device_detach (ndev); +rtnl_lock ();if (mdp->wol_enabled) ret =sh_eth_wol_setup (ndev);else ret =sh_eth_close (ndev); +rtnl_unlock ();return ret; }
@@ -3513,10 +3515,12 @@ static int sh_eth_resume(struct device *dev)if (!netif_running (ndev))return 0 ; +rtnl_lock ();if (mdp->wol_enabled) ret =sh_eth_wol_restore (ndev);else ret =sh_eth_open (ndev); +rtnl_unlock ();if (ret <0 )return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 347/393 net: hsr: fix fill_frame_info() regression vs VLAN packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 0f5697f1a3f99bc2b674b8aa3c5da822c5673c11 ]
Stephan Wurm reported that my recent patch broke VLAN support.
Apparently skb->mac_len is not correct for VLAN traffic as shown by debug traces [1].
Use instead pskb_may_pull() to make sure the expected header is present in skb->head.
Many thanks to Stephan for his help.
[1]
kernel: skb len=170 headroom=2 headlen=170 tailroom=20
mac=(2,14) mac_len=14 net=(16,-1) trans=-1
shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0))
csum(0x0 start=0 offset=0 ip_summed=0 complete_sw=0 valid=0 level=0)
hash(0x0 sw=0 l4=0) proto=0x0000 pkttype=0 iif=0
priority=0x0 mark=0x0 alloc_cpu=0 vlan_all=0x0
encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0)kernel: dev name=prp0 feat=0x0000000000007000
kernel: sk family=17 type=3 proto=0
kernel: skb headroom: 00000000: 74 00
kernel: skb linear: 00000000: 01 0c cd 01 00 01 00 d0 93 53 9c cb 81 00 80 00
kernel: skb linear: 00000010: 88 b8 00 01 00 98 00 00 00 00 61 81 8d 80 16 52
kernel: skb linear: 00000020: 45 47 44 4e 43 54 52 4c 2f 4c 4c 4e 30 24 47 4f
kernel: skb linear: 00000030: 24 47 6f 43 62 81 01 14 82 16 52 45 47 44 4e 43
kernel: skb linear: 00000040: 54 52 4c 2f 4c 4c 4e 30 24 44 73 47 6f 6f 73 65
kernel: skb linear: 00000050: 83 07 47 6f 49 64 65 6e 74 84 08 67 8d f5 93 7e
kernel: skb linear: 00000060: 76 c8 00 85 01 01 86 01 00 87 01 00 88 01 01 89
kernel: skb linear: 00000070: 01 00 8a 01 02 ab 33 a2 15 83 01 00 84 03 03 00
kernel: skb linear: 00000080: 00 91 08 67 8d f5 92 77 4b c6 1f 83 01 00 a2 1a
kernel: skb linear: 00000090: a2 06 85 01 00 83 01 00 84 03 03 00 00 91 08 67
kernel: skb linear: 000000a0: 8d f5 92 77 4b c6 1f 83 01 00
kernel: skb tailroom: 00000000: 80 18 02 00 fe 4e 00 00 01 01 08 0a 4f fd 5e d1
kernel: skb tailroom: 00000010: 4f fd 5e cd
--- net/hsr/hsr_forward.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/hsr/hsr_forward.c +5 -2
@@ -588,9 +588,12 @@ static int fill_frame_info(struct hsr_frame_info *frame, frame->is_vlan = true;if (frame->is_vlan) { - if (skb->mac_len < offsetofend(struct hsr_vlan_ethhdr, vlanhdr)) +/* Note: skb->mac_len might be wrong here. */ +if (!pskb_may_pull (skb, +skb_mac_offset (skb) + + offsetofend(struct hsr_vlan_ethhdr, vlanhdr)))return -EINVAL ; - vlan_hdr = (struct hsr_vlan_ethhdr *)ethhdr; + vlan_hdr = (struct hsr_vlan_ethhdr *)skb_mac_header (skb); proto = vlan_hdr->vlanhdr.h_vlan_encapsulated_proto;/* FIXME: */ netdev_warn_once (skb->dev,"VLAN not yet supported" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 348/393 genksyms: fix memory leak when the same symbol is added from source
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 45c9c4101d3d2fdfa00852274bbebba65fcc3cf2 ]
When a symbol that is already registered is added again, __add_symbol() returns without freeing the symbol definition, making it unreachable.
The following test cases demonstrate different memory leak points.
[Test Case 1]
Forward declaration with exactly the same definition
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) {}
EXPORT_SYMBOL(foo);[Test Case 2]
Forward declaration with a different definition (e.g. attribute)
$ cat foo.c
#include <linux/export.h>
void foo(void);
__attribute__((__section__(".ref.text"))) void foo(void) {}
EXPORT_SYMBOL(foo);[Test Case 3]
Preserving an overridden symbol (compile with KBUILD_PRESERVE=1)
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) { }
EXPORT_SYMBOL(foo);$ cat foo.symref override foo void foo ( int )
The memory leaks in Test Case 1 and 2 have existed since the introduction of genksyms into the kernel tree. [1]
The memory leak in Test Case 3 was introduced by commit 5dae9a550a74 ("genksyms: allow to ignore symbol checksum changes").
When multiple init_declarators are reduced to an init_declarator_list, the decl_spec must be duplicated. Otherwise, the following Test Case 4 would result in a double-free bug.
[Test Case 4]
$ cat foo.c #include <linux/export.h>
extern int foo, bar;
int foo, bar; EXPORT_SYMBOL(foo);
In this case, 'foo' and 'bar' share the same decl_spec, 'int'. It must be unshared before being passed to add_symbol().
--- scripts/genksyms/genksyms.c | 3 +++ scripts/genksyms/parse.y | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-)
scripts/genksyms/genksyms.c +3 -0
@@ -241,6 +241,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, "unchanged\n"); } sym->is_declared =1 ; +free_list (defn,NULL );return sym; }else if (!sym->is_declared) {if (sym->is_override && flag_preserve) {
@@ -249,6 +250,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,print_type_name (type, name);fprintf (stderr," modversion change\n" ); sym->is_declared =1 ; +free_list (defn,NULL );return sym; }else { status = is_unknown_symbol(sym) ?
@@ -256,6 +258,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type, } }else {error_with_pos ("redefinition of %s" , name); +free_list (defn,NULL );return sym; }break ;
scripts/genksyms/parse.y +12 -2
@@ -152,14 +152,19 @@ simple_declaration: ; init_declarator_list_opt: - /* empty */ { $$ = NULL; } - | init_declarator_list + /* empty */ { $$ = NULL; } + | init_declarator_list { free_list(decl_spec, NULL); $$ = $1; } ; init_declarator_list: init_declarator { struct string_list *decl = *$1; *$1 = NULL; + + /* avoid sharing among multiple init_declarators */ + if (decl_spec) + decl_spec = copy_list_range(decl_spec, NULL); + add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL;
@@ -170,6 +175,11 @@ init_declarator_list: *$3 = NULL; free_list(*$2, NULL); *$2 = decl_spec; + + /* avoid sharing among multiple init_declarators */ + if (decl_spec) + decl_spec = copy_list_range(decl_spec, NULL); + add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 349/393 genksyms: fix memory leak when the same symbol is read from *.symref file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit be2fa44b5180a1f021efb40c55fdf63c249c3209 ]
When a symbol that is already registered is read again from *.symref file, __add_symbol() removes the previous one from the hash table without freeing it.
[Test Case]
$ cat foo.c
#include <linux/export.h>
void foo(void);
void foo(void) {}
EXPORT_SYMBOL(foo);$ cat foo.symref foo void foo ( void ) foo void foo ( void )
When a symbol is removed from the hash table, it must be freed along with its ->name and ->defn members. However, sym->name cannot be freed because it is sometimes shared with node->string, but not always. If sym->name and node->string share the same memory, free(sym->name) could lead to a double-free bug.
To resolve this issue, always assign a strdup'ed string to sym->name.
--- scripts/genksyms/genksyms.c | 8 ++++++-- scripts/genksyms/genksyms.h | 2 +- scripts/genksyms/parse.y | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-)
scripts/genksyms/genksyms.c +6 -2
@@ -274,11 +274,15 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,break ; } } + +free_list (sym->defn,NULL ); +free (sym->name); +free (sym); --nsyms; } sym =xmalloc (sizeof (*sym)); - sym->name = name; + sym->name =xstrdup (name); sym->type = type; sym->defn = defn; sym->expansion_trail =NULL ;
@@ -485,7 +489,7 @@ static void read_reference(FILE *f) defn = def; def =read_node (f); } - subsym =add_reference_symbol (xstrdup (sym->string), sym->tag, + subsym =add_reference_symbol (sym->string, sym->tag, defn, is_extern); subsym->is_override = is_override;free_node (sym);
scripts/genksyms/genksyms.h +1 -1
@@ -32,7 +32,7 @@ struct string_list {struct symbol {struct symbol *hash_next; -const char *name; +char *name;enum symbol_type type;struct string_list *defn;struct symbol *expansion_trail;
scripts/genksyms/parse.y +2 -2
@@ -482,12 +482,12 @@ enumerator_list: enumerator: IDENT { - const char *name = strdup((*$1)->string); + const char *name = (*$1)->string; add_symbol(name, SYM_ENUM_CONST, NULL, 0); } | IDENT '=' EXPRESSION_PHRASE { - const char *name = strdup((*$1)->string); + const char *name = (*$1)->string; struct string_list *expr = copy_list_range(*$3, *$2); add_symbol(name, SYM_ENUM_CONST, expr, 0); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 350/393 hostfs: convert hostfs to use the new mount API
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongbo Li <[email protected]>
[ Upstream commit cd140ce9f611a5e9d2a5989a282b75e55c71dab3 ]
Convert the hostfs filesystem to the new internal mount API as the old one will be obsoleted and removed. This allows greater flexibility in communication of mount parameters between userspace, the VFS and the filesystem.
See Documentation/filesystems/mount_api.txt for more information.
Stable-dep-of: 60a600243244 ("hostfs: fix string handling in __dentry_name()")
--- fs/hostfs/hostfs_kern.c | 83 ++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 21 deletions(-)
fs/hostfs/hostfs_kern.c +62 -21
@@ -16,11 +16,16 @@#include <linux/seq_file.h> #include <linux/writeback.h> #include <linux/mount.h> +#include <linux/fs_context.h> #include <linux/namei.h> #include "hostfs.h" #include <init.h> #include <kern.h> +struct hostfs_fs_info { +char *host_root_path; +}; +struct hostfs_inode_info {int fd;fmode_t mode;
@@ -90,8 +95,10 @@ static char *__dentry_name(struct dentry *dentry, char *name)char *p =dentry_path_raw (dentry, name,PATH_MAX );char *root;size_t len; +struct hostfs_fs_info *fsi; - root = dentry->d_sb->s_fs_info; + fsi = dentry->d_sb->s_fs_info; + root = fsi->host_root_path; len =strlen (root);if (IS_ERR (p)) {__putname (name);
@@ -196,8 +203,10 @@ static int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf)long long f_bavail;long long f_files;long long f_ffree; +struct hostfs_fs_info *fsi; - err =do_statfs (dentry->d_sb->s_fs_info, + fsi = dentry->d_sb->s_fs_info; + err =do_statfs (fsi->host_root_path, &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, &f_ffree, &sf->f_fsid,sizeof (sf->f_fsid), &sf->f_namelen);
@@ -245,7 +254,11 @@ static void hostfs_free_inode(struct inode *inode)static int hostfs_show_options (struct seq_file *seq,struct dentry *root) { -const char *root_path = root->d_sb->s_fs_info; +struct hostfs_fs_info *fsi; +const char *root_path; + + fsi = root->d_sb->s_fs_info; + root_path = fsi->host_root_path;size_t offset =strlen (root_ino) +1 ;if (strlen (root_path) > offset)
@@ -924,10 +937,11 @@ static const struct inode_operations hostfs_link_iops = { .get_link = hostfs_get_link, }; -static int hostfs_fill_sb_common (struct super_block *sb,void *d,int silent) +static int hostfs_fill_super (struct super_block *sb,struct fs_context *fc) { +struct hostfs_fs_info *fsi = sb->s_fs_info;struct inode *root_inode; -char *host_root_path, *req_root = d; +char *host_root = fc->source;int err; sb->s_blocksize =1024 ;
@@ -941,15 +955,15 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)return err;/* NULL is printed as '(null)' by printf(): avoid that. */ -if (req_root ==NULL ) - req_root ="" ; +if (fc->source ==NULL ) + host_root ="" ; - sb->s_fs_info = host_root_path = -kasprintf (GFP_KERNEL ,"%s/%s" , root_ino, req_root); -if (host_root_path ==NULL ) + fsi->host_root_path = +kasprintf (GFP_KERNEL ,"%s/%s" , root_ino, host_root); +if (fsi->host_root_path ==NULL )return -ENOMEM ; - root_inode =hostfs_iget (sb, host_root_path); + root_inode =hostfs_iget (sb, fsi->host_root_path);if (IS_ERR (root_inode))return PTR_ERR (root_inode);
@@ -957,7 +971,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)char *name;iput (root_inode); - name =follow_link (host_root_path); + name =follow_link (fsi->host_root_path);if (IS_ERR (name))return PTR_ERR (name);
@@ -974,11 +988,38 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)return 0 ; } -static struct dentry *hostfs_read_sb (struct file_system_type *type, -int flags,const char *dev_name, -void *data) +static int hostfs_fc_get_tree (struct fs_context *fc) { -return mount_nodev (type, flags, data, hostfs_fill_sb_common); +return get_tree_nodev (fc, hostfs_fill_super); +} + +static void hostfs_fc_free (struct fs_context *fc) +{ +struct hostfs_fs_info *fsi = fc->s_fs_info; + +if (!fsi) +return ; + +kfree (fsi->host_root_path); +kfree (fsi); +} + +static const struct fs_context_operations hostfs_context_ops = { + .get_tree = hostfs_fc_get_tree, + .free = hostfs_fc_free, +}; + +static int hostfs_init_fs_context (struct fs_context *fc) +{ +struct hostfs_fs_info *fsi; + + fsi =kzalloc (sizeof (*fsi),GFP_KERNEL ); +if (!fsi) +return -ENOMEM ; + + fc->s_fs_info = fsi; + fc->ops = &hostfs_context_ops; +return 0 ; }static void hostfs_kill_sb (struct super_block *s)
@@ -988,11 +1029,11 @@ static void hostfs_kill_sb(struct super_block *s) }static struct file_system_type hostfs_type = { - .owner =THIS_MODULE , - .name ="hostfs" , - .mount = hostfs_read_sb, - .kill_sb = hostfs_kill_sb, - .fs_flags =0 , + .owner =THIS_MODULE , + .name ="hostfs" , + .init_fs_context = hostfs_init_fs_context, + .kill_sb = hostfs_kill_sb, + .fs_flags =0 , };MODULE_ALIAS_FS ("hostfs" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 351/393 hostfs: fix string handling in __dentry_name()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 60a6002432448bb3f291d80768ae98d62efc9c77 ]
strcpy() should not be used with destination potentially overlapping the source; what's more, strscpy() in there is pointless - we already know the amount we want to copy; might as well use memcpy().
--- fs/hostfs/hostfs_kern.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)
fs/hostfs/hostfs_kern.c +6 -21
@@ -93,32 +93,17 @@ __uml_setup("hostfs=", hostfs_args,static char *__dentry_name (struct dentry *dentry,char *name) {char *p =dentry_path_raw (dentry, name,PATH_MAX ); -char *root; -size_t len; -struct hostfs_fs_info *fsi; - - fsi = dentry->d_sb->s_fs_info; - root = fsi->host_root_path; - len =strlen (root); -if (IS_ERR (p)) { -__putname (name); -return NULL ; - } - -/* -* This function relies on the fact that dentry_path_raw() will place -* the path name at the end of the provided buffer. -*/ -BUG_ON (p +strlen (p) +1 != name +PATH_MAX ); +struct hostfs_fs_info *fsi = dentry->d_sb->s_fs_info; +char *root = fsi->host_root_path; +size_t len =strlen (root); -strscpy (name, root,PATH_MAX ); -if (len > p - name) { +if (IS_ERR (p) || len > p - name) {__putname (name);return NULL ; } -if (p > name + len) -strcpy (name + len, p); +memcpy (name, root, len); +memmove (name + len, p, name +PATH_MAX - p);return name; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 352/393 hostfs: Add const qualifier to host_root in hostfs_fill_super()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 104eef133fd9c17e4dc28bf43f592a86f26d8a59 upstream.
After the recent conversion to the new mount API, there is a warning when building hostfs (which may be upgraded to an error via CONFIG_WERROR=y):
fs/hostfs/hostfs_kern.c: In function 'hostfs_fill_super':
fs/hostfs/hostfs_kern.c:942:27: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
942 | char *host_root = fc->source;
| ^~Add the 'const' qualifier, as host_root will not be modified after its assignment. Move the assignment to keep the existing reverse Christmas tree order intact.
--- fs/hostfs/hostfs_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hostfs/hostfs_kern.c +1 -1
@@ -925,8 +925,8 @@ static const struct inode_operations hosstatic int hostfs_fill_super (struct super_block *sb,struct fs_context *fc) {struct hostfs_fs_info *fsi = sb->s_fs_info; +const char *host_root = fc->source;struct inode *root_inode; -char *host_root = fc->source;int err; sb->s_blocksize =1024 ;
Greg Kroah-Hartman
maintainerPATCH 353/393 hostfs: fix the host directory parse when mounting.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongbo Li <[email protected]>
commit ef9ca17ca458ac7253ae71b552e601e49311fc48 upstream.
hostfs not keep the host directory when mounting. When the host directory is none (default), fc->source is used as the host root directory, and this is wrong. Here we use parse_monolithic to handle the old mount path for parsing the root directory. For new mount path, The parse_param is used for the host directory parse.
--- fs/hostfs/hostfs_kern.c | 65 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 10 deletions(-)
fs/hostfs/hostfs_kern.c +55 -10
@@ -17,6 +17,7 @@#include <linux/writeback.h> #include <linux/mount.h> #include <linux/fs_context.h> +#include <linux/fs_parser.h> #include <linux/namei.h> #include "hostfs.h" #include <init.h>
@@ -925,7 +926,6 @@ static const struct inode_operations hosstatic int hostfs_fill_super (struct super_block *sb,struct fs_context *fc) {struct hostfs_fs_info *fsi = sb->s_fs_info; -const char *host_root = fc->source;struct inode *root_inode;int err;
@@ -939,15 +939,6 @@ static int hostfs_fill_super(struct supeif (err)return err; -/* NULL is printed as '(null)' by printf(): avoid that. */ -if (fc->source ==NULL ) - host_root ="" ; - - fsi->host_root_path = -kasprintf (GFP_KERNEL ,"%s/%s" , root_ino, host_root); -if (fsi->host_root_path ==NULL ) -return -ENOMEM ; - root_inode =hostfs_iget (sb, fsi->host_root_path);if (IS_ERR (root_inode))return PTR_ERR (root_inode);
@@ -973,6 +964,58 @@ static int hostfs_fill_super(struct supereturn 0 ; } +enum hostfs_parma { + Opt_hostfs, +}; + +static const struct fs_parameter_spec hostfs_param_specs[] = { +fsparam_string_empty ("hostfs" , Opt_hostfs), + {} +}; + +static int hostfs_parse_param (struct fs_context *fc,struct fs_parameter *param) +{ +struct hostfs_fs_info *fsi = fc->s_fs_info; +struct fs_parse_result result; +char *host_root; +int opt; + + opt =fs_parse (fc, hostfs_param_specs, param, &result); +if (opt <0 ) +return opt; + +switch (opt) { +case Opt_hostfs: + host_root = param->string; +if (!*host_root) + host_root ="" ; + fsi->host_root_path = +kasprintf (GFP_KERNEL ,"%s/%s" , root_ino, host_root); +if (fsi->host_root_path ==NULL ) +return -ENOMEM ; +break ; + } + +return 0 ; +} + +static int hostfs_parse_monolithic (struct fs_context *fc,void *data) +{ +struct hostfs_fs_info *fsi = fc->s_fs_info; +char *host_root = (char *)data; + +/* NULL is printed as '(null)' by printf(): avoid that. */ +if (host_root ==NULL ) + host_root ="" ; + + fsi->host_root_path = +kasprintf (GFP_KERNEL ,"%s/%s" , root_ino, host_root); +if (fsi->host_root_path ==NULL ) +return -ENOMEM ; + +return 0 ; +} +static int hostfs_fc_get_tree (struct fs_context *fc) {return get_tree_nodev (fc, hostfs_fill_super);
@@ -990,6 +1033,8 @@ static void hostfs_fc_free(struct fs_con }static const struct fs_context_operations hostfs_context_ops = { + .parse_monolithic = hostfs_parse_monolithic, + .parse_param = hostfs_parse_param, .get_tree = hostfs_fc_get_tree, .free = hostfs_fc_free, };
Greg Kroah-Hartman
maintainerPATCH 354/393 RISC-V: Mark riscv_v_init() as __init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Palmer Dabbelt <[email protected]>
[ Upstream commit 9d87cf525fd2e1a5fcbbb40ee3df216d1d266c88 ]
This trips up with Xtheadvector enabled, but as far as I can tell it's just been an issue since the original patchset.
--- arch/riscv/kernel/vector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/vector.c +1 -1
@@ -270,7 +270,7 @@ static int __init riscv_v_sysctl_init(void)static int __init riscv_v_sysctl_init (void ) {return 0 ; }#endif /* ! CONFIG_SYSCTL */ -static int riscv_v_init (void ) +static int __init riscv_v_init (void ) {return riscv_v_sysctl_init (); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 355/393 ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Detlev Casanova <[email protected]>
[ Upstream commit 5323186e2e8d33c073fad51e24f18e2d6dbae2da ]
In commit9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"), the set_sysclk callback was removed as considered unused as the mclk rate can be set in the hw_params callback.
The difference between hw_params and set_sysclk is that the former is called with the audio sampling rate set in the params (e.g.: 48000 Hz) while the latter is called with a clock rate already computed with
sampling_rate * mclk-fs (e.g.: 48000 * 256)
For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must be set to 128 instead of the default 256, and that value is set in the device tree at the machine driver level (like a simple-audio-card compatible node).
Therefore, the i2s_tdm driver has no idea that another mclk-fs value can be configured and simply computes the mclk rate in the hw_params callback with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI audio.
Re-add the set_sysclk callback so that the mclk rate is computed by the machine driver which has the correct mclk-fs value set in its device tree node.
--- sound/soc/rockchip/rockchip_i2s_tdm.c | 31 +++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +29 -2
@@ -24,7 +24,6 @@#define DRV_NAME "rockchip-i2s-tdm" -#define DEFAULT_MCLK_FS 256#define CH_GRP_MAX 4/* The max channel 8 / 2 */ #define MULTIPLEX_CH_MAX 10
@@ -72,6 +71,8 @@ struct rk_i2s_tdm_dev {bool has_playback;bool has_capture;struct snd_soc_dai_driver *dai; +unsigned int mclk_rx_freq; +unsigned int mclk_tx_freq; };static int to_ch_num (unsigned int val)
@@ -647,6 +648,27 @@ static int rockchip_i2s_trcm_mode(struct snd_pcm_substream *substream,return 0 ; } +static int rockchip_i2s_tdm_set_sysclk (struct snd_soc_dai *cpu_dai,int stream, +unsigned int freq,int dir) +{ +struct rk_i2s_tdm_dev *i2s_tdm =to_info (cpu_dai); + +if (i2s_tdm->clk_trcm) { + i2s_tdm->mclk_tx_freq = freq; + i2s_tdm->mclk_rx_freq = freq; + }else { +if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) + i2s_tdm->mclk_tx_freq = freq; +else + i2s_tdm->mclk_rx_freq = freq; + } + +dev_dbg (i2s_tdm->dev,"The target mclk_%s freq is: %d\n" , + stream ?"rx" :"tx" , freq); + +return 0 ; +} +static int rockchip_i2s_tdm_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)
@@ -661,15 +683,19 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,if (i2s_tdm->clk_trcm ==TRCM_TX ) { mclk = i2s_tdm->mclk_tx; + mclk_rate = i2s_tdm->mclk_tx_freq; }else if (i2s_tdm->clk_trcm ==TRCM_RX ) { mclk = i2s_tdm->mclk_rx; + mclk_rate = i2s_tdm->mclk_rx_freq; }else if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { mclk = i2s_tdm->mclk_tx; + mclk_rate = i2s_tdm->mclk_tx_freq; }else { mclk = i2s_tdm->mclk_rx; + mclk_rate = i2s_tdm->mclk_rx_freq; } - err =clk_set_rate (mclk,DEFAULT_MCLK_FS *params_rate (params)); + err =clk_set_rate (mclk, mclk_rate);if (err)return err;
@@ -829,6 +855,7 @@ static const struct snd_soc_dai_ops rockchip_i2s_tdm_dai_ops = { .hw_params = rockchip_i2s_tdm_hw_params, .set_bclk_ratio = rockchip_i2s_tdm_set_bclk_ratio, .set_fmt = rockchip_i2s_tdm_set_fmt, + .set_sysclk = rockchip_i2s_tdm_set_sysclk, .set_tdm_slot = rockchip_dai_tdm_slot, .trigger = rockchip_i2s_tdm_trigger, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 356/393 io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
[ Upstream commit d58d82bd0efd6c8edd452fc2f6c6dd052ec57cb2 ]
io_uring_cmd_sock() does a normal read of cmd->sqe->cmd_op, where it really should be using a READ_ONCE() as ->sqe may still be pointing to the original SQE. Since the prep side already does this READ_ONCE() and stores it locally, use that value rather than re-read it.
--- io_uring/uring_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/uring_cmd.c +1 -1
@@ -175,7 +175,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)if (!prot || !prot->ioctl)return -EOPNOTSUPP ; -switch (cmd->sqe->cmd_op) { +switch (cmd->cmd_op) {case SOCKET_URING_OP_SIOCINQ : ret = prot->ioctl (sk,SIOCINQ , &arg);if (ret)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 357/393 cifs: Validate EAs for WSL reparse points
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit ef201e8759d20bf82b5943101147072de12bc524 ]
Major and minor numbers for char and block devices are mandatory for stat. So check that the WSL EA $LXDEV is present for WSL CHR and BLK reparse points.
WSL reparse point tag determinate type of the file. But file type is present also in the WSL EA $LXMOD. So check that both file types are same.
--- fs/smb/client/reparse.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
fs/smb/client/reparse.c +18 -4
@@ -674,11 +674,12 @@ int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,return parse_reparse_point (buf, plen, cifs_sb, full_path, true, data); } -static void wsl_to_fattr (struct cifs_open_info_data *data, +static bool wsl_to_fattr (struct cifs_open_info_data *data,struct cifs_sb_info *cifs_sb,u32 tag,struct cifs_fattr *fattr) {struct smb2_file_full_ea_info *ea; +bool have_xattr_dev = false;u32 next =0 ;switch (tag) {
@@ -721,13 +722,24 @@ static void wsl_to_fattr(struct cifs_open_info_data *data, fattr->cf_uid =wsl_make_kuid (cifs_sb, v); else if (!strncmp(name, SMB2_WSL_XATTR_GID, nlen)) fattr->cf_gid = wsl_make_kgid(cifs_sb, v); - else if (!strncmp(name, SMB2_WSL_XATTR_MODE, nlen)) + else if (!strncmp(name, SMB2_WSL_XATTR_MODE, nlen)) { +/* File type in reparse point tag and in xattr mode must match. */ +if (S_DT (fattr->cf_mode) !=S_DT (le32_to_cpu (*(__le32 *)v))) +return false; fattr->cf_mode = (umode_t )le32_to_cpu (*(__le32 *)v); - else if (!strncmp(name, SMB2_WSL_XATTR_DEV, nlen)) + } else if (!strncmp(name, SMB2_WSL_XATTR_DEV, nlen)) { fattr->cf_rdev =reparse_mkdev (v); + have_xattr_dev = true; + } }while (next); out: + +/* Major and minor numbers for char and block devices are mandatory. */ +if (!have_xattr_dev && (tag ==IO_REPARSE_TAG_LX_CHR || tag ==IO_REPARSE_TAG_LX_BLK )) +return false; + fattr->cf_dtype =S_DT (fattr->cf_mode); +return true; } static bool posix_reparse_to_fattr(struct cifs_sb_info *cifs_sb,
@@ -801,7 +813,9 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,case IO_REPARSE_TAG_AF_UNIX :case IO_REPARSE_TAG_LX_CHR :case IO_REPARSE_TAG_LX_BLK : -wsl_to_fattr (data, cifs_sb, tag, fattr); + ok =wsl_to_fattr (data, cifs_sb, tag, fattr); +if (!ok) +return false;break ;case IO_REPARSE_TAG_NFS : ok =posix_reparse_to_fattr (cifs_sb, fattr, data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 358/393 cifs: Fix getting and setting SACLs over SMB1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 8b19dfb34d17e77a0809d433cc128b779282131b ]
SMB1 callback get_cifs_acl_by_fid() currently ignores its last argument and therefore ignores request for SACL_SECINFO. Fix this issue by correctly propagating info argument from get_cifs_acl() and get_cifs_acl_by_fid() to CIFSSMBGetCIFSACL() function and pass SACL_SECINFO when requested.
For accessing SACLs it is needed to open object with SYSTEM_SECURITY access. Pass this flag when trying to get or set SACLs.
Same logic is in the SMB2+ code path.
This change fixes getting and setting of "system.cifs_ntsd_full" and "system.smb3_ntsd_full" xattrs over SMB1 as currently it silentely ignored SACL part of passed xattr buffer.
--- fs/smb/client/cifsacl.c | 25 +++++++++++++++---------- fs/smb/client/cifsproto.h | 2 +- fs/smb/client/cifssmb.c | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-)
fs/smb/client/cifsacl.c +15 -10
@@ -1395,7 +1395,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY struct smb_ntsd *get_cifs_acl_by_fid (struct cifs_sb_info *cifs_sb,const struct cifs_fid *cifsfid,u32 *pacllen, -u32 __maybe_unused unused) +u32 info) {struct smb_ntsd *pntsd =NULL ;unsigned int xid;
@@ -1407,7 +1407,7 @@ struct smb_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, xid =get_xid (); rc =CIFSSMBGetCIFSACL (xid,tlink_tcon (tlink), cifsfid->netfid, &pntsd, - pacllen); + pacllen, info);free_xid (xid);cifs_put_tlink (tlink);
@@ -1419,7 +1419,7 @@ struct smb_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, }static struct smb_ntsd *get_cifs_acl_by_path (struct cifs_sb_info *cifs_sb, -const char *path,u32 *pacllen) +const char *path,u32 *pacllen,u32 info) {struct smb_ntsd *pntsd =NULL ;int oplock =0 ;
@@ -1446,9 +1446,12 @@ static struct smb_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, .fid = &fid, }; +if (info &SACL_SECINFO ) + oparms.desired_access |=SYSTEM_SECURITY ; + rc =CIFS_open (xid, &oparms, &oplock,NULL );if (!rc) { - rc =CIFSSMBGetCIFSACL (xid, tcon, fid.netfid, &pntsd, pacllen); + rc =CIFSSMBGetCIFSACL (xid, tcon, fid.netfid, &pntsd, pacllen, info);CIFSSMBClose (xid, tcon, fid.netfid); }
@@ -1472,7 +1475,7 @@ struct smb_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,if (inode) open_file =find_readable_file (CIFS_I (inode), true);if (!open_file) -return get_cifs_acl_by_path (cifs_sb, path, pacllen); +return get_cifs_acl_by_path (cifs_sb, path, pacllen, info); pntsd =get_cifs_acl_by_fid (cifs_sb, &open_file->fid, pacllen, info);cifsFileInfo_put (open_file);
@@ -1485,7 +1488,7 @@ int set_cifs_acl(struct smb_ntsd *pnntsd, __u32 acllen, {int oplock =0 ;unsigned int xid; -int rc, access_flags; +int rc, access_flags =0 ;struct cifs_tcon *tcon;struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);struct tcon_link *tlink =cifs_sb_tlink (cifs_sb);
@@ -1498,10 +1501,12 @@ int set_cifs_acl(struct smb_ntsd *pnntsd, __u32 acllen, tcon =tlink_tcon (tlink); xid =get_xid (); -if (aclflag ==CIFS_ACL_OWNER || aclflag ==CIFS_ACL_GROUP ) - access_flags =WRITE_OWNER ; -else - access_flags =WRITE_DAC ; +if (aclflag &CIFS_ACL_OWNER || aclflag &CIFS_ACL_GROUP ) + access_flags |=WRITE_OWNER ; +if (aclflag &CIFS_ACL_SACL ) + access_flags |=SYSTEM_SECURITY ; +if (aclflag &CIFS_ACL_DACL ) + access_flags |=WRITE_DAC ; oparms = (struct cifs_open_parms ) { .tcon = tcon,
fs/smb/client/cifsproto.h +1 -1
@@ -570,7 +570,7 @@ extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,const struct nls_table *nls_codepage, struct cifs_sb_info *cifs_sb);extern int CIFSSMBGetCIFSACL (const unsigned int xid,struct cifs_tcon *tcon, -__u16 fid,struct smb_ntsd **acl_inf,__u32 *buflen); +__u16 fid,struct smb_ntsd **acl_inf,__u32 *buflen,__u32 info);extern int CIFSSMBSetCIFSACL (const unsigned int ,struct cifs_tcon *,__u16 ,struct smb_ntsd *pntsd,__u32 len,int aclflag); extern int cifs_do_get_acl(const unsigned int xid, struct cifs_tcon *tcon,
fs/smb/client/cifssmb.c +2 -2
@@ -3385,7 +3385,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,/* Get Security Descriptor (by handle) from remote server for a file or dir */ int CIFSSMBGetCIFSACL (const unsigned int xid,struct cifs_tcon *tcon,__u16 fid, -struct smb_ntsd **acl_inf,__u32 *pbuflen) +struct smb_ntsd **acl_inf,__u32 *pbuflen,__u32 info) {int rc =0 ;int buf_type =0 ;
@@ -3408,7 +3408,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid, pSMB->MaxSetupCount =0 ; pSMB->Fid = fid;/* file handle always le */ pSMB->AclFlags =cpu_to_le32 (CIFS_ACL_OWNER |CIFS_ACL_GROUP | -CIFS_ACL_DACL ); +CIFS_ACL_DACL | info); pSMB->ByteCount =cpu_to_le16 (11 );/* 3 bytes pad + 8 bytes parm */ inc_rfc1001_len (pSMB,11 ); iov[0 ].iov_base = (char *)pSMB;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 359/393 kconfig: fix file name in warnings when loading KCONFIG_DEFCONFIG_LIST
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit a314f52a0210730d0d556de76bb7388e76d4597d ]
Most 'make *config' commands use .config as the base configuration file.
When .config does not exist, Kconfig tries to load a file listed in KCONFIG_DEFCONFIG_LIST instead.
However, since commit b75b0a819af9 ("kconfig: change defconfig_list option to environment variable"), warning messages have displayed an incorrect file name in such cases.
Below is a demonstration using Debian Trixie. While loading /boot/config-6.12.9-amd64, the warning messages incorrectly show .config as the file name.
With this commit, the correct file name is displayed in warnings.
[Before]
$ rm -f .config $ make config # # using defaults found in /boot/config-6.12.9-amd64 # .config:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT .config:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
[After]
$ rm -f .config $ make config # # using defaults found in /boot/config-6.12.9-amd64 # /boot/config-6.12.9-amd64:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT /boot/config-6.12.9-amd64:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
--- scripts/kconfig/confdata.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/kconfig/confdata.c +4 -2
@@ -386,10 +386,12 @@ int conf_read_simple(const char *name, int def) *p ='\0' ; - in =zconf_fopen (env); + name = env; + + in =zconf_fopen (name);if (in) {conf_message ("using defaults found in %s" , - env); + name); goto load; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 360/393 kconfig: require a space after # for valid input
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 4d137ab0107ead0f2590fc0314e627431e3b9e3f ]
Currently, when an input line starts with '#', (line + 2) is passed to memcmp() without checking line[1].
It means that line[1] can be any arbitrary character. For example, "#KCONFIG_FOO is not set" is accepted as valid input, functioning the same as "# CONFIG_FOO is not set".
More importantly, this can potentially lead to a buffer overrun if line[1] == '\0'. It occurs if the input only contains '#', as (line + 2) points to an uninitialized buffer.
Check line[1], and skip the line if it is not a space.
Stable-dep-of: a409fc1463d6 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
--- scripts/kconfig/confdata.c | 2 ++ 1 file changed, 2 insertions(+)
scripts/kconfig/confdata.c +2 -0
@@ -432,6 +432,8 @@ int conf_read_simple(const char *name, int def) conf_lineno++; sym =NULL ;if (line[0 ] =='#' ) { +if (line[1 ] !=' ' ) +continue ;if (memcmp (line +2 ,CONFIG_ ,strlen (CONFIG_ )))continue ; p =strchr (line +2 +strlen (CONFIG_ ),' ' );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 361/393 kconfig: remove unused code for S_DEF_AUTO in conf_read_simple()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 92d4fe0a48f1ab6cf20143dd0b376f4fe842854b ]
The 'else' arm here is unreachable in practical use cases.
include/config/auto.conf does not include "# CONFIG_... is not set" line unless it is manually hacked.
Stable-dep-of: a409fc1463d6 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
--- scripts/kconfig/confdata.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
scripts/kconfig/confdata.c +8 -13
@@ -442,20 +442,15 @@ int conf_read_simple(const char *name, int def) *p++ =0 ;if (strncmp (p,"is not set" ,10 ))continue ; -if (def ==S_DEF_USER ) { - sym =sym_find (line +2 +strlen (CONFIG_ )); -if (!sym) { -if (warn_unknown) -conf_warning ("unknown symbol: %s" , - line +2 +strlen (CONFIG_ )); -conf_set_changed (true); -continue ; - } - }else { - sym =sym_lookup (line +2 +strlen (CONFIG_ ),0 ); -if (sym->type ==S_UNKNOWN ) - sym->type =S_BOOLEAN ; + sym =sym_find (line +2 +strlen (CONFIG_ )); +if (!sym) { +if (warn_unknown) +conf_warning ("unknown symbol: %s" , + line +2 +strlen (CONFIG_ )); + +conf_set_changed (true); +continue ; }if (sym->flags & def_flags) {conf_warning ("override: reassigning to symbol %s" , sym->name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 362/393 kconfig: deduplicate code in conf_read_simple()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit d854b4b21de684a16a7d6163c7b0e9c5ff8a09d3 ]
Kconfig accepts both "# CONFIG_FOO is not set" and "CONFIG_FOO=n" as a valid input, but conf_read_simple() duplicates similar code to handle them. Factor out the common code.
Stable-dep-of: a409fc1463d6 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
--- scripts/kconfig/confdata.c | 89 +++++++++++++++----------------------- 1 file changed, 35 insertions(+), 54 deletions(-)
scripts/kconfig/confdata.c +35 -54
@@ -346,11 +346,10 @@ int conf_read_simple(const char *name, int def)FILE *in =NULL ;char *line =NULL ;size_t line_asize =0 ; -char *p, *p2; +char *p, *p2, *val;struct symbol *sym;int i, def_flags; -const char *warn_unknown; -const char *werror; +const char *warn_unknown, *werror, *sym_name; warn_unknown =getenv ("KCONFIG_WARN_UNKNOWN_SYMBOLS" ); werror =getenv ("KCONFIG_WERROR" );
@@ -430,77 +429,34 @@ int conf_read_simple(const char *name, int def)while (compat_getline (&line, &line_asize, in) !=-1 ) { conf_lineno++; - sym =NULL ;if (line[0 ] =='#' ) {if (line[1 ] !=' ' )continue ; -if (memcmp (line +2 ,CONFIG_ ,strlen (CONFIG_ ))) + p = line +2 ; +if (memcmp (p,CONFIG_ ,strlen (CONFIG_ )))continue ; - p =strchr (line +2 +strlen (CONFIG_ ),' ' ); + sym_name = p +strlen (CONFIG_ ); + p =strchr (sym_name,' ' );if (!p)continue ; *p++ =0 ;if (strncmp (p,"is not set" ,10 ))continue ; - sym =sym_find (line +2 +strlen (CONFIG_ )); -if (!sym) { -if (warn_unknown) -conf_warning ("unknown symbol: %s" , - line +2 +strlen (CONFIG_ )); - -conf_set_changed (true); -continue ; - } -if (sym->flags & def_flags) { -conf_warning ("override: reassigning to symbol %s" , sym->name); - } -switch (sym->type) { -case S_BOOLEAN : -case S_TRISTATE : - sym->def[def].tri = no; - sym->flags |= def_flags; -break ; -default : - ; - } + val ="n" ; }else if (memcmp (line,CONFIG_ ,strlen (CONFIG_ )) ==0 ) { - p =strchr (line +strlen (CONFIG_ ),'=' ); + sym_name = line +strlen (CONFIG_ ); + p =strchr (sym_name,'=' );if (!p)continue ; *p++ =0 ; + val = p; p2 =strchr (p,'\n' );if (p2) { *p2-- =0 ;if (*p2 =='\r' ) *p2 =0 ; } - - sym =sym_find (line +strlen (CONFIG_ )); -if (!sym) { -if (def ==S_DEF_AUTO ) { -/* -* Reading from include/config/auto.conf -* If CONFIG_FOO previously existed in -* auto.conf but it is missing now, -* include/config/FOO must be touched. -*/ -conf_touch_dep (line +strlen (CONFIG_ )); - }else { -if (warn_unknown) -conf_warning ("unknown symbol: %s" , - line +strlen (CONFIG_ )); - -conf_set_changed (true); - } -continue ; - } - -if (sym->flags & def_flags) { -conf_warning ("override: reassigning to symbol %s" , sym->name); - } -if (conf_set_sym_val (sym, def, def_flags, p)) -continue ; }else {if (line[0 ] !='\r' && line[0 ] !='\n' ) conf_warning("unexpected data: %.*s",
@@ -509,6 +465,31 @@ int conf_read_simple(const char *name, int def)continue ; } + sym =sym_find (sym_name); +if (!sym) { +if (def ==S_DEF_AUTO ) { +/* +* Reading from include/config/auto.conf. +* If CONFIG_FOO previously existed in auto.conf +* but it is missing now, include/config/FOO +* must be touched. +*/ +conf_touch_dep (sym_name); + }else { +if (warn_unknown) +conf_warning ("unknown symbol: %s" , sym_name); + +conf_set_changed (true); + } +continue ; + } + +if (sym->flags & def_flags) +conf_warning ("override: reassigning to symbol %s" , sym->name); + +if (conf_set_sym_val (sym, def, def_flags, val)) +continue ; +if (sym &&sym_is_choice_value (sym)) {struct symbol *cs =prop_get_symbol (sym_get_choice_prop (sym));switch (sym->def[def].tri) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 363/393 kconfig: WERROR unmet symbol dependency
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit 15d3f7664d2776c086f813f1efbfe2ae20a85e89 ]
When KCONFIG_WERROR env variable is set treat unmet direct symbol dependency as a terminal condition (error).
Stable-dep-of: a409fc1463d6 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
--- scripts/kconfig/conf.c | 6 ++++++ scripts/kconfig/confdata.c | 13 ++++++++----- scripts/kconfig/lkc_proto.h | 2 ++ scripts/kconfig/symbol.c | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-)
scripts/kconfig/conf.c +6 -0
@@ -827,6 +827,9 @@ int main(int ac, char **av)break ; } +if (conf_errors ()) +exit (1 ); +if (sync_kconfig) { name =getenv ("KCONFIG_NOSILENTUPDATE" );if (name && *name) {
@@ -890,6 +893,9 @@ int main(int ac, char **av)break ; } +if (sym_dep_errors ()) +exit (1 ); +if (input_mode == savedefconfig) {if (conf_write_defconfig (defconfig_file)) { fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
scripts/kconfig/confdata.c +8 -5
@@ -155,6 +155,13 @@ static void conf_message(const char *fmt, ...)static const char *conf_filename;static int conf_lineno, conf_warnings; +bool conf_errors (void ) +{ +if (conf_warnings) +return getenv ("KCONFIG_WERROR" ); +return false; +} +static void conf_warning (const char *fmt, ...) {va_list ap;
@@ -349,10 +356,9 @@ int conf_read_simple(const char *name, int def)char *p, *p2, *val;struct symbol *sym;int i, def_flags; -const char *warn_unknown, *werror, *sym_name; +const char *warn_unknown, *sym_name; warn_unknown =getenv ("KCONFIG_WARN_UNKNOWN_SYMBOLS" ); - werror =getenv ("KCONFIG_WERROR" );if (name) { in =zconf_fopen (name); }else {
@@ -513,9 +519,6 @@ int conf_read_simple(const char *name, int def)free (line);fclose (in); -if (conf_warnings && werror) -exit (1 ); -return 0 ; }
scripts/kconfig/lkc_proto.h +2 -0
@@ -12,6 +12,7 @@ void conf_set_changed(bool val);bool conf_get_changed (void );void conf_set_changed_callback (void (*fn)(void ));void conf_set_message_callback (void (*fn)(const char *s)); +bool conf_errors (void );/* symbol.c */ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE ];
@@ -22,6 +23,7 @@ void print_symbol_for_listconfig(struct symbol *sym);struct symbol **sym_re_search (const char *pattern);const char *sym_type_name (enum symbol_type type);void sym_calc_value (struct symbol *sym); +bool sym_dep_errors (void );enum symbol_type sym_get_type (struct symbol *sym);bool sym_tristate_within_range (struct symbol *sym,tristate tri);bool sym_set_tristate_value (struct symbol *sym,tristate tri);
scripts/kconfig/symbol.c +9 -0
@@ -40,6 +40,7 @@ static struct symbol symbol_empty = {struct symbol *modules_sym;static tristate modules_val; +static int sym_warnings;enum symbol_type sym_get_type (struct symbol *sym) {
@@ -320,6 +321,14 @@ static void sym_warn_unmet_dep(struct symbol *sym) " Selected by [m]:\n");fputs (str_get (&gs), stderr); + sym_warnings++; +} + +bool sym_dep_errors (void ) +{ +if (sym_warnings) +return getenv ("KCONFIG_WERROR" ); +return false; }void sym_calc_value (struct symbol *sym)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 364/393 kconfig: fix memory leak in sym_warn_unmet_dep()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit a409fc1463d664002ea9bf700ae4674df03de111 ]
The string allocated in sym_warn_unmet_dep() is never freed, leading to a memory leak when an unmet dependency is detected.
--- scripts/kconfig/symbol.c | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/symbol.c +1 -0
@@ -321,6 +321,7 @@ static void sym_warn_unmet_dep(struct symbol *sym) " Selected by [m]:\n");fputs (str_get (&gs), stderr); +str_free (&gs); sym_warnings++; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 365/393 hexagon: fix using plain integer as NULL pointer warning in cmpxchg
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit 8a20030038742b9915c6d811a4e6c14b126cafb4 ]
Sparse reports
net/ipv4/inet_diag.c:1511:17: sparse: sparse: Using plain integer as NULL pointer
Due to this code calling cmpxchg on a non-integer type struct inet_diag_handler *
return !cmpxchg((const struct inet_diag_handler**)&inet_diag_table[type],
NULL, h) ? 0 : -EEXIST;
While hexagon's cmpxchg assigns an integer value to a variable of this type.
__typeof__(*(ptr)) __oldval = 0;
Update this assignment to cast 0 to the correct type.
The original issue is easily reproduced at head with the below block, and is absent after this change.
make LLVM=1 ARCH=hexagon defconfig
make C=1 LLVM=1 ARCH=hexagon net/ipv4/inet_diag.o
--- arch/hexagon/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/include/asm/cmpxchg.h +1 -1
@@ -56,7 +56,7 @@ __arch_xchg(unsigned long x, volatile void *ptr, int size)__typeof__ (ptr) __ptr = (ptr); \ __typeof__(*(ptr)) __old = (old); \ __typeof__(*(ptr)) __new = (new); \ - __typeof__(*(ptr)) __oldval = 0; \ + __typeof__(*(ptr)) __oldval = (__typeof__(*(ptr))) 0; \ \ asmvolatile ( \ "1: %0 = memw_locked(%1);\n" \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 366/393 hexagon: Fix unbalanced spinlock in die()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Yujun <[email protected]>
[ Upstream commit 03410e87563a122075c3721acc7d5510e41d8332 ]
die executes holding the spinlock of &die.lock and unlock it after printing the oops message.
However in the code if the notify_die() returns NOTIFY_STOP , die() exit with returning 1 but never unlocked the spinlock.
Fix this by adding spin_unlock_irq(&die.lock) before returning.
--- arch/hexagon/kernel/traps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/hexagon/kernel/traps.c +3 -1
@@ -195,8 +195,10 @@ int die(const char *str, struct pt_regs *regs, long err)printk (KERN_EMERG "Oops: %s[#%d]:\n" , str, ++die.counter);if (notify_die (DIE_OOPS , str, regs, err,pt_cause (regs),SIGSEGV ) == -NOTIFY_STOP ) +NOTIFY_STOP ) { +spin_unlock_irq (&die.lock);return 1 ; + }print_modules ();show_regs (regs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 367/393 f2fs: Introduce linear search for dentries
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lee <[email protected]>
commit 91b587ba79e1b68bb718d12b0758dbcdab4e9cb7 upstream.
This patch addresses an issue where some files in case-insensitive directories become inaccessible due to changes in how the kernel function, utf8_casefold(), generates case-folded strings from the commit 5c26d2f1d3f5 ("unicode: Don't special case ignorable code points").
F2FS uses these case-folded names to calculate hash values for locating dentries and stores them on disk. Since utf8_casefold() can produce different output across kernel versions, stored hash values and newly calculated hash values may differ. This results in affected files no longer being found via the hash-based lookup.
To resolve this, the patch introduces a linear search fallback. If the initial hash-based search fails, F2FS will sequentially scan the directory entries.
--- fs/f2fs/dir.c | 53 ++++++++++++++++++++++++++++++++++++++--------------- fs/f2fs/f2fs.h | 6 ++++-- fs/f2fs/inline.c | 5 +++-- 3 files changed, 45 insertions(+), 19 deletions(-)
fs/f2fs/dir.c +38 -15
@@ -166,7 +166,8 @@ static unsigned long dir_block_index(unsstatic struct f2fs_dir_entry *find_in_block (struct inode *dir,struct page *dentry_page,const struct f2fs_filename *fname, -int *max_slots) +int *max_slots, +bool use_hash) {struct f2fs_dentry_block *dentry_blk;struct f2fs_dentry_ptr d;
@@ -174,7 +175,7 @@ static struct f2fs_dir_entry *find_in_bl dentry_blk = (struct f2fs_dentry_block *)page_address (dentry_page);make_dentry_ptr_block (dir, &d, dentry_blk); -return f2fs_find_target_dentry (&d, fname, max_slots); +return f2fs_find_target_dentry (&d, fname, max_slots, use_hash); }#if IS_ENABLED (CONFIG_UNICODE )
@@ -251,7 +252,8 @@ static inline int f2fs_match_name(const }struct f2fs_dir_entry *f2fs_find_target_dentry (const struct f2fs_dentry_ptr *d, -const struct f2fs_filename *fname,int *max_slots) +const struct f2fs_filename *fname,int *max_slots, +bool use_hash) {struct f2fs_dir_entry *de;unsigned long bit_pos =0 ;
@@ -274,7 +276,7 @@ struct f2fs_dir_entry *f2fs_find_target_continue ; } -if (de->hash_code == fname->hash) { +if (!use_hash || de->hash_code == fname->hash) { res =f2fs_match_name (d->inode, fname, d->filename[bit_pos],le16_to_cpu (de->name_len));
@@ -301,11 +303,12 @@ found:static struct f2fs_dir_entry *find_in_level (struct inode *dir,unsigned int level,const struct f2fs_filename *fname, -struct page **res_page) +struct page **res_page, +bool use_hash) {int s =GET_DENTRY_SLOTS (fname->disk_name.len);unsigned int nbucket, nblock; -unsigned int bidx, end_block; +unsigned int bidx, end_block, bucket_no;struct page *dentry_page;struct f2fs_dir_entry *de =NULL ;pgoff_t next_pgofs;
@@ -315,8 +318,11 @@ static struct f2fs_dir_entry *find_in_le nbucket =dir_buckets (level,F2FS_I (dir)->i_dir_level); nblock =bucket_blocks (level); + bucket_no = use_hash ?le32_to_cpu (fname->hash) % nbucket :0 ; + +start_find_bucket: bidx =dir_block_index (level,F2FS_I (dir)->i_dir_level, -le32_to_cpu (fname->hash) % nbucket); + bucket_no); end_block = bidx + nblock;while (bidx < end_block) {
@@ -333,7 +339,7 @@ static struct f2fs_dir_entry *find_in_le } } - de =find_in_block (dir, dentry_page, fname, &max_slots); + de =find_in_block (dir, dentry_page, fname, &max_slots, use_hash);if (IS_ERR (de)) { *res_page =ERR_CAST (de); de =NULL ;
@@ -350,12 +356,18 @@ static struct f2fs_dir_entry *find_in_le bidx++; } -if (!de && room &&F2FS_I (dir)->chash != fname->hash) { -F2FS_I (dir)->chash = fname->hash; -F2FS_I (dir)->clevel = level; - } +if (de) +return de; -return de; +if (likely (use_hash)) { +if (room &&F2FS_I (dir)->chash != fname->hash) { +F2FS_I (dir)->chash = fname->hash; +F2FS_I (dir)->clevel = level; + } + }else if (++bucket_no < nbucket) { + goto start_find_bucket; + } +return NULL ; } struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
@@ -366,11 +378,15 @@ struct f2fs_dir_entry *__f2fs_find_entrystruct f2fs_dir_entry *de =NULL ;unsigned int max_depth;unsigned int level; +bool use_hash = true; *res_page =NULL ; +#if IS_ENABLED (CONFIG_UNICODE ) +start_find_entry: +#endif if (f2fs_has_inline_dentry (dir)) { - de =f2fs_find_in_inline_dir (dir, fname, res_page); + de =f2fs_find_in_inline_dir (dir, fname, res_page, use_hash); goto out; }
@@ -386,11 +402,18 @@ struct f2fs_dir_entry *__f2fs_find_entry }for (level =0 ; level < max_depth; level++) { - de =find_in_level (dir, level, fname, res_page); + de =find_in_level (dir, level, fname, res_page, use_hash);if (de ||IS_ERR (*res_page))break ; } + out: +#if IS_ENABLED (CONFIG_UNICODE ) +if (IS_CASEFOLDED (dir) && !de && use_hash) { + use_hash = false; + goto start_find_entry; + } +#endif /* This is to increase the speed of f2fs_create */ if (!de)F2FS_I (dir)->task = current;
fs/f2fs/f2fs.h +4 -2
@@ -3531,7 +3531,8 @@ int f2fs_prepare_lookup(struct inode *di struct f2fs_filename *fname);void f2fs_free_filename (struct f2fs_filename *fname);struct f2fs_dir_entry *f2fs_find_target_dentry (const struct f2fs_dentry_ptr *d, -const struct f2fs_filename *fname,int *max_slots); +const struct f2fs_filename *fname,int *max_slots, +bool use_hash);int f2fs_fill_dentries (struct dir_context *ctx,struct f2fs_dentry_ptr *d,unsigned int start_pos,struct fscrypt_str *fstr); void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent,
@@ -4148,7 +4149,8 @@ int f2fs_write_inline_data(struct inodeint f2fs_recover_inline_data (struct inode *inode,struct page *npage);struct f2fs_dir_entry *f2fs_find_in_inline_dir (struct inode *dir,const struct f2fs_filename *fname, -struct page **res_page); +struct page **res_page, +bool use_hash);int f2fs_make_empty_inline_dir (struct inode *inode,struct inode *parent,struct page *ipage); int f2fs_add_inline_entry(struct inode *dir, const struct f2fs_filename *fname,
fs/f2fs/inline.c +3 -2
@@ -353,7 +353,8 @@ process_inline:struct f2fs_dir_entry *f2fs_find_in_inline_dir (struct inode *dir,const struct f2fs_filename *fname, -struct page **res_page) +struct page **res_page, +bool use_hash) {struct f2fs_sb_info *sbi =F2FS_SB (dir->i_sb);struct f2fs_dir_entry *de;
@@ -370,7 +371,7 @@ struct f2fs_dir_entry *f2fs_find_in_inli inline_dentry =inline_data_addr (dir, ipage);make_dentry_ptr_inline (dir, &d, inline_dentry); - de =f2fs_find_target_dentry (&d, fname,NULL ); + de =f2fs_find_target_dentry (&d, fname,NULL , use_hash);unlock_page (ipage);if (IS_ERR (de)) { *res_page =ERR_CAST (de);
Greg Kroah-Hartman
maintainerPATCH 368/393 NFSD: Reset cb_seq_status after NFS4ERR_DELAY
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 961b4b5e86bf56a2e4b567f81682defa5cba957e upstream.
I noticed that once an NFSv4.1 callback operation gets a NFS4ERR_DELAY status on CB_SEQUENCE and then the connection is lost, the callback client loops, resending it indefinitely.
The switch arm in nfsd4_cb_sequence_done() that handles NFS4ERR_DELAY uses rpc_restart_call() to rearm the RPC state machine for the retransmit, but that path does not call the rpc_prepare_call callback again. Thus cb_seq_status is set to -10008 by the first NFS4ERR_DELAY result, but is never set back to 1 for the retransmits.
nfsd4_cb_sequence_done() thinks it's getting nothing but a long series of CB_SEQUENCE NFS4ERR_DELAY replies.
--- fs/nfsd/nfs4callback.c | 1 + 1 file changed, 1 insertion(+)
fs/nfsd/nfs4callback.c +1 -0
@@ -1202,6 +1202,7 @@ static bool nfsd4_cb_sequence_done(struc ret = false;break ;case -NFS4ERR_DELAY : + cb->cb_seq_status =1 ;if (!rpc_restart_call (task)) goto out;
Greg Kroah-Hartman
maintainerPATCH 369/393 Revert "SUNRPC: Reduce thread wake-up rate when receiving large RPC messages"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 966a675da844f1a764bb44557c21561cc3d09840 upstream.
I noticed that a handful of NFSv3 fstests were taking an unexpectedly long time to run. Troubleshooting showed that the server's TCP window closed and never re-opened, which caused the client to trigger an RPC retransmit timeout after 180 seconds.
The client's recovery action was to establish a fresh connection and retransmit the timed-out requests. This worked, but it adds a long delay.
I tracked the problem to the commit that attempted to reduce the rate at which the network layer delivers TCP socket data_ready callbacks. Under most circumstances this change worked as expected, but for NFSv3, which has no session or other type of throttling, it can overwhelm the receiver on occasion.
I'm sure I could tweak the lowat settings, but the small benefit doesn't seem worth the bother. Just revert it.
--- net/sunrpc/svcsock.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
net/sunrpc/svcsock.c +1 -11
@@ -1093,9 +1093,6 @@ static void svc_tcp_fragment_received(st/* If we have more data, signal svc_xprt_enqueue() to try again */ svsk->sk_tcplen =0 ; svsk->sk_marker = xdr_zero; - -smp_wmb (); -tcp_set_rcvlowat (svsk->sk_sk,1 ); }/**
@@ -1185,17 +1182,10 @@ err_incomplete: goto err_delete;if (len == want)svc_tcp_fragment_received (svsk); -else { -/* Avoid more ->sk_data_ready() calls until the rest -* of the message has arrived. This reduces service -* thread wake-ups on large incoming messages. */ -tcp_set_rcvlowat (svsk->sk_sk, -svc_sock_reclen (svsk) - svsk->sk_tcplen); - +else trace_svcsock_tcp_recv_short (&svsk->sk_xprt,svc_sock_reclen (svsk), svsk->sk_tcplen -sizeof (rpc_fraghdr)); - } goto err_noclose; error:if (len != -EAGAIN )
Greg Kroah-Hartman
maintainerPATCH 370/393 kbuild: switch from lz4c to lz4 for compression
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parth Pancholi <[email protected]>
commit e397a603e49cc7c7c113fad9f55a09637f290c34 upstream.
Replace lz4c with lz4 for kernel image compression.
Although lz4 and lz4c are functionally similar, lz4c has been deprecated upstream since 2018. Since as early as Ubuntu 16.04 and Fedora 25, lz4 and lz4c have been packaged together, making it safe to update the requirement from lz4c to lz4.
Consequently, some distributions and build systems, such as OpenEmbedded, have fully transitioned to using lz4. OpenEmbedded core adopted this change in commit fe167e082cbd ("bitbake.conf: require lz4 instead of lz4c"), causing compatibility issues when building the mainline kernel in the latest OpenEmbedded environment, as seen in the errors below.
This change also updates the LZ4 compression commands to make it backward compatible by replacing stdin and stdout with the '-' option, due to some unclear reason, the stdout keyword does not work for lz4 and '-' works for both. In addition, this modifies the legacy '-c1' with '-9' which is also compatible with both. This fixes the mainline kernel build failures with the latest master OpenEmbedded builds associated with the mentioned compatibility issues.
LZ4 arch/arm/boot/compressed/piggy_data/bin/sh: 1: lz4c: not found
...
...
ERROR: oe_runmake failed
--- Makefile | 2 +- scripts/Makefile.lib | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Makefile +1 -1
@@ -518,7 +518,7 @@ KGZIP = gzip KBZIP2 = bzip2 KLZOP = lzop LZMA = lzma -LZ4 = lz4c +LZ4 = lz4 XZ = xz ZSTD = zstd
scripts/Makefile.lib +2 -2
@@ -472,10 +472,10 @@ quiet_cmd_lzo_with_size = LZO $@ cmd_lzo_with_size = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@ quiet_cmd_lz4 = LZ4 $@ - cmd_lz4 = cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout > $@ + cmd_lz4 = cat $(real-prereqs) | $(LZ4) -l -9 - - > $@ quiet_cmd_lz4_with_size = LZ4 $@ - cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \ + cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -9 - -; \ $(size_append); } > $@ # U-Boot mkimage
Greg Kroah-Hartman
maintainerPATCH 371/393 netfilter: nf_tables: reject mismatching sum of field_len with set key length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
commit 1b9335a8000fb70742f7db10af314104b6ace220 upstream.
The field length description provides the length of each separated key field in the concatenation, each field gets rounded up to 32-bits to calculate the pipapo rule width from pipapo_init(). The set key length provides the total size of the key aligned to 32-bits.
Register-based arithmetics still allows for combining mismatching set key length and field length description, eg. set key length 10 and field description [ 5, 4 ] leading to pipapo width of 12.
--- net/netfilter/nf_tables_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +4 -4
@@ -4875,7 +4875,7 @@ static int nft_set_desc_concat_parse(constatic int nft_set_desc_concat (struct nft_set_desc *desc,const struct nlattr *nla) { -u32 num_regs =0 , key_num_regs =0 ; +u32 len =0 , num_regs;struct nlattr *attr;int rem, err, i;
@@ -4889,12 +4889,12 @@ static int nft_set_desc_concat(struct nf }for (i =0 ; i < desc->field_count; i++) - num_regs +=DIV_ROUND_UP (desc->field_len[i],sizeof (u32)); + len +=round_up (desc->field_len[i],sizeof (u32)); - key_num_regs =DIV_ROUND_UP (desc->klen,sizeof (u32)); -if (key_num_regs != num_regs) +if (len != desc->klen)return -EINVAL ; + num_regs =DIV_ROUND_UP (desc->klen,sizeof (u32));if (num_regs >NFT_REG32_COUNT )return -E2BIG ;
Greg Kroah-Hartman
maintainerPATCH 372/393 selftests/rseq: Fix handling of glibc without rseq support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Desnoyers <[email protected]>
commit 336d02bc4c6bec5c3d933e5d470a94970f830957 upstream.
When porting librseq commit:
commit c7b45750fa85 ("Adapt to glibc __rseq_size feature detection")
from librseq to the kernel selftests, the following line was missed at the end of rseq_init():
rseq_size = get_rseq_kernel_feature_size();
which effectively leaves rseq_size initialized to -1U when glibc does not have rseq support. glibc supports rseq from version 2.35 onwards.
In a following librseq commit
commit c67d198627c2 ("Only set 'rseq_size' on first thread registration")
to mimic the libc behavior, a new approach is taken: don't set the feature size in 'rseq_size' until at least one thread has successfully registered. This allows using 'rseq_size' in fast-paths to test for both registration status and available features. The caveat is that on libc either all threads are registered or none are, while with bare librseq it is the responsability of the user to register all threads using rseq.
This combines the changes from the following librseq git commits:
commit c7b45750fa85 ("Adapt to glibc __rseq_size feature detection") commit c67d198627c2 ("Only set 'rseq_size' on first thread registration")
--- tools/testing/selftests/rseq/rseq.c | 32 ++++++++++++++++++++++------- tools/testing/selftests/rseq/rseq.h | 9 +++++++- 2 files changed, 33 insertions(+), 8 deletions(-)
tools/testing/selftests/rseq/rseq.c +25 -7
@@ -61,7 +61,6 @@ unsigned int rseq_size = -1U;unsigned int rseq_flags;static int rseq_ownership; -static int rseq_reg_success;/* At least one rseq registration has succeded. */ /* Allocate a large area for the TLS. */ #define RSEQ_THREAD_AREA_ALLOC_SIZE 1024
@@ -152,14 +151,27 @@ int rseq_register_current_thread(void) } rc =sys_rseq (&__rseq_abi,get_rseq_min_alloc_size (),0 ,RSEQ_SIG );if (rc) { -if (RSEQ_READ_ONCE (rseq_reg_success)) { +/* +* After at least one thread has registered successfully +* (rseq_size > 0), the registration of other threads should +* never fail. +*/ +if (RSEQ_READ_ONCE (rseq_size) >0 ) {/* Incoherent success/failure within process. */ abort (); }return -1 ; }assert (rseq_current_cpu_raw () >=0 ); -RSEQ_WRITE_ONCE (rseq_reg_success,1 ); + +/* +* The first thread to register sets the rseq_size to mimic the libc +* behavior. +*/ +if (RSEQ_READ_ONCE (rseq_size) ==0 ) { +RSEQ_WRITE_ONCE (rseq_size,get_rseq_kernel_feature_size ()); + } +return 0 ; }
@@ -235,12 +247,18 @@ void rseq_init(void)return ; } rseq_ownership =1 ; -if (!rseq_available ()) { - rseq_size =0 ; -return ; - } + +/* Calculate the offset of the rseq area from the thread pointer. */ rseq_offset = (void *)&__rseq_abi -rseq_thread_pointer (); + +/* rseq flags are deprecated, always set to 0. */ rseq_flags =0 ; + +/* +* Set the size to 0 until at least one thread registers to mimic the +* libc behavior. +*/ + rseq_size =0 ; } static __attribute__((destructor))
tools/testing/selftests/rseq/rseq.h +8 -1
@@ -60,7 +60,14 @@extern ptrdiff_t rseq_offset;/* -* Size of the registered rseq area. 0 if the registration was +* The rseq ABI is composed of extensible feature fields. The extensions +* are done by appending additional fields at the end of the structure. +* The rseq_size defines the size of the active feature set which can be +* used by the application for the current rseq registration. Features +* starting at offset >= rseq_size are inactive and should not be used. +* +* The rseq_size is the intersection between the available allocation +* size for the rseq area and the feature size supported by the kernel. * unsuccessful. */ extern unsigned int rseq_size;
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 373/393 ktest.pl: Check kernelrelease return in get_version
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marliere <[email protected]>
commit a4e17a8f239a545c463f8ec27db4ed6e74b31841 upstream.
In the case of a test that uses the special option ${KERNEL_VERSION} in one of its settings but has no configuration available in ${OUTPUT_DIR}, for example if it's a new empty directory, then the make kernelrelease call will fail and the subroutine will chomp an empty string, silently. Fix that by adding an empty configuration and retrying.
--- tools/testing/ktest/ktest.pl | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/ktest/ktest.pl +5 -0
@@ -2406,6 +2406,11 @@ sub get_version { return if ($have_version); doprint "$make kernelrelease ... "; $version = `$make -s kernelrelease | tail -1`; + if (!length($version)) { + run_command "$make allnoconfig" or return 0; + doprint "$make kernelrelease ... "; + $version = `$make -s kernelrelease | tail -1`; + } chomp($version); doprint "$version\n"; $have_version = 1;
Greg Kroah-Hartman
maintainerPATCH 374/393 ALSA: usb-audio: Add delay quirk for iBasso DC07 Pro
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lianqin Hu <[email protected]>
commit d85fc52cbb9a719c8335d93a28d6a79d7acd419f upstream.
Audio control requests that sets sampling frequency sometimes fail on this card. Adding delay between control messages eliminates that problem.
usb 1-1: New USB device found, idVendor=2fc6, idProduct=f0b7 usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-1: Product: iBasso DC07 Pro
usb 1-1: Manufacturer: iBasso
usb 1-1: SerialNumber: CTUA171130B
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2243,6 +2243,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x2d95 ,0x8021 ,/* VIVO USB-C-XE710 HEADSET */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), +DEVICE_FLG (0x2fc6 ,0xf0b7 ,/* iBasso DC07 Pro */ +QUIRK_FLAG_CTL_MSG_DELAY_1M ),DEVICE_FLG (0x30be ,0x0101 ,/* Schiit Hel */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
Greg Kroah-Hartman
maintainerPATCH 375/393 net: usb: rtl8150: enable basic endpoint checking
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
commit 90b7f2961798793275b4844348619b622f983907 upstream.
Syzkaller reports [1] encountering a common issue of utilizing a wrong usb endpoint type during URB submitting stage. This, in turn, triggers a warning shown below.
For now, enable simple endpoint checking (specifically, bulk and interrupt eps, testing control one is not essential) to mitigate the issue with a view to do other related cosmetic changes later, if they are necessary.
[1] Syzkaller report:
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: CPU: 1 PID: 2586 at drivers/usb/core/urb.c:503 usb_submit_urb+0xe4b/0x1730 driv> Modules linked in: CPU: 1 UID: 0 PID: 2586 Comm: dhcpcd Not tainted 6.11.0-rc4-syzkaller-00069-gfc88bb11617> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:usb_submit_urb+0xe4b/0x1730 drivers/usb/core/urb.c:503 Code: 84 3c 02 00 00 e8 05 e4 fc fc 4c 89 ef e8 fd 25 d7 fe 45 89 e0 89 e9 4c 89 f2 48 8> RSP: 0018:ffffc9000441f740 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff888112487a00 RCX: ffffffff811a99a9 RDX: ffff88810df6ba80 RSI: ffffffff811a99b6 RDI: 0000000000000001 RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001 R13: ffff8881023bf0a8 R14: ffff888112452a20 R15: ffff888112487a7c FS: 00007fc04eea5740(0000) GS:ffff8881f6300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0a1de9f870 CR3: 000000010dbd0000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> rtl8150_open+0x300/0xe30 drivers/net/usb/rtl8150.c:733 __dev_open+0x2d4/0x4e0 net/core/dev.c:1474 __dev_change_flags+0x561/0x720 net/core/dev.c:8838 dev_change_flags+0x8f/0x160 net/core/dev.c:8910 devinet_ioctl+0x127a/0x1f10 net/ipv4/devinet.c:1177 inet_ioctl+0x3aa/0x3f0 net/ipv4/af_inet.c:1003 sock_do_ioctl+0x116/0x280 net/socket.c:1222 sock_ioctl+0x22e/0x6c0 net/socket.c:1341 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x193/0x220 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc04ef73d49
...
This change has not been tested on real hardware.
--- drivers/net/usb/rtl8150.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/net/usb/rtl8150.c +22 -0
@@ -71,6 +71,14 @@#define MSR_SPEED (1<<3)#define MSR_LINK (1<<2) +/* USB endpoints */ +enum rtl8150_usb_ep { +RTL8150_USB_EP_CONTROL =0 , +RTL8150_USB_EP_BULK_IN =1 , +RTL8150_USB_EP_BULK_OUT =2 , +RTL8150_USB_EP_INT_IN =3 , +}; +/* Interrupt pipe data */ #define INT_TSR 0x00#define INT_RSR 0x01
@@ -867,6 +875,13 @@ static int rtl8150_probe(struct usb_intestruct usb_device *udev =interface_to_usbdev (intf);rtl8150_t *dev;struct net_device *netdev; +static const u8 bulk_ep_addr[] = { +RTL8150_USB_EP_BULK_IN |USB_DIR_IN , +RTL8150_USB_EP_BULK_OUT |USB_DIR_OUT , +0 }; +static const u8 int_ep_addr[] = { +RTL8150_USB_EP_INT_IN |USB_DIR_IN , +0 }; netdev =alloc_etherdev (sizeof (rtl8150_t));if (!netdev)
@@ -880,6 +895,13 @@ static int rtl8150_probe(struct usb_intereturn -ENOMEM ; } +/* Verify that all required endpoints are present */ +if (!usb_check_bulk_endpoints (intf, bulk_ep_addr) || + !usb_check_int_endpoints (intf, int_ep_addr)) { +dev_err (&intf->dev,"couldn't find required endpoints\n" ); + goto out; + } +tasklet_setup (&dev->tl, rx_fixup);spin_lock_init (&dev->rx_pool_lock);
Greg Kroah-Hartman
maintainerPATCH 376/393 usb: xhci: Fix NULL pointer dereference on certain command aborts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 1e0a19912adb68a4b2b74fd77001c96cd83eb073 upstream.
If a command is queued to the final usable TRB of a ring segment, the enqueue pointer is advanced to the subsequent link TRB and no further. If the command is later aborted, when the abort completion is handled the dequeue pointer is advanced to the first TRB of the next segment.
If no further commands are queued, xhci_handle_stopped_cmd_ring() sees the ring pointers unequal and assumes that there is a pending command, so it calls xhci_mod_cmd_timer() which crashes if cur_cmd was NULL.
Don't attempt timer setup if cur_cmd is NULL. The subsequent doorbell ring likely is unnecessary too, but it's harmless. Leave it alone.
This is probably Bug 219532, but no confirmation has been received.
The issue has been independently reproduced and confirmed fixed using a USB MCU programmed to NAK the Status stage of SET_ADDRESS forever. Everything continued working normally after several prevented crashes.
--- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +2 -1
@@ -420,7 +420,8 @@ static void xhci_handle_stopped_cmd_ringif ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && !(xhci->xhc_state &XHCI_STATE_DYING )) { xhci->current_cmd = cur_cmd; -xhci_mod_cmd_timer (xhci); +if (cur_cmd) +xhci_mod_cmd_timer (xhci);xhci_ring_cmd_db (xhci); } }
Greg Kroah-Hartman
maintainerPATCH 377/393 drivers/card_reader/rtsx_usb: Restore interrupt based detection
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Rhodes <[email protected]>
commit 235b630eda072d7e7b102ab346d6b8a2c028a772 upstream.
This commit reintroduces interrupt-based card detection previously used in the rts5139 driver. This functionality was removed in commit 00d8521dcd23 ("staging: remove rts5139 driver code").
Reintroducing this mechanism fixes presence detection for certain card readers, which with the current driver, will taken approximately 20 seconds to enter S3 as mmc_rescan has to be frozen.
--- drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +15 -0
@@ -286,6 +286,7 @@ static int rtsx_usb_get_status_with_bulkint rtsx_usb_get_card_status (struct rtsx_ucr *ucr,u16 *status) {int ret; +u8 interrupt_val =0 ;u16 *buf;if (!status)
@@ -308,6 +309,20 @@ int rtsx_usb_get_card_status(struct rtsx ret =rtsx_usb_get_status_with_bulk (ucr, status); } +rtsx_usb_read_register (ucr,CARD_INT_PEND , &interrupt_val); +/* Cross check presence with interrupts */ +if (*status &XD_CD ) +if (!(interrupt_val &XD_INT )) + *status &= ~XD_CD ; + +if (*status &SD_CD ) +if (!(interrupt_val &SD_INT )) + *status &= ~SD_CD ; + +if (*status &MS_CD ) +if (!(interrupt_val &MS_INT )) + *status &= ~MS_CD ; +/* usb_control_msg may return positive when success */ if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 378/393 usb: gadget: f_tcm: Fix Get/SetInterface return value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 3b997089903b909684114aca6f79d683e5c64a0e upstream.
Check to make sure that the GetInterface and SetInterface are for valid interface. Return proper alternate setting number on GetInterface.
--- drivers/usb/gadget/function/f_tcm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +10 -2
@@ -2048,9 +2048,14 @@ static void tcm_delayed_set_alt(struct wstatic int tcm_get_alt (struct usb_function *f,unsigned intf) { -if (intf == bot_intf_desc.bInterfaceNumber) +struct f_uas *fu =to_f_uas (f); + +if (fu->iface != intf) +return -EOPNOTSUPP ; + +if (fu->flags &USBG_IS_BOT )return USB_G_ALT_INT_BBB ; -if (intf == uasp_intf_desc.bInterfaceNumber) +else if (fu->flags &USBG_IS_UAS )return USB_G_ALT_INT_UAS ;return -EOPNOTSUPP ;
@@ -2060,6 +2065,9 @@ static int tcm_set_alt(struct usb_functi {struct f_uas *fu =to_f_uas (f); +if (fu->iface != intf) +return -EOPNOTSUPP ; +if ((alt ==USB_G_ALT_INT_BBB ) || (alt ==USB_G_ALT_INT_UAS )) {struct guas_setup_wq *work;
Greg Kroah-Hartman
maintainerPATCH 379/393 usb: dwc3-am62: Fix an OF node leak in phy_syscon_pll_refclk()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
commit a266462b937beba065e934a563efe13dd246a164 upstream.
phy_syscon_pll_refclk() leaks an OF node obtained by of_parse_phandle_with_fixed_args(), thus add an of_node_put() call.
--- drivers/usb/dwc3/dwc3-am62.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-am62.c +1 -0
@@ -160,6 +160,7 @@ static int phy_syscon_pll_refclk(structif (ret)return ret; +of_node_put (args.np); am62->offset = args.args[0 ]; ret =regmap_update_bits (am62->syscon, am62->offset,PHY_PLL_REFCLK_MASK , am62->rate_code);
Greg Kroah-Hartman
maintainerPATCH 380/393 usb: dwc3: core: Defer the probe until USB power supply ready
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Tso <[email protected]>
commit 66e0ea341a2a78d14336117f19763bd9be26d45d upstream.
Currently, DWC3 driver attempts to acquire the USB power supply only once during the probe. If the USB power supply is not ready at that time, the driver simply ignores the failure and continues the probe, leading to permanent non-functioning of the gadget vbus_draw callback.
Address this problem by delaying the dwc3 driver initialization until the USB power supply is registered.
--- drivers/usb/dwc3/core.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/usb/dwc3/core.c +21 -9
@@ -1505,8 +1505,6 @@ static void dwc3_get_properties(struct du8 tx_thr_num_pkt_prd =0 ;u8 tx_max_burst_prd =0 ;u8 tx_fifo_resize_max_num; -const char *usb_psy_name; -int ret;/* default to highest possible threshold */ lpm_nyet_threshold =0xf ;
@@ -1541,13 +1539,6 @@ static void dwc3_get_properties(struct d dwc->sys_wakeup =device_may_wakeup (dwc->sysdev); - ret =device_property_read_string (dev,"usb-psy-name" , &usb_psy_name); -if (ret >=0 ) { - dwc->usb_psy =power_supply_get_by_name (usb_psy_name); -if (!dwc->usb_psy) -dev_err (dev,"couldn't get usb power supply\n" ); - } - dwc->has_lpm_erratum =device_property_read_bool (dev,"snps,has-lpm-erratum" ); device_property_read_u8(dev, "snps,lpm-nyet-threshold",
@@ -1887,6 +1878,23 @@ static int dwc3_get_clocks(struct dwc3 *return 0 ; } +static struct power_supply *dwc3_get_usb_power_supply (struct dwc3 *dwc) +{ +struct power_supply *usb_psy; +const char *usb_psy_name; +int ret; + + ret =device_property_read_string (dwc->dev,"usb-psy-name" , &usb_psy_name); +if (ret <0 ) +return NULL ; + + usb_psy =power_supply_get_by_name (usb_psy_name); +if (!usb_psy) +return ERR_PTR (-EPROBE_DEFER ); + +return usb_psy; +} +static int dwc3_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -1940,6 +1948,10 @@ static int dwc3_probe(struct platform_dedwc3_get_properties (dwc); + dwc->usb_psy =dwc3_get_usb_power_supply (dwc); +if (IS_ERR (dwc->usb_psy)) +return dev_err_probe (dev,PTR_ERR (dwc->usb_psy),"couldn't get usb power supply\n" ); + dwc->reset =devm_reset_control_array_get_optional_shared (dev);if (IS_ERR (dwc->reset)) { ret =PTR_ERR (dwc->reset);
Greg Kroah-Hartman
maintainerPATCH 381/393 usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jos Wang <[email protected]>
commit 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 upstream.
As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.
--- drivers/usb/typec/tcpm/tcpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +1 -1
@@ -4065,7 +4065,7 @@ static void run_state_machine(struct tcp port->caps_count =0 ; port->pd_capable = true;tcpm_set_state_cond (port,SRC_SEND_CAPABILITIES_TIMEOUT , -PD_T_SEND_SOURCE_CAP ); +PD_T_SENDER_RESPONSE ); }break ;case SRC_SEND_CAPABILITIES_TIMEOUT :
Greg Kroah-Hartman
maintainerPATCH 382/393 usb: typec: tcpci: Prevent Sink disconnection before vPpsShutdown in SPR PPS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Tso <[email protected]>
commit 4d27afbf256028a1f54363367f30efc8854433c3 upstream.
The Source can drop its output voltage to the minimum of the requested PPS APDO voltage range when it is in Current Limit Mode. If this voltage falls within the range of vPpsShutdown, the Source initiates a Hard Reset and discharges Vbus. However, currently the Sink may disconnect before the voltage reaches vPpsShutdown, leading to unexpected behavior.
Prevent premature disconnection by setting the Sink's disconnect threshold to the minimum vPpsShutdown value. Additionally, consider the voltage drop due to IR drop when calculating the appropriate threshold. This ensures a robust and reliable interaction between the Source and Sink during SPR PPS Current Limit Mode operation.
--- drivers/usb/typec/tcpm/tcpci.c | 13 +++++++++---- drivers/usb/typec/tcpm/tcpm.c | 8 +++++--- include/linux/usb/tcpm.h | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-)
drivers/usb/typec/tcpm/tcpci.c +9 -4
@@ -26,6 +26,7 @@#define VPPS_NEW_MIN_PERCENT 95#define VPPS_VALID_MIN_MV 100#define VSINKDISCONNECT_PD_MIN_PERCENT 90 +#define VPPS_SHUTDOWN_MIN_PERCENT 85struct tcpci {struct device *dev;
@@ -337,7 +338,8 @@ static int tcpci_enable_auto_vbus_discha }static int tcpci_set_auto_vbus_discharge_threshold (struct tcpc_dev *dev,enum typec_pwr_opmode mode, -bool pps_active,u32 requested_vbus_voltage_mv) +bool pps_active,u32 requested_vbus_voltage_mv, +u32 apdo_min_voltage_mv) {struct tcpci *tcpci =tcpc_to_tcpci (dev);unsigned int pwr_ctrl, threshold =0 ;
@@ -359,9 +361,12 @@ static int tcpci_set_auto_vbus_discharge threshold =AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV ; }else if (mode ==TYPEC_PWR_MODE_PD ) {if (pps_active) - threshold = ((VPPS_NEW_MIN_PERCENT * requested_vbus_voltage_mv /100 ) - -VSINKPD_MIN_IR_DROP_MV -VPPS_VALID_MIN_MV ) * -VSINKDISCONNECT_PD_MIN_PERCENT /100 ; +/* +* To prevent disconnect when the source is in Current Limit Mode. +* Set the threshold to the lowest possible voltage vPpsShutdown (min) +*/ + threshold =VPPS_SHUTDOWN_MIN_PERCENT * apdo_min_voltage_mv /100 - +VSINKPD_MIN_IR_DROP_MV ;else threshold = ((VSRC_NEW_MIN_PERCENT * requested_vbus_voltage_mv /100 ) - VSINKPD_MIN_IR_DROP_MV - VSRC_VALID_MIN_MV) *
drivers/usb/typec/tcpm/tcpm.c +5 -3
@@ -2326,10 +2326,12 @@ static int tcpm_set_auto_vbus_discharge_return 0 ; ret = port->tcpc->set_auto_vbus_discharge_threshold (port->tcpc, mode, pps_active, - requested_vbus_voltage); + requested_vbus_voltage, + port->pps_data.min_volt);tcpm_log_force (port, -"set_auto_vbus_discharge_threshold mode:%d pps_active:%c vbus:%u ret:%d" , - mode, pps_active ?'y' :'n' , requested_vbus_voltage, ret); +"set_auto_vbus_discharge_threshold mode:%d pps_active:%c vbus:%u pps_apdo_min_volt:%u ret:%d" , + mode, pps_active ?'y' :'n' , requested_vbus_voltage, + port->pps_data.min_volt, ret);return ret; }
include/linux/usb/tcpm.h +2 -1
@@ -150,7 +150,8 @@ struct tcpc_dev {void (*frs_sourcing_vbus)(struct tcpc_dev *dev);int (*enable_auto_vbus_discharge)(struct tcpc_dev *dev,bool enable);int (*set_auto_vbus_discharge_threshold)(struct tcpc_dev *dev,enum typec_pwr_opmode mode, -bool pps_active,u32 requested_vbus_voltage); +bool pps_active,u32 requested_vbus_voltage, +u32 pps_apdo_min_voltage);bool (*is_vbus_vsafe0v)(struct tcpc_dev *dev);void (*set_partner_usb_comm_capable)(struct tcpc_dev *dev,bool enable);void (*check_contaminant)(struct tcpc_dev *dev);
Greg Kroah-Hartman
maintainerPATCH 383/393 mptcp: consolidate suboption status
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit c86b000782daba926c627d2fa00c3f60a75e7472 upstream.
MPTCP maintains the received sub-options status is the bitmask carrying the received suboptions and in several bitfields carrying per suboption additional info.
Zeroing the bitmask before parsing is not enough to ensure a consistent status, and the MPTCP code has to additionally clear some bitfiled depending on the actually parsed suboption.
The above schema is fragile, and syzbot managed to trigger a path where a relevant bitfield is not cleared/initialized:
BUG: KMSAN: uninit-value in __mptcp_expand_seq net/mptcp/options.c:1030 [inline] BUG: KMSAN: uninit-value in mptcp_expand_seq net/mptcp/protocol.h:864 [inline] BUG: KMSAN: uninit-value in ack_update_msk net/mptcp/options.c:1060 [inline] BUG: KMSAN: uninit-value in mptcp_incoming_options+0x2036/0x3d30 net/mptcp/options.c:1209 __mptcp_expand_seq net/mptcp/options.c:1030 [inline] mptcp_expand_seq net/mptcp/protocol.h:864 [inline] ack_update_msk net/mptcp/options.c:1060 [inline] mptcp_incoming_options+0x2036/0x3d30 net/mptcp/options.c:1209 tcp_data_queue+0xb4/0x7be0 net/ipv4/tcp_input.c:5233 tcp_rcv_established+0x1061/0x2510 net/ipv4/tcp_input.c:6264 tcp_v4_do_rcv+0x7f3/0x11a0 net/ipv4/tcp_ipv4.c:1916 tcp_v4_rcv+0x51df/0x5750 net/ipv4/tcp_ipv4.c:2351 ip_protocol_deliver_rcu+0x2a3/0x13d0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x336/0x500 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_rcv_finish+0x4a2/0x520 net/ipv4/ip_input.c:447 NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0xcd/0x380 net/ipv4/ip_input.c:567 __netif_receive_skb_one_core net/core/dev.c:5704 [inline] __netif_receive_skb+0x319/0xa00 net/core/dev.c:5817 process_backlog+0x4ad/0xa50 net/core/dev.c:6149 __napi_poll+0xe7/0x980 net/core/dev.c:6902 napi_poll net/core/dev.c:6971 [inline] net_rx_action+0xa5a/0x19b0 net/core/dev.c:7093 handle_softirqs+0x1a0/0x7c0 kernel/softirq.c:561 __do_softirq+0x14/0x1a kernel/softirq.c:595 do_softirq+0x9a/0x100 kernel/softirq.c:462 __local_bh_enable_ip+0x9f/0xb0 kernel/softirq.c:389 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline] __dev_queue_xmit+0x2758/0x57d0 net/core/dev.c:4493 dev_queue_xmit include/linux/netdevice.h:3168 [inline] neigh_hh_output include/net/neighbour.h:523 [inline] neigh_output include/net/neighbour.h:537 [inline] ip_finish_output2+0x187c/0x1b70 net/ipv4/ip_output.c:236 __ip_finish_output+0x287/0x810 ip_finish_output+0x4b/0x600 net/ipv4/ip_output.c:324 NF_HOOK_COND include/linux/netfilter.h:303 [inline] ip_output+0x15f/0x3f0 net/ipv4/ip_output.c:434 dst_output include/net/dst.h:450 [inline] ip_local_out net/ipv4/ip_output.c:130 [inline] __ip_queue_xmit+0x1f2a/0x20d0 net/ipv4/ip_output.c:536 ip_queue_xmit+0x60/0x80 net/ipv4/ip_output.c:550 __tcp_transmit_skb+0x3cea/0x4900 net/ipv4/tcp_output.c:1468 tcp_transmit_skb net/ipv4/tcp_output.c:1486 [inline] tcp_write_xmit+0x3b90/0x9070 net/ipv4/tcp_output.c:2829 __tcp_push_pending_frames+0xc4/0x380 net/ipv4/tcp_output.c:3012 tcp_send_fin+0x9f6/0xf50 net/ipv4/tcp_output.c:3618 __tcp_close+0x140c/0x1550 net/ipv4/tcp.c:3130 __mptcp_close_ssk+0x74e/0x16f0 net/mptcp/protocol.c:2496 mptcp_close_ssk+0x26b/0x2c0 net/mptcp/protocol.c:2550 mptcp_pm_nl_rm_addr_or_subflow+0x635/0xd10 net/mptcp/pm_netlink.c:889 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:924 [inline] mptcp_pm_flush_addrs_and_subflows net/mptcp/pm_netlink.c:1688 [inline] mptcp_nl_flush_addrs_list net/mptcp/pm_netlink.c:1709 [inline] mptcp_pm_nl_flush_addrs_doit+0xe10/0x1630 net/mptcp/pm_netlink.c:1750 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2542 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:726 ____sys_sendmsg+0x877/0xb60 net/socket.c:2583 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2637 __sys_sendmsg net/socket.c:2669 [inline] __do_sys_sendmsg net/socket.c:2674 [inline] __se_sys_sendmsg net/socket.c:2672 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2672 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 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 stored to memory at:
mptcp_get_options+0x2c0f/0x2f20 net/mptcp/options.c:397 mptcp_incoming_options+0x19a/0x3d30 net/mptcp/options.c:1150 tcp_data_queue+0xb4/0x7be0 net/ipv4/tcp_input.c:5233 tcp_rcv_established+0x1061/0x2510 net/ipv4/tcp_input.c:6264 tcp_v4_do_rcv+0x7f3/0x11a0 net/ipv4/tcp_ipv4.c:1916 tcp_v4_rcv+0x51df/0x5750 net/ipv4/tcp_ipv4.c:2351 ip_protocol_deliver_rcu+0x2a3/0x13d0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x336/0x500 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_rcv_finish+0x4a2/0x520 net/ipv4/ip_input.c:447 NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0xcd/0x380 net/ipv4/ip_input.c:567 __netif_receive_skb_one_core net/core/dev.c:5704 [inline] __netif_receive_skb+0x319/0xa00 net/core/dev.c:5817 process_backlog+0x4ad/0xa50 net/core/dev.c:6149 __napi_poll+0xe7/0x980 net/core/dev.c:6902 napi_poll net/core/dev.c:6971 [inline] net_rx_action+0xa5a/0x19b0 net/core/dev.c:7093 handle_softirqs+0x1a0/0x7c0 kernel/softirq.c:561 __do_softirq+0x14/0x1a kernel/softirq.c:595
Uninit was stored to memory at:
put_unaligned_be32 include/linux/unaligned.h:68 [inline] mptcp_write_options+0x17f9/0x3100 net/mptcp/options.c:1417 mptcp_options_write net/ipv4/tcp_output.c:465 [inline] tcp_options_write+0x6d9/0xe90 net/ipv4/tcp_output.c:759 __tcp_transmit_skb+0x294b/0x4900 net/ipv4/tcp_output.c:1414 tcp_transmit_skb net/ipv4/tcp_output.c:1486 [inline] tcp_write_xmit+0x3b90/0x9070 net/ipv4/tcp_output.c:2829 __tcp_push_pending_frames+0xc4/0x380 net/ipv4/tcp_output.c:3012 tcp_send_fin+0x9f6/0xf50 net/ipv4/tcp_output.c:3618 __tcp_close+0x140c/0x1550 net/ipv4/tcp.c:3130 __mptcp_close_ssk+0x74e/0x16f0 net/mptcp/protocol.c:2496 mptcp_close_ssk+0x26b/0x2c0 net/mptcp/protocol.c:2550 mptcp_pm_nl_rm_addr_or_subflow+0x635/0xd10 net/mptcp/pm_netlink.c:889 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:924 [inline] mptcp_pm_flush_addrs_and_subflows net/mptcp/pm_netlink.c:1688 [inline] mptcp_nl_flush_addrs_list net/mptcp/pm_netlink.c:1709 [inline] mptcp_pm_nl_flush_addrs_doit+0xe10/0x1630 net/mptcp/pm_netlink.c:1750 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2542 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:726 ____sys_sendmsg+0x877/0xb60 net/socket.c:2583 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2637 __sys_sendmsg net/socket.c:2669 [inline] __do_sys_sendmsg net/socket.c:2674 [inline] __se_sys_sendmsg net/socket.c:2672 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2672 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 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 stored to memory at:
mptcp_pm_add_addr_signal+0x3d7/0x4c0 mptcp_established_options_add_addr net/mptcp/options.c:666 [inline] mptcp_established_options+0x1b9b/0x3a00 net/mptcp/options.c:884 tcp_established_options+0x2c4/0x7d0 net/ipv4/tcp_output.c:1012 __tcp_transmit_skb+0x5b7/0x4900 net/ipv4/tcp_output.c:1333 tcp_transmit_skb net/ipv4/tcp_output.c:1486 [inline] tcp_write_xmit+0x3b90/0x9070 net/ipv4/tcp_output.c:2829 __tcp_push_pending_frames+0xc4/0x380 net/ipv4/tcp_output.c:3012 tcp_send_fin+0x9f6/0xf50 net/ipv4/tcp_output.c:3618 __tcp_close+0x140c/0x1550 net/ipv4/tcp.c:3130 __mptcp_close_ssk+0x74e/0x16f0 net/mptcp/protocol.c:2496 mptcp_close_ssk+0x26b/0x2c0 net/mptcp/protocol.c:2550 mptcp_pm_nl_rm_addr_or_subflow+0x635/0xd10 net/mptcp/pm_netlink.c:889 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:924 [inline] mptcp_pm_flush_addrs_and_subflows net/mptcp/pm_netlink.c:1688 [inline] mptcp_nl_flush_addrs_list net/mptcp/pm_netlink.c:1709 [inline] mptcp_pm_nl_flush_addrs_doit+0xe10/0x1630 net/mptcp/pm_netlink.c:1750 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2542 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:726 ____sys_sendmsg+0x877/0xb60 net/socket.c:2583 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2637 __sys_sendmsg net/socket.c:2669 [inline] __do_sys_sendmsg net/socket.c:2674 [inline] __se_sys_sendmsg net/socket.c:2672 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2672 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 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 stored to memory at:
mptcp_pm_add_addr_received+0x95f/0xdd0 net/mptcp/pm.c:235 mptcp_incoming_options+0x2983/0x3d30 net/mptcp/options.c:1169 tcp_data_queue+0xb4/0x7be0 net/ipv4/tcp_input.c:5233 tcp_rcv_state_process+0x2a38/0x49d0 net/ipv4/tcp_input.c:6972 tcp_v4_do_rcv+0xbf9/0x11a0 net/ipv4/tcp_ipv4.c:1939 tcp_v4_rcv+0x51df/0x5750 net/ipv4/tcp_ipv4.c:2351 ip_protocol_deliver_rcu+0x2a3/0x13d0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x336/0x500 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_rcv_finish+0x4a2/0x520 net/ipv4/ip_input.c:447 NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0xcd/0x380 net/ipv4/ip_input.c:567 __netif_receive_skb_one_core net/core/dev.c:5704 [inline] __netif_receive_skb+0x319/0xa00 net/core/dev.c:5817 process_backlog+0x4ad/0xa50 net/core/dev.c:6149 __napi_poll+0xe7/0x980 net/core/dev.c:6902 napi_poll net/core/dev.c:6971 [inline] net_rx_action+0xa5a/0x19b0 net/core/dev.c:7093 handle_softirqs+0x1a0/0x7c0 kernel/softirq.c:561 __do_softirq+0x14/0x1a kernel/softirq.c:595
Local variable mp_opt created at:
mptcp_incoming_options+0x119/0x3d30 net/mptcp/options.c:1127 tcp_data_queue+0xb4/0x7be0 net/ipv4/tcp_input.c:5233
The current schema is too fragile; address the issue grouping all the state-related data together and clearing the whole group instead of just the bitmask. This also cleans-up the code a bit, as there is no need to individually clear "random" bitfield in a couple of places any more.
--- net/mptcp/options.c | 13 +++++-------- net/mptcp/protocol.h | 30 ++++++++++++++++-------------- 2 files changed, 21 insertions(+), 22 deletions(-)
net/mptcp/options.c +5 -8
@@ -108,7 +108,6 @@ static void mptcp_parse_option(const str mp_opt->suboptions |=OPTION_MPTCP_DSS ; mp_opt->use_map =1 ; mp_opt->mpc_map =1 ; - mp_opt->use_ack =0 ; mp_opt->data_len =get_unaligned_be16 (ptr); ptr +=2 ; }
@@ -157,11 +156,6 @@ static void mptcp_parse_option(const strpr_debug ("DSS\n" ); ptr++; -/* we must clear 'mpc_map' be able to detect MP_CAPABLE -* map vs DSS map in mptcp_incoming_options(), and reconstruct -* map info accordingly -*/ - mp_opt->mpc_map =0 ; flags = (*ptr++) &MPTCP_DSS_FLAG_MASK ; mp_opt->data_fin = (flags &MPTCP_DSS_DATA_FIN ) !=0 ; mp_opt->dsn64 = (flags &MPTCP_DSS_DSN64 ) !=0 ;
@@ -369,8 +363,11 @@ void mptcp_get_options(const struct sk_bconst unsigned char *ptr;int length; -/* initialize option status */ - mp_opt->suboptions =0 ; +/* Ensure that casting the whole status to u32 is efficient and safe */ + BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); +BUILD_BUG_ON (!IS_ALIGNED (offsetof(struct mptcp_options_received , status), +sizeof (u32))); + *(u32 *)&mp_opt->status =0 ; length = (th->doff *4 ) -sizeof (struct tcphdr ); ptr = (const unsigned char *)(th +1 );
net/mptcp/protocol.h +16 -14
@@ -149,22 +149,24 @@ struct mptcp_options_received {u32 subflow_seq;u16 data_len;__sum16 csum; -u16 suboptions; +struct_group (status, + u16 suboptions; + u16 use_map:1, + dsn64:1, + data_fin:1, + use_ack:1, + ack64:1, + mpc_map:1, + reset_reason:4, + reset_transient:1, + echo:1, + backup:1, + deny_join_id0:1, + __unused:2; + ); +u8 join_id;u32 token;u32 nonce; - u16 use_map:1, - dsn64:1, - data_fin:1, - use_ack:1, - ack64:1, - mpc_map:1, - reset_reason:4, - reset_transient:1, - echo:1, - backup:1, - deny_join_id0:1, - __unused:2; -u8 join_id;u64 thmac;u8 hmac[MPTCPOPT_HMAC_LEN ];struct mptcp_addr_info addr;
Greg Kroah-Hartman
maintainerPATCH 384/393 mptcp: handle fastopen disconnect correctly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 619af16b3b57a3a4ee50b9a30add9ff155541e71 upstream.
Syzbot was able to trigger a data stream corruption:
WARNING: CPU: 0 PID: 9846 at net/mptcp/protocol.c:1024 __mptcp_clean_una+0xddb/0xff0 net/mptcp/protocol.c:1024 Modules linked in: CPU: 0 UID: 0 PID: 9846 Comm: syz-executor351 Not tainted 6.13.0-rc2-syzkaller-00059-g00a5acdbf398 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024 RIP: 0010:__mptcp_clean_una+0xddb/0xff0 net/mptcp/protocol.c:1024 Code: fa ff ff 48 8b 4c 24 18 80 e1 07 fe c1 38 c1 0f 8c 8e fa ff ff 48 8b 7c 24 18 e8 e0 db 54 f6 e9 7f fa ff ff e8 e6 80 ee f5 90 <0f> 0b 90 4c 8b 6c 24 40 4d 89 f4 e9 04 f5 ff ff 44 89 f1 80 e1 07 RSP: 0018:ffffc9000c0cf400 EFLAGS: 00010293 RAX: ffffffff8bb0dd5a RBX: ffff888033f5d230 RCX: ffff888059ce8000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc9000c0cf518 R08: ffffffff8bb0d1dd R09: 1ffff110170c8928 R10: dffffc0000000000 R11: ffffed10170c8929 R12: 0000000000000000 R13: ffff888033f5d220 R14: dffffc0000000000 R15: ffff8880592b8000 FS: 00007f6e866496c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6e86f491a0 CR3: 00000000310e6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __mptcp_clean_una_wakeup+0x7f/0x2d0 net/mptcp/protocol.c:1074 mptcp_release_cb+0x7cb/0xb30 net/mptcp/protocol.c:3493 release_sock+0x1aa/0x1f0 net/core/sock.c:3640 inet_wait_for_connect net/ipv4/af_inet.c:609 [inline] __inet_stream_connect+0x8bd/0xf30 net/ipv4/af_inet.c:703 mptcp_sendmsg_fastopen+0x2a2/0x530 net/mptcp/protocol.c:1755 mptcp_sendmsg+0x1884/0x1b10 net/mptcp/protocol.c:1830 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:726 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2583 ___sys_sendmsg net/socket.c:2637 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6e86ebfe69 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 1f 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6e86649168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f6e86f491b8 RCX: 00007f6e86ebfe69 RDX: 0000000030004001 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00007f6e86f491b0 R08: 00007f6e866496c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6e86f491bc R13: 000000000000006e R14: 00007ffe445d9420 R15: 00007ffe445d9508 </TASK>
The root cause is the bad handling of disconnect() generated internally by the MPTCP protocol in case of connect FASTOPEN errors.
Address the issue increasing the socket disconnect counter even on such a case, to allow other threads waiting on the same socket lock to properly error out.
--- net/mptcp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +3 -1
@@ -1768,8 +1768,10 @@ static int mptcp_sendmsg_fastopen(struct* see mptcp_disconnect(). * Attempt it again outside the problematic scope. */ -if (!mptcp_disconnect (sk,0 )) +if (!mptcp_disconnect (sk,0 )) { + sk->sk_disconnects++; sk->sk_socket->state =SS_UNCONNECTED ; + } }inet_clear_bit (DEFER_CONNECT , sk);
Greg Kroah-Hartman
maintainerPATCH 385/393 remoteproc: core: Fix ida_free call while not allocated
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaud Pouliquen <[email protected]>
commit 7378aeb664e5ebc396950b36a1f2dedf5aabec20 upstream.
In the rproc_alloc() function, on error, put_device(&rproc->dev) is called, leading to the call of the rproc_type_release() function. An error can occurs before ida_alloc is called.
In such case in rproc_type_release(), the condition (rproc->index >= 0) is true as rproc->index has been initialized to 0.ida_free() is called reporting a warning:
[ 4.181906] WARNING: CPU: 1 PID: 24 at lib/idr.c:525 ida_free+0x100/0x164 [ 4.186378] stm32-display-dsi 5a000000.dsi: Fixed dependency cycle(s) with /soc/dsi@5a000000/panel@0 [ 4.188854] ida_free called for id=0 which is not allocated. [ 4.198256] mipi-dsi 5a000000.dsi.0: Fixed dependency cycle(s) with /soc/dsi@5a000000 [ 4.203556] Modules linked in: panel_orisetech_otm8009a dw_mipi_dsi_stm(+) gpu_sched dw_mipi_dsi stm32_rproc stm32_crc32 stm32_ipcc(+) optee(+) [ 4.224307] CPU: 1 UID: 0 PID: 24 Comm: kworker/u10:0 Not tainted 6.12.0 #442 [ 4.231481] Hardware name: STM32 (Device Tree Support) [ 4.236627] Workqueue: events_unbound deferred_probe_work_func [ 4.242504] Call trace: [ 4.242522] unwind_backtrace from show_stack+0x10/0x14 [ 4.250218] show_stack from dump_stack_lvl+0x50/0x64 [ 4.255274] dump_stack_lvl from __warn+0x80/0x12c [ 4.260134] __warn from warn_slowpath_fmt+0x114/0x188 [ 4.265199] warn_slowpath_fmt from ida_free+0x100/0x164 [ 4.270565] ida_free from rproc_type_release+0x38/0x60 [ 4.275832] rproc_type_release from device_release+0x30/0xa0 [ 4.281601] device_release from kobject_put+0xc4/0x294 [ 4.286762] kobject_put from rproc_alloc.part.0+0x208/0x28c [ 4.292430] rproc_alloc.part.0 from devm_rproc_alloc+0x80/0xc4 [ 4.298393] devm_rproc_alloc from stm32_rproc_probe+0xd0/0x844 [stm32_rproc] [ 4.305575] stm32_rproc_probe [stm32_rproc] from platform_probe+0x5c/0xbc
Calling ida_alloc earlier in rproc_alloc ensures that the rproc->index is properly set.
--- drivers/remoteproc/remoteproc_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/remoteproc/remoteproc_core.c +7 -7
@@ -2465,6 +2465,13 @@ struct rproc *rproc_alloc(struct device rproc->dev.driver_data = rproc;idr_init (&rproc->notifyids); +/* Assign a unique device index and name */ + rproc->index =ida_alloc (&rproc_dev_index,GFP_KERNEL ); +if (rproc->index <0 ) { +dev_err (dev,"ida_alloc failed: %d\n" , rproc->index); + goto put_device; + } + rproc->name =kstrdup_const (name,GFP_KERNEL );if (!rproc->name) goto put_device;
@@ -2475,13 +2482,6 @@ struct rproc *rproc_alloc(struct deviceif (rproc_alloc_ops (rproc, ops)) goto put_device; -/* Assign a unique device index and name */ - rproc->index =ida_alloc (&rproc_dev_index,GFP_KERNEL ); -if (rproc->index <0 ) { -dev_err (dev,"ida_alloc failed: %d\n" , rproc->index); - goto put_device; - } -dev_set_name (&rproc->dev,"remoteproc%d" , rproc->index);atomic_set (&rproc->power,0 );
Greg Kroah-Hartman
maintainerPATCH 386/393 media: uvcvideo: Fix double free in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit c6ef3a7fa97ec823a1e1af9085cf13db9f7b3bac upstream.
If the uvc_status_init() function fails to allocate the int_urb, it will free the dev->status pointer but doesn't reset the pointer to NULL. This results in the kfree() call in uvc_status_cleanup() trying to double-free the memory. Fix it by resetting the dev->status pointer to NULL after freeing it.
Reviewed by: Ricardo Ribalda <[email protected]>
--- drivers/media/usb/uvc/uvc_status.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/uvc/uvc_status.c +1 -0
@@ -269,6 +269,7 @@ int uvc_status_init(struct uvc_device *d dev->int_urb =usb_alloc_urb (0 ,GFP_KERNEL );if (!dev->int_urb) {kfree (dev->status); + dev->status =NULL ;return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 387/393 pps: Fix a use-after-free
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calvin Owens <[email protected]>
commit c79a39dc8d060b9e64e8b0fa9d245d44befeefbe upstream.
On a board running ntpd and gpsd, I'm seeing a consistent use-after-free in sys_exit() from gpsd when rebooting:
pps pps1: removed
------------[ cut here ]------------
kobject: '(null)' (00000000db4bec24): is not initialized, yet kobject_put() is being called.
WARNING: CPU: 2 PID: 440 at lib/kobject.c:734 kobject_put+0x120/0x150
CPU: 2 UID: 299 PID: 440 Comm: gpsd Not tainted 6.11.0-rc6-00308-gb31c44928842 #1
Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : kobject_put+0x120/0x150
lr : kobject_put+0x120/0x150
sp : ffffffc0803d3ae0
x29: ffffffc0803d3ae0 x28: ffffff8042dc9738 x27: 0000000000000001
x26: 0000000000000000 x25: ffffff8042dc9040 x24: ffffff8042dc9440
x23: ffffff80402a4620 x22: ffffff8042ef4bd0 x21: ffffff80405cb600
x20: 000000000008001b x19: ffffff8040b3b6e0 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 696e6920746f6e20
x14: 7369203a29343263 x13: 205d303434542020 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
kobject_put+0x120/0x150
cdev_put+0x20/0x3c
__fput+0x2c4/0x2d8
____fput+0x1c/0x38
task_work_run+0x70/0xfc
do_exit+0x2a0/0x924
do_group_exit+0x34/0x90
get_signal+0x7fc/0x8c0
do_signal+0x128/0x13b4
do_notify_resume+0xdc/0x160
el0_svc+0xd4/0xf8
el0t_64_sync_handler+0x140/0x14c
el0t_64_sync+0x190/0x194
---[ end trace 0000000000000000 ]---...followed by more symptoms of corruption, with similar stacks:
refcount_t: underflow; use-after-free.
kernel BUG at lib/list_debug.c:62!
Kernel panic - not syncing: Oops - BUG: Fatal exception
This happens because pps_device_destruct() frees the pps_device with the embedded cdev immediately after calling cdev_del(), but, as the comment above cdev_del() notes, fops for previously opened cdevs are still callable even after cdev_del() returns. I think this bug has always been there: I can't explain why it suddenly started happening every time I reboot this particular board.
In commit d953e0e837e6 ("pps: Fix a use-after free bug when unregistering a source."), George Spelvin suggested removing the embedded cdev. That seems like the simplest way to fix this, so I've implemented his suggestion, using __register_chrdev() with pps_idr becoming the source of truth for which minor corresponds to which device.
But now that pps_idr defines userspace visibility instead of cdev_add(), we need to be sure the pps->dev refcount can't reach zero while userspace can still find it again. So, the idr_remove() call moves to pps_unregister_cdev(), and pps_idr now holds a reference to pps->dev.
pps_core: source serial1 got cdev (251:1)
<...>
pps pps1: removed
pps_core: unregistering pps1
pps_core: deallocating pps1
--- drivers/pps/clients/pps-gpio.c | 4 - drivers/pps/clients/pps-ktimer.c | 4 - drivers/pps/clients/pps-ldisc.c | 6 - drivers/pps/clients/pps_parport.c | 4 - drivers/pps/kapi.c | 10 +- drivers/pps/kc.c | 10 +- drivers/pps/pps.c | 127 +++++++++++++++++++------------------- drivers/ptp/ptp_ocp.c | 2 include/linux/pps_kernel.h | 3 9 files changed, 87 insertions(+), 83 deletions(-)
drivers/pps/clients/pps-gpio.c +2 -2
@@ -214,8 +214,8 @@ static int pps_gpio_probe(struct platforreturn -EINVAL ; } -dev_info (data->pps->dev,"Registered IRQ %d as PPS source\n" , - data->irq); +dev_dbg (&data->pps->dev,"Registered IRQ %d as PPS source\n" , + data->irq);return 0 ; }
drivers/pps/clients/pps-ktimer.c +2 -2
@@ -56,7 +56,7 @@ static struct pps_source_info pps_ktimer static void __exit pps_ktimer_exit(void) { -dev_info (pps->dev,"ktimer PPS source unregistered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source unregistered\n" );del_timer_sync (&ktimer);pps_unregister_source (pps);
@@ -74,7 +74,7 @@ static int __init pps_ktimer_init(void)timer_setup (&ktimer, pps_ktimer_event,0 );mod_timer (&ktimer, jiffies +HZ ); -dev_info (pps->dev,"ktimer PPS source registered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source registered\n" );return 0 ; }
drivers/pps/clients/pps-ldisc.c +3 -3
@@ -32,7 +32,7 @@ static void pps_tty_dcd_change(struct ttpps_event (pps, &ts, active ?PPS_CAPTUREASSERT :PPS_CAPTURECLEAR ,NULL ); -dev_dbg (pps->dev,"PPS %s at %lu\n" , +dev_dbg (&pps->dev,"PPS %s at %lu\n" , active ?"assert" :"clear" , jiffies); }
@@ -69,7 +69,7 @@ static int pps_tty_open(struct tty_struc goto err_unregister; } -dev_info (pps->dev,"source \"%s\" added\n" , info.path); +dev_dbg (&pps->dev,"source \"%s\" added\n" , info.path);return 0 ;
@@ -89,7 +89,7 @@ static void pps_tty_close(struct tty_strif (WARN_ON (!pps))return ; -dev_info (pps->dev,"removed\n" ); +dev_info (&pps->dev,"removed\n" );pps_unregister_source (pps); }
drivers/pps/clients/pps_parport.c +2 -2
@@ -81,7 +81,7 @@ static void parport_irq(void *handle)/* check the signal (no signal means the pulse is lost this time) */ if (!signal_is_set (port)) {local_irq_restore (flags); -dev_err (dev->pps->dev,"lost the signal\n" ); +dev_err (&dev->pps->dev,"lost the signal\n" ); goto out_assert; }
@@ -98,7 +98,7 @@ static void parport_irq(void *handle)/* timeout */ dev->cw_err++;if (dev->cw_err >=CLEAR_WAIT_MAX_ERRORS ) { -dev_err (dev->pps->dev,"disabled clear edge capture after %d" +dev_err (&dev->pps->dev,"disabled clear edge capture after %d" " timeouts\n" , dev->cw_err); dev->cw =0 ; dev->cw_err =0 ;
drivers/pps/kapi.c +5 -5
@@ -41,7 +41,7 @@ static void pps_add_offset(struct pps_ktstatic void pps_echo_client_default (struct pps_device *pps,int event,void *data) { -dev_info (pps->dev,"echo %s %s\n" , +dev_info (&pps->dev,"echo %s %s\n" , event &PPS_CAPTUREASSERT ?"assert" :"" , event &PPS_CAPTURECLEAR ?"clear" :"" ); }
@@ -112,7 +112,7 @@ struct pps_device *pps_register_source(s goto kfree_pps; } -dev_info (pps->dev,"new PPS source %s\n" , info->name); +dev_dbg (&pps->dev,"new PPS source %s\n" , info->name);return pps;
@@ -166,7 +166,7 @@ void pps_event(struct pps_device *pps, s/* check event type */ BUG_ON ((event & (PPS_CAPTUREASSERT |PPS_CAPTURECLEAR )) ==0 ); -dev_dbg (pps->dev,"PPS event at %lld.%09ld\n" , +dev_dbg (&pps->dev,"PPS event at %lld.%09ld\n" , (s64 )ts->ts_real.tv_sec, ts->ts_real.tv_nsec);timespec_to_pps_ktime (&ts_real, ts->ts_real);
@@ -188,7 +188,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->assert_tu = ts_real; pps->assert_sequence++; -dev_dbg (pps->dev,"capture assert seq #%u\n" , +dev_dbg (&pps->dev,"capture assert seq #%u\n" , pps->assert_sequence); captured = ~0 ;
@@ -202,7 +202,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->clear_tu = ts_real; pps->clear_sequence++; -dev_dbg (pps->dev,"capture clear seq #%u\n" , +dev_dbg (&pps->dev,"capture clear seq #%u\n" , pps->clear_sequence); captured = ~0 ;
drivers/pps/kc.c +5 -5
@@ -43,11 +43,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel" +dev_info (&pps->dev,"unbound kernel" " consumer\n" ); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"selected kernel consumer" +dev_err (&pps->dev,"selected kernel consumer" " is not bound\n" );return -EINVAL ; }
@@ -57,11 +57,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode = bind_args->edge; pps_kc_hardpps_dev = pps;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"bound kernel consumer: " +dev_info (&pps->dev,"bound kernel consumer: " "edge=0x%x\n" , bind_args->edge); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"another kernel consumer" +dev_err (&pps->dev,"another kernel consumer" " is already bound\n" );return -EINVAL ; }
@@ -83,7 +83,7 @@ void pps_kc_remove(struct pps_device *pp pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel consumer" +dev_info (&pps->dev,"unbound kernel consumer" " on device removal\n" ); }else spin_unlock_irq (&pps_kc_hardpps_lock);
drivers/pps/pps.c +66 -61
288 lines not on this page · raw message
drivers/ptp/ptp_ocp.c +1 -1
@@ -4055,7 +4055,7 @@ ptp_ocp_complete(struct ptp_ocp *bp) pps =pps_lookup_dev (bp->ptp);if (pps) -ptp_ocp_symlink (bp, pps->dev,"pps" ); +ptp_ocp_symlink (bp, &pps->dev,"pps" );ptp_ocp_debugfs_add_device (bp);
include/linux/pps_kernel.h +1 -2
@@ -56,8 +56,7 @@ struct pps_device {unsigned int id;/* PPS source unique ID */ void const *lookup_cookie;/* For pps_lookup_dev() only */ -struct cdev cdev; -struct device *dev; +struct device dev;struct fasync_struct *async_queue;/* fasync method */ spinlock_t lock; };
Greg Kroah-Hartman
maintainerPATCH 388/393 usb: gadget: f_tcm: Dont free command immediately
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit c225d006a31949d673e646d585d9569bc28feeb9 upstream.
Don't prematurely free the command. Wait for the status completion of the sense status. It can be freed then. Otherwise we will double-free the command.
--- drivers/usb/gadget/function/f_tcm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -2
@@ -1066,7 +1066,6 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd,TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); -transport_generic_free_cmd (&cmd->se_cmd,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1195,7 +1194,6 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd,TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); -transport_generic_free_cmd (&cmd->se_cmd,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 389/393 staging: media: max96712: fix kernel oops when removing module
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Palcu <[email protected]>
commit ee1b5046d5cd892a0754ab982aeaaad3702083a5 upstream.
The following kernel oops is thrown when trying to remove the max96712 module:
Unable to handle kernel paging request at virtual address 00007375746174db
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010af89000 [00007375746174db] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in: crct10dif_ce polyval_ce mxc_jpeg_encdec flexcan
snd_soc_fsl_sai snd_soc_fsl_asoc_card snd_soc_fsl_micfil dwc_mipi_csi2
imx_csi_formatter polyval_generic v4l2_jpeg imx_pcm_dma can_dev
snd_soc_imx_audmux snd_soc_wm8962 snd_soc_imx_card snd_soc_fsl_utils
max96712(C-) rpmsg_ctrl rpmsg_char pwm_fan fuse
[last unloaded: imx8_isi]
CPU: 0 UID: 0 PID: 754 Comm: rmmod
Tainted: G C 6.12.0-rc6-06364-g327fec852c31 #17
Tainted: [C]=CRAP
Hardware name: NXP i.MX95 19X19 board (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : led_put+0x1c/0x40
lr : v4l2_subdev_put_privacy_led+0x48/0x58sp : ffff80008699bbb0
x29: ffff80008699bbb0 x28: ffff00008ac233c0 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
x23: ffff000080cf1170 x22: ffff00008b53bd00 x21: ffff8000822ad1c8
x20: ffff000080ff5c00 x19: ffff00008b53be40 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000004 x13: ffff0000800f8010 x12: 0000000000000000
x11: ffff000082acf5c0 x10: ffff000082acf478 x9 : ffff0000800f8010 x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff6364626d x5 : 8080808000000000 x4 : 0000000000000020 x3 : 00000000553a3dc1 x2 : ffff00008ac233c0 x1 : ffff00008ac233c0 x0 : ff00737574617473
Call trace: led_put+0x1c/0x40 v4l2_subdev_put_privacy_led+0x48/0x58 v4l2_async_unregister_subdev+0x2c/0x1a4 max96712_remove+0x1c/0x38 [max96712] i2c_device_remove+0x2c/0x9c device_remove+0x4c/0x80 device_release_driver_internal+0x1cc/0x228 driver_detach+0x4c/0x98 bus_remove_driver+0x6c/0xbc driver_unregister+0x30/0x60 i2c_del_driver+0x54/0x64 max96712_i2c_driver_exit+0x18/0x1d0 [max96712] __arm64_sys_delete_module+0x1a4/0x290 invoke_syscall+0x48/0x10c el0_svc_common.constprop.0+0xc0/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x34/0xd8 el0t_64_sync_handler+0x120/0x12c el0t_64_sync+0x190/0x194 Code: f9000bf3 aa0003f3 f9402800 f9402000 (f9403400) ---[ end trace 0000000000000000 ]---
This happens because in v4l2_i2c_subdev_init(), the i2c_set_cliendata() is called again and the data is overwritten to point to sd, instead of priv. So, in remove(), the wrong pointer is passed to v4l2_async_unregister_subdev(), leading to a crash.
--- drivers/staging/media/max96712/max96712.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/max96712/max96712.c +2 -2
@@ -402,7 +402,6 @@ static int max96712_probe(struct i2c_clireturn -ENOMEM ; priv->client = client; -i2c_set_clientdata (client, priv); priv->regmap =devm_regmap_init_i2c (client, &max96712_i2c_regmap);if (IS_ERR (priv->regmap))
@@ -435,7 +434,8 @@ static int max96712_probe(struct i2c_clistatic void max96712_remove (struct i2c_client *client) { -struct max96712_priv *priv =i2c_get_clientdata (client); +struct v4l2_subdev *sd =i2c_get_clientdata (client); + struct max96712_priv *priv = container_of(sd, struct max96712_priv, sd);v4l2_async_unregister_subdev (&priv->sd);
Greg Kroah-Hartman
maintainerPATCH 390/393 media: imx-jpeg: Fix potential error pointer dereference in detach_pm()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 1378ffec30367233152b7dbf4fa6a25ee98585d1 upstream.
The proble is on the first line:
if (jpeg->pd_dev[i] && !pm_runtime_suspended(jpeg->pd_dev[i]))
If jpeg->pd_dev[i] is an error pointer, then passing it to pm_runtime_suspended() will lead to an Oops. The other conditions check for both error pointers and NULL, but it would be more clear to use the IS_ERR_OR_NULL() check for that.
--- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +4 -3
@@ -2674,11 +2674,12 @@ static void mxc_jpeg_detach_pm_domains(sint i;for (i =0 ; i < jpeg->num_domains; i++) { -if (jpeg->pd_dev[i] && !pm_runtime_suspended (jpeg->pd_dev[i])) +if (!IS_ERR_OR_NULL (jpeg->pd_dev[i]) && + !pm_runtime_suspended (jpeg->pd_dev[i]))pm_runtime_force_suspend (jpeg->pd_dev[i]); -if (jpeg->pd_link[i] && !IS_ERR (jpeg->pd_link[i])) +if (!IS_ERR_OR_NULL (jpeg->pd_link[i]))device_link_del (jpeg->pd_link[i]); -if (jpeg->pd_dev[i] && !IS_ERR (jpeg->pd_dev[i])) +if (!IS_ERR_OR_NULL (jpeg->pd_dev[i]))dev_pm_domain_detach (jpeg->pd_dev[i], true); jpeg->pd_dev[i] =NULL ; jpeg->pd_link[i] =NULL ;
Greg Kroah-Hartman
maintainerPATCH 391/393 btrfs: output the reason for open_ctree() failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit d0f038104fa37380e2a725e669508e43d0c503e9 upstream.
There is a recent ML report that mounting a large fs backed by hardware RAID56 controller (with one device missing) took too much time, and systemd seems to kill the mount attempt.
In that case, the only error message is:
BTRFS error (device sdj): open_ctree failed
There is no reason on why the failure happened, making it very hard to understand the reason.
At least output the error number (in the particular case it should be -EINTR) to provide some clue.
--- fs/btrfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/super.c +1 -1
@@ -1162,7 +1162,7 @@ static int btrfs_fill_super(struct super err =open_ctree (sb, fs_devices, (char *)data);if (err) { -btrfs_err (fs_info,"open_ctree failed" ); +btrfs_err (fs_info,"open_ctree failed: %d" , err);return err; }
Greg Kroah-Hartman
maintainerPATCH 392/393 s390: Add -std=gnu11 to decompressor and purgatory CFLAGS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 3b8b80e993766dc96d1a1c01c62f5d15fafc79b9 upstream.
GCC changed the default C standard dialect from gnu17 to gnu23, which should not have impacted the kernel because it explicitly requests the gnu11 standard in the main Makefile. However, there are certain places in the s390 code that use their own CFLAGS without a '-std=' value, which break with this dialect change because of the kernel's own definitions of bool, false, and true conflicting with the C23 reserved keywords.
include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
11 | false = 0,
| ^~~~~
include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
35 | typedef _Bool bool;
| ^~~~ include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
Add '-std=gnu11' to the decompressor and purgatory CFLAGS to eliminate these errors and make the C standard version of these areas match the rest of the kernel.
--- arch/s390/Makefile | 2 +- arch/s390/purgatory/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/Makefile +1 -1
@@ -21,7 +21,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FL ifndef CONFIG_AS_IS_LLVM KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) endif -KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
arch/s390/purgatory/Makefile +1 -1
@@ -21,7 +21,7 @@ UBSAN_SANITIZE := n KASAN_SANITIZE := n KCSAN_SANITIZE := n -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes +KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
Greg Kroah-Hartman
maintainerPATCH 393/393 LoongArch: Change 8 to 14 for LOONGARCH_MAX_{BRP,WRP}
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
commit f502ea618bf16d615d7dc6138c8988d3118fe750 upstream.
The maximum number of load/store watchpoints and fetch instruction watchpoints is 14 each according to LoongArch Reference Manual, so change 8 to 14 for the related code.
--- arch/loongarch/include/asm/hw_breakpoint.h | 4 - arch/loongarch/include/asm/loongarch.h | 60 +++++++++++++++++++++++++++++ arch/loongarch/kernel/hw_breakpoint.c | 16 ++++++- 3 files changed, 76 insertions(+), 4 deletions(-)
arch/loongarch/include/asm/hw_breakpoint.h +2 -2
@@ -38,8 +38,8 @@ struct arch_hw_breakpoint {* Limits. * Changing these will require modifications to the register accessors. */ -#define LOONGARCH_MAX_BRP 8 -#define LOONGARCH_MAX_WRP 8 +#define LOONGARCH_MAX_BRP 14 +#define LOONGARCH_MAX_WRP 14/* Virtual debug register bases. */ #define CSR_CFG_ADDR 0
arch/loongarch/include/asm/loongarch.h +60 -0
72 lines not on this page · raw message
arch/loongarch/kernel/hw_breakpoint.c +14 -2
@@ -51,7 +51,13 @@ int hw_breakpoint_slots(int type)READ_WB_REG_CASE (OFF ,4 ,REG ,T ,VAL ); \READ_WB_REG_CASE (OFF ,5 ,REG ,T ,VAL ); \READ_WB_REG_CASE (OFF ,6 ,REG ,T ,VAL ); \ -READ_WB_REG_CASE (OFF ,7 ,REG ,T ,VAL ); +READ_WB_REG_CASE (OFF ,7 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,8 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,9 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,10 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,11 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,12 ,REG ,T ,VAL ); \ +READ_WB_REG_CASE (OFF ,13 ,REG ,T ,VAL );#define GEN_WRITE_WB_REG_CASES (OFF ,REG ,T ,VAL ) \ WRITE_WB_REG_CASE(OFF, 0, REG, T, VAL); \
@@ -61,7 +67,13 @@ int hw_breakpoint_slots(int type)WRITE_WB_REG_CASE (OFF ,4 ,REG ,T ,VAL ); \WRITE_WB_REG_CASE (OFF ,5 ,REG ,T ,VAL ); \WRITE_WB_REG_CASE (OFF ,6 ,REG ,T ,VAL ); \ -WRITE_WB_REG_CASE (OFF ,7 ,REG ,T ,VAL ); +WRITE_WB_REG_CASE (OFF ,7 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,8 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,9 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,10 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,11 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,12 ,REG ,T ,VAL ); \ +WRITE_WB_REG_CASE (OFF ,13 ,REG ,T ,VAL );static u64 read_wb_reg (int reg,int n,int t) {
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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 Fri, 07 Feb 2025 13:43:04 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.76-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.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 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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.
Am 05.02.2025 um 14:38 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.76 release. There are 393 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.6.76-rc1 on x86 and arm64 Azure VM.
Kernel binary size for x86 build:
text data bss dec hex filename 27313564 16700078 4653056 48666698 2e6984a vmlinux
Kernel binary size for arm64 build:
text data bss dec hex filename 34662827 13840370 970368 49473565 2f2e81d vmlinux
Thanks,
Hardik
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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 Fri, 07 Feb 2025 13:43:04 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.76-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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 Fri, 07 Feb 2025 13:43:04 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.76-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.6:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 115 pass, 1 failLinux version: 6.6.76-rc1-g3b8d2f9dc632
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-a04Test failures: tegra194-p2972-0000: pm-system-suspend.sh
Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.76 release. There are 393 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 Fri, 07 Feb 2025 13:43:04 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.76-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.6.76-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 3b8d2f9dc632278f4bc3589b49712b752cb93654
* git describe: v6.6.74-439-g3b8d2f9dc632
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.6.y/build/v6.6.74-439-g3b8d2f9dc632
## Test Regressions (compared to v6.6.74-44-g2c44b59139a8)
## Metric Regressions (compared to v6.6.74-44-g2c44b59139a8)
## Test Fixes (compared to v6.6.74-44-g2c44b59139a8)
## Metric Fixes (compared to v6.6.74-44-g2c44b59139a8)
## Test result summary
total: 71538, pass: 42664, fail: 17801, skip: 10732, xfail: 341
## Build Summary
* arc: 6 total, 5 passed, 1 failed
* arm: 133 total, 133 passed, 0 failed
* arm64: 46 total, 44 passed, 2 failed
* i386: 31 total, 28 passed, 3 failed
* mips: 30 total, 25 passed, 5 failed
* parisc: 5 total, 5 passed, 0 failed
* powerpc: 36 total, 32 passed, 4 failed
* riscv: 23 total, 22 passed, 1 failed
* s390: 18 total, 14 passed, 4 failed
* sh: 12 total, 10 passed, 2 failed
* sparc: 9 total, 8 passed, 1 failed
* x86_64: 38 total, 37 passed, 1 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org