id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
1478a34470bf4755465d29b348b24a610bccc180
Analyze and fix the following issue in the Linux kernel code: drm/amd: Set minimum version for set_hw_resource_1 on gfx11 to 0x52
Problem Details: commit f81cd793119e ("drm/amd/amdgpu: Fix MES init sequence") caused a dependency on new enough MES firmware to use amdgpu. This was fixed on most gfx11 and gfx12 hardware with commit 0180e0a5dd5c ("drm/amdgpu/mes: add compatibility checks for set_hw_resource_1"), but this left out that GC 11.0.4 had ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 3a52754b5cad..ceddc953785f 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -1671,7 +1671,7 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block) if...
0274a54897f356f9c78767c4a2a5863f7dde90c6
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: extend delta clamping logic to CM3 LUT helper
Problem Details: Commit 27fc10d1095f ("drm/amd/display: Fix the delta clamping for shaper LUT") fixed banding when using plane shaper LUT in DCN10 CM helper. The problem is also present in DCN30 CM helper, fix banding by extending the same bug delta clamping fix to CM3. Signed-off-by: Melissa Wen <mwen@igalia.com> Re...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c index a4f14b16564c..227aa8672d17 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c @@ -105,9 +105,12 @@ void...
5006505b19a2119e71c008044d59f6d753c858b9
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: fix wrong color value mapping on MCM shaper LUT
Problem Details: Some shimmer/colorful points appears when using the steamOS color pipeline for HDR on gaming with DCN32. These points look like black values being wrongly mapped to red/blue/green values. It was caused because the number of hw points in regular LUTs and in a shaper LUT was treated as the same. DCN3+ r...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c index 0690c346f2c5..a4f14b16564c 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c @@ -163,6 +163,11 @@ bool...
6ba60345f45eaf7cb4f89105d26083a4b9fd1cba
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Fix double deletion of validate_list
Problem Details: If amdgpu_amdkfd_gpuvm_free_memory_of_gpu() fails after kgd_mem is removed from validate_list, the mem handle still lingers in the KFD idr. This means when process is terminated, kfd_process_free_outstanding_kfd_bos() will call amdgpu_amdkfd_gpuvm_free_memory_of_gpu() again resulting in double deletion...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 768998c82b43..00ea69baa126 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1924,21 +1924,21 @@ int amdgpu_amdkfd_gpuvm_f...
97a9689300eb2b393ba5efc17c8e5db835917080
Analyze and fix the following issue in the Linux kernel code: Revert "drm/amd: Check if ASPM is enabled from PCIe subsystem"
Problem Details: This reverts commit 7294863a6f01248d72b61d38478978d638641bee. This commit was erroneously applied again after commit 0ab5d711ec74 ("drm/amd: Refactor `amdgpu_aspm` to be evaluated per device") removed it, leading to very hard to debug crashes, when used with a system with two AMD GPUs of which only on...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d6d0a6e34c6b..95d26f086d54 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2405,9 +2405,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, return -E...
4a0f94dfef34745a380a93b3a764d82e0ff840f4
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Promote DC to 3.2.368
Problem Details: This version brings along following fixes: - Migrate DCCG register access from hwseq to dccg component. - Add lpddr5 handling to dml2.1 - Correct external pr fsm control - Make DCN35 OTG disable w/a reusable - Make DSC FGCG a DSC block level function - Make some DCN35 DCCG symbols reusable - Fix writeb...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index ce2eceba2ab7..fdfcfa416d16 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -63,7 +63,7 @@ struct dcn_dsc_reg_state; struct dcn_optc_reg_state; struct dcn_dccg_reg_state; ...
22bd5f691665b3d427d21db077698d580a5e5266
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: DIO memory leak fix.
Problem Details: [why] Allocated memory for dcn10_dio but not freed in dcn401_resource. [how] Add kfree for it in dcn401_resource. Reviewed-by: Aric Cyr <aric.cyr@amd.com> Signed-off-by: Bhuvanachandra Pinninti <bpinnint@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd....
```diff diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c index df3acf589582..4875faffe873 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn...
c2d2ccc85faf8cc6934d50c18e43097eb453ade2
Analyze and fix the following issue in the Linux kernel code: drm/amd: Set minimum version for set_hw_resource_1 on gfx11 to 0x52
Problem Details: commit f81cd793119e ("drm/amd/amdgpu: Fix MES init sequence") caused a dependency on new enough MES firmware to use amdgpu. This was fixed on most gfx11 and gfx12 hardware with commit 0180e0a5dd5c ("drm/amdgpu/mes: add compatibility checks for set_hw_resource_1"), but this left out that GC 11.0.4 had ...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 81bf9385d55a..09ebb13ca5e8 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -1673,7 +1673,7 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block) if...
9d6bd60695806782bec8562ab73aefafce067f05
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix a NULL pointer dereference in dcn20_hwseq.c
Problem Details: [why] hws->funcs.dccg_init is accessed without checking if it is NULL, which may lead to a NULL pointer dereference. [how] Add a NULL check before calling dccg_init. Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Wayne Li...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c index 87a1dc27def4..307e8f8060e6 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c @@ -3140,7 +3140,8 @@...
e121ccca8a4a5dd6fb5d395de6ef31ebfce7fb38
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix IGT ILR link training failure on Replay panel
Problem Details: [Why & How] Fix the IGT ilr_link-training-configs test failure by directly using the supported link rates from DPCD. Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 5fb573214f18..cfe35442dfcb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -46,6 +46,...
bb4099c7d90043673c8089ae1dce0d6c7d393f13
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix IGT link training failure on Replay panel
Problem Details: [Why] IGT link-training-configs test fails to set the link rate on Replay panels because some link rate types are not supported in debugfs. As a result, debugfs treats these link rates as invalid, causing the IGT test to fail. [How] Add missing link rate types to resolve this issue. Reviewed-by: Chia...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index b9ed29ec60dc..5fb573214f18 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -302,8 +30...
9ef84a307582a92ef055ef0bd3db10fd8ac75960
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Fix writeback on DCN 3.2+
Problem Details: [WHAT] 1. Set no scaling for writeback as they are hardcoded in DCN3.2+. 2. Set no fast plane update for writeback commits. Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.whee...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0b4fc654e76f..56332f3f95ef 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -10662,10 +10662,10 @@ static void dm_set_...
31b153315b8702d0249aa44d83d9fbf42c5c7a79
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: ensure no_hw_access is visible before MMIO
Problem Details: Add a full memory barrier after clearing no_hw_access in amdgpu_device_mode1_reset() so subsequent PCI state restore access cannot observe stale state on other CPUs. Fixes: 7edb503fe4b6 ("drm/amd/pm: Disable MMIO access during SMU Mode 1 reset") Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index c7f44422939f..c1ffc63e23ab 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -5733,6 +5733,9 @@ int amdgpu_device_mode1_reset(struct amdgpu_device ...
5c9ecd8e6437cd55a38ea4f1e1d19cee8e226cb8
Analyze and fix the following issue in the Linux kernel code: PM: sleep: wakeirq: harden dev_pm_clear_wake_irq() against races
Problem Details: dev_pm_clear_wake_irq() currently uses a dangerous pattern where dev->power.wakeirq is read and checked for NULL outside the lock. If two callers invoke this function concurrently, both might see a valid pointer and proceed. This could result in a double-free when the second caller acquires the lock an...
```diff diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index 8aa28c08b289..c0809d18fc54 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -83,13 +83,16 @@ EXPORT_SYMBOL_GPL(dev_pm_set_wake_irq); */ void dev_pm_clear_wake_irq(struct device *dev) { - struct wake...
1fedbb589448bee9f20bb2ed9c850d1d2cf9963c
Analyze and fix the following issue in the Linux kernel code: cpufreq: intel_pstate: Enable asym capacity only when CPU SMT is not possible
Problem Details: According to the description in the intel_pstate.rst documentation, Capacity-Aware Scheduling and Energy-Aware Scheduling are only supported on a hybrid processor without SMT. Previously, the system used sched_smt_active() for judgment, which is not a strict condition because users can switch it on or ...
```diff diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index ec4abe374573..1625ec2d0d06 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1161,7 +1161,7 @@ static void hybrid_init_cpu_capacity_scaling(bool refresh) * the capacity of SMT threads is not ...
8c5b40678c63be6b85f1c2dc8c8b89d632faf988
Analyze and fix the following issue in the Linux kernel code: libperf build: Always place libperf includes first
Problem Details: When building tools/perf the CFLAGS can contain a directory for the installed headers. As the headers may be being installed while building libperf.a this can cause headers to be partially installed and found in the include path while building an object file for libperf.a. The installed header may re...
```diff diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile index 9692d0742ed0..32301a1d8f0c 100644 --- a/tools/lib/perf/Makefile +++ b/tools/lib/perf/Makefile @@ -50,9 +50,9 @@ INCLUDES = \ -I$(srctree)/tools/include/uapi # Append required CFLAGS +override CFLAGS := $(INCLUDES) $(CFLAGS) override CFLAG...
b126097b0327437048bd045a0e4d273dea2910dd
Analyze and fix the following issue in the Linux kernel code: i2c: imx: preserve error state in block data length handler
Problem Details: When a block read returns an invalid length, zero or >I2C_SMBUS_BLOCK_MAX, the length handler sets the state to IMX_I2C_STATE_FAILED. However, i2c_imx_master_isr() unconditionally overwrites this with IMX_I2C_STATE_READ_CONTINUE, causing an endless read loop that overruns buffers and crashes the system...
```diff diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index dcce882f3eba..85f554044cf1 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1103,7 +1103,8 @@ static irqreturn_t i2c_imx_master_isr(struct imx_i2c_struct *i2c_imx, unsigned i case IMX_I2C_STATE_REA...
bc8dedae022ce3058659c3addef3ec4b41d15e00
Analyze and fix the following issue in the Linux kernel code: ceph: fix oops due to invalid pointer for kfree() in parse_longname()
Problem Details: This fixes a kernel oops when reading ceph snapshot directories (.snap), for example by simply running `ls /mnt/my_ceph/.snap`. The variable str is guarded by __free(kfree), but advanced by one for skipping the initial '_' in snapshot names. Thus, kfree() is called with an invalid pointer. This patch...
```diff diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index 0ea4db650f85..9a115282f67d 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c @@ -166,12 +166,13 @@ static struct inode *parse_longname(const struct inode *parent, struct ceph_vino vino = { .snap = CEPH_NOSNAP }; char *name_end, *inode_number; int r...
39125eaf8863ab09d70c4b493f58639b08d5a897
Analyze and fix the following issue in the Linux kernel code: drm/xe/pm: Disable D3Cold for BMG only on specific platforms
Problem Details: Restrict D3Cold disablement for BMG to unsupported NUC platforms, instead of disabling it on all platforms. Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> Fixes: 3e331a6715ee ("drm/xe/pm: Temporarily disable D3Cold on BMG") Link: https://patch.msgid.link/20260123173238.1642383-1-karthik.poosa@...
```diff diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 559cf5490ac0..01185f10a883 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -8,6 +8,7 @@ #include <linux/fault-inject.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> +#include <linux/dmi.h> #i...
36c0de02575ce59dfd879eb4ef63d53a68bbf9ce
Analyze and fix the following issue in the Linux kernel code: perf/arm-cmn: Reject unsupported hardware configurations
Problem Details: So far we've been fairly lax about accepting both unknown CMN models (at least with a warning), and unknown revisions of those which we do know, as although things do frequently change between releases, typically enough remains the same to be somewhat useful for at least some basic bringup checks. Howe...
```diff diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 651edd73bfcb..4fbafc4b7984 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -2422,6 +2422,15 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADD...
283182c1c239f6873d1a50e9e710c1a699f2256b
Analyze and fix the following issue in the Linux kernel code: perf: arm_spe: Properly set hw.state on failures
Problem Details: When arm_spe_pmu_next_off() fails to calculate a valid limit, it returns zero to indicate that tracing should not start. However, the caller arm_spe_perf_aux_output_begin() does not propagate this failure by updating hwc->state, cause the error to be silently ignored by upper layers. Because hwc->sta...
```diff diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index 4801115f2b54..5410fb7428d0 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -106,6 +106,8 @@ struct arm_spe_pmu { /* Keep track of our dynamic hotplug state */ static enum cpuhp_state arm_spe_pmu_online; +s...
750817a7c41de083ca5d73052e97bb7b67d7c394
Analyze and fix the following issue in the Linux kernel code: accel/amdxdna: Fix incorrect error code returned for failed chain command
Problem Details: The driver currently returns an incorrect error code when a chain command fails. In this case, ERT_CMD_STATE_ERROR is expected to be reported for failed chain commands. Fixes: aac243092b70 ("accel/amdxdna: Add command execution") Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Reviewed-by: M...
```diff diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index ad5b5cd0bc81..fe8f9783a73c 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -274,7 +274,7 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size) ret = -EINV...
b853007fdcdd64b49601a993c2b30c28279ae15d
Analyze and fix the following issue in the Linux kernel code: accel/amdxdna: Remove hardware context status
Problem Details: One newly supported command does not require hardware context configuration to be performed upfront. As a result, checking hardware context status causes this command to fail incorrectly. Remove hardware context status handling entirely. For other commands, if userspace submits a request without confi...
```diff diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index c4a58c00e442..ad5b5cd0bc81 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -47,17 +47,6 @@ static void aie2_job_put(struct amdxdna_sched_job *job) kref_put(&job->refcnt, aie2_job_rele...
124bdc6eccc8c5cba68fee00e01c084c116c4360
Analyze and fix the following issue in the Linux kernel code: ALSA: usb-audio: fix broken logic in snd_audigy2nx_led_update()
Problem Details: When the support for the Sound Blaster X-Fi Surround 5.1 Pro was added, the existing logic for the X-Fi Surround 5.1 in snd_audigy2nx_led_put() was broken due to missing *else* before the added *if*: snd_usb_ctl_msg() became incorrectly called twice and an error from first snd_usb_ctl_msg() call ignore...
```diff diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index f8eccb1c58da..cf4ccf467cb6 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -311,13 +311,8 @@ static int snd_audigy2nx_led_update(struct usb_mixer_interface *mixer, if (pm.err < 0) return pm.err; - if (chip->usb...
26aa5295010ffaebcf8f1991c53fa7cf2ee1b20d
Analyze and fix the following issue in the Linux kernel code: remoteproc: imx_rproc: Fix invalid loaded resource table detection
Problem Details: imx_rproc_elf_find_loaded_rsc_table() may incorrectly report a loaded resource table even when the current firmware does not provide one. When the device tree contains a "rsc-table" entry, priv->rsc_table is non-NULL and denotes where a resource table would be located if one is present in memory. Howe...
```diff diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 375de79168a1..f5f916d67905 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -729,6 +729,10 @@ imx_rproc_elf_find_loaded_rsc_table(struct rproc *rproc, const struct firmware * { struct imx_rpr...
2e171ab29f916455a49274a2042bac4a4b35570e
Analyze and fix the following issue in the Linux kernel code: panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Problem Details: Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel. Add the panic_force_cpu= kern...
```diff diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 73d846211144..97161861781c 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4788,6 +4788,21 @@ Kernel parameters panic_on_w...
fe6d29b082d49df336ebb92226a3c004ae9e3222
Analyze and fix the following issue in the Linux kernel code: drm/bridge: imx8qxp-pixel-combiner: Fix bailout for imx8qxp_pc_bridge_probe()
Problem Details: In case the channel0 is unavailable and bailing out from free_child is needed when we fail to add a DRM bridge for the available channel1, pointer pc->ch[0] in the bailout path would be NULL and it would be dereferenced as pc->ch[0]->bridge.next_bridge. Fix this by checking pc->ch[0] before dereferenc...
```diff diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c index 74eda8b54023..99a9280edb4f 100644 --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c @@ -348,7 +348,7 @@ static int imx8qx...
988bb1b9ededab9aed83df8c1f5be0232b71ded3
Analyze and fix the following issue in the Linux kernel code: mq-deadline: covert to use request_queue->async_depth
Problem Details: In downstream kernel, we test with mq-deadline with many fio workloads, and we found a performance regression after commit 39823b47bbd4 ("block/mq-deadline: Fix the tag reservation code") with following test: [global] rw=randread direct=1 ramp_time=1 ioengine=libaio iodepth=1024 numjobs=24 bs=1024k gr...
```diff diff --git a/block/mq-deadline.c b/block/mq-deadline.c index 29d00221fbea..95917a88976f 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -98,7 +98,6 @@ struct deadline_data { int fifo_batch; int writes_starved; int front_merges; - u32 async_depth; int prio_aging_expire; spinlock_t lock;...
169343cc8ff2bd59758760d867bd26adae866a2b
Analyze and fix the following issue in the Linux kernel code: perf build: Remove NO_LIBCAP that controls nothing
Problem Details: Using libcap was removed in commit e25ebda78e230283 ("perf cap: Tidy up and improve capability testing") and improve capability testing"), however, some build documentation and a use of the NO_LIBCAP=1 were lingering. Remove these left over bits. Fixes: e25ebda78e230283 ("perf cap: Tidy up and improv...
```diff diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index b6edc8100c8e..2a7e5814b159 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -86,8 +86,6 @@ include ../scripts/utilities.mak # # Define NO_LIBBPF if you do not want BPF support # -# Define NO_LIBCAP if you do not wan...
e894f633980804a528a2d6996c4ea651df631632
Analyze and fix the following issue in the Linux kernel code: kthread: Honour kthreads preferred affinity after cpuset changes
Problem Details: When cpuset isolated partitions get updated, unbound kthreads get indifferently affine to all non isolated CPUs, regardless of their individual affinity preferences. For example kswapd is a per-node kthread that prefers to be affine to the node it refers to. Whenever an isolated partition is created, ...
```diff diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 8d27403888ce..c92c1149ee6e 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -100,6 +100,7 @@ void kthread_unpark(struct task_struct *k); void kthread_parkme(void); void kthread_exit(long result) __noreturn; void kthread...
03ff7351016983653bab5b38e58529d0e38a28cf
Analyze and fix the following issue in the Linux kernel code: cpuset: Update HK_TYPE_DOMAIN cpumask from cpuset
Problem Details: Until now, HK_TYPE_DOMAIN used to only include boot defined isolated CPUs passed through isolcpus= boot option. Users interested in also knowing the runtime defined isolated CPUs through cpuset must use different APIs: cpuset_cpu_is_isolated(), cpu_is_isolated(), etc... There are many drawbacks to tha...
```diff diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index c7cf6934489c..d8d9baf44516 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -9,6 +9,11 @@ enum hk_type { /* Inverse of boot-time isolcpus= argument */ HK_TYPE_DOMAIN_BOOT, + /* + * Sam...
826af7fa62e347464b1b4e0ba2fe19a92438084f
Analyze and fix the following issue in the Linux kernel code: ALSA: aloop: Fix racy access at PCM trigger
Problem Details: The PCM trigger callback of aloop driver tries to check the PCM state and stop the stream of the tied substream in the corresponding cable. Since both check and stop operations are performed outside the cable lock, this may result in UAF when a program attempts to trigger frequently while opening/closi...
```diff diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 64ef03b2d579..aa0d2fcb1a18 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -336,37 +336,43 @@ static bool is_access_interleaved(snd_pcm_access_t access) static int loopback_check_format(struct loopback_cable *cable, int stream...
ee4784a83fb21a2d16ebfdf8877fa6f6a1129150
Analyze and fix the following issue in the Linux kernel code: block: don't use strcpy to copy blockdev name
Problem Details: 0-day bot flagged the use of strcpy() in blk_trace_setup(), because the source buffer can theoretically be bigger than the destination buffer. While none of the current callers pass a string bigger than BLKTRACE_BDEV_SIZE, use strscpy() to prevent eventual future misuse and silence the checker warning...
```diff diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d031c8d80be4..c4db5c2e7103 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -793,7 +793,7 @@ int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, return PTR_ERR(bt); } blk_trace_setup_finalize(q, name...
c5ff6b83715919767f181f13e992b5055812a194
Analyze and fix the following issue in the Linux kernel code: tcp: accecn: handle unexpected AccECN negotiation feedback
Problem Details: According to Sections 3.1.2 and 3.1.3 of AccECN spec (RFC9768). In Section 3.1.2, it says an AccECN implementation has no need to recognize or support the Server response labelled 'Nonce' or ECN-nonce feedback more generally, as RFC 3540 has been reclassified as Historic. AccECN is compatible with alt...
```diff diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index 2e1637edf1d3..a709fb1756eb 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h @@ -473,6 +473,26 @@ static inline u8 tcp_accecn_option_init(const struct sk_buff *skb, return TCP_ACCECN_OPT_COUNTER_SEEN; } +static inline void tcp_ec...
7885ce0147401d5f6908ad4da660334031d836b7
Analyze and fix the following issue in the Linux kernel code: tcp: try to avoid safer when ACKs are thinned
Problem Details: Add newly acked pkts EWMA. When ACK thinning occurs, select between safer and unsafe cep delta in AccECN processing based on it. If the packets ACKed per ACK tends to be large, don't conservatively assume ACE field overflow. This patch uses the existing 2-byte holes in the rx group for new u16 variabl...
```diff diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst index 26f32dbcf6ec..563daea10d6c 100644 --- a/Documentation/networking/net_cachelines/tcp_sock.rst +++ b/Documentation/networking/net_cachelines/tcp_sock.rst @@ -105,6 +105,7 @@ u32 ...
6e1e735181e0c18e1f4ecb0118be4b1e2ee439d1
Analyze and fix the following issue in the Linux kernel code: ASoC: rt1320: fix intermittent no-sound issue
Problem Details: This patch adds a setting to resolve the intermittent no-sound issue. Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://patch.msgid.link/20260203084827.768238-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
```diff diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c index feecef258b65..e6142645b903 100644 --- a/sound/soc/codecs/rt1320-sdw.c +++ b/sound/soc/codecs/rt1320-sdw.c @@ -203,6 +203,7 @@ static const struct reg_sequence rt1320_vc_blind_write[] = { { 0x3fc2bfc2, 0x00 }, { 0x3fc2bfc1, 0x00...
284e70ace9ecdeb8644fbe65c5da12c90b377545
Analyze and fix the following issue in the Linux kernel code: ASoC: SOF: Intel: use hdev->info.link_mask directly
Problem Details: The link_mask variable is not changed after setting to hdev->info.link_mask until it is used for another purpose to get the used SoundWire links and set to mach->mach_params.links. Besides, the link_mask variable should be reset before any link id is added to the link_mask. To fix the issue above and a...
```diff diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 0bb85f92e106..686ecc040867 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1304,9 +1304,8 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev int i; hdev = pdata->hw_pdata; -...
b48ca920613858b477f75946907e72c74570af05
Analyze and fix the following issue in the Linux kernel code: iommupt: Always add IOVA range to iotlb_gather in gather_range_pages()
Problem Details: Add current (iova, len) to the iotlb gather, regardless of the setting of PT_FEAT_FLUSH_RANGE or PT_FEAT_FLUSH_RANGE_NO_GAPS. In gather_range_pages(), the current IOVA range is only added to iotlb_gather when PT_FEAT_FLUSH_RANGE is set. Yet a virtual IOMMU with NpCache uses only PT_FEAT_FLUSH_RANGE_NO...
```diff diff --git a/drivers/iommu/generic_pt/iommu_pt.h b/drivers/iommu/generic_pt/iommu_pt.h index 3327116a441c..6de22fa6bb34 100644 --- a/drivers/iommu/generic_pt/iommu_pt.h +++ b/drivers/iommu/generic_pt/iommu_pt.h @@ -58,10 +58,9 @@ static void gather_range_pages(struct iommu_iotlb_gather *iotlb_gather, * Note...
9e249c48412828e807afddc21527eb734dc9bd3d
Analyze and fix the following issue in the Linux kernel code: iommu/amd: serialize sequence allocation under concurrent TLB invalidations
Problem Details: With concurrent TLB invalidations, completion wait randomly gets timed out because cmd_sem_val was incremented outside the IOMMU spinlock, allowing CMD_COMPL_WAIT commands to be queued out of sequence and breaking the ordering assumption in wait_on_sem(). Move the cmd_sem_val increment under iommu->loc...
```diff diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h index cfcbad6c28ff..c685d3771436 100644 --- a/drivers/iommu/amd/amd_iommu_types.h +++ b/drivers/iommu/amd/amd_iommu_types.h @@ -752,7 +752,7 @@ struct amd_iommu { u32 flags; volatile u64 *cmd_sem; - atomic64_t cmd_sem_v...
fb7f54aa2a99b07945911152c5d3d4a6eb39f797
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: mvm: pause TCM on fast resume
Problem Details: Not pausing it means that we can have the TCM work queued into a non-freezable workqueue, which, in resume, is re-activated before the driver's resume is called. The TCM work might send commands to the FW before we resumed the device, leading to an assert. Closes: https://lore.kernel.org/linux-wireles...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index 07f1a84c274e..af1a45845999 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ...
5ff641011ab7fb63ea101251087745d9826e8ef5
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: mld: cancel mlo_scan_start_wk
Problem Details: mlo_scan_start_wk is not canceled on disconnection. In fact, it is not canceled anywhere except in the restart cleanup, where we don't really have to. This can cause an init-after-queue issue: if, for example, the work was queued and then drv_change_interface got executed. This can also cause use-aft...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/mld/iface.c b/drivers/net/wireless/intel/iwlwifi/mld/iface.c index a5ececfc13e4..f15d1f5d1bf5 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/iface.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/iface.c @@ -55,8 +55,6 @@ void iwl_mld_cleanup_vif(void *data, u8...
b79e0875fe8144fcb09e4fc1cf386cb3b2262480
Analyze and fix the following issue in the Linux kernel code: PCI: s32g: Skip Root Port removal during success
Problem Details: Currently, s32g_pcie_parse_ports() exercises the 'err_port' path even during the success case. This results in ports getting deleted after successful parsing of Root Ports. Hence, skip the removal of Root Ports during success. Fixes: 5cbc7d3e316e ("PCI: s32g: Add NXP S32G PCIe controller driver (RC)"...
```diff diff --git a/drivers/pci/controller/dwc/pcie-nxp-s32g.c b/drivers/pci/controller/dwc/pcie-nxp-s32g.c index 47745749f75c..b3ec38099fa3 100644 --- a/drivers/pci/controller/dwc/pcie-nxp-s32g.c +++ b/drivers/pci/controller/dwc/pcie-nxp-s32g.c @@ -282,12 +282,12 @@ static int s32g_pcie_parse_ports(struct device *dev...
1b51bd761599b84e963d9cb510e7c7d8fbf9d1ee
Analyze and fix the following issue in the Linux kernel code: apparmor: fix cast in format string DEBUG statement
Problem Details: if debugging is enabled the DEBUG statement will fail do to a bad fat fingered cast. Fixes: 102ada7ca37ed ("apparmor: fix fmt string type error in process_strs_entry") Signed-off-by: John Johansen <john.johansen@canonical.com>
```diff diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 175445c09896..e68adf39771f 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -546,7 +546,7 @@ static int unpack_strs_table(struct aa_ext *e, const char *name, bool multi, if (c <=...
4df29fb5bcebeea28b29386dec18355949512ca1
Analyze and fix the following issue in the Linux kernel code: rust_binder: return p from rust_binder_transaction_target_node()
Problem Details: Somehow this got changed to NULL when I ported this to upstream it. No idea how that happened. Reported-by: Carlos Llamas <cmllamas@google.com> Closes: https://lore.kernel.org/r/aXkEiC1sGOGfDuzI@google.com Fixes: c1ea31205edf ("rust_binder: add binder_transaction tracepoint") Signed-off-by: Alice Ryhl...
```diff diff --git a/drivers/android/binder/rust_binder.h b/drivers/android/binder/rust_binder.h index e68ba7a23c34..d2284726c025 100644 --- a/drivers/android/binder/rust_binder.h +++ b/drivers/android/binder/rust_binder.h @@ -79,7 +79,7 @@ static inline rust_binder_node rust_binder_transaction_target_node(rust_binder_...
ec4ddc90d201d09ef4e4bef8a2c6d9624525ad68
Analyze and fix the following issue in the Linux kernel code: binderfs: fix ida_alloc_max() upper bound
Problem Details: The 'max' argument of ida_alloc_max() takes the maximum valid ID and not the "count". Using an ID of BINDERFS_MAX_MINOR (1 << 20) for dev->minor would exceed the limits of minor numbers (20-bits). Fix this off-by-one error by subtracting 1 from the 'max'. Cc: stable@vger.kernel.org Fixes: 3ad20fe393b3...
```diff diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index b46bcb91072d..9f8a18c88d66 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -132,8 +132,8 @@ static int binderfs_binder_device_create(struct inode *ref_inode, mutex_lock(&binderfs_minors_mutex); if (++info-...
d6ba734814266bbf7ee01f9030436597116805f3
Analyze and fix the following issue in the Linux kernel code: rust_binderfs: fix ida_alloc_max() upper bound
Problem Details: The 'max' argument of ida_alloc_max() takes the maximum valid ID and not the "count". Using an ID of BINDERFS_MAX_MINOR (1 << 20) for dev->minor would exceed the limits of minor numbers (20-bits). Fix this off-by-one error by subtracting 1 from the 'max'. Cc: stable@vger.kernel.org Fixes: eafedbc7c050...
```diff diff --git a/drivers/android/binder/rust_binderfs.c b/drivers/android/binder/rust_binderfs.c index c69026df775c..88374b31ab7c 100644 --- a/drivers/android/binder/rust_binderfs.c +++ b/drivers/android/binder/rust_binderfs.c @@ -132,8 +132,8 @@ static int binderfs_binder_device_create(struct inode *ref_inode, m...
38ac9179a79d81ab1db3807ddd6c03fab29eb19b
Analyze and fix the following issue in the Linux kernel code: rust_binder: fix needless borrow in context.rs
Problem Details: Clippy warns about a needless borrow in context.rs: error: this expression creates a reference which is immediately dereferenced by the compiler --> drivers/android/binder/context.rs:141:18 | 141 | func(&proc); | ^^^^^ help: change this to: `...
```diff diff --git a/drivers/android/binder/context.rs b/drivers/android/binder/context.rs index c7b75efef217..9cf437c025a2 100644 --- a/drivers/android/binder/context.rs +++ b/drivers/android/binder/context.rs @@ -138,7 +138,7 @@ impl Context { { let lock = self.manager.lock(); for proc in &lock...
377563ce0653031de8d530e8b2f590d13349e29c
Analyze and fix the following issue in the Linux kernel code: revocable: fix SRCU index corruption by requiring caller-provided storage
Problem Details: The struct revocable handle stores the SRCU read-side index (idx) for the duration of a resource access. If multiple threads share the same struct revocable instance, they race on writing to the idx field, corrupting the SRCU state and potentially causing unsafe unlocks. Refactor the API to replace r...
```diff diff --git a/Documentation/driver-api/driver-model/revocable.rst b/Documentation/driver-api/driver-model/revocable.rst index ab7c0af5fbb6..350e7faeccdc 100644 --- a/Documentation/driver-api/driver-model/revocable.rst +++ b/Documentation/driver-api/driver-model/revocable.rst @@ -81,14 +81,14 @@ For Resource Prov...
4d7dc4d1a62dbb22b1178dddeeb7a22d0272df77
Analyze and fix the following issue in the Linux kernel code: revocable: Fix races in revocable_alloc() using RCU
Problem Details: There are two race conditions when allocating a revocable instance: 1. After a struct revocable_provider is revoked, the caller might still hold a dangling pointer to it. A subsequent call to revocable_alloc() can trigger a use-after-free. 2. If revocable_provider_release() runs concurrently wi...
```diff diff --git a/Documentation/driver-api/driver-model/revocable.rst b/Documentation/driver-api/driver-model/revocable.rst index 22a442cc8d7f..ab7c0af5fbb6 100644 --- a/Documentation/driver-api/driver-model/revocable.rst +++ b/Documentation/driver-api/driver-model/revocable.rst @@ -76,9 +76,6 @@ For Resource Provid...
ad9cb48b2bd8b26d0a74bb8c16aaa4d6ec9a498a
Analyze and fix the following issue in the Linux kernel code: Input: apbps2 - fix comment style and typos
Problem Details: Capitalize comment starts to match kernel coding style. Fix spelling: "reciever" -> "receiver" Fix grammar: "it's" (contraction of "it is") -> "its" (possessive) Remove uncertainty from "Clear error bits?" comment. Compile tested only. Signed-off-by: Micah Ostrow <bluefox9516@gmail.com> Link: https:/...
```diff diff --git a/drivers/input/serio/apbps2.c b/drivers/input/serio/apbps2.c index b815337be2f4..a5fbb27088be 100644 --- a/drivers/input/serio/apbps2.c +++ b/drivers/input/serio/apbps2.c @@ -67,7 +67,7 @@ static irqreturn_t apbps2_isr(int irq, void *dev_id) rxflags = (status & APBPS2_STATUS_PE) ? SERIO_PARITY : ...
e34881c84c255bc300f24d9fe685324be20da3d1
Analyze and fix the following issue in the Linux kernel code: sched: Re-evaluate scheduling when migrating queued tasks out of throttled cgroups
Problem Details: Consider the following sequence on a CPU configured with nohz_full: 1) A task P runs in cgroup A, and cgroup A becomes throttled due to CFS bandwidth control. The gse (cgroup A) where the task P attached is dequeued and the CPU switches to idle. 2) Before cgroup A is unthrottled, task P is migrate...
```diff diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8f2dc0a941ef..b411e4feff7f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9126,6 +9126,7 @@ void sched_move_task(struct task_struct *tsk, bool for_autogroup) { unsigned int queue_flags = DEQUEUE_SAVE | DEQUEUE_MOVE; bool resched =...
94894c9c477e53bcea052e075c53f89df3d2a33e
Analyze and fix the following issue in the Linux kernel code: sched/rt: Skip currently executing CPU in rto_next_cpu()
Problem Details: CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work...
```diff diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 0a9b2cd6da72..a7680477fa6f 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2106,6 +2106,7 @@ static void push_rt_tasks(struct rq *rq) */ static int rto_next_cpu(struct root_domain *rd) { + int this_cpu = smp_processor_id(); int next; in...
dd6a37e8faa723c680cb8615efa5b042691b927f
Analyze and fix the following issue in the Linux kernel code: selftests/sched_ext: Add test for DL server total_bw consistency
Problem Details: Add a new kselftest to verify that the total_bw value in /sys/kernel/debug/sched/debug remains consistent across all CPUs under different sched_ext BPF program states: 1. Before a BPF scheduler is loaded 2. While a BPF scheduler is loaded and active 3. After a BPF scheduler is unloaded The test runs ...
```diff diff --git a/tools/testing/selftests/sched_ext/Makefile b/tools/testing/selftests/sched_ext/Makefile index c9255d1499b6..2c601a7eaff5 100644 --- a/tools/testing/selftests/sched_ext/Makefile +++ b/tools/testing/selftests/sched_ext/Makefile @@ -185,6 +185,7 @@ auto-test-targets := \ select_cpu_vtime \ rt_s...
5a40a9bb56d455e7548ba4b6d7787918323cbaf0
Analyze and fix the following issue in the Linux kernel code: sched/debug: Fix dl_server (re)start conditions
Problem Details: There are two problems with sched_server_write_common() that can cause the dl_server to malfunction upon attempting to change the parameters: 1) when, after having disabled the dl_server by setting runtime=0, it is enabled again while tasks are already enqueued. In this case is_active would stil...
```diff diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index eae14e57adf1..d08b00429323 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1799,7 +1799,7 @@ void dl_server_start(struct sched_dl_entity *dl_se) struct rq *rq = dl_se->rq; dl_se->dl_defer_idle = 0; - if (!dl_server...
76d12132ba459ab929cb66eb2030c666aacdb69a
Analyze and fix the following issue in the Linux kernel code: sched/debug: Add support to change sched_ext server params
Problem Details: When a sched_ext server is loaded, tasks in the fair class are automatically moved to the sched_ext class. Add support to modify the ext server parameters similar to how the fair server parameters are modified. Re-use common code between ext and fair servers as needed. Co-developed-by: Andrea Righi <...
```diff diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 41e389569d06..59e650f9d436 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -330,14 +330,16 @@ enum dl_param { DL_PERIOD, }; -static unsigned long fair_server_period_max = (1UL << 22) * NSEC_PER_USEC; /* ~4 seconds */ -static uns...
cd959a3562050d1c676be37f1d256a96cb067868
Analyze and fix the following issue in the Linux kernel code: sched_ext: Add a DL server for sched_ext tasks
Problem Details: sched_ext currently suffers starvation due to RT. The same workload when converted to EXT can get zero runtime if RT is 100% running, causing EXT processes to stall. Fix it by adding a DL server for EXT. A kselftest is also included later to confirm that both DL servers are functioning correctly: # ...
```diff diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 260633e6b212..8f2dc0a941ef 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8484,6 +8484,9 @@ int sched_cpu_dying(unsigned int cpu) dump_rq_tasks(rq, KERN_WARNING); } dl_server_stop(&rq->fair_server); +#ifdef CONFIG_SCHED_CLASS_EX...
68ec89d0e99156803bdea3c986c0198624e40ea2
Analyze and fix the following issue in the Linux kernel code: sched/debug: Stop and start server based on if it was active
Problem Details: Currently the DL server interface for applying parameters checks CFS-internals to identify if the server is active. This is error-prone and makes it difficult when adding new servers in the future. Fix it, by using dl_server_active() which is also used by the DL server code to determine if the DL serv...
```diff diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index ed9254da5116..41e389569d06 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -348,6 +348,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu return err; scoped_guard (rq_lock_irqsave, rq) { + b...
6080fb211672aec6ce8f2f5a2e0b4eae736f2027
Analyze and fix the following issue in the Linux kernel code: sched/debug: Fix updating of ppos on server write ops
Problem Details: Updating "ppos" on error conditions does not make much sense. The pattern is to return the error code directly without modifying the position, or modify the position on success and return the number of bytes written. Since on success, the return value of apply is 0, there is no point in modifying ppos...
```diff diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 929fdf09e8e9..ed9254da5116 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -339,8 +339,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu long cpu = (long) ((struct seq_file *) filp->private_data)...
3cb3b27693bf30defb16aa096158a3b24583b8d2
Analyze and fix the following issue in the Linux kernel code: sched/deadline: Clear the defer params
Problem Details: The defer params were not cleared in __dl_clear_params. Clear them. Without this is some of my test cases are flaking and the DL timer is not starting correctly AFAICS. Fixes: a110a81c52a9 ("sched/deadline: Deferrable dl server") Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Pe...
```diff diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 82e7a214b961..7e181ec02220 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -3660,6 +3660,9 @@ static void __dl_clear_params(struct sched_dl_entity *dl_se) dl_se->dl_non_contending = 0; dl_se->dl_overrun = 0; dl_se-...
da6f5bbc2e7902f578b503f2a4c3d8d09ca4b102
Analyze and fix the following issue in the Linux kernel code: gfs2: fix memory leaks in gfs2_fill_super error path
Problem Details: Fix two memory leaks in the gfs2_fill_super() error handling path when transitioning a filesystem to read-write mode fails. First leak: kthread objects (thread_struct, task_struct, etc.) When gfs2_freeze_lock_shared() fails after init_threads() succeeds, the created kernel threads (logd and quotad) ar...
```diff diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index e7a88b717991..c7d57de7c8f0 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1276,7 +1276,6 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) if (error) { gfs2_freeze_unlock(sdp); - gfs2_destroy_thre...
53c998527ffa60f9deda8974a11ad39790684159
Analyze and fix the following issue in the Linux kernel code: arm64/gcs: Fix error handling in arch_set_shadow_stack_status()
Problem Details: alloc_gcs() returns an error-encoded pointer on failure, which comes from do_mmap(), not NULL. The current NULL check fails to detect errors, which could lead to using an invalid GCS address. Use IS_ERR_VALUE() to properly detect errors, consistent with the check in gcs_alloc_thread_stack(). Fixes: ...
```diff diff --git a/arch/arm64/mm/gcs.c b/arch/arm64/mm/gcs.c index 6e93f78de79b..04a23a497f20 100644 --- a/arch/arm64/mm/gcs.c +++ b/arch/arm64/mm/gcs.c @@ -199,8 +199,8 @@ int arch_set_shadow_stack_status(struct task_struct *task, unsigned long arg) size = gcs_size(0); gcs = alloc_gcs(0, size); - if (!gcs) ...
45c0a8a70253ab97e676b9791891e389a531664b
Analyze and fix the following issue in the Linux kernel code: drm/panel: ilitek-ili9882t: Remove duplicate initializers in tianma_il79900a_dsc
Problem Details: Clang warns (or errors with CONFIG_WERROR=y / W=e): drivers/gpu/drm/panel/panel-ilitek-ili9882t.c:95:16: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides] 95 | .vbr_enable = 0, | ^ drivers/gpu/drm/panel/...
```diff diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c index 370424ddfc80..8b2bfb7d3638 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c @@ -88,11 +88,9 @@ static const struct drm_dsc_config tianma_...
ef92b98f5f6758a049898b53aa30476010db04fa
Analyze and fix the following issue in the Linux kernel code: media: pci: mg4b: Use IRQF_NO_THREAD
Problem Details: The interrupt handler iio_trigger_generic_data_rdy_poll() will invoke other interrupt handlers and this supposed to happen from hard interrupt context. Use IRQF_NO_THREAD to forbid forced-threading. Fixes: 0ab13674a9bd1 ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver") Signed-off-by: Sebasti...
```diff diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c index 4f9a35904b41..70cad324df60 100644 --- a/drivers/media/pci/mgb4/mgb4_trigger.c +++ b/drivers/media/pci/mgb4/mgb4_trigger.c @@ -115,7 +115,7 @@ static int probe_trigger(struct iio_dev *indio_dev, int irq) if (!st->t...
ad121a62d5663f3b68ad55c9d733af0c4b663f85
Analyze and fix the following issue in the Linux kernel code: drm/i915/dp: Rework pipe joiner logic in mode_valid
Problem Details: Currently in intel_dp_mode_valid(), we compute the number of joined pipes required before deciding whether DSC is needed. This ordering prevents us from accounting for DSC-related overhead when determining pipe requirements. It is not possible to first decide whether DSC is needed and then compute the...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 8dcbc4b76a1a..bf1fed201c66 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1434,6 +1434,23 @@ bool intel_dp_has_dsc(const struct intel_connector *connector)...
a56a70f8d20752c8be032ac03f7e8684dccdeb58
Analyze and fix the following issue in the Linux kernel code: btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
Problem Details: We allocate the bitmap but we never free it in free_raid_bio_pointers(). Fix this by adding a bitmap_free() call against the stripe_uptodate_bitmap of a raid bio. Fixes: 1810350b04ef ("btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap") Reported-by: Christoph Hellwig <hch@lst.de> Link: ...
```diff diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index f38d8305e46d..baadaaa189c0 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -150,6 +150,7 @@ static void scrub_rbio_work_locked(struct work_struct *work); static void free_raid_bio_pointers(struct btrfs_raid_bio *rbio) { bitmap_free(rbio->err...
5341c98450df7cf8dacc907a80e3362f3155c847
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: add unit tests for pending extent walking functions
Problem Details: I ran into another sort of trivial bug in v1 of the patch and concluded that these functions really ought to be unit tested. These two functions form the core of searching the chunk allocation pending extent bitmap and have relatively easily definable semantics, so unit testing them can help ensure th...
```diff diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile index 743d7677b175..975104b74486 100644 --- a/fs/btrfs/Makefile +++ b/fs/btrfs/Makefile @@ -44,4 +44,5 @@ btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \ tests/extent-buffer-tests.o tests/btrfs-tests.o \ tests/extent-io-tests.o tests...
b14c5e04bd0f722ed631845599d52d03fcae1bc1
Analyze and fix the following issue in the Linux kernel code: btrfs: fix EEXIST abort due to non-consecutive gaps in chunk allocation
Problem Details: I have been observing a number of systems aborting at insert_dev_extents() in btrfs_create_pending_block_groups(). The following is a sample stack trace of such an abort coming from forced chunk allocation (typically behind CONFIG_BTRFS_EXPERIMENTAL) but this can theoretically happen to any DUP chunk a...
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d33780082b8d..329a922893b4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1509,30 +1509,158 @@ error_bdev_put: } /* - * Try to find a chunk that intersects [start, start + len] range and when one - * such is found, record the end of it...
b291ad4458df8311626dfa0a089918f6a542d6bc
Analyze and fix the following issue in the Linux kernel code: btrfs: fix transaction commit blocking during trim of unallocated space
Problem Details: When trimming unallocated space, btrfs_trim_fs() holds the device_list_mutex for the entire duration while iterating through all devices. On large filesystems with significant unallocated space, this operation can take minutes to hours on large storage systems. This causes a problem because btrfs_run_...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 87fd94449f11..03cf9f242c70 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6513,10 +6513,12 @@ void btrfs_error_unpin_extent_range(struct btrfs_fs_info *fs_info, u64 start, u6 * it while performing the free space search si...
912d1c6680bdb40b72b1b9204706f32b6eb842c3
Analyze and fix the following issue in the Linux kernel code: btrfs: continue trimming remaining devices on failure
Problem Details: Commit 93bba24d4b5a ("btrfs: Enhance btrfs_trim_fs function to handle error better") intended to make device trimming continue even if one device fails, tracking failures and reporting them at the end. However, it used 'break' instead of 'continue', causing the loop to exit on the first device failure....
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a91bce05ffb4..b63296e9abf4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6688,7 +6688,7 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) if (ret) { dev_failed++; dev_ret = ret; - ...
3a1f4264daed4b419c325a7fe35e756cada3cf82
Analyze and fix the following issue in the Linux kernel code: btrfs: fix block_group_tree dirty_list corruption
Problem Details: When the incompat flag EXTENT_TREE_V2 is set, we unconditionally add the block group tree to the switch_commits list before calling switch_commit_roots, as we do for the tree root and the chunk root. However, the block group tree uses normal root dirty tracking and in any transaction that does an alloc...
```diff diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8aa55cd8a0bf..0b2498749b1e 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -2508,13 +2508,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) list_add_tail(&fs_info->chunk_root->dirty_list, &cur_tra...
c757edbef980d4e5d70749d3c98e00279af58b96
Analyze and fix the following issue in the Linux kernel code: btrfs: fix copying the flags of btrfs_bio after split
Problem Details: When a btrfs_bio gets split, only 'bbio->csum_search_commit_root' gets copied to the new btrfs_bio, all the other flags don't. When a bio is split in btrfs_submit_chunk(), btrfs_split_bio() creates the new split bio via btrfs_bio_init() which zeroes the struct with memset. Looking at btrfs_split_bio()...
```diff diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index d3475d179362..0a69e09bfe28 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -97,7 +97,13 @@ static struct btrfs_bio *btrfs_split_bio(struct btrfs_fs_info *fs_info, bbio->orig_logical = orig_bbio->orig_logical; orig_bbio->orig_logical += map_length; }...
52ee9965d09b2c56a027613db30d1fb20d623861
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: fixup last alloc pointer after extent removal for RAID0/10
Problem Details: When a block group is composed of a sequential write zone and a conventional zone, we recover the (pseudo) write pointer of the conventional zone using the end of the last allocated position. However, if the last extent in a block group is removed, the last extent position will be smaller than the oth...
```diff diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index a10e1076c881..7fa60a44d716 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1561,7 +1561,9 @@ static int btrfs_load_block_group_raid0(struct btrfs_block_group *bg, { struct btrfs_fs_info *fs_info = bg->fs_info; u64 stripe_nr = 0, stripe_offset ...
e2d848649e64de39fc1b9c64002629b4daa1105d
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: fixup last alloc pointer after extent removal for DUP
Problem Details: When a block group is composed of a sequential write zone and a conventional zone, we recover the (pseudo) write pointer of the conventional zone using the end of the last allocated position. However, if the last extent in a block group is removed, the last extent position will be smaller than the oth...
```diff diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 714f45045c84..a10e1076c881 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1450,6 +1450,20 @@ static int btrfs_load_block_group_dup(struct btrfs_block_group *bg, return -EIO; } + /* + * When the last extent is removed, last_alloc can be sma...
dda3ec9ee6b3e120603bff1b798f25b51e54ac5d
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: fixup last alloc pointer after extent removal for RAID1
Problem Details: When a block group is composed of a sequential write zone and a conventional zone, we recover the (pseudo) write pointer of the conventional zone using the end of the last allocated position. However, if the last extent in a block group is removed, the last extent position will be smaller than the oth...
```diff diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index d6a2480d5dc1..714f45045c84 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1491,6 +1491,21 @@ static int btrfs_load_block_group_raid1(struct btrfs_block_group *bg, /* In case a device is missing we have a cap of 0, so don't use it. */ bg->zone_...
51b1fcf71c88c3c89e7dcf07869c5de837b1f428
Analyze and fix the following issue in the Linux kernel code: btrfs: qgroup: return correct error when deleting qgroup relation item
Problem Details: If we fail to delete the second qgroup relation item, we end up returning success or -ENOENT in case the first item does not exist, instead of returning the error from the second item deletion. Fixes: 73798c465b66 ("btrfs: qgroup: Try our best to delete qgroup relations") Reviewed-by: Johannes Thumshi...
```diff diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 14d393a5853d..c03bb96d3a34 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1640,8 +1640,10 @@ delete_item: if (ret < 0 && ret != -ENOENT) goto out; ret2 = del_qgroup_relation_item(trans, dst, src); - if (ret2 < 0 && ret2 != -ENOENT) + if...
385c65f8274b8caff75102474c4c9e8a95e6ec4c
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: prepare extent map tests for strict alignment checks
Problem Details: Currently the extent map self tests have the following points that will cause false alerts for the incoming strict extent map alignment checks: - Incorrect inlined extent map size Which is not following what the kernel is doing for inlined extents, as btrfs_extent_item_to_extent_map() always uses...
```diff diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c index aabf825e8d7b..811f36d41101 100644 --- a/fs/btrfs/tests/extent-map-tests.c +++ b/fs/btrfs/tests/extent-map-tests.c @@ -173,9 +173,12 @@ static int test_case_2(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode) retu...
d77b90cfe08f4cf20dbbc255f8ef13bee831be63
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: remove invalid file extent map tests
Problem Details: In the inode self tests, there are several problems: - Invalid file extents E.g. hole range [4K, 4K + 4) is completely invalid. Only inlined extent maps can have an unaligned ram_bytes, and even for that case, the generated extent map will use sectorsize as em->len. - Unaligned hole after inl...
```diff diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c index 6bd17d059ae6..b04fbcaf0a1d 100644 --- a/fs/btrfs/tests/inode-tests.c +++ b/fs/btrfs/tests/inode-tests.c @@ -81,17 +81,20 @@ static void insert_inode_item_key(struct btrfs_root *root) * diagram of how the extents will look though th...
a8bec25e014eab671ec8a25b03d391cad3e55230
Analyze and fix the following issue in the Linux kernel code: btrfs: deal with missing root in sample_block_group_extent_item()
Problem Details: In case the root does not exists, which is unexpected, btrfs_extent_root() returns NULL, but we ignore that and so if it happens we can trigger a NULL pointer dereference later. So verify if we found the root and log an error message in case it's missing. Reviewed-by: Boris Burkov <boris@bur.io> Revie...
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 66c512bc022c..28aa87872f0d 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -607,6 +607,12 @@ static int sample_block_group_extent_item(struct btrfs_caching_control *caching_ lockdep_assert_held_read(&fs_info->commit_root_se...
7c2830f00c3e086292c1ee9f27b61efaf8e76c9a
Analyze and fix the following issue in the Linux kernel code: btrfs: fallback to buffered IO if the data profile has duplication
Problem Details: [BACKGROUND] Inspired by a recent kernel bug report, which is related to direct IO buffer modification during writeback, that leads to contents mismatch of different RAID1 mirrors. [CAUSE AND PROBLEMS] The root cause is exactly the same explained in commit 968f19c5b1b7 ("btrfs: always fallback to buff...
```diff diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c index bc7cc2d81f8f..9a63200d7a53 100644 --- a/fs/btrfs/direct-io.c +++ b/fs/btrfs/direct-io.c @@ -801,6 +801,8 @@ ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) ssize_t ret; unsigned int ilock_flags = 0; struct iomap_dio *dio;...
19eff93dc738e8afaa59cb374b44bb5a162e6c2d
Analyze and fix the following issue in the Linux kernel code: btrfs: fix periodic reclaim condition
Problem Details: Problems with current implementation: 1. reclaimable_bytes is signed while chunk_sz is unsigned, causing negative reclaimable_bytes to trigger reclaim unexpectedly 2. The "space must be freed between scans" assumption breaks the two-scan requirement: first scan marks block groups, second scan ...
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 4fc4d49910bf..6c6133584196 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1889,6 +1889,7 @@ void btrfs_reclaim_bgs_work(struct work_struct *work) while (!list_empty(&fs_info->reclaim_bgs)) { u64 used; u64 reserved; ...
c3d6dda60c9da79a108592b14560e326384dbf4e
Analyze and fix the following issue in the Linux kernel code: btrfs: allow remapped chunks to have zero stripes
Problem Details: When a chunk has been fully remapped, we are going to set its num_stripes to 0, as it will no longer represent a physical location on disk. Change tree-checker to allow for this, and fix read_one_chunk() to avoid a divide by zero. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Mark Harmstone...
```diff diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index a6c158cd8fcd..ead2e1e2a0bb 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -816,6 +816,32 @@ static void chunk_err(const struct btrfs_fs_info *fs_info, va_end(args); } +static bool valid_stripe_count(u64 profile, u16...
b322fa5ff1320430d9a8349cb57770a47399b690
Analyze and fix the following issue in the Linux kernel code: btrfs: tag as unlikely error handling in run_one_delayed_ref()
Problem Details: We don't expect to get errors unless we have a corrupted fs, bad RAM or a bug. So tag the error handling as unlikely. This slightly reduces the module's text size on x86_64 using gcc 14.2.0-19 from Debian. Before this change: $ size fs/btrfs/btrfs.ko text data bss dec hex filen...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b3a26b61f937..5e3877a42ee6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1785,13 +1785,15 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans, btrfs_err(fs_info, "unexpected delayed ref node type: %u", no...
c7d1d4ff56744074e005771aff193b927392d51f
Analyze and fix the following issue in the Linux kernel code: btrfs: don't BUG() on unexpected delayed ref type in run_one_delayed_ref()
Problem Details: There is no need to BUG(), we can just return an error and log an error message. Reviewed-by: Boris Burkov <boris@bur.io> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1dcd69fe97ed..57ffe9b3b954 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1761,32 +1761,36 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans, struct btrfs_delayed_extent_op *extent_op, ...
d6f6109fe4b32878df8a5d4143a055ea680b1f84
Analyze and fix the following issue in the Linux kernel code: btrfs: update outdated comment in __add_block_group_free_space()
Problem Details: The function add_block_group_free_space() was renamed btrfs_add_block_group_free_space() by commit 6fc5ef782988 ("btrfs: add btrfs prefix to free space tree exported functions"). Update the comment accordingly. Do some reorganization of the next few lines to keep the comment within 80 characters. Si...
```diff diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index 776b6467dfad..ac092898130f 100644 --- a/fs/btrfs/free-space-tree.c +++ b/fs/btrfs/free-space-tree.c @@ -1396,9 +1396,9 @@ static int __add_block_group_free_space(struct btrfs_trans_handle *trans, * can use multiple transactions, every...
d1a020a8d72731b80a01e1abdb8ff965ee278f69
Analyze and fix the following issue in the Linux kernel code: btrfs: add mount time auto fix for orphan fst entries
Problem Details: [BUG] Before btrfs-progs v6.16.1 release, mkfs.btrfs can leave free space tree entries for deleted chunks: # mkfs.btrfs -f -O fst $dev # btrfs ins dump-tree -t chunk $dev btrfs-progs v6.16 chunk tree leaf 22036480 items 4 free space 15781 generation 8 owner CHUNK_TREE leaf 22036480 flags 0...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7dea5615bd8f..9bb5d65219a7 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3013,6 +3013,15 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info) } } + /* + * Before btrfs-progs v6.16.1 mkfs.btrfs can leave free space entrie...
4cdb457a23751a1debebbf7d010300fe4eff47a8
Analyze and fix the following issue in the Linux kernel code: btrfs: remove unreachable return after btrfs_backref_panic() in btrfs_backref_finish_upper_links()
Problem Details: The return statement after btrfs_backref_panic() is unreachable since btrfs_backref_panic() calls BUG() which never returns. Remove the return to unify it with the other calls to btrfs_backref_panic(). Signed-off-by: Zhen Ni <zhen.ni@easystack.cn> Reviewed-by: David Sterba <dsterba@suse.com> Signed-of...
```diff diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 78da47a3d00e..9bb406f7dd30 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -3609,10 +3609,8 @@ int btrfs_backref_finish_upper_links(struct btrfs_backref_cache *cache, } rb_node = rb_simple_insert(&cache->rb_root, &upper->simple_node)...
2ef2e97fe74e937a246681713434ca16d8e5552e
Analyze and fix the following issue in the Linux kernel code: btrfs: move space_info_flag_to_str() to space-info.h
Problem Details: Move space_info_flag_to_str() to space-info.h and as it now isn't static to space-info.c any more prefix it with 'btrfs_'. This way it can be re-used in other places. Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: Johannes Thumshirn <joh...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 3f08e450f796..857e4fd2c77e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -606,22 +606,6 @@ do { \ spin_unlock(&__rsv->lock); \ } while (0) -static const char *space_info_flag_to_str(const struct btrfs_space_inf...
6d0f25cdd8e3248ee6e4899722d610083fe5aa6d
Analyze and fix the following issue in the Linux kernel code: btrfs: update stale comment in __cow_file_range_inline()
Problem Details: We mention that the reserved data space is page size aligned but that's not true anymore, as it's sector size aligned instead. In commit 0bb067ca64e3 ("btrfs: fix the qgroup data free range for inline data extents") we updated the amount passed to btrfs_qgroup_free_data() from page size to sector size,...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index cd3baeadda5c..e83a881fe202 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -690,8 +690,8 @@ out: /* * Don't forget to free the reserved space, as for inlined extent * it won't count as data extent, free them directly here. - * And at reserv...
01c8634c695d199de4a4669c5d684bbec148e71b
Analyze and fix the following issue in the Linux kernel code: btrfs: pass level to _btrfs_printk() to avoid parsing level from string
Problem Details: There's code in _btrfs_printk() to parse the message level from the input string so we can augment the message with the level description for better visibility in the logs. The parsing code has evolved over time, see commits: - 40f7828b36e3b9 ("btrfs: better handle btrfs_printk() defaults") - 262c5e...
```diff diff --git a/fs/btrfs/messages.c b/fs/btrfs/messages.c index 2f853de44473..6190777924bf 100644 --- a/fs/btrfs/messages.c +++ b/fs/btrfs/messages.c @@ -211,33 +211,19 @@ static struct ratelimit_state printk_limits[] = { RATELIMIT_STATE_INIT(printk_limits[7], DEFAULT_RATELIMIT_INTERVAL, 100), }; -void __cold...
fab0c0f03cfd0dfe793889e3374ebc68ecf18889
Analyze and fix the following issue in the Linux kernel code: btrfs: introduce BTRFS_PATH_AUTO_RELEASE() helper
Problem Details: There are already several bugs with on-stack btrfs_path involved, even it is already a little safer than btrfs_path pointers (only leaks the extent buffers, not the btrfs_path structure itself) - Patch "btrfs: make sure extent and csum paths are always released in scrub_raid56_parity_stripe()" - Pa...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 692370fc07b2..6de7ad191e04 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -85,6 +85,14 @@ struct btrfs_path { #define BTRFS_PATH_AUTO_FREE(path_name) \ struct btrfs_path *path_name __free(btrfs_free_path) = NULL +/* + * This defines an on-...
fe11ac191ce0ad910f6fda0c628bcff19fcff47d
Analyze and fix the following issue in the Linux kernel code: btrfs: switch to library APIs for checksums
Problem Details: Make btrfs use the library APIs instead of crypto_shash, for all checksum computations. This has many benefits: - Allows future checksum types, e.g. XXH3 or CRC64, to be more easily supported. Only a library API will be needed, not crypto_shash too. - Eliminates the overhead of the generic crypto...
```diff diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig index 6d6fc85835d4..d88eb836a193 100644 --- a/fs/btrfs/Kconfig +++ b/fs/btrfs/Kconfig @@ -4,11 +4,8 @@ config BTRFS_FS tristate "Btrfs filesystem support" select BLK_CGROUP_PUNT_BIO select CRC32 - select CRYPTO - select CRYPTO_CRC32C - select CRYPTO_XXHASH ...
b39b26e017c7889181cb84032e22bef72e81cf29
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: don't zone append to conventional zone
Problem Details: In case of a zoned RAID, it can happen that a data write is targeting a sequential write required zone and a conventional zone. In this case the bio will be marked as REQ_OP_ZONE_APPEND but for the conventional zone, this needs to be REQ_OP_WRITE. The setting of REQ_OP_ZONE_APPEND is deferred to the l...
```diff diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index fa1d321a2fb8..e4d382d3a7ae 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -480,6 +480,8 @@ static void btrfs_clone_write_end_io(struct bio *bio) static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio) { + u64 physical = bio->bi_iter...
9c46bcda5f347febdbb4d117fb21a37ffcec5fa4
Analyze and fix the following issue in the Linux kernel code: btrfs: check squota parent usage on membership change
Problem Details: We could have detected the quick inherit bug more directly if we had an extra warning about squota hierarchy consistency while modifying the hierarchy. In squotas, the parent usage always simply adds up to the sum of its children, so we can just check for that when changing membership and detect more a...
```diff diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 206587820fec..3a74759b59ee 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -346,6 +346,42 @@ int btrfs_verify_qgroup_counts(const struct btrfs_fs_info *fs_info, u64 qgroupid } #endif +static bool squota_check_parent_usage(struct btrfs_fs_inf...
29fb415a6a72c9207d118dd0a7a37184a14a3680
Analyze and fix the following issue in the Linux kernel code: btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
Problem Details: We allocate the bitmap but we never free it in free_raid_bio_pointers(). Fix this by adding a bitmap_free() call against the stripe_uptodate_bitmap of a raid bio. Fixes: 1810350b04ef ("btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap") Reported-by: Christoph Hellwig <hch@lst.de> Link: ...
```diff diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index f38d8305e46d..baadaaa189c0 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -150,6 +150,7 @@ static void scrub_rbio_work_locked(struct work_struct *work); static void free_raid_bio_pointers(struct btrfs_raid_bio *rbio) { bitmap_free(rbio->err...
87abe931fbc349d13407a3dd61e6e9a899389141
Analyze and fix the following issue in the Linux kernel code: MIPS: tools: relocs: Ship a definition of R_MIPS_PC32
Problem Details: R_MIPS_PC32 is a GNU extension, its definition is available in glibc only since 2.39 (released in 2024), and not available in musl libc yet. Provide our own definition for R_MIPS_PC32 and use it if necessary to fix relocs tool building on musl and older glibc systems. Fixes: ff79d31eb536 ("mips: Add s...
```diff diff --git a/arch/mips/boot/tools/relocs.h b/arch/mips/boot/tools/relocs.h index 607ff0103064..942981d9ce73 100644 --- a/arch/mips/boot/tools/relocs.h +++ b/arch/mips/boot/tools/relocs.h @@ -29,6 +29,13 @@ void die(char *fmt, ...); #define R_MIPS_PC26_S2 61 #endif +/* + * GNU extension that available in gl...
0061b5199d7c81076181a64529f7a799ebb89399
Analyze and fix the following issue in the Linux kernel code: devlink: Reverse locking order for nested instances
Problem Details: Commit [1] defined the locking expectations for nested devlink instances: the nested-in devlink instance lock needs to be acquired before the nested devlink instance lock. The code handling devlink rels was architected with that assumption in mind. There are no actual users of double locking yet but t...
```diff diff --git a/net/devlink/core.c b/net/devlink/core.c index 58093f49c090..6ae62c7f2a80 100644 --- a/net/devlink/core.c +++ b/net/devlink/core.c @@ -178,9 +178,7 @@ int devlink_rel_nested_in_add(u32 *rel_index, u32 devlink_index, * a notification of a change of this object should be sent * over netlink. The p...
3125fc17016945b11e9725c6aff30ff3326fd58f
Analyze and fix the following issue in the Linux kernel code: net: spacemit: k1-emac: fix jumbo frame support
Problem Details: The driver never programs the MAC frame size and jabber registers, causing the hardware to reject frames larger than the default 1518 bytes even when larger DMA buffers are allocated. Program MAC_MAXIMUM_FRAME_SIZE, MAC_TRANSMIT_JABBER_SIZE, and MAC_RECEIVE_JABBER_SIZE based on the configured MTU. Als...
```diff diff --git a/drivers/net/ethernet/spacemit/k1_emac.c b/drivers/net/ethernet/spacemit/k1_emac.c index 88e9424d2d51..b49c4708bf9e 100644 --- a/drivers/net/ethernet/spacemit/k1_emac.c +++ b/drivers/net/ethernet/spacemit/k1_emac.c @@ -12,6 +12,7 @@ #include <linux/dma-mapping.h> #include <linux/etherdevice.h> #i...
bc804a8d7e865ef47fb7edcaf5e77d18bf444ebc
Analyze and fix the following issue in the Linux kernel code: erofs: handle end of filesystem properly for file-backed mounts
Problem Details: I/O requests beyond the end of the filesystem should be zeroed out, similar to loopback devices and that is what we expect. Fixes: ce63cb62d794 ("erofs: support unencoded inodes for fileio") Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
```diff diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c index c1d0081609dc..43998fe1cce1 100644 --- a/fs/erofs/fileio.c +++ b/fs/erofs/fileio.c @@ -24,21 +24,17 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret) container_of(iocb, struct erofs_fileio_rq, iocb); struct folio_iter fi; - if (...
2030dddf95451b4e7a389f052091e7c4b7b274c6
Analyze and fix the following issue in the Linux kernel code: mm, shmem: prevent infinite loop on truncate race
Problem Details: When truncating a large swap entry, shmem_free_swap() returns 0 when the entry's index doesn't match the given index due to lookup alignment. The failure fallback path checks if the entry crosses the end border and aborts when it happens, so truncate won't erase an unexpected entry or range. But one ...
```diff diff --git a/mm/shmem.c b/mm/shmem.c index 6c3485d24d66..79af5f9f8b90 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1211,17 +1211,22 @@ whole_folios: swaps_freed = shmem_free_swap(mapping, indices[i], end - 1, folio); if (!swaps_freed) { - /* - * If found a large swap entry cross...
011d4e52a76cf4131ae612869b9874c09eef7657
Analyze and fix the following issue in the Linux kernel code: liveupdate: luo_file: do not clear serialized_data on unfreeze
Problem Details: Patch series "liveupdate: fixes in error handling". This series contains some fixes in LUO's error handling paths. The first patch deals with failed freeze() attempts. The cleanup path calls unfreeze, and that clears some data needed by later unpreserve calls. The second patch is a bit more involve...
```diff diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index a32a777f6df8..9f7283379ebc 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -402,8 +402,6 @@ static void luo_file_unfreeze_one(struct luo_file_set *file_set, luo_file->fh->ops->unfreeze(&args); }...