summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-08-13s390/debug: Fix deadlock during unregisterPeter Oberparleiter
Unregistering an s390dbf debug area while one of the associated debugfs files is being written to can cause a deadlock: $ echo >.../vmur/level $ rmmod vmur =================================================== debugfs write debugfs_file_get() debug_unregister() mutex_lock(debug_mutex) debugfs_remove() wait for debugfs_file_put() debug_file_ops.write() debug_input() mutex_lock(debug_mutex) ==> DEADLOCK Fix this by splitting debug_unregister() into an s390dbf and debugfs part, and running only the s390dbf part with debug_mutex locked. Fixes: 9372a82892c2 ("s390/debug: fix debug area life cycle") Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-08-13s390/cpum_cf: Handle CPU hotplug via prepare/dead callbacksThomas Richter
The command 'perf stat -e cycles -- <command>' crashes the kernel when CPUs are hotplug added during that run. Root cause is the allocation of struct cpu_cf_events at first event initialization. The allocation is dynamic and the first event that has task context creates such a structure for each online CPU. This is not sufficient. CPUs may be offline during event creation and can be set online during the perf run time. For example commands # echo 0 > /sys/devices/system/cpu/cpu1/online # perf stat -e cycles -i -- stress-ng -t10s --matrix X # sleep 1 # echo 1 > /sys/devices/system/cpu/cpu1/online create an event for CPUs 0,2-X. Since the events are created with task-context, the scheduler will eventually schedule the program on CPU1. This CPU has not created and initialized any per CPU event infrastructure as that CPU was not online at the time of the perf invocation. Thus when the scheduler runs stress-ng on CPU1, the function cpumf_pmu_add() refers to a NULL pointer: struct cpu_cf_events *cpuhw = this_cpu_cfhw(); This function call is invoked after the task stress-ng has been made runnable on CPU1. And this_cpu_cfhw() returns NULL. The result is a panic: Unable to handle kernel pointer dereference in virtual kernel address space Failing address: 0000000000000000 TEID: 0000000000000483 .... Krnl PSW : 0404d00180000000 000003ef8291fd0c (cpumf_pmu_add+0x3c/0x80) .... Call Trace: [<000003ef8291fd0c>] cpumf_pmu_add+0x3c/0x80 [<000003ef82bb5e3e>] event_sched_in+0xae/0x190 [<000003ef82bb60d6>] merge_sched_in+0x1b6/0x390 [<000003ef82bb65b8>] visit_groups_merge.constprop.0.isra.0+0x308/0x5b0 [<000003ef82bb689a>] pmu_groups_sched_in+0x3a/0x50 [<000003ef82bb6a30>] ctx_sched_in+0x180/0x260 [<000003ef82bb780c>] perf_event_context_sched_in+0x11c/0x2d0 [<000003ef82bb79ee>] __perf_event_task_sched_in+0x2e/0xc0 [<000003ef82994834>] finish_task_switch.isra.0+0x1a4/0x250 .... Last Breaking-Event-Address: [<000003ef8291f1d8>] this_cpu_cfhw+0x38/0x40 The issue arises only in per-task context when the CPUMF facility is used and the scheduler picks a random CPU for such a process to run on. The scheduler enables the CPUMF infrastructure via PMU callback functions pmu::add() and pmu::del(). Introduce a CPU hotplug prepare/dead callback pair which creates and removes the per CPU counter data while the CPU is offline. Count the users which track every CPU (cpu == -1), that is perf_event_open() events with task context and /dev/hwctr device sessions, in the new counter cpu_cf_root::tskcnt, protected by pmc_reserve_mutex. This ensures the infrastructure is available when new CPU is selected to run the per-task context process. In cpum_cf_free_root() and cpum_cf_free_cpu() ensure the reference pointer to data structures is set to NULL before the data is freed to prevent interrupt handlers to access stale data. [gor@linux.ibm.com: change commit message] Fixes: 9b9cf3c77e7e ("s390/cpum_cf: rework PER_CPU_DEFINE of struct cpu_cf_events") Cc: stable@vger.kernel.org # v6.5+ Suggested-by: Heiko Carstens <hca@linux.ibm.com> Suggested-by: Christian Borntraeger <borntraeger@linux.ibm.com> Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2026-08-13ASoC: amd: acp: pass audio_drv_data to dma_irq_handlerRosen Penev
The IRQ handler only needs the audio_drv_data, so pass it directly as the request_irq argument instead of the device pointer and a dev_get_drvdata() lookup. Assisted-by: opencode:deepseek-v4-flash-free Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260811041925.25016-1-rosenp@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Restructure to support deferrable card bindingMark Brown
Chancel Liu <chancel.liu@nxp.com> says: The ASoC core has evolved over several kernel releases to support deferrable card binding: when a component is not yet available, devm_snd_soc_register_card() no longer propagates -EPROBE_DEFER back to the machine driver. Instead the card is placed on an internal deferred list and rebound automatically once the missing component registers. As a result, registering a sound card no longer guarantees that all CPU and codec components have already probed successfully. This exposed two regressions in fsl-asoc-card: 1. The machine driver caches codec MCLK rate during probe(). On platforms where the MCLK is derived from the CPU DAI clock and its final rate is applied via assigned-clocks in the CPU DAI node, probing before the CPU DAI driver completes leaves fsl-asoc-card with a stale mclk_freq. 2. If a card defers due to a missing component, it queues the card onto the unbind_card_list and returns 0. The driver then proceeds to call simple_util_init_jack(). At this point, the snd_card pointer is NULL. Patch 1 drops mclk management for nau8822 from this machine driver. Patch 2 is a pure refactoring with no functional change. the large if/else chain of of_device_is_compatible() calls in probe() is replaced by a platform data table approach. Patch 3 moves all component-dependent initialisation and jacks out of probe() and into late_probe(), which is the correct place under the deferrable binding model. Link: https://patch.msgid.link/20260810093834.1511749-1-chancel.liu@oss.nxp.com
2026-08-13ASoC: fsl-asoc-card: Move bound-component setup to late_probeChancel Liu
Move all operations that require bound codec and CPU DAI components out of probe() and into late_probe(), which is the correct place for them now that ASoC supports deferrable card binding. late_probe() may be called multiple times after an unbind/rebind cycle, so every initialization step is guarded accordingly. Three new helpers are introduced: - fsl_asoc_card_init_cpu() CPU DAI-specific setup. Previously done in probe() while CPU DAI component maybe not ready. - fsl_asoc_card_init_codecs() Reads codec MCLK rates from the bound component devices, invokes the per-compatible pdata->codec_init callback if present. - fsl_asoc_card_init_jack() Registers headphone and microphone jacks. The call site of codec_init callbacks moves from probe() to fsl_asoc_card_init_codecs(), which runs in late_probe() after the bound codec device is known. This makes sure codecs can get proper MCLK. The old card-name fallback depended on codec_dev_name[], which required looking up the codec device in probe(). This is no longer valid under deferrable card binding because the codec component may not have probed yet. Since the DT binding requires "model", remove the fallback and fail with a clear error. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-4-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Move static compatible data to platform dataChancel Liu
Replace the large if/else chain of of_device_is_compatible() calls in probe() with a table-driven approach. Each compatible string now has a corresponding static const struct fsl_asoc_card_pdata descriptor stored in the of_device_id .data field. probe() calls of_device_get_match_data() once and reads all per-compatible configuration from the returned pointer: - DAI format - CPU SYSCLK direction and ratio overrides - TDM slot width - Codec DAI name, MCLK id, FLL/PLL ids, PLL S24 ratio - playback_only / capture_only direction restrictions - Default DAPM route table - Excluded PCM format mask (for SAI + WM8960/WM8962) - Optional probe_init callback (SPDIF multi-codec discovery) - Optional codec_init callback (codec-specific post-probe logic) This patch is a pure refactoring, no functional change is intended. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-3-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: fsl-asoc-card: Drop mclk management for nau8822Chancel Liu
commit 93f12a7568269 ("ASoC: nau8822: add MCLK support") added MCLK handling directly in the nau8822 codec driver. The machine driver no longer needs to acquire and enable the codec MCLK on its behalf. Remove MCLK management in this machine driver that was introduced by commit 1075df4bdeb32 ("ASoC: fsl-asoc-card: add nau8822 support"). This avoids a potential double-enable and removes clock resource management from the machine driver where it does not belong. Additionally, the sound card may be unbound and rebound multiple times during its lifetime. Managing a codec clock resource in the machine driver would require careful cleanup in the card remove path to avoid reference count leaks. Leaving clock management to the codec driver, which has the same lifetime as the codec device, is the correct ownership model. The nau8822 compatible entry, DAI name, and PLL/FLL clock ID configuration are kept unchanged. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260810093834.1511749-2-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: Simplify probe error handlingMark Brown
bui duc phuc <phucduc.bui@gmail.com> says: This series simplifies probe error handling across Rockchip ASoC drivers. It replaces open-coded error handling with dev_err_probe() where appropriate, removes redundant probe error messages, returns the original error code directly, and fixes handling of -EPROBE_DEFER returned by platform_get_irq_optional() in the Rockchip SAI driver and devm_pinctrl_get() in the Rockchip I2S driver. Compile tested only. Link: https://patch.msgid.link/20260806052136.21034-1-phucduc.bui@gmail.com
2026-08-13ASoC: rockchip: spdif: Return the original error codebui duc phuc
Return the original error code directly and drop the redundant error message since the called function already reports the failure. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-15-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_sai: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-14-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_sai: Return the original error codebui duc phuc
Return the original error code directly and drop the redundant error message since the called function already reports the failure. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-13-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_sai: Propagate -EPROBE_DEFER from IRQ lookupbui duc phuc
Return -EPROBE_DEFER from platform_get_irq_optional() so the driver is re-probed when the interrupt resource becomes available instead of continuing probe without an IRQ. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-12-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_rt5645: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-11-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_pdm: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-10-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_max98090: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-9-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: i2s-tdm: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-8-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: i2s-tdm: Inline PTR_ERR() in dev_err_probe()bui duc phuc
Pass PTR_ERR() directly to dev_err_probe() and avoid assigning it to the local variable first. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-7-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_i2s: Propagate -EPROBE_DEFER from devm_pinctrl_get()bui duc phuc
Return -EPROBE_DEFER from devm_pinctrl_get() instead of ignoring it and continuing probe. This allows the driver to be reprobed once the pinctrl provider becomes available. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-6-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_i2s: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-5-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rockchip_i2s: Use dev_err_probe() for error handlingbui duc phuc
Replace dev_err() with dev_err_probe() to prevent log spam when probe returns -EPROBE_DEFER. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-4-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rk3288_hdmi_analog: Use dev_err_probe() for error handlingbui duc phuc
Replace dev_err() with dev_err_probe() to prevent log spam when probe returns -EPROBE_DEFER. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-3-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: rockchip: rk3288_hdmi_analog: Drop redundant probe error messagesbui duc phuc
Remove the probe error messages to avoid duplicate error reporting, since the error is already reported by the called functions. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Link: https://patch.msgid.link/20260806052136.21034-2-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-13ASoC: meson: Drop __force castTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop a superfluous cast. Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-15-tiwai@suse.de
2026-08-13ASoC: mediatek: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-14-tiwai@suse.de
2026-08-13ASoC: Intel: avs: Drop __force castTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop a superfluous cast. Acked-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-13-tiwai@suse.de
2026-08-13ASoC: fsl: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-12-tiwai@suse.de
2026-08-13ALSA: emu10k1: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for control parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-11-tiwai@suse.de
2026-08-13ALSA: asihpi: Drop __force castTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop a superfluous cast. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-10-tiwai@suse.de
2026-08-13ALSA: hda: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM and control parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-9-tiwai@suse.de
2026-08-13ALSA: aloop: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-8-tiwai@suse.de
2026-08-13ALSA: kunit: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-7-tiwai@suse.de
2026-08-13ALSA: oss: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-6-tiwai@suse.de
2026-08-13ALSA: control: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for control parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-5-tiwai@suse.de
2026-08-13ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBITTakashi Iwai
Avoid macros to define SNDRV_PCM_FMTBIT_* and SNDRV_PCM_SUBFMTBIT_* contants but use plain bit shifts, instead. This allows bindgen and other tools aware of those definitions. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-4-tiwai@suse.de
2026-08-13ALSA: pcm: Drop __force castsTakashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly __force prefix. Simply drop those superfluous casts. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-3-tiwai@suse.de
2026-08-13ALSA: uapi: Drop __bitwise and __force prefixTakashi Iwai
We've used __bitwise and __force for some integer parameters for sanity-checks via sparse, with a hope that it'll reduce the misuse or incorrect assignments. This worked in principle, but OTOH, it's been quite a PITA, making the code much uglier than its gain, too, because one had to cast with __force everywhere. Also, Rust-binding would skip those defines because of __force usage, which will become more pains in near future. So let's drop __bitwise and __force prefix usages. In this patch, we start cleaning up the UAPI headers at first. The former bit-wised typedefs are still kept for compatibility for now. As it's only markers for sparse, the changes are absolutely safe, per se. Only that we'll need to watch out more carefully about the variable usage for PCM format type, etc. Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260812060557.80445-2-tiwai@suse.de
2026-08-13Merge tag 'firewire-fixes-7.2-final' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394 Pull firewire fix from Takashi Sakamoto: "Fix a NULL pointer dereference in 1394 OHCI PCI driver when probe() returns early with an error, as detected by Syzkaller" * tag 'firewire-fixes-7.2-final' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: ohci: fix NULL pointer dereference in ar_context_release
2026-08-13Merge tag 'gpio-fixes-for-v7.2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fixes from Bartosz Golaszewski: - use raw_spinlock_t in gpio-ml-ioh to avoid locking context issues - fix a race condition in gpio-ml-ioh by sharing the register locks across channels - fix a use-after-free bug in unbind path in gpio-sloppy-logic-analyzer * tag 'gpio-fixes-for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: sloppy-logic-analyzer: fix use-after-free via debugfs trigger on unbind gpio: ml-ioh: share the register lock across channels gpio: ml-ioh: use raw_spinlock_t for the register lock gpiolib: Check gc->get_direction() before calling gpiod_get_direction()
2026-08-13s390/vfio-ap: Fix NULL deref in status_show() during queue probeAnthony Krowiak
When vfio_ap_mdev_probe_queue() creates the sysfs attribute group, the queue's driver data has not yet been set. A concurrent read of the 'status' attribute can therefore call dev_get_drvdata() and get NULL, which is then passed directly to vfio_ap_mdev_for_queue() where q->apqn is unconditionally dereferenced, causing a NULL pointer dereference. Fix this by acquiring the update locks before calling sysfs_create_group(). The status_show() function acquires guests_lock before reading the driver data, so any concurrent read will block until after dev_set_drvdata() has been called and the update locks are released. As a bonus, the APQN no longer needs to be read from the queue struct after allocation — it can be read directly from apdev before allocation and stored in a local variable, which is then assigned to q->apqn once the allocation succeeds. Fixes: 260f3ea141382 ("s390/vfio-ap: move probe and remove callbacks to vfio_ap_ops.c") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix hot-unplug skipped when last AP adapter or domain removedAnthony Krowiak
The vfio_ap_mdev_hot_unplug_cfg() function uses the return value of bitmap_andnot() to determine whether the guest APCB needs to be updated. However, bitmap_andnot() returns false when the resulting destination bitmap is empty. This means that if the only adapter, domain or control domain assigned to an mdev is removed from the host's AP configuration, the bit is correctly cleared from the shadow APCB, but bitmap_andnot() returns false because the result is an empty bitmap. Consequently, do_hotplug remains 0 and vfio_ap_mdev_update_guest_apcb() is never called, leaving the KVM guest with stale hardware access to the unplugged AP devices. Fix this by replacing the bitmap_andnot() return value check with bitmap_intersects() to determine whether the shadow APCB actually overlaps with the removal mask. If there is an intersection, call bitmap_andnot() solely for its side effect of clearing the bits, then unconditionally set do_hotplug to trigger the guest APCB update. Fixes: eeb386aeb5b7c ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: fix potential use of uninitialized apm_filtered bitmapAnthony Krowiak
The DECLARE_BITMAP(apm_filtered, AP_DEVICES) macro allocates the bitmap on the stack without zero-initializing it. In vfio_ap_mdev_hot_plug_cfg(), the vfio_ap_mdev_filter_matrix() function is only called to initialize and populate apm_filtered if either filter_adapters or filter_domains is true. If the hot plug configuration change only adds control domains (meaning filter_cdoms is true, but filter_adapters and filter_domains are both false), vfio_ap_mdev_filter_matrix() is bypassed. Consequently, apm_filtered is passed to reset_queues_for_apids() with uninitialized stack garbage. This can cause reset_queues_for_apids() to interpret arbitrary stack garbage bits as valid APIDs to reset, potentially performing unintended guest hardware queue resets. Fix this by zero-initializing the apm_filtered bitmap at the beginning of vfio_ap_mdev_hot_plug_cfg() using bitmap_zero(). Fixes: eeb386aeb5b7c ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix control domain removal in vfio_ap_mdev_cfg_removeAnthony Krowiak
The vfio_ap_config_remove function uses the bitmap_andnot function to clear bits from the matrix_mdev->matrix.adm bitmap (specifies the control domains assigned to the mdev). This prevents the explicitly unplugged control domains from being removed the KVM guest. The bitmap_and function is used instead. Fixes: eeb386aeb5b7c ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix required lock not held during update of ap_matrix_mdev objectAnthony Krowiak
In the vfio_ap_mdev_cfg_add function, the apm_add, aqm_add and adm_add fields of an ap_matrix_mdev object fields are modified while not holding the matrix_dev->mdevs_lock. This lock must be held while making these to guard against a race condition with another caller that may be concurrently modifying these fields or any of the fields in the matrix_mdev->matrix. Fixes: eeb386aeb5b7c ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix missing lock required to access list of ap_matrix_mdev objectsAnthony Krowiak
In order to traverse or add/remove ap_matrix_mdev objects in the matrix_dev->mdev_list, the matrix_dev->guests_lock mutex must be held. There are two functions that access the list without holding the mutex: vfio_ap_mdev_probe function ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The vfio_ap_mdev_probe function uses the matrix_dev->mdevs_lock mutex to guard the add of a newly created ap_matrix_mdev object to the matrix_dev->mdev_list. This mutex does not protect list access; its purpose is to guard against concurrent access to fields contained in an ap_matrix_mdev object. This could lead to kernel memory corruption or use-after-free if another mdev is created or removed concurrently. The adding of an ap_matrix_mdev object to matrix_dev->mdev_list is now guarded by the matrix_dev->guests_lock which is the correct way to protect against concurrent mdev_list access. Also removed the following two lines of code because the matrix_mdev is allocated via vfio_alloc_device macro which uses kzalloc, so req_trigger and cfg_chg_trigger are already zero-initialised when the struct is allocated before the call to vfio_register_emulated_iommu_dev. This prevents a window whereby these triggers are set to NULL after the device is exposed to userspace. matrix_mdev->req_trigger = NULL; matrix_mdev->cfg_chg_trigger = NULL; vfio_ap_mdev_for_queue function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The status_show function that supports display of the status attribute of the devices in /sys/bus/ap/devices calls the vfio_ap_mdev_for_queue function which iterates the matrix_dev->mdev_list to find the object representing the queue device whose status is to be displayed. In order to traverse this list, the matrix_dev->guests_lock mutex must be held. To fix this, the guests_lock mutex is taken prior to taking the matrix_dev->mdevs_lock mutex in the status_show function. It is taken there rather than the vfio_ap_mdev_for_queue function - where it is needed - because it must be taken prior to the mdevs_lock mutex in order to adhere to the proper locking order and prevent a lockdep splat; also because the mdevs_lock is needed there to access fields within the matrix_mdev object in that function. See the vfio-ap-locking.rst in the linux kernel tree. Fixes: 2c1ee8983aa3 ("s390/vfio-ap: prepare for dynamic update of guest's APCB on queue probe/remove") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix dereference matrix_mdev->kvm without checking for NULLAnthony Krowiak
The ap_driver structure has two fields which are function pointers to callbacks: * .on_config_changed: called at the start of the AP bus scan function to notify the device driver that the host AP configuration has changed and the associated AP devices will be added or removed accordingly. This gives the implementor a chance to evaluate the configuration changes and respond to them before the associated devices are added or removed. * .on_scan_complete: Called at the end of the AP bus scan function to notify the device driver that the host AP configuration has changed and the AP devices have been added or removed accordingly. This gives the implementor the opportunity to respond to the changes after the associated devices are added or removed. These two callbacks are implemented in the vfio_ap device driver via the vfio_ap_on_cfg_changed and vfio_ap_on_scan_complete functions respectively. Within the call stack of these two callback functions the matrix_mdev->kvm->lock mutex is taken without checking whether matrix_mdev->kvm is NULL or not. If matrix_mdev->kvm has never been set, trying to take the lock will trigger a NULL pointer dereference. This patch adds checks for matrix_mdev->kvm == NULL before taking the matrix_mdev->kvm->lock mutex. Note that the matrix_mdev->kvm->lock mutex taken in the vfio_ap_mdev_hot_plug_config function is moved to the calling function along with the matrix_dev->mdevs_lock which is needed there to access the fields of the matrix_mdev. It makes little sense to make the change the check for matrix_mdev->kvm there before taking the kvm->lock mutex only to have to move it out via another patch, so it is done in this patch. It is important to make note of the following: 1. The matrix_dev->guests_lock is acquired at the start of both callback functions. This ensures that matrix_mdev will not be removed via the vfio_ap_mdev_remove function because it too takes matrix_dev_guests_lock before removing the object; so, matrix_mdev will be available for the duration of the callback functions. 2. The matrix_dev->mdevs_lock mutex must be taken in order to access fields within the matrix_mdev structure 3. matrix_mdev->kvm->lock mutex must be taken before the matrix_dev->mdevs_lock to prevent a lockdep splat. 4: The kvm->lock must be held while plugging the guest's AP configuration into its SIE state description via the vfio_ap_mdev_update_guest_apcb function. 5. The vfio_ap_mdev_update_guest_apcb checks matrix_mdev->kvm to verify it is not NULL before doing the hot plug of the guest's AP configuration. Fixes: eeb386aeb5b7c ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13s390/vfio-ap: Fix stale do_remove flag across iterations in ↵Anthony Krowiak
vfio_ap_mdev_cfg_remove The do_remove flag in vfio_ap_mdev_cfg_remove() is initialised to zero before the loop that iterates over the list of matrix mdevs, but is never reset at the start of each iteration. Since do_remove is OR-accumulated across iterations, a positive result from one mdev carries over to subsequent mdevs. The fix is to set the do_remove flag with the first call to bitmap_and; for example: do_remove = bitmap_an rather than do_remove |= bitmap_and. Fixes: eeb386aeb5b7 ("s390/vfio-ap: handle config changed and scan complete notification") Cc: stable@vger.kernel.org Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
2026-08-13Merge tag 'm68k-for-v7.2-tag2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k Pull m68k fix from Geert Uytterhoeven: "Define NR_CPUS to 1. This fixes a long-standing but never critical before oddity on m68k, that turned into a serious configuration issue after a recent erofs change" * tag 'm68k-for-v7.2-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Define NR_CPUS to 1
2026-08-13drm/log: Fix infinite loop when scale is too large for displayShixiong Ou
When scale is large enough that scaled_font exceeds the display dimensions, rows or columns become 0. A columns value of 0 causes an infinite loop in drm_log_draw_kmsg_record() because the loop never decrements len. Check for zero rows/columns in drm_log_setup_modeset() and return an error, cleaning up the already allocated buffer to avoid a leak. Fixes: 8a4b913df427 ("drm/log: Add integer scaling support") Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260729084815.692944-1-oushixiong1025@163.com Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2026-08-13drm/log: Fix out-of-bounds read on empty message lengthShixiong Ou
drm_log_draw_kmsg_record() accesses s[len - 1] to strip the trailing newline, but len is unsigned int. If len is 0, the subtraction wraps to UINT_MAX, causing an out-of-bounds read. Add an early return when len is 0. Fixes: 25e2c2a3eff5 ("drm/log: Color the timestamp, to improve readability") Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260729084520.688087-1-oushixiong1025@163.com Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2026-08-13drm/log: Fix division by zero when scale module parameter is 0Shixiong Ou
The scale module parameter can be set to 0 via kernel command line. When scale is 0, scaled_font_h and scaled_font_w become 0, causing a division by zero in the rows/columns calculation. Since the scale module parameter is read-only (0444 permissions), it cannot be changed at runtime via sysfs. Clamp it to 1 once in drm_log_register(). Fixes: 8a4b913df427 ("drm/log: Add integer scaling support") Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260730014440.66323-1-oushixiong1025@163.com Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>