id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
919afb86694f5a8a9b50bff56cd8199f065b0dbb
Analyze and fix the following issue in the Linux kernel code: m68k: mcf5441x: fix clocks numbering
Problem Details: Fix clocks numbering, set correct values for eport and DAC, as per RM Rev 5, 05/2018, table 9.5. Fixes: bea8bcb12da09 ("m68knommu: Add support for the Coldfire m5441x.") Fixes: 007f84ede6e3e ("m68k: coldfire: remove private clk_get/clk_put") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> ...
```diff diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c index 6ce730098ff6..613b0275d9d8 100644 --- a/arch/m68k/coldfire/m5441x.c +++ b/arch/m68k/coldfire/m5441x.c @@ -41,9 +41,9 @@ DEFINE_CLK(0, "mcfpit.0", 32, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.1", 33, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.2", 3...
77a6b90ce56bc982dcfa94229b8e28e6abb16e95
Analyze and fix the following issue in the Linux kernel code: net: mvpp2: build skb from XDP-adjusted data on XDP_PASS
Problem Details: When an XDP program uses bpf_xdp_adjust_head() or bpf_xdp_adjust_tail() and then returns XDP_PASS, mvpp2 still builds the skb from fixed offsets derived from the original RX descriptor. Packet geometry changes made by the XDP program are therefore discarded before the skb reaches the stack. Update rx_...
```diff diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 481daafdc1cb..ccc24a1301f2 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3917,10 +3917,10 @@ static int mvpp2_rx(struct mv...
5e8e2a9624df72fca7c736b2966b2cbf6c9c3ff6
Analyze and fix the following issue in the Linux kernel code: net: mvpp2: refill RX buffers before XDP or skb use
Problem Details: The RX error path returns the current descriptor buffer to the hardware BM pool. That is only valid while the driver still owns the buffer. mvpp2_rx_refill() can fail after the current buffer has been handed to XDP or attached to an skb. In those cases mvpp2_run_xdp() may have recycled, redirected, or...
```diff diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 3372ed27cc8d..481daafdc1cb 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3971,6 +3971,12 @@ static int mvpp2_rx(struct mvp...
f3c6aa078927e6fe8121c9c591ddee8716c5305a
Analyze and fix the following issue in the Linux kernel code: net: mvpp2: limit XDP frame size to the RX buffer
Problem Details: mvpp2 has short and long BM pools, and short pool buffers can be smaller than PAGE_SIZE. The XDP path nevertheless initializes every xdp_buff with PAGE_SIZE as frame size. XDP helpers use frame_sz to validate tail growth and to derive the hard end of the data area. Advertising PAGE_SIZE for short buff...
```diff diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 92a701f4fe3f..3372ed27cc8d 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3979,7 +3979,7 @@ static int mvpp2_rx(struct mvpp...
180235600934bef6add3be637c296d6cf3272e67
Analyze and fix the following issue in the Linux kernel code: net: mvpp2: sync RX data at the hardware packet offset
Problem Details: mvpp2 programs the RX queue packet offset, so hardware writes received data at dma_addr + MVPP2_SKB_HEADROOM. The current CPU sync starts at dma_addr and only covers rx_bytes + MVPP2_MH_SIZE bytes, which syncs the unused headroom and misses the same number of bytes at the packet tail. On non-coherent ...
```diff diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index f442b874bb59..92a701f4fe3f 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3946,9 +3946,10 @@ static int mvpp2_rx(struct mvp...
36f1648644d769c496a8e47e53603e863e358d73
Analyze and fix the following issue in the Linux kernel code: mtd: slram: remove failed entries from the device list
Problem Details: register_device() links a new slram_mtdlist entry before allocating all of the state needed by the entry. If a later allocation, memremap(), or mtd_device_register() fails, the partially initialized entry remains on the global list. A later cleanup can then dereference or free invalid state from that f...
```diff diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index 69cb63d99f57..48c2bc6b65ee 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c @@ -129,6 +129,7 @@ static int slram_write(struct mtd_info *mtd, loff_t to, size_t len, static int register_device(char *name, unsig...
493f8fc57bf685e23d3c924dbd787249d47fb972
Analyze and fix the following issue in the Linux kernel code: phy: lynx-28g: avoid returning NULL in of_xlate() function
Problem Details: Sashiko points out that _of_phy_get() does not support a NULL returned output from phy_provider->of_xlate(), just a valid pointer or a pointer-encoded error. When lynx_28g_probe() -> for_each_available_child_of_node() skips over lanes which have OF nodes with status = "disabled", the priv->lane[idx].p...
```diff diff --git a/drivers/phy/freescale/phy-fsl-lynx-28g.c b/drivers/phy/freescale/phy-fsl-lynx-28g.c index 92bfc5f65e0b..cacc128dc96a 100644 --- a/drivers/phy/freescale/phy-fsl-lynx-28g.c +++ b/drivers/phy/freescale/phy-fsl-lynx-28g.c @@ -1435,7 +1435,7 @@ static struct phy *lynx_28g_xlate(struct device *dev, ...
ebc1d9906894703286d12306a6f242d90cfb49e8
Analyze and fix the following issue in the Linux kernel code: PCI: mediatek: Use actual physical address instead of virt_to_phys()
Problem Details: The driver previously used virt_to_phys() on the ioremapped register base (port->base) to compute the MSI message address. Using virt_to_phys() on an IO mapped address is incorrect because it expects a kernel virtual address. To fix it, store the physical start of the I/O register region in mtk_pcie_p...
```diff diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index f34d91e495bc..1bb8839c3cb0 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -176,6 +176,7 @@ struct mtk_pcie_soc { /** * struct mtk_pcie_port - PCIe port infor...
b3ee497970c63cea37976aeaa84bac39611fe0eb
Analyze and fix the following issue in the Linux kernel code: dt-bindings: phy: sc8280xp-qmp-pcie: Disallow bifurcation register on Purwa
Problem Details: Neither of the two Gen4x4 PHYs found on Purwa supports bifurcation. The PHY is however physically laid out as if it were to, since there are two separate ports (A/B). Split out a new if-then block to un-require the bifurcation register handle to squash this warning: purwa-iot-evk.dtb: phy@1bd4000 (qc...
```diff diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml index 3a35120a77ec..431e8cb5df84 100644 --- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/p...
5f1d444e084ce3e4619e38c45a8cc29e6fffb2bf
Analyze and fix the following issue in the Linux kernel code: crypto: xilinx-trng - Replace crypto_drbg_ctr_df() with HMAC-SHA512
Problem Details: This code is just trying to condition 48 bytes of random data. This can be done easily using HKDF-SHA512-Extract, saving 300 lines of code. This commit also fixes forward security (in this particular case) by clearing the entropy from memory after it's used. Signed-off-by: Eric Biggers <ebiggers@ker...
```diff diff --git a/crypto/Kconfig b/crypto/Kconfig index b5c5a1e04435..c3d7a20d5cb1 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1246,11 +1246,6 @@ config CRYPTO_KDF800108_CTR select CRYPTO_HMAC select CRYPTO_SHA256 -config CRYPTO_DF80090A - tristate - select CRYPTO_AES - select CRYPTO_CTR - endmenu m...
2dd67774228930ccf6441e5628996021f410c4e0
Analyze and fix the following issue in the Linux kernel code: crypto: xilinx-trng - Fix return value of xtrng_hwrng_trng_read()
Problem Details: Implementations of hwrng::read are expected to return the number of bytes generated. Update xtrng_hwrng_trng_read() to match that. Fixes: 8979744aca80 ("crypto: xilinx - Add TRNG driver for Versal") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu...
```diff diff --git a/drivers/crypto/xilinx/xilinx-trng.c b/drivers/crypto/xilinx/xilinx-trng.c index a35643baa489..a30b0b3b3685 100644 --- a/drivers/crypto/xilinx/xilinx-trng.c +++ b/drivers/crypto/xilinx/xilinx-trng.c @@ -239,18 +239,21 @@ static int xtrng_hwrng_trng_read(struct hwrng *hwrng, void *data, size_t max, b...
32b4d29280ed2a991dc196d5845b892acedc63b8
Analyze and fix the following issue in the Linux kernel code: crypto: xilinx-trng - Remove crypto_rng interface
Problem Details: Implementing the crypto_rng interface has no purpose, as it isn't used in practice. It's being removed from other drivers too. Just remove it. This leaves hwrng, which is actually used. Tagging with 'Cc stable' due to the bugs that this removes: - xtrng_trng_generate() sometimes returned success...
```diff diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 4c47ab6bb267..851904fb9ba4 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -703,7 +703,6 @@ config CRYPTO_DEV_XILINX_TRNG tristate "Support for Xilinx True Random Generator" depends on ZYNQMP_FIRMWARE || COMPILE_TEST se...
216a7795ec210bdabd5dad42323eee70bbfc8d90
Analyze and fix the following issue in the Linux kernel code: crypto: hisi-trng - Remove crypto_rng interface
Problem Details: drivers/crypto/hisilicon/trng/trng.c exposes the same hardware through two completely separate interfaces, crypto_rng and hwrng. However, the implementation of this is buggy because it permits generation operations from these interfaces to run concurrently with each other, accessing the same registers...
```diff diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig index 1e6d772f4bb6..8aa23c939775 100644 --- a/drivers/crypto/hisilicon/Kconfig +++ b/drivers/crypto/hisilicon/Kconfig @@ -80,6 +80,5 @@ config CRYPTO_DEV_HISI_TRNG tristate "Support for HISI TRNG Driver" depends on ARM64 && ACP...
af3d1bb9a09daf928fc3f173689fb7904d6a6d4f
Analyze and fix the following issue in the Linux kernel code: crypto: loongson - Remove broken and unused loongson-rng
Problem Details: The loongson-rng rng_alg has several vulnerabilities, including not providing forward security, and a use-after-free bug due to the use of wait_for_completion_interruptible(). Meanwhile, the rng_alg framework doesn't really have any purpose in the first place other than to access the software algorith...
```diff diff --git a/MAINTAINERS b/MAINTAINERS index 882214b0e7db..6c805560c77c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15070,7 +15070,6 @@ M: Qunqin Zhao <zhaoqunqin@loongson.cn> L: linux-crypto@vger.kernel.org S: Maintained F: drivers/char/tpm/tpm_loongson.c -F: drivers/crypto/loongson/ F: drivers/mfd/loon...
7811ec9e973d2c9e465083699f0c8240b98cb8c4
Analyze and fix the following issue in the Linux kernel code: crypto: crypto4xx - Remove insecure and unused rng_alg
Problem Details: Remove crypto4xx_rng, as it is insecure and unused: - It has only a 64-bit security strength, which is highly inadequate. This can be seen by the fact that crypto4xx_hw_init() seeds it with only 64 bits of entropy, and the fact that the original commit mentions that it implements ANSI X9.17 Anne...
```diff diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 3449b3c9c6ad..5dab813a9f74 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -301,7 +301,6 @@ config CRYPTO_DEV_PPC4XX select CRYPTO_CCM select CRYPTO_CTR select CRYPTO_GCM - select CRYPTO_RNG select CRYPTO_SKCIPHER h...
b3ac78756588059729b9195fcc9f4b37d54057a5
Analyze and fix the following issue in the Linux kernel code: crypto: qat - validate RSA CRT component lengths
Problem Details: The generic RSA key parser (rsa_helper.c) bounds each CRT component (p, q, dp, dq, qinv) by the modulus size n_sz, but qat_rsa_setkey_crt() allocates half-size DMA buffers (key_sz / 2) and right-aligns each component with: memcpy(dst + half_key_sz - len, src, len) When a CRT component is larger t...
```diff diff --git a/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c b/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c index e09b9edfce42..75c15c8e41db 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c @@ -1085,7 +1085,7 @@ static void qat...
7524fe142b5a772f8421aeee2132cf7e21a00103
Analyze and fix the following issue in the Linux kernel code: dt-bindings: dma: snps,dw-axi-dmac: Add fallback compatible for CV1800B
Problem Details: The previous version of the binding change only add compatible string without adding the fallback compatible, this breaks backward compatibility. Add the needed fallback compatible to fix this. Fixes: be3e2a0419c6 ("dt-bindings: dma: snps,dw-axi-dmac: Add CV1800B compatible") Signed-off-by: Inochi Ama...
```diff diff --git a/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml b/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml index 804514732dbe..0a30a455b0ee 100644 --- a/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml +++ b/Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml @@ -2...
df0c2dc68770cf43f15df40b184df030b850ea05
Analyze and fix the following issue in the Linux kernel code: dmaengine: dw-axi-dmac: fix PM for system sleep and channel alloc
Problem Details: The driver only had runtime PM callbacks. If a channel stayed allocated across system suspend/resume, the runtime usage count could remain non-zero while hardware state (DMAC_CFG, clocks) was lost, and axi_dma_runtime_resume() would not run to restore it. Add system-sleep PM ops that use pm_runtime_fo...
```diff diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index f7a50f470461..bcefaff03b5c 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -516,11 +516,17 @@ static void dw_axi_dma_synchronize(...
6251f7d3472c0409e30f8d6a24f10d33d12e3f9a
Analyze and fix the following issue in the Linux kernel code: Input: synaptics-rmi4 - unregister function handlers on physical driver registration failure
Problem Details: If rmi_register_physical_driver() fails, the current error path unregisters only the RMI bus. The function handlers registered earlier remain registered with the driver core. Add a separate error path to unregister the function handlers before unregistering the bus in this failure case. Fixes: 2b6a32...
```diff diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 687cb987bc13..ade57e2a7201 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -455,11 +455,13 @@ static int __init rmi_bus_init(void) if (error) { pr_err("%s: error registering the RMI physical drive...
10627ddc0167aab5c1c390a10ef461e9937aba08
Analyze and fix the following issue in the Linux kernel code: bpf: Tighten cgroup storage cookie checks for prog arrays
Problem Details: The fix in commit abad3d0bad72 ("bpf: Fix oob access in cgroup local storage") is still incomplete. The prog-array compatibility check treats a program with no cgroup storage as compatible with any stored storage cookie. This allows a storage-less program to bridge a tail call chain between an entry pr...
```diff diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index a656a8572bdb..649cce41e13f 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -2481,7 +2481,7 @@ static bool __bpf_prog_map_compatible(struct bpf_map *map, cookie = aux->cgroup_storage[i] ? aux->cgroup_storage[i]->cookie : 0; ret = ma...
856668312685d9a8f32d49a135a89c429d309f81
Analyze and fix the following issue in the Linux kernel code: Input: ads7846 - don't use scratch for tx_buf when clearing register
Problem Details: The workaround for XPT2046 clears the command register, giving the touchscreen controller a NOP. The change incorrectly re-uses the req->scratch variable which is used as rx_buf for xfer[5], so by the time xfer[6] occurs, the contents of req->scratch may not be 0. It was found that the touchscreen cont...
```diff diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index d3b529333ca2..8d6416ac283e 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -328,7 +328,6 @@ struct ser_req { u8 ref_on; u8 command; u8 ref_off; - u16 scratch; ...
52e582e316c48c53bb3082c29f7862ebc554087e
Analyze and fix the following issue in the Linux kernel code: perf symbols: Add bounds checks to read_build_id() note iteration in minimal build
Problem Details: symbol-minimal.c's read_build_id() iterates ELF notes with the same pattern as symbol-elf.c's elf_read_build_id(): pointer arithmetic driven by n_namesz and n_descsz from 32-bit note header fields, without validating that the name and desc fit within the note section data. A malformed ELF file with ov...
```diff diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index 8221dc9868f7..091071d06416 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "dso.h" #include "symbol.h" #include "symsrc.h" @@ -44,7 +45,7 @@...
acc56d3941fc2997a5a21ea9233a8ac3d87c4f2f
Analyze and fix the following issue in the Linux kernel code: perf symbols: Add bounds checks to elf_read_build_id() note iteration
Problem Details: elf_read_build_id() iterates ELF notes using pointer arithmetic driven by n_namesz and n_descsz from the note headers. Neither the note header read nor the subsequent name/desc advances are checked against the section boundary. A malformed ELF file with oversized note sizes causes out-of-bounds reads...
```diff diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 10902a5dc6db..d84e2e031d43 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -835,10 +835,24 @@ static int elf_read_build_id(Elf *elf, void *bf, size_t size) ptr = data->d_buf; while (ptr < (data->d_...
a0e4362a3e7b592f1d58949ffe3d6decad39a17c
Analyze and fix the following issue in the Linux kernel code: perf bpf: Fix metadata leak in perf_env__add_bpf_info() on duplicate insert
Problem Details: When perf_env__insert_bpf_prog_info() returns false (duplicate program), the error path frees info_linear and info_node but not info_node->metadata. If bpf_metadata_create() had succeeded, the metadata allocation is permanently leaked. Fix by calling bpf_metadata_free() on info_node->metadata before ...
```diff diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index b65ad28cd950..c4594969d767 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -873,6 +873,7 @@ static int perf_env__add_bpf_info(struct perf_env *env, u32 id) if (!perf_env__insert_bpf_prog_info(env, info_...
aece2b8966fc8de5be46ee9287d0f60d6690c300
Analyze and fix the following issue in the Linux kernel code: perf bpf: Fix map data leak in bpf_metadata_create() on alloc failure
Problem Details: bpf_metadata_create() calls bpf_metadata_read_map_data() which allocates map.btf and map.rodata. If the subsequent bpf_metadata_alloc() fails, the code does 'continue' which skips bpf_metadata_free_map_data(), permanently leaking both allocations. Fix by calling bpf_metadata_free_map_data() before co...
```diff diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index fe01551dc3e6..b65ad28cd950 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -395,8 +395,10 @@ static struct bpf_metadata *bpf_metadata_create(struct bpf_prog_info *info) continue; metadata = bpf_me...
903b0526dcf86d030c5970b4b0a67f9c227368e2
Analyze and fix the following issue in the Linux kernel code: perf bpf: Add NULL check for btf__type_by_id() in synthesize_bpf_prog_name()
Problem Details: synthesize_bpf_prog_name() calls btf__type_by_id() and immediately dereferences the result via t->name_off without checking for NULL. btf__type_by_id() returns NULL when the type_id is invalid or out of range. When processing perf.data files, finfo->type_id comes from untrusted input, so an invalid ID...
```diff diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 2c09842469f1..fe01551dc3e6 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -146,7 +146,8 @@ static int synthesize_bpf_prog_name(char *buf, int size, if (btf) { finfo = func_infos + sub_id * info->func...
fd1f70776add263f8ef38a87ae593c75303f1dcd
Analyze and fix the following issue in the Linux kernel code: tools lib api: Fix mount_overload() snprintf truncation and toupper range
Problem Details: mount_overload() builds an environment variable name like "PERF_SYSFS_ENVIRONMENT" from fs->name. Two bugs: 1) snprintf() uses name_len as the buffer size instead of sizeof(upper_name). For fs->name = "sysfs" (len=5), the output is truncated to "PERF" (4 chars + null), so getenv() never finds t...
```diff diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c index d16911818d4d..cbd8eab0d1df 100644 --- a/tools/lib/api/fs/fs.c +++ b/tools/lib/api/fs/fs.c @@ -261,8 +261,8 @@ static const char *mount_overload(struct fs *fs) /* "PERF_" + name + "_ENVIRONMENT" + '\0' */ char upper_name[5 + name_len + 12 + 1];...
438ece06185696e14c63c6113d5e2d34ec0a9680
Analyze and fix the following issue in the Linux kernel code: tools lib api: Fix filename__write_int() writing uninitialized stack data
Problem Details: filename__write_int() formats an integer into a 64-byte buffer with sprintf() then passes sizeof(buf) (64) as the write length. This writes all 64 bytes including uninitialized stack data past the formatted string. Most sysfs files reject the oversized write, making the function always return -1. Fi...
```diff diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c index 3cc302d4c47b..d16911818d4d 100644 --- a/tools/lib/api/fs/fs.c +++ b/tools/lib/api/fs/fs.c @@ -376,12 +376,13 @@ int filename__write_int(const char *filename, int value) { int fd = open(filename, O_WRONLY), err = -1; char buf[64]; + int len; ...
2ea64782a428bed74f595961e651ceb8c4c5bf22
Analyze and fix the following issue in the Linux kernel code: perf tools: Use snprintf() in dso__read_running_kernel_build_id()
Problem Details: dso__read_running_kernel_build_id() uses sprintf() to format a sysfs path from machine->root_dir into a PATH_MAX buffer. If root_dir is close to PATH_MAX in length, appending "/sys/kernel/notes" (18 bytes) overflows the stack buffer. Switch to snprintf() with sizeof(path) to prevent the overflow. Re...
```diff diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 6a34717c9f31..5d0179758738 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -1779,7 +1779,7 @@ void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine) if (machine__is_default_guest(machine)) return;...
34d3d93fac6d92237cb9d730ca04c37ed361c7a6
Analyze and fix the following issue in the Linux kernel code: perf hwmon: Guard label read against empty or failed reads
Problem Details: hwmon_pmu__read_events() reads label files with read() into a stack buffer, strips trailing newlines, then checks buf[0] == '\0'. When read() returns 0 (empty file) or -1 (error), the buffer is never written, so buf[0] reads uninitialized stack memory. If the garbage byte is non-zero, the code falls ...
```diff diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c index bdcbe887579a..efd3067a2e59 100644 --- a/tools/perf/util/hwmon_pmu.c +++ b/tools/perf/util/hwmon_pmu.c @@ -295,8 +295,11 @@ static int hwmon_pmu__read_events(struct hwmon_pmu *pmu) while (read_len > 0 && buf[read_len - 1] == '\n') ...
51cdb188edeaf389e4377859b9c483c19ce5a259
Analyze and fix the following issue in the Linux kernel code: perf tools: Fix uninitialized pathname on uncompressed fallback in filename__decompress()
Problem Details: filename__decompress() has an early return path for files that are not actually compressed. This path returns the fd from open() directly but never writes to the pathname output parameter, leaving the caller with an uninitialized buffer despite a successful return. Callers like dso__decompress_kmodul...
```diff diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 47043a3a2fb4..e82ecdc95777 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -471,8 +471,11 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, goto out; } - decomp = t...
1b4e9fbdeabc549965e70ac0cd8095d57ff6df06
Analyze and fix the following issue in the Linux kernel code: perf symbols: Bounds-check descsz in sysfs__read_build_id() GNU fallback
Problem Details: When sysfs__read_build_id() matches NT_GNU_BUILD_ID with the right namesz but the name content is not "GNU", it falls back to reading descsz bytes into the stack buffer bf[BUFSIZ]: } else if (read(fd, bf, descsz) != (ssize_t)descsz) Unlike the else branch which validates namesz + descsz against s...
```diff diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 36a0304707e1..06cfb84f86eb 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -961,8 +961,13 @@ int sysfs__read_build_id(const char *filename, struct build_id *bid) err = 0; break; } - ...
e1a2c9d70b312acc262f6be936dd5bbd9bbc6236
Analyze and fix the following issue in the Linux kernel code: perf hwmon: Fix parse_hwmon_filename() strlcpy buffer overflow
Problem Details: parse_hwmon_filename() strips the "_alarm" suffix from event names by copying into a 24-byte stack buffer: strlcpy(fn_type, fn_item, fn_item_len - 5); The third argument is the source length minus the suffix, not the destination buffer capacity. A long event name ending in "_alarm" can have fn_i...
```diff diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c index fbfb872ceb18..bdcbe887579a 100644 --- a/tools/perf/util/hwmon_pmu.c +++ b/tools/perf/util/hwmon_pmu.c @@ -202,7 +202,8 @@ bool parse_hwmon_filename(const char *filename, fn_item_len = strlen(fn_item); if (fn_item_len > 6 && !strcmp...
ae75956c166fe169b8c137bf375305fc97820a62
Analyze and fix the following issue in the Linux kernel code: perf hwmon: Use scnprintf() in hwmon_pmu__for_each_event()
Problem Details: hwmon_pmu__for_each_event() formats description strings via: len = snprintf(desc_buf, sizeof(desc_buf), "%s in unit %s named %s.", ...); len += hwmon_pmu__describe_items(hwm, desc_buf + len, sizeof(desc_buf) - len, ...); If value->label is long enough to cause snprintf() to truncate, it retur...
```diff diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c index d895cd74f2a0..fbfb872ceb18 100644 --- a/tools/perf/util/hwmon_pmu.c +++ b/tools/perf/util/hwmon_pmu.c @@ -514,14 +514,14 @@ int hwmon_pmu__for_each_event(struct perf_pmu *pmu, void *state, pmu_event_callb int ret; size_t len; -...
1847c5fae344a0fb9cc0f95be40b378359c6fc3b
Analyze and fix the following issue in the Linux kernel code: perf hwmon: Fix off-by-one null termination on sysfs reads
Problem Details: Three functions read sysfs files into fixed-size stack buffers using the full buffer size, then null-terminate at buf[read_len]. If the read fills the buffer exactly, read_len equals sizeof(buf) and the null byte writes one past the array, corrupting an adjacent stack variable. Fix all three by readi...
```diff diff --git a/tools/perf/util/hwmon_pmu.c b/tools/perf/util/hwmon_pmu.c index dbf6a71af47f..d895cd74f2a0 100644 --- a/tools/perf/util/hwmon_pmu.c +++ b/tools/perf/util/hwmon_pmu.c @@ -289,7 +289,7 @@ static int hwmon_pmu__read_events(struct hwmon_pmu *pmu) if (fd < 0) continue; - read_len = read(fd,...
31d596054550f793508abe7dd593853ece47d428
Analyze and fix the following issue in the Linux kernel code: perf tools: Fix thread__set_comm_from_proc() on empty comm file
Problem Details: thread__set_comm_from_proc() calls procfs__read_str() then strips the trailing newline via comm[sz - 1] = '\0'. procfs__read_str() allocates the buffer before reading, so on an empty /proc/pid/comm (reachable during late exit teardown) it returns success with sz = 0 and an unterminated heap buffer. T...
```diff diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index ba33c0dfc18f..e483ffcb5d93 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -295,6 +295,11 @@ int thread__set_comm_from_proc(struct thread *thread) if (!(snprintf(path, sizeof(path), "%d/task/%d/comm", thre...
b6bb3b005dcdd960b8e0b7f9d6869132b3de08d5
Analyze and fix the following issue in the Linux kernel code: perf intel-pt: Fix snprintf size tracking bug in insn decoder
Problem Details: dump_insn() tracks remaining buffer space with a 'left' variable, but the loop subtracts the cumulative offset 'n' each iteration instead of just the per-iteration delta: n += snprintf(x->out + n, left, "%02x ", inbuf[i]); left -= n; /* BUG: n is cumulative, not the delta */ After two iterat...
```diff diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c index 72c7a4e15d61..f90fcbc4302d 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c @@ -220,7 +220,6 ...
b8acc68f1382a3f380a0e7320a95d328ac5e9027
Analyze and fix the following issue in the Linux kernel code: perf tools: Use mkostemp() for O_CLOEXEC on temporary files
Problem Details: mkstemp() creates file descriptors without the close-on-exec flag. These fds leak to child processes spawned during symbol resolution (addr2line, objdump), wasting descriptors and potentially exposing temporary file contents. Replace mkstemp() with mkostemp(tmpbuf, O_CLOEXEC) at all three call sites: ...
```diff diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index fb2e78fe2aa8..ee06a252a54d 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -346,7 +346,7 @@ int filename__decompress(const char *name, char *pathname, if (!compressions[comp].is_compressed(name)) return open(name, O_RDONLY |...
9c74f0aab398cb32ab250401f323c0fdc9a3a496
Analyze and fix the following issue in the Linux kernel code: perf symbols: Bounds-check .gnu_debuglink section data
Problem Details: filename__read_debuglink() copies .gnu_debuglink section data into a caller-provided buffer via: strncpy(debuglink, data->d_buf, size); where size is PATH_MAX. If the ELF section is smaller than size and lacks a null terminator, strncpy reads past data->d_buf into adjacent memory. A malformed E...
```diff diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 8fb25a5692b5..51e7cfe0f593 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1027,7 +1027,14 @@ int filename__read_debuglink(const char *filename, char *debuglink, goto out_elf_end; /* the start ...
6eaa8ee3e2abe5112e80e94c27196bb175689469
Analyze and fix the following issue in the Linux kernel code: perf symbols: Fix signed overflow in sysfs__read_build_id() size check
Problem Details: sysfs__read_build_id() reads ELF note headers from sysfs files. The note's namesz and descsz fields are used to compute the skip size: int n = namesz + descsz; if (n > (int)sizeof(bf)) Both namesz and descsz are size_t from NOTE_ALIGN() of 32-bit note header fields. Their sum can exceed INT...
```diff diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index c2bdfd0003df..8fb25a5692b5 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -964,14 +964,17 @@ int sysfs__read_build_id(const char *filename, struct build_id *bid) } else if (read(fd, bf, descsz) !=...
52b1f9678499b13b7aeb0186d9c6f486c043283f
Analyze and fix the following issue in the Linux kernel code: tools lib api: Fix missing null termination in filename__read_int/ull()
Problem Details: filename__read_int() passes a stack buffer to read() using the full sizeof(line) and then hands it to atoi() without null-terminating. If a sysfs file fills the 64-byte buffer exactly, atoi() reads past the array into uninitialized stack memory. filename__read_ull_base() has the same issue with strtou...
```diff diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c index edec23406dbc..3cc302d4c47b 100644 --- a/tools/lib/api/fs/fs.c +++ b/tools/lib/api/fs/fs.c @@ -294,11 +294,14 @@ int filename__read_int(const char *filename, int *value) { char line[64]; int fd = open(filename, O_RDONLY), err = -1; + ssize_t n...
33035f7dd4e49f3f117e70c5e36c8c1ae88d37f2
Analyze and fix the following issue in the Linux kernel code: perf pmu: Fix perf_pmu__parse_scale/unit() OOB access on empty sysfs file
Problem Details: perf_pmu__parse_scale() reads a PMU scale file then accesses scale[sret - 1] to strip a trailing newline. Only sret < 0 is guarded, so an empty file (sret == 0) causes scale[-1] — a stack buffer underflow that reads and potentially writes out of bounds. perf_pmu__parse_unit() has the same pattern: al...
```diff diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index f588cce60194..a550f030b85d 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -314,7 +314,7 @@ static int perf_pmu__parse_scale(struct perf_pmu *pmu, struct perf_pmu_alias *al goto error; sret = read(fd, scale, sizeof(scale)-...
836455e6dbd34eb3d12eeab5e2d2b9a7f1512459
Analyze and fix the following issue in the Linux kernel code: perf pmu: Fix pmu_id() heap underwrite on empty identifier file
Problem Details: pmu_id() calls filename__read_str() then strips the trailing newline via str[len - 1] = 0. If the PMU identifier file is empty, filename__read_str() succeeds with len = 0. len - 1 underflows size_t to SIZE_MAX, writing a null byte before the heap allocation. Add a len == 0 check before the newline s...
```diff diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 1539960ba23b..f588cce60194 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -865,6 +865,12 @@ static char *pmu_id(const char *name) if (filename__read_str(path, &str, &len) < 0) return NULL; + /* empty identifier file — not...
2f4e244b5968b1f7392d7de31dc961ef80f2e42e
Analyze and fix the following issue in the Linux kernel code: perf jitdump: Fix a build error with ASAN
Problem Details: I found this error when I pass EXTRA_CFLAGS=-fsanitize=address on Fedora 44 with GCC 16. Fix it by copying one less byte. CC util/jitdump.o util/jitdump.c: In function ‘jit_process’: util/jitdump.c:237:9: error: ‘__builtin_strncpy’ specified bound 4096 equals destination size ...
```diff diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 18fd84a82153..83005b30b9bf 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -234,7 +234,7 @@ jit_open(struct jit_buf_desc *jd, const char *name) /* * keep dirname for generating files and mmap records */ - ...
04d8a36625efe5ad20d7c2c04cdae960af70d118
Analyze and fix the following issue in the Linux kernel code: perf test cs-etm: Speed up basic test
Problem Details: Like the name says, this should be the most basic test possible. Kernel recording is slow and already has coverage on the systemwide test. Perf report output also has coverage elsewhere. 'ls' also produces more trace than 'true'. We only want to test if the combination of recording options works at al...
```diff diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh index da2f599393e2..83295a8fe179 100755 --- a/tools/perf/tests/shell/test_arm_coresight.sh +++ b/tools/perf/tests/shell/test_arm_coresight.sh @@ -179,10 +179,9 @@ arm_cs_etm_snapshot_test() { arm_cs_etm_b...
68ca50bc0fa64841cd73b8a1538df1d7f7eb4108
Analyze and fix the following issue in the Linux kernel code: perf cs-etm: Queue context packets for frontend
Problem Details: PE_CONTEXT elements update the context ID and exception level, but the decoder may still have prior packets cached for frontend processing. Updating the context immediately in the decoder backend can make those cached packets get consumed with the wrong thread or EL state. Add a CS_ETM_CONTEXT packet ...
```diff diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index dee3020ceaa9..26940f1f1b0b 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -402,6 +402,8 @@ cs_etm_decoder__buffer_packet(str...
4aa4d246c81f360d2609c6ffe0b72f2895973447
Analyze and fix the following issue in the Linux kernel code: perf pmu: Use scnprintf in buffer offset calculations
Problem Details: Replace snprintf with scnprintf in buffer offset calculations to ensure the 'used' count will not exceed the "len". The current logic in perf_pmu__for_each_event uses an unconditional + 1 increment to buf_used to account for null terminators. This can cause a stack buffer overflow in the subsequent sc...
```diff diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index e765a7ffb0d6..1539960ba23b 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -2146,15 +2146,19 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu, pr_err("Failure to parse '%s' terms '%s': %d\n", ali...
e191518a9e72ec0b9d0254d537a48a4c8d18dc4b
Analyze and fix the following issue in the Linux kernel code: pinctrl: qcom: eliza: Add missing sdc2 pin function mappings
Problem Details: GPIOs 38, 39, 48 and 49 support the SDC2 DATA function, while GPIO 51 supports SDC2 CMD and GPIO 62 supports SDC2 CLK. However, the sdc2 pin function is not listed in the corresponding pingroup definitions, preventing these pins from being muxed for SDC2 operation. Add the missing sdc2 function mappi...
```diff diff --git a/drivers/pinctrl/qcom/pinctrl-eliza.c b/drivers/pinctrl/qcom/pinctrl-eliza.c index 4a2ef7b2a28c..32711db0c82e 100644 --- a/drivers/pinctrl/qcom/pinctrl-eliza.c +++ b/drivers/pinctrl/qcom/pinctrl-eliza.c @@ -1402,8 +1402,8 @@ static const struct msm_pingroup eliza_groups[] = { [35] = PINGROUP(35, q...
90220ddfa8e2c93e26af2cd51d6158ca2243c622
Analyze and fix the following issue in the Linux kernel code: i2c: mxs: add missing kernel-doc for struct mxs_i2c_dev members
Problem Details: Add kernel-doc documentation for the struct members that were previously undocumented. This fixes warnings when building with W=1 and ensures the struct is fully documented per kernel-doc conventions. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Frank Li ...
```diff diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 08c9091a1e35..4e07babea9c3 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -108,6 +108,14 @@ enum mxs_i2c_devtype { * @cmd_complete: completion object for transaction wait * @cmd_err: error code fo...
d798af0a0f271e6d1e000e9fed579d25317091c3
Analyze and fix the following issue in the Linux kernel code: pinctrl: qcom: lpass-lpi: drop unused runtime-PM write helper
Problem Details: lpi_gpio_write() became unused after the PM clock runtime conversion switched write paths to register helper calls inside callers that already hold an active runtime-PM reference. With -Werror this triggers: error: 'lpi_gpio_write' defined but not used [-Wunused-function] Drop the dead wrapper and ...
```diff diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c index 4d758fd117c4..5fd4a4eba654 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -52,15 +52,15 @@ static void __iomem *lpi_gpio_reg(struct lpi_pinctrl *state, ...
4ec5e932e636896e97e4c6a8205b0ac76d52421a
Analyze and fix the following issue in the Linux kernel code: vfio/qat: fix f_pos race in qat_vf_resume_write()
Problem Details: qat_vf_resume_write() checks filp->f_pos before taking migf->lock, but copies into the migration-state buffer after taking the lock and re-reading the shared file position. Two concurrent writers could therefore pass the bounds check with the old offset, then have the second writer copy after the firs...
```diff diff --git a/drivers/vfio/pci/qat/main.c b/drivers/vfio/pci/qat/main.c index ac9652539d66..60ff907b6a67 100644 --- a/drivers/vfio/pci/qat/main.c +++ b/drivers/vfio/pci/qat/main.c @@ -298,14 +298,18 @@ static ssize_t qat_vf_resume_write(struct file *filp, const char __user *buf, return -ESPIPE; offs = &filp...
8e45719acdd6bf0bb6bf083957b53e40340dcd41
Analyze and fix the following issue in the Linux kernel code: dt-bindings: interrupt-controller: renesas,r9a09g077-icu: Fix reg size in example
Problem Details: According to Figure 5.1 ("Unified memory map"), the safety register block is 64 KiB large, just like the non-safety register block. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/364ff570c8...
```diff diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,r9a09g077-icu.yaml b/Documentation/devicetree/bindings/interrupt-controller/renesas,r9a09g077-icu.yaml index 78c01d14e765..a809bc4f7515 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/renesas,r9a09g077-icu.yaml +++ b...
4bd109899fb51594e0d868238ada109c12d13a74
Analyze and fix the following issue in the Linux kernel code: perf tools: Fix the check for parameterized field in event term
Problem Details: The format_alias() function in util/pmu.c has a check to detect whether the event has parameterized field ( =? ). The string alias->terms contains the event and if the event has user configurable parameter, there will be presence of sub string "=?" in the alias->terms. Snippet of code: /* Paramemter...
```diff diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 9994709ef12b..e765a7ffb0d6 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -2134,7 +2134,7 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu, skip_duplicate_pmus); /* Paramemterized events ...
2857a5dca750ea989c6fb70b4c14e801e4b7b4ad
Analyze and fix the following issue in the Linux kernel code: perf data convert json: Fix addr_location leak on time-filtered samples
Problem Details: When samples are skipped due to time filtering in process_sample_event(), the early return path bypasses addr_location__exit(), causing memory leaks of thread, map, and maps references acquired by machine__resolve(). These references must be released through addr_location__exit() before returning. Fi...
```diff diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c index c71dfb77c697..40412c3dbdb2 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -177,6 +177,7 @@ static int process_sample_event(const struct perf_tool *tool, if (perf_time__...
49f5f6ae67dec54014584bb3126a5a94f14e2a5c
Analyze and fix the following issue in the Linux kernel code: perf s390: Fix TEXTREL in Python extension by compiling as PIC
Problem Details: On s390 the Python extension build fails as follows when using a linker that is configured to treat text relocations (TEXTREL) in shared libraries as error by default: GEN python/perf.cpython-314-s390x-linux-gnu.so /usr/bin/ld.bfd: error: read-only segment has dynamic relocations This occurrs b...
```diff diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 6e7b15fab2ec..0ba307e78fe1 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -77,6 +77,7 @@ endif ifeq ($(ARCH),s390) CFLAGS += -fPIC + CXXFLAGS += -fPIC endif # Unconditionally set up the libunwind f...
8d28a56cae9b298a351b361d8d374cb4a9089e3f
Analyze and fix the following issue in the Linux kernel code: perf riscv: fix register name strings
Problem Details: On risc-v, pref probe generates an invalid syntax for a named register in a kprobe. $ perf probe --debug verbose --add "n_tty_write tty" ... Writing event: p:probe/n_tty_write _text+8922528 tty=%"%a0":x64 Failed to write event: Invalid argument The problem is the combination of #define REG_DWARFN...
```diff diff --git a/tools/perf/arch/riscv/include/dwarf-regs-table.h b/tools/perf/arch/riscv/include/dwarf-regs-table.h index 009a4e3c51ab..8c42806d34f1 100644 --- a/tools/perf/arch/riscv/include/dwarf-regs-table.h +++ b/tools/perf/arch/riscv/include/dwarf-regs-table.h @@ -3,7 +3,7 @@ /* This is included in perf/util...
60e7870052f417d83965db144f70ae21fcfcf37f
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Return sendctx slot after Send preparation failure
Problem Details: rpcrdma_prepare_send_sges() gets a sendctx before it maps the SGEs for the Send WR. If one of the mapping helpers fails, no Send WR is posted, so no Send completion is guaranteed to advance rb_sc_tail. Current cleanup clears sc_req so a later completion can sweep over that slot, but a consecutive run ...
```diff diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 3f50828802de..1285f04cdac1 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -747,6 +747,7 @@ inline int rpcrdma_prepare_send_sges(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdr, ...
abc011ddaf1617e3e82d8a1e87daa7ddbfb9bac5
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Repost Receive buffers for malformed replies
Problem Details: rpcrdma_wc_receive() decrements the transport's Receive count for every completion before it dispatches a successful Receive to rpcrdma_reply_handler(). The handler must post a replacement Receive WR before returning unless ownership of the rep has moved elsewhere, as on the backchannel path. Commit 2...
```diff diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 5ff086ccd259..3f50828802de 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1528,11 +1528,13 @@ out_norqst: out_badversion: trace_xprtrdma_reply_vers_err(rep); - goto out; + rpcrdma_rep_pu...
c3a628aab2dc8f5fd7bff86ceaeae64de590e60a
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Sanitize the reply credit grant after parsing
Problem Details: The out_norqst exit in rpcrdma_reply_handler() branches away before the credit clamp, so a reply that matches no pending request reaches out_post carrying the raw credit value parsed from the wire. rpcrdma_post_recvs() does not bound its @needed argument: the refill loop allocates and chains Receive WR...
```diff diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 63e64d53e289..5ff086ccd259 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1472,6 +1472,14 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) credits = be32_to_cpu(*p++); rep->rr_proc ...
c7653d5cebc8492c77ec0415b5e9c0fb3e644bc6
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Fix bcall rep leak and unbounded peek
Problem Details: rpcrdma_is_bcall() decodes a reply's first words to decide whether the frame is a backchannel call. Two issues in that decode path let a short or malformed reply leak the receive buffer and drain the Receive queue. First, the speculative peek p = xdr_inline_decode(xdr, 0); /* five p++ reads f...
```diff diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index f115baba6d56..63e64d53e289 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -1088,6 +1088,8 @@ rpcrdma_is_bcall(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep) /* Peek at stream conten...
234c0ff695ef3ffb656931000e6b823d0c2f30fd
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Resize reply buffers before reposting receives
Problem Details: Commit 0e13dd9ea8be ("xprtrdma: Remove temp allocation of rpcrdma_rep objects") made rpcrdma_rep objects survive disconnects. That is normally fine, but it also means their receive regbufs keep the size they had when they were first allocated. Each rep's receive buffer is sized to ep->re_inline_recv w...
```diff diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 74d173e5681d..8392ba4bcdca 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -81,6 +81,8 @@ rpcrdma_regbuf_alloc_node(size_t size, enum dma_data_direction direction, int node); static struct rpcrdma_r...
0f13fc7c7d2e0427517e63c739277a4cd338b0c5
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Check frwr_wp_create() during connect
Problem Details: frwr_wp_create() creates the singleton Memory Region used to encode padding for Write chunks whose payload length is not XDR-aligned. Its failure paths return a negative errno and leave ep->re_write_pad_mr set to NULL. rpcrdma_xprt_connect() currently ignores that return value. If frwr_wp_create() fai...
```diff diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index a192b77ce739..74d173e5681d 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -549,7 +549,17 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) goto out; } rpcrdma_mrs_create(r_xprt); - frwr_wp_c...
bb7caa63e1db22fd03e8dc591b12169e99169dff
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Initialize re_id before removal registration
Problem Details: rpcrdma_create_id() registers ep->re_rn with the rpcrdma ib_client before returning the new rdma_cm_id to rpcrdma_ep_create(). However rpcrdma_ep_create() currently stores that pointer in ep->re_id only after rpcrdma_create_id() returns. A local administrator can race an NFS/RDMA mount against RDMA de...
```diff diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 7ddab4ed5d03..a192b77ce739 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -334,6 +334,7 @@ static struct rdma_cm_id *rpcrdma_create_id(struct rpcrdma_xprt *r_xprt, if (rc) goto out; + ep->re_id = i...
af9b65b29af341932625c4283dc7a23cdb62688a
Analyze and fix the following issue in the Linux kernel code: xprtrdma: Fix ep kref imbalance on ADDR_CHANGE
Problem Details: rpcrdma_cm_event_handler() falls through to the disconnected: label on RDMA_CM_EVENT_ADDR_CHANGE and calls rpcrdma_ep_put() with no matching get when the event arrives before RDMA_CM_EVENT_ESTABLISHED. The kref then underflows during connect teardown and rpcrdma_xprt_disconnect() operates on a freed ep...
```diff diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 993bc5c444a4..7ddab4ed5d03 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -245,8 +245,17 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) complete(&ep->re_done); retur...
b6e267e3d3ffb10277bf5ade6f66d5f0d7bde399
Analyze and fix the following issue in the Linux kernel code: dt-bindings: nvmem: consumer: Make 'nvmem' an array of one-item entries
Problem Details: 'nvmem' unlike 'nvmem-cells', consumes references to just a single phandle with no arguments (i.e. with 0 cells). Constrain the schema to enforce that, so that the number of such single-item entries can then be regulated by IP block-specific YAMLs. Suggested-by: Rob Herring <robh@kernel.org> Signed-o...
```diff diff --git a/Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml b/Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml index a26633bf52db..45836308c724 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml @@ -1...
63a694c51bf120a37550890b8e7736b4888985e9
Analyze and fix the following issue in the Linux kernel code: HID: uhid: convert to hid_safe_input_report()
Problem Details: Commit 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()"), added a check in hid_report_raw_event() to reject reports if the received data size is smaller than expected. This was intended to prevent OOB errors by no longer allowing zeroing-out of shorter reports due to the lac...
```diff diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 524b53a3c87b..37b60c3aaf66 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -595,8 +595,8 @@ static int uhid_dev_input(struct uhid_device *uhid, struct uhid_event *ev) if (!READ_ONCE(uhid->running)) return -EINVAL; - hid_input_report(u...
7698e338f49a436072c3800183e7b37394958e58
Analyze and fix the following issue in the Linux kernel code: Input: ads7846 - restore half-duplex support
Problem Details: On some boards, the SPI controller is limited to half-duplex and the driver fails spamming "ads7846 spi2.1: spi_sync --> -22". Restore half-duplex support with multiple SPI transfers. Fixes: 9c9509717b53 ("Input: ads7846 - convert to full duplex") Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Li...
```diff diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 4b39f7212d35..d3b529333ca2 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -134,6 +134,9 @@ struct ads7846 { bool disabled; /* P: lock */ bool suspended; /* P: lock ...
5901eda2ed99ba0d3661da6eb265970559323bb3
Analyze and fix the following issue in the Linux kernel code: of: cpu: add check in __of_find_n_match_cpu_property()
Problem Details: In __of_find_n_match_cpu_property(), checking the variable ac for 0 won't prevent a possible overflow when multiplying it by sizeof(*cell). Besides, of_read_number() (called in the *for* loop) can't return correct result if that variable (which equals the #address-cells prop's value) exceeds 2, so addi...
```diff diff --git a/drivers/of/cpu.c b/drivers/of/cpu.c index 5214dc3d05ae..bd0e918d6f29 100644 --- a/drivers/of/cpu.c +++ b/drivers/of/cpu.c @@ -60,7 +60,7 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, cell = of_get_property(cpun, prop_name, &prop_len); if (!cell && !ac && arch_match_cpu...
e33711d5e757011bb6d3506af4d6c97dad412b8f
Analyze and fix the following issue in the Linux kernel code: perf tools: Use scnprintf() in build_id__snprintf() and hwmon read_events()
Problem Details: build_id__snprintf() and hwmon_pmu__read_events() accumulate formatted output via snprintf(), which returns the would-have-been-written count on truncation. In build_id__snprintf(), this inflates the return value beyond the buffer size. In hwmon_pmu__read_events(), len overshoots out_buf_len and the ...
```diff diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 8c0a9ae932aa..eb95ab90f974 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -93,8 +93,11 @@ int build_id__snprintf(const struct build_id *build_id, char *bf, size_t bf_size return 0; } - for (size_t i = ...
227a8748742f0263f1fe3131449b44563b77a209
Analyze and fix the following issue in the Linux kernel code: perf hists: Fix snprintf() in hists__scnprintf_title() UID filter path
Problem Details: hists__scnprintf_title() accumulates formatted output into a buffer using scnprintf() for all filter clauses except the UID filter, which uses snprintf(). If the buffer fills up and snprintf() returns more than the remaining space, printed exceeds size and the next 'size - printed' underflows, causing...
```diff diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 811d68fa6770..df978c996b6c 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -2963,9 +2963,10 @@ int __hists__scnprintf_title(struct hists *hists, char *bf, size_t size, bool sh ev_name, sample_freq_str, enable_ref ? ref...
cab3a9331ed0b3f884dd61c8a25b3cf123705982
Analyze and fix the following issue in the Linux kernel code: perf bpf: Use scnprintf() in snprintf_hex() and synthesize_bpf_prog_name()
Problem Details: Both functions accumulate formatted output via ret += snprintf(buf + ret, size - ret, ...). If the buffer is too small and snprintf() returns more than the remaining space, ret exceeds size and the next 'size - ret' underflows, causing snprintf() to write past the buffer end. Switch to scnprintf() wh...
```diff diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index a27945c279ef..2c09842469f1 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -36,7 +36,7 @@ static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len) size_t i; for (i = 0; i < le...
b145137fec13dc8fc7fcb14193ce395a1164e3a1
Analyze and fix the following issue in the Linux kernel code: perf tools: Add O_CLOEXEC to open() calls in DSO and ELF code
Problem Details: open() calls in dso.c and symbol-elf.c omit O_CLOEXEC, which leaks file descriptors to child processes spawned during symbol resolution (e.g., addr2line, objdump). This can exhaust the fd limit during long profiling sessions or when processing many DSOs. Add O_CLOEXEC to all open() calls in both file...
```diff diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 7dced896c64e..fb2e78fe2aa8 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -344,7 +344,7 @@ int filename__decompress(const char *name, char *pathname, * descriptor to the uncompressed file. */ if (!compressions[comp].is_c...
d9b99dc8148e0c1f5da3942131b47e0d21187a32
Analyze and fix the following issue in the Linux kernel code: perf sched: Fix idle-hist callchain display using wrong rb_first variant
Problem Details: timehist_print_idlehist_callchain() calls rb_first_cached() on sorted_root, but the sort function (callchain_param.sort) populates it via rb_insert_color() on the plain rb_root member — not the cached variant. This means rb_leftmost is never set, so rb_first_cached() always returns NULL and the entire...
```diff diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index caf05863a54e..5f16caebd964 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3130,7 +3130,8 @@ static size_t timehist_print_idlehist_callchain(struct rb_root_cached *root) size_t ret = 0; FILE *fp = stdout;...
4477dc01fcfc7f404772a67e0c1e056541ceb61d
Analyze and fix the following issue in the Linux kernel code: perf sched: Bounds-check prio before test_bit() in timehist
Problem Details: timehist_skip_sample() reads prio from untrusted tracepoint data via perf_sample__intval(sample, "prev_prio") without bounds validation. A crafted perf.data with prev_prio >= MAX_PRIO (140) causes test_bit() to read past the end of the prio_bitmap, which is only MAX_PRIO bits. Add a prio >= 0 guard be...
```diff diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 1ff01f03d2ad..caf05863a54e 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2645,7 +2645,9 @@ static bool timehist_skip_sample(struct perf_sched *sched, else if (evsel__name_is(sample->evsel, "sched:sched_s...
60f065dbaf46e65830da62a0041761f0c039e086
Analyze and fix the following issue in the Linux kernel code: cxl/test: Zero out LSA backing memory to avoid leaking to user
Problem Details: Memory through vmalloc() is not zeroed out. When this memory is copied into output payload, it leaks memory content to user. Use vzalloc() instead to zero out the memory. Suggested-by: sashiko-bot Link: https://lore.kernel.org/linux-cxl/20260605173146.2B9A31F00893@smtp.kernel.org/ Fixes: 7d3eb23c4ccf ...
```diff diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index 9a7cd3f46a1e..739343cd5802 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -1724,7 +1724,7 @@ static int cxl_mock_mem_probe(struct platform_device *pdev) return -ENOMEM; dev_set_drvdata(dev, mdata...
81eafcada109b653977c4dfbd2b6a72470025a01
Analyze and fix the following issue in the Linux kernel code: cxl/test: Fix integer overflow in mock LSA bounds checks
Problem Details: Pre-existing issue discovered by sashiko-bot. mock_get_lsa() and mock_set_lsa() validate the requested LSA range with "offset + length > LSA_SIZE". Both offset and length are u32 and, in mock_get_lsa(), both are taken directly from the user-supplied payload. The addition is evaluated modulo 2^32, so a...
```diff diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index 2e9a5f151e98..9a7cd3f46a1e 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -1063,7 +1063,7 @@ static int mock_get_lsa(struct cxl_mockmem_data *mdata, return -EINVAL; offset = le32_to_cpu(get_lsa->...
71a1def165267bc0947d4236f7336f490739c379
Analyze and fix the following issue in the Linux kernel code: cxl/test: Verify cmd->size_in before accessing payload
Problem Details: Several mock mailbox handlers access input payload fields before verifying that cmd->size_in is large enough for the corresponding structure. To ensure invalid commands are rejected before any payload data is consumed, add missing size checks and move existing checks ahead of the first payload field a...
```diff diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index 271c7ad8cc32..2e9a5f151e98 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -312,12 +312,17 @@ static int mock_get_event(struct device *dev, struct cxl_mbox_cmd *cmd) static int mock_clear_event(stru...
942cd47faa2047b46dfd85745603eba9006973e6
Analyze and fix the following issue in the Linux kernel code: RDMA/core: Fix broadcast address falsely detected as local
Problem Details: When rdma_resolve_addr() is invoked with a broadcast destination on an IPoIB interface, is_dst_local() inspects the resolved route and incorrectly concludes that the address is local. As a result, the resolution fails with -ENODEV. The issue stems from using '&' to compare rt_type with RTN_LOCAL. The R...
```diff diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 7e62b5b1ffaa..e9fb7ad4c377 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -438,7 +438,7 @@ static int addr6_resolve(struct sockaddr *src_sock, static bool is_dst_local(const struct dst_entry ...
2cde8282ff6e28c5e2fa3dbed25f154bd0e1cd7f
Analyze and fix the following issue in the Linux kernel code: RDMA/bnxt_re: Check debugfs parameter allocation for failure
Problem Details: bnxt_re_debugfs_add_pdev() allocates per-file private data for the CC configuration debugfs entries. The loop that initializes those entries uses rdev->cc_config_params immediately, so allocation failure would lead to NULL pointer dereferences while setting up debugfs. Debugfs is best-effort. If the C...
```diff diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c index 5fed2cf66be3..143e9bfc6b79 100644 --- a/drivers/infiniband/hw/bnxt_re/debugfs.c +++ b/drivers/infiniband/hw/bnxt_re/debugfs.c @@ -498,6 +498,8 @@ void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev) bnxt_re...
6ba90ce2069ae923b0ec787aebdf2d786e5d2a58
Analyze and fix the following issue in the Linux kernel code: PCI: rcar-host: Remove unused LIST_HEAD(res)
Problem Details: Remove the unused LIST_HEAD(res) declaration from rcar_pcie_hw_enable(). The macro instantiation defines an unused 'struct list_head res' variable, which conflicts with a valid resource loop-local 'struct resource *res' declaration further down in the function, triggering a compiler variable shadowing...
```diff diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c index 213028052aa5..cd9171eebc28 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -346,7 +346,6 @@ static void rcar_pcie_hw_enable(struct rcar_pcie_host *host) st...
db0a0768d09273aadadeb76730cd658d720333a4
Analyze and fix the following issue in the Linux kernel code: HID: hid-goodix-spi: validate report size to prevent stack buffer overflow
Problem Details: goodix_hid_set_raw_report() builds a protocol frame in a 128-byte stack buffer (tmp_buf), writing an 11-12 byte header followed by the caller-supplied report data. The HID core caps report size at HID_MAX_BUFFER_SIZE (16384) by default, while the driver does not set hid_ll_driver.max_buffer_size and p...
```diff diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c index 80c0288a3a38..288cb827e9d6 100644 --- a/drivers/hid/hid-goodix-spi.c +++ b/drivers/hid/hid-goodix-spi.c @@ -520,6 +520,9 @@ static int goodix_hid_set_raw_report(struct hid_device *hid, memcpy(tmp_buf + tx_len, args, args_len); tx...
e4aaac46593733a06ec1a1f1a63128206d67fcaa
Analyze and fix the following issue in the Linux kernel code: drm/xe: include all registered queues in TLB invalidation
Problem Details: Context-based TLB invalidation currently selects only scheduling-active exec queues via q->ops->active(). During rebind flows, queues may be suspended (or transitioning through resume) while still owning valid translations, causing them to be skipped from invalidation and leading to missed TLB invalida...
```diff diff --git a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c index ced58f46f846..cf6d106e6036 100644 --- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c +++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c @@ -255,9 +255,8 @@ static int send_tlb_inval_ctx_ppgtt(struct xe_tlb_inval *tlb_inval, u32 s...
381b3576a87f4ed6e76adb78d7d9400428f8f4b7
Analyze and fix the following issue in the Linux kernel code: drm/xe/hw_error: Use HW_ERR prefix in log
Problem Details: Hardware errors should be logged with HW_ERR prefix. Make them consistent with existing logs. Fixes: 01aab7e1c9d4 ("drm/xe/xe_hw_error: Add support for PVC SoC errors") Signed-off-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Riana Tauro <riana.tauro@intel.com> Link: https://patch.msgid.link/2026...
```diff diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c index 2a31b430570e..e869bc3948d9 100644 --- a/drivers/gpu/drm/xe/xe_hw_error.c +++ b/drivers/gpu/drm/xe/xe_hw_error.c @@ -219,9 +219,9 @@ static void log_hw_error(struct xe_tile *tile, const char *name, struct xe_device *xe = til...
3e3f5b0c5ae6845b4d8d23f079e872635cd8b0ae
Analyze and fix the following issue in the Linux kernel code: drm/xe/drm_ras: Add per node cleanup action
Problem Details: cleanup_node_param() is not registered for previous node in case of counter allocation failure, which results in stale memory of previous node that isn't cleaned up on unwind. Add per node cleanup action which guarantees cleanup on unwind and also simplifies the cleanup logic. Fixes: b40db12b542f ("dr...
```diff diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c index 7357100034e2..c6cd32b7eeda 100644 --- a/drivers/gpu/drm/xe/xe_drm_ras.c +++ b/drivers/gpu/drm/xe/xe_drm_ras.c @@ -100,53 +100,47 @@ static int assign_node_params(struct xe_device *xe, struct drm_ras_node *node, return 0; } ...
4dcfcdc9fbb5efef21e149adf349d42d84c9da04
Analyze and fix the following issue in the Linux kernel code: drm/xe/drm_ras: Make counter allocation drm managed
Problem Details: cleanup_node_param() is not registered for previous node in case of counter allocation failure, which results in stale memory of previous node that isn't cleaned up on unwind. Fix this using drm managed allocation, which is guaranteed to be cleaned up on unwind. Fixes: b40db12b542f ("drm/xe/xe_drm_ras...
```diff diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c index e07dc23a155e..7357100034e2 100644 --- a/drivers/gpu/drm/xe/xe_drm_ras.c +++ b/drivers/gpu/drm/xe/xe_drm_ras.c @@ -52,7 +52,7 @@ static struct xe_drm_ras_counter *allocate_and_copy_counters(struct xe_device *x struct xe_drm_ra...
68938cc08e23a94fd881e845837ff918de005ce7
Analyze and fix the following issue in the Linux kernel code: drm/xe/display: fix oops in suspend/shutdown without display
Problem Details: The xe driver keeps track of whether to probe display, and whether display hardware is there, using xe->info.probe_display. It gets set to false if there's no display after intel_display_device_probe(). However, the display may also be disabled via fuses, detected at a later time in intel_display_devic...
```diff diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c index 00dfa68af29a..b17fb698d2f8 100644 --- a/drivers/gpu/drm/xe/display/xe_display.c +++ b/drivers/gpu/drm/xe/display/xe_display.c @@ -124,6 +124,15 @@ int xe_display_init_early(struct xe_device *xe) intel_displa...
a9e900bc5c5914aca750afafa459363e575d3046
Analyze and fix the following issue in the Linux kernel code: perf tools: NULL bitmap pointers after bitmap_free()
Problem Details: Two call sites free bitmaps without NULLing the pointer, risking double-free if the structure is reused or cleanup is called twice: - mmap__munmap(): map->affinity_mask.bits - record__mmap_cpu_mask_free(): mask->bits Set each pointer to NULL after bitmap_free(). Fixes: 8384a2600c...
```diff diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a33c78f030d9..e91539055675 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -3084,6 +3084,7 @@ static int record__mmap_cpu_mask_alloc(struct mmap_cpu_mask *mask, int nr_bits) static void record__mmap_cpu_m...
c7d573551f9286100a055ef696cde6af54549677
Analyze and fix the following issue in the Linux kernel code: netfilter: nft_meta_bridge: fix stale stack leak via IIFHWADDR register
Problem Details: NFT_META_BRI_IIFHWADDR declares its destination register with len = ETH_ALEN (6 bytes), which the register-init tracking rounds up to two 32-bit registers (8 bytes). nft_meta_bridge_get_eval() then does memcpy(dest, br_dev->dev_addr, ETH_ALEN), writing only 6 bytes and leaving the upper 2 bytes of the ...
```diff diff --git a/net/bridge/netfilter/nft_meta_bridge.c b/net/bridge/netfilter/nft_meta_bridge.c index 7763e78abb00..219c40680260 100644 --- a/net/bridge/netfilter/nft_meta_bridge.c +++ b/net/bridge/netfilter/nft_meta_bridge.c @@ -64,6 +64,8 @@ static void nft_meta_bridge_get_eval(const struct nft_expr *expr, if...
b251598b8bf37300510868f739a79e07800d41ce
Analyze and fix the following issue in the Linux kernel code: HID: pidff: Use correct effect type in effect update
Problem Details: When updating an existing effect, the effect type from the last created effect was sent to the device instead of the updated one. This caused incorrect reports when a game creates multiple different effects and updates only one that is not the last created. Fixes FFB in multiple games that create mult...
```diff diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index c45f182d0448..5f4395f7c645 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -522,7 +522,7 @@ static void pidff_set_effect_report(struct pidff_device *pidff, pidff->set_effect[PID_EFFECT_BLOCK_...
ab185e0c4fb82dfba6fb86f8271e06f931d9c64c
Analyze and fix the following issue in the Linux kernel code: netfilter: nft_fib: fix stale stack leak via the OIFNAME register
Problem Details: For NFT_FIB_RESULT_OIFNAME the destination register is declared with len = IFNAMSIZ (four 32-bit registers), but on the lookup-fail, RTN_LOCAL and oif-mismatch paths nft_fib{4,6}_eval() only writes one register via "*dest = 0". The remaining three registers are left as whatever was on the stack in nft_...
```diff diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c index 9d0c6d75109b..177d738825b4 100644 --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -128,7 +128,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, fl4.saddr = get...
772cecf198da732faebb5dcfc46d66a505be8495
Analyze and fix the following issue in the Linux kernel code: netfilter: nft_exthdr: fix register tracking for F_PRESENT flag
Problem Details: nft_exthdr_init() passes user-controlled priv->len to nft_parse_register_store(), which marks that many bytes in the register bitmap as initialized. However, when NFT_EXTHDR_F_PRESENT is set, the eval paths write only 1 byte (nft_reg_store8) or 4 bytes (*dest = 0 on TCP/DCCP error path). When len > 4...
```diff diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c index e6a07c0df207..d3fc7969f123 100644 --- a/net/netfilter/nft_exthdr.c +++ b/net/netfilter/nft_exthdr.c @@ -532,6 +532,9 @@ static int nft_exthdr_init(const struct nft_ctx *ctx, return err; } + if ((flags & NFT_EXTHDR_F_PRESENT) && l...
a84b6fedbc97078788be78dbdd7517d143ad1a77
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_log: validate MAC header was set before dumping it
Problem Details: The fallback path of dump_mac_header() guards the MAC header access only with "skb->mac_header != skb->network_header", without checking skb_mac_header_was_set(). When the MAC header is unset, mac_header is 0xffff, so the test passes and skb_mac_header(skb) returns skb->head + 0xffff, ~64 KiB past the ...
```diff diff --git a/net/netfilter/nf_log_syslog.c b/net/netfilter/nf_log_syslog.c index 7a8952b049d1..e37b09b3203b 100644 --- a/net/netfilter/nf_log_syslog.c +++ b/net/netfilter/nf_log_syslog.c @@ -815,8 +815,8 @@ static void dump_mac_header(struct nf_log_buf *m, fallback: nf_log_buf_add(m, "MAC="); - if (dev->ha...
f7f2fbb0e893a0238dc464f8d8c0f5609bec584f
Analyze and fix the following issue in the Linux kernel code: netfilter: x_tables: avoid leaking percpu counter pointers
Problem Details: The native and compat get-entries paths copy the fixed rule entry header from the kernelized rule blob to userspace before overwriting the entry's counter fields with a sanitized counter snapshot. On SMP kernels, entry->counters.pcnt contains the percpu allocation address used by x_tables rule counter...
```diff diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index ad2259678c78..0ea513bf77fb 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@ -702,14 +702,12 @@ static int copy_entries_to_user(unsigned int total_size, const struct xt_entry_target *t; ...
c3009418f9fa1dcb3eb86f4d8c92583537b5faa3
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_conntrack: destroy stale expectfn expectations on unregister
Problem Details: NAT helpers such as nf_nat_h323 store a raw pointer to module text in exp->expectfn (e.g. ip_nat_q931_expect). nf_ct_helper_expectfn_unregister() only unlinks the callback descriptor and never walks the expectation table, so an expectation pending at module removal survives with a dangling exp->expectf...
```diff diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index de2f956abf34..24cf3d2d9745 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h @@ -155,6 +155,7 @@ void nf_ct_helper_log(struct sk_buff *skb, const ...
efc542561729a2859397dad51bda1fe41262beb1
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_tables_offload: drop device refcount on error
Problem Details: Reported by sashiko: If nft_flow_action_entry_next() returns NULL, dev reference leaks. Fixes: c6f85577584b ("netfilter: nf_tables_offload: add nft_flow_action_entry_next() and use it") Reported-by: Juri Lelli <juri.lelli@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo ...
```diff diff --git a/net/netfilter/nf_dup_netdev.c b/net/netfilter/nf_dup_netdev.c index 3b0a70e154cd..3d88ef927f31 100644 --- a/net/netfilter/nf_dup_netdev.c +++ b/net/netfilter/nf_dup_netdev.c @@ -74,16 +74,18 @@ int nft_fwd_dup_netdev_offload(struct nft_offload_ctx *ctx, struct flow_action_entry *entry; struct n...
ccb9fd4b87538ccf19ccff78ee26700526d94867
Analyze and fix the following issue in the Linux kernel code: netfilter: revalidate bridge ports
Problem Details: ebt_redirect_tg() dereferences br_port_get_rcu() return without a NULL check, causing a kernel panic when the bridge port has been removed between the original hook invocation and an NFQUEUE reinject. A mere NULL check isn't sufficient, however. As sashiko review points out userspace can not only rem...
```diff diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c index 3fda71a8579d..73f185cccd63 100644 --- a/net/bridge/netfilter/ebt_dnat.c +++ b/net/bridge/netfilter/ebt_dnat.c @@ -39,7 +39,9 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par) dev = xt_in(par); break...
ec2612b8ad9e642596db011dd8b6568ef1edeaa1
Analyze and fix the following issue in the Linux kernel code: HID: wacom: stop hardware after post-start probe failures
Problem Details: wacom_parse_and_register() starts HID hardware before registering inputs and initializing pad LEDs/remotes. Those later steps can fail, but their error paths currently release Wacom resources without stopping the HID hardware. Route post-hid_hw_start() failures through hid_hw_stop() before releasing d...
```diff diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 3e3bcf695296..0eafa483b7f7 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2460,16 +2460,16 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) error = wacom_register_inputs(wacom); if (error...
d0ff08d946c83b51359a8063c41e9f5af067e628
Analyze and fix the following issue in the Linux kernel code: HID: core: demote warning to debug level
Problem Details: The log level for short messages was changed from debug to warning, flooding syslog on systems with devices that regularly send short reports, in my case an UPS: $ dmesg |grep -c 'Event data for report .* was too short' 35 Demote it back to debug level. Fixes: 0a3fe972a7cb ("HID: core: Miti...
```diff diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index b3596851c719..3c3884684914 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2072,8 +2072,8 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 * rsize = max_buffer_size; if (bsize < rsize)...
310628484ef06f95c5589374fade917a5689787b
Analyze and fix the following issue in the Linux kernel code: spi: rzv2h-rspi: Fix SPDR read access width for 16-bit RX
Problem Details: The RZ/V2H hardware manual (section 7.5.2.2.1) specifies that read access size for the SPI Data Register (SPDR) are fixed at 32 bits. The RZV2H_RSPI_RX macro for the 16-bit data path used readw(), violating this requirement. Switch to readl() for the 16-bit RX path to conform to the hardware specifica...
```diff diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 1655efda7d20..6ed3fad873b8 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -135,8 +135,9 @@ static inline void rzv2h_rspi_rx_##type(struct rzv2h_rspi_priv *rspi, \ RZV2H_RSPI_TX(writel, u32) RZV2H_RS...
de8c602d5a2180c737e55dcd3dbcbf9dcc4af292
Analyze and fix the following issue in the Linux kernel code: arm64: dts: lx2160a-rev2: avoid 32-bit pcie window system ram overlap
Problem Details: A 3GB non-prefetchable PCIe bus window can overlap with inbound DMA addresses for low system RAM, so DMA transactions may be routed to a BAR on the same host bridge instead of memory. Change the 32-bit non-prefetchable PCIe window back from 3GB to 1GB on all controllers, avoiding that overlap while ke...
```diff diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a-rev2.dtsi b/arch/arm64/boot/dts/freescale/fsl-lx2160a-rev2.dtsi index 3570399f9b21..3d2637fee2d3 100644 --- a/arch/arm64/boot/dts/freescale/fsl-lx2160a-rev2.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a-rev2.dtsi @@ -17,7 +17,7 @@ ranges = /* 16-Bi...