6.6.158-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 134/1193 scripts: modpost: detect and report truncated buf_printf() output
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Courbot <[email protected]>
[ Upstream commit d7231d8cb262b1e350c00271bf53d54414b4f3b1 ]
buf_printf() uses a fixed-size stack buffer. vsnprintf() returns the number of bytes that *would* have been written to that buffer, which can be larger than the size of said buffer if the formatted string is too long.
The problem is that whenever this happens buf_printf() currently passes this length, unchecked, to buf_write(), which silently reads past the stack buffer and copies invalid data into the output buffer.
Fix this by detecting vsnprintf() failures and truncations before appending to the output buffer, and report a fatal error instead of producing corrupt symbol names.
--- scripts/mod/modpost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
scripts/mod/modpost.c +10 -1
@@ -1730,8 +1730,17 @@ void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf,va_start (ap, fmt); len =vsnprintf (tmp,SZ , fmt, ap); -buf_write (buf, tmp, len);va_end (ap); + +if (len <0 ) { +perror ("vsnprintf failed" ); +exit (1 ); + } +if (len >=SZ ) +fatal ("buf_printf output truncated for string %s: %d bytes needed, %d available\n" , + tmp, len +1 ,SZ ); + +buf_write (buf, tmp, len); }void buf_write (struct buffer *buf,const char *s,int len)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/1193 drm/nouveau/gsp: add SEC2 to GA100 chip table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
[ Upstream commit 604d0efb17cc0dd197e089134736ac2698d5fca7 ]
The booter-load and booter-unload firmware run on the SEC2 falcon. During tu102_gsp_oneinit(), the booter constructor needs device->sec2 to access the SEC2 falcon.
Without the .sec2 entry, device->sec2 is NULL and this dereference crashes during GSP-RM boot.
--- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2591,6 +2591,7 @@ nv170_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .ce = { 0x000003ff, ga100_ce_new }, .fifo = { 0x00000001, ga100_fifo_new }, + .sec2 = { 0x00000001, tu102_sec2_new }, }; static const struct nvkm_device_chip
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/1193 ASoC: Intel: catpt: Complete coredump handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 7e5d59f407bc39d43b350cc45f7880647429eb5d ]
An exception may occur during the firmware booting procedure. In such case the firmware sends COREDUMP_REQUESTS and expects the driver to dump relevant information and finish with the COREDUMP_RELEASE write.
To distinguish such situation from generic timeout, always signal fw_ready completion when a coredump request is received and translate it to -EREMOTEIO in catpt_boot_firmware().
The "FW READY" print makes the success clearly visible even when the event-traces are not enabled.
--- sound/soc/intel/catpt/ipc.c | 8 ++++++++ sound/soc/intel/catpt/loader.c | 3 +++ sound/soc/intel/catpt/registers.h | 12 ++++++++++++ 3 files changed, 23 insertions(+)
sound/soc/intel/catpt/ipc.c +8 -0
@@ -205,6 +205,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)memcpy_fromio (&config, cdev->lpe_ba + off,sizeof (config));trace_catpt_ipc_payload ((u8 *)&config,sizeof (config)); +dev_dbg (cdev->dev,"FW READY 0x%08x\n" , header);catpt_ipc_arm (ipc, &config);complete (&cdev->fw_ready);return ;
@@ -215,6 +216,13 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)dev_err (cdev->dev,"ADSP device coredump received\n" ); ipc->ready = false;catpt_coredump (cdev); + +if (catpt_readl_dram (cdev,COREDUMP ) ==CATPT_COREDUMP_REQUEST ) { +dev_dbg (cdev->dev,"releasing firmware from the coredump state\n" ); +catpt_writel_dram (cdev,COREDUMP ,CATPT_COREDUMP_RELEASE ); + } + +complete (&cdev->fw_ready);/* TODO: attempt recovery */ break ;
sound/soc/intel/catpt/loader.c +3 -0
@@ -626,6 +626,9 @@ int catpt_boot_firmware(struct catpt_dev *cdev, bool restore)if (!ret) {dev_err (cdev->dev,"firmware ready timeout\n" );return -ETIMEDOUT ; +/* Wake up does not mean FW is ready, an exception could occur. */ + }else if (!cdev->ipc.ready) { +return -EREMOTEIO ; }/* update sram pg & clock once done booting */
sound/soc/intel/catpt/registers.h +12 -0
@@ -124,6 +124,11 @@#define CATPT_SSCR2_DEFAULT 0x0#define CATPT_SSPSP2_DEFAULT 0x0 +/* Coredump register and its states */ +#define CATPT_DRAM_COREDUMP 0x1F4 +#define CATPT_COREDUMP_REQUEST UINT_MAX +#define CATPT_COREDUMP_RELEASE 0 +/* Physically the same block, access address differs between host and dsp */ #define CATPT_DSP_DRAM_OFFSET 0x400000#define catpt_to_host_offset (offset) ((offset) & ~(CATPT_DSP_DRAM_OFFSET))
@@ -137,6 +142,8 @@/* registry I/O helpers */ +#define catpt_dram_addr (cdev) \ + ((cdev)->lpe_ba + (cdev)->spec->host_dram_offset)#define catpt_shim_addr (cdev) \ ((cdev)->lpe_ba + (cdev)->spec->host_shim_offset)#define catpt_dma_addr (cdev, dma) \
@@ -151,6 +158,11 @@#define catpt_writel_ssp (cdev, ssp, reg, val) \ writel(val, catpt_ssp_addr(cdev, ssp) + (reg)) +#define catpt_readl_dram (cdev, reg) \ + readl(catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_writel_dram (cdev, reg, val) \ + writel(val, catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_readl_shim (cdev, reg) \ readl(catpt_shim_addr(cdev) + CATPT_SHIM_##reg)#define catpt_writel_shim (cdev, reg, val) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/1193 libbpf: Add __NR_bpf definition for LoongArch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit a4a5d4ee061240a1d39053db0a87f841d43277c0 ]
LoongArch uses the generic syscall table, where __NR_bpf is defined as 280 in include/uapi/asm-generic/unistd.h.
To align with other architectures, add the __NR_bpf definition for LoongArch to avoid a potential compilation failure: "error __NR_bpf not defined. libbpf does not support your arch."
This is a follow up patch of:
commit b0c47807d31d ("bpf: Add sparc support to tools and samples.") commit bad1926dd2f6 ("bpf, s390: fix build for libbpf and selftest suite") commit ca31ca8247e2 ("tools/bpf: fix perf build error with uClibc (seen on ARC)") commit e32cb12ff52a ("bpf, mips: Fix build errors about __NR_bpf undeclared")
--- tools/build/feature/test-bpf.c | 2 ++ tools/lib/bpf/bpf.c | 2 ++ 2 files changed, 4 insertions(+)
tools/build/feature/test-bpf.c +2 -0
@@ -20,6 +20,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
tools/lib/bpf/bpf.c +2 -0
@@ -59,6 +59,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/1193 soundwire: dmi-quirks: Disable ghost Realtek devices
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 4dab2b904414fac53535c4e4cdad808132f4cdc2 ]
Many systems ship with a Realtek audio codec in the ACPI that doesn't physically exist in the system. This confuses the newer function topology system that creates the soundcard, as it builds the card based on the ACPI information.
Whilst we are working with the laptop vendors to try and stop this happening there are quite a few systems where this has shipped. Add a quirk to disable this "ghost" device.
Currently this patch should cover:
- Asus UX5406AA
- Lenovo Yoga Pro 9i (83SF)
- Lenovo Yoga Slim 7 Ultra (83QK)
--- drivers/soundwire/dmi-quirks.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/soundwire/dmi-quirks.c +35 -0
@@ -90,6 +90,19 @@ static const struct adr_remap intel_rooks_county[] = { {} }; +/* +* Many platforms have ghost realtek devices in the ACPI that don't physically +* exist, remove those devices. +*/ +static const struct adr_remap ghost_realtek[] = { +/* rt722 on link3 */ + { +0x000330025d072201ull , +0x0000000000000000ull + }, + {} +}; +static const struct dmi_system_id adr_remap_quirk_table[] = {/* TGL devices */ {
@@ -164,6 +177,28 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)hp_omen_16, }, +/* PTL devices */ + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), + DMI_MATCH(DMI_BOARD_NAME, "UX5406AA"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83QK"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83SF"), + }, + .driver_data = (void *)ghost_realtek, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/1193 gfs2: page poisoning fix
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 4982e58669b11c43644efb5fb7435975848b716e ]
Processes can write to the last page of a file using mmap, and when the file size is not a multiple of the page size, this can be used to write beyond the end of the file. This is sometimes referred to as page poisoning, and it is not a problem in itself because the data beyond eof will be ignored. However, we currently fail to clear out any space beyond the end of the file that we skip over when the file size is increased, so that "poison" can end up getting exposed. Fix that.
Fixes xfstest generic/363.
--- fs/gfs2/bmap.c | 19 +++++++++++++++++++ fs/gfs2/bmap.h | 1 + fs/gfs2/file.c | 10 ++++++++++ 3 files changed, 30 insertions(+)
fs/gfs2/bmap.c +19 -0
@@ -1317,6 +1317,19 @@ static int gfs2_block_zero_range(struct inode *inode, loff_t from,return iomap_zero_range (inode, from, length,NULL , &gfs2_iomap_ops); } +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end) +{ +loff_t isize =i_size_read (inode); +unsigned int len = isize & ~PAGE_MASK ; + +if (!len || isize >= end) +return 0 ; + len =PAGE_SIZE - len; +if (end - isize < len) + len = end - isize; +return gfs2_block_zero_range (inode, isize, len); +} +#define GFS2_JTRUNC_REVOKES 8192/**
@@ -2092,6 +2105,12 @@ static int do_grow(struct inode *inode, u64 size) unstuff =1 ; } +if (!unstuff) { + error =gfs2_clear_beyond_eof (inode, size); +if (error) + goto do_grow_qunlock; + } + error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT + (unstuff && gfs2_is_jdata(ip) ? RES_JDATA : 0) +
fs/gfs2/bmap.h +1 -0
@@ -57,6 +57,7 @@ int gfs2_get_extent(struct inode *inode, u64 lblock, u64 *dblock, unsigned int *extlen);int gfs2_alloc_extent (struct inode *inode,u64 lblock,u64 *dblock,unsigned *extlen,bool *new); +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end);int gfs2_setattr_size (struct inode *inode,u64 size);int gfs2_truncatei_resume (struct gfs2_inode *ip);int gfs2_file_dealloc (struct gfs2_inode *ip);
fs/gfs2/file.c +10 -0
@@ -1056,6 +1056,10 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, goto out_unlock; } + ret =gfs2_clear_beyond_eof (inode, iocb->ki_pos); +if (ret) + goto out_unlock; +pagefault_disable (); ret =iomap_file_buffered_write (iocb, from, &gfs2_iomap_ops);pagefault_enable ();
@@ -1258,6 +1262,12 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t next = (next +1 ) << sdp->sd_sb.sb_bsize_shift; +if (!(mode &FALLOC_FL_KEEP_SIZE )) { + error =gfs2_clear_beyond_eof (inode, offset + len); +if (error) +return error; + } + offset &= bsize_mask; len = next - offset;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/1193 soundwire: only handle alert events when the peripheral is attached
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 38cd651ebce7065a81c7e950d9e2ea1572304605 ]
It doesn't make sense to handle an alert event when the peripheral is not attached. The slave->status could be SDW_SLAVE_ATTACHED or SDW_SLAVE_ALERT when it is attached on the bus.
--- drivers/soundwire/bus.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soundwire/bus.c +4 -0
@@ -1923,6 +1923,10 @@ int sdw_handle_slave_status(struct sdw_bus *bus,break ;case SDW_SLAVE_ALERT : +if (slave->status !=SDW_SLAVE_ATTACHED && + slave->status !=SDW_SLAVE_ALERT ) +continue ; + ret =sdw_handle_slave_alerts (slave);if (ret <0 ) dev_err(&slave->dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 105/1193 s390/zcore: Removed unused variables
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 0a2aa995c0a1d363b5f0803862e84834e3876ae2 ]
allmodconfig with clang W=1 points out unused global variables:
drivers/s390/char/zcore.c:49:23: error: variable
'zcore_reipl_file' set but not used [-Werror,-Wunused-but-set-global]drivers/s390/char/zcore.c:50:23: error: variable
'zcore_hsa_file' set but not used [-Werror,-Wunused-but-set-global]
Remove both of them, since there is no point in keeping them.
--- drivers/s390/char/zcore.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/s390/char/zcore.c +2 -6
@@ -48,8 +48,6 @@ struct ipib_info {static struct debug_info *zcore_dbf;static int hsa_available;static struct dentry *zcore_dir; -static struct dentry *zcore_reipl_file; -static struct dentry *zcore_hsa_file;static struct ipl_parameter_block *zcore_ipl_block;static unsigned long os_info_flags;
@@ -357,10 +355,8 @@ static int __init zcore_init(void) goto fail; zcore_dir =debugfs_create_dir ("zcore" ,NULL ); - zcore_reipl_file =debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir, -NULL , &zcore_reipl_fops); - zcore_hsa_file =debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir, -NULL , &zcore_hsa_fops); +debugfs_create_file ("reipl" ,S_IRUSR , zcore_dir,NULL , &zcore_reipl_fops); +debugfs_create_file ("hsa" ,S_IRUSR |S_IWUSR , zcore_dir,NULL , &zcore_hsa_fops);register_reboot_notifier (&zcore_reboot_notifier);atomic_notifier_chain_register (&panic_notifier_list, &zcore_on_panic_notifier);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 141/1193 mmc: davinci: fix mmc_add_host order in probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Abdelkader <[email protected]>
[ Upstream commit d04e0151d316edbdb4f0397a9b92a1936e4a1421 ]
mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up.
--- drivers/mmc/host/davinci_mmc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/davinci_mmc.c +5 -7
@@ -1302,14 +1302,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) goto cpu_freq_fail; } - ret =mmc_add_host (mmc); -if (ret <0 ) - goto mmc_add_host_fail; - ret =devm_request_irq (&pdev->dev, irq, mmc_davinci_irq,0 ,mmc_hostname (mmc), host);if (ret) - goto request_irq_fail; + goto mmc_add_host_fail;if (host->sdio_irq >=0 ) { ret = devm_request_irq(&pdev->dev, host->sdio_irq,
@@ -1319,6 +1315,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) mmc->caps |=MMC_CAP_SDIO_IRQ ; } + ret =mmc_add_host (mmc); +if (ret <0 ) + goto mmc_add_host_fail; +rename_region (mem,mmc_hostname (mmc)); dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n",
@@ -1327,8 +1327,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)return 0 ; -request_irq_fail: -mmc_remove_host (mmc); mmc_add_host_fail:mmc_davinci_cpufreq_deregister (host); cpu_freq_fail:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 142/1193 mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 5ce500d31a1625d8fe7ede950201b8df076bdd48 ]
The RZ/G2N (R8A774B1) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2N is identical with the R-Car M3-N (R8A77965), it requires the specific quirks and configuration defined in of_r8a77965_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774b1" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -277,6 +277,7 @@ static const struct renesas_sdhi_of_data_with_quirks of_rza2_compatible = {static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible ="renesas,sdhi-r7s9210" , .data = &of_rza2_compatible, }, { .compatible ="renesas,sdhi-mmc-r8a77470" , .data = &of_rcar_gen3_compatible, }, + { .compatible ="renesas,sdhi-r8a774b1" , .data = &of_r8a77965_compatible, }, { .compatible ="renesas,sdhi-r8a774e1" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a7795" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a77961" , .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 143/1193 tracing: Disable KCOV instrumentation for trace_irqsoff.o
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 01046072880b654dbadf71be2f645aad4a7b5d87 ]
When KCOV runs its boot selftest with whole-kernel instrumentation enabled, it sets current->kcov_mode to KCOV_MODE_TRACE_PC without installing a coverage area. Any instrumented code accepted as task-context coverage in that window dereferences current->kcov_area and crashes.
On ARMv5 Versatile PB with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y, boot hits a NULL pointer fault during the selftest:
kcov: running self test
Internal error: Oops: 5 [#1] ARM PC is at __sanitizer_cov_trace_pc+0x4c/0x90 Kernel panic - not syncing: Fatal exception
A diagnostic run showed the unwanted coverage comes from the IRQs-off tracer callbacks reached from ARM IRQ entry before hardirq context is visible to KCOV:
__sanitizer_cov_trace_pc from tracer_hardirqs_off+0x18/0x1cc tracer_hardirqs_off from trace_hardirqs_off+0x34/0x54 trace_hardirqs_off from __irq_svc+0x58/0xb0 __irq_svc from kcov_init+0x7c/0xdc
and similarly through tracer_hardirqs_on().
trace_preemptirq.o is already excluded because this tracing path can run from early interrupt code and produce coverage unrelated to syscall inputs. Exclude trace_irqsoff.o as well, instead of requiring users to turn off CONFIG_KCOV_INSTRUMENT_ALL=y, which is the default whole-kernel KCOV mode.
With the exclusion in place, the same ARMv5 Versatile PB QEMU test boots through the KCOV selftest and reaches userspace.
Tested on ARMv5 Versatile PB QEMU with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y.
--- kernel/trace/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/Makefile +3 -2
@@ -31,9 +31,10 @@ ifdef CONFIG_GCOV_PROFILE_FTRACE GCOV_PROFILE := y endif -# Functions in this file could be invoked from early interrupt -# code and produce random code coverage. +# Functions in these files can run from IRQ entry before hardirq context +# is visible to KCOV, and produce coverage unrelated to syscall inputs. KCOV_INSTRUMENT_trace_preemptirq.o := n +KCOV_INSTRUMENT_trace_irqsoff.o := n CFLAGS_bpf_trace.o := -I$(src)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 144/1193 mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ebf7f2198ac4817bd2929cf83c697cefa8bf36a9 ]
The RZ/G2E (R8A774C0) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2E is identical with the R-Car E3 (R8A77990), it requires the specific quirks and configuration defined in of_r8a77990_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774c0" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -278,6 +278,7 @@ static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible = "renesas,sdhi-r7s9210", .data = &of_rza2_compatible, }, { .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, }, { .compatible = "renesas,sdhi-r8a774b1", .data = &of_r8a77965_compatible, }, + { .compatible = "renesas,sdhi-r8a774c0", .data = &of_r8a77990_compatible, }, { .compatible = "renesas,sdhi-r8a774e1", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a7795", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a77961", .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 145/1193 iio: light: stk3310: Deal with the ps interrupt issue in PM
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miao Li <[email protected]>
[ Upstream commit 9c1d639e90cf42f5c1401f91f38ffd89af6dd970 ]
On the Inspur HS326 laptop(which integrated with HiSilicon M900 processor), if the STK3311-X chip's PS interrupt is configured in "Recommended interrupt mode", the interrupt cannot be triggered normally after waking from suspend or hibernation.
In this case, neither disabling and re-enabling the interrupt nor resetting the PS threshold register can restore the interrupt to normal operation.
If the interrupt is disabled in suspend() then reset the PS threshold register and enable the interrupt in resume(). This resolves the issue.
--- drivers/iio/light/stk3310.c | 76 +++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 7 deletions(-)
drivers/iio/light/stk3310.c +69 -7
@@ -106,6 +106,9 @@ struct stk3310_data {struct mutex lock;bool als_enabled;bool ps_enabled; +bool ps_int_enabled; +uint32_t ps_thdl; +uint32_t ps_thdh;uint32_t ps_near_level;u64 timestamp;struct regmap *regmap;
@@ -275,10 +278,17 @@ static int stk3310_write_event(struct iio_dev *indio_dev, buf =cpu_to_be16 (val); ret =regmap_bulk_write (data->regmap, reg, &buf,2 ); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to set PS threshold!\n" ); +return ret; + } -return ret; +if (reg ==STK3310_REG_THDH_PS ) + data->ps_thdh = val; +else + data->ps_thdl = val; + +return 0 ; } static int stk3310_read_event_config(struct iio_dev *indio_dev,
@@ -313,11 +323,17 @@ static int stk3310_write_event_config(struct iio_dev *indio_dev,/* Set INT_PS value */ mutex_lock (&data->lock); ret =regmap_field_write (data->reg_int_ps, state); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to set interrupt mode\n" ); +mutex_unlock (&data->lock); +return ret; + } + + data->ps_int_enabled = state; +mutex_unlock (&data->lock); -return ret; +return 0 ; } static int stk3310_read_raw(struct iio_dev *indio_dev,
@@ -490,10 +506,15 @@ static int stk3310_init(struct iio_dev *indio_dev)/* Enable PS interrupts */ ret =regmap_field_write (data->reg_int_ps,STK3310_PSINT_EN ); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to enable interrupts!\n" ); +return ret; + } -return ret; + data->ps_int_enabled = true; + data->ps_thdh =STK3310_PS_MAX_VAL ; + +return 0 ; }static bool stk3310_is_volatile_reg (struct device *dev,unsigned int reg)
@@ -659,9 +680,18 @@ static void stk3310_remove(struct i2c_client *client)static int stk3310_suspend (struct device *dev) {struct stk3310_data *data; +int ret; data =iio_priv (i2c_get_clientdata (to_i2c_client (dev))); +if (data->ps_int_enabled) { + ret =regmap_field_write (data->reg_int_ps,0x0 ); +if (ret <0 ) { +dev_err (dev,"failed to disable ps int at suspend.\n" ); +return ret; + } + } +return stk3310_set_state (data,STK3310_STATE_STANDBY ); }
@@ -669,6 +699,8 @@ static int stk3310_resume(struct device *dev) {u8 state =0 ;struct stk3310_data *data; +__be16 buf; +int ret; data =iio_priv (i2c_get_clientdata (to_i2c_client (dev)));if (data->ps_enabled)
@@ -676,7 +708,37 @@ static int stk3310_resume(struct device *dev)if (data->als_enabled) state |=STK3310_STATE_EN_ALS ; -return stk3310_set_state (data, state); + ret =stk3310_set_state (data, state); +if (ret <0 ) +return ret; + +if (data->ps_thdl !=0x0 ) { + buf =cpu_to_be16 (data->ps_thdl); + ret =regmap_bulk_write (data->regmap,STK3310_REG_THDL_PS , &buf,2 ); +if (ret <0 ) { +dev_err (dev,"failed to set reg THDL_PS at resume.\n" ); +return ret; + } + } + +if (data->ps_thdh !=STK3310_PS_MAX_VAL ) { + buf =cpu_to_be16 (data->ps_thdh); + ret =regmap_bulk_write (data->regmap,STK3310_REG_THDH_PS , &buf,2 ); +if (ret <0 ) { +dev_err (dev,"failed to set reg THDH_PS at resume.\n" ); +return ret; + } + } + +if (data->ps_int_enabled) { + ret =regmap_field_write (data->reg_int_ps,STK3310_PSINT_EN ); +if (ret <0 ) { +dev_err (dev,"failed to enable ps int at resume.\n" ); +return ret; + } + } + +return 0 ; } static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/1193 perf/ftrace: Fix WARNING in __unregister_ftrace_function
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
[ Upstream commit 9581123304b23049437324038698af9fb56ee663 ]
perf_ftrace_function_unregister() unconditionally calls unregister_ftrace_function() without checking whether the ftrace_ops was ever successfully registered. This triggers a WARN_ON in __unregister_ftrace_function() when the ops doesn't have FTRACE_OPS_FL_ENABLED set.
This can happen during perf_event_alloc() error cleanup when perf_trace_destroy() is called via __free_event() on an event whose ftrace_ops registration failed or was already torn down by perf_try_init_event()'s err_destroy path.
The call path is:
perf_event_alloc() error cleanup
-> __free_event()
-> event->destroy() [tp_perf_event_destroy]
-> perf_trace_destroy()
-> perf_trace_event_close()
-> TRACE_REG_PERF_CLOSE
-> perf_ftrace_function_unregister()
-> unregister_ftrace_function()
-> __unregister_ftrace_function()
-> WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED))Fix this by checking FTRACE_OPS_FL_ENABLED before attempting to unregister. If the ops is not enabled, just free the filter and return success.
--- kernel/trace/trace_event_perf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/trace/trace_event_perf.c +11 -1
@@ -497,7 +497,17 @@ static int perf_ftrace_function_register(struct perf_event *event)static int perf_ftrace_function_unregister (struct perf_event *event) {struct ftrace_ops *ops = &event->ftrace_ops; -int ret =unregister_ftrace_function (ops); +int ret =0 ; + +/* +* Perf will call this unconditionally even if the ops is not +* enabled. The unregister_ftrace_function() will warn if called +* when not enabled. Just bypass the unregistering if ops isn't +* enabled here. +*/ +if (ops->flags &FTRACE_OPS_FL_ENABLED ) + ret =unregister_ftrace_function (ops); +ftrace_free_filter (ops);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 147/1193 iio: accel: mma8452: switch to non-devm request_threaded_irq()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjay Chitroda <[email protected]>
[ Upstream commit 0a6726ec20cd4c0101f2de0ca485a11676224dea ]
Avoid using devm_request_threaded_irq() as the driver requires explicit error-handling path(s). Using devm_* API together with goto-based unwinding breaks the expected LIFO resource release model.
Add explicit IRQ cleanup in the driver teardown paths to follow kernel resource management conventions.
--- drivers/iio/accel/mma8452.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/iio/accel/mma8452.c +12 -7
@@ -1695,18 +1695,16 @@ static int mma8452_probe(struct i2c_client *client) goto trigger_cleanup;if (client->irq) { - ret =devm_request_threaded_irq (&client->dev, - client->irq, -NULL , mma8452_interrupt, -IRQF_TRIGGER_LOW |IRQF_ONESHOT , - client->name, indio_dev); + ret =request_threaded_irq (client->irq,NULL , mma8452_interrupt, +IRQF_TRIGGER_LOW |IRQF_ONESHOT , + client->name, indio_dev);if (ret) goto buffer_cleanup; } ret =pm_runtime_set_active (&client->dev);if (ret <0 ) - goto buffer_cleanup; + goto free_irq;pm_runtime_enable (&client->dev); pm_runtime_set_autosuspend_delay(&client->dev,
@@ -1715,7 +1713,7 @@ static int mma8452_probe(struct i2c_client *client) ret =iio_device_register (indio_dev);if (ret <0 ) - goto buffer_cleanup; + goto free_irq; ret =mma8452_set_freefall_mode (data, false);if (ret <0 )
@@ -1726,6 +1724,10 @@ static int mma8452_probe(struct i2c_client *client) unregister_device:iio_device_unregister (indio_dev); +free_irq: +if (client->irq) +free_irq (client->irq, indio_dev); + buffer_cleanup:iio_triggered_buffer_cleanup (indio_dev);
@@ -1751,6 +1753,9 @@ static void mma8452_remove(struct i2c_client *client)pm_runtime_disable (&client->dev);pm_runtime_set_suspended (&client->dev); +if (client->irq) +free_irq (client->irq, indio_dev); +iio_triggered_buffer_cleanup (indio_dev);mma8452_trigger_cleanup (indio_dev);mma8452_standby (iio_priv (indio_dev));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/1193 libbpf: Also reset {insn,data}_cur on realloc failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit d2f7bd066ed492aeaf82864fbf1f06770f9d9f9d ]
realloc_insn_buf() as well as realloc_data_buf() free and NULL gen->insn_start / gen->data_start on -ENOMEM but leave gen->insn_cur / gen->data_cur pointing into the old, freed buffer. Just reset the cursors to NULL alongside the base pointers so the freed state is coherent.
--- tools/lib/bpf/gen_loader.c | 2 ++ 1 file changed, 2 insertions(+)
tools/lib/bpf/gen_loader.c +2 -0
@@ -63,6 +63,7 @@ static int realloc_insn_buf(struct bpf_gen *gen, __u32 size) gen->error = -ENOMEM ;free (gen->insn_start); gen->insn_start =NULL ; + gen->insn_cur =NULL ;return -ENOMEM ; } gen->insn_start = insn_start;
@@ -86,6 +87,7 @@ static int realloc_data_buf(struct bpf_gen *gen, __u32 size) gen->error = -ENOMEM ;free (gen->data_start); gen->data_start =NULL ; + gen->data_cur =NULL ;return -ENOMEM ; } gen->data_start = data_start;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/1193 clk: socfpga: agilex: implement l3_main_free_clk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Ng Ho Yin <[email protected]>
[ Upstream commit 1e7f56205813a2c48cdb3e9a4b0a24f49fd9a548 ]
The AGILEX_L3_MAIN_FREE_CLK is defined in the dt-bindings header but was never implemented in the clock driver. Per the Agilex TRM, l3_main_free_clk has no divider or mux and is a fixed 1:1 derivative of noc_free_clk that clocks most of the interconnect datapath.
--- drivers/clk/socfpga/clk-agilex.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/socfpga/clk-agilex.c +2 -0
@@ -259,6 +259,8 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = { 0, 0x3C, 0, 0, 0}, {AGILEX_NOC_FREE_CLK ,"noc_free_clk" ,NULL , noc_free_mux,ARRAY_SIZE (noc_free_mux), 0, 0x40, 0, 0, 0}, + { AGILEX_L3_MAIN_FREE_CLK, "l3_main_free_clk", "noc_free_clk", NULL, + 1, 0, 0, 1, 0, 0}, { AGILEX_L4_SYS_FREE_CLK, "l4_sys_free_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0, 0, 4, 0x30, 1}, { AGILEX_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/1193 thermal/drivers/tegra/soctherma: Switch to devm cooling device registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit ee126267bc04bfb03816ae9d71ca24c5bf99e739 ]
Use devm_thermal_of_cooling_device_register() to simplify resource management and avoid manual cleanup in error paths.
As a side effect this change has the benefit of solving an existing issue. Before, the function tegra_soctherm_remove() only called debugfs_remove_recursive() and never called thermal_cooling_device_unregister() for any of the cooling devices registered here.
After the driver removal, the thermal framework's cdev list would still hold references to thermal_cooling_device objects whose devdata pointer (ts) pointed to memory already freed by the platform device's devm cleanup.
With this change, the cooling device is unregistered when the driver is removed, thus fixing the issue above.
--- drivers/thermal/tegra/soctherm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/tegra/soctherm.c +3 -3
@@ -1699,9 +1699,9 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev) stc->init = true; }else { - tcd =thermal_of_cooling_device_register (np_stcc, - (char *)name, ts, - &throt_cooling_ops); + tcd =devm_thermal_of_cooling_device_register (dev, np_stcc, + (char *)name, ts, + &throt_cooling_ops);if (IS_ERR_OR_NULL (tcd)) { dev_err(dev, "throttle-cfg: %s: failed to register cooling device\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/1193 drm/panel: simple: Add AM-1280800W8TZQW-T00H
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dario Binacchi <[email protected]>
[ Upstream commit 6acb810ebc5d8dea5c250326c14dc44e32dc8e92 ]
Add Ampire, AM-1280800W8TZQW-T00H 10.1" TFT LCD panel timings.
--- drivers/gpu/drm/panel/panel-simple.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +28 -0
@@ -737,6 +737,31 @@ static const struct panel_desc ampire_am_1280800n3tzqw_t00h = { .connector_type = DRM_MODE_CONNECTOR_LVDS, }; +static const struct drm_display_mode ampire_am_1280800w8tzqw_t00h_mode = { + .clock =72400 , + .hdisplay =1280 , + .hsync_start =1280 +40 , + .hsync_end =1280 +40 +80 , + .htotal =1280 +40 +80 +40 , + .vdisplay =800 , + .vsync_start =800 +10 , + .vsync_end =800 +10 +18 , + .vtotal =800 +10 +18 +10 , +}; + +static const struct panel_desc ampire_am_1280800w8tzqw_t00h = { + .modes = &ire_am_1280800w8tzqw_t00h_mode, + .num_modes =1 , + .bpc =8 , + .size = { + .width =217 , + .height =136 , + }, + .bus_flags =DRM_BUS_FLAG_DE_HIGH , + .bus_format =MEDIA_BUS_FMT_RGB888_1X7X4_SPWG , + .connector_type =DRM_MODE_CONNECTOR_LVDS , +}; +static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = { .clock =9000 , .hdisplay =480 ,
@@ -4144,6 +4169,9 @@ static const struct of_device_id platform_of_match[] = { { .compatible = "ampire,am-1280800n3tzqw-t00h", .data = &ire_am_1280800n3tzqw_t00h, + }, { + .compatible = "ampire,am-1280800w8tzqw-t00h", + .data = &ire_am_1280800w8tzqw_t00h, }, { .compatible = "ampire,am-480272h3tmqw-t01h", .data = &ire_am_480272h3tmqw_t01h,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/1193 mips: cps: Assemble jr.hb with an R2 ISA level
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit e5d64f868e484da06f5c141c18c32c01c269625e ]
A MIPS allmodconfig built with LLVM can select CPU_MIPS32_R1 together with MIPS_MT_SMP. In that configuration clang invokes the integrated assembler with -march=mips32, and the MIPS MT path in cps-vec.S fails to assemble two jr.hb instructions:
arch/mips/kernel/cps-vec.S:376:2: error: instruction requires a CPU feature not currently enabled
arch/mips/kernel/cps-vec.S:490:4: error: instruction requires a CPU feature not currently enabled
The earlier jr.hb in the same file is already assembled inside a .set MIPS_ISA_LEVEL_RAW scope. The two failing sites are reached after popping back to the file's base ISA level, so LLVM correctly rejects them for an R1 target.
Wrap those jr.hb instructions in the same ISA-level push/pop used by the working site. This keeps the MT code unchanged while making the required R2 hazard-branch encoding explicit to the assembler.
--- arch/mips/kernel/cps-vec.S | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/kernel/cps-vec.S +6 -0
@@ -392,8 +392,11 @@ LEAF(mips_cps_boot_vpes) .set pop PTR_LA t1, 1f + .set push + .set MIPS_ISA_LEVEL_RAW jr.hb t1 nop + .set pop 1: mfc0 t1, CP0_MVPCONTROL ori t1, t1, MVPCONTROL_VPC mtc0 t1, CP0_MVPCONTROL
@@ -506,8 +509,11 @@ LEAF(mips_cps_boot_vpes) li t0, TCHALT_H mtc0 t0, CP0_TCHALT PTR_LA t0, 1f + .set push + .set MIPS_ISA_LEVEL_RAW 1: jr.hb t0 nop + .set pop 2:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/1193 iio: adc: qcom-spmi-iadc: balance enable_irq_wake() on driver unbind
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stepan Ionichev <[email protected]>
[ Upstream commit 929fec2964f71d4b1ac664ee963d8226c5cf01c6 ]
iadc_probe() calls enable_irq_wake() after a successful devm_request_irq(), but the driver has no remove callback or matching disable_irq_wake(), so the wake reference count on the IRQ is leaked on module unload or driver unbind.
Check the IRQ request error first, then register a devm action that calls disable_irq_wake() so the wake reference is released in the same scope as the enable. While here, drop the inverted "if (!ret) ... else return ret" in favour of the standard "if (ret) return ret;" pattern.
--- drivers/iio/adc/qcom-spmi-iadc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/iio/adc/qcom-spmi-iadc.c +15 -3
@@ -481,6 +481,11 @@ static const struct iio_chan_spec iadc_channels[] = { }, }; +static void iadc_disable_irq_wake (void *data) +{ +disable_irq_wake ((unsigned long )data); +} +static int iadc_probe (struct platform_device *pdev) {struct device_node *node = pdev->dev.of_node;
@@ -538,9 +543,16 @@ static int iadc_probe(struct platform_device *pdev)if (!iadc->poll_eoc) { ret =devm_request_irq (dev, irq_eoc, iadc_isr,0 ,"spmi-iadc" , iadc); -if (!ret) -enable_irq_wake (irq_eoc); -else +if (ret) +return ret; + + ret =enable_irq_wake (irq_eoc); +if (ret) +return ret; + + ret =devm_add_action_or_reset (dev, iadc_disable_irq_wake, + (void *)(unsigned long )irq_eoc); +if (ret)return ret; }else {device_init_wakeup (iadc->dev,1 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 101/1193 wifi: rtw89: pci: enable LTR based on pcie control register
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dian-Syuan Yang <[email protected]>
[ Upstream commit 779bbe1902f29d0ef131249ddd42a8dfbe21d0fb ]
Originally, driver always transmits LTR (Latency Tolerance Reporting) to pcie host, but it may cause pcie link down on some platforms because LTR is not supported. As a result, driver will check the control register of LTR setting to decide whether to enable LTR feature.
This applies to Wi-Fi 6 chips only. For Wi-Fi 7 chips, although the driver still issues LTR, the hardware has its own internal logic to determine whether to actually transmit it to pcie host.
--- drivers/net/wireless/realtek/rtw89/pci.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/pci.c +15 -1
@@ -2543,6 +2543,17 @@ static int rtw89_pci_mode_op(struct rtw89_dev *rtwdev)return 0 ; } +static bool rtw89_pci_dev_ltr_enabled (struct rtw89_dev *rtwdev) +{ +struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; +struct pci_dev *pdev = rtwpci->pdev; +u16 cap; + +pcie_capability_read_word (pdev,PCI_EXP_DEVCTL2 , &cap); + +return !!(cap &PCI_EXP_DEVCTL2_LTR_EN ); +} +static int rtw89_pci_ops_deinit (struct rtw89_dev *rtwdev) {const struct rtw89_pci_info *info = rtwdev->pci_info;
@@ -2646,7 +2657,7 @@ int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en) {u32 val; -if (!en) +if (!en || !rtw89_pci_dev_ltr_enabled (rtwdev))return 0 ; val =rtw89_read32 (rtwdev,R_AX_LTR_CTRL_0 );
@@ -2682,6 +2693,9 @@ int rtw89_pci_ltr_set_v1(struct rtw89_dev *rtwdev, bool en)u32 dec_ctrl;u32 val32; +if (!rtw89_pci_dev_ltr_enabled (rtwdev)) +return 0 ; + val32 =rtw89_read32 (rtwdev,R_AX_LTR_CTRL_0 );if (rtw89_pci_ltr_is_err_reg_val (val32))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/1193 wifi: ath11k: fix invalid data access in ath11k_dp_rx_h_undecap_nwifi
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <[email protected]>
[ Upstream commit 6b471e9aefee9ed73278eb1141e0d8530a56fae9 ]
In certain cases, hardware might provide packets with a length greater than the maximum native Wi-Fi header length. This can lead to accessing and modifying fields in the header within the ath11k_dp_rx_h_undecap_nwifi() function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type and potentially result in invalid data access and memory corruption.
Kernel stack is corrupted in: ath11k_dp_rx_h_undecap+0x6b0/0x6b0 [ath11k]
Call trace: ath11k_dp_rx_h_mpdu+0x0/0x2e8 [ath11k] ath11k_dp_rx_h_mpdu+0x1e0/0x2e8 [ath11k] ath11k_dp_rx_wbm_err+0x1e0/0x450 [ath11k] ath11k_dp_rx_process_wbm_err+0x2fc/0x460 [ath11k] ath11k_dp_service_srng+0x2e0/0x348 [ath11k]
Add a sanity check before processing the SKB to prevent invalid data access in the undecap native Wi-Fi function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type.
This adapted from the discussion/patch of the ath12k driver [1].
Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04685-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 50 +++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +47 -3
@@ -2504,6 +2504,29 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *napieee80211_rx_napi (ar->hw, pubsta, msdu, napi); } +static bool ath11k_dp_rx_check_nwifi_hdr_len_valid (struct ath11k_base *ab, +struct hal_rx_desc *rx_desc, +struct sk_buff *msdu) +{ +struct ieee80211_hdr *hdr; +u8 decap_type; +u32 hdr_len; + + decap_type =ath11k_dp_rx_h_msdu_start_decap_type (ab, rx_desc); +if (decap_type !=DP_RX_DECAP_TYPE_NATIVE_WIFI ) +return true; + + hdr = (struct ieee80211_hdr *)msdu->data; + hdr_len =ieee80211_hdrlen (hdr->frame_control); + +if (likely (hdr_len <=DP_MAX_NWIFI_HDR_LEN )) +return true; + + ab->soc_stats.invalid_rbm++; +WARN_ON_ONCE (1 ); +return false; +} + static int ath11k_dp_rx_process_msdu(struct ath11k *ar, struct sk_buff *msdu, struct sk_buff_head *msdu_list,
@@ -2574,6 +2597,11 @@ static int ath11k_dp_rx_process_msdu(struct ath11k *ar, } } +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) { + ret = -EINVAL ; + goto free_out; + } +ath11k_dp_rx_h_ppdu (ar, rx_desc, rx_status);ath11k_dp_rx_h_mpdu (ar, msdu, rx_desc, rx_status);
@@ -3314,6 +3342,12 @@ static int ath11k_dp_rx_h_verify_tkip_mic(struct ath11k *ar, struct ath11k_peerRX_FLAG_IV_STRIPPED |RX_FLAG_DECRYPTED ;skb_pull (msdu, hal_rx_desc_sz); +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ar->ab, rx_desc, + msdu))) { +dev_kfree_skb_any (msdu); +return -EINVAL ; + } +ath11k_dp_rx_h_ppdu (ar, rx_desc, rxs);ath11k_dp_rx_h_undecap (ar, msdu, rx_desc,HAL_ENCRYPT_TYPE_TKIP_MIC , rxs, true);
@@ -4006,6 +4040,10 @@ static int ath11k_dp_rx_h_null_q_desc(struct ath11k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); } + +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ar->ab, desc, msdu))) +return -EINVAL ; +ath11k_dp_rx_h_ppdu (ar, desc, status);ath11k_dp_rx_h_mpdu (ar, msdu, desc, status);
@@ -4050,7 +4088,7 @@ static bool ath11k_dp_rx_h_reo_err(struct ath11k *ar, struct sk_buff *msdu,return drop; } -static void ath11k_dp_rx_h_tkip_mic_err (struct ath11k *ar,struct sk_buff *msdu, +static bool ath11k_dp_rx_h_tkip_mic_err (struct ath11k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {u16 msdu_len;
@@ -4058,6 +4096,7 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,u8 l3pad_bytes;struct ath11k_skb_rxcb *rxcb =ATH11K_SKB_RXCB (msdu);u32 hal_rx_desc_sz = ar->ab->hw_params.hal_desc_sz; +struct ath11k_base *ab = ar->ab; rxcb->is_first_msdu =ath11k_dp_rx_h_msdu_end_first_msdu (ar->ab, desc); rxcb->is_last_msdu =ath11k_dp_rx_h_msdu_end_last_msdu (ar->ab, desc);
@@ -4067,6 +4106,9 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return true; +ath11k_dp_rx_h_ppdu (ar, desc, status); status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR |
@@ -4074,19 +4116,21 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,ath11k_dp_rx_h_undecap (ar, msdu, desc,HAL_ENCRYPT_TYPE_TKIP_MIC , status, false); + +return false; }static bool ath11k_dp_rx_h_rxdma_err (struct ath11k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {struct ath11k_skb_rxcb *rxcb =ATH11K_SKB_RXCB (msdu); -bool drop = false; +bool drop; ar->ab->soc_stats.rxdma_error[rxcb->err_code]++;switch (rxcb->err_code) {case HAL_REO_ENTR_RING_RXDMA_ECODE_TKIP_MIC_ERR : -ath11k_dp_rx_h_tkip_mic_err (ar, msdu, status); + drop =ath11k_dp_rx_h_tkip_mic_err (ar, msdu, status);break ;default :/* TODO: Review other rxdma error code to check if anything is
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 159/1193 fs/ntfs3: validate index entry key bounds
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 98d6e5d9dc1d34dcffc61549617581a5fe1ef807 ]
[BUG]
A malformed NTFS directory index entry can advertise a key_size larger than the bytes actually present in its NTFS_DE payload. Directory lookup then passes that malformed key to cmp_fnames(), which can read past the end of the kmalloc'ed index buffer.
BUG: KASAN: slab-out-of-bounds in fname_full_size fs/ntfs3/ntfs.h:590 [inline] BUG: KASAN: slab-out-of-bounds in cmp_fnames+0x1ea/0x230 fs/ntfs3/index.c:46 Read of size 1 at addr ffff88801c313018 by task syz.6.3365/9279 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xbe/0x130 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xd1/0x650 mm/kasan/report.c:482 kasan_report+0xfb/0x140 mm/kasan/report.c:595 __asan_report_load1_noabort+0x14/0x30 mm/kasan/report_generic.c:378 fname_full_size fs/ntfs3/ntfs.h:590 [inline] cmp_fnames+0x1ea/0x230 fs/ntfs3/index.c:46 hdr_find_e.isra.0+0x3ed/0x670 fs/ntfs3/index.c:762 indx_find+0x4b5/0x900 fs/ntfs3/index.c:1186 dir_search_u+0x2c0/0x460 fs/ntfs3/dir.c:254 ntfs_lookup+0x1cc/0x2a0 fs/ntfs3/namei.c:85 __lookup_slow+0x241/0x450 fs/namei.c:1816 lookup_slow fs/namei.c:1833 [inline] walk_component+0x31c/0x570 fs/namei.c:2151 link_path_walk+0x592/0xd60 fs/namei.c:2519 path_lookupat+0x138/0x660 fs/namei.c:2675 filename_lookup+0x1f3/0x560 fs/namei.c:2705 filename_setxattr+0xad/0x1c0 fs/xattr.c:660 path_setxattrat+0x1d8/0x280 fs/xattr.c:713 __do_sys_lsetxattr fs/xattr.c:754 [inline] __se_sys_lsetxattr fs/xattr.c:750 [inline] __x64_sys_lsetxattr+0xd0/0x150 fs/xattr.c:750 ... Allocated by task 9279: kasan_save_stack+0x39/0x70 mm/kasan/common.c:56 kasan_save_track+0x14/0x40 mm/kasan/common.c:77 kasan_save_alloc_info+0x37/0x60 mm/kasan/generic.c:573 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xc3/0xd0 mm/kasan/common.c:417 kasan_kmalloc include/linux/kasan.h:262 [inline] __do_kmalloc_node mm/slub.c:5650 [inline] __kmalloc_noprof+0x2bd/0x900 mm/slub.c:5662 kmalloc_noprof include/linux/slab.h:961 [inline] indx_read+0x41d/0xad0 fs/ntfs3/index.c:1059 indx_find+0x447/0x900 fs/ntfs3/index.c:1179 dir_search_u+0x2c0/0x460 fs/ntfs3/dir.c:254 ntfs_lookup+0x1cc/0x2a0 fs/ntfs3/namei.c:85 __lookup_slow+0x241/0x450 fs/namei.c:1816 lookup_slow fs/namei.c:1833 [inline] walk_component+0x31c/0x570 fs/namei.c:2151 link_path_walk+0x592/0xd60 fs/namei.c:2519 path_lookupat+0x138/0x660 fs/namei.c:2675 filename_lookup+0x1f3/0x560 fs/namei.c:2705 filename_setxattr+0xad/0x1c0 fs/xattr.c:660 path_setxattrat+0x1d8/0x280 fs/xattr.c:713 __do_sys_lsetxattr fs/xattr.c:754 [inline] __se_sys_lsetxattr fs/xattr.c:750 [inline] __x64_sys_lsetxattr+0xd0/0x150 fs/xattr.c:750 ...
[CAUSE]
The index-header validators only validated INDEX_HDR-level geometry. They did not walk each NTFS_DE to verify entry alignment, subnode layout, or that key_size fit inside the entry payload. They also allowed a last sentinel entry to carry a non-zero key_size.
[FIX]
Walk every NTFS_DE in ntfs3's index-header validators and reject entries with invalid layout, mismatched subnode state, oversized key_size, or non-zero sentinel keys before lookup or log replay can consume them.
--- fs/ntfs3/fslog.c | 26 ++++++++++++++++++++------ fs/ntfs3/index.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 7 deletions(-)
fs/ntfs3/fslog.c +20 -6
@@ -2641,11 +2641,12 @@ static int read_next_log_rec(struct ntfs_log *log, struct lcb *lcb, u64 *lsn)bool check_index_header (const struct INDEX_HDR *hdr,size_t bytes) { +const bool has_subnode =hdr_has_subnode (hdr);__le16 mask;u32 min_de, de_off, used, total;const struct NTFS_DE *e; -if (hdr_has_subnode (hdr)) { +if (has_subnode) { min_de =sizeof (struct NTFS_DE ) +sizeof (u64); mask =NTFS_IE_HAS_SUBNODES ; }else {
@@ -2662,20 +2663,33 @@ bool check_index_header(const struct INDEX_HDR *hdr, size_t bytes)return false; } - e =Add2Ptr (hdr, de_off); + e = (const struct NTFS_DE *)((const u8 *)hdr + de_off);for (;;) {u16 esize =le16_to_cpu (e->size); -struct NTFS_DE *next =Add2Ptr (e, esize); +u16 key_size =le16_to_cpu (e->key_size); +u16 data_size; -if (esize < min_de ||PtrOffset (hdr, next) > used || +if (!IS_ALIGNED (esize,8 ) || esize < min_de || (e->flags &NTFS_IE_HAS_SUBNODES ) != mask) {return false; } -if (de_is_last (e)) +if (size_add (de_off, esize) > used) +return false; + +if (de_is_last (e)) { +if (key_size) +return false; +break ; + } + + data_size = esize - min_de; +if (key_size > data_size) +return false; - e = next; + de_off += esize; + e = (const struct NTFS_DE *)((const u8 *)hdr + de_off); }return true;
fs/ntfs3/index.c +36 -1
@@ -613,16 +613,51 @@ static const struct NTFS_DE *hdr_insert_head(struct INDEX_HDR *hdr,*/ static bool index_hdr_check (const struct INDEX_HDR *hdr,u32 bytes) { +const bool has_subnode =hdr_has_subnode (hdr); +const u16 min_size =sizeof (struct NTFS_DE ) + + (has_subnode ?sizeof (u64) :0 );u32 end =le32_to_cpu (hdr->used);u32 tot =le32_to_cpu (hdr->total);u32 off =le32_to_cpu (hdr->de_off); +const struct NTFS_DE *e;if (!IS_ALIGNED (off,8 ) || tot > bytes || end > tot || -size_add (off,sizeof (struct NTFS_DE )) > end) { +size_add (off, min_size) > end) {/* incorrect index buffer. */ return false; } +/* Ensure every key stays inside its entry before lookup walks it. */ + e = (const struct NTFS_DE *)((const u8 *)hdr + off); +for (;;) { +u16 e_size =le16_to_cpu (e->size); +u16 key_size =le16_to_cpu (e->key_size); +u16 data_size; + +if (!IS_ALIGNED (e_size,8 ) || e_size < min_size || +de_has_vcn (e) != has_subnode) { +/* incorrect index entry. */ +return false; + } + +if (size_add (off, e_size) > end) +return false; + +if (de_is_last (e)) { +if (key_size) +return false; + +break ; + } + + data_size = e_size - min_size; +if (key_size > data_size) +return false; + + off += e_size; + e = (const struct NTFS_DE *)((const u8 *)hdr + off); + } +return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 160/1193 ntfs3: fix out-of-bounds read in ntfs_dir_emit() and hdr_find_e()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessandro Schino <[email protected]>
[ Upstream commit aa1bdbb39f49c5bc9779316891c40005517842a5 ]
The bounds check in ntfs_dir_emit() compares fname->name_len (a character count) against e->size (a byte count) without accounting for the 2-byte-per-character UTF-16LE encoding or the ATTR_FILE_NAME header size:
if (fname->name_len + sizeof(struct NTFS_DE) > le16_to_cpu(e->size))
This computes: name_len + 16 > e_size
The correct check must account for the ATTR_FILE_NAME header (66 bytes before the name) and the UTF-16LE character size (2 bytes each):
sizeof(NTFS_DE) + offsetof(ATTR_FILE_NAME, name) + name_len * sizeof(short) > e_size
Which computes: 16 + 66 + name_len * 2 > e_size
The correct calculation already exists as fname_full_size() in ntfs.h and is used in cmp_fnames(), namei.c, and fslog.c, but was not used in the readdir path.
A crafted NTFS image with an index entry containing a small e->size but large fname->name_len bypasses the current check, causing ntfs_utf16_to_nls() to read past the entry boundary.
Additionally, add a key_size validation in hdr_find_e() to ensure the declared key_size does not exceed the available entry data, preventing comparison functions from reading past entry boundaries on the lookup path.
--- fs/ntfs3/dir.c | 4 +++- fs/ntfs3/index.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-)
fs/ntfs3/dir.c +3 -1
@@ -304,7 +304,9 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,if (sbi->options->nohidden && (fname->dup.fa &FILE_ATTRIBUTE_HIDDEN ))return true; -if (fname->name_len +sizeof (struct NTFS_DE ) >le16_to_cpu (e->size)) +if (sizeof (struct NTFS_DE ) + + offsetof(struct ATTR_FILE_NAME , name) + + fname->name_len *sizeof (short ) >le16_to_cpu (e->size))return true; name_len = ntfs_utf16_to_nls(sbi, fname->name, fname->name_len, name,
fs/ntfs3/index.c +4 -0
@@ -794,6 +794,10 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, binary_search: e_key_len =le16_to_cpu (e->key_size); +/* Validate key_size fits within the entry data area. */ +if (e_key_len >le16_to_cpu (e->size) -sizeof (struct NTFS_DE )) +return NULL ; + diff2 = (*cmp)(key, key_len, e +1 , e_key_len, ctx);if (diff2 >0 ) {if (found) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 161/1193 ASoC: codecs: rk3328: Use managed GPIO and clock helpers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 0cf3489bba9ad13aae052232e223e19a620fe7a7 ]
rk3328_platform_probe() acquires the mute GPIO with gpiod_get_optional() but never releases it. It also enables mclk and pclk manually while relying on probe error labels for unwind, and the driver has no platform remove callback to disable those clocks after a successful unbind.
This path has already needed fixes for missing clock unwinds on probe errors. Use devm_gpiod_get_optional() and devm_clk_get_enabled() so the GPIO and enabled clock lifetimes are tied to the device. This removes the manual error labels and makes both probe failure and driver unbind follow the normal devres cleanup path.
--- sound/soc/codecs/rk3328_codec.c | 54 ++++++++------------------------- 1 file changed, 13 insertions(+), 41 deletions(-)
sound/soc/codecs/rk3328_codec.c +13 -41
@@ -425,7 +425,6 @@ static int rk3328_platform_probe(struct platform_device *pdev)struct rk3328_codec_priv *rk3328;struct regmap *grf;void __iomem *base; -int ret =0 ; rk3328 =devm_kzalloc (&pdev->dev,sizeof (*rk3328),GFP_KERNEL );if (!rk3328)
@@ -441,14 +440,13 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON2 , (BIT (14 ) <<16 |BIT (14 ))); - ret =of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , - &rk3328->spk_depop_time); -if (ret <0 ) { +if (of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , + &rk3328->spk_depop_time)) {dev_info (&pdev->dev,"spk_depop_time use default value.\n" ); rk3328->spk_depop_time =200 ; } - rk3328->mute =gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH ); + rk3328->mute =devm_gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH );if (IS_ERR (rk3328->mute))return PTR_ERR (rk3328->mute);/*
@@ -461,57 +459,31 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON10 ,BIT (17 ) |BIT (1 )); } - rk3328->mclk =devm_clk_get (&pdev->dev,"mclk" ); + rk3328->mclk =devm_clk_get_enabled (&pdev->dev,"mclk" );if (IS_ERR (rk3328->mclk))return PTR_ERR (rk3328->mclk); - ret =clk_prepare_enable (rk3328->mclk); -if (ret) -return ret;clk_set_rate (rk3328->mclk,INITIAL_FREQ ); - rk3328->pclk =devm_clk_get (&pdev->dev,"pclk" ); -if (IS_ERR (rk3328->pclk)) { -dev_err (&pdev->dev,"can't get acodec pclk\n" ); - ret =PTR_ERR (rk3328->pclk); - goto err_unprepare_mclk; - } - - ret =clk_prepare_enable (rk3328->pclk); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable acodec pclk\n" ); - goto err_unprepare_mclk; - } + rk3328->pclk =devm_clk_get_enabled (&pdev->dev,"pclk" ); +if (IS_ERR (rk3328->pclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (rk3328->pclk), +"failed to get or enable acodec pclk\n" ); base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (base)) { - ret =PTR_ERR (base); - goto err_unprepare_pclk; - } +if (IS_ERR (base)) +return PTR_ERR (base); rk3328->regmap =devm_regmap_init_mmio (&pdev->dev, base, &rk3328_codec_regmap_config); -if (IS_ERR (rk3328->regmap)) { - ret =PTR_ERR (rk3328->regmap); - goto err_unprepare_pclk; - } +if (IS_ERR (rk3328->regmap)) +return PTR_ERR (rk3328->regmap);platform_set_drvdata (pdev, rk3328); - ret =devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, +return devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, rk3328_dai,ARRAY_SIZE (rk3328_dai)); -if (ret) - goto err_unprepare_pclk; - -return 0 ; - -err_unprepare_pclk: -clk_disable_unprepare (rk3328->pclk); - -err_unprepare_mclk: -clk_disable_unprepare (rk3328->mclk); -return ret; }static const struct of_device_id rk3328_codec_of_match[]__maybe_unused = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 162/1193 ALSA: seq: oss: Reject reads that cannot fit the next event
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 611f538253d970f4d152003841544e875828d015 ]
snd_seq_oss_read() checks whether the next queued OSS sequencer event fits in the remaining userspace buffer before removing it from the read queue.
The check is inverted. It currently stops when the event is smaller than the remaining buffer, so a normal 4-byte event is not copied for an 8-byte read buffer. Conversely, an 8-byte event can be copied for a smaller read count.
Break only when the remaining userspace buffer is smaller than the next event, and report -EINVAL if no complete event has been copied. This prevents an undersized read from looking like end-of-file while leaving the event queued for a later read with a large enough buffer.
--- sound/core/seq/oss/seq_oss_rw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/seq/oss/seq_oss_rw.c +2 -1
@@ -57,7 +57,8 @@ snd_seq_oss_read(struct seq_oss_devinfo *dp, char __user *buf, int count)break ; } ev_len =ev_length (&rec); -if (ev_len < count) { +if (count < ev_len) { + err = -EINVAL ;snd_seq_oss_readq_unlock (readq, flags);break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 163/1193 dpaa2-switch: rework FDB management on the bridge leave path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit efc1d92eacf03afa6f4d53bf7120e059b6f961f2 ]
On bridge leave, the dpaa2_switch_port_set_fdb() function always allocates a new FDB for the port which is becoming standalone. In case no FDB is found, then the port leaving a bridge will continue to use the current one.
The above logic does not cover the case in which there are multiple bridges which have ports from the same DPSW instance. In this case, when the last port leaves bridge #1, it finds an unused FDB to switch to, but the old FDB is not marked as unused. Since the number of FDBs is equal to the number of DPSW interfaces, this will eventually lead to multiple ports sharing the same FDB.
Fix this by changing how we are managing the FDBs on the leave path. Instead of directly allocating a new FDB, first verify if the current port is the last one to leave a bridge. If this is the case, then continue to use the current FDB and only allocate another FDB if there are other ports remaining in the bridge.
--- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +24 -7
@@ -54,27 +54,44 @@ dpaa2_switch_filter_block_get_unused(struct ethsw_core *ethsw)static u16 dpaa2_switch_port_set_fdb (struct ethsw_port_priv *port_priv,struct net_device *bridge_dev) { +struct ethsw_core *ethsw = port_priv->ethsw_data;struct ethsw_port_priv *other_port_priv =NULL ;struct dpaa2_switch_fdb *fdb;struct net_device *other_dev; +bool last_fdb_user = true;struct list_head *iter; +int i;/* If we leave a bridge (bridge_dev is NULL), find an unused * FDB and use that. */ if (!bridge_dev) { - fdb =dpaa2_switch_fdb_get_unused (port_priv->ethsw_data); - -/* If there is no unused FDB, we must be the last port that -* leaves the last bridge, all the others are standalone. We -* can just keep the FDB that we already have. -*/ +/* First verify if this is the last port to leave this bridge */ +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) { +if (!ethsw->ports[i] || ethsw->ports[i] == port_priv) +continue ; +if (ethsw->ports[i]->fdb == port_priv->fdb) { + last_fdb_user = false; +break ; + } + } -if (!fdb) { +/* If this is the last user of the FDB, just keep using it. */ +if (last_fdb_user) { port_priv->fdb->bridge_dev =NULL ;return 0 ; } +/* Since we are not the last port which leaves a bridge, +* acquire a new FDB and use it. The number of FDBs is sized to +* accommodate all switch ports as standalone, each with its +* private FDB, which means that dpaa2_switch_fdb_get_unused() +* must succeed here. WARN if not. +*/ + fdb =dpaa2_switch_fdb_get_unused (port_priv->ethsw_data); +if (WARN_ON (!fdb)) +return 0 ; + port_priv->fdb = fdb; port_priv->fdb->in_use = true; port_priv->fdb->bridge_dev =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 164/1193 dpaa2-switch: fix the error path in dpaa2_switch_rx()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 74c1c9f5c0c30bbd0c2cf87b6e3507e7ea46c13d ]
In case of an error in dpaa2_switch_rx(), the dpaa2_switch_free_fd() function is called in order to free the FD. This is incorrect since the dpaa2_switch_free_fd() is intended to be used on Tx frame descriptors, meaning that it expects in the software annotation area of the FD data to find a valid skb pointer on which to call dev_kfree_skb().
Fix this by extracting the dma_unmap_page() from dpaa2_switch_build_linear_skb() directly into the dpaa2_switch_rx() function. This allows us to directly use free_pages() in case of an error before an SKB was created and kfree_skb() afterwards.
--- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +12 -11
@@ -2394,18 +2394,13 @@ static int dpaa2_switch_port_blocking_event(struct notifier_block *nb,/* Build a linear skb based on a single-buffer frame descriptor */ static struct sk_buff *dpaa2_switch_build_linear_skb (struct ethsw_core *ethsw, -const struct dpaa2_fd *fd) +const struct dpaa2_fd *fd, +void *fd_vaddr) {u16 fd_offset =dpaa2_fd_get_offset (fd); -dma_addr_t addr =dpaa2_fd_get_addr (fd);u32 fd_length =dpaa2_fd_get_len (fd);struct device *dev = ethsw->dev;struct sk_buff *skb =NULL ; -void *fd_vaddr; - - fd_vaddr =dpaa2_iova_to_virt (ethsw->iommu_domain, addr); -dma_unmap_page (dev, addr,DPAA2_SWITCH_RX_BUF_SIZE , -DMA_FROM_DEVICE ); skb =build_skb (fd_vaddr,DPAA2_SWITCH_RX_BUF_SIZE +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )));
@@ -2431,6 +2426,7 @@ static void dpaa2_switch_tx_conf(struct dpaa2_switch_fq *fq,static void dpaa2_switch_rx (struct dpaa2_switch_fq *fq,const struct dpaa2_fd *fd) { +dma_addr_t addr =dpaa2_fd_get_addr (fd);struct ethsw_core *ethsw = fq->ethsw;struct ethsw_port_priv *port_priv;struct net_device *netdev;
@@ -2438,10 +2434,14 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,struct sk_buff *skb;u16 vlan_tci, vid;int if_id, err; +void *vaddr; + + vaddr =dpaa2_iova_to_virt (ethsw->iommu_domain, addr); +dma_unmap_page (ethsw->dev, addr,DPAA2_SWITCH_RX_BUF_SIZE , +DMA_FROM_DEVICE );/* get switch ingress interface ID */ if_id =upper_32_bits (dpaa2_fd_get_flc (fd)) &0x0000FFFF ; -if (if_id >= ethsw->sw_attr.num_ifs) {dev_err (ethsw->dev,"Frame received from unknown interface!\n" ); goto err_free_fd;
@@ -2457,7 +2457,7 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq, } } - skb =dpaa2_switch_build_linear_skb (ethsw, fd); + skb =dpaa2_switch_build_linear_skb (ethsw, fd, vaddr);if (unlikely (!skb)) goto err_free_fd;
@@ -2475,7 +2475,8 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq, err =__skb_vlan_pop (skb, &vlan_tci);if (err) {dev_info (ethsw->dev,"__skb_vlan_pop() returned %d" , err); - goto err_free_fd; +kfree_skb (skb); +return ; } }
@@ -2490,7 +2491,7 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,return ; err_free_fd: -dpaa2_switch_free_fd (ethsw, fd); +free_pages ((unsigned long )vaddr,0 ); }static void dpaa2_switch_detect_features (struct ethsw_core *ethsw)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 165/1193 net: dsa: sja1105: flower: reject cross-chip redirect
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Yang <[email protected]>
[ Upstream commit cfa5274a5dc2a23b957da5dc806d2ac0c7a66af0 ]
dsa_port_from_netdev() may return a valid port from a different switch chip. Programming another chip's port index into the local hardware causes redirection to the wrong port, or an out-of-bounds access if the index exceeds the local chip's port count.
Apply a minimal fix that adds a check to catch this case and adjusts the extack message. When cls->common.skip_sw is not set, the operation could instead redirect to the upstream port and let the software or upstream switch(es) handle the forward, but that is not addressed here.
--- drivers/net/dsa/sja1105/sja1105_flower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/sja1105/sja1105_flower.c +2 -2
@@ -388,9 +388,9 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,struct dsa_port *to_dp; to_dp =dsa_port_from_netdev (act->dev); -if (IS_ERR (to_dp)) { +if (IS_ERR (to_dp) || to_dp->ds != ds) {NL_SET_ERR_MSG_MOD (extack, -"Destination not a switch port" ); +"Destination not a local switch port" );return -EOPNOTSUPP ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 166/1193 dpaa2-switch: fix handling of NAPI on the remove path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit e23d7c8c1d4ba435c457d7ffb2669175ec819b07 ]
All the NAPI instances for a DPSW device are attached to the first switch port's net_device but shared by all ports. The NAPI instances get disabled only once the last port goes down.
This causes an issue on the .remove() path where each port is unregistered and freed one at a time, causing the NAPI instances to be deleted even though they are not disabled.
In order to avoid this, split up the unregister_netdev() calls from the free_netdev() so that we make sure all ports go down before we attempt a deletion of NAPI instances. Also, make the netif_napi_del() explicit as it is on the .probe() path.
--- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +10 -5
@@ -3263,7 +3263,6 @@ static void dpaa2_switch_teardown(struct fsl_mc_device *sw_dev)static void dpaa2_switch_remove (struct fsl_mc_device *sw_dev) { -struct ethsw_port_priv *port_priv;struct ethsw_core *ethsw;struct device *dev;int i;
@@ -3275,11 +3274,17 @@ static void dpaa2_switch_remove(struct fsl_mc_device *sw_dev)dpsw_disable (ethsw->mc_io,0 , ethsw->dpsw_handle); -for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) { - port_priv = ethsw->ports[i]; -unregister_netdev (port_priv->netdev); +/* Unregister all the netdevs so that they are brought down and the +* shared NAPI instances gets disabled. +*/ +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) +unregister_netdev (ethsw->ports[i]->netdev); + +for (i =0 ; i <DPAA2_SWITCH_RX_NUM_FQS ; i++) +netif_napi_del (ðsw->fq[i].napi); + +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++)dpaa2_switch_remove_port (ethsw, i); - }kfree (ethsw->fdbs);kfree (ethsw->filter_blocks);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 167/1193 thermal/drivers/qcom/tsens: Atomic temperature read with hardware-guided retries
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Priyansh Jain <[email protected]>
[ Upstream commit e28ef2f3ccea276436bd0f30c93f99e764ba492b ]
The existing TSENS temperature read logic polls the valid bit and then reads the temperature register. When temperature reads are triggered at very short intervals, this can race with hardware updates and allow the temperature field to be read while it is still being updated.
In this case, the valid bit may already be asserted even though the temperature value is transitioning, resulting in an incorrect reading.
Hardware programming guidelines require the temperature value and the valid bit to be sampled atomically in the same read transaction. A reading is considered valid only if the valid bit is observed set in that same sample.
The guidelines further specify that software should attempt the temperature read up to three times to account for transient update windows. If none of the attempts yields a valid sample, a stable fallback value must be returned: if the first and second samples match, the second value is returned;otherwise, if the second and third samples match, the third value is returned;if neither pair matches, -EAGAIN is returned.
Update the TSENS sensor read logic to implement atomic sampling along with the recommended retry-and-compare fallback behavior. This removes the race window and ensures deterministic temperature values in accordance with hardware requirements.
--- drivers/thermal/qcom/tsens.c | 111 ++++++++++++++++++++++++----------- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 78 insertions(+), 34 deletions(-)
drivers/thermal/qcom/tsens.c +77 -34
@@ -315,9 +315,66 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) }/** -* tsens_hw_to_mC - Return sign-extended temperature in mCelsius. +* tsens_read_temp - Retrieve temperature readings from the hardware. * @s: Pointer to sensor struct * @field: Index into regmap_field array pointing to temperature data +* @temp: temperature in deciCelsius to be read from hardware +* +* This function handles temperature returned in ADC code or deciCelsius +* depending on IP version. +* +* Return: 0 on success, a negative errno will be returned in error cases +*/ +static int tsens_read_temp (const struct tsens_sensor *s,int field,int *temp) +{ +struct tsens_priv *priv = s->priv; +int temp_val[MAX_READ_RETRY ] = {0 }; +u32 status; +int ret; +u32 last_temp_mask =GENMASK (priv->fields[LAST_TEMP_0 ].msb, + priv->fields[LAST_TEMP_0 ].lsb); +u32 valid_bit = priv->rf[VALID_0 ] ?BIT (priv->fields[VALID_0 ].lsb) :0 ; + +for (int i =0 ; i <MAX_READ_RETRY ; i++) { + ret =regmap_read (priv->tm_map, priv->fields[field].reg, &status); +if (ret) +return ret; + +/* VER_0 doesn't have a VALID bit */ +if (!valid_bit) { + *temp = status & last_temp_mask; +return 0 ; + } + + temp_val[i] = status & last_temp_mask; + +if (status & valid_bit) { + *temp = temp_val[i]; +return 0 ; + } + } + +/* +* As per the HW guidelines, if none of the attempts observe a +* valid sample, a stable fallback value must be returned. If the +* first and second samples match, the second value is returned; +* otherwise, if the second and third samples match, the third +* value is returned. +*/ +if (temp_val[0 ] == temp_val[1 ]) + *temp = temp_val[1 ]; +else if (temp_val[1 ] == temp_val[2 ]) + *temp = temp_val[2 ]; +else +return -EAGAIN ; + +return 0 ; +} + +/** +* tsens_hw_to_mC - Return sign-extended temperature in mCelsius. +* @s: Pointer to sensor struct +* @temp: temperature in milliCelsius to be read from hardware * * This function handles temperature returned in ADC code or deciCelsius * depending on IP version.
@@ -325,20 +382,14 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s)* Return: Temperature in milliCelsius on success, a negative errno will * be returned in error cases */ -static int tsens_hw_to_mC (const struct tsens_sensor *s,int field) +static int tsens_hw_to_mC (const struct tsens_sensor *s,int temp) {struct tsens_priv *priv = s->priv;u32 resolution; -u32 temp =0 ; -int ret; resolution = priv->fields[LAST_TEMP_0 ].msb - priv->fields[LAST_TEMP_0 ].lsb; - ret =regmap_field_read (priv->rf[field], &temp); -if (ret) -return ret; -/* Convert temperature from ADC code to milliCelsius */ if (priv->feat->adc)return code_to_degc (temp, s) *1000 ;
@@ -513,8 +564,10 @@ static int tsens_read_irq_state(struct tsens_priv *priv, u32 hw_id, &d->crit_irq_mask);if (ret)return ret; - - d->crit_thresh =tsens_hw_to_mC (s,CRIT_THRESH_0 + hw_id); + ret =regmap_field_read (priv->rf[CRIT_THRESH_0 + hw_id], &d->crit_thresh); +if (ret) +return ret; + d->crit_thresh =tsens_hw_to_mC (s, d->crit_thresh); }else {/* No mask register on older TSENS */ d->up_irq_mask =0 ;
@@ -524,8 +577,16 @@ static int tsens_read_irq_state(struct tsens_priv *priv, u32 hw_id, d->crit_thresh =0 ; } - d->up_thresh =tsens_hw_to_mC (s,UP_THRESH_0 + hw_id); - d->low_thresh =tsens_hw_to_mC (s,LOW_THRESH_0 + hw_id); + ret =regmap_field_read (priv->rf[UP_THRESH_0 + hw_id], &d->up_thresh); +if (ret) +return ret; + + d->up_thresh =tsens_hw_to_mC (s, d->up_thresh); + ret =regmap_field_read (priv->rf[LOW_THRESH_0 + hw_id], &d->low_thresh); +if (ret) +return ret; + + d->low_thresh =tsens_hw_to_mC (s, d->low_thresh); dev_dbg(priv->dev, "[%u] %s%s: status(%u|%u|%u) | clr(%u|%u|%u) | mask(%u|%u|%u)\n", hw_id, __func__,
@@ -749,33 +810,15 @@ static void tsens_disable_irq(struct tsens_priv *priv)int get_temp_tsens_valid (const struct tsens_sensor *s,int *temp) { -struct tsens_priv *priv = s->priv;int hw_id = s->hw_id;u32 temp_idx =LAST_TEMP_0 + hw_id; -u32 valid_idx =VALID_0 + hw_id; -u32 valid;int ret; -/* VER_0 doesn't have VALID bit */ -if (tsens_version (priv) ==VER_0 ) - goto get_temp; - -/* Valid bit is 0 for 6 AHB clock cycles. -* At 19.2MHz, 1 AHB clock is ~60ns. -* We should enter this loop very, very rarely. -* Wait 1 us since it's the min of poll_timeout macro. -* Old value was 400 ns. -*/ - ret =regmap_field_read_poll_timeout (priv->rf[valid_idx], valid, - valid,1 ,20 *USEC_PER_MSEC ); -if (ret) -return ret; - -get_temp: -/* Valid bit is set, OK to read the temperature */ - *temp =tsens_hw_to_mC (s, temp_idx); + ret =tsens_read_temp (s, temp_idx, temp); +if (!ret) + *temp =tsens_hw_to_mC (s, *temp); -return 0 ; +return ret; }int get_temp_common (const struct tsens_sensor *s,int *temp)
drivers/thermal/qcom/tsens.h +1 -0
@@ -21,6 +21,7 @@#define THRESHOLD_MIN_ADC_CODE 0x0#define MAX_SENSORS 16 +#define MAX_READ_RETRY 3#include <linux/interrupt.h> #include <linux/thermal.h>
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 168/1193 xhci: Prevent queuing new commands if xhci is inaccessible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit 82b70c799281cc24506085be978b829149ba0ca4 ]
Refuse to queue a new command on the command ring if xHC is marked inaccessible with the HCD_FLAG_HW_ACCESSIBLE.
HCD_FLAG_HW_ACCESSIBLE is set and cleared in suspend and resume.
Also print a warning if xhci is being suspended with commands still pending on the command ring.
--- drivers/usb/host/xhci-ring.c | 6 ++++++ drivers/usb/host/xhci.c | 4 ++++ 2 files changed, 10 insertions(+)
drivers/usb/host/xhci-ring.c +6 -0
@@ -4468,6 +4468,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, u32 field3, u32 field4, bool command_must_succeed) { int reserved_trbs = xhci->cmd_ring_reserved_trbs; +struct usb_hcd *hcd =xhci_to_hcd (xhci);int ret; if ((xhci->xhc_state & XHCI_STATE_DYING) ||
@@ -4477,6 +4478,11 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,return -ESHUTDOWN ; } +if (!HCD_HW_ACCESSIBLE (hcd)) { +xhci_warn (xhci,"Can't queue command, xHC not accessible\n" ); +return -ESHUTDOWN ; + } +if (!command_must_succeed) reserved_trbs++;
drivers/usb/host/xhci.c +4 -0
@@ -919,6 +919,10 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)/* step 1: stop endpoint */ /* skipped assuming that port suspend has done */ +/* Check if command ring is empty */ +if (!list_empty (&xhci->cmd_list)) +xhci_warn (xhci,"Suspending and stopping xHC with pending command!\n" ); +/* step 2: clear Run/Stop bit */ command =readl (&xhci->op_regs->command); command &= ~CMD_RUN ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 151/1193 ASoC: qcom: q6apm: return error code to consumers on failures
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
[ Upstream commit 3075ae5abbc370d2a9a01bd6d554a412d406f5bd ]
Return errors from audioreach_set_media_format() to ensure callers are notified when media format setup fails.
This could hide failures while programming media format parameters for individual modules and allow graph setup to continue with incomplete configuration.
--- sound/soc/qcom/qdsp6/q6apm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/qcom/qdsp6/q6apm.c +5 -5
@@ -203,10 +203,7 @@ int q6apm_graph_media_format_shmem(struct q6apm_graph *graph,if (!module)return -ENODEV ; -audioreach_set_media_format (graph, module, cfg); - -return 0 ; - +return audioreach_set_media_format (graph, module, cfg); }EXPORT_SYMBOL_GPL (q6apm_graph_media_format_shmem);
@@ -371,6 +368,7 @@ int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_mostruct audioreach_sub_graph *sgs;struct audioreach_container *container;struct audioreach_module *module; +int ret;list_for_each_entry (sgs, &info->sg_list, node) {list_for_each_entry (container, &sgs->container_list, node) {
@@ -379,7 +377,9 @@ int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_mo (module->module_id == MODULE_ID_RD_SHARED_MEM_EP)) continue; -audioreach_set_media_format (graph, module, cfg); + ret =audioreach_set_media_format (graph, module, cfg); +if (ret) +return ret; } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 169/1193 drm/amdkfd: fix UAF race in destroy_queue_cpsch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alysa Liu <[email protected]>
[ Upstream commit ac081deaf16a639ea7dff2f285fe421a33c1ade0 ]
wait_on_destroy_queue() drops locks to wait for queue resume, allowing a concurrent destroy to free the queue. Use is_being_destroyed flag to serialize destruction.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
@@ -2048,6 +2048,9 @@ static int wait_on_destroy_queue(struct device_queue_manager *dqm,if (pdd->qpd.is_debug)return ret; +if (q->properties.is_being_destroyed) +return -EBUSY ; + q->properties.is_being_destroyed = true;if (pdd->process->debug_trap_enabled && q->properties.is_suspended) {
@@ -2060,6 +2063,9 @@ static int wait_on_destroy_queue(struct device_queue_manager *dqm,dqm_lock (dqm); } +if (ret) + q->properties.is_being_destroyed = false; +return ret; }
@@ -2151,7 +2157,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,return retval; failed_try_destroy_debugged_queue: - + q->properties.is_being_destroyed = false;dqm_unlock (dqm);return retval; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 170/1193 drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asad Kamal <[email protected]>
[ Upstream commit f193e71fa9fab2e68ef85201b106e8f580d3a25b ]
The powerplay path allocates hardcode_pp_table once with kmemdup(..., soft_pp_table_size). memcpy(..., size) used the sysfs store count (up to PAGE_SIZE) with no upper bound, causing heap overflow. Reject writes where size exceeds soft_pp_table_size.
--- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +3 -0
@@ -680,6 +680,9 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; +if (size > hwmgr->soft_pp_table_size) +return -EINVAL ; +if (!hwmgr->hardcode_pp_table) { hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, hwmgr->soft_pp_table_size,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 171/1193 drm/amdgpu: fix buffer overflow during vBIOS update
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiwu Zhang <[email protected]>
[ Upstream commit 6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5 ]
Clamp the buffer postion to write by setting the bin attribute to the maximum buffer size so that VFS layer will block the out-of-bounds accessing.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
@@ -3694,7 +3694,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,*/ static struct bin_attribute psp_vbflash_bin_attr = { .attr = {.name ="psp_vbflash" , .mode =0660 }, - .size =0 , + .size =AMD_VBIOS_FILE_MAX_SIZE_B , .write = amdgpu_psp_vbflash_write, .read = amdgpu_psp_vbflash_read, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 172/1193 RDMA/irdma: Fix typo in SQ completions generation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyrill Gorcunov <[email protected]>
[ Upstream commit b548a6c4eee5c428663f3944e173e6c92e2e8d6f ]
When we generate completion for SQ the opcode while being properly read from ring buffer is ignored when written back to completion. Seems to be a simple typo.
--- drivers/infiniband/hw/irdma/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/utils.c +1 -1
@@ -2478,7 +2478,7 @@ void irdma_generate_flush_completions(struct irdma_qp *iwqp) cmpl->cpi.wr_id = qp->sq_wrtrk_array[wqe_idx].wrid; sw_wqe = qp->sq_base[wqe_idx].elem;get_64bit_val (sw_wqe,24 , &wqe_qword); - cmpl->cpi.op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE ,IRDMAQPSQ_OPCODE ); + cmpl->cpi.op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE , wqe_qword); cmpl->cpi.q_type =IRDMA_CQE_QTYPE_SQ ;/* remove the SQ WR by moving SQ tail*/ IRDMA_RING_SET_TAIL(*sq_ring,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 173/1193 net/mlx5: E-Switch, align disable sequence with switchdev-to-legacy transition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shay Drory <[email protected]>
[ Upstream commit b48b6308dfaeae49fcda61b4066773cb5e8a9ce8 ]
This patch align the eswitch disable sequence with the switchdev-to-legacy mode transition, where eswitch must be disabled before device detachment. The consistent ordering is required for proper SD LAG cleanup which depends on eswitch state during teardown.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -0
@@ -1524,6 +1524,7 @@ void mlx5_uninit_one(struct mlx5_core_dev *dev)mlx5_hwmon_dev_unregister (dev);mlx5_crdump_disable (dev); +mlx5_eswitch_disable (dev->priv.eswitch);mlx5_unregister_device (dev);if (!test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {
@@ -1608,6 +1609,7 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend)devl_assert_locked (priv_to_devlink (dev));mutex_lock (&dev->intf_state_mutex); +mlx5_eswitch_disable (dev->priv.eswitch);mlx5_detach_device (dev, suspend);if (!test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 174/1193 clk: keystone: dont cache clock rate
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
[ Upstream commit a80b32a140c8612bbaed27009c383d43304db6d5 ]
The TISCI firmware will return 0 if the clock or consumer is not enabled although there is a stored value in the firmware. IOW a call to set rate will work but at get rate will always return 0 if the clock is disabled.
The clk framework will try to cache the clock rate when it's requested by a consumer. If the clock or consumer is not enabled at that point, the cached value is 0, which is wrong. Thus, disable the cache altogether.
--- drivers/clk/keystone/sci-clk.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/keystone/sci-clk.c +8 -0
@@ -333,6 +333,14 @@ static int _sci_clk_build(struct sci_clk_provider *provider, init.ops = &sci_clk_ops; init.num_parents = sci_clk->num_parents; + +/* +* A clock rate query to the SCI firmware will return 0 if either the +* clock itself is disabled or the attached device/consumer is disabled. +* This makes it inherently unsuitable for the caching of the clk +* framework. +*/ + init.flags =CLK_GET_RATE_NOCACHE ; sci_clk->hw.init = &init; ret =devm_clk_hw_register (provider->dev, &sci_clk->hw);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 175/1193 ALSA: hda/realtek: Add quirk for ASUS VivoBook X509DAP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Faleichyk <[email protected]>
[ Upstream commit 3580bc53520ce4efc94ece5886ad3670b93667ba ]
The internal microphone on ASUS VivoBook X509DAP (subsystem ID 0x1043:0x197e) is not detected without a quirk entry. Add ALC256_FIXUP_ASUS_MIC_NO_PRESENCE to fix the issue.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10310,6 +10310,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x194e ,"ASUS UX563FD" ,ALC294_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x1970 ,"ASUS UX550VE" ,ALC289_FIXUP_ASUS_GA401 ), +SND_PCI_QUIRK (0x1043 ,0x197e ,"ASUS VivoBook X509DAP" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1982 ,"ASUS B1400CEPE" ,ALC256_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 176/1193 ipmi: si: Use platform_get_irq_optional() to retrieve interrupt
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 39851b7e580a65bee732e5364f0efb974b242370 ]
Use platform_get_irq_optional() to retrieve the interrupt resource instead of directly parsing and mapping the OF node via irq_of_parse_and_map(). This is the standard pattern for platform devices. irq_of_parse_and_map() requires ire_dispose_mapping(), which is missing.
Message-ID: <[email protected]> [Handle a negative return from platform_get_irq_optional() to mean
no interrupt is assigned.]
--- drivers/char/ipmi/ipmi_si_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_platform.c +4 -1
@@ -279,7 +279,10 @@ static int of_ipmi_probe(struct platform_device *pdev) io.regspacing = regspacing ?be32_to_cpup (regspacing) :DEFAULT_REGSPACING ; io.regshift = regshift ?be32_to_cpup (regshift) :0 ; - io.irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + io.irq =platform_get_irq_optional (pdev,0 ); +if (io.irq <0 ) + io.irq =0 ; + io.dev = &pdev->dev; dev_dbg(&pdev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 177/1193 drm/amdkfd: Unwind debug trap enable on copy_to_user failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongqiang Sun <[email protected]>
[ Upstream commit 01112e241e37f9ac98b6f418d93ce2e0b87b7ee0 ]
If kfd_dbg_trap_enable() fails while copying runtime_info to userspace, it had already activated the trap, set debug_trap_enabled, taken an extra process reference, and opened the debug event file. Return -EFAULT without unwinding that state, leaving inconsistent trap state and a refcount imbalance that could break later DISABLE/ENABLE.
On copy_to_user failure, deactivate the trap and undo the rest of the enable setup before returning.
--- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +6 -0
@@ -805,6 +805,12 @@ int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd,if (copy_to_user (runtime_info, (void *)&target->runtime_info, copy_size)) {kfd_dbg_trap_deactivate (target, false,0 ); +fput (target->dbg_ev_file); + target->dbg_ev_file =NULL ; +if (target->debugger_process) +atomic_dec (&target->debugger_process->debugged_process_count); + target->debug_trap_enabled = false; +kfd_unref_process (target); r = -EFAULT ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 178/1193 wifi: nl80211: Increase ie_len size to prevent truncated IEs in new peer notifications
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thiyagarajan Pandiyan <[email protected]>
[ Upstream commit dfb67ae569bf0726187725b1ef8d89377778861e ]
Currently, ie_len in cfg80211_notify_new_peer_candidate is defined as 1-byte field, capping the maximum IE list size at 255 bytes. When a large beacon is received, the IE list is truncated, passing incomplete data to wpa_supplicant. This causes supplicant to fail parsing the IEs.
Increasing the size of ie_len to allow the full length of the IE list to be forwarded properly.
--- include/net/cfg80211.h | 2 +- net/wireless/nl80211.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/cfg80211.h +1 -1
@@ -7383,7 +7383,7 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,* cfg80211 then sends a notification to userspace. */ void cfg80211_notify_new_peer_candidate (struct net_device *dev, -const u8 *macaddr,const u8 *ie,u8 ie_len, +const u8 *macaddr,const u8 *ie,size_t ie_len,int sig_dbm,gfp_t gfp);/**
net/wireless/nl80211.c +1 -1
@@ -18502,7 +18502,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, }void cfg80211_notify_new_peer_candidate (struct net_device *dev,const u8 *addr, -const u8 *ie,u8 ie_len, +const u8 *ie,size_t ie_len,int sig_dbm,gfp_t gfp) {struct wireless_dev *wdev = dev->ieee80211_ptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 152/1193 ASoC: codecs: pcm3168a: Drop CONFIG_PM-conditional preproc directive
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit eb7107264da8545ba7381a76818bae553e1fd1e4 ]
Revert changes done in commit 489db5d94150 ("ASoC: pcm3168a:
Don't disable pcm3168a when CONFIG_PM defined") and add pm_runtime_status_suspended() check.
The suspended-check addresses regulator's "unbalanced disables" warning during driver removal even when CONFIG_PM is enabled.
--- sound/soc/codecs/pcm3168a.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
sound/soc/codecs/pcm3168a.c +7 -13
@@ -820,15 +820,6 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) }EXPORT_SYMBOL_GPL (pcm3168a_probe); -static void pcm3168a_disable (struct device *dev) -{ -struct pcm3168a_priv *pcm3168a =dev_get_drvdata (dev); - -regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), - pcm3168a->supplies); -clk_disable_unprepare (pcm3168a->scki); -} -void pcm3168a_remove (struct device *dev) {struct pcm3168a_priv *pcm3168a =dev_get_drvdata (dev);
@@ -840,10 +831,12 @@ void pcm3168a_remove(struct device *dev)* The asserted level of GPIO_ACTIVE_LOW is LOW. */ gpiod_set_value_cansleep (pcm3168a->gpio_rst,1 ); +pm_runtime_disable (dev); -#ifndef CONFIG_PM -pcm3168a_disable (dev); -#endif +if (!pm_runtime_status_suspended (dev)) { +regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), pcm3168a->supplies); +clk_disable_unprepare (pcm3168a->scki); + } }EXPORT_SYMBOL_GPL (pcm3168a_remove);
@@ -899,7 +892,8 @@ static int pcm3168a_rt_suspend(struct device *dev)regcache_cache_only (pcm3168a->regmap, true); -pcm3168a_disable (dev); +regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), pcm3168a->supplies); +clk_disable_unprepare (pcm3168a->scki);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 179/1193 RDMA/umem: Be careful about boundary conditions in ib_umem_find_best_pgsz()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 09ea6837a0434fb4db99528a5055b6d822135dcf ]
Several corner cases, especially important on 32 bits:
- umem->iova is u64, the function argument should pass in u64 or iova will be truncated
- Check that the length is not too large for the iova
- Check that lengths > 4G don't overflow the GENMASK
--- drivers/infiniband/core/umem.c | 18 ++++++++++++------ include/rdma/ib_umem.h | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/infiniband/core/umem.c +12 -6
@@ -78,14 +78,17 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d*/ unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt) +u64 virt) {unsigned long curr_len =0 ;dma_addr_t curr_base = ~0 ; -unsigned long va, pgoff; +unsigned long pgoff;struct scatterlist *sg; -dma_addr_t mask; +unsigned long mask =0 ; +unsigned int bits;dma_addr_t end; +u64 last_va; +u64 va;int i; umem->iova = va = virt;
@@ -103,9 +106,12 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,* number of required pages. Compute the largest page size that could * work based on VA address bits that don't change. */ - mask = pgsz_bitmap & -GENMASK (BITS_PER_LONG -1 , -bits_per ((umem->length -1 + virt) ^ virt)); +if (check_add_overflow (umem->length -1 , virt, &last_va)) +return 0 ; + bits =bits_per (virt ^ last_va); +if (bits <BITS_PER_LONG ) + mask = pgsz_bitmap &GENMASK (BITS_PER_LONG -1 , bits); +/* offset into first SGL */ pgoff = umem->address & ~PAGE_MASK ;
include/rdma/ib_umem.h +2 -2
@@ -81,7 +81,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset, size_t length);unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt); +u64 virt);/** * ib_umem_find_best_pgoff - Find best HW page size
@@ -161,7 +161,7 @@ static inline int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offs }static inline unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt) +u64 virt) {return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 180/1193 RDMA/mlx5: Fix state and counter desync on loopback enable failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 0d32eabccbe4b2f8d45be3192c5f3c76c8af703d ]
In mlx5_ib_enable_lb(), dev->lb.enabled was unconditionally set to true even if mlx5_nic_vport_update_local_lb() failed.
Fix this by only setting dev->lb.enabled on success. On failure, roll back the reference counters and return the error.
--- drivers/infiniband/hw/mlx5/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/infiniband/hw/mlx5/main.c +11 -0
@@ -1739,6 +1739,9 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp) dev->lb.qps == 1) {if (!dev->lb.enabled) { err =mlx5_nic_vport_update_local_lb (dev->mdev, true); +if (err) + goto err_rollback; + dev->lb.enabled = true; } }
@@ -1746,6 +1749,14 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp)mutex_unlock (&dev->lb.mutex);return err; + +err_rollback: +if (td) + dev->lb.user_td--; +if (qp) + dev->lb.qps--; +mutex_unlock (&dev->lb.mutex); +return err; }void mlx5_ib_disable_lb (struct mlx5_ib_dev *dev,bool td,bool qp)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 181/1193 bpf: NUL-terminate replaced sysctl value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
[ Upstream commit a66e3b5bacf38d6ab29fa05a9754f7a114485605 ]
When writing to sysctls, proc_sys_call_handler() guarantees that the buffer passed to proc handlers is NUL-terminated. If bpf_sysctl_set_new_value() replaces the pending sysctl value, it can hand a replacement buffer directly to proc handlers. However, the helper currently copies only buf_len bytes into that buffer without appending a NUL terminator, leaving downstream parsers vulnerable to out-of-bounds access.
Fix this by appending a '\0' after the replaced value to restore the expected sysctl semantics. Since the helper already rejects buf_len greater than PAGE_SIZE - 1, there is always room for the extra byte.
Reproduced in a QEMU x86_64 guest booted with KASAN while exercising the sysctl replacement path with a cgroup/sysctl BPF program. The reproducer targets /proc/sys/net/core/flow_limit_cpu_bitmap, fills the original user write buffer with non-zero bytes, and overrides the sysctl value so the replacement buffer lacks a terminating NUL. Under that setup, the pre-fix kernel reported:
BUG: KASAN: slab-out-of-bounds in strnchrnul+0x72/0x90 Read of size 1 at addr ffff88800de57000 by task repro_patch3/66 CPU: 0 UID: 0 PID: 66 Comm: repro_patch3 Not tainted 7.1.0-rc3-00269-g8370ca1f87cc #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 print_report+0xcb/0x5e0 ? __virt_addr_valid+0x21d/0x3f0 ? strnchrnul+0x72/0x90 ? strnchrnul+0x72/0x90 kasan_report+0xca/0x100 ? strnchrnul+0x72/0x90 strnchrnul+0x72/0x90 bitmap_parse+0x37/0x2e0 flow_limit_cpu_sysctl+0xc6/0x840 ? __pfx_flow_limit_cpu_sysctl+0x10/0x10 ? __kvmalloc_node_noprof+0x5ba/0x870 proc_sys_call_handler+0x31d/0x480 ? __pfx_proc_sys_call_handler+0x10/0x10 ? selinux_file_permission+0x39f/0x500 ? lock_is_held_type+0x9e/0x120 vfs_write+0x98e/0x1000 ... </TASK> The buggy address is located 0 bytes to the right of allocated 4096-byte region [ffff88800de56000, ffff88800de57000)
With this fix applied, rerunning the same sysctl-targeted path yields no corresponding KASAN reports.
--- kernel/bpf/cgroup.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
@@ -2206,6 +2206,7 @@ BPF_CALL_3(bpf_sysctl_set_new_value, struct bpf_sysctl_kern *, ctx,return -E2BIG ;memcpy (ctx->new_val, buf, buf_len); + ((char *)ctx->new_val)[buf_len] ='\0' ; ctx->new_len = buf_len; ctx->new_updated =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/1193 net: cpsw_new: unregister devlink on port registration failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit b64f763b607426ac97e44b114f0b8844ac3b86dd ]
cpsw_probe() registers devlink before registering the CPSW ports.
If cpsw_register_ports() fails, the error path only unregisters the notifiers and then releases the lower level resources. It does not undo the successful cpsw_register_devlink() call, leaving the devlink instance and its parameters registered after probe has failed.
Add a devlink cleanup label for the path where devlink registration has already succeeded, and use it when port registration fails.
--- drivers/net/ethernet/ti/cpsw_new.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw_new.c +3 -1
@@ -2015,7 +2015,7 @@ static int cpsw_probe(struct platform_device *pdev) ret =cpsw_register_ports (cpsw);if (ret) - goto clean_unregister_notifiers; + goto clean_unregister_devlink; dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n", &ss_res->start, descs_pool_size,
@@ -2027,6 +2027,8 @@ static int cpsw_probe(struct platform_device *pdev)return 0 ; +clean_unregister_devlink: +cpsw_unregister_devlink (cpsw); clean_unregister_notifiers:cpsw_unregister_notifiers (cpsw); clean_cpts:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/1193 hsr: broadcast netlink notifications in the devices net namespace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit a762fabd7ef9a6cc07258684138f9c3f078d0326 ]
The HSR generic netlink family sets .netnsok = true. HSR devices can live in network namespaces other than init_net.
Two async notifiers broadcast events with genlmsg_multicast(). They are hsr_nl_ringerror() and hsr_nl_nodedown(). That helper delivers only on the default genl socket in init_net. So the events always land in init_net. The network namespace of the device does not matter.
This has two effects. A listener in the device's own namespace never sees its own ring error and node down events. A privileged listener in init_net receives events from HSR devices in other namespaces. The payload carries the peer node MAC (HSR_A_NODE_ADDR) and the slave port ifindex (HSR_A_IFINDEX).
Switch both callers to genlmsg_multicast_netns(). Other families with .netnsok = true already do this. Examples are gtp, ovpn, team, batman-adv, netdev-genl, ethtool and handshake.
hsr_nl_ringerror() already has the slave port. It uses dev_net(port->dev). hsr_nl_nodedown() takes the namespace from the master port via hsr_port_get_hsr().
--- net/hsr/hsr_netlink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/hsr/hsr_netlink.c +7 -2
@@ -233,7 +233,8 @@ void hsr_nl_ringerror(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN], goto nla_put_failure;genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (port->dev), + skb,0 ,0 ,GFP_ATOMIC );return ;
@@ -269,8 +270,12 @@ void hsr_nl_nodedown(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN])if (res <0 ) goto nla_put_failure; +rcu_read_lock (); + master =hsr_port_get_hsr (hsr,HSR_PT_MASTER );genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (master->dev), + skb,0 ,0 ,GFP_ATOMIC ); +rcu_read_unlock ();return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/1193 net: microchip: sparx5: clean up PSFP resources on flower setup failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 46e50367338702abe3df661df7795bdada40fef7 ]
sparx5_tc_flower_psfp_setup() allocates PSFP stream gate, flow meter and stream filter resources before adding VCAP actions. If a later step fails, the resources allocated earlier in the function are not unwound.
Add error paths to release the stream filter, flow meter and stream gate when setup fails after they have been acquired.
Also make sparx5_psfp_fm_add() return the acquired flow-meter id before the existing-flow-meter early return. When an existing flow meter is reused, sparx5_psfp_fm_get() increments its pool reference count, but the caller previously kept psfp_fmid as 0. If a later setup step failed, the error path could try to delete flow-meter id 0 instead of the reused flow meter, leaving the incremented reference behind.
--- .../ethernet/microchip/sparx5/sparx5_psfp.c | 5 +++-- .../microchip/sparx5/sparx5_tc_flower.c | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_psfp.c +3 -2
@@ -273,6 +273,9 @@ int sparx5_psfp_fm_add(struct sparx5 *sparx5, u32 uidx, ret =sparx5_psfp_fm_get (uidx, &fm->pol.idx);if (ret <0 )return ret; + + *id = fm->pol.idx; +/* Was already in use, no need to reconfigure */ if (ret >1 )return 0 ;
@@ -287,8 +290,6 @@ int sparx5_psfp_fm_add(struct sparx5 *sparx5, u32 uidx,if (ret <0 )return ret; - *id = fm->pol.idx; -return 0 ; }
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +14 -4
@@ -801,7 +801,7 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5,/* Add new flow-meter */ ret =sparx5_psfp_fm_add (sparx5, pol_idx, fm, &psfp_fmid);if (ret <0 ) -return ret; + goto err_sg_del; }/* Map stream filter to stream gate */
@@ -810,7 +810,7 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5,/* Add new stream-filter and map it to a steam gate */ ret =sparx5_psfp_sf_add (sparx5, sf, &psfp_sfid);if (ret <0 ) -return ret; + goto err_fm_del;/* Streams are classified by ISDX - map ISDX 1:1 to sfid for now. */ sparx5_isdx_conf_set (sparx5, psfp_sfid, psfp_sfid, psfp_fmid);
@@ -818,13 +818,23 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5, ret =vcap_rule_add_action_bit (vrule,VCAP_AF_ISDX_ADD_REPLACE_SEL ,VCAP_BIT_1 );if (ret) -return ret; + goto err_sf_del; ret =vcap_rule_add_action_u32 (vrule,VCAP_AF_ISDX_VAL , psfp_sfid);if (ret) -return ret; + goto err_sf_del;return 0 ; + +err_sf_del: +sparx5_isdx_conf_set (sparx5, psfp_sfid,0 ,0 ); +sparx5_psfp_sf_del (sparx5, psfp_sfid); +err_fm_del: +if (pol_idx >=0 ) +sparx5_psfp_fm_del (sparx5, psfp_fmid); +err_sg_del: +sparx5_psfp_sg_del (sparx5, psfp_sgid); +return ret; }/* Handle the action trap for a VCAP rule */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 185/1193 ALSA: es18xx: check control allocation before private data setup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 422e42b7c2b882ba1d16d4afc8891bcea7c4de93 ]
snd_es18xx_mixer() creates controls with snd_ctl_new1() and then stores bookkeeping pointers or sets private_free before calling snd_ctl_add(). snd_ctl_new1() can return NULL on allocation failure, so those writes can dereference a NULL control pointer.
Check the returned control pointers before using them and return -ENOMEM on allocation failure.
--- sound/isa/es18xx.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/isa/es18xx.c +4 -0
@@ -1776,6 +1776,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_base_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_base_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (chip->caps &ES18XX_HWV ) {switch (idx) {case 0 :
@@ -1837,6 +1839,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_hw_volume_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_hw_volume_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (idx ==0 ) chip->hw_volume = kctl;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/1193 netfilter: nf_conntrack: use get_unaligned_be32() in tcp_sack()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit d3bf9eae486490832bd08fd62ab0ac601f346bd4 ]
The timestamp-only fast path dereferences the option stream as *(__be32 *)ptr, which assumes 4-byte alignment that the TCP option stream does not guarantee. Use get_unaligned_be32() instead, which reads the value safely and already returns host byte order, so the htonl() on the comparison constant can be dropped.
This matches the existing get_unaligned_be32() use later in the same function.
--- net/netfilter/nf_conntrack_proto_tcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +5 -5
@@ -405,11 +405,11 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,return ;/* Fast path for timestamp-only option */ -if (length ==TCPOLEN_TSTAMP_ALIGNED - && *(__be32 *)ptr ==htonl ((TCPOPT_NOP <<24 ) - | (TCPOPT_NOP <<16 ) - | (TCPOPT_TIMESTAMP <<8 ) - |TCPOLEN_TIMESTAMP )) +if (length ==TCPOLEN_TSTAMP_ALIGNED && +get_unaligned_be32 (ptr) == ((TCPOPT_NOP <<24 ) | + (TCPOPT_NOP <<16 ) | + (TCPOPT_TIMESTAMP <<8 ) | +TCPOLEN_TIMESTAMP ))return ;while (length >0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/1193 btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 18d32b0013efba19f7ad3e5b08d7aee813d604a6 ]
[BUG]
Running btrfs balance can trigger a null-ptr-deref before relocating a data chunk when metadata corruption leaves a chunk in the chunk tree without a corresponding block group in the in-memory cache:
KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f]
RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601
Call Trace:
__btrfs_balance fs/btrfs/volumes.c:4217 [inline]
btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604
btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline]
btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313
...[CAUSE]__btrfs_balance() iterates the on-disk chunk tree and passes the chunk logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data chunk. That helper then queries the in-memory block group cache:
cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_type = cache->flags; /* cache may be NULL */
A corrupt image can contain a chunk item whose matching block group item is missing, so no block group is ever inserted into the cache. In that case btrfs_lookup_block_group() returns NULL.
The code only guards this with ASSERT(cache), which becomes a no-op when CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of cache->flags therefore crashes the kernel.
[FIX]
Add a NULL check after btrfs_lookup_block_group() in btrfs_may_alloc_data_chunk() and print and error message for clarity.
--- fs/btrfs/volumes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +5 -1
@@ -3466,7 +3466,11 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info,u64 chunk_type; cache =btrfs_lookup_block_group (fs_info, chunk_offset); -ASSERT (cache); +if (unlikely (!cache)) { +btrfs_err (fs_info,"balance: chunk at bytenr %llu has no corresponding block group" , + chunk_offset); +return -EUCLEAN ; + } chunk_type = cache->flags;btrfs_put_block_group (cache);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/1193 btrfs: tree-checker: validate names in ROOT_REF and ROOT_BACKREF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Cen <[email protected]>
[ Upstream commit 0af37c217edf15fa21dac1c40822086df356c6bb ]
ROOT_REF and ROOT_BACKREF items contain a struct btrfs_root_ref followed by the subvolume name. Several readers assume that this layout is already valid and then use the on-disk name length directly. A corrupted item can therefore make those readers address bytes outside the item, and BTRFS_IOC_GET_SUBVOL_INFO can copy too many bytes into its fixed-size UAPI name buffer.
Validate ROOT_REF and ROOT_BACKREF items in tree-checker before any reader uses them. Reject records that do not contain a non-empty name, whose name_len does not exactly describe the remaining item payload, or whose name exceeds BTRFS_NAME_LEN.
For BTRFS_IOC_GET_SUBVOL_INFO, copy only the validated on-disk name_len instead of deriving the copy length from the item size. The ioctl result is zeroed when allocated. That leaves the existing trailing zero byte untouched.
--- fs/btrfs/ioctl.c | 11 +++++------ fs/btrfs/tree-checker.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-)
fs/btrfs/ioctl.c +5 -6
@@ -2167,7 +2167,6 @@ static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)struct btrfs_root_ref *rref;struct extent_buffer *leaf;unsigned long item_off; -unsigned long item_len;int slot;int ret =0 ;
@@ -2242,17 +2241,17 @@ static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)btrfs_item_key_to_cpu (leaf, &key, slot);if (key.objectid == subvol_info->treeid && key.type ==BTRFS_ROOT_BACKREF_KEY ) { +u16 name_len; + subvol_info->parent_id = key.offset; rref = btrfs_item_ptr(leaf, slot, struct btrfs_root_ref); + name_len =btrfs_root_ref_name_len (leaf, rref); subvol_info->dirid =btrfs_root_ref_dirid (leaf, rref); - item_off =btrfs_item_ptr_offset (leaf, slot) - +sizeof (struct btrfs_root_ref ); - item_len =btrfs_item_size (leaf, slot) - -sizeof (struct btrfs_root_ref ); + item_off =btrfs_item_ptr_offset (leaf, slot) +sizeof (*rref);read_extent_buffer (leaf, subvol_info->name, - item_off, item_len); + item_off, name_len); }else { ret = -ENOENT ; goto out;
fs/btrfs/tree-checker.c +35 -0
@@ -1252,6 +1252,37 @@ static int check_root_item(struct extent_buffer *leaf, struct btrfs_key *key,return 0 ; } +static int check_root_ref (struct extent_buffer *leaf,struct btrfs_key *key,int slot) +{ +struct btrfs_root_ref *rref; +u32 item_size =btrfs_item_size (leaf, slot); +u32 name_len; + +if (unlikely (item_size <=sizeof (*rref))) { +generic_err (leaf, slot, +"invalid root ref item size for key type %u, have %u expect > %zu" , + key->type, item_size,sizeof (*rref)); +return -EUCLEAN ; + } + + rref = btrfs_item_ptr(leaf, slot, struct btrfs_root_ref); + name_len =btrfs_root_ref_name_len (leaf, rref); +if (unlikely (name_len >BTRFS_NAME_LEN )) { +generic_err (leaf, slot, +"root ref name too long for key type %u, have %u max %u" , + key->type, name_len,BTRFS_NAME_LEN ); +return -EUCLEAN ; + } +if (unlikely (item_size !=sizeof (*rref) + name_len)) { +generic_err (leaf, slot, +"invalid root ref item size for key type %u, have %u expect %zu" , + key->type, item_size,sizeof (*rref) + name_len); +return -EUCLEAN ; + } + +return 0 ; +} + __printf(3,4)__cold static void extent_err(const struct extent_buffer *eb, int slot,
@@ -1871,6 +1902,10 @@ static enum btrfs_tree_block_status check_leaf_item(struct extent_buffer *leaf,case BTRFS_ROOT_ITEM_KEY : ret =check_root_item (leaf, key, slot);break ; +case BTRFS_ROOT_REF_KEY : +case BTRFS_ROOT_BACKREF_KEY : + ret =check_root_ref (leaf, key, slot); +break ;case BTRFS_EXTENT_ITEM_KEY :case BTRFS_METADATA_ITEM_KEY : ret =check_extent_item (leaf, key, slot, prev_key);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 153/1193 ata: ahci: fail probe if BAR too small for claimed ports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: liyouhong <[email protected]>
[ Upstream commit c4086c6e1af757e1ff26fa2d2926b3ec0195de79 ]
When an AHCI controller is disabled in BIOS, its HOST_CAP register may contain a bogus value, e.g. 0xFFFFFFFF.
Since CAP.NP (Number of Ports) is a zeroes based 5-bit register field, a value of 0x1f means 32 ports. If CAP.NP claims more ports than can physically fit within the mapped BAR region, accessing port registers beyond the BAR boundary causes a kernel panic.
Add validation in ahci_init_one() to check that the BAR size is sufficient for the number of ports claimed in CAP.NP. The check calculates the required MMIO size as:
required_size = 0x100 (global registers) + max_ports * 0x80
If required_size exceeds the actual BAR size, the probe fails with -ENODEV, preventing the panic and providing a clear error message.
--- drivers/ata/ahci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/ata/ahci.c +22 -0
@@ -1852,6 +1852,24 @@ static ssize_t remapped_nvme_show(struct device *dev,static DEVICE_ATTR_RO (remapped_nvme); +static int ahci_validate_bar_size (struct pci_dev *pdev,int bar, +struct ahci_host_priv *hpriv) +{ +u32 cap =readl (hpriv->mmio +HOST_CAP ); +unsigned int max_ports =ahci_nr_ports (cap); +u32 last_port_end =0x100 + (max_ports *0x80 ); +resource_size_t bar_size =pci_resource_len (pdev, bar); + +if (last_port_end > bar_size) { +dev_warn (&pdev->dev, +"BAR%d too small for %u ports (last port ends at %#x, BAR %pa)\n" , + bar, max_ports, last_port_end, &bar_size); +return -ENODEV ; + } + +return 0 ; +} +static int ahci_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {unsigned int board_id = ent->driver_data;
@@ -1954,6 +1972,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) hpriv->mmio =pcim_iomap_table (pdev)[ahci_pci_bar]; + rc =ahci_validate_bar_size (pdev, ahci_pci_bar, hpriv); +if (rc) +return rc; +/* detect remapped nvme devices */ ahci_remap_check (pdev, ahci_pci_bar, hpriv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/1193 NFS: fix eof updates after NFSv4.2 fallocate/zero-range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
[ Upstream commit 35168eb947f230aaa35fd8416a30563ef89f5421 ]
Generic/075 reliably exposes a regression when the client holds an NFSv4 write delegation: ZERO_RANGE/ALLOCATE extends the file on the server, but the local inode keeps the old i_size. The test then fails with 'Size error' because the post-op attribute refresh refuses to touch i_size while a delegation is outstanding, and the cached EOF was never marked stale.
Update _nfs42_proc_fallocate() so that on success it:
- bumps i_size when the operation extends the file, and
- marks NFS_INO_INVALID_BLOCKS since the block count can also change
Tested with xfstests generic/075 over NFSv4.2.
--- fs/nfs/nfs42proc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/nfs/nfs42proc.c +10 -5
@@ -79,12 +79,17 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, status =nfs4_call_sync (server->client, server, msg, &args.seq_args, &res.seq_res,0 );if (status ==0 ) { -if (nfs_should_remove_suid (inode)) { -spin_lock (&inode->i_lock); +loff_t newsize = offset + len; + +spin_lock (&inode->i_lock); +if (newsize >i_size_read (inode)) +i_size_write (inode, newsize); +nfs_set_cache_invalid (inode,NFS_INO_INVALID_BLOCKS ); +if (nfs_should_remove_suid (inode))nfs_set_cache_invalid (inode, -NFS_INO_REVAL_FORCED |NFS_INO_INVALID_MODE ); -spin_unlock (&inode->i_lock); - } +NFS_INO_REVAL_FORCED | +NFS_INO_INVALID_MODE ); +spin_unlock (&inode->i_lock); status =nfs_post_op_update_inode_force_wcc (inode, res.falloc_fattr); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 154/1193 ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Pei <[email protected]>
[ Upstream commit 3a59c3b772e5dc0cedecce8e7fbf7c2d6245b643 ]
PCI root bridges enumerated by acpi_pci_root_add() can be the _DEP supplier for other ACPI consumers, most notably ACPI0017 CXL root devices whose probe path depends on acpi_pci_find_root() succeeding. Once the root bus has been added, those consumers can safely be enumerated, so notify them by clearing the dependency.
Call acpi_dev_clear_dependencies() at the end of acpi_pci_root_add(), after pci_bus_add_devices(), following the same pattern used by other ACPI suppliers such as the EC (drivers/acpi/ec.c) and the ACPI PCI Link device (drivers/acpi/pci_link.c). The clear is intentionally done only on the success path; on the error paths the supplier did not attach and consumers must keep dep_unmet set.
This is a prerequisite for honoring _DEP on ACPI0016 host bridges, which matters on architectures where the probe order of acpi_pci_root relative to cxl_acpi is not guaranteed (e.g. RISC-V).
--- drivers/acpi/pci_root.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/pci_root.c +4 -0
@@ -764,6 +764,10 @@ static int acpi_pci_root_add(struct acpi_device *device,pci_lock_rescan_remove ();pci_bus_add_devices (root->bus);pci_unlock_rescan_remove (); + +/* Clear _DEP dependencies to allow consumers to enumerate */ +acpi_dev_clear_dependencies (device); +return 1 ; remove_dmar:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 155/1193 net: qrtr: fix node refcount leak on ctrl packet alloc failure
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 3b09ff54114566864eea59020f6b69c5bb325b9d ]
qrtr_send_resume_tx() calls qrtr_node_lookup() which takes a reference on the returned node. If the subsequent call to qrtr_alloc_ctrl_packet() fails due to memory allocation failure, the function returns -ENOMEM without calling qrtr_node_release() to release the node reference.
Add qrtr_node_release(node) before returning on the allocation failure path to properly release the reference.
--- net/qrtr/af_qrtr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +3 -1
@@ -1009,8 +1009,10 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)return -EINVAL ; skb =qrtr_alloc_ctrl_packet (&pkt,GFP_KERNEL ); -if (!skb) +if (!skb) { +qrtr_node_release (node);return -ENOMEM ; + } pkt->cmd =cpu_to_le32 (QRTR_TYPE_RESUME_TX ); pkt->client.node =cpu_to_le32 (cb->dst_node);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 156/1193 net: wwan: t7xx: Add delay between MD and SAP suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit ae733795e593272f67d607c09d2a00637ac13ed0 ]
SAP (Service Access Point) suspend occasionally times out with error -110 (ETIMEDOUT), followed by modem port errors and complete modem failure requiring a system reboot to recover.
Error symptoms:
mtk_t7xx 0000:72:00.0: [PM] SAP suspend error: -110 mtk_t7xx 0000:72:00.0: can't suspend (...returned -110) mtk_t7xx 0000:07:00.0: Failed to send skb: -22 mtk_t7xx 0000:07:00.0: Write error on MBIM port, -22
The modem firmware needs time after receiving the MD (modem) suspend request to complete internal operations before it is ready to accept the SAP suspend request. Without this delay, if runtime PM attempts to suspend while the firmware is busy, the SAP suspend command times out, leaving the modem in an unrecoverable state.
Root cause and userspace interaction:
ModemManager 1.24+ includes changes that reduce the likelihood of this issue by ensuring the modem is in a low-power state before the kernel attempts runtime suspend. However, the kernel driver should not depend on specific userspace behavior or ModemManager versions. Older versions (1.20-1.22) are still widely deployed, and the kernel should be robust regardless of userspace implementation details.
There appears to be no hardware status register or other mechanism available to query whether the firmware is ready for SAP suspend. A delay between the two suspend requests is the most reliable solution found through testing.
Add a 50ms delay between MD suspend and SAP suspend. This gives the firmware adequate time to complete internal operations without adding significant latency to the suspend path. This makes the driver robust across all ModemManager versions and system conditions.
Testing: 96+ hours of continuous operation with ModemManager 1.20.2 and Fibocom FM350-GL modem. Zero SAP suspend timeouts observed across 2000+ successful suspend/resume cycles. Previously failed within 24 hours with 100% reproducibility.
--- drivers/net/wwan/t7xx/t7xx_pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wwan/t7xx/t7xx_pci.c +3 -0
@@ -313,6 +313,9 @@ static int __t7xx_pci_pm_suspend(struct pci_dev *pdev) goto abort_suspend; } +/* Delay to prevent SAP suspend timeout */ +msleep (50 ); + ret =t7xx_send_pm_request (t7xx_dev,H2D_CH_SUSPEND_REQ_AP );if (ret) {t7xx_send_pm_request (t7xx_dev,H2D_CH_RESUME_REQ );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 157/1193 iommu/rockchip: disable fetch dte time limit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Xue <[email protected]>
[ Upstream commit 8d4346ecd4950ae08cc76a6de327c264e846758c ]
Disable the Bit 31 of the AUTO_GATING iommu register, as it causes hangups with the RGA3 (Raster Graphics Acceleration 3) peripheral. The RGA3 register description of the TRM already states that the bit must be set to 1. The vendor kernel sets the bit unconditionally to 1 to fix VOP (Video Output Processor) screen black issues. This patch squashes the 2 vendor kernel commits with the following commit messages:
Master fetch data and cpu update page table may work in parallel, may have the following procedure:
master cpu
fetch dte update page tabl
| |
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make iommu block) <- zap iotlb entry
New iommu version has the above bug, if fetch dte consecutively four times, then it will be blocked. Fortunately, we can set bit 31 of register MMU_AUTO_GATING to 1 to make it work as old version which does not have this issue.
This issue only appears on RV1126 so far, so make a workaround dedicated to "rockchip,rv1126" machine type.
iommu/rockchip: fix vop blocked and screen black on RK356X and RK3588
RK3568 and RK3588 has the same issue as RV1126/RV1109 that caused by dte fetch time limit, So we can set BIT(31) of register 0x24 default to 1 as a workaround.
--- drivers/iommu/rockchip-iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iommu/rockchip-iommu.c +8 -0
@@ -73,6 +73,8 @@#define SPAGE_ORDER 12#define SPAGE_SIZE (1 << SPAGE_ORDER) +#define DISABLE_FETCH_DTE_TIME_LIMIT BIT(31) +/* * Support mapping any size that fits in one page table: * 4 KiB to 4 MiB
@@ -924,6 +926,7 @@ static int rk_iommu_enable(struct rk_iommu *iommu)struct iommu_domain *domain = iommu->domain;struct rk_iommu_domain *rk_domain =to_rk_domain (domain);int ret, i; +u32 auto_gate; ret =clk_bulk_enable (iommu->num_clocks, iommu->clocks);if (ret)
@@ -942,6 +945,11 @@ static int rk_iommu_enable(struct rk_iommu *iommu) rk_ops->mk_dtentries(rk_domain->dt_dma));rk_iommu_base_command (iommu->bases[i],RK_MMU_CMD_ZAP_CACHE );rk_iommu_write (iommu->bases[i],RK_MMU_INT_MASK ,RK_MMU_IRQ_MASK ); + +/* Workaround for iommu blocked, BIT(31) default to 1 */ + auto_gate =rk_iommu_read (iommu->bases[i],RK_MMU_AUTO_GATING ); + auto_gate |=DISABLE_FETCH_DTE_TIME_LIMIT ; +rk_iommu_write (iommu->bases[i],RK_MMU_AUTO_GATING , auto_gate); } ret =rk_iommu_enable_paging (iommu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 158/1193 fs/ntfs3: preserve non-DOS attribute bits in system.dos_attrib
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit b1c1101067d9536bcb0fe023b96ee2dde5535959 ]
[BUG]
A corrupted ntfs3 image can hit a NULL function pointer call in generic_perform_write() after toggling system.ntfs_attrib and then overwriting system.dos_attrib on the same file.
BUG: kernel NULL pointer dereference, address: 0000000000000000 \#PF: supervisor instruction fetch in kernel mode \#PF: error_code(0x0010) - not-present page PGD bed5067 P4D bed5067 PUD 0 Oops: Oops: 0010 [#1] SMP KASAN NOPTI RIP: 0010:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0018:ffff88801025f988 EFLAGS: 00010246 Call Trace: generic_perform_write+0x409/0x8c0 mm/filemap.c:4255 __generic_file_write_iter+0x1bb/0x200 mm/filemap.c:4372 ntfs_file_write_iter+0xcd9/0x1c20 fs/ntfs3/file.c:1253 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x63b/0xf70 fs/read_write.c:686 ksys_write+0x133/0x250 fs/read_write.c:738 __do_sys_write fs/read_write.c:749 [inline] __se_sys_write fs/read_write.c:746 [inline] __x64_sys_write+0x77/0xc0 fs/read_write.c:746 ...
[CAUSE]
system.ntfs_attrib updates ATTR_DATA flags via ni_new_attr_flags() and switches i_mapping->a_ops to ntfs_aops_cmpr when FILE_ATTRIBUTE_COMPRESSED is set. system.dos_attrib then overwrites ni->std_fa from a one-byte DOS attribute value, clearing the compression bit without updating ATTR_DATA or the mapping operations.
Old buffered writes use is_compressed(ni) to choose __generic_file_write_iter(). That leaves generic_perform_write() calling a NULL write_begin callback from ntfs_aops_cmpr.
[FIX]
Treat system.dos_attrib as a low-byte DOS attribute update and preserve the existing non-DOS attribute bits in ni->std_fa. This keeps compressed and sparse state consistent with ATTR_DATA and the mapping operations while keeping the existing DOS attribute semantics intact.
--- fs/ntfs3/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ntfs3/xattr.c +3 -1
@@ -853,7 +853,9 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,if (!strcmp (name,SYSTEM_DOS_ATTRIB )) {if (sizeof (u8) != size) goto out; - new_fa =cpu_to_le32 (*(u8 *)value); +/* system.dos_attrib only covers the low DOS attribute byte. */ + new_fa = (ni->std_fa & ~cpu_to_le32 (0xff )) | +cpu_to_le32 (*(u8 *)value); goto set_new_fa; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/1193 net: ibm: emac: Reserve VLAN header in MJS limit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 0906c117f81c2ae6e6dbfa82719f79c75e1c9325 ]
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from ndev->mtu directly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.
This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped by QCA_HDR_LEN to 1502 during dsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.
Pad MJS by VLAN_HLEN so a VLAN-tagged full-MTU frame passes.
Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
--- drivers/net/ethernet/ibm/emac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/core.c +2 -1
@@ -30,6 +30,7 @@#include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/ethtool.h> +#include <linux/if_vlan.h> #include <linux/mii.h> #include <linux/bitops.h> #include <linux/workqueue.h>
@@ -466,7 +467,7 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)if (emac_has_feature (dev,EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE )) { r &= ~EMAC4_RMR_MJS_MASK ; - r |=EMAC4_RMR_MJS (ndev->mtu); + r |=EMAC4_RMR_MJS (ndev->mtu +VLAN_HLEN ); }return r;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/1193 xprtrdma: Add request-pool slack for delayed recycling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 64bf6892057b746c55bcc045b9492741b72d8d27 ]
After the previous patch gates req recycling on Send completion, a completed RPC's rpcrdma_req can remain pinned by the sendctx ring until the next signaled Send completion releases it. The transmitted-RPC ceiling is unchanged: xprt_request_get_cong() gates Sends against xprt->cwnd, the RPC/RDMA credit window fed by server-granted credits and capped at re_max_requests. The req pool, however, must exceed max_reqs by enough that this recycle delay does not stall a slot allocation that the credit window would admit.
The headroom is bounded. frwr_open() sets re_send_batch to re_max_requests >> 3 -- one in every eight Sends is signaled -- so at most re_send_batch unsignaled Sends can be outstanding before the next signaled completion releases them. That equals max_reqs / 8 reqs in the worst case, with a one-slot floor for small max_reqs values where the right-shift rounds to zero.
The sendctx ring and the hardware Send Queue are not enlarged to match. Both are sized in rpcrdma_sendctxs_create() and frwr_query_device() for re_max_requests in-flight Sends, which is the ceiling the credit window enforces. The pool slack does not raise that ceiling -- it only lets allocation keep pace with the credit window during the brief interval in which earlier reqs are pinned waiting for the next signaled completion. At any moment, at most re_send_batch sendctxes are held by unswept unsignaled Sends, leaving the rest of the ring available for newly admitted Sends.
Allocate max_reqs + DIV_ROUND_UP(max_reqs, 8) request objects and name the slack calculation at the allocation site so the 1/8 bound stays tied to the Send-signaling batch size.
--- net/sunrpc/xprtrdma/verbs.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +20 -1
@@ -1110,6 +1110,22 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)spin_unlock (&buf->rb_lock); } +static unsigned int rpcrdma_req_pool_slack (unsigned int max_reqs) +{ +/* The sendctx ring can hold up to one Send-signaling batch +* (re_send_batch, set by frwr_open() to re_max_requests >> 3) +* of unfinished Sends. Each pins its req until a signaled Send +* completion releases the sendctx. Size the pool above max_reqs +* by that batch so the recycle delay does not stall a slot +* allocation that the RPC/RDMA credit window would admit. +* +* Round up: re_max_requests >> 3 is zero when max_reqs < 8, but +* a single unsignaled Send is still enough to pin one req. One +* slack slot covers that case. +*/ +return DIV_ROUND_UP (max_reqs,8 ); +} +/** * rpcrdma_buffer_create - Create initial set of req/rep objects * @r_xprt: transport instance to (re)initialize
@@ -1119,6 +1135,7 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)int rpcrdma_buffer_create (struct rpcrdma_xprt *r_xprt) {struct rpcrdma_buffer *buf = &r_xprt->rx_buf; +unsigned int max_reqs;int i, rc; buf->rb_bc_srv_max_requests =0 ;
@@ -1132,7 +1149,9 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)INIT_LIST_HEAD (&buf->rb_all_reps); rc = -ENOMEM ; -for (i =0 ; i < r_xprt->rx_xprt.max_reqs; i++) { + max_reqs = r_xprt->rx_xprt.max_reqs; + max_reqs +=rpcrdma_req_pool_slack (max_reqs); +for (i =0 ; i < max_reqs; i++) {struct rpcrdma_req *req; req = rpcrdma_req_create(r_xprt,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/1193 vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Evgenii Burenchev <[email protected]>
[ Upstream commit 4c653e85857b41a7148917f2628fae1d04a9c251 ]
dev_set_name() may fail and return an error, but its return value is currently ignored and overwritten by _vdpa_register_device().
Abort device creation if dev_set_name() fails and release the device reference to avoid continuing with an improperly initialized struct device.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Message-ID: <[email protected]>
--- drivers/vdpa/ifcvf/ifcvf_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +9 -2
@@ -718,15 +718,22 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, ret =dev_set_name (&vdpa_dev->dev,"%s" , name); else ret =dev_set_name (&vdpa_dev->dev,"vdpa%u" , vdpa_dev->index); +if (ret) { +IFCVF_ERR (pdev,"Failed to set device name" ); + goto err; + } ret =_vdpa_register_device (&adapter->vdpa, vf->nr_vring);if (ret) { -put_device (&adapter->vdpa.dev);IFCVF_ERR (pdev,"Failed to register to vDPA bus" ); -return ret; + goto err; }return 0 ; + +err: +put_device (&adapter->vdpa.dev); +return ret; }static void ifcvf_vdpa_dev_del (struct vdpa_mgmt_dev *mdev,struct vdpa_device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/1193 ALSA: hda/realtek: Add quirk for HP 255 15.6 inch G9 Notebook PC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Furst Blumier <[email protected]>
[ Upstream commit 98e157916f83c26a41448267180944048d2f1460 ]
The HP 255 15.6 inch G9 Notebook PC (PCI SSID 103c:8a1b) uses the ALC236 codec but lacks an entry in the quirk table, causing the kernel to fall back to a null SSID match (103c:0000) and skip the necessary fixup. Add a quirk entry using ALC236_FIXUP_HP_MUTE_LED_COEFBIT2, matching the HP 255 G8 which uses the same codec and fixup. This fixes the mute-button LED and fixes an issue with unplugging and replugging a headset jack not being recognized as an audio sink.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10177,6 +10177,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x89ca ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x89d3 ,"HP EliteBook 645 G9 (MB 89D2)" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8a0f ,"HP Pavilion 14-ec1xxx" ,ALC287_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8a1b ,"HP 255 15.6 inch G9 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x8a1f ,"HP Laptop 14s-dr5xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x8a20 ,"HP Laptop 15s-fq5xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/1193 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IRH8
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moritz Baron <[email protected]>
[ Upstream commit 853e10ec445984e99b3c7f6375f4e185614b842a ]
The Lenovo Yoga Pro 7 14IRH8 (ALC287 codec, subsystem ID 0x17aa:0x38b1) has bass speakers on pin 0x17 that are not routed through a DAC with volume control. This causes the bass speakers to play at full volume regardless of the volume slider position.
Apply ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN which corrects the DAC routing for pin 0x17, enabling proper volume control. This is the same fix used for other Yoga Pro 7 models with identical audio topology (14APH8, 14AHP9, 14ASP10, 14IAH10).
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -10566,6 +10566,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3843 ,"Yoga 9i" ,ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP ),SND_PCI_QUIRK (0x17aa ,0x3847 ,"Legion 7 16ACHG6" ,ALC287_FIXUP_LEGION_16ACHG6 ),SND_PCI_QUIRK (0x17aa ,0x384a ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), +/* Yoga Pro 7 14IRH8 shares PCI SSID 17aa:3852 with Yoga 7 14ITL5; +* use codec SSID to distinguish them +*/ +HDA_CODEC_QUIRK (0x17aa ,0x38b1 ,"Lenovo Yoga Pro 7 14IRH8" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3852 ,"Lenovo Yoga 7 14ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/1193 ata: libata-pmp: add JMicron JMS562 quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit c62aff1174cf88e10716c7513702443c47551fc6 ]
JMicron JMS562, as used in QNAP QDA-A2AR RAID1 adapters, may keep the exported ATA device not ready while the array is rebuilding.
In this state, libata may repeatedly try to softreset and classify the fan-out link. On the affected adapter, this can time out, make PMP/SCR access fail, and eventually disable the fan-out link before the RAID volume is exported.
A failing boot shows the fan-out link failing SRST, PMP access timing out, SCR read failing, and the link being disabled:
ata4.00: softreset failed (device not ready) ata4.15: qc timeout after 3000 msecs (cmd 0xe4) ata4.00: failed to read SCR 0 (Emask=0x4) ata4.00: failed to recover link after 3 tries, disabling
After that, the root filesystem on the exported RAID volume cannot be found.
Add JMS562 to the existing JMicron PMP quirk that disables LPM, avoids softreset on fan-out links, and assumes an ATA device. This prevents libata from dropping the exported RAID volume during rebuild recovery.
--- drivers/ata/libata-pmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-pmp.c +6 -1
@@ -446,8 +446,13 @@ static void sata_pmp_quirks(struct ata_port *ap)* otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links -1 ].flags |=ATA_LFLAG_NO_RETRY ; - }else if (vendor ==0x197b && (devid ==0x2352 || devid ==0x0325 )) { + }else if (vendor ==0x197b && + (devid ==0x0562 || devid ==0x2352 || devid ==0x0325 )) {/* +* 0x0562: JMicron JMS562, as used in QNAP QDA-A2AR RAID1 +* adapters. The exported device may stay not ready +* while the array is rebuilding, and SRST/classify can +* time out before the RAID volume is exported. * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? * 0x0325: jmicron JMB394. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/1193 platform/x86: intel-hid: Add HP ProBook x360 440 G1 to button_array_table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Metchev <[email protected]>
[ Upstream commit c39023ca9a447f09c072080efc84d6874c2275c9 ]
The volume rocker buttons on the HP ProBook x360 440 G1 convertible emit events 0xc4-0xc7 via the intel-hid ACPI device (INT33D5). These codes are only present in intel_array_keymap, which is used when the "5 button array" input device exists. On this machine button_array_present() returns false because the firmware does not advertise the array through the HEBC method, so notify_handler() routes the events to a NULL priv->array and they are dropped as "unknown event 0xc4". As a result the side volume keys do nothing.
Add the machine to button_array_table so the array device is created and the volume rocker emits KEY_VOLUMEUP / KEY_VOLUMEDOWN. This is equivalent to booting with the enable_5_button_array=1 module parameter, which was used to confirm the fix on the affected hardware.
--- drivers/platform/x86/intel/hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel/hid.c +7 -0
@@ -142,6 +142,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"), }, }, + { + .ident = "HP ProBook x360 440 G1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook x360 440 G1"), + }, + }, { } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/1193 nvme-fc: Do not cancel requests in io target before it is initialized
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 ee38469f88492df99e1d97f03aa40ecfd218934f ]
A new nvme-fc controller in CONNECTING state sees admin request timeout schedules ctrl->ioerr_work to abort inflight requests. This ends up calling __nvme_fc_abort_outstanding_ios() which aborts requests in both admin and io tagsets. In case fc_ctrl->tag_set was not initialized we see the warning below. This is because ctrl.queue_count is initialized early in nvme_fc_alloc_ctrl().
nvme nvme0: NVME-FC{0}: starting error recovery Connectivity Loss
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe lpfc 0000:ab:00.0: queue 0 connect admin queue failed (-6). you didn't initialize this object before use?
turning off the locking correctness validator.
Workqueue: nvme-reset-wq nvme_fc_ctrl_ioerr_work [nvme_fc] Call Trace: <TASK> dump_stack_lvl+0x57/0x80 register_lock_class+0x567/0x580 __lock_acquire+0x330/0xb90 lock_acquire.part.0+0xad/0x210 blk_mq_tagset_busy_iter+0xf9/0xc00 __nvme_fc_abort_outstanding_ios+0x23f/0x320 [nvme_fc] nvme_fc_ctrl_ioerr_work+0x172/0x210 [nvme_fc] process_one_work+0x82c/0x1450 worker_thread+0x5ee/0xfd0 kthread+0x3a0/0x750 ret_from_fork+0x439/0x670 ret_from_fork_asm+0x1a/0x30 </TASK>
Update the check in __nvme_fc_abort_outstanding_ios() confirm that io tagset was created before iterating over busy requests. Also make sure to cancel ctrl->ioerr_work before removing io tagset.
--- drivers/nvme/host/fc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +6 -1
@@ -2459,7 +2459,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)* io requests back to the block layer as part of normal completions * (but with error status). */ -if (ctrl->ctrl.queue_count >1 ) { +if (ctrl->ctrl.queue_count >1 && ctrl->ctrl.tagset) {nvme_quiesce_io_queues (&ctrl->ctrl);nvme_sync_io_queues (&ctrl->ctrl); blk_mq_tagset_busy_iter(&ctrl->tag_set,
@@ -2896,6 +2896,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) out_delete_hw_queues:nvme_fc_delete_hw_io_queues (ctrl); out_cleanup_tagset: +/* +* In CONNECTING state ctrl->ioerr_work will abort both admin +* and io tagsets. Cancel it first before removing io tagset. +*/ +cancel_work_sync (&ctrl->ioerr_work);nvme_remove_io_tag_set (&ctrl->ctrl);nvme_fc_free_io_queues (ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/1193 sctp: Unwind address notifier registration on failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit c8459ee2fef502d6ef6c063751c33d9ac7943eab ]
sctp_v4_add_protocol() and sctp_v6_add_protocol() register their address notifiers before registering the SCTP protocol handlers. If protocol registration fails, the functions return without unregistering the notifiers.
Unregister the notifiers on the protocol registration failure paths. Also propagate notifier registration failures instead of ignoring them.
--- net/sctp/ipv6.c | 10 ++++++++-- net/sctp/protocol.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
net/sctp/ipv6.c +8 -2
@@ -1221,11 +1221,17 @@ void sctp_v6_protosw_exit(void)/* Register with inet6 layer. */ int sctp_v6_add_protocol (void ) { +int ret; +/* Register notifier for inet6 address additions/deletions. */ -register_inet6addr_notifier (&sctp_inet6addr_notifier); + ret =register_inet6addr_notifier (&sctp_inet6addr_notifier); +if (ret) +return ret; -if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) +if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inet6addr_notifier (&sctp_inet6addr_notifier);return -EAGAIN ; + }return 0 ; }
net/sctp/protocol.c +8 -2
@@ -1276,12 +1276,18 @@ static void sctp_v4_protosw_exit(void)static int sctp_v4_add_protocol (void ) { +int ret; +/* Register notifier for inet address additions/deletions. */ -register_inetaddr_notifier (&sctp_inetaddr_notifier); + ret =register_inetaddr_notifier (&sctp_inetaddr_notifier); +if (ret) +return ret;/* Register SCTP with inet layer. */ -if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) +if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inetaddr_notifier (&sctp_inetaddr_notifier);return -EAGAIN ; + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 207/1193 PCI: Avoid SBR for Qualcomm WCN6855/WCN7850 WiFi, SDX62/SDX65 modems
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit 6a4f64c3a3ada43e71ef1e06da89beb36bdaeefa ]
Some Qualcomm PCIe devices (WCN6855/WCN7850 WiFi cards, SDX62/SDX65 modems) do not properly support Secondary Bus Reset (SBR).
Testing confirms this is device-specific, not deployment-specific:
MediaTek MT7925e successfully uses bus reset through the same passive M.2-to-PCIe adapters where Qualcomm devices fail, proving PERST# is properly wired through the adapters.
Prevent use of Secondary Bus Reset for these devices.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3770,6 +3770,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003e , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1103 , quirk_no_bus_reset);/* WCN6855 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1107 , quirk_no_bus_reset);/* WCN7850 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x0308 , quirk_no_bus_reset);/* SDX62/SDX65 */ /* * Root port on some Cavium CN8xxx chips do not successfully complete a bus
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 208/1193 dmaengine: dw-axi-dmac: fix PM for system sleep and channel alloc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tze Yee Ng <[email protected]>
[ Upstream commit df0c2dc68770cf43f15df40b184df030b850ea05 ]
The driver only had runtime PM callbacks. If a channel stayed allocated across system suspend/resume, the runtime usage count could remain non-zero while hardware state (DMAC_CFG, clocks) was lost, and axi_dma_runtime_resume() would not run to restore it.
Add system-sleep PM ops that use pm_runtime_force_suspend() and pm_runtime_force_resume() so suspend/resume reuses the existing axi_dma_suspend() and axi_dma_resume() paths.
Replace pm_runtime_get() with pm_runtime_resume_and_get() in dma_chan_alloc_chan_resources() so clocks are enabled before a client can immediately submit a transfer and touch MMIO.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +9 -2
@@ -470,11 +470,17 @@ static void dw_axi_dma_synchronize(struct dma_chan *dchan)static int dma_chan_alloc_chan_resources (struct dma_chan *dchan) {struct axi_dma_chan *chan =dchan_to_axi_dma_chan (dchan); +int ret; + + ret =pm_runtime_resume_and_get (chan->chip->dev); +if (ret <0 ) +return ret;/* ASSERT: channel is idle */ if (axi_chan_is_hw_enable (chan)) {dev_err (chan2dev (chan),"%s is non-idle!\n" ,axi_chan_name (chan)); +pm_runtime_put (chan->chip->dev);return -EBUSY ; }
@@ -485,12 +491,11 @@ static int dma_chan_alloc_chan_resources(struct dma_chan *dchan) 64, 0);if (!chan->desc_pool) {dev_err (chan2dev (chan),"No memory for descriptors\n" ); +pm_runtime_put (chan->chip->dev);return -ENOMEM ; }dev_vdbg (dchan2dev (dchan),"%s: allocating\n" ,axi_chan_name (chan)); -pm_runtime_get (chan->chip->dev); -return 0 ; }
@@ -1565,6 +1570,8 @@ static int dw_remove(struct platform_device *pdev) }static const struct dev_pm_ops dw_axi_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume)SET_RUNTIME_PM_OPS (axi_dma_runtime_suspend, axi_dma_runtime_resume,NULL ) };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 209/1193 hwmon: (pmbus/lm25066) Fix PMBus coefficients for LM5064/5066/5066i
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Potin Lai <[email protected]>
[ Upstream commit 83dda7ed185501ba1f8165aeca83ff4a8ef7c263 ]
Swap the high setting and low setting coefficients in the lm25066_coeff table for LM5064, LM5066, and LM5066i. The coefficients were previously mapped incorrectly, resulting in inverted current and power scaling.
Additionally, dynamically assign the exponent (R) registers inside the probe's LM25066_DEV_SETUP_CL check. This ensures that the proper exponent is applied (e.g., for LM25056, high setting power exponent is -4, but low setting power exponent is -3).
--- drivers/hwmon/pmbus/lm25066.c | 54 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-)
drivers/hwmon/pmbus/lm25066.c +28 -26
@@ -133,23 +133,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10742, - .b = 1552, + .m = 5456, + .b = 2118, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5456, - .b = 2118, + .m = 10742, + .b = 1552, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = 8524, + .m = 612, + .b = 11202, .R = -3, }, [PSC_POWER_L] = { - .m = 612, - .b = 11202, + .m = 1204, + .b = 8524, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -168,23 +168,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10753, - .b = -1200, + .m = 5405, + .b = -600, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5405, - .b = -600, + .m = 10753, + .b = -1200, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = -6000, + .m = 605, + .b = -8000, .R = -3, }, [PSC_POWER_L] = { - .m = 605, - .b = -8000, + .m = 1204, + .b = -6000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -203,23 +203,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 15076, - .b = -504, + .m = 7645, + .b = 100, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 7645, - .b = 100, + .m = 15076, + .b = -504, .R = -2, }, [PSC_POWER] = { - .m = 1701, - .b = -4000, + .m = 861, + .b = -965, .R = -3, }, [PSC_POWER_L] = { - .m = 861, - .b = -965, + .m = 1701, + .b = -4000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -520,18 +520,20 @@ static int lm25066_probe(struct i2c_client *client) info->m[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].m; info->b[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].b; info->R[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].R; - info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; - info->R[PSC_POWER ] = coeff[PSC_POWER ].R;if (config &LM25066_DEV_SETUP_CL ) { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].R; info->m[PSC_POWER ] = coeff[PSC_POWER_L ].m; info->b[PSC_POWER ] = coeff[PSC_POWER_L ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER_L ].R; }else { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; info->m[PSC_POWER ] = coeff[PSC_POWER ].m; info->b[PSC_POWER ] = coeff[PSC_POWER ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER ].R; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/1193 configfs_depend_prep(): pass configfs_dirent instead of dentry
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 764682e0118432260191d194edbdaff208260483 ]
Again, the only thing it uses dentry for is dentry->d_fsdata; for the recursive call the situation is the same as with configfs_detach_prep() and the same observation about ->s_dentry->d_fsdata applies.
--- fs/configfs/dir.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/configfs/dir.c +4 -8
@@ -1060,15 +1060,12 @@ static int configfs_dump(struct configfs_dirent *sd, int level)* much on the stack, though, so folks that need this function - be careful * about your stack! Patches will be accepted to make it iterative. */ -static int configfs_depend_prep (struct dentry *origin, +static int configfs_depend_prep (struct configfs_dirent *sd,struct config_item *target) { -struct configfs_dirent *child_sd, *sd; +struct configfs_dirent *child_sd;int ret =0 ; -BUG_ON (!origin || !origin->d_fsdata); - sd = origin->d_fsdata; -if (sd->s_element == target)/* Boo-yah */ goto out;
@@ -1076,8 +1073,7 @@ static int configfs_depend_prep(struct dentry *origin,if ((child_sd->s_type &CONFIGFS_DIR ) && !(child_sd->s_type &CONFIGFS_USET_DROPPING ) && !(child_sd->s_type &CONFIGFS_USET_CREATING )) { - ret =configfs_depend_prep (child_sd->s_dentry, - target); + ret =configfs_depend_prep (child_sd, target);if (!ret) goto out;/* Child path boo-yah */ }
@@ -1098,7 +1094,7 @@ static int configfs_do_depend_item(struct dentry *subsys_dentry,spin_lock (&configfs_dirent_lock);/* Scan the tree, return 0 if found */ - ret =configfs_depend_prep (subsys_dentry, target); + ret =configfs_depend_prep (subsys_dentry->d_fsdata, target);if (ret) goto out_unlock_dirent_lock;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 210/1193 spi: xilinx: let transfers timeout in case of no IRQ
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit 0f95264f49ace739d411fd9149e2b3545d741d06 ]
In case of failed HW the driver may not see an interrupt and will stuck in waiting forever. We can avoid such situation by timing out of transfers if the interrupt is not seen in a reasonable time.
This problem can be found on unload of ptp_ocp driver for TimeCard which uses Xilinx SPI AXI and SPI-NOR flash memory. During tear-down process spi-nor drivers send soft reset command which is not triggering an interrupt stalling the unload process completely.
--- drivers/spi/spi-xilinx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-xilinx.c +5 -1
@@ -284,7 +284,11 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)if (use_irq) { xspi->write_fn (cr, xspi->regs +XSPI_CR_OFFSET ); -wait_for_completion (&xspi->done); +if (!wait_for_completion_timeout (&xspi->done,secs_to_jiffies (1 ))) { +dev_err (&spi->dev,"SPI transfer timed out\n" ); +xspi_init_hw (xspi); +return -ETIMEDOUT ; + }/* A transmit has just completed. Process received data * and check for more data to transmit. Always inhibit * the transmitter while the Isr refills the transmit
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 211/1193 Bluetooth: btusb: Add Mercusys MA530 for Realtek RTL8761BUV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hrvoje Nuic <[email protected]>
[ Upstream commit ce21a5cf3d1fd92b84ea9ad2b7c7240aff2162d2 ]
Add the USB ID for the Mercusys MA530 Bluetooth adapter. The device uses a Realtek RTL8761BUV controller and works with the existing Realtek setup path.
The device reports vendor ID 0x2c4e and product ID 0x0115, and loads the rtl_bt/rtl8761bu_fw.bin firmware successfully with this quirk.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -730,6 +730,8 @@ static const struct usb_device_id quirks_table[] = { { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, /* Additional Realtek 8761BUV Bluetooth devices */ + { USB_DEVICE(0x2c4e, 0x0115), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 212/1193 Bluetooth: btusb: Add support for TP-Link TL-UB250
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cris <[email protected]>
[ Upstream commit ea77debfe443f505a4edbb7f21340a583a8a143f ]
Add USB ID 2357:0607 for TP-Link TL-UB250.
This is a Realtek RTL8761BUV based Bluetooth adapter.
Without this entry the device is picked up by the generic Bluetooth USB class match and exposes hci0, but the Realtek setup path is not used and rtl8761bu firmware/config are not loaded.
The controller reports Realtek Semiconductor Corporation as the manufacturer and LMP subversion 0x8761. With this entry added, btusb loads rtl_bt/rtl8761bu_fw.bin and rtl_bt/rtl8761bu_config.bin successfully.
Relevant part of /sys/kernel/debug/usb/devices:
T: Bus=01 Lev=02 Prnt=06 Port=00 Cnt=01 Dev#= 9 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2357 ProdID=0607 Rev= 2.00 S: Product=TP-Link TL-UB250 Adapter
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
Use the same flags as the existing TP-Link 2357:0604 entry.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -734,6 +734,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2357, 0x0607), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2550, 0x8761), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/1193 Bluetooth: L2CAP: validate connectionless PSM length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit a40a5f922546b3bd7c094d882b29177db4f2abe0 ]
Connectionless L2CAP frames carry a two-byte PSM at the start of the payload. l2cap_recv_frame() currently reads that PSM unconditionally after validating only the outer L2CAP length.
A malformed connectionless frame with a zero- or one-byte payload can therefore make the parser read beyond the advertised skb payload and use tailroom bytes as part of the PSM. A VHCI-backed QEMU reproducer injected a one-byte connectionless payload and reached the unchecked read.
Reject connectionless frames that cannot contain the PSM before reading or pulling it. This preserves all valid connectionless frames while dropping only structurally incomplete packets.
--- net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/l2cap_core.c +5 -0
@@ -7031,6 +7031,11 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)break ;case L2CAP_CID_CONN_LESS : +if (skb->len <L2CAP_PSMLEN_SIZE ) { +kfree_skb (skb); +break ; + } + psm =get_unaligned ((__le16 *) skb->data);skb_pull (skb,L2CAP_PSMLEN_SIZE );l2cap_conless_channel (conn, psm, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/1193 ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit ee7b5f7b39332febf917f9ebf212842cc9379815 ]
rockchip_pdm_set_fmt() calls pm_runtime_get_sync() before accessing hardware registers, but ignores its return value.
If the runtime resume fails, the function continues to perform register accesses while the device state is undefined.
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and return early on failure to avoid unpowered register accesses.
--- sound/soc/rockchip/rockchip_pdm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_pdm.c +5 -1
@@ -322,6 +322,7 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, {struct rk_pdm_dev *pdm =to_info (cpu_dai);unsigned int mask =0 , val =0 ; +int ret; mask =PDM_CKP_MSK ;switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {
@@ -335,7 +336,10 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai,return -EINVAL ; } -pm_runtime_get_sync (cpu_dai->dev); + ret =pm_runtime_resume_and_get (cpu_dai->dev); +if (ret) +return ret; +regmap_update_bits (pdm->regmap,PDM_CLK_CTRL , mask, val);pm_runtime_put (cpu_dai->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/1193 ASoC: rockchip: rockchip_pdm: Reorder clock enable sequence
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 3168721d6ec3b610edf6a3c22ad190722a27d276 ]
Enable the 'hclk' bus clock before the 'clk' controller clock during runtime resume.
The bus clock provides the register access interface, so enable it before the controller clock. This also makes the resume sequence the reverse of the suspend sequence, which keeps the clock ordering consistent.
--- sound/soc/rockchip/rockchip_pdm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/rockchip/rockchip_pdm.c +5 -5
@@ -427,16 +427,16 @@ static int rockchip_pdm_runtime_resume(struct device *dev)struct rk_pdm_dev *pdm =dev_get_drvdata (dev);int ret; - ret =clk_prepare_enable (pdm->clk); + ret =clk_prepare_enable (pdm->hclk);if (ret) { -dev_err (pdm->dev,"clock enable failed %d\n" , ret); +dev_err (pdm->dev,"hclock enable failed %d\n" , ret);return ret; } - ret =clk_prepare_enable (pdm->hclk); + ret =clk_prepare_enable (pdm->clk);if (ret) { -clk_disable_unprepare (pdm->clk); -dev_err (pdm->dev,"hclock enable failed %d\n" , ret); +clk_disable_unprepare (pdm->hclk); +dev_err (pdm->dev,"clock enable failed %d\n" , ret);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/1193 ASoC: rockchip: spdif: Restore regcache cache-only mode on sync failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 3546e9aa691ac981e4734fedd1646d0180784893 ]
If regcache_sync() fails during runtime resume, the driver disables the clocks and returns an error. However, the regmap cache-only mode is left disabled.
Restore cache-only mode in the error path so subsequent register accesses continue to use the cache while the device is inactive.
--- sound/soc/rockchip/rockchip_spdif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_spdif.c +1 -0
@@ -98,6 +98,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) ret =regcache_sync (spdif->regmap);if (ret) { +regcache_cache_only (spdif->regmap, true);clk_disable_unprepare (spdif->mclk);clk_disable_unprepare (spdif->hclk); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 217/1193 Bluetooth: btusb: Add TP-Link UB600 for Realtek 8761BUV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nils Helmig <[email protected]>
[ Upstream commit bc597f0cc44f0b173c50ee986a047219cd559ee9 ]
Add the vendor/product ID (0x37ad, 0x0600) to usb_device_id table for Realtek 8761BUV.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=37ad ProdID=0600 Rev= 2.00 S: Manufacturer= S: Product=TP-Link Bluetooth USB Adapter S: SerialNumber=ACA7F14FD2A5 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -750,6 +750,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2b89, 0x6275), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x37ad, 0x0600), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, /* Additional Realtek 8761CU Bluetooth devices */ { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 218/1193 sparc64: uprobes: add missing break
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 5b0eee4cd812bd6547eea393cb9b5c0322f26c88 ]
Missing fallthrough causes failure with newer compilers:
arch/sparc/kernel/uprobes.c:284:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
284 | default:
| ^
arch/sparc/kernel/uprobes.c:284:2: note: insert 'break;' to avoid fall-through
284 | default:
| ^
| break;--- arch/sparc/kernel/uprobes.c | 1 + 1 file changed, 1 insertion(+)
arch/sparc/kernel/uprobes.c +1 -0
@@ -278,6 +278,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,case DIE_SSTEP :if (uprobe_post_sstep_notifier (args->regs)) ret =NOTIFY_STOP ; +break ;default :break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 219/1193 net: stmmac: xgmac2: disable RBUE in default RX interrupt mask
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nazim Amirul <[email protected]>
[ Upstream commit d3265c19b35d036bba327b36b5366bee76b0157c ]
Enabling the RX Buffer Unavailable (RBUE) interrupt is counterproductive and can trigger a MAC interrupt storm under heavy RX pressure. When the DMA runs out of RX descriptors it fires RBUE continuously until software refills the ring.
However, RBUE is redundant: the normal RX completion interrupt (RIE) already triggers NAPI, which processes completed descriptors and refills the ring, causing the DMA to resume. The RBUE handler itself only sets handle_rx - the same outcome as RIE.
On Agilex5 under heavy RX pressure, the MAC interrupt (which includes RBUE) was observed firing 1,821,811,555 times against only 2,618,627 actual RX completions - a ~695x ratio - confirming the severity of the storm.
RBUE does not provide OOM recovery. If page_pool is exhausted, stmmac_rx_refill() cannot advance the DMA tail pointer, the DMA stays suspended, and RBUE fires again on the next NAPI completion - a storm with no forward progress. This patch trades that storm for a clean stall with the same RX outcome. Proper OOM recovery is a pre-existing gap outside the scope of this fix.
Note: as a consequence of disabling RBUE, the rx_buf_unav_irq ethtool counter will always read 0 on XGMAC2 devices. This behaviour is already inconsistent across DWMAC core versions.
Remove RBUE from XGMAC_DMA_INT_DEFAULT_EN and XGMAC_DMA_INT_DEFAULT_RX to prevent the interrupt storm while keeping normal RX handling intact.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -2
@@ -435,9 +435,9 @@#define XGMAC_RIE BIT(6)#define XGMAC_TBUE BIT(2)#define XGMAC_TIE BIT(0) -#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | XGMAC_RBUE | \ +#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | \ XGMAC_RIE | XGMAC_TIE) -#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RBUE | XGMAC_RIE) +#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RIE)#define XGMAC_DMA_INT_DEFAULT_TX (XGMAC_TIE)#define XGMAC_DMA_CH_Rx_WATCHDOG (x) (0x0000313c + (0x80 * (x)))#define XGMAC_RWT GENMASK(7, 0)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/1193 net: ibm: emac: mal: fix potential system hang in mal_remove()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 7c5d41f87f079990bf241359e3c1332d8d10fe87 ]
napi_disable() is not idempotent and calling it on an already-disabled or unenabled NAPI context will cause the kernel to spin indefinitely waiting for the NAPI_STATE_SCHED bit to clear.
In mal_remove(), napi_disable() is called unconditionally. If no MACs were registered, NAPI was never enabled. Also, if they were registered but subsequently unregistered, NAPI was already disabled in mal_unregister_commac(). In either case, calling napi_disable() causes the kernel to hang upon module removal.
Fix this by only calling napi_disable() in mal_remove() if the commac list is not empty (which implies NAPI is enabled).
--- drivers/net/ethernet/ibm/emac/mal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/ibm/emac/mal.c +3 -3
@@ -718,13 +718,13 @@ static int mal_remove(struct platform_device *ofdev)MAL_DBG (mal,"remove" NL );/* Synchronize with scheduled polling */ -napi_disable (&mal->napi); - -if (!list_empty (&mal->list)) +if (!list_empty (&mal->list)) { +napi_disable (&mal->napi);/* This is *very* bad */ WARN (1 ,KERN_EMERG "mal%d: commac list is not empty on remove!\n" , mal->index); + }free_irq (mal->serr_irq, mal);free_irq (mal->txde_irq, mal);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 220/1193 ptp: ocp: add shutdown callback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit f6f955cbf9d4e02deebe54ca91c118b53be9ffe6 ]
The shutdown callback was never implemented for this driver, but it's needed because .remove() callback is never called during kexec/reboot process. That leaves HW with some interrupts enabled and may cause spurious interrupt while booting into a new kernel during with kexec. If it happens that I2C interrupt fires during kexec, the whole I2C bus is disabled leaving TimeCard with no devlink communication. The same happens if timestampers were enabled, leaving the card without timestamper interrupts until full reboot cycle.
Implement .shutdown() callback with the same function as remove callback.
--- drivers/ptp/ptp_ocp.c | 1 + 1 file changed, 1 insertion(+)
drivers/ptp/ptp_ocp.c +1 -0
@@ -4264,6 +4264,7 @@ static struct pci_driver ptp_ocp_driver = { .id_table = ptp_ocp_pcidev_id, .probe = ptp_ocp_probe, .remove = ptp_ocp_remove, + .shutdown = ptp_ocp_remove, }; static int
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 221/1193 vsock: use sk_acceptq_is_full() helper in all transports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raf Dickson <[email protected]>
[ Upstream commit 4ff2e84ff1b33d79fa0e3ae355ce4a334908ef9a ]
Replace the open-coded backlog check with sk_acceptq_is_full(). The helper uses > instead of >=, which is the correct comparison per commit 64a146513f8f ("[NET]: Revert incorrect accept queue backlog changes."), and adds READ_ONCE() for proper memory ordering.
--- net/vmw_vsock/hyperv_transport.c | 2 +- net/vmw_vsock/vmci_transport.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/hyperv_transport.c +1 -1
@@ -323,7 +323,7 @@ static void hvs_open_connection(struct vmbus_channel *chan) goto out;if (conn_from_host) { -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) +if (sk_acceptq_is_full (sk)) goto out; new =vsock_create_connected (sk);
net/vmw_vsock/vmci_transport.c +1 -1
@@ -1002,7 +1002,7 @@ static int vmci_transport_recv_listen(struct sock *sk,* reset. Otherwise we create and initialize a child socket and reply * with a connection negotiation. */ -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) { +if (sk_acceptq_is_full (sk)) {vmci_transport_reply_reset (pkt);return -ECONNREFUSED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 222/1193 e1000e: limit endianness conversion to boundary words
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Agalakov Daniil <[email protected]>
[ Upstream commit a5ecafcfb27baf2dba766c4fd99dbb947f4e85d8 ]
[Why]
In e1000_set_eeprom(), the eeprom_buff is allocated to hold a range of words. However, only the boundary words (the first and the last) are populated from the EEPROM if the write request is not word-aligned. The words in the middle of the buffer remain uninitialized because they are intended to be completely overwritten by the new data via memcpy().
The previous implementation had a loop that performed le16_to_cpus() on the entire buffer. This resulted in endianness conversion being performed on uninitialized memory for all interior words.
Fix this by converting the endianness only for the boundary words immediately after they are successfully read from the EEPROM.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/intel/e1000e/ethtool.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/e1000e/ethtool.c +12 -7
@@ -605,20 +605,25 @@ static int e1000_set_eeprom(struct net_device *netdev,/* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ ret_val =e1000_read_nvm (hw, first_word,1 , &eeprom_buff[0 ]); +if (ret_val) + goto out; + +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[0 ]); + ptr++; } -if (((eeprom->offset + eeprom->len) &1 ) && (!ret_val)) +if ((eeprom->offset + eeprom->len) &1 ) {/* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ ret_val =e1000_read_nvm (hw, last_word,1 , &eeprom_buff[last_word - first_word]); +if (ret_val) + goto out; -if (ret_val) - goto out; - -/* Device's eeprom is always little-endian, word addressable */ -for (i =0 ; i < last_word - first_word +1 ; i++) -le16_to_cpus (&eeprom_buff[i]); +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[last_word - first_word]); + }memcpy (ptr, bytes, eeprom->len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 223/1193 net/sched: act_csum: dont mangle UDP tunnel GSO packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit 9bcb30b389ec5888590cb6ec58c7a3b80fe49a11 ]
Similar to commit add641e7dee3 ("sched: act_csum: don't mangle TCP and UDP GSO packets"), UDP tunnel GSO packets going through act_csum shouldn't have their checksum calculated at this point, because it will be done after segmentation. Setting the checksum in act_csum modifies skb->ip_summed and prevents inner IP csum offload from kicking in, resulting in a packet with a bad checksum.
Add UDP tunnel GSO packets to the exceptions, and also add UDP GSO (SKB_GSO_UDP_L4), as the same logic as in the commit mentioned above applies to UDP GSO too.
--- net/sched/act_csum.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/act_csum.c +6 -2
@@ -258,7 +258,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,const struct iphdr *iph;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
@@ -314,7 +316,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,const struct ipv6hdr *ip6h;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 224/1193 smb: client: fix races in cifsd thread creation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fredric Cover <[email protected]>
[ Upstream commit e8a5cf2ff5a13fefb228f2069e29dd7d8e37185d ]
The cifsd demultiplex thread can run and access tcp_ses before the parent thread has finished populating tcp_ses, which the worker thread accesses locklessly.
Also, the kthread_run macro may start the thread before returning the thread pointer. Because the pointer is part of the structure that the thread can access, if the kernel is preempted after the thread is spawned, but before the thread pointer is populated and the thread attempts to exit, it will sleep, waiting for a SIGKILL signal.
Fix this by moving creation of the thread to after all of tcp_ses'es fields are populated, and spawning the thread last, using a split kthread_create/wake_up_process logic.
--- fs/smb/client/connect.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
fs/smb/client/connect.c +16 -11
@@ -1839,14 +1839,6 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* this will succeed. No need for try_module_get(). */ __module_get (THIS_MODULE ); - tcp_ses->tsk =kthread_run (cifs_demultiplex_thread, - tcp_ses,"cifsd" ); -if (IS_ERR (tcp_ses->tsk)) { - rc =PTR_ERR (tcp_ses->tsk); -cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); -module_put (THIS_MODULE ); - goto out_err_crypto_release; - } tcp_ses->min_offload = ctx->min_offload; tcp_ses->retrans = ctx->retrans;/*
@@ -1854,9 +1846,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* to the struct since the kernel thread not created yet * no need to spinlock this update of tcpStatus */ -spin_lock (&tcp_ses->srv_lock); tcp_ses->tcpStatus = CifsNeedNegotiate; -spin_unlock (&tcp_ses->srv_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 )) tcp_ses->max_credits =SMB2_MAX_CREDITS_AVAILABLE ;
@@ -1865,7 +1855,16 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, tcp_ses->nr_targets =1 ; tcp_ses->ignore_signature = ctx->ignore_signature; -/* thread spawned, put it on the list */ + + tcp_ses->tsk =kthread_create (cifs_demultiplex_thread, + tcp_ses,"cifsd" ); +if (IS_ERR (tcp_ses->tsk)) { + rc =PTR_ERR (tcp_ses->tsk); +cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); +module_put (THIS_MODULE ); + goto out_err_crypto_release; + } +/* thread created, put it on the list */ spin_lock (&cifs_tcp_ses_lock);list_add (&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);spin_unlock (&cifs_tcp_ses_lock);
@@ -1873,6 +1872,12 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,/* queue echo request delayed work */ queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval); +/* +* Use split create/wake logic to ensure that tcp_ses is fully populated +* and tcp_ses->tsk is valid +*/ +wake_up_process (tcp_ses->tsk); +return tcp_ses; out_err_crypto_release:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 225/1193 i3c: mipi-i3c-hci: Tolerate i3c_master_add_i3c_dev_locked() failures in DAA
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit c236563c8a84239d31a1e6ec4444887a7b5ed98f ]
i3c_master_add_i3c_dev_locked() no longer leaves the address marked as free on failure, so aborting the DAA sequence on its error is unnecessary.
Failure to register a discovered device does not invalidate the entire Dynamic Address Assignment (DAA) procedure. Align with the behavior of other I3C master drivers by ignoring errors from i3c_master_add_i3c_dev_locked() and continuing enumeration.
--- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 4 +--- drivers/i3c/master/mipi-i3c-hci/cmd_v2.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +1 -3
@@ -359,9 +359,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }if (dat_idx >=0 )
drivers/i3c/master/mipi-i3c-hci/cmd_v2.c +1 -3
@@ -299,9 +299,7 @@ static int hci_cmd_v2_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }hci_free_xfer (xfer,2 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 226/1193 sparc: Disable compat support with LLD
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 852fed2e8bfe195351fb0078ba7245d41154e7a5 ]
An LLVM=1 sparc64 allmodconfig enables COMPAT and then tries to build the 32-bit vDSO. That path cannot be linked with ld.lld:
ld.lld: error: unknown emulation: elf32_sparc
ld.lld does not support the 32-bit SPARC ELF emulation used for the compat vDSO, so keep COMPAT disabled when LLD is the linker. This avoids selecting an unsupported build path while leaving the existing GNU ld configuration unchanged.
--- arch/sparc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/sparc/Kconfig +1 -0
@@ -487,6 +487,7 @@ endmenu config COMPAT bool depends on SPARC64 + depends on !LD_IS_LLD default y select HAVE_UID16 select ARCH_WANT_OLD_COMPAT_IPC
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/1193 tls: Flush backlog before waiting for a new record
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit edcf32b8a48f5882b5b7a91b21c89d233d4aecf2 ]
While lock_sock is held, incoming TCP segments land on sk->sk_backlog rather than sk->sk_receive_queue. tls_rx_rec_wait() inspects only sk_receive_queue, so backlog data remains invisible. For non-blocking callers (read_sock, and recvmsg or splice_read with MSG_DONTWAIT) this causes a spurious -EAGAIN. For blocking callers it forces an unnecessary sleep/wakeup cycle.
Flush the backlog inside tls_rx_rec_wait() before checking sk_receive_queue so the strparser can parse newly-arrived segments immediately. On the next loop iteration tls_read_flush_backlog() may redundantly flush, but this path is cold and the cost is negligible.
Backlog processing can run tcp_reset(), which calls tcp_done_with_error() to set sk->sk_err = ECONNRESET and then tcp_done() to set sk->sk_shutdown = SHUTDOWN_MASK. The pre-existing top-of-loop sk_err check already ran before the flush, so the freshly-set error would be masked by the next-line sk_shutdown test returning 0 (EOF). Re-check sk_err immediately before the sk_shutdown test so a connection abort surfaces as -ECONNRESET rather than a clean EOF.
Commit f508262ae9f2 ("tls: Preserve sk_err across recvmsg() when data has been copied") gave the top-of-loop sk_err check a has_copied split. The recheck applies the same handling: when the caller has already copied bytes, sk_err is reported but preserved so the error surfaces on the next call; otherwise sock_error() consumes it so the error is reported exactly once.
--- net/tls/tls_sw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/tls/tls_sw.c +12 -0
@@ -1414,12 +1414,24 @@ tls_rx_rec_wait(struct sock *sk, struct sk_psock *psock, bool nonblock,if (ret <0 )return ret; +if (sk_flush_backlog (sk)) + released = true;if (!skb_queue_empty (&sk->sk_receive_queue)) {tls_strp_check_rcv (&ctx->strp);if (tls_strp_msg_ready (ctx))break ; } +/* sk_flush_backlog() can run tcp_reset(), which sets +* sk_err and then sk_shutdown via tcp_done(). Recheck +* sk_err here so a connection abort surfaces as the +* actual error rather than a clean EOF. +*/ +if (sk->sk_err) { +if (has_copied) +return -READ_ONCE (sk->sk_err); +return sock_error (sk); + }if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/1193 platform/x86: dell-laptop: add Inspiron N5110 to touchpad LED quirk table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gleb Sonichev <[email protected]>
[ Upstream commit bfe91a80b13f8068f6fa07aa8c468d284150d4ad ]
The Inspiron N5110 needs the touchpad LED quirk (Vostro V130 quirk) to properly control the touchpad LED. Add its DMI identifier to the existing quirk table, next to the similar Inspiron M5110 entry.
Tested on Dell Inspiron N5110.
The touchpad LED works correctly with this quirk enabled.
--- drivers/platform/x86/dell/dell-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/dell/dell-laptop.c +9 -0
@@ -206,6 +206,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = { }, .driver_data = &quirk_dell_vostro_v130, }, + { + .callback = dmi_matched, + .ident = "Dell Inspiron N5110", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N5110"), + }, + .driver_data = &quirk_dell_vostro_v130, + }, { .callback = dmi_matched, .ident = "Dell Vostro 3360",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/1193 wifi: mt76: transform aspm_conf for pci_disable_link_state
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiajia Liu <[email protected]>
[ Upstream commit 2dd78856223484895306351df1f903a4b75d213f ]
commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") changed PCIE_LINK_STATE_L0S (1) to (BIT(0) | BIT(1)). PCI_EXP_LNKCTL_ASPM_L0S (1) and PCI_EXP_LNKCTL_ASPM_L1 (2) are no longer matched with PCIE_LINK_STATE_L0S (3) and PCIE_LINK_STATE_L1 (4).
On the platform enabling ASPM L0s and L1, mt76_pci_disable_aspm is not able to disable L1. Fix this by transforming aspm_conf to pcie link state.
--- drivers/net/wireless/mediatek/mt76/pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/pci.c +7 -1
@@ -30,8 +30,14 @@ void mt76_pci_disable_aspm(struct pci_dev *pdev)if (IS_ENABLED (CONFIG_PCIEASPM )) {int err; +int state =0 ; - err =pci_disable_link_state (pdev, aspm_conf); +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L0S ) + state |=PCIE_LINK_STATE_L0S ; +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L1 ) + state |=PCIE_LINK_STATE_L1 ; + + err =pci_disable_link_state (pdev, state);if (!err)return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/1193 btrfs: protect sb_write_pointer() with invalidate lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: KangNing Liao <[email protected]>
[ Upstream commit 123b9a545f4d0348e81f558a032bf2a93ee5722f ]
sb_write_pointer() reads the super block from the block device page cache using read_cache_page_gfp(). This has the same race with BLKBSZSET as the one fixed by commit 3f29d661e568 ("btrfs: sync read disk super and set block size").
Take the mapping invalidate lock around read_cache_page_gfp() to serialize the read against block size changes.
--- fs/btrfs/zoned.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/zoned.c +2 -0
@@ -130,8 +130,10 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,u64 bytenr =ALIGN_DOWN (zone_end,BTRFS_SUPER_INFO_SIZE ) -BTRFS_SUPER_INFO_SIZE ; +filemap_invalidate_lock (mapping); page[i] =read_cache_page_gfp (mapping, bytenr >>PAGE_SHIFT ,GFP_NOFS ); +filemap_invalidate_unlock (mapping);if (IS_ERR (page[i])) {if (i ==1 )btrfs_release_disk_super (super[0 ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/1193 hwmon: (adt7462) Add of_match_table to support devicetree
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 cd1b42617aafe01810ab7d3b9948d2f5fa9fb8af ]
Add of_match_table to add support of devicetree probing.
--- drivers/hwmon/adt7462.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hwmon/adt7462.c +8 -0
@@ -12,6 +12,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/err.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/log2.h> #include <linux/slab.h>
@@ -1814,10 +1815,17 @@ static const struct i2c_device_id adt7462_id[] = { };MODULE_DEVICE_TABLE (i2c, adt7462_id); +static const struct of_device_id adt7462_of_match[] = { + { .compatible ="onnn,adt7462" }, + { }, +}; +MODULE_DEVICE_TABLE (of, adt7462_of_match); +static struct i2c_driver adt7462_driver = { .class =I2C_CLASS_HWMON , .driver = { .name ="adt7462" , + .of_match_table = adt7462_of_match, }, .probe = adt7462_probe, .id_table = adt7462_id,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/1193 net: dsa: qca8k: Add support for force mode for fixed link topology
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Moussalem <[email protected]>
[ Upstream commit e0a77b1ed9001bdd0c73b99c67abb90f4bd7d7f5 ]
A fixed link topology is commonly used to connect this switch (on port 0 or 6) to a SoC's MAC over SGMII. When inband negotiation is not used, the switch needs to be configured to operate in force mode. As such, enable support for force mode.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 22 ++++++++++++++++------ drivers/net/dsa/qca/qca8k.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/dsa/qca/qca8k-8xxx.c +16 -6
@@ -1526,7 +1526,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, {struct qca8k_priv *priv =pcs_to_qca8k_pcs (pcs)->priv;int cpu_port_index, ret, port; -u32 reg, val; +u32 mask, reg, val; port =pcs_to_qca8k_pcs (pcs)->port;switch (port) {
@@ -1599,11 +1599,21 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,if (priv->ports_config.sgmii_tx_clk_falling_edge) val |=QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE ; -if (val) - ret =qca8k_rmw (priv, reg, -QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | -QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE , - val); + mask = (val) ? (QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | +QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE ) :0 ; + +/* +* (Un)set force mode on QCA8337 only, don't include it in the mask for +* others. It is written to the PORT0 PAD register for both port 0 and 6. +*/ +if (priv->switch_id ==QCA8K_ID_QCA8337 ) { +if (neg_mode ==PHYLINK_PCS_NEG_OUTBAND ) + val |=QCA8K_PORT_PAD_SGMII_FORCE_MODE ; + mask |=QCA8K_PORT_PAD_SGMII_FORCE_MODE ; + } + +if (mask) + ret =qca8k_rmw (priv, reg, mask, val);return 0 ; }
drivers/net/dsa/qca/qca8k.h +1 -0
@@ -58,6 +58,7 @@#define QCA8K_PORT_PAD_RGMII_TX_DELAY_EN BIT(25)#define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24)#define QCA8K_PORT_PAD_SGMII_EN BIT(7) +#define QCA8K_PORT_PAD_SGMII_FORCE_MODE BIT(3)#define QCA8K_REG_PWS 0x010#define QCA8K_PWS_POWER_ON_SEL BIT(31)/* This reg is only valid for QCA832x and toggle the package
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/1193 RDMA/rtrs-srv: Fix integer underflow in process_read and process_write
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurelien DESBRIERES <[email protected]>
[ Upstream commit 54bf38b27afc08a0eb6b732f9c14eb8a4bcb66b5 ]
usr_len is read from a network-supplied message field (le16_to_cpu) and used to compute data_len = off - usr_len without validating that usr_len <= off. A malicious RDMA client can send usr_len > off causing an integer underflow, resulting in data_len wrapping to a huge size_t value which is then passed to the rdma_ev callback as a memory length, leading to out-of-bounds memory access.
Fix by reading and validating usr_len <= off before rtrs_srv_get_ops_ids() in both process_read() and process_write(), ensuring the early return path acquires no reference and has no resource leak.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +10 -2
@@ -1042,6 +1042,11 @@ static void process_read(struct rtrs_srv_con *con, "Processing read request failed, invalid message\n");return ; } + usr_len =le16_to_cpu (msg->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,READ ); id = srv_path->ops_ids[buf_id];
@@ -1049,7 +1054,6 @@ static void process_read(struct rtrs_srv_con *con, id->dir =READ ; id->msg_id = buf_id; id->rd_msg = msg; - usr_len =le16_to_cpu (msg->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
@@ -1095,6 +1099,11 @@ static void process_write(struct rtrs_srv_con *con, rtrs_srv_state_str(srv_path->state));return ; } + usr_len =le16_to_cpu (req->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,WRITE ); id = srv_path->ops_ids[buf_id];
@@ -1102,7 +1111,6 @@ static void process_write(struct rtrs_srv_con *con, id->dir =WRITE ; id->msg_id = buf_id; - usr_len =le16_to_cpu (req->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 228/1193 HID: hidpp: fix potential UAF in hidpp_connect_event()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 6df6b1f2c49678211f65647c300bc51dda02893b ]
If input_register_device() fails, we call input_free_device(), but keep stale pointer to the old device in hidpp->input, which could potentially lead to UAF. Fix that by resetting it to NULL before returning from hidpp_connect_event().
--- drivers/hid/hid-logitech-hidpp.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-logitech-hidpp.c +1 -0
@@ -4313,6 +4313,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) ret =input_register_device (input);if (ret) { + hidpp->input =NULL ;input_free_device (input);return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 237/1193 leds: pca9532: Dont stop blinking for non-zero brightness
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Deiminger <[email protected]>
[ Upstream commit 0261683a4d31783d680e74b3ae5f22f6a62128cc ]
pca9532 unexpectedly stopped blinking when changing brightness to a non-zero value. To reproduce:
echo timer > /sys/class/leds/led-1/trigger # blinks echo 255 > /sys/class/leds/led-1/brightness # blinking stops, light on cat /sys/class/leds/led-1/trigger # still claims [timer]
According to Documentation/leds/leds-class.rst, only brightness = 0 shall be a stop condition:
Quoted 3 lines
You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to
LED_OFFit will also disable the timer trigger.
Therefore add a guard to continue blinking when brightness != LED_OFF, similar to how pca955x does it since 575f10dc64a2 ("leds: pca955x: Add HW blink support").
--- drivers/leds/leds-pca9532.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/leds-pca9532.c +5 -3
@@ -175,11 +175,13 @@ static int pca9532_set_brightness(struct led_classdev *led_cdev,int err =0 ;struct pca9532_led *led =ldev_to_led (led_cdev); -if (value ==LED_OFF ) +if (value ==LED_OFF ) { led->state =PCA9532_OFF ; -else if (value ==LED_FULL ) + }else if (led->state ==PCA9532_PWM1 ) { +return 0 ;/* Non-zero brightness shall not stop HW blinking */ + }else if (value ==LED_FULL ) { led->state =PCA9532_ON ; -else { + }else { led->state =PCA9532_PWM0 ;/* Thecus: hardcode one pwm */ err =pca9532_calcpwm (led->client,0 ,0 , value);if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 238/1193 mfd: tps65219: Make poweroff handler conditional on system-power-controller
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akashdeep Kaur <[email protected]>
[ Upstream commit 104cd764a031bfe2ffe253adce9581384a78c16e ]
Currently, the TPS65219 driver unconditionally registers a poweroff handler. This causes issues on systems where a different component (such as TF-A firmware) should handle system poweroff instead.
Make the poweroff handler registration conditional based on the "system-power-controller" device tree property. This follows the standard kernel pattern where only the designated power controller registers for system poweroff operations.
On systems where the property is absent, the PMIC will not register a poweroff handler, allowing other poweroff mechanisms to function.
--- drivers/mfd/tps65219.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65219.c +8 -6
@@ -280,13 +280,15 @@ static int tps65219_probe(struct i2c_client *client)return ret; } - ret =devm_register_power_off_handler (tps->dev, - tps65219_power_off_handler, - tps); -if (ret) { -dev_err (tps->dev,"failed to register power-off handler: %d\n" , ret); -return ret; +if (of_device_is_system_power_controller (tps->dev->of_node)) { + ret =devm_register_power_off_handler (tps->dev, + tps65219_power_off_handler, + tps); +if (ret) +return dev_err_probe (tps->dev, ret, +"Failed to register power-off handler\n" ); } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 239/1193 mfd: rsmu: Add 8a34002 support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Bystrin <[email protected]>
[ Upstream commit d18fd55c780c2bae3d353024cab7f8746d3d9e91 ]
Add compatible string, i2c_devcie_id and spi_devcie_id to support 8a34002.
--- drivers/mfd/rsmu_i2c.c | 2 ++ drivers/mfd/rsmu_spi.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/mfd/rsmu_i2c.c +2 -0
@@ -255,6 +255,7 @@ static void rsmu_i2c_remove(struct i2c_client *client)static const struct i2c_device_id rsmu_i2c_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {"8v19n850" ,RSMU_SL },
@@ -266,6 +267,7 @@ MODULE_DEVICE_TABLE(i2c, rsmu_i2c_id);static const struct of_device_id rsmu_i2c_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,8v19n850" , .data = (void *)RSMU_SL },
drivers/mfd/rsmu_spi.c +2 -0
@@ -244,6 +244,7 @@ static void rsmu_spi_remove(struct spi_device *client)static const struct spi_device_id rsmu_spi_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {}
@@ -253,6 +254,7 @@ MODULE_DEVICE_TABLE(spi, rsmu_spi_id);static const struct of_device_id rsmu_spi_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, {}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 240/1193 drm/amdkfd: Let driver decide buffer size at AMDKFD_IOC_GET_DMABUF_INFO ioctl
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaogang Chen <[email protected]>
[ Upstream commit 8242a8d9d7194d5ef8a8b38a5621ca0966a3ec15 ]
amdkfd driver needs allocate buffer to return bo metadata to user space. The buffer size is controlled by user currently. It is a potential security issue that hostile value (e.g. 2 GiB) lets any render-group user trigger order-MAX allocation/OOM in kernel context.
This patch first finds bo metadata size. If the size is smaller than user provided value drive can safely allocate buffer in kernel space and copy to user space buffer. If not, driver will let user know, not allocate and copy. User will redo with new buffer in user space.
This patch lets driver decide buffer allocation size to avoid potential hostile size from user space.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 23 ++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++-------- 3 files changed, 22 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +19 -4
@@ -469,7 +469,7 @@ uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz(struct amdgpu_device *adev)int amdgpu_amdkfd_get_dmabuf_info (struct amdgpu_device *adev,int dma_buf_fd,struct amdgpu_device **dmabuf_adev, -uint64_t *bo_size,void *metadata_buffer, +uint64_t *bo_size,void **metadata_buffer,size_t buffer_size,uint32_t *metadata_size,uint32_t *flags,int8_t *xcp_id) {
@@ -504,9 +504,24 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd, *dmabuf_adev = adev;if (bo_size) *bo_size =amdgpu_bo_size (bo); -if (metadata_buffer) - r =amdgpu_bo_get_metadata (bo, metadata_buffer, buffer_size, - metadata_size, &metadata_flags); +if (metadata_buffer) { +/* first get metadata_size by buffer = NULL */ + r =amdgpu_bo_get_metadata (bo,NULL ,0 , + metadata_size,NULL ); + +/* user buf_size is bigger than bo metadata_size +* allocate a buf at kernel space and copy */ +if (*metadata_size <= buffer_size) { + *metadata_buffer =kzalloc (*metadata_size,GFP_KERNEL ); + +if (!*metadata_buffer) +return -ENOMEM ; + + r =amdgpu_bo_get_metadata (bo, *metadata_buffer, *metadata_size, +NULL , &metadata_flags); + }else + r = -EINVAL ; + }if (flags) { *flags = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ? KFD_IOC_ALLOC_MEM_FLAGS_VRAM
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -1
@@ -237,7 +237,7 @@ uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev);uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz (struct amdgpu_device *adev);int amdgpu_amdkfd_get_dmabuf_info (struct amdgpu_device *adev,int dma_buf_fd,struct amdgpu_device **dmabuf_adev, -uint64_t *bo_size,void *metadata_buffer, +uint64_t *bo_size,void **metadata_buffer,size_t buffer_size,uint32_t *metadata_size,uint32_t *flags,int8_t *xcp_id); uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -8
@@ -1547,16 +1547,10 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,if (!dev)return -EINVAL ; -if (args->metadata_ptr) { - metadata_buffer =kzalloc (args->metadata_size,GFP_KERNEL ); -if (!metadata_buffer) -return -ENOMEM ; - } -/* Get dmabuf info from KGD */ r =amdgpu_amdkfd_get_dmabuf_info (dev->adev, args->dmabuf_fd, &dmabuf_adev, &args->size, - metadata_buffer, args->metadata_size, + &metadata_buffer, args->metadata_size, &args->metadata_size, &flags, &xcp_id);if (r) goto exit;
@@ -1568,7 +1562,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, args->flags = flags;/* Copy metadata buffer to user mode */ -if (metadata_buffer) { +if (metadata_buffer && args->metadata_ptr) { r =copy_to_user ((void __user *)args->metadata_ptr, metadata_buffer, args->metadata_size);if (r !=0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 241/1193 drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaogang Chen <[email protected]>
[ Upstream commit 516bf737a5602875f6c28d1028967837c8edf2c0 ]
If inx from find_first_zero_bit is beyond range not need set doorbell_bitmap.
--- drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +5 -3
@@ -153,14 +153,16 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd,u32 inx;mutex_lock (&kfd->doorbell_mutex); + inx =find_first_zero_bit (kfd->doorbell_bitmap,PAGE_SIZE /sizeof (u32)); +if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) { +mutex_unlock (&kfd->doorbell_mutex); +return NULL ; + }__set_bit (inx, kfd->doorbell_bitmap);mutex_unlock (&kfd->doorbell_mutex); -if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) -return NULL ; - *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 242/1193 drm/amdgpu: Use system unbound workqueue for soft IH ring
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit ba2977dcce72127986fbad76c4c67f134e2f69ae ]
Allow the kernel to dispatch the soft IH work on other CPUs.
Otherwise it can happen that the soft IH ring fills up before it actually starts processing anything, which can easily happen with retry page faults, in which case the CP repeatedly spams the CPU with a lot of interrupts.
This significantly improves retry page fault handling on GPUs that don't have the filter CAM and must rely on software based filtering.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -500,7 +500,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev, unsigned int num_dw) {amdgpu_ih_ring_write (adev, &adev->irq.ih_soft, entry->iv_entry, num_dw); -schedule_work (&adev->irq.ih_soft_work); +queue_work (system_unbound_wq, &adev->irq.ih_soft_work); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 243/1193 ALSA: usb-audio: Add quirk for YAMAHA CDS3000
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Louis Colaco <[email protected]>
[ Upstream commit 348f69320e4db6ebec6940c81154bec4b9eb275a ]
This quirk is identical to the one for the Yamaha Steinberg UR22, here applied to a CD player that also uses the Steinberg USB interface. This quirk is necessary to avoid sporadic "clic" noise when using the DAC of the player.
--- sound/usb/quirks-table.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/usb/quirks-table.h +14 -0
@@ -390,6 +390,20 @@ YAMAHA_DEVICE(0x105d, NULL), } } }, +{ +USB_DEVICE (0x0499 ,0x150d ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Yamaha", */ +/* .product_name = "CDS3000", */ + QUIRK_DATA_COMPOSITE { + { QUIRK_DATA_STANDARD_AUDIO(1) }, + { QUIRK_DATA_STANDARD_AUDIO(2) }, + { QUIRK_DATA_MIDI_YAMAHA(3) }, + { QUIRK_DATA_IGNORE(4) }, + QUIRK_COMPOSITE_END + } + } +}, {USB_DEVICE (0x0499 ,0x1718 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 244/1193 PCI: iproc: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a6a64e150f12ad5391e0a0d60f6a3d119b06ce50 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-iproc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-iproc.c +2 -0
@@ -1540,8 +1540,10 @@ void iproc_pcie_remove(struct iproc_pcie *pcie) {struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();iproc_pcie_msi_disable (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 245/1193 PCI: altera: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a8759c8ac48c0419f5899e95a6ffc611b07c965b ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-altera.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-altera.c +2 -0
@@ -832,8 +832,10 @@ static void altera_pcie_remove(struct platform_device *pdev)struct altera_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();altera_pcie_irq_teardown (pcie); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 246/1193 PCI: rockchip: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit 0bd9611587bb494c33566d825fe34b2705e4b167 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-rockchip-host.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-rockchip-host.c +2 -0
@@ -1018,8 +1018,10 @@ static void rockchip_pcie_remove(struct platform_device *pdev)struct rockchip_pcie *rockchip =dev_get_drvdata (dev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (rockchip); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();irq_domain_remove (rockchip->irq_domain);rockchip_pcie_deinit_phys (rockchip);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 229/1193 fuse: set ff->flock only on success
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Tianci <[email protected]>
[ Upstream commit 71947173cef279be5eed209ec28f8c11f9d73159 ]
If FUSE_SETLK fails (e.g., due to EWOULDBLOCK), we shall not set FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release().
--- fs/fuse/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c +2 -1
@@ -2680,8 +2680,9 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)struct fuse_file *ff = file->private_data;/* emulate flock with POSIX locks */ - ff->flock = true; err =fuse_setlk (file, fl,1 ); +if (!err) + ff->flock = true; }return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 247/1193 PCI: mediatek: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a29812a55da8d0dbeb071b26ac428c338e3fc389 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-mediatek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-mediatek.c +2 -0
@@ -1174,8 +1174,10 @@ static void mtk_pcie_remove(struct platform_device *pdev)struct mtk_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();mtk_pcie_free_resources (pcie);mtk_pcie_irq_teardown (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 248/1193 md/raid5: account discard IO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 74ddbf98e2db646ec58f7e7731c936b7a4a470fe ]
Raid5 handles discard bios internally through make_discard_request() and never passes them through md_account_bio(). As a result, discard IO is missing the md-device iostat accounting that normal raid5 IO and discard IO in other raid levels get from md_account_bio().
Before accounting the bio, trim the request to the full data stripes that raid5 will actually discard. The first full stripe is the ceiling of the bio start divided by data-stripe sectors, and the last full stripe is the floor of the bio end divided by data-stripe sectors. Account that exact MD logical full-stripe range, then restore the original iterator so bio completion and iostat still cover the original request.
--- drivers/md/raid5.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/md/raid5.c +23 -10
@@ -5741,7 +5741,10 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) {struct r5conf *conf = mddev->private;sector_t logical_sector, last_sector; +sector_t first_stripe, last_stripe;struct stripe_head *sh; +struct bvec_iter bi_iter; +struct bio *orig_bi = bi;int stripe_sectors;/* We need to handle this when io_uring supports discard/trim */
@@ -5752,19 +5755,29 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi)/* Skip discard while reshape is happening */ return ; - logical_sector = bi->bi_iter.bi_sector & ~((sector_t )RAID5_STRIPE_SECTORS (conf)-1 ); - last_sector =bio_end_sector (bi); - - bi->bi_next =NULL ; - stripe_sectors = conf->chunk_sectors * (conf->raid_disks - conf->max_degraded); - logical_sector =DIV_ROUND_UP_SECTOR_T (logical_sector, - stripe_sectors); -sector_div (last_sector, stripe_sectors); + first_stripe =DIV_ROUND_UP_SECTOR_T (bi->bi_iter.bi_sector, + stripe_sectors); + last_stripe =bio_end_sector (bi); +sector_div (last_stripe, stripe_sectors); + +if (first_stripe >= last_stripe) { +bio_endio (bi); +return ; + } + + bi_iter = bi->bi_iter; + bi->bi_iter.bi_sector = first_stripe * stripe_sectors; + bi->bi_iter.bi_size = ((last_stripe - first_stripe) * + stripe_sectors) <<9 ; +md_account_bio (mddev, &bi); + orig_bi->bi_iter = bi_iter; + bi->bi_iter = bi_iter; + bi->bi_next =NULL ; - logical_sector *= conf->chunk_sectors; - last_sector *= conf->chunk_sectors; + logical_sector = first_stripe * conf->chunk_sectors; + last_sector = last_stripe * conf->chunk_sectors;for (; logical_sector < last_sector; logical_sector +=RAID5_STRIPE_SECTORS (conf)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 249/1193 md/raid5: let stripe batch bm_seq comparison wrap-safe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <[email protected]>
[ Upstream commit 00e93faf4cea9e8802ac5dfee0952d84fc95c40f ]
Once the 32-bit seq wraps, a newer bm_seq can look smaller than old, so .. covert to wrap-safe calculate way.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -991,7 +991,7 @@ static void stripe_add_to_batch_list(struct r5conf *conf,if (test_and_clear_bit (STRIPE_BIT_DELAY , &sh->state)) {int seq = sh->bm_seq;if (test_bit (STRIPE_BIT_DELAY , &sh->batch_head->state) && - sh->batch_head->bm_seq > seq) + sh->batch_head->bm_seq - seq >0 ) seq = sh->batch_head->bm_seq;set_bit (STRIPE_BIT_DELAY , &sh->batch_head->state); sh->batch_head->bm_seq = seq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 250/1193 f2fs: validate inline dentry name lengths before conversion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit cfcd0e49a178b3dac2c0ece656079081dbf5da74 ]
Inline dentry conversion copies names out of the inline dentry area before checking that each recorded name length fits in the available filename slots.
A corrupted image can therefore make the conversion path read past the inline filename storage while building the regular dentry block.
Validate each inline dentry name length against the inline filename area before copying it.
--- fs/f2fs/inline.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/f2fs/inline.c +7 -0
@@ -507,6 +507,12 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos++;continue ; } +if (unlikely (le16_to_cpu (de->name_len) >F2FS_NAME_LEN || + bit_pos +GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)) > + d.max)) { + err = -EFSCORRUPTED ; + goto punch_dentry_pages; + }/* * We only need the disk_name and hash to move the dentry.
@@ -527,6 +533,7 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos +=GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)); }return 0 ; + punch_dentry_pages:truncate_inode_pages (&dir->i_data,0 );f2fs_truncate_blocks (dir,0 , false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 251/1193 rtc: aspeed: add AST2700 compatible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tommy Huang <[email protected]>
[ Upstream commit 3319cfeeb8c4047026f84df045c438f7bbd338a6 ]
Add support for matching the RTC controller on ASPEED AST2700 SoCs.
The AST2700 RTC controller is compatible with the existing ASPEED RTC driver implementation.
--- drivers/rtc/rtc-aspeed.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-aspeed.c +1 -0
@@ -111,6 +111,7 @@ static const struct of_device_id aspeed_rtc_match[] = { { .compatible = "aspeed,ast2400-rtc", }, { .compatible = "aspeed,ast2500-rtc", }, { .compatible = "aspeed,ast2600-rtc", }, + { .compatible = "aspeed,ast2700-rtc", }, {} }; MODULE_DEVICE_TABLE(of, aspeed_rtc_match);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 252/1193 ksmbd: fix lease break and ack state handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 5015191096db311759fef98769270336cd8b1324 ]
Do not skip valid lease states containing WRITE_CACHING when breaking level-II/read leases for writes and truncates.
Handle lease break acknowledgments according to the SMB2 rule that the acknowledged state must be a subset of the server's break target. Apply the acknowledged state directly and keep the break pending on failed ACKs.
--- fs/smb/server/oplock.c | 24 +++------ fs/smb/server/smb2pdu.c | 106 ++++++++++------------------------------ 2 files changed, 34 insertions(+), 96 deletions(-)
fs/smb/server/oplock.c +8 -16
@@ -1485,14 +1485,8 @@ void smb_break_all_levII_oplock(struct ksmbd_work *work, struct ksmbd_file *fp,continue ; } -if (brk_op->is_lease && (brk_op->o_lease->state & - (~(SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_HANDLE_CACHING_LE )))) { -ksmbd_debug (OPLOCK ,"unexpected lease state(0x%x)\n" , - brk_op->o_lease->state); - goto next; - }else if (brk_op->level != -SMB2_OPLOCK_LEVEL_II ) { +if (!brk_op->is_lease && + brk_op->level !=SMB2_OPLOCK_LEVEL_II ) {ksmbd_debug (OPLOCK ,"unexpected oplock(0x%x)\n" , brk_op->level); goto next;
@@ -1553,15 +1547,13 @@ void smb_break_all_oplock(struct ksmbd_work *work, struct ksmbd_file *fp)*/ __u8 smb2_map_lease_to_oplock (__le32 lease_state) { -if (lease_state == (SMB2_LEASE_HANDLE_CACHING_LE | -SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_WRITE_CACHING_LE )) { +if ((lease_state &SMB2_LEASE_WRITE_CACHING_LE ) && + (lease_state &SMB2_LEASE_HANDLE_CACHING_LE )) {return SMB2_OPLOCK_LEVEL_BATCH ; - }else if (lease_state !=SMB2_LEASE_WRITE_CACHING_LE && - lease_state &SMB2_LEASE_WRITE_CACHING_LE ) { -if (!(lease_state &SMB2_LEASE_HANDLE_CACHING_LE )) -return SMB2_OPLOCK_LEVEL_EXCLUSIVE ; - }else if (lease_state &SMB2_LEASE_READ_CACHING_LE ) { + }else if (lease_state &SMB2_LEASE_WRITE_CACHING_LE ) { +return SMB2_OPLOCK_LEVEL_EXCLUSIVE ; + }else if (lease_state & (SMB2_LEASE_READ_CACHING_LE | +SMB2_LEASE_HANDLE_CACHING_LE )) {return SMB2_OPLOCK_LEVEL_II ; }return 0 ;
fs/smb/server/smb2pdu.c +26 -80
147 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 253/1193 ksmbd: validate SMB2 lease create contexts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit b69be2c58615950ee7353b61a21acdf8508c0cbb ]
Validate SMB2 lease context lengths, requested lease state bits, and v2 flags before using the context. Return errors via ERR_PTR so CREATE can distinguish a missing lease context from a malformed one.
Also ignore lease v2 contexts for SMB 2.1, where they are not valid.
--- fs/smb/server/oplock.c | 33 ++++++++++++++++++++++++++++----- fs/smb/server/smb2pdu.c | 24 +++++++++++++++++++++++- 2 files changed, 51 insertions(+), 6 deletions(-)
fs/smb/server/oplock.c +28 -5
@@ -5,6 +5,7 @@*/ #include <linux/moduleparam.h> +#include <linux/err.h> #include "glob.h" #include "oplock.h"
@@ -19,6 +20,20 @@static LIST_HEAD (lease_table_list);static DEFINE_RWLOCK (lease_list_lock); +#define SMB2_LEASE_STATE_MASK_LE (SMB2_LEASE_READ_CACHING_LE | \ + SMB2_LEASE_HANDLE_CACHING_LE | \ + SMB2_LEASE_WRITE_CACHING_LE) + +static bool lease_state_valid (__le32 state) +{ +return !(state & ~SMB2_LEASE_STATE_MASK_LE ); +} + +static bool lease_v2_flags_valid (__le32 flags) +{ +return !(flags & ~SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE ); +} +/** * alloc_opinfo() - allocate a new opinfo object for oplock info * @work: smb work
@@ -1621,12 +1636,14 @@ struct lease_ctx_info *parse_lease_state(void *open_req)struct lease_ctx_info *lreq; cc =smb2_find_context_vals (req,SMB2_CREATE_REQUEST_LEASE ,4 ); -if (IS_ERR_OR_NULL (cc)) +if (IS_ERR (cc)) +return ERR_CAST (cc); +if (!cc)return NULL ; lreq =kzalloc (sizeof (struct lease_ctx_info ),GFP_KERNEL );if (!lreq) -return NULL ; +return ERR_PTR (-ENOMEM );if (sizeof (struct lease_context_v2 ) ==le32_to_cpu (cc->DataLength)) {struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
@@ -1640,11 +1657,14 @@ struct lease_ctx_info *parse_lease_state(void *open_req) lreq->flags = lc->lcontext.LeaseFlags; lreq->epoch = lc->lcontext.Epoch; lreq->duration = lc->lcontext.LeaseDuration; +if (!lease_state_valid (lreq->req_state) || + !lease_v2_flags_valid (lreq->flags)) + goto err_out;if (lreq->flags ==SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE )memcpy (lreq->parent_lease_key, lc->lcontext.ParentLeaseKey,SMB2_LEASE_KEY_SIZE ); lreq->version =2 ; - }else { + }else if (sizeof (struct lease_context ) ==le32_to_cpu (cc->DataLength)) {struct create_lease *lc = (struct create_lease *)cc; if (le16_to_cpu(cc->DataOffset) + le32_to_cpu(cc->DataLength) <
@@ -1655,12 +1675,15 @@ struct lease_ctx_info *parse_lease_state(void *open_req) lreq->req_state = lc->lcontext.LeaseState; lreq->flags = lc->lcontext.LeaseFlags; lreq->duration = lc->lcontext.LeaseDuration; +if (!lease_state_valid (lreq->req_state)) + goto err_out; lreq->version =1 ; - } + }else + goto err_out;return lreq; err_out:kfree (lreq); -return NULL ; +return ERR_PTR (-EINVAL ); }/**
fs/smb/server/smb2pdu.c +23 -1
@@ -2986,6 +2986,17 @@ int smb2_open(struct ksmbd_work *work)if (server_conf.flags &KSMBD_GLOBAL_FLAG_DURABLE_HANDLE && req->CreateContextsOffset) { lc =parse_lease_state (req); +if (IS_ERR (lc)) { + rc =PTR_ERR (lc); + lc =NULL ; + goto err_out2; + } +if (lc && lc->version ==2 && conn->dialect <SMB30_PROT_ID ) { +kfree (lc); + lc =NULL ; +if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) + req_op_level =SMB2_OPLOCK_LEVEL_NONE ; + } rc =parse_durable_handle_context (work, req, lc, &dh_info);if (rc) {ksmbd_debug (SMB ,"error parsing durable handle context\n" );
@@ -3017,8 +3028,19 @@ int smb2_open(struct ksmbd_work *work) goto reconnected_fp; } - }else if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) + }else if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) { lc =parse_lease_state (req); +if (IS_ERR (lc)) { + rc =PTR_ERR (lc); + lc =NULL ; + goto err_out2; + } +if (lc && lc->version ==2 && conn->dialect <SMB30_PROT_ID ) { +kfree (lc); + lc =NULL ; + req_op_level =SMB2_OPLOCK_LEVEL_NONE ; + } + }if (le32_to_cpu (req->ImpersonationLevel) >le32_to_cpu (IL_DELEGATE )) { pr_err("Invalid impersonationlevel : 0x%x\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 254/1193 ksmbd: align SMB2 oplock break ack handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 80a56d4a826c6c84430286fcf7d8655f7c5b0868 ]
Handle SMB2 oplock break acknowledgments according to the server-side validation rules in MS-SMB2.
Return STATUS_INVALID_DEVICE_STATE when an ACK arrives while the open is not breaking, reject SMB2_OPLOCK_LEVEL_LEASE with STATUS_INVALID_PARAMETER, allow BATCH acknowledgments to EXCLUSIVE, and make invalid ACK levels fail with STATUS_INVALID_OPLOCK_PROTOCOL after lowering the oplock to NONE.
Update the successful response from the final granted oplock level instead of relying on the oplock transition helpers, which could turn invalid ACKs into successful responses.
--- fs/smb/server/smb2pdu.c | 104 ++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 58 deletions(-)
fs/smb/server/smb2pdu.c +46 -58
@@ -8652,11 +8652,10 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)struct smb2_oplock_break *rsp;struct ksmbd_file *fp;struct oplock_info *opinfo =NULL ; -__le32 err =0 ; -int ret =0 ; +__le32 status =STATUS_SUCCESS ; +int ret;u64 volatile_id, persistent_id;char req_oplevel =0 , rsp_oplevel =0 ; -unsigned int oplock_change_type;WORK_BUFFERS (work, req, rsp);
@@ -8682,71 +8681,55 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)return ; } -if (opinfo->level ==SMB2_OPLOCK_LEVEL_NONE ) { - rsp->hdr.Status =STATUS_INVALID_OPLOCK_PROTOCOL ; +if (opinfo->op_state !=OPLOCK_ACK_WAIT ) { +ksmbd_debug (SMB ,"unexpected oplock state 0x%x\n" , + opinfo->op_state); + status =STATUS_INVALID_DEVICE_STATE ; goto err_out; } -if (opinfo->op_state ==OPLOCK_STATE_NONE ) { -ksmbd_debug (SMB ,"unexpected oplock state 0x%x\n" , opinfo->op_state); - rsp->hdr.Status =STATUS_UNSUCCESSFUL ; +if (req_oplevel ==SMB2_OPLOCK_LEVEL_LEASE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_PARAMETER ; goto err_out; } -if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - (req_oplevel !=SMB2_OPLOCK_LEVEL_II && - req_oplevel !=SMB2_OPLOCK_LEVEL_NONE )) { - err =STATUS_INVALID_OPLOCK_PROTOCOL ; - oplock_change_type =OPLOCK_WRITE_TO_NONE ; - }else if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && - req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { - err =STATUS_INVALID_OPLOCK_PROTOCOL ; - oplock_change_type =OPLOCK_READ_TO_NONE ; - }else if (req_oplevel ==SMB2_OPLOCK_LEVEL_II || - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - err =STATUS_INVALID_DEVICE_STATE ; -if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - req_oplevel ==SMB2_OPLOCK_LEVEL_II ) { - oplock_change_type =OPLOCK_WRITE_TO_READ ; - }else if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - oplock_change_type =OPLOCK_WRITE_TO_NONE ; - }else if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - oplock_change_type =OPLOCK_READ_TO_NONE ; - }else { - oplock_change_type =0 ; - } - }else { - oplock_change_type =0 ; +if (opinfo->level ==SMB2_OPLOCK_LEVEL_NONE ) { + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; } -switch (oplock_change_type) { -case OPLOCK_WRITE_TO_READ : - ret =opinfo_write_to_read (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_II ; -break ; -case OPLOCK_WRITE_TO_NONE : - ret =opinfo_write_to_none (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; -break ; -case OPLOCK_READ_TO_NONE : - ret =opinfo_read_to_none (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; -break ; -default : -pr_err ("unknown oplock change 0x%x -> 0x%x\n" , - opinfo->level, rsp_oplevel); +if (opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE && + req_oplevel !=SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; } -if (ret <0 ) { - rsp->hdr.Status = err; +if (opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH && + req_oplevel !=SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE && + req_oplevel !=SMB2_OPLOCK_LEVEL_EXCLUSIVE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; + } + +if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; goto err_out; } +if (req_oplevel ==SMB2_OPLOCK_LEVEL_EXCLUSIVE ) + rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; +else + rsp_oplevel = req_oplevel; + + opinfo->level = rsp_oplevel; + rsp->StructureSize =cpu_to_le16 (24 ); rsp->OplockLevel = rsp_oplevel; rsp->Reserved =0 ;
@@ -8754,11 +8737,16 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work) rsp->VolatileFid = volatile_id; rsp->PersistentFid = persistent_id; ret =ksmbd_iov_pin_rsp (work, rsp,sizeof (struct smb2_oplock_break )); -if (ret) { +if (ret) +ksmbd_debug (SMB ,"failed to pin oplock break response: %d\n" , + ret); + goto out; + err_out: -smb2_set_err_rsp (work); - } + rsp->hdr.Status = status; +smb2_set_err_rsp (work); +out: opinfo->op_state =OPLOCK_STATE_NONE ;wake_up_interruptible_all (&opinfo->oplock_q);opinfo_put (opinfo);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 255/1193 ksmbd: use connection ClientGUID for lease lookup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit fa111daae1a02dbff5693dfc12f368bccd9eb5f4 ]
MS-SMB2 defines the lease table lookup key as Connection.ClientGuid. Use the connection ClientGUID consistently when checking for same-client leases and duplicate lease keys.
Also preserve directory and parent lease metadata when copying an existing lease state to a new open.
--- fs/smb/server/oplock.c | 16 +++++++++------- fs/smb/server/oplock.h | 2 +- fs/smb/server/smb2pdu.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-)
fs/smb/server/oplock.c +9 -7
@@ -520,7 +520,7 @@ static inline int compare_guid_key(struct oplock_info *opinfo,* Return: oplock(lease) object on success, otherwise NULL */ static struct oplock_info *same_client_has_lease (struct ksmbd_inode *ci, -char *client_guid, +const char *client_guid,struct lease_ctx_info *lctx) {int ret;
@@ -1088,7 +1088,7 @@ void destroy_lease_table(struct ksmbd_conn *conn)write_unlock (&lease_list_lock); } -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx) {struct oplock_info *opinfo;
@@ -1105,7 +1105,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci, }list_for_each_entry (lb, &lease_table_list, l_entry) { -if (!memcmp (lb->client_guid, sess->ClientGUID, +if (!memcmp (lb->client_guid, conn->ClientGUID,SMB2_CLIENT_GUID_SIZE )) goto found; }
@@ -1121,7 +1121,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,rcu_read_unlock ();if (opinfo->o_fp->f_ci == ci) goto op_next; - err =compare_guid_key (opinfo, sess->ClientGUID, + err =compare_guid_key (opinfo, conn->ClientGUID, lctx->lease_key);if (err) { err = -EINVAL ;
@@ -1154,6 +1154,9 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2) lease2->flags = lease1->flags; lease2->epoch = lease1->epoch; lease2->version = lease1->version; + lease2->is_dir = lease1->is_dir; +memcpy (lease2->parent_lease_key, lease1->parent_lease_key, +SMB2_LEASE_KEY_SIZE ); } static void add_lease_global_list(struct oplock_info *opinfo,
@@ -1298,7 +1301,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid, struct ksmbd_file *fp, __u16 tid, struct lease_ctx_info *lctx, int share_ret) { - struct ksmbd_session *sess = work->sess; int err = 0;struct oplock_info *opinfo =NULL , *prev_opinfo =NULL ;struct ksmbd_inode *ci = fp->f_ci;
@@ -1341,12 +1343,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,struct oplock_info *m_opinfo;/* is lease already granted ? */ - m_opinfo =same_client_has_lease (ci, sess->ClientGUID, + m_opinfo =same_client_has_lease (ci, work->conn->ClientGUID, lctx);if (m_opinfo) {copy_lease (m_opinfo, opinfo);if (atomic_read (&m_opinfo->breaking_cnt)) - opinfo->o_lease->flags = + opinfo->o_lease->flags |=SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE ;opinfo_put (m_opinfo); goto out;
fs/smb/server/oplock.h +1 -1
@@ -123,7 +123,7 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp);struct create_context *smb2_find_context_vals (void *open_req,const char *tag,int tag_len);struct oplock_info *lookup_lease_in_table (struct ksmbd_conn *conn,char *lease_key); -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx);void destroy_lease_table (struct ksmbd_conn *conn); void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
fs/smb/server/smb2pdu.c +1 -1
@@ -3514,7 +3514,7 @@ int smb2_open(struct ksmbd_work *work)ksmbd_debug (SMB ,"lease req for(%s) req oplock state 0x%x, lease state 0x%x\n" , name, req_op_level, lc->req_state); - rc =find_same_lease_key (sess, fp->f_ci, lc); + rc =find_same_lease_key (conn, fp->f_ci, lc);if (rc) goto err_out1; } else if (open_flags == O_RDONLY &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 256/1193 ksmbd: treat unnamed DATA stream as base file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 171b5d72dd80f99271c073c6e38d5263687c3b6d ]
The SMB path suffix :: names the unnamed data stream of the base file, not an alternate data stream backed by a DosStream xattr.
Canonicalize an empty stream name with an explicit type to a NULL stream name after parsing. This keeps the base filename produced by strsep() and lets open continue through the normal base-file path instead of looking for a non-existent empty stream xattr.
--- fs/smb/server/misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/smb/server/misc.c +11 -3
@@ -121,7 +121,9 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)char *stream_type;char *s_name;int rc =0 ; +bool has_stream_type = false; + *stream_name =NULL ; s_name = filename; filename =strsep (&s_name,":" );ksmbd_debug (SMB ,"filename : %s, streams : %s\n" , filename, s_name);
@@ -137,14 +139,20 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)ksmbd_debug (SMB ,"stream name : %s, stream type : %s\n" , s_name, stream_type); -if (!strncasecmp ("$data" , stream_type,5 )) +if (!strncasecmp ("$data" , stream_type,5 )) { *s_type =DATA_STREAM ; -else if (!strncasecmp ("$index_allocation" , stream_type,17 )) + has_stream_type = true; + }else if (!strncasecmp ("$index_allocation" , stream_type,17 )) { *s_type =DIR_STREAM ; -else + has_stream_type = true; + }else { rc = -ENOENT ; + } } +if (has_stream_type && !s_name[0 ] && *s_type ==DATA_STREAM ) + goto out; + *stream_name = s_name; out:return rc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 230/1193 scsi: bfa: Reduce kernel stack usage in bfa_fcs_lport_fdmi_build_portattr_block()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 57a6ed0b41677ccc5e28cc0976e495c1dfa33747 ]
bfa_fcs_fdmi_get_portattr() gets inlined into multiple places and has two fairly large variables on the stack, to the point of causing a warning in some randconfig builds:
drivers/scsi/bfa/bfa_fcs_lport.c:2198:1: error: stack frame size (1560) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_portattr_block' [-Werror,-Wframe-larger-than]
2198 | bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
| ^
drivers/scsi/bfa/bfa_fcs_lport.c:1856:1: error: stack frame size (1600) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_rhba_pyld' [-Werror,-Wframe-larger-than]
1856 | bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
| ^Mark the inner function as noinline_for_stack to keep it separate from the other variables and prevent multiple copies of the same variable to get inlined here.
--- drivers/scsi/bfa/bfa_fcs_lport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bfa/bfa_fcs_lport.c +1 -1
@@ -2673,7 +2673,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, } -static void +static noinline_for_stack voidbfa_fcs_fdmi_get_portattr (struct bfa_fcs_lport_fdmi_s *fdmi,struct bfa_fcs_fdmi_port_attr_s *port_attr) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 257/1193 ksmbd: apply create security descriptor first
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit ba3cf6ee4f0eacc1f8c607b80188e3b32ef5e0e3 ]
smb2.create.aclfile creates files with an SMB2_CREATE_SD_BUFFER create context and expects the resulting security descriptor to match the descriptor supplied by the client.
ksmbd currently tries to inherit the parent DACL first and only parses the SMB2_CREATE_SD_BUFFER context when DACL inheritance fails. If inheritance succeeds, the explicit security descriptor supplied on create is ignored. This breaks create requests that include owner/group information in the security descriptor.
Apply the create security descriptor first when the context is present. Fall back to the existing inherited/default ACL path only when no create security descriptor was supplied.
--- fs/smb/server/smb2pdu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
fs/smb/server/smb2pdu.c +9 -7
@@ -3383,14 +3383,16 @@ int smb2_open(struct ksmbd_work *work)if (posix_acl_rc)ksmbd_debug (SMB ,"inherit posix acl failed : %d\n" , posix_acl_rc); -if (test_share_config_flag (work->tcon->share_conf, -KSMBD_SHARE_FLAG_ACL_XATTR )) { - rc =smb_inherit_dacl (conn, &path, sess->user->uid, - sess->user->gid); - } + rc =smb2_create_sd_buffer (work, req, &path); +if (rc && rc != -ENOENT ) + goto err_out; -if (rc) { - rc =smb2_create_sd_buffer (work, req, &path); +if (rc == -ENOENT ) { +if (test_share_config_flag (work->tcon->share_conf, +KSMBD_SHARE_FLAG_ACL_XATTR )) { + rc =smb_inherit_dacl (conn, &path, sess->user->uid, + sess->user->gid); + }if (rc) {if (posix_acl_rc) ksmbd_vfs_set_init_posix_acl(idmap,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 258/1193 ksmbd: deny renaming directory with open children
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit c841bd3d8dec33a000d6e31b7e7fafb22c39e4e9 ]
Windows denies renaming a directory while a file below that directory is still open. smb2.rename.rename_dir_openfile checks this by keeping a file handle open under the directory and then attempting to rename the directory handle. ksmbd did not check open children before calling vfs_rename(), so the rename incorrectly succeeded.
For non-POSIX clients, scan the global open file table for active handles whose dentries are below the directory being renamed. If any child is open, fail the rename with -EACCES so the client receives STATUS_ACCESS_DENIED.
--- fs/smb/server/vfs.c | 6 ++++++ fs/smb/server/vfs_cache.c | 25 +++++++++++++++++++++++++ fs/smb/server/vfs_cache.h | 1 + 3 files changed, 32 insertions(+)
fs/smb/server/vfs.c +6 -0
@@ -734,6 +734,12 @@ int ksmbd_vfs_rename(struct ksmbd_work *work, const struct path *old_path, goto out3; } +if (!work->tcon->posix_extensions &&d_is_dir (old_child) && +ksmbd_has_open_files (old_child)) { + err = -EACCES ; + goto out3; + } + parent_fp =ksmbd_lookup_fd_inode (old_child->d_parent);if (parent_fp) {if (parent_fp->daccess &FILE_DELETE_LE ) {
fs/smb/server/vfs_cache.c +25 -0
@@ -10,6 +10,7 @@#include <linux/vmalloc.h> #include <linux/kthread.h> #include <linux/freezer.h> +#include <linux/dcache.h> #include "glob.h" #include "vfs_cache.h"
@@ -649,6 +650,30 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct dentry *dentry)return NULL ; } +bool ksmbd_has_open_files (struct dentry *dentry) +{ +struct ksmbd_file *fp; +unsigned int id; +bool ret = false; + +read_lock (&global_ft.lock); +idr_for_each_entry (global_ft.idr, fp, id) { +struct dentry *fp_dentry = fp->filp->f_path.dentry; + +if (fp->f_state !=FP_INITED ) +continue ; +if (fp_dentry == dentry) +continue ; +if (is_subdir (fp_dentry, dentry)) { + ret = true; +break ; + } + } +read_unlock (&global_ft.lock); + +return ret; +} +#define OPEN_ID_TYPE_VOLATILE_ID (0)#define OPEN_ID_TYPE_PERSISTENT_ID (1)
fs/smb/server/vfs_cache.h +1 -0
@@ -162,6 +162,7 @@ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id);void ksmbd_put_durable_fd (struct ksmbd_file *fp);struct ksmbd_file *ksmbd_lookup_fd_cguid (char *cguid);struct ksmbd_file *ksmbd_lookup_fd_inode (struct dentry *dentry); +bool ksmbd_has_open_files (struct dentry *dentry);unsigned int ksmbd_open_durable_fd (struct ksmbd_file *fp);struct ksmbd_file *ksmbd_open_fd (struct ksmbd_work *work,struct file *filp);void ksmbd_launch_ksmbd_durable_scavenger (void );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 259/1193 ksmbd: start file id allocation at 1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 6b375be0b4e1be89e9a817880515311503a19114 ]
ksmbd allocates both the volatile id (per-session file table) and the persistent id (global file table) with idr_alloc_cyclic() starting at 0. The first open after the module loads therefore gets volatile id 0 and persistent id 0, and ksmbd returns an SMB2 FileId of {0, 0} in the create response.
Clients treat an all-zero FileId as a null handle. smbtorture's smb2_util_handle_empty() considers {0, 0} empty, so tests that guard the close with it (e.g. smb2.oplock.statopen1, smb2.lease.statopen*) never close that first handle. The leaked open keeps the inode's oplock count non-zero, so a later batch oplock request on the same file is downgraded to level II and the test fails.
Start the id allocation at 1 (KSMBD_START_FID) so no handle is ever assigned a {0, 0} FileId, matching the behaviour of other SMB servers.
--- fs/smb/server/vfs_cache.c | 3 ++- fs/smb/server/vfs_cache.h | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
fs/smb/server/vfs_cache.c +2 -1
@@ -698,7 +698,8 @@ static int __open_id(struct ksmbd_file_table *ft, struct ksmbd_file *fp,idr_preload (GFP_KERNEL );write_lock (&ft->lock); - ret =idr_alloc_cyclic (ft->idr, fp,0 ,INT_MAX -1 ,GFP_NOWAIT ); + ret =idr_alloc_cyclic (ft->idr, fp,KSMBD_START_FID ,INT_MAX -1 , +GFP_NOWAIT );if (ret >=0 ) { id = ret; ret =0 ;
fs/smb/server/vfs_cache.h +6 -1
@@ -23,7 +23,12 @@#define FILE_GENERIC_WRITE 0x120116#define FILE_GENERIC_EXECUTE 0X1200a0 -#define KSMBD_START_FID 0 +/* +* Start volatile/persistent file id allocation at 1. A file id of 0 yields an +* SMB2 FileId of {0, 0}, which clients (e.g. Windows, Samba) treat as a null +* handle and never close, leaking the open on the server. +*/ +#define KSMBD_START_FID 1#define KSMBD_NO_FID (INT_MAX)#define SMB2_NO_FID (0xFFFFFFFFFFFFFFFFULL)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 260/1193 ksmbd: break RH leases before delete-on-close
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 1f1083c36fa11c5d9011451c7b9ab380545c72ea ]
The delete paths only marked the opened file delete pending or delete-on-close. When another client still held a read/handle lease, no lease break was sent before the delete state changed.
smb2.lease.unlink uses a create request with FILE_DELETE_ON_CLOSE and expects the second client's unlink to break the first client's RH lease to R with ACK_REQUIRED set. SetInfo(FileDispositionInformation) has the same lease-breaking requirement.
Break level-II/read-handle leases before setting delete pending or delete-on-close so clients are notified before the file is removed.
--- fs/smb/server/smb2pdu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/smb/server/smb2pdu.c +7 -3
@@ -3532,8 +3532,10 @@ int smb2_open(struct ksmbd_work *work) goto err_out1; } -if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE ) +if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE ) { +smb_break_all_levII_oplock (work, fp,0 );ksmbd_fd_set_delete_on_close (fp, file_info); + }if (need_truncate) { rc =smb2_create_truncate (&fp->filp->f_path);
@@ -6427,7 +6429,8 @@ static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,return smb2_rename (work, fp, rename_info, work->conn->local_nls); } -static int set_file_disposition_info (struct ksmbd_file *fp, +static int set_file_disposition_info (struct ksmbd_work *work, +struct ksmbd_file *fp,struct smb2_file_disposition_info *file_info) {struct inode *inode;
@@ -6442,6 +6445,7 @@ static int set_file_disposition_info(struct ksmbd_file *fp,if (S_ISDIR (inode->i_mode) &&ksmbd_vfs_empty_dir (fp) == -ENOTEMPTY )return -EBUSY ; +smb_break_all_levII_oplock (work, fp,0 );ksmbd_set_inode_pending_delete (fp); }else {ksmbd_clear_inode_pending_delete (fp);
@@ -6565,7 +6569,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,if (buf_len <sizeof (struct smb2_file_disposition_info ))return -EINVAL ; -return set_file_disposition_info (fp, +return set_file_disposition_info (work, fp, (struct smb2_file_disposition_info *)buffer); }case FILE_FULL_EA_INFORMATION :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 261/1193 ksmbd: treat read-control opens as stat opens only for leases
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit be939e11c4724d1de3650e8bafd4c3583d9684b2 ]
A second open that requests only metadata-level access must not break the existing caching state. ksmbd already skips the break for such opens via fp->attrib_only (FILE_READ_ATTRIBUTES, FILE_WRITE_ATTRIBUTES and FILE_SYNCHRONIZE).
An open requesting only READ_CONTROL (reading the security descriptor) must be treated differently depending on the existing caching state. smbtorture smb2.lease.statopen4 expects a read-control open NOT to break a caching lease, while smb2.oplock.statopen1 expects the same open to break a batch oplock. So READ_CONTROL is a stat open for leases but not for oplocks.
Extend the stat-open break-skip in smb_grant_oplock() to also cover a read-control-only open, but only when the existing holder is a lease. The global fp->attrib_only flag (used for share-mode, rename and truncate decisions) is left unchanged so oplock behaviour is preserved.
--- fs/smb/server/oplock.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
fs/smb/server/oplock.c +27 -3
@@ -208,6 +208,18 @@ void opinfo_put(struct oplock_info *opinfo)free_opinfo (opinfo); } +static bool ksmbd_inode_has_lease (struct ksmbd_inode *ci) +{ +struct oplock_info *opinfo =opinfo_get_list (ci); +bool is_lease; + +if (!opinfo) +return false; + is_lease = opinfo->is_lease; +opinfo_put (opinfo); +return is_lease; +} +static void opinfo_add (struct oplock_info *opinfo,struct ksmbd_file *fp) {struct ksmbd_inode *ci = fp->f_ci;
@@ -1331,10 +1343,22 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,if (!opinfo_count (fp)) goto set_lev; -/* grant none-oplock if second open is trunc */ -if (fp->attrib_only && fp->cdoption !=FILE_OVERWRITE_IF_LE && +/* +* A stat open that only requests metadata access must not break the +* existing caching state. READ_CONTROL (reading the security +* descriptor) does not conflict with a lease, but it does conflict +* with an oplock, so only treat a read-control-only open as a stat +* open when the existing holder is a lease. +*/ +if (fp->cdoption !=FILE_OVERWRITE_IF_LE && fp->cdoption !=FILE_OVERWRITE_LE && - fp->cdoption !=FILE_SUPERSEDE_LE ) { + fp->cdoption !=FILE_SUPERSEDE_LE && + (fp->attrib_only || + (!(fp->daccess & ~(FILE_READ_ATTRIBUTES_LE | +FILE_WRITE_ATTRIBUTES_LE | +FILE_SYNCHRONIZE_LE | +FILE_READ_CONTROL_LE )) && +ksmbd_inode_has_lease (ci)))) { req_op_level =SMB2_OPLOCK_LEVEL_NONE ; goto set_lev; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 262/1193 PCI/proc: Fix race between pci_proc_init() and pci_bus_add_device()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 8857f6578b001bcf5f53c8c6a3936647f05291a8 ]
pci_proc_attach_device() creates procfs entries for PCI devices and is called from pci_bus_add_device(). It lazily creates the per-bus procfs directory (bus->procdir) via proc_mkdir() on first use, and returns early if proc_initialized is not yet set.
On x86 with ACPI, PCI enumeration occurs at subsys_initcall, before pci_proc_init() sets proc_initialized at device_initcall. The for_each_pci_dev() loop in pci_proc_init() then creates procfs entries for these already-enumerated devices, but runs without holding pci_rescan_remove_lock.
On ARM64 with devicetree, PCI host bridges probe at device_initcall. With async probing enabled, pci_bus_add_device() can run concurrently with pci_proc_init(), and both may call pci_proc_attach_device() for the same device or for different devices on the same bus. As pci_host_probe() holds pci_rescan_remove_lock while pci_proc_init() does not, there is no serialisation between the two paths.
When two threads concurrently call pci_proc_attach_device() for devices on the same bus, both observe bus->procdir as NULL and both call proc_mkdir(). The proc filesystem serialises directory creation internally, so only one caller succeeds. The other results in a warning like:
proc_dir_entry '000c:00/00.0' already registered
The caller receives NULL (duplicate entry) and unconditionally stores it to bus->procdir, corrupting the valid pointer set by the first caller.
Serialise access to proc_initialized, proc_bus_pci_dir, bus->procdir and dev->procent with a new mutex local to drivers/pci/proc.c, and store the created entries to bus->procdir and dev->procent only on success, so a failed creation can never overwrite a valid pointer.
Additionally, wrap the for_each_pci_dev() loop in pci_proc_init() with pci_lock_rescan_remove() to serialise against concurrent PCI bus operations, add an early return in pci_proc_attach_device() when dev->procent is already set to make the function idempotent, and clear bus->procdir in pci_proc_detach_bus() to prevent use of a dangling pointer after proc_remove().
--- drivers/pci/proc.c | 79 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 23 deletions(-)
drivers/pci/proc.c +56 -23
@@ -20,6 +20,7 @@#include "pci.h" static int proc_initialized;/* = 0 */ +static DEFINE_MUTEX (pci_proc_lock);static loff_t proc_bus_pci_lseek (struct file *file,loff_t off,int whence) {
@@ -426,40 +427,64 @@ static const struct seq_operations proc_bus_pci_devices_op = {static struct proc_dir_entry *proc_bus_pci_dir; -int pci_proc_attach_device (struct pci_dev *dev) +static int __pci_proc_attach_bus (struct pci_bus *bus) { -struct pci_bus *bus = dev->bus; -struct proc_dir_entry *e; +struct proc_dir_entry *dir;char name[16 ]; +lockdep_assert_held (&pci_proc_lock); +if (!proc_initialized)return -EACCES ; -if (!bus->procdir) { -if (pci_proc_domain (bus)) { -sprintf (name,"%04x:%02x" ,pci_domain_nr (bus), - bus->number); - }else { -sprintf (name,"%02x" , bus->number); - } - bus->procdir =proc_mkdir (name, proc_bus_pci_dir); -if (!bus->procdir) -return -ENOMEM ; - } +if (bus->procdir) +return 0 ; + +if (pci_proc_domain (bus)) +sprintf (name,"%04x:%02x" ,pci_domain_nr (bus), bus->number); +else +sprintf (name,"%02x" , bus->number); + + dir =proc_mkdir (name, proc_bus_pci_dir); +if (!dir) +return -ENOMEM ; + + bus->procdir = dir; + +return 0 ; +} + +int pci_proc_attach_device (struct pci_dev *dev) +{ +struct pci_bus *bus = dev->bus; +struct proc_dir_entry *entry; +char name[16 ]; +int ret; + +guard (mutex)(&pci_proc_lock); + +if (dev->procent) +return 0 ; + + ret =__pci_proc_attach_bus (bus); +if (ret) +return ret;sprintf (name,"%02x.%x" ,PCI_SLOT (dev->devfn),PCI_FUNC (dev->devfn)); - e =proc_create_data (name,S_IFREG |S_IRUGO |S_IWUSR , bus->procdir, - &proc_bus_pci_ops, dev); -if (!e) + entry =proc_create_data (name,S_IFREG |S_IRUGO |S_IWUSR , + bus->procdir, &proc_bus_pci_ops, dev); +if (!entry)return -ENOMEM ; -proc_set_size (e, dev->cfg_size); - dev->procent = e; + +proc_set_size (entry, dev->cfg_size); + dev->procent = entry;return 0 ; }int pci_proc_detach_device (struct pci_dev *dev) { +guard (mutex)(&pci_proc_lock);proc_remove (dev->procent); dev->procent =NULL ;return 0 ;
@@ -467,19 +492,27 @@ int pci_proc_detach_device(struct pci_dev *dev)int pci_proc_detach_bus (struct pci_bus *bus) { +guard (mutex)(&pci_proc_lock);proc_remove (bus->procdir); + bus->procdir =NULL ;return 0 ; }static int __init pci_proc_init (void ) {struct pci_dev *dev =NULL ; - proc_bus_pci_dir =proc_mkdir ("bus/pci" ,NULL ); -proc_create_seq ("devices" ,0 , proc_bus_pci_dir, - &proc_bus_pci_devices_op); - proc_initialized =1 ; + + scoped_guard(mutex, &pci_proc_lock) { + proc_bus_pci_dir =proc_mkdir ("bus/pci" ,NULL ); +proc_create_seq ("devices" ,0 , proc_bus_pci_dir, + &proc_bus_pci_devices_op); + proc_initialized =1 ; + } + +pci_lock_rescan_remove ();for_each_pci_dev (dev)pci_proc_attach_device (dev); +pci_unlock_rescan_remove ();return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 263/1193 PCI/sysfs: Use kstrtobool() to parse the ROM attribute input
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 92742802ecbf215a2b60dcfd326d2213595010f1 ]
pci_write_rom() controls access to the ROM content through the corresponding sysfs attribute, and treats the input as a request to disable only when it matches the string "0\n" exactly:
if ((off == 0) && (*buf == '0') && (count == 2))
The count == 2 condition encodes the trailing newline that echo(1) appends. This was found when userspace wrote "0" without a trailing newline aiming to disable access, which failed to match the condition above and enabled access instead. For example:
$ echo 0 > rom # "0\n", count 2, access disabled $ echo -n 0 > rom # "0", count 1, access enabled $ echo > rom # "", count 1, access enabled (likely not desirable)
Parse the input with kstrtobool(), which handles common boolean inputs such as "0", "1", "n", "y" or "off", "on", with or without a trailing newline, so both of the above disable access, and update the now stale comment.
As a side effect, input that does not parse as a boolean is rejected with -EINVAL rather than enabling access. The documented "0" and "1" continue to work as before, and rejecting malformed input brings the attribute in line with how sysfs attributes typically handle it.
--- drivers/pci/pci-sysfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/pci-sysfs.c +6 -5
@@ -1309,18 +1309,19 @@ void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }* @off: file offset * @count: number of byte in input * -* writing anything except 0 enables it +* Writing a boolean value enables or disables the ROM display. */ static ssize_t pci_write_rom (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count) {struct pci_dev *pdev =to_pci_dev (kobj_to_dev (kobj)); +bool enable; -if ((off ==0 ) && (*buf =='0' ) && (count ==2 )) - pdev->rom_attr_enabled =0 ; -else - pdev->rom_attr_enabled =1 ; +if (kstrtobool (buf, &enable)) +return -EINVAL ; + + pdev->rom_attr_enabled = enable;return count; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 264/1193 regulator: da9121: Use subvariant ids in the I2C table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 7ddbf1cde4a03e36e17d06fbc711870eb0b256d7 ]
da9121_i2c_probe() stores i2c_get_match_data() in chip->subvariant_id and da9121_assign_chip_model() switches on DA9121_SUBTYPE_* values. The OF table provides those subvariant values, but the I2C id table currently provides DA9121_TYPE_* values.
Make the I2C id table use the same subvariant namespace as the OF table so non-DT I2C matches feed the expected data type into the model assignment code.
--- drivers/regulator/da9121-regulator.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/regulator/da9121-regulator.c +9 -9
@@ -1178,15 +1178,15 @@ static void da9121_i2c_remove(struct i2c_client *i2c) }static const struct i2c_device_id da9121_i2c_id[] = { - {"da9121" ,DA9121_TYPE_DA9121_DA9130 }, - {"da9130" ,DA9121_TYPE_DA9121_DA9130 }, - {"da9217" ,DA9121_TYPE_DA9217 }, - {"da9122" ,DA9121_TYPE_DA9122_DA9131 }, - {"da9131" ,DA9121_TYPE_DA9122_DA9131 }, - {"da9220" ,DA9121_TYPE_DA9220_DA9132 }, - {"da9132" ,DA9121_TYPE_DA9220_DA9132 }, - {"da9141" ,DA9121_TYPE_DA9141 }, - {"da9142" ,DA9121_TYPE_DA9142 }, + {"da9121" ,DA9121_SUBTYPE_DA9121 }, + {"da9130" ,DA9121_SUBTYPE_DA9130 }, + {"da9217" ,DA9121_SUBTYPE_DA9217 }, + {"da9122" ,DA9121_SUBTYPE_DA9122 }, + {"da9131" ,DA9121_SUBTYPE_DA9131 }, + {"da9220" ,DA9121_SUBTYPE_DA9220 }, + {"da9132" ,DA9121_SUBTYPE_DA9132 }, + {"da9141" ,DA9121_SUBTYPE_DA9141 }, + {"da9142" ,DA9121_SUBTYPE_DA9142 }, {}, };MODULE_DEVICE_TABLE (i2c, da9121_i2c_id);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 265/1193 net: au1000: move free_irq out of the close-time spinlocked section
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <[email protected]>
[ Upstream commit f48763beab4eea41fc480c9702ec6eebe8d75e4f ]
au1000_close() calls free_irq() while aup->lock is still held with spin_lock_irqsave(). free_irq() can sleep because it takes the IRQ descriptor request mutex, so it does not belong inside the close-time spinlocked section.
This was found by our static analysis tool and then confirmed by manual review of the in-tree au1000_close() .ndo_stop path. The reviewed path keeps aup->lock held across the MAC reset, queue stop and free_irq(dev->irq, dev).
A directed runtime validation kept that ndo_stop carrier and the same free_irq(dev->irq, dev) operation under the driver lock. Lockdep reported "BUG: sleeping function called from invalid context" and "Invalid wait context" while free_irq() was taking desc->request_mutex, with au1000_close() and free_irq() on the stack.
Drop aup->lock before freeing the IRQ. The protected close-time work still stops the device and queue before IRQ teardown, but the sleepable IRQ core path now runs outside the spinlocked section.
--- drivers/net/ethernet/amd/au1000_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +2 -1
@@ -943,9 +943,10 @@ static int au1000_close(struct net_device *dev)/* stop the device */ netif_stop_queue (dev); +spin_unlock_irqrestore (&aup->lock, flags); +/* disable the interrupt */ free_irq (dev->irq, dev); -spin_unlock_irqrestore (&aup->lock, flags);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 266/1193 blk-cgroup: protect iterating blkgs with blkcg->lock in blkcg_print_stat()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 25656304dabd26198ec69460c594a19d086ef099 ]
blkcg_print_one_stat() will be called for each blkg:
- access blkg->iostat, which is freed from rcu callback blkg_free_workfn();
- access policy data from pd_stat_fn(), which is freed from pd_free_fn(), while pd_free_fn() can be called by removing blkcg or deactivating policy;
Take blkcg->lock while iterating so the blkgs stay online and both blkg->iostat and policy data for activated policies stay valid. Use irq-safe locking because blkcg->lock can be nested under q->queue_lock, which is used from IRQ completion paths.
Prepare to convert protecting blkgs from request_queue with mutex.
--- block/blk-cgroup.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
block/blk-cgroup.c +3 -6
@@ -1201,13 +1201,10 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)else cgroup_rstat_flush (blkcg->css.cgroup); -rcu_read_lock (); -hlist_for_each_entry_rcu (blkg, &blkcg->blkg_list, blkcg_node) { -spin_lock_irq (&blkg->q->queue_lock); +guard (spinlock_irq)(&blkcg->lock); +hlist_for_each_entry (blkg, &blkcg->blkg_list, blkcg_node)blkcg_print_one_stat (blkg, sf); -spin_unlock_irq (&blkg->q->queue_lock); - } -rcu_read_unlock (); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 231/1193 gpio: pisosr: Read "ngpios" as u32
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 4910aa198d25e5d1067236560ba34ab12bccc677 ]
The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.
Read "ngpios" as u32 and keep the existing assignment to the chip field.
--- drivers/gpio/gpio-pisosr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pisosr.c +3 -1
@@ -125,6 +125,7 @@ static int pisosr_gpio_probe(struct spi_device *spi) {struct device *dev = &spi->dev;struct pisosr_gpio *gpio; +u32 ngpios;int ret; gpio =devm_kzalloc (dev,sizeof (*gpio),GFP_KERNEL );
@@ -133,7 +134,8 @@ static int pisosr_gpio_probe(struct spi_device *spi) gpio->chip = template_chip; gpio->chip.parent = dev; -of_property_read_u16 (dev->of_node,"ngpios" , &gpio->chip.ngpio); +if (!of_property_read_u32 (dev->of_node,"ngpios" , &ngpios)) + gpio->chip.ngpio = ngpios; gpio->spi = spi;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 267/1193 rtc: bq32000: add delay between RTC reads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adriana Stancu <[email protected]>
[ Upstream commit d4992b7050a10079bc760bdc5b8688e05a09dfc2 ]
When the RTC is used on systems without a interrupt line, userspace tools like hwclock fall back to a frequent polling loop to synchronize with the edge of the next second.
On the BQ32000, this aggressive polling can temporarly lock the register refresh cycle, because the continuous transfers prevent the hardware from updating the buffer. This results in stale data reads or select() timeouts in userspace.
This patch introduces a delay before reading the RTC registers in order to provide a sufficient idle time for the hardware to sync with the register buffer.
--- drivers/rtc/rtc-bq32k.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/rtc/rtc-bq32k.c +9 -0
@@ -16,6 +16,7 @@#include <linux/kstrtox.h> #include <linux/errno.h> #include <linux/bcd.h> +#include <linux/delay.h> #define BQ32K_SECONDS 0x00/* Seconds register address */ #define BQ32K_SECONDS_MASK 0x7F/* Mask over seconds value */
@@ -89,9 +90,17 @@ static int bq32k_write(struct device *dev, void *data, uint8_t off, uint8_t len)static int bq32k_rtc_read_time (struct device *dev,struct rtc_time *tm) { +struct i2c_client *client =to_i2c_client (dev);struct bq32k_regs regs;int error; +/* +* When the device doesn't have the interrupt connected, prevent +* userpace from polling the RTC registers too frequently. +*/ +if (client->irq <=0 ) +usleep_range (2000 ,2500 ); + error =bq32k_read (dev, ®s,0 ,sizeof (regs));if (error)return error;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 268/1193 eth: mlx5: fix macsec dependency
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 87ab8276ed24d688febfef4d0c1794896e778192 ]
Configurations with mlx5 built-in but macsec=m fail to link:
x86_64-linux-ld: drivers/infiniband/hw/mlx5/macsec.o: in function `mlx5r_add_gid_macsec_operations':
macsec.c:(.text+0x77d): undefined reference to `macsec_netdev_is_offloaded'
x86_64-linux-ld: drivers/infiniband/hw/mlx5/macsec.o: in function `mlx5r_del_gid_macsec_operations':
macsec.c:(.text+0xe81): undefined reference to `macsec_netdev_is_offloaded'
Fix the dependency so this configuration cannot happen.
--- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -1
@@ -143,7 +143,7 @@ config MLX5_CORE_IPOIB config MLX5_MACSEC bool "Connect-X support for MACSec offload" depends on MLX5_CORE_EN - depends on MACSEC + depends on MACSEC=y || MACSEC=MLX5_CORE default n help Build support for MACsec cryptography-offload acceleration in the NIC.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 269/1193 fbdev: pm2fb: unwind WC setup on probe failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 16eb19f0c90af03bda6ba66586d7bb0e9cf85b43 ]
Add arch_phys_wc_del() on error path to keep the write-combining setup balanced when later probe steps fail.
--- drivers/video/fbdev/pm2fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/pm2fb.c +1 -0
@@ -1709,6 +1709,7 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_exit_both:kfree (info->pixmap.addr); err_exit_pixmap: +arch_phys_wc_del (default_par->wc_cookie);iounmap (info->screen_base);release_mem_region (pm2fb_fix.smem_start, pm2fb_fix.smem_len); err_exit_mmio:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 270/1193 spi: core: Abort active target transfer on controller suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Praveen Talari <[email protected]>
[ Upstream commit c1bab046d4786c5b17aab7c5225bf0d4a2a2d19b ]
When an SPI controller operating in target mode has a transfer in progress at the time of system suspend, the suspend path proceeds without aborting the ongoing transfer. This can leave the hardware in an inconsistent state, potentially causing the system to hang or fail to resume cleanly.
Fix this by invoking the controller's target_abort callback from spi_controller_suspend() when the controller is in target mode and the callback is registered. This ensures any active target transfer is cleanly terminated before the controller is suspended.
--- drivers/spi/spi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi.c +3 -0
@@ -3376,6 +3376,9 @@ int spi_controller_suspend(struct spi_controller *ctlr) {int ret =0 ; +if (ctlr->cur_msg &&spi_controller_is_target (ctlr) && ctlr->target_abort) + ctlr->target_abort (ctlr); +/* Basically no-ops for non-queued controllers */ if (ctlr->queued) { ret =spi_stop_queue (ctlr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 271/1193 btrfs: tree-checker: validate INODE_REFs namelen
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 3dc22abc21f5892406c09202fa2627196cc96967 ]
[BUG]
A crafted btrfs image can trigger the following crash:
BUG: unable to handle page fault for address: ffffd1dc42884000 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page CPU: 9 UID: 0 PID: 1034 Comm: poc Not tainted 7.1.0-rc4-custom+ #383 PREEMPT(full) 46af0a92938a63be7132e0dfd71e62327c51d5c2 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:memcpy+0xc/0x10 Call Trace: <TASK> read_extent_buffer+0xe4/0x100 [btrfs 3cf0785dd58fec8c5ff84633b772f17ce1f92a8f] btrfs_get_name+0x15e/0x1e0 [btrfs 3cf0785dd58fec8c5ff84633b772f17ce1f92a8f] reconnect_path+0x165/0x390 exportfs_decode_fh_raw+0x337/0x400 ? drop_caches_sysctl_handler+0xb0/0xb0 </TASK> ---[ end trace 0000000000000000 ]--- RIP: 0010:memcpy+0xc/0x10 Kernel panic - not syncing: Fatal exception
[CAUSE]
TThe crafted image has the following corrupted INODE_REF item:
item 9 key (258 INODE_REF 257) itemoff 11544 itemsize 4106
index 2 namelen 4096 name: d\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000The itemsize matches the namelen, but the namelen is 4096, way larger than normal name length limit (BTRFS_NAME_LEN, 255).
Meanwhile the memory of the @name is only 255 byte sized, this will cause out-of-boundary access, and cause the above crash.
[FIX]
Add extra namelen verification for INODE_REF, just like what we have done in ROOT_REF checks.
Now the crafted image can be rejected gracefully:
BTRFS critical (device dm-2): corrupt leaf: root=5 block=30572544 slot=14 ino=259, invalid inode ref name length, has 4096 expect [1, 255] BTRFS error (device dm-2): read time tree block corruption detected on logical 30572544 mirror 2
--- fs/btrfs/tree-checker.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/tree-checker.c +6 -0
@@ -1774,6 +1774,12 @@ static int check_inode_ref(struct extent_buffer *leaf, iref = (struct btrfs_inode_ref *)ptr; namelen =btrfs_inode_ref_name_len (leaf, iref); +if (unlikely (namelen ==0 || namelen >BTRFS_NAME_LEN )) { +inode_ref_err (leaf, slot, +"invalid inode ref name length, has %u expect [1, %u]" , + namelen,BTRFS_NAME_LEN ); +return -EUCLEAN ; + }if (unlikely (ptr +sizeof (*iref) + namelen > end)) { inode_ref_err(leaf, slot, "inode ref overflow, ptr %lu end %lu namelen %u",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 272/1193 drm/arm/malidp: use clk_bulk API in runtime PM resume and suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Kenji Mendonça Kaneko <[email protected]>
[ Upstream commit 46f715a16989f4e7bbbc2eb41447051874b027f3 ]
malidp_runtime_pm_resume() calls clk_prepare_enable() three times without checking the return value. If any clock fails to enable, the driver silently proceeds with unclocked hardware, leading to undefined behavior.
Convert both the resume and suspend paths to use the clk_bulk API:clk_bulk_prepare_enable() in resume checks the return value and rolls back any successfully enabled clocks on failure; clk_bulk_disable_unprepare() in suspend keeps the two paths symmetric.
This issue was found by code review without access to Mali DP hardware.
--- drivers/gpu/drm/arm/malidp_drv.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/arm/malidp_drv.c +16 -6
@@ -668,6 +668,11 @@ static int malidp_runtime_pm_suspend(struct device *dev)struct drm_device *drm =dev_get_drvdata (dev);struct malidp_drm *malidp =drm_to_malidp (drm);struct malidp_hw_device *hwdev = malidp->dev; +struct clk_bulk_data clks[] = { + { .clk = hwdev->pclk }, + { .clk = hwdev->aclk }, + { .clk = hwdev->mclk }, + };/* we can only suspend if the hardware is in config mode */ WARN_ON (!hwdev->hw->in_config_mode (hwdev));
@@ -675,9 +680,7 @@ static int malidp_runtime_pm_suspend(struct device *dev)malidp_se_irq_fini (hwdev);malidp_de_irq_fini (hwdev); hwdev->pm_suspended = true; -clk_disable_unprepare (hwdev->mclk); -clk_disable_unprepare (hwdev->aclk); -clk_disable_unprepare (hwdev->pclk); +clk_bulk_disable_unprepare (ARRAY_SIZE (clks), clks);return 0 ; }
@@ -687,10 +690,17 @@ static int malidp_runtime_pm_resume(struct device *dev)struct drm_device *drm =dev_get_drvdata (dev);struct malidp_drm *malidp =drm_to_malidp (drm);struct malidp_hw_device *hwdev = malidp->dev; +struct clk_bulk_data clks[] = { + { .clk = hwdev->pclk }, + { .clk = hwdev->aclk }, + { .clk = hwdev->mclk }, + }; +int err; + + err =clk_bulk_prepare_enable (ARRAY_SIZE (clks), clks); +if (err) +return err; -clk_prepare_enable (hwdev->pclk); -clk_prepare_enable (hwdev->aclk); -clk_prepare_enable (hwdev->mclk); hwdev->pm_suspended = false;malidp_de_irq_hw_init (hwdev);malidp_se_irq_hw_init (hwdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 273/1193 netfilter: nf_conntrack_expect: zero at allocation time
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 241ccd2fed9051db443aadce248fc0ab30f55e97 ]
There are occasional LLM hints wrt. leaking uninitialized data to userspace via ctnetlink. Just zero at allocation time, expectations are not frequently used these days.
Intentionally keeps _init as-is because we could theoretically support re-init, so add the missing exp->dir there.
--- net/netfilter/nf_conntrack_expect.c | 3 ++- net/netfilter/nf_conntrack_netlink.c | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-)
net/netfilter/nf_conntrack_expect.c +2 -1
@@ -304,7 +304,7 @@ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me) {struct nf_conntrack_expect *new; - new =kmem_cache_alloc (nf_ct_expect_cachep,GFP_ATOMIC ); + new =kmem_cache_zalloc (nf_ct_expect_cachep,GFP_ATOMIC );if (!new)return NULL ;
@@ -386,6 +386,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,#if IS_ENABLED (CONFIG_NF_NAT )memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr));memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); + exp->dir =0 ;#endif }EXPORT_SYMBOL_GPL (nf_ct_expect_init);
net/netfilter/nf_conntrack_netlink.c +1 -10
@@ -3548,8 +3548,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct,if (cda[CTA_EXPECT_FLAGS ]) { exp->flags =ntohl (nla_get_be32 (cda[CTA_EXPECT_FLAGS ])); exp->flags &= ~NF_CT_EXPECT_USERSPACE ; - }else { - exp->flags =0 ; }if (cda[CTA_EXPECT_FN ]) {const char *name =nla_data (cda[CTA_EXPECT_FN ]);
@@ -3561,8 +3559,7 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, goto err_out; } exp->expectfn = expfn->expectfn; - }else - exp->expectfn =NULL ; + } exp->class = class; exp->master = ct;
@@ -3581,12 +3578,6 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct, exp, nf_ct_l3num(ct));if (err <0 ) goto err_out; -#if IS_ENABLED (CONFIG_NF_NAT ) - } else { -memset (&exp->saved_addr,0 ,sizeof (exp->saved_addr)); -memset (&exp->saved_proto,0 ,sizeof (exp->saved_proto)); - exp->dir =0 ; -#endif }return exp; err_out:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 274/1193 ksmbd: fix sd_ndr.data memory leak in ksmbd_vfs_set_sd_xattr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit d4d56b00c7df88cd5751e7415bdfabc9fdbc82a7 ]
ndr_encode_v4_ntacl() allocates sd_ndr.data via kzalloc() at entry. If any subsequent ndr_write_*() call returns error during encoding, the allocated sd_ndr.data won't be freed and causes memory leak.
Move kfree(sd_ndr.data) into out label to ensure the buffer gets released on all success and error return paths.
--- fs/smb/server/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/vfs.c +1 -1
@@ -1544,8 +1544,8 @@ int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn,if (rc <0 )pr_err ("Failed to store XATTR ntacl :%d\n" , rc); -kfree (sd_ndr.data); out: +kfree (sd_ndr.data);kfree (acl_ndr.data);kfree (smb_acl);kfree (def_smb_acl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 232/1193 spi: Add NULL check for spi_get_device_id() in spi_get_device_match_data()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: guoqi0226 <[email protected]>
[ Upstream commit f1b061b4d4c6cbf861319ba954caa80145cf018f ]
Prevent NULL pointer dereference when spi_get_device_id() returns NULL, which can happen when using driver_override without matching SPI ID entry.
--- drivers/spi/spi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi.c +5 -1
@@ -366,12 +366,16 @@ EXPORT_SYMBOL_GPL(spi_get_device_id);const void *spi_get_device_match_data (const struct spi_device *sdev) {const void *match; +const struct spi_device_id *id; match =device_get_match_data (&sdev->dev);if (match)return match; -return (const void *)spi_get_device_id (sdev)->driver_data; + id =spi_get_device_id (sdev); +if (!id) +return NULL ; +return (const void *)id->driver_data; }EXPORT_SYMBOL_GPL (spi_get_device_match_data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 233/1193 ALSA: usb-audio: Add quirk flags for SC13A
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ai Chao <[email protected]>
[ Upstream commit 8956950dab22fbaefe92ca1980728165c5da793d ]
The SC13A ( VID 0x1ff7, PID 0x0f81) not support reading the current sample rate and results in an error message printed to kmsg. Set QUIRK_FLAG_GET_SAMPLE_RATE to skip the sample rate check.
Quirky device sample:
usb 3-5.2.4.1: new high-speed USB device number 11 using xhci_hcd usb 3-5.2.4.1: New USB device found, idVendor=1ff7, idProduct=0f81 usb 3-5.2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-5.2.4.1: Product: SC13A
usb 3-5.2.4.1: Manufacturer: Linux Foundation
usb 3-5.2.4.1: SerialNumber: 000002
usb 3-5.2.4.1: Found UVC 1.50 device SC13A (1ff7:0f81)
usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
usb 3-5.2.4.1: Warning! Unlikely big volume range (=4096),
cval->res is probably wrong.
usb 3-5.2.4.1: [5] FU [Mic Capture Volume] ch = 1, val = 0/4096/1
usbcore: registered new interface driver snd-usb-audio usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2225,6 +2225,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_MIC_RES_16),DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ), +DEVICE_FLG (0x1ff7 ,0x0f81 ,/* SC13A Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x2040 ,0x7200 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 234/1193 tls: reject the combination of TLS and sockmap
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 460e6486617c17dd19abe8f3fc67d9a6fa25f8ca ]
TLS and sockmap (BPF psock) integration hides a lot of latent bugs. Bugs which may be more or less relevant for real users but they are definitely exploitable.
We could not find anyone actively using this integration so let's reject this config. Adding a TLS socket to a sockmap was already rejected by sk_psock_init() through the inet_csk_has_ulp() check. We need to reject the attempts to configure the TLS keys (rather than adding the ULP itself) because checking prior to the ULP installation is tricky without risking a race with sockmap getting added in parallel (sockmap does not hold the socket lock).
This patch is a minimal rejection of the feature. Subsequent patch in the series will do a light dead code removal. Full cleanup would require a major rewrite of the Tx path, we don't need skmsg any more.
--- net/tls/tls_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/tls/tls_main.c +11 -0
@@ -592,6 +592,17 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,int rc =0 ;int conf; +/* TLS and sockmap are mutually exclusive. A socket already in a +* sockmap (i.e. with a psock attached) cannot be upgraded to TLS. +* sockmap rejects TLS sockets already (see sk_psock_init()). +*/ +rcu_read_lock (); +if (sk_psock (sk)) { +rcu_read_unlock (); +return -EINVAL ; + } +rcu_read_unlock (); +if (sockptr_is_null (optval) || (optlen <sizeof (*crypto_info)))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 235/1193 ALSA: hda/conexant: Add pin config quirk for Lenovo IdeaPad Slim 5 16AKP10
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Galen Hassen <[email protected]>
[ Upstream commit f7c4968ae3af3e819428da5416c2dfd361473f5c ]
The Lenovo IdeaPad Slim 5 16AKP10 (PCI SSID 17aa:38b6) uses the Conexant SN6140 codec. The internal microphone is on pin 0x1a but the BIOS configures it with pin default 0x95a60120, which includes a jack detection bit that causes the kernel to treat it as an unplugged external mic rather than a fixed internal mic.
Add a pin config quirk that overrides pin 0x1a to 0x95a60130, setting the connectivity bits to indicate a fixed/always-connected device. This allows the internal microphone to be correctly identified and used.
--- sound/pci/hda/patch_conexant.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_conexant.c +12 -0
@@ -307,6 +307,7 @@ enum {CXT_FIXUP_HEADSET_MIC ,CXT_FIXUP_HP_MIC_NO_PRESENCE ,CXT_PINCFG_SWS_JS201D , +CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ,CXT_PINCFG_TOP_SPEAKER ,CXT_FIXUP_HP_A_U , CXT_FIXUP_ACER_SWIFT_HP,
@@ -841,6 +842,12 @@ static const struct hda_pintbl cxt_pincfg_lemote[] = { {} }; +/* Lenovo IdeaPad Slim 5 16AKP10 with SN6140 */ +static const struct hda_pintbl cxt_pincfg_lenovo_ideapad_slim5_16akp10[] = { + {0x1a ,0x95a60130 },/* Internal mic, fixed/always-connected */ + {} +}; +/* SuoWoSi/South-holding JS201D with sn6140 */ static const struct hda_pintbl cxt_pincfg_sws_js201d[] = { {0x16 ,0x03211040 },/* hp out */
@@ -1015,6 +1022,10 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_PINS, .v.pins = cxt_pincfg_sws_js201d, }, + [CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10] = { + .type = HDA_FIXUP_PINS, + .v.pins = cxt_pincfg_lenovo_ideapad_slim5_16akp10, + }, [CXT_PINCFG_TOP_SPEAKER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -1123,6 +1134,7 @@ static const struct hda_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo IdeaPad Z560" ,CXT_FIXUP_MUTE_LED_EAPD ), +SND_PCI_QUIRK (0x17aa ,0x38b6 ,"Lenovo IdeaPad Slim 5 16AKP10" ,CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ),SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 236/1193 leds: uleds: Return -EFAULT on copy_to_user() failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 61ed78f55a46e12afd4b464c4ba736f55ff33c5e ]
uleds_read() copies the current brightness value to userspace but ignores copy_to_user() failures. It then clears the pending update and reports a successful full read even when no data was copied.
Return -EFAULT when the copy fails and leave the update pending so a later read can retry.
--- drivers/leds/uleds.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/leds/uleds.c +7 -4
@@ -148,10 +148,13 @@ static ssize_t uleds_read(struct file *file, char __user *buffer, size_t count, }else if (!udev->new_data && (file->f_flags &O_NONBLOCK )) { retval = -EAGAIN ; }else if (udev->new_data) { - retval =copy_to_user (buffer, &udev->brightness, -sizeof (udev->brightness)); - udev->new_data = false; - retval =sizeof (udev->brightness); +if (copy_to_user (buffer, &udev->brightness, +sizeof (udev->brightness))) { + retval = -EFAULT ; + }else { + udev->new_data = false; + retval =sizeof (udev->brightness); + } }mutex_unlock (&udev->mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 227/1193 ALSA: hda/realtek: Add quirk for Lenovo Xiaoxin 14 GT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viktor Menshin <[email protected]>
[ Upstream commit 3a3e810e91080a5121170ee11554a55ed89a1c8b ]
The Lenovo Xiaoxin 14 GT (Chinese market model, AMD Ryzen AI 9 365) produces constant electrical hissing and crackling noise from both internal speakers and 3.5mm headphone jack during audio playback. Audio works correctly on Windows.
The PCI SSID 17aa:3912 is not present in the quirk list. The device shares the same AMD platform and ALC287 codec as neighboring Lenovo 14" AMD models (17aa:3911, 17aa:390d), so apply the same fixup.
Note: the fixup selection is based on similarity with neighboring models and has not been verified by testing a compiled kernel. Guidance from maintainers on the correct fixup is welcome.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10600,6 +10600,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ),SND_PCI_QUIRK (0x17aa ,0x390d ,"Lenovo Yoga Pro 7 14ASP10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3911 ,"Lenovo Yoga Pro 7 14IAH10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3912 ,"Lenovo Xiaoxin 14 GT" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3913 ,"Lenovo 145" ,ALC236_FIXUP_LENOVO_INV_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 276/1193 ksmbd: fix n.data memory leak in ksmbd_vfs_set_dos_attrib_xattr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit 7ac657bb9c5c1b0f7bdf1fa6d3ad532f969be5cf ]
Free ndr buffer data when ndr_encode_dos_attr() returns error to avoid memory leak.
--- fs/smb/server/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/smb/server/vfs.c +3 -2
@@ -1637,14 +1637,15 @@ int ksmbd_vfs_set_dos_attrib_xattr(struct mnt_idmap *idmap, err =ndr_encode_dos_attr (&n, da);if (err) -return err; + goto out; err =ksmbd_vfs_setxattr (idmap, path,XATTR_NAME_DOS_ATTRIBUTE , (void *)n.data, n.offset,0 , get_write);if (err)ksmbd_debug (SMB ,"failed to store dos attribute in xattr\n" ); -kfree (n.data); +out: +kfree (n.data);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 285/1193 ALSA: usb-audio: caiaq: validate EP1 reply lengths
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit aba30af07d4fe499b50209801eba9da8a815522f ]
usb_ep1_command_reply_dispatch() uses buf[0] as a command byte and then reads command-specific fixed items from the same URB buffer. Several paths use buf + 1, buf[1], buf[2], or buf + 3 without first proving that urb->actual_length contains those bytes.
Add per-command length checks, use a payload length derived from the bytes after the command byte for the control-state copy, and reject short analog input payloads before the input helper reads fixed offsets from the EP1 reply.
--- sound/usb/caiaq/device.c | 17 ++++++++++++++--- sound/usb/caiaq/input.c | 6 ++++++ 2 files changed, 20 insertions(+), 3 deletions(-)
sound/usb/caiaq/device.c +14 -3
@@ -134,14 +134,22 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb)struct device *dev = &urb->dev->dev;struct snd_usb_caiaqdev *cdev = urb->context;unsigned char *buf = urb->transfer_buffer; +unsigned int payload_len; +unsigned int copy_len;if (urb->status || !cdev) {dev_warn (dev,"received EP1 urb->status = %i\n" , urb->status);return ; } +if (urb->actual_length <1 ) +return ; + + payload_len = urb->actual_length -1 ;switch (buf[0 ]) {case EP1_CMD_GET_DEVICE_INFO : +if (payload_len <sizeof (struct caiaq_device_spec )) +break ;memcpy (&cdev->spec, buf+1 ,sizeof (struct caiaq_device_spec )); cdev->spec.fw_version =le16_to_cpu (cdev->spec.fw_version); dev_dbg(dev, "device spec (firmware %d): audio: %d in, %d out, "
@@ -157,18 +165,21 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb)wake_up (&cdev->ep1_wait_queue);break ;case EP1_CMD_AUDIO_PARAMS : +if (payload_len <1 ) +break ; cdev->audio_parm_answer = buf[1 ];wake_up (&cdev->ep1_wait_queue);break ;case EP1_CMD_MIDI_READ : +if (urb->actual_length <3 || urb->actual_length -3 < buf[2 ]) +break ;snd_usb_caiaq_midi_handle_input (cdev, buf[1 ], buf +3 , buf[2 ]);break ;case EP1_CMD_READ_IO :if (cdev->chip.usb_id ==USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_AUDIO8DJ )) { -if (urb->actual_length >sizeof (cdev->control_state)) - urb->actual_length =sizeof (cdev->control_state); -memcpy (cdev->control_state, buf +1 , urb->actual_length); + copy_len = min_t(unsigned int, payload_len, sizeof(cdev->control_state)); +memcpy (cdev->control_state, buf +1 , copy_len);wake_up (&cdev->ep1_wait_queue);break ; }
sound/usb/caiaq/input.c +6 -0
@@ -203,6 +203,8 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev,switch (cdev->chip.usb_id) {case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_RIGKONTROL2 ): +if (len <6 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_X , buf,2 );snd_caiaq_input_report_abs (cdev,ABS_Y , buf,0 );snd_caiaq_input_report_abs (cdev,ABS_Z , buf,1 );
@@ -210,11 +212,15 @@ static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev,case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_RIGKONTROL3 ):case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER ):case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_KORECONTROLLER2 ): +if (len <6 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_X , buf,0 );snd_caiaq_input_report_abs (cdev,ABS_Y , buf,1 );snd_caiaq_input_report_abs (cdev,ABS_Z , buf,2 );break ;case USB_ID (USB_VID_NATIVEINSTRUMENTS ,USB_PID_TRAKTORKONTROLX1 ): +if (len <16 ) +return ;snd_caiaq_input_report_abs (cdev,ABS_HAT0X , buf,4 );snd_caiaq_input_report_abs (cdev,ABS_HAT0Y , buf,2 );snd_caiaq_input_report_abs (cdev,ABS_HAT1X , buf,6 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 286/1193 wifi: ralink: RT2X00: init EEPROM properly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corentin Labbe <[email protected]>
[ Upstream commit 0a2581cbae9e442835f68d22044157db61cdf54d ]
I have an hostapd setup with a
01:00.0 Network controller: Ralink corp. RT2790 Wireless 802.11n 1T/2R PCIe
The setup work fine on 6.18.26-gentoo
It breaks on 6.18.33-gentoo (and still broken on 6.18.37)
I found an hint in dmesg:
On 6.18.26-gentoo I see:
May 31 15:48:45 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0003 detected On 6.18.33-gentoo I see: May 31 15:22:57 trash01 kernel: ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 0006 detected
The RF chipset seems badly detected.
The problem was the EEPROM which was badly initialized.
Probably the origin was in some PCI change but unfortunately I couldn't play to bisect/reboot often the board with this card to do it.
--- drivers/net/wireless/ralink/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt61pci.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2400pci.c +1 -1
@@ -1429,7 +1429,7 @@ static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)*/ static int rt2400pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2500pci.c +1 -1
@@ -1555,7 +1555,7 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)*/ static int rt2500pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
drivers/net/wireless/ralink/rt2x00/rt2800pci.c +1 -1
@@ -108,7 +108,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom)static int rt2800pci_read_eeprom_pci (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg; reg =rt2x00mmio_register_read (rt2x00dev,E2PROM_CSR );
drivers/net/wireless/ralink/rt2x00/rt61pci.c +1 -1
@@ -2298,7 +2298,7 @@ static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance)*/ static int rt61pci_validate_eeprom (struct rt2x00_dev *rt2x00dev) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};u32 reg;u16 word;u8 *mac;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 287/1193 wifi: mac80211: validate deauth frame length before reason access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <[email protected]>
[ Upstream commit 4a360c6e18dfa9d70006c7247a6a8cc8dfe0d60f ]
ieee80211_rx_mgmt_deauth() reads the deauth reason code before checking that the fixed field is actually present in the received frame.
Validate the deauth frame length first and only then read the reason code.
--- net/mac80211/mlme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +4 -2
@@ -3826,13 +3826,15 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len) {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; -u16 reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +u16 reason_code;sdata_assert_lock (sdata); -if (len <24 +2 ) + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code))return ; + reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); +if (!ether_addr_equal (mgmt->bssid, mgmt->sa)) {ieee80211_tdls_handle_disconnect (sdata, mgmt->sa, reason_code);return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 288/1193 wifi: rsi: avoid reading TKIP MIC keys for non-TKIP ciphers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 843fe9bc583b7686ca68312ac9319c9240a73c03 ]
rsi_hal_load_key() copies tx_mic_key and rx_mic_key from data[16] and data[24] whenever key data is present. Those offsets are only part of the 32-byte TKIP key layout. Shorter keys used by other ciphers, such as CCMP, do not provide those bytes, so the unconditional copies can read past the supplied key buffer.
Only copy the MIC keys for TKIP, and reject malformed TKIP keys that are shorter than the expected 32-byte layout.
--- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +4 -2
@@ -848,8 +848,10 @@ int rsi_hal_load_key(struct rsi_common *common, }else {memcpy (&set_key->key[0 ][0 ], data, key_len); } -memcpy (set_key->tx_mic_key, &data[16 ],8 ); -memcpy (set_key->rx_mic_key, &data[24 ],8 ); +if (cipher ==WLAN_CIPHER_SUITE_TKIP ) { +memcpy (set_key->tx_mic_key, &data[16 ],8 ); +memcpy (set_key->rx_mic_key, &data[24 ],8 ); + } }else {memset (&set_key[FRAME_DESC_SZ ],0 , frame_len -FRAME_DESC_SZ ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 289/1193 wifi: libertas: reject short monitor TX frames
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 13ff543e0b2c713aedeaadadde686686e949dc78 ]
In monitor mode, lbs_hard_start_xmit() casts skb->data to a radiotap TX header, skips that header, and then copies the 802.11 destination address from offset 4 in the remaining frame. The generic length check only rejects zero-length and oversized skbs, so a short monitor frame can be read past the end of the skb data.
Require enough bytes for the radiotap TX header and the destination address field before using the monitor-mode header layout.
--- drivers/net/wireless/marvell/libertas/tx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/libertas/tx.c +7 -0
@@ -117,6 +117,13 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)if (priv->wdev->iftype ==NL80211_IFTYPE_MONITOR ) {struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; +if (skb->len <sizeof (*rtap_hdr) +4 +ETH_ALEN ) { +lbs_deb_tx ("tx err: short monitor frame %u\n" , skb->len); + dev->stats.tx_dropped++; + dev->stats.tx_errors++; + goto free; + } +/* set txpd fields from the radiotap header */ txpd->tx_control =cpu_to_le32 (convert_radiotap_rate_to_mv (rtap_hdr->rate));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 290/1193 wifi: cfg80211: validate assoc response length before status and IE access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <[email protected]>
[ Upstream commit b760113aeca2e9362d56bf9e9263373ffe6c8eb3 ]
cfg80211_rx_assoc_resp() initialises the status and response-IE fields of cfg80211_connect_resp_params from the management frame before proving that the frame is long enough for those offsets. S1G and regular association responses also have different IE offsets, but the S1G path only patched resp_ie after the unsafe initialiser had already run.
Defer resp_ie, resp_ie_len, and status to after the link-iteration loop. Use a bool to remember whether the frame is S1G, then validate the appropriate minimum length and set all three fields in a single if/else block. Funnel short-frame and SME-reject cleanup through a shared free_bss label for the abandon paths.
--- net/wireless/mlme.c | 56 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 21 deletions(-)
net/wireless/mlme.c +35 -21
@@ -32,14 +32,10 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, .timeout_reason = NL80211_TIMEOUT_UNSPECIFIED, .req_ie = data->req_ies, .req_ie_len = data->req_ies_len, - .resp_ie = mgmt->u.assoc_resp.variable, - .resp_ie_len = data->len - - offsetof(struct ieee80211_mgmt , - u.assoc_resp.variable), - .status = le16_to_cpu(mgmt->u.assoc_resp.status_code), .ap_mld_addr = data->ap_mld_addr, };unsigned int link_id; +bool is_s1g = false;for (link_id =0 ; link_id <ARRAY_SIZE (data->links); link_id++) { cr.links[link_id].status = data->links[link_id].status;
@@ -60,16 +56,32 @@ void cfg80211_rx_assoc_resp(struct net_device *dev,if (cr.links[link_id].bss->channel->band ==NL80211_BAND_S1GHZ ) {WARN_ON (link_id); - cr.resp_ie = (u8 *)&mgmt->u.s1g_assoc_resp.variable; - cr.resp_ie_len = data->len - - offsetof(struct ieee80211_mgmt , - u.s1g_assoc_resp.variable); + is_s1g = true; }if (cr.ap_mld_addr) cr.valid_links |=BIT (link_id); } +if (is_s1g) { +if (data->len < offsetof(struct ieee80211_mgmt , + u.s1g_assoc_resp.variable)) + goto free_bss; + cr.resp_ie = (u8 *)&mgmt->u.s1g_assoc_resp.variable; + cr.resp_ie_len = data->len - + offsetof(struct ieee80211_mgmt , + u.s1g_assoc_resp.variable); + }else { +if (data->len < offsetof(struct ieee80211_mgmt , + u.assoc_resp.variable)) + goto free_bss; + cr.resp_ie = mgmt->u.assoc_resp.variable; + cr.resp_ie_len = data->len - + offsetof(struct ieee80211_mgmt , + u.assoc_resp.variable); + } + cr.status =le16_to_cpu (mgmt->u.assoc_resp.status_code); +trace_cfg80211_send_rx_assoc (dev, data);/*
@@ -78,22 +90,24 @@ void cfg80211_rx_assoc_resp(struct net_device *dev,* and got a reject -- we only try again with an assoc * frame instead of reassoc. */ -if (cfg80211_sme_rx_assoc_resp (wdev, cr.status)) { -for (link_id =0 ; link_id <ARRAY_SIZE (data->links); link_id++) { -struct cfg80211_bss *bss = data->links[link_id].bss; - -if (!bss) -continue ; - -cfg80211_unhold_bss (bss_from_pub (bss)); -cfg80211_put_bss (wiphy, bss); - } -return ; - } +if (cfg80211_sme_rx_assoc_resp (wdev, cr.status)) + goto free_bss;nl80211_send_rx_assoc (rdev, dev, data);/* update current_bss etc., consumes the bss reference */ __cfg80211_connect_result (dev, &cr, cr.status ==WLAN_STATUS_SUCCESS ); +return ; + +free_bss: +for (link_id =0 ; link_id <ARRAY_SIZE (data->links); link_id++) { +struct cfg80211_bss *bss = data->links[link_id].bss; + +if (!bss) +continue ; + +cfg80211_unhold_bss (bss_from_pub (bss)); +cfg80211_put_bss (wiphy, bss); + } }EXPORT_SYMBOL (cfg80211_rx_assoc_resp);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 291/1193 ksmbd: find bound sessions during reauthentication
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit faf8578c77f3d846aca9cd882c293e03eafcc6df ]
A session bound to an additional connection is stored in the session channel list, but it is not added to that connection's local session table. After the binding exchange completes, conn->binding is cleared.
A later SESSION_SETUP reauthentication on the bound channel only searches the local session table. It fails to find the session and returns STATUS_USER_SESSION_DELETED instead of processing authentication and returning STATUS_LOGON_FAILURE for invalid credentials.
If the local lookup fails, look up the session globally and accept it only when the current connection is registered in its channel list. This keeps unbound connections from using the session while allowing reauthentication on an established channel.
This fixes smb2.session.bind_invalid_auth.
--- fs/smb/server/smb2pdu.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/server/smb2pdu.c +7 -0
@@ -1784,6 +1784,13 @@ int smb2_sess_setup(struct ksmbd_work *work) }else { sess =ksmbd_session_lookup (conn,le64_to_cpu (req->hdr.SessionId)); +if (!sess) { + sess =ksmbd_session_lookup_slowpath (le64_to_cpu (req->hdr.SessionId)); +if (sess && !lookup_chann_list (sess, conn)) { +ksmbd_user_session_put (sess); + sess =NULL ; + } + }if (!sess) { rc = -ENOENT ; goto out_err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 292/1193 ksmbd: mark invalid session responses as signed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 9e8ad620ddfde5a5f4ef58372e3805e9388cb0f4 ]
When a signed request uses a session that is not registered on the connection, ksmbd returns STATUS_USER_SESSION_DELETED before reaching the normal response signing path. The response therefore lacks SMB2_FLAGS_SIGNED.
Clients that require signing check this flag before handling STATUS_USER_SESSION_DELETED and replace the server status with STATUS_ACCESS_DENIED when it is absent. The protocol permits this error response to skip signature verification because the connection has no matching session key.
Preserve SMB2_FLAGS_SIGNED on the early error response when the request was signed. This lets the client propagate STATUS_USER_SESSION_DELETED. It fixes smb2.session.bind2.
--- fs/smb/server/server.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/smb/server/server.c +6 -0
@@ -197,6 +197,12 @@ static void __handle_ksmbd_work(struct ksmbd_work *work,else conn->ops->set_rsp_status (work,STATUS_USER_SESSION_DELETED ); +if (conn->ops->is_sign_req (work, conn->ops->get_cmd_val (work))) { +struct smb2_hdr *rsp_hdr; + + rsp_hdr =ksmbd_resp_buf_curr (work); + rsp_hdr->Flags |=SMB2_FLAGS_SIGNED ; + } goto send; }else if (rc >0 ) { rc = conn->ops->get_ksmbd_tcon (work);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 293/1193 ksmbd: validate SID namespace before mapping IDs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit fbe0bb2b75eb3c61e8464486506253d1b471240b ]
sid_to_id() currently treats the last subauthority of any owner or group SID as a Unix uid or gid. For example, this maps Everyone (S-1-1-0) to uid 0 and BUILTIN\Users (S-1-5-32-545) to gid 545.
When an SMB2 CREATE security descriptor contains those SIDs, ksmbd attempts to change the newly created file to the bogus Unix ownership. notify_change() then returns -EPERM, which makes smb2.create.aclfile fail with NT_STATUS_SHARING_VIOLATION.
Validate the SID prefix before extracting its RID. Only server-domain owner SIDs and S-1-22-2 Unix group SIDs have local ID representations. Treat other valid Windows SIDs as unmapped so their original values can still be preserved in the NT ACL xattr.
--- fs/smb/server/smbacl.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
fs/smb/server/smbacl.c +17 -4
@@ -258,6 +258,7 @@ static int sid_to_id(struct mnt_idmap *idmap, struct smb_sid *psid, uint sidtype, struct smb_fattr *fattr) { + const struct smb_sid *sid_prefix;int rc = -EINVAL ;/*
@@ -279,6 +280,12 @@ static int sid_to_id(struct mnt_idmap *idmap,kuid_t uid;uid_t id; +/* Only the server domain RID has a local uid representation. */ + sid_prefix = &server_conf.domain_sid; +if (psid->num_subauth != sid_prefix->num_subauth +1 || +compare_sids (psid, sid_prefix)) +return -EINVAL ; + id =le32_to_cpu (psid->sub_auth[psid->num_subauth -1 ]); uid =KUIDT_INIT (id); uid =from_vfsuid (idmap, &init_user_ns,VFSUIDT_INIT (uid));
@@ -290,6 +297,12 @@ static int sid_to_id(struct mnt_idmap *idmap,kgid_t gid;gid_t id; +/* Local gids are represented by S-1-22-2-<gid>. */ + sid_prefix = &sid_unix_groups; +if (psid->num_subauth != sid_prefix->num_subauth +1 || +compare_sids (psid, sid_prefix)) +return -EINVAL ; + id =le32_to_cpu (psid->sub_auth[psid->num_subauth -1 ]); gid =KGIDT_INIT (id); gid =from_vfsgid (idmap, &init_user_ns,VFSGIDT_INIT (gid));
@@ -916,9 +929,9 @@ int parse_sec_desc(struct mnt_idmap *idmap, struct smb_ntsd *pntsd, rc =sid_to_id (idmap, owner_sid_ptr,SIDOWNER , fattr);if (rc) { -pr_err ("%s: Error %d mapping Owner SID to uid\n" , - __func__, rc); +ksmbd_debug (SMB ,"Owner SID has no Unix uid mapping\n" ); owner_sid_ptr =NULL ; + rc =0 ; } }
@@ -934,9 +947,9 @@ int parse_sec_desc(struct mnt_idmap *idmap, struct smb_ntsd *pntsd, } rc =sid_to_id (idmap, group_sid_ptr,SIDUNIX_GROUP , fattr);if (rc) { -pr_err ("%s: Error %d mapping Group SID to gid\n" , - __func__, rc); +ksmbd_debug (SMB ,"Group SID has no Unix gid mapping\n" ); group_sid_ptr =NULL ; + rc =0 ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 294/1193 wifi: cfg80211: validate rx/tx MLME callback frame lengths before access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <[email protected]>
[ Upstream commit d5e4586546974179feca305a94e07fac3e9727fe ]
cfg80211_rx_mlme_mgmt() and cfg80211_tx_mlme_mgmt() call tracepoints before rejecting frames shorter than the frame-control field. After that, they only require len >= 2 before dispatching into subtype handlers that assume their fixed fields are present.
The frames that trip this are not shorter than 2 bytes; they are short relative to their subtype. mwifiex is a concrete in-tree example on the length side: mwifiex_process_mgmt_packet() only requires a 4-address ieee80211_hdr plus the 2-byte firmware length prefix before handing the frame to cfg80211_rx_mlme_mgmt(). After stripping the length prefix and removing addr4, pkt_len can be exactly 24: a bare 3-address management header with no reason-code body. The existing WARN_ON(len < 2) does not fire on such a frame, and cfg80211_process_deauth() then reads u.deauth.reason_code as a two-byte access starting at offset 24, immediately past the 24-byte buffer.
Add a frame-control length gate, then validate each subtype's minimum frame size in an if/else-if chain that mirrors the dispatch logic. Trace only after the frame is known to be well-formed.
Side effects of this change:
- The WARN_ON(len < 2) is dropped. It only guarded the frame_control read, never the subtype fixed fields, and it does not fire on the frames that actually trigger the out-of-bounds read (which are >= 2). The len >= 2 check is kept as the guard before dereferencing frame_control, but without the warning: these are exported callbacks and a malformed frame from a driver should be dropped silently rather than backtraced.
- cfg80211_tx_mlme_mgmt() previously routed every non-deauth subtype through disassociation handling; it now silently ignores unrecognised subtypes.
--- net/wireless/mlme.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-)
net/wireless/mlme.c +37 -8
@@ -164,19 +164,35 @@ void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len) {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;ASSERT_WDEV_LOCK (wdev); -trace_cfg80211_rx_mlme_mgmt (dev, buf, len); +if (len <sizeof (fc)) +return ; + + fc = mgmt->frame_control; -if (WARN_ON (len <2 )) +if (ieee80211_is_auth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.auth.status_code)) +return ; + }else if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } + +trace_cfg80211_rx_mlme_mgmt (dev, buf, len); -if (ieee80211_is_auth (mgmt->frame_control)) +if (ieee80211_is_auth (fc))cfg80211_process_auth (wdev, buf, len); -else if (ieee80211_is_deauth (mgmt->frame_control)) +else if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, false); -else if (ieee80211_is_disassoc (mgmt->frame_control)) +else cfg80211_process_disassoc (wdev, buf, len, false); }EXPORT_SYMBOL (cfg80211_rx_mlme_mgmt);
@@ -229,15 +245,28 @@ void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, {struct wireless_dev *wdev = dev->ieee80211_ptr;struct ieee80211_mgmt *mgmt = (void *)buf; +__le16 fc;ASSERT_WDEV_LOCK (wdev); -trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); +if (len <sizeof (fc)) +return ; -if (WARN_ON (len <2 )) + fc = mgmt->frame_control; + +if (ieee80211_is_deauth (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.deauth.reason_code)) +return ; + }else if (ieee80211_is_disassoc (fc)) { + if (len < offsetofend(struct ieee80211_mgmt, u.disassoc.reason_code)) +return ; + }else {return ; + } + +trace_cfg80211_tx_mlme_mgmt (dev, buf, len, reconnect); -if (ieee80211_is_deauth (mgmt->frame_control)) +if (ieee80211_is_deauth (fc))cfg80211_process_deauth (wdev, buf, len, reconnect);else cfg80211_process_disassoc (wdev, buf, len, reconnect);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 277/1193 ksmbd: Fix acl.sd_buf memory leak and invalid sd_size error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Liu <[email protected]>
[ Upstream commit d708a36634bb7b6f94d0e76d587d2ec50b2b93b5 ]
1. When ndr_decode_v4_ntacl() fails, the code jumped to free_n_data which only freed n.data, skipping kfree(acl.sd_buf) and leaking the buffer. Zero-initialize struct xattr_ntacl acl, reorder error labels to out_free to release acl.sd_buf on all error paths.
2. if (acl.sd_size < sizeof(struct smb_ntsd)) is true, original code returned success without freeing sd_buf and left stale *pntsd. Set rc = -EINVAL before jumping to out_free to return error code and free buffer.
--- fs/smb/server/vfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/smb/server/vfs.c +3 -4
@@ -1561,7 +1561,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,struct ndr n;struct inode *inode =d_inode (dentry);struct ndr acl_ndr = {0 }; -struct xattr_ntacl acl; +struct xattr_ntacl acl = {0 };struct xattr_smb_acl *smb_acl =NULL , *def_smb_acl =NULL ;__u8 cmp_hash[XATTR_SD_HASH_SIZE ] = {0 };
@@ -1572,7 +1572,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn, n.length = rc; rc =ndr_decode_v4_ntacl (&n, &acl);if (rc) - goto free_n_data; + goto out_free; smb_acl =ksmbd_vfs_make_xattr_posix_acl (idmap, inode,ACL_TYPE_ACCESS );
@@ -1602,6 +1602,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn, *pntsd = acl.sd_buf;if (acl.sd_size <sizeof (struct smb_ntsd )) {pr_err ("sd size is invalid\n" ); + rc = -EINVAL ; goto out_free; }
@@ -1621,8 +1622,6 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn,kfree (acl.sd_buf); *pntsd =NULL ; } - -free_n_data:kfree (n.data);return rc; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 295/1193 gpio: dwapb: Mask interrupts at hardware initialization
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liang Hao <[email protected]>
[ Upstream commit aaf7766ba3b99a3834319e7cf939838afc705574 ]
GPIO interrupts may retain stale state across warm reboots when peripherals remain powered. If a GPIO line is not explicitly configured for interrupts, this can result in interrupt storms due to missing handlers.
Fix this by ensuring all interrupts are masked and disabled at hardware initialization time via the init_hw() callback. Pending interrupts are also cleared to start from a known-safe state.
Interrupts will be unmasked only when explicitly configured by userspace or kernel drivers.
--- drivers/gpio/gpio-dwapb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpio/gpio-dwapb.c +17 -0
@@ -200,6 +200,22 @@ static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)dwapb_write (gpio,GPIO_INT_POLARITY , pol); } +static int dwapb_irq_init_hw (struct gpio_chip *gc) +{ +struct dwapb_gpio *gpio =to_dwapb_gpio (gc); + +/* +* GPIO interrupts may retain stale state across warm reboots when +* peripherals stay powered. Force a known-safe state before the GPIO +* irqchip and irq domain are set up. +*/ +dwapb_write (gpio,GPIO_INTEN ,0 ); +dwapb_write (gpio,GPIO_INTMASK ,0xffffffff ); +dwapb_write (gpio,GPIO_PORTA_EOI ,0xffffffff ); + +return 0 ; +} +static u32 dwapb_do_irq (struct dwapb_gpio *gpio) {struct gpio_chip *gc = &gpio->ports[0 ].gc;
@@ -461,6 +477,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, girq = &gc->irq; girq->handler = handle_bad_irq; girq->default_type =IRQ_TYPE_NONE ; + girq->init_hw = dwapb_irq_init_hw; port->pirq = pirq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 296/1193 wifi: libipw: fix key index receive bound checks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 74ed3669f26803b1761c1f55403062bea44c3466 ]
libipw_rx() reads skb->data[hdrlen + 3] to extract the WEP key index in both the software-decrypt key selection path and the hardware-decrypted IV/ICV strip path. In both places the existing guard only checks skb->len >= hdrlen + 3, which proves bytes up to hdrlen + 2 but not the byte at hdrlen + 3.
Require hdrlen + 4 bytes before reading that item in both paths. This is a local source-boundary check only; it does not change the key index semantics.
--- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +2 -2
@@ -417,7 +417,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, ieee->host_mc_decrypt : ieee->host_decrypt;if (can_be_decrypted) { -if (skb->len >= hdrlen +3 ) { +if (skb->len >= hdrlen +4 ) {/* Top two-bits of byte 3 are the key index */ keyidx = skb->data[hdrlen +3 ] >>6 ; }
@@ -663,7 +663,7 @@ int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,int trimlen =0 ;/* Top two-bits of byte 3 are the key index */ -if (skb->len >= hdrlen +3 ) +if (skb->len >= hdrlen +4 ) keyidx = skb->data[hdrlen +3 ] >>6 ;/* To strip off any security data which appears before the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 297/1193 netfilter: ipset: mark the rcu locked areas properly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 5d0c22e73656d050daffad10a2ba8765ce8441c8 ]
When we bump the uref counter, there's no need to keep the rcu lock because the referred hash table can't disappear. Also, from the same reason in mtype_gc we need the rcu lock and not a spinlock.
--- net/netfilter/ipset/ip_set_hash_gen.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +5 -8
@@ -568,9 +568,10 @@ mtype_gc(struct work_struct *work) set = gc->set; h = set->data; -spin_lock_bh (&set->lock); - t =ipset_dereference_set (h->table, set); +rcu_read_lock_bh (); + t =rcu_dereference_bh (h->table);atomic_inc (&t->uref); +rcu_read_unlock_bh (); numof_locks =ahash_numof_locks (t->htable_bits); r = gc->region++;if (r >= numof_locks) {
@@ -579,7 +580,6 @@ mtype_gc(struct work_struct *work) next_run = (IPSET_GC_PERIOD (set->timeout) *HZ ) / numof_locks;if (next_run <HZ /10 ) next_run =HZ /10 ; -spin_unlock_bh (&set->lock);mtype_gc_do (set, h, t, r);
@@ -859,15 +859,13 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext, key =HKEY (value, h->initval, t->htable_bits); r =ahash_region (key);atomic_inc (&t->uref); +rcu_read_unlock_bh (); elements = t->hregion[r].elements; maxelem = t->maxelem;if (elements >= maxelem) {u32 e; -if (SET_WITH_TIMEOUT (set)) { -rcu_read_unlock_bh (); +if (SET_WITH_TIMEOUT (set))mtype_gc_do (set, h, t, r); -rcu_read_lock_bh (); - } maxelem = h->maxelem; elements =0 ;for (e =0 ; e <ahash_numof_locks (t->htable_bits); e++)
@@ -875,7 +873,6 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,if (elements >= maxelem &&SET_WITH_FORCEADD (set)) forceadd = true; } -rcu_read_unlock_bh ();spin_lock_bh (&t->hregion[r].lock); n =rcu_dereference_bh (hbucket (t, key));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 298/1193 wifi: rsi: validate beacon length before fixed buffer copy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 8ecdeb8b8a33b22c597299043c0dcfce50beb9ea ]
rsi_prepare_beacon() copies the mac80211 beacon frame after FRAME_DESC_SZ into a management skb whose usable tailroom may be smaller than MAX_MGMT_PKT_SIZE after alignment.
Validate the beacon length against the actual tailroom before the copy and skb_put(). Leave ownership of the management skb with the caller on error, matching the existing rsi_send_beacon() cleanup path.
--- drivers/net/wireless/rsi/rsi_91x_hal.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/rsi/rsi_91x_hal.c +8 -0
@@ -431,6 +431,7 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb)struct ieee80211_vif *vif;struct sk_buff *mac_bcn;u8 vap_id =0 , i; +unsigned int tailroom;u16 tim_offset =0 ;for (i =0 ; i <RSI_MAX_VIFS ; i++) {
@@ -480,6 +481,13 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb)if (mac_bcn->data[tim_offset +2 ] ==0 ) bcn_frm->frame_info |=cpu_to_le16 (RSI_DATA_DESC_DTIM_BEACON ); + tailroom =skb_tailroom (skb); +if (tailroom <FRAME_DESC_SZ || + mac_bcn->len > tailroom -FRAME_DESC_SZ ) { +dev_kfree_skb (mac_bcn); +return -EMSGSIZE ; + } +memcpy (&skb->data[FRAME_DESC_SZ ], mac_bcn->data, mac_bcn->len);skb_put (skb, mac_bcn->len +FRAME_DESC_SZ );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 299/1193 smb/client: reduce fallocate zero buffer allocation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huiwen He <[email protected]>
[ Upstream commit 9e4ec3be67af41ab859302d7109b34976efd9258 ]
The fallocate emulation allocates a 1 MiB zero-filled buffer even though each SMB2_write request is limited to SMB2_MAX_BUFFER_SIZE, which is 64 KiB. A high-order 1 MiB allocation is more likely to fail on a fragmented system.
Allocate only the smaller of the requested range and SMB2_MAX_BUFFER_SIZE, and reuse that zero-filled buffer for every write request. Also reject a successful write that makes no progress to avoid looping indefinitely.
This reduces the contiguous allocation required by fallocate emulation without changing the written data or range semantics.
--- fs/smb/client/smb2ops.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/smb/client/smb2ops.c +4 -3
@@ -3379,7 +3379,7 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, char *buf) {struct cifs_io_parms io_parms = {0 }; -int nbytes; +unsigned int nbytes;int rc =0 ;struct kvec iov[2 ];
@@ -3400,9 +3400,10 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, rc =SMB2_write (xid, &io_parms, &nbytes, iov,1 );if (rc)break ; +if (!nbytes) +return -EIO ;if (nbytes > len)return -EINVAL ; - buf += nbytes; off += nbytes; len -= nbytes; }
@@ -3432,7 +3433,7 @@ static int smb3_simple_fallocate_range(unsigned int xid,if (rc) goto out; - buf =kvzalloc (1024 *1024 ,GFP_KERNEL ); + buf =kvzalloc (min_t (loff_t, len,SMB2_MAX_BUFFER_SIZE ),GFP_KERNEL );if (buf ==NULL ) { rc = -ENOMEM ; goto out;
Signature · 1 line
2.53.0