id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
3581cb91543967ee1a57849116e26036f6240e6d
Analyze and fix the following issue in the Linux kernel code: soc: qcom: pmic_glink: disable UCSI on sc8280xp
Problem Details: Enabling UCSI on sc8280xp and the Lenovo ThinkPad X13s in particular results in a number of errors and timeouts during boot: [ 9.012421] ucsi_glink.pmic_glink_ucsi pmic_glink.ucsi.0: GET_CONNECTOR_STATUS failed (-95) [ 14.047379] ucsi_glink.pmic_glink_ucsi pmic_glink.ucsi.0: timeout waiting for U...
```diff diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c index 71d8901a9389..511aa40842a1 100644 --- a/drivers/soc/qcom/pmic_glink.c +++ b/drivers/soc/qcom/pmic_glink.c @@ -342,6 +342,7 @@ static const unsigned long pmic_glink_sm8450_client_mask = BIT(PMIC_GLINK_CLIENT static const struct o...
01bd694ac2f682fb8017e16148b928482bc8fa4b
Analyze and fix the following issue in the Linux kernel code: bus: mhi: host: Drop chan lock before queuing buffers
Problem Details: Ensure read and write locks for the channel are not taken in succession by dropping the read lock from parse_xfer_event() such that a callback given to client can potentially queue buffers and acquire the write lock in that process. Any queueing of buffers should be done without channel read lock acqui...
```diff diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index ad7807e4b523..abb561db9ae1 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -644,6 +644,8 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, mhi_del_ring_element(mhi_cntrl, tre_ring); ...
eed6e57e9f3e2beac37563eb6a0129549daa330e
Analyze and fix the following issue in the Linux kernel code: soc: qcom: llcc: Fix dis_cap_alloc and retain_on_pc configuration
Problem Details: Commit c14e64b46944 ("soc: qcom: llcc: Support chipsets that can write to llcc") add the support for chipset where capacity based allocation and retention through power collapse can be programmed based on content of SCT table mentioned in the llcc driver where the target like sdm845 where the entire p...
```diff diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index e038c421af3d..c22b070e8ab2 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -1034,15 +1034,15 @@ static int _qcom_llcc_cfg_program(const struct llcc_slice_config *config, u32 disable_cap_alloc, retai...
b89b6a863dd53bc70d8e52d50f9cfaef8ef5e9c9
Analyze and fix the following issue in the Linux kernel code: bus: mhi: host: Add spinlock to protect WP access when queueing TREs
Problem Details: Protect WP accesses such that multiple threads queueing buffers for incoming data do not race. Meanwhile, if CONFIG_TRACE_IRQFLAGS is enabled, irq will be enabled once __local_bh_enable_ip is called as part of write_unlock_bh. Hence, let's take irqsave lock after TRE is generated to avoid running writ...
```diff diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index d80975f4bba8..ad7807e4b523 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -1124,17 +1124,15 @@ static int mhi_queue(struct mhi_device *mhi_dev, struct mhi_buf_info *buf_info, if (unlikely(MHI_PM_IN_ERRO...
fbfd1f55ad34be14e52b39a1b83ae1f0d29b890c
Analyze and fix the following issue in the Linux kernel code: soc: qcom: pmic_pdcharger_ulog: Fix hypothetical ulog request message endianess
Problem Details: Sparse reports the following: % ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make C=2 W=1 drivers/soc/qcom/pmic_pdcharger_ulog.o ... CC drivers/soc/qcom/pmic_pdcharger_ulog.o CHECK drivers/soc/qcom/pmic_pdcharger_ulog.c drivers/soc/qcom/pmic_pdcharger_ulog.c:57:34: warnin...
```diff diff --git a/drivers/soc/qcom/pmic_pdcharger_ulog.c b/drivers/soc/qcom/pmic_pdcharger_ulog.c index f1aaacf05005..238cd38589dc 100644 --- a/drivers/soc/qcom/pmic_pdcharger_ulog.c +++ b/drivers/soc/qcom/pmic_pdcharger_ulog.c @@ -54,9 +54,9 @@ static int pmic_pdcharger_ulog_request(struct pmic_pdcharger_ulog *pg) ...
a74ebfcd60c649f1bff7c369e432c322ae0a0d6a
Analyze and fix the following issue in the Linux kernel code: soc: qcom: pmic_pdcharger_ulog: Move TRACE_SYSTEM out of #if protection
Problem Details: As specified in samples/trace_events/trace-events-sample.h: * Notice that TRACE_SYSTEM should be defined outside of #if * protection, just like TRACE_INCLUDE_FILE. Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver") Signed-off-by: Andrew Halaney <ahalaney@redhat.com> Reviewed-by...
```diff diff --git a/drivers/soc/qcom/pmic_pdcharger_ulog.h b/drivers/soc/qcom/pmic_pdcharger_ulog.h index 9d5d9af4fbe4..152e3a6b5480 100644 --- a/drivers/soc/qcom/pmic_pdcharger_ulog.h +++ b/drivers/soc/qcom/pmic_pdcharger_ulog.h @@ -3,14 +3,14 @@ * Copyright (c) 2023, Linaro Ltd */ +#undef TRACE_SYSTEM +#define...
4d2b810f44f1c7b65d374b0128dabb15f1fd6c09
Analyze and fix the following issue in the Linux kernel code: soc: qcom: pmic_pdcharger_ulog: Search current directory for headers
Problem Details: As specified in samples/trace_events/Makefile: If you include a trace header outside of include/trace/events then the file that does the #define CREATE_TRACE_POINTS must have that tracer file in its main search path. This is because define_trace.h will include it, and must be able to f...
```diff diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 110108e23669..05b3d54e8dc9 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_QCOM_PDR_HELPERS) += pdr_interface.o obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink.o obj-$(CONFIG_QCOM_PMIC_GL...
feec9f0add432a867f23e29afcd2f7088889b8e2
Analyze and fix the following issue in the Linux kernel code: arm64: dts: qcom: acer-aspire1: Correct audio codec definition
Problem Details: When initially added, a mistake was made in the definition of the codec. Despite the fact that the DMIC line is connected on the side of the codec chip, and relevant passive components, including 0-ohm resistors connecting the dmics, are present, the dmic line is still cut in another place on the boar...
```diff diff --git a/arch/arm64/boot/dts/qcom/sc7180-acer-aspire1.dts b/arch/arm64/boot/dts/qcom/sc7180-acer-aspire1.dts index cfde8cd47107..00b442696618 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-acer-aspire1.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-acer-aspire1.dts @@ -209,9 +209,22 @@ AVDD-supply = <&vreg_l15a...
fd4b634f9b9b3dc059cf1c0ff243711bb245c004
Analyze and fix the following issue in the Linux kernel code: soc: qcom: llcc: Add missing description for members in slice config
Problem Details: Fix all warnings thrown due to missing description for some of the members in llcc_slice_config. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202312050519.mup4Q8mD-lkp@intel.com/ Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Link: https://lore.kernel.o...
```diff diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c index b5ca08c020ac..e038c421af3d 100644 --- a/drivers/soc/qcom/llcc-qcom.c +++ b/drivers/soc/qcom/llcc-qcom.c @@ -92,6 +92,19 @@ * @write_scid_en: Bit enables write cache support for a given scid. * @write_scid_cacheable_en: Enables wr...
4bbda9421f316efdaef5dbf642e24925ef7de130
Analyze and fix the following issue in the Linux kernel code: arm64: dts: qcom: msm8939: Make blsp_dma controlled-remotely
Problem Details: The blsp_dma controller is shared between the different subsystems, which is why it is already initialized by the firmware. We should not reinitialize it from Linux to avoid potential other users of the DMA engine to misbehave. In mainline this can be described using the "qcom,controlled-remotely" pro...
```diff diff --git a/arch/arm64/boot/dts/qcom/msm8939.dtsi b/arch/arm64/boot/dts/qcom/msm8939.dtsi index 4ba115eecfd5..29f6bd9df2eb 100644 --- a/arch/arm64/boot/dts/qcom/msm8939.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8939.dtsi @@ -1761,6 +1761,7 @@ clock-names = "bam_clk"; #dma-cells = <1>; qcom,ee = <0>; +...
7c45b6ddbcff01f9934d11802010cfeb0879e693
Analyze and fix the following issue in the Linux kernel code: arm64: dts: qcom: msm8916: Make blsp_dma controlled-remotely
Problem Details: The blsp_dma controller is shared between the different subsystems, which is why it is already initialized by the firmware. We should not reinitialize it from Linux to avoid potential other users of the DMA engine to misbehave. In mainline this can be described using the "qcom,controlled-remotely" pro...
```diff diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index e8a14dd7e7c2..7f8327b0dbdb 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -2155,6 +2155,7 @@ clock-names = "bam_clk"; #dma-cells = <1>; qcom,ee = <0>; +...
12844ac08c593c2dd232b1b0d96ee21944dfb044
Analyze and fix the following issue in the Linux kernel code: arm64: dts: qcom: msm8939: Add clock-frequency for broadcast timer
Problem Details: Looks like not all firmware versions used for MSM8939 program the timer frequency for both broadcast/MMIO timers, causing a WARNING at runtime: WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:38 cev_delta2ns+0x74/0x90 pc : cev_delta2ns+0x74/0x90 lr : clockevents_config.part.0+0x64/0x8c Call trace:...
```diff diff --git a/arch/arm64/boot/dts/qcom/msm8939.dtsi b/arch/arm64/boot/dts/qcom/msm8939.dtsi index 95610a32750a..4ba115eecfd5 100644 --- a/arch/arm64/boot/dts/qcom/msm8939.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8939.dtsi @@ -2195,6 +2195,8 @@ #address-cells = <1>; #size-cells = <1>; ranges; + /* Nec...
71f130c9193f613d497f7245365ed05ffdb0a401
Analyze and fix the following issue in the Linux kernel code: clk: qcom: videocc-sm8150: Add missing PLL config property
Problem Details: When the driver was ported upstream, PLL test_ctl_hi1 register value was omitted. Add it to ensure the PLLs are fully configured. Fixes: 5658e8cf1a8a ("clk: qcom: add video clock controller driver for SM8150") Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@quicinc.com> Reviewed-by: Konrad Dybci...
```diff diff --git a/drivers/clk/qcom/videocc-sm8150.c b/drivers/clk/qcom/videocc-sm8150.c index 6a5f89f53da8..52a9a453a143 100644 --- a/drivers/clk/qcom/videocc-sm8150.c +++ b/drivers/clk/qcom/videocc-sm8150.c @@ -33,6 +33,7 @@ static struct alpha_pll_config video_pll0_config = { .config_ctl_val = 0x20485699, .con...
1fd9a939db24d2f66e48f8bca3e3654add3fa205
Analyze and fix the following issue in the Linux kernel code: clk: qcom: videocc-sm8150: Update the videocc resets
Problem Details: Add all the available resets for the video clock controller on sm8150. Fixes: 5658e8cf1a8a ("clk: qcom: add video clock controller driver for SM8150") Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@quicinc.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Konrad Dybci...
```diff diff --git a/drivers/clk/qcom/videocc-sm8150.c b/drivers/clk/qcom/videocc-sm8150.c index 1afdbe4a249d..6a5f89f53da8 100644 --- a/drivers/clk/qcom/videocc-sm8150.c +++ b/drivers/clk/qcom/videocc-sm8150.c @@ -214,6 +214,10 @@ static const struct regmap_config video_cc_sm8150_regmap_config = { static const stru...
ff753723bf3916770c1e2580fe1f34ad9d6f0283
Analyze and fix the following issue in the Linux kernel code: arm64: dts: qcom: qrb4210-rb2: Enable MPSS and Wi-Fi
Problem Details: Enable the remote processors and tighten up the regulators to enable Wi-Fi functionality on the RB2. For reference, the hw/sw identifies as: qmi chip_id 0x150 chip_family 0x4002 board_id 0xff soc_id 0x40670000 qmi fw_version 0x337302d3 fw_build_timestamp 2023-01-06 01:50 fw_build_id QC_IMAGE_VERSION_...
```diff diff --git a/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts b/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts index 33c312ae842e..7c19f874fa71 100644 --- a/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts +++ b/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts @@ -281,6 +281,12 @@ status = "okay"; }; +&remoteproc_mpss { + firmware-name...
a7dc6343519752eb6d86bfa78378a8af5da1f475
Analyze and fix the following issue in the Linux kernel code: Revert "soc: qcom: stats: Add DDR sleep stats"
Problem Details: After recent reports ([1], [2]) of older platforms (particularly 8150 and 7180) breaking after DDR sleep stats introduction, revert the following: Commit 73380e2573c3 ("soc: qcom: stats: fix 64-bit division") Commit e84e61bdb97c ("soc: qcom: stats: Add DDR sleep stats") The feature itself is rather u...
```diff diff --git a/drivers/soc/qcom/qcom_stats.c b/drivers/soc/qcom/qcom_stats.c index 5ec8a754b22b..0216fc24f2ca 100644 --- a/drivers/soc/qcom/qcom_stats.c +++ b/drivers/soc/qcom/qcom_stats.c @@ -3,7 +3,6 @@ * Copyright (c) 2011-2021, The Linux Foundation. All rights reserved. */ -#include <linux/bitfield.h> ...
b1dfc0f76231bbf395c59d20a2070684620d5d0f
Analyze and fix the following issue in the Linux kernel code: net: phy: skip LED triggers on PHYs on SFP modules
Problem Details: Calling led_trigger_register() when attaching a PHY located on an SFP module potentially (and practically) leads into a deadlock. Fix this by not calling led_trigger_register() for PHYs localted on SFP modules as such modules actually never got any LEDs. ===============================================...
```diff diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 2ce74593d6e4..a42df2c1bd04 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1548,7 +1548,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, goto error; phy_resume(phyd...
f43c3a62e7d57e5da8d5f0c50d7254808af15920
Analyze and fix the following issue in the Linux kernel code: arm64: dts: freescale: fix the schema check errors for fsl,tmu-calibration
Problem Details: fsl,tmu-calibration contains cell pairs (u32-matrix). Mark them as such. Use matching property syntax and allow correct validation. No functional changes. Signed-off-by: David Heidelberg <david@ixit.cz> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
```diff diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi index d0733451d3ce..1e3fe3897b52 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi @@ -307,45 +307,46 @@ reg = <0x0 0x1f00000 0x0 0x1000...
47360e40dcb92c09f417ccbe956e646bd95a09b6
Analyze and fix the following issue in the Linux kernel code: ARM: dts: imx27-phytec-phycore-som: Use 'rtc' as node name
Problem Details: Node names should be generic. Use 'rtc' for the rtc node to fix the following dt-schema warning: imx27-phytec-phycore-rdk.dtb: pcf8563@51: $nodename:0: 'pcf8563@51' does not match '^rtc(@.*|-([0-9]|[1-9][0-9]+))?$' from schema $id: http://devicetree.org/schemas/rtc/nxp,pcf8563.yaml# Signed-off-by: ...
```diff diff --git a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi index 0e527d1f9e55..e958d7286ae9 100644 --- a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi +++ b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi @@ -180,7 +180,7 @@ ...
480a9c4e7dfd56c2bcac7a5d415f16458f3f434e
Analyze and fix the following issue in the Linux kernel code: ARM: dts: imx25: Remove unneeded keypad properties
Problem Details: Per imx-keypad.yaml, '#address-cells', '#size-cells', 'clock-names' are not valid properties. Remove them to fix the following dt-schema warning: imx25-pdk.dtb: kpp@43fa8000: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'clock-names' were unexpected) from schema $id: http...
```diff diff --git a/arch/arm/boot/dts/nxp/imx/imx25.dtsi b/arch/arm/boot/dts/nxp/imx/imx25.dtsi index db814d7b568d..9cfff2151b7e 100644 --- a/arch/arm/boot/dts/nxp/imx/imx25.dtsi +++ b/arch/arm/boot/dts/nxp/imx/imx25.dtsi @@ -188,12 +188,9 @@ }; kpp: kpp@43fa8000 { - #address-cells = <1>; - #size-cells...
9ff5a14432179d566a0b4d7edca73d4fb4a7cd86
Analyze and fix the following issue in the Linux kernel code: arm64: dts: imx8qxp-mek: Move port under USB connector
Problem Details: Per nxp,ptn5110.yaml, 'port' should be placed under 'connector'. Do as requested to fix the following dt-schema warning: imx8qxp-mek.dtb: tcpc@50: connector:ports: 'port@0' is a required property from schema $id: http://devicetree.org/schemas/usb/nxp,ptn5110.yaml# imx8qxp-mek.dtb: tcpc@50: co...
```diff diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts index 6c3d8715bc11..9f660f386039 100644 --- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts +++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts @@ -152,12 +152,6 @@ interrupt-parent = <&lsio_gpio1>; ...
117211aa739a926e6555cfea883be84bee6f1695
Analyze and fix the following issue in the Linux kernel code: bpf: Add missing BPF_LINK_TYPE invocations
Problem Details: Pengfei Xu reported [1] Syzkaller/KASAN issue found in bpf_link_show_fdinfo. The reason is missing BPF_LINK_TYPE invocation for uprobe multi link and for several other links, adding that. [1] https://lore.kernel.org/bpf/ZXptoKRSLspnk2ie@xpf.sh.intel.com/ Fixes: 89ae89f53d20 ("bpf: Add multi uprobe l...
```diff diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index fc0d6f32c687..94baced5a1ad 100644 --- a/include/linux/bpf_types.h +++ b/include/linux/bpf_types.h @@ -142,9 +142,13 @@ BPF_LINK_TYPE(BPF_LINK_TYPE_ITER, iter) #ifdef CONFIG_NET BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns) BPF_LINK_TYPE(BPF...
42d45c45624a098a9fdc477c7a8b86167f948c77
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Temporarily disable dummy_struct_ops test on s390
Problem Details: Temporarily disable dummy_struct_ops test on s390. The breakage is likely due to commit 2cd3e3772e41 ("x86/cfi,bpf: Fix bpf_struct_ops CFI"). Signed-off-by: Alexei Starovoitov <ast@kernel.org>
```diff diff --git a/tools/testing/selftests/bpf/DENYLIST.s390x b/tools/testing/selftests/bpf/DENYLIST.s390x index 1a63996c0304..d27aa42d11a4 100644 --- a/tools/testing/selftests/bpf/DENYLIST.s390x +++ b/tools/testing/selftests/bpf/DENYLIST.s390x @@ -1,5 +1,7 @@ # TEMPORARY # Alphabetical order +dummy_st_ops/dummy_in...
852486b35f344887786d63250946dd921a05d7e8
Analyze and fix the following issue in the Linux kernel code: x86/cfi,bpf: Fix bpf_exception_cb() signature
Problem Details: As per the earlier patches, BPF sub-programs have bpf_callback_t signature and CFI expects callers to have matching signature. This is violated by bpf_prog_aux::bpf_exception_cb(). [peterz: Changelog] Reported-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Alexei Starovoitov <alexei.starovoi...
```diff diff --git a/include/linux/bpf.h b/include/linux/bpf.h index db46b3359bf5..5e694934cf37 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1484,7 +1484,7 @@ struct bpf_prog_aux { int cgroup_atype; /* enum cgroup_bpf_attach_type */ struct bpf_map *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]; ch...
e4c00339891c074c76f626ac82981963cbba5332
Analyze and fix the following issue in the Linux kernel code: bpf: Fix dtor CFI
Problem Details: Ensure the various dtor functions match their prototype and retain their CFI signatures, since they don't have their address taken, they are prone to not getting CFI, making them impossible to call indirectly. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r...
```diff diff --git a/kernel/bpf/cpumask.c b/kernel/bpf/cpumask.c index 7499b7d8c06f..2e73533a3811 100644 --- a/kernel/bpf/cpumask.c +++ b/kernel/bpf/cpumask.c @@ -96,6 +96,12 @@ __bpf_kfunc void bpf_cpumask_release(struct bpf_cpumask *cpumask) migrate_enable(); } +__bpf_kfunc void bpf_cpumask_release_dtor(void *cp...
2cd3e3772e41377f32d6eea643e0590774e9187c
Analyze and fix the following issue in the Linux kernel code: x86/cfi,bpf: Fix bpf_struct_ops CFI
Problem Details: BPF struct_ops uses __arch_prepare_bpf_trampoline() to write trampolines for indirect function calls. These tramplines much have matching CFI. In order to obtain the correct CFI hash for the various methods, add a matching structure that contains stub functions, the compiler will generate correct CFI ...
```diff diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h index 8779abd217b7..1a50b2cd4713 100644 --- a/arch/x86/include/asm/cfi.h +++ b/arch/x86/include/asm/cfi.h @@ -123,6 +123,8 @@ static inline int cfi_get_offset(void) } #define cfi_get_offset cfi_get_offset +extern u32 cfi_get_func_hash(void...
e72d88d18df4e03c80e64c2535f70c64f1dc6fc1
Analyze and fix the following issue in the Linux kernel code: x86/cfi,bpf: Fix bpf_callback_t CFI
Problem Details: Where the main BPF program is expected to match bpf_func_t, sub-programs are expected to match bpf_callback_t. This fixes things like: tools/testing/selftests/bpf/progs/bloom_filter_bench.c: bpf_for_each_map_elem(&array_map, bloom_callback, &data, 0); Signed-off-by: Peter Zijlstra (Intel...
```diff diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h index 7a7b0b823a98..8779abd217b7 100644 --- a/arch/x86/include/asm/cfi.h +++ b/arch/x86/include/asm/cfi.h @@ -106,6 +106,7 @@ struct pt_regs; enum bug_trap_type handle_cfi_failure(struct pt_regs *regs); #define __bpfcall extern u32 cfi_bpf_...
4f9087f16651aca4a5f32da840a53f6660f0579a
Analyze and fix the following issue in the Linux kernel code: x86/cfi,bpf: Fix BPF JIT call
Problem Details: The current BPF call convention is __nocfi, except when it calls !JIT things, then it calls regular C functions. It so happens that with FineIBT the __nocfi and C calling conventions are incompatible. Specifically __nocfi will call at func+0, while FineIBT will have endbr-poison there, which is not a ...
```diff diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h index 2a494643089d..7a7b0b823a98 100644 --- a/arch/x86/include/asm/cfi.h +++ b/arch/x86/include/asm/cfi.h @@ -9,15 +9,125 @@ */ #include <linux/bug.h> +/* + * An overview of the various calling conventions... + * + * Traditional: + * + * ...
3b74713a0321de5e4b1507990ef87049f8c887d8
Analyze and fix the following issue in the Linux kernel code: dt-bindings: PCI: qcom: Correct reset-names property
Problem Details: There is no "resets-names" property, but "reset-names". Fixes: 075a9d55932e ("dt-bindings: PCI: qcom: Convert to YAML") Link: https://lore.kernel.org/linux-pci/20231111142006.51883-1-krzysztof.kozlowski@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Krzys...
```diff diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml index 9dfb341e4f77..6be2aebdc98e 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml @@ -89,7 +89,7 @@ properties: ...
4791c44c0a982051713458cf4e66855e9f092713
Analyze and fix the following issue in the Linux kernel code: dt-bindings: PCI: qcom: Adjust iommu-map for different SoC
Problem Details: The PCIe controller on SDX55 has five entries in its iommu-map, MSM8998 has one and SDM845 has sixteen, so allow wider number of items to fix dtbs_check warnings like: qcom-sdx55-mtp.dtb: pcie@1c00000: iommu-map: [[0, 21, 512, 1], [256, 21, 513, 1], [512, 21, 514, 1], [768, 21, 515, 1], [1024, 2...
```diff diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml index eadba38171e1..4bf2299f70a6 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml @@ -62,7 +62,8 @@ properties: ...
86d7d57a3f096c8349b32a0cd5f6f314e4416a6d
Analyze and fix the following issue in the Linux kernel code: f2fs: fix to check return value of f2fs_recover_xattr_data
Problem Details: Should check return value of f2fs_recover_xattr_data in __f2fs_setxattr rather than doing invalid retry if error happen. Also just do set_page_dirty in f2fs_recover_xattr_data when page is changed really. Fixes: 50a472bbc79f ("f2fs: do not return EFSCORRUPTED, but try to run online repair") Signed-of...
```diff diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 6c7f6a649d27..9b546fd21010 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2751,11 +2751,11 @@ recover_xnid: f2fs_update_inode_page(inode); /* 3: update and set xattr node page dirty */ - if (page) + if (page) { memcpy(F2FS_NODE(xpage), F2FS_NODE(...
ae1914174a63a558113e80d24ccac2773f9f7b2b
Analyze and fix the following issue in the Linux kernel code: cred: get rid of CONFIG_DEBUG_CREDENTIALS
Problem Details: This code is rarely (never?) enabled by distros, and it hasn't caught anything in decades. Let's kill off this legacy debug code. Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
```diff diff --git a/arch/powerpc/configs/skiroot_defconfig b/arch/powerpc/configs/skiroot_defconfig index 8d3eacb50d56..9d44e6630908 100644 --- a/arch/powerpc/configs/skiroot_defconfig +++ b/arch/powerpc/configs/skiroot_defconfig @@ -301,7 +301,6 @@ CONFIG_WQ_WATCHDOG=y CONFIG_DEBUG_SG=y CONFIG_DEBUG_NOTIFIERS=y CO...
f8fa5d76925991976b3e7076f9d1052515ec1fca
Analyze and fix the following issue in the Linux kernel code: cred: switch to using atomic_long_t
Problem Details: There are multiple ways to grab references to credentials, and the only protection we have against overflowing it is the memory required to do so. With memory sizes only moving in one direction, let's bump the reference count to 64-bit and move it outside the realm of feasibly overflowing. Signed-off...
```diff diff --git a/include/linux/cred.h b/include/linux/cred.h index af8d353a4b86..a3383f8efb8f 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -109,7 +109,7 @@ static inline int groups_search(const struct group_info *group_info, kgid_t grp) * same context as task->real_cred. */ struct cred { - a...
96c36eaa7730081e5c946819e4dfad0f432c70f7
Analyze and fix the following issue in the Linux kernel code: btrfs: migrate btrfs_repair_io_failure() to folio interfaces
Problem Details: [BUG] Test case btrfs/124 failed if larger metadata folio is enabled, the dying message looks like this: BTRFS error (device dm-2): bad tree block start, mirror 2 want 31686656 have 0 BTRFS info (device dm-2): read error corrected: ino 0 off 31686656 (dev /dev/mapper/test-scratch2 sector 20928) BUG...
```diff diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 67a885d3f9a8..928f512cdb4a 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -194,6 +194,12 @@ static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio, struct bio_vec *bv = bio_first_bvec_all(&repair_bbio->bio); int mirror = repair_bbio->mirror_num...
f4521b01c5246b921debc6db6f112f89f94cc61b
Analyze and fix the following issue in the Linux kernel code: btrfs: migrate eb_bitmap_offset() to folio interfaces
Problem Details: [BUG] Test case btrfs/002 would fail if larger folios are enabled for metadata: assertion failed: folio, in fs/btrfs/extent_io.c:4358 ------------[ cut here ]------------ kernel BUG at fs/btrfs/extent_io.c:4358! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 30916 Comm: fsstress Tainted:...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 423861e5e8f5..a0ffd41c5cc1 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4459,22 +4459,22 @@ void copy_extent_buffer(const struct extent_buffer *dst, } /* - * Calculate the page and offset of the byte containing the given bit ...
4a565c8069b7578a79d193d277e9c760aacf3e75
Analyze and fix the following issue in the Linux kernel code: btrfs: don't double put our subpage reference in alloc_extent_buffer
Problem Details: This fixes as case in "btrfs: refactor alloc_extent_buffer() to allocate-then-attach method". We have been seeing panics in the CI for the subpage stuff recently, it happens on btrfs/187 but could potentially happen anywhere. In the subpage case, if we race with somebody else inserting the same exten...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a5c2acd5c8ae..2c69e1f0fa10 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3175,11 +3175,9 @@ static void detach_extent_buffer_folio(struct extent_buffer *eb, struct folio *f /* Release all pages attached to the extent buffer */ s...
2b0122aaa800b021e36027d7f29e206f87c761d6
Analyze and fix the following issue in the Linux kernel code: btrfs: sysfs: validate scrub_speed_max value
Problem Details: The value set as scrub_speed_max accepts size with suffixes (k/m/g/t/p/e) but we should still validate it for trailing characters, similar to what we do with chunk_size_store. CC: stable@vger.kernel.org # 5.15+ Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: David Sterba <dsterba@suse.com...
```diff diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index e6b51fb3ddc1..84c05246ffd8 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -1783,6 +1783,10 @@ static ssize_t btrfs_devinfo_scrub_speed_max_store(struct kobject *kobj, unsigned long long limit; limit = memparse(buf, &endptr); + /* There could ...
6140ba8a0a1460986ee98b4062df7d4876b88295
Analyze and fix the following issue in the Linux kernel code: btrfs: switch btrfs_root::delayed_nodes_tree to xarray from radix-tree
Problem Details: The radix-tree has been superseded by the xarray (https://lwn.net/Articles/745073), this patch converts the btrfs_root::delayed_nodes, the APIs are used in a simple way. First idea is to do xa_insert() but this would require GFP_ATOMIC allocation which we want to avoid if possible. The preload mechani...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 54fd4eb92745..70e828d33177 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -227,10 +227,10 @@ struct btrfs_root { struct rb_root inode_tree; /* - * radix tree that keeps track of delayed nodes of every inode, - * protected by inode_lock + *...
eefaf0a1a6f10726faa4d1b7800fdf307e97ef55
Analyze and fix the following issue in the Linux kernel code: btrfs: fix typos found by codespell
Problem Details: Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 4f3b693a16b1..67a885d3f9a8 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -626,7 +626,7 @@ static bool should_async_write(struct btrfs_bio *bbio) /* * Submit bio to an async queue. * - * Return true if the work has been succesfuly submitted, else fals...
4618d0a66b505a81cc39b17935118227a7fc24f8
Analyze and fix the following issue in the Linux kernel code: btrfs: fix mismatching parameter names for btrfs_get_extent()
Problem Details: The definition for btrfs_get_extent() is using "u64 end" as the last parameter, but in implementation we go "u64 len", and all call sites follows the implementation. This can be very confusing during development, as most developers including me, would just use the snippet returned by LSP (clangd in my...
```diff diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index bd629d011fdc..7f7c5a92d2b8 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -491,7 +491,7 @@ struct inode *btrfs_iget_path(struct super_block *s, u64 ino, struct inode *btrfs_iget(struct super_block *s, u64 ino, struct btrfs_...
b30aa1c176ba86a035d40c2d2f12dc0e0f687e0e
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: fix error messages for test case 4 of extent map tests
Problem Details: In test case 4 for extent maps, if we error out we are supposed to print in interval but instead of printing a non-inclusive end offset, we are printing the length of the interval, which makes it confusing. So fix that to print the exclusive end offset instead. Signed-off-by: Filipe Manana <fdmanana@s...
```diff diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c index 8602f94cc29d..ac64eafad703 100644 --- a/fs/btrfs/tests/extent-map-tests.c +++ b/fs/btrfs/tests/extent-map-tests.c @@ -388,13 +388,13 @@ static int __test_case_4(struct btrfs_fs_info *fs_info, write_unlock(&em_tree->lock);...
d6d1e6c17cab2dcb7b8530c599f00e7de906d380
Analyze and fix the following issue in the Linux kernel code: bpf: Limit the number of kprobes when attaching program to multiple kprobes
Problem Details: An abnormally big cnt may also be assigned to kprobe_multi.cnt when attaching multiple kprobes. It will trigger the following warning in kvmalloc_node(): if (unlikely(size > INT_MAX)) { WARN_ON_ONCE(!(flags & __GFP_NOWARN)); return NULL; } Fix the warning by limiting the maximal number of...
```diff diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 75c05aea9fd9..97c0c49c40a0 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -43,6 +43,7 @@ rcu_dereference_protected(p, lockdep_is_held(&bpf_event_mutex)) #define MAX_UPROBE_MULTI_CNT (1U << 20) +#define MAX_KPROB...
8b2efe51ba85ca83460941672afac6fca4199df6
Analyze and fix the following issue in the Linux kernel code: bpf: Limit the number of uprobes when attaching program to multiple uprobes
Problem Details: An abnormally big cnt may be passed to link_create.uprobe_multi.cnt, and it will trigger the following warning in kvmalloc_node(): if (unlikely(size > INT_MAX)) { WARN_ON_ONCE(!(flags & __GFP_NOWARN)); return NULL; } Fix the warning by limiting the maximal number of uprobes in bpf_uprobe_multi_...
```diff diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 774cf476a892..75c05aea9fd9 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -42,6 +42,8 @@ #define bpf_event_rcu_dereference(p) \ rcu_dereference_protected(p, lockdep_is_held(&bpf_event_mutex)) +#define MAX_UP...
5df12742b7e3aae2594a30a9d14d5d6e9e7699f4
Analyze and fix the following issue in the Linux kernel code: Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
Problem Details: This reverts commit 40613da52b13fb21c5566f10b287e0ca8c12c4e9 and the subsequent fix to it: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus") 40613da52b13 fixed a problem where hot-adding a device with large BARs failed if the bridge windows programmed...
```diff diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 601129772b2d..5b1f271c6034 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -512,15 +512,12 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge) if (pass && de...
9050aefab15b2da2c7d65d794ca445919ae4c235
Analyze and fix the following issue in the Linux kernel code: arm64: dts: rockchip: fix misleading comment in rk3399-puma-haikou.dts
Problem Details: Haikou is an evaluation and development platform for System on Modules (SOMs). The GPIO0_B1 is routed to the Wake button instead of BIOS_DISABLE, update the comment to reflect that. Signed-off-by: Vahe Grigoryan <vahe.grigoryan@theobroma-systems.com> Link: https://lore.kernel.org/r/20231214122801.314...
```diff diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts index 115c14c0a3c6..4f2d4bb12032 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts @@ -177,7 +177,7 @@ <0 RK_PB2 R...
ed9b50a13edf442f5493603cc54f73bfc6eca1e9
Analyze and fix the following issue in the Linux kernel code: btrfs: cache that we don't have security.capability set
Problem Details: When profiling a workload I noticed we were constantly calling getxattr. These were mostly coming from __remove_privs, which will lookup if security.capability exists to remove it. However instrumenting getxattr showed we get called nearly constantly on an idle machine on a lot of accesses. These are...
```diff diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 5572ae52444e..74a2b02669e7 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -69,6 +69,8 @@ enum { BTRFS_INODE_VERITY_IN_PROGRESS, /* Set when this inode is a free space inode. */ BTRFS_INODE_FREE_SPACE_INODE, + /* Set wh...
f67d922edb4e95a4a56d07d5d40a76dd4f23a85b
Analyze and fix the following issue in the Linux kernel code: fs: indicate request originates from old mount API
Problem Details: We already communicate to filesystems when a remount request comes from the old mount API as some filesystems choose to implement different behavior in the new mount API than the old mount API to e.g., take the chance to fix significant API bugs. Allow the same for regular mount requests. Fixes: b3309...
```diff diff --git a/fs/namespace.c b/fs/namespace.c index fbf0e596fcd3..6c39ec020a5f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2875,7 +2875,12 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags, if (IS_ERR(fc)) return PTR_ERR(fc); + /* + * Indicate to the filesystem that the remo...
ebb0beca6c6a2d33f809a74bad63261651237833
Analyze and fix the following issue in the Linux kernel code: btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item()
Problem Details: There's no reason to open code what btrfs_next_item() does when searching for extent items at scrub.c:scrub.c:find_first_extent_item(), so remove the logic to find the next item and use btrfs_next_item() instead, making the code shorter and less nested code blocks. While at it also fix the comment to t...
```diff diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 00826644bca8..2b04cdb3c4e9 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1408,14 +1408,11 @@ search_forward: if (ret > 0) break; next: - path->slots[0]++; - if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { - ret = btrfs_n...
3128b548c759da4263b44306093d3a1751dcc58d
Analyze and fix the following issue in the Linux kernel code: btrfs: split assert into two different asserts when removing block group
Problem Details: When starting a transaction to remove a block group we have one ASSERT that checks we found an extent map and that the extent map's start offset matches the desired chunk offset. In case one of the conditions fails, we get a stack trace that point to the respective line of code, however we can't tell w...
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 6e5dc68ff661..fca653cc977c 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1303,7 +1303,8 @@ struct btrfs_trans_handle *btrfs_start_trans_remove_block_group( read_lock(&em_tree->lock); em = lookup_extent_mapping(em_tree,...
9ba7c686feb04f16088ca4523c204ed49b07fc0a
Analyze and fix the following issue in the Linux kernel code: btrfs: do not utilize goto to implement delayed inode ref deletion
Problem Details: [PROBLEM] The function __btrfs_update_delayed_inode() is doing something not meeting the code standard of today: path->slots[0]++ if (path->slots[0] >= btrfs_header_nritems(leaf)) goto search; again: if (!is_the_target_inode_ref()) goto out; ret = btrfs_delete_item(); /* Some cleanup. */ ret...
```diff diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 7381241334e8..91159dd7355b 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1036,14 +1036,33 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans, if (!test_bit(BTRFS_DELAYED_NODE_DEL_IREF, &n...
2dc4196138055eb0340231aecac4d78c2ec2bea5
Analyze and fix the following issue in the Linux kernel code: x86/alternatives: Disable interrupts and sync when optimizing NOPs in place
Problem Details: apply_alternatives() treats alternatives with the ALT_FLAG_NOT flag set special as it optimizes the existing NOPs in place. Unfortunately, this happens with interrupts enabled and does not provide any form of core synchronization. So an interrupt hitting in the middle of the update and using the affe...
```diff diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index fd44739828f7..aae7456ece07 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -255,6 +255,16 @@ static void __init_or_module noinline optimize_nops(u8 *instr, size_t len) } } +static void __init_...
3ea1704a92967834bf0e64ca1205db4680d04048
Analyze and fix the following issue in the Linux kernel code: x86/alternatives: Sync core before enabling interrupts
Problem Details: text_poke_early() does: local_irq_save(flags); memcpy(addr, opcode, len); local_irq_restore(flags); sync_core(); That's not really correct because the synchronization should happen before interrupts are re-enabled to ensure that a pending interrupt observes the complete update of the opco...
```diff diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 73be3931e4f0..fd44739828f7 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1685,8 +1685,8 @@ void __init_or_module text_poke_early(void *addr, const void *opcode, } else { local_irq_save(flag...
69a7386c1ec25476a0c78ffeb59de08a2a08f495
Analyze and fix the following issue in the Linux kernel code: x86/smpboot/64: Handle X2APIC BIOS inconsistency gracefully
Problem Details: Chris reported that a Dell PowerEdge T340 system stopped to boot when upgrading to a kernel which contains the parallel hotplug changes. Disabling parallel hotplug on the kernel command line makes it boot again. It turns out that the Dell BIOS has x2APIC enabled and the boot CPU comes up in X2APIC mo...
```diff diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 086a2c3aaaa0..0f8103240fda 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -255,6 +255,22 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) testl $X2APIC_ENABLE, %eax jnz .Lread_apicid_msr +#i...
23c93c3b6275a59f2a685f4a693944b53c31df4e
Analyze and fix the following issue in the Linux kernel code: bnxt_en: do not map packet buffers twice
Problem Details: Remove double-mapping of DMA buffers as it can prevent page pool entries from being freed. Mapping is managed by page pool infrastructure and was previously managed by the driver in __bnxt_alloc_rx_page before allowing the page pool infrastructure to manage it. Fixes: 578fcfd26e2a ("bnxt_en: Let the ...
```diff diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 96f5ca778c67..8cb9a99154aa 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -59,7 +59,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct b...
a5b91555403e3a09ae00bed85fc78b60801dda24
Analyze and fix the following issue in the Linux kernel code: xfs: repair quotas
Problem Details: Fix anything that causes the quota verifiers to fail. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
```diff diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index cdf81eb180e2..fbe3cdc79036 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -199,5 +199,9 @@ xfs-y += $(addprefix scrub/, \ xfs-$(CONFIG_XFS_RT) += $(addprefix scrub/, \ rtbitmap_repair.o \ ) + +xfs-$(CONFIG_XFS_QUOTA) += $(addprefi...
ffd37b22bd2b7cca7749c85a0a08268158903e55
Analyze and fix the following issue in the Linux kernel code: xfs: online repair of realtime bitmaps
Problem Details: Fix all the file metadata surrounding the realtime bitmap file, which includes the rt geometry, file size, forks, and space mappings. The bitmap contents themselves cannot be fixed without rt rmap, so that will come later. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hell...
```diff diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index a7830df42c4e..e7727451d1c8 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -192,5 +192,9 @@ xfs-y += $(addprefix scrub/, \ refcount_repair.o \ repair.o \ ) + +xfs-$(CONFIG_XFS_RT) += $(addprefix scrub/, \ + rtbitmap_rep...
dbbdbd0086320a026903ca34efedb6abf55230ed
Analyze and fix the following issue in the Linux kernel code: xfs: repair problems in CoW forks
Problem Details: Try to repair errors that we see in file CoW forks so that we don't do stupid things like remap garbage into a file. There's not a lot we can do with the COW fork -- the ondisk metadata record only that the COW staging extents are owned by the refcount btree, which effectively means that we can't reco...
```diff diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 66c1a5001772..a7830df42c4e 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -184,6 +184,7 @@ xfs-y += $(addprefix scrub/, \ agheader_repair.o \ alloc_repair.o \ bmap_repair.o \ + cow_repair.o \ ialloc_repair.o \ ...
d9041681dd2f5334529a68868c9266631c384de4
Analyze and fix the following issue in the Linux kernel code: xfs: set inode sick state flags when we zap either ondisk fork
Problem Details: In a few patches, we'll add some online repair code that tries to massage the ondisk inode record just enough to get it to pass the inode verifiers so that we can continue with more file repairs. Part of that massaging can include zapping the ondisk forks to clear errors. After that point, the bmap f...
```diff diff --git a/fs/xfs/libxfs/xfs_health.h b/fs/xfs/libxfs/xfs_health.h index 99e796256c5d..6296993ff8f3 100644 --- a/fs/xfs/libxfs/xfs_health.h +++ b/fs/xfs/libxfs/xfs_health.h @@ -68,6 +68,11 @@ struct xfs_fsop_geom; #define XFS_SICK_INO_SYMLINK (1 << 6) /* symbolic link remote target */ #define XFS_SICK_INO_...
6b5d917780219d0d8f8e2cefefcb6f50987d0fa3
Analyze and fix the following issue in the Linux kernel code: xfs: dont cast to char * for XFS_DFORK_*PTR macros
Problem Details: Code in the next patch will assign the return value of XFS_DFORK_*PTR macros to a struct pointer. gcc complains about casting char* strings to struct pointers, so let's fix the macro's cast to void* to shut up the warnings. While we're at it, fix one of the scrub tests that uses PTR to use BOFF inste...
```diff diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 9a88aba1589f..f16974126ff9 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1008,7 +1008,7 @@ enum xfs_dinode_fmt { * Return pointers to the data or attribute forks. */ #define XFS_DFORK_DPTR(dip) \ - ((c...
576d30ecb620ae3bc156dfb2a4e91143e7f3256d
Analyze and fix the following issue in the Linux kernel code: xfs: add missing nrext64 inode flag check to scrub
Problem Details: Add this missing check that the superblock nrext64 flag is set if the inode flag is set. Fixes: 9b7d16e34bbeb ("xfs: Introduce XFS_DIFLAG2_NREXT64 and associated helpers") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
```diff diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c index 7e97db8255c6..6c40f3e020ea 100644 --- a/fs/xfs/scrub/inode.c +++ b/fs/xfs/scrub/inode.c @@ -342,6 +342,10 @@ xchk_inode_flags2( if (xfs_dinode_has_bigtime(dip) && !xfs_has_bigtime(mp)) goto bad; + /* no large extent counts without the filesys...
6ece924b95226235059ed2ffc2c0f44a124c5910
Analyze and fix the following issue in the Linux kernel code: xfs: create separate structures and code for u32 bitmaps
Problem Details: Create a version of the xbitmap that handles 32-bit integer intervals and adapt the xfs_agblock_t bitmap to use it. This reduces the size of the interval tree nodes from 48 to 36 bytes and enables us to use a more efficient slab (:0000040 instead of :0000048) which allows us to pack more nodes into a ...
```diff diff --git a/fs/xfs/scrub/agheader_repair.c b/fs/xfs/scrub/agheader_repair.c index 876a2f41b063..4000bdc8b500 100644 --- a/fs/xfs/scrub/agheader_repair.c +++ b/fs/xfs/scrub/agheader_repair.c @@ -494,12 +494,11 @@ xrep_agfl_walk_rmap( /* Strike out the blocks that are cross-linked according to the rmapbt. */ S...
a20ffa7d9f863056364b11a680145a76ef15acb2
Analyze and fix the following issue in the Linux kernel code: xfs: add debug knobs to control btree bulk load slack factors
Problem Details: Add some debug knobs so that we can control the leaf and node block slack when rebuilding btrees. For developers, it might be useful to construct btrees of various heights by crafting a filesystem with a certain number of records and then using repair+knobs to rebuild the index with a certain shape. P...
```diff diff --git a/fs/xfs/scrub/newbt.c b/fs/xfs/scrub/newbt.c index 992cf34a13e7..46883606ad88 100644 --- a/fs/xfs/scrub/newbt.c +++ b/fs/xfs/scrub/newbt.c @@ -32,6 +32,7 @@ * btree bulk loading code calculates for us. However, there are some * exceptions to this rule: * + * (0) If someone turned one of the d...
13ae04d8d45227c2ba51e188daf9fc13d08a1b12
Analyze and fix the following issue in the Linux kernel code: xfs: force all buffers to be written during btree bulk load
Problem Details: While stress-testing online repair of btrees, I noticed periodic assertion failures from the buffer cache about buffers with incorrect DELWRI_Q state. Looking further, I observed this race between the AIL trying to write out a btree block and repair zapping a btree block after the fact: AIL: Repai...
```diff diff --git a/fs/xfs/libxfs/xfs_btree_staging.c b/fs/xfs/libxfs/xfs_btree_staging.c index dd75e208b543..29e3f8ccb185 100644 --- a/fs/xfs/libxfs/xfs_btree_staging.c +++ b/fs/xfs/libxfs/xfs_btree_staging.c @@ -342,9 +342,7 @@ xfs_btree_bload_drop_buf( if (*bpp == NULL) return; - if (!xfs_buf_delwri_queue(*b...
fbd60a67f4975d6bad25d9d504055fae8c1c27b7
Analyze and fix the following issue in the Linux kernel code: accel/qaic: Fix MHI channel struct field order
Problem Details: The timesync channels have their struct fields out of order with the rest of the channels. Fix them so there is a consistent style in the file. Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@li...
```diff diff --git a/drivers/accel/qaic/mhi_controller.c b/drivers/accel/qaic/mhi_controller.c index 832464f2833a..364eede0ac02 100644 --- a/drivers/accel/qaic/mhi_controller.c +++ b/drivers/accel/qaic/mhi_controller.c @@ -358,8 +358,8 @@ static struct mhi_channel_config aic100_channels[] = { .wake_capable = false, ...
e9158c7e55339737847cebbfa397c668713f1a15
Analyze and fix the following issue in the Linux kernel code: usb: typec: tcpm: Parse Accessory Mode information
Problem Details: Some of the boards supported by the TCPM drivers can support USB-C Accessory Modes (Analog Audio, Debug). Parse information about supported modes from the device tree. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: htt...
```diff diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 8372f98de757..cf70f1cf2f61 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -6144,6 +6144,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, { const char *opmode_str; int ret; + int mode;...
4c8874c2a6512b9fe7285cab1a6910d9211a6cfb
Analyze and fix the following issue in the Linux kernel code: accel/qaic: Implement quirk for SOC_HW_VERSION
Problem Details: The SOC_HW_VERSION register in the BHI space is not correctly initialized by the device and in many cases contains uninitialized data. The register could contain 0xFFFFFFFF which is a special value to indicate a link error in PCIe, therefore if observed, we could incorrectly think the device is down. ...
```diff diff --git a/drivers/accel/qaic/mhi_controller.c b/drivers/accel/qaic/mhi_controller.c index 5036e58e7235..1405623b03e4 100644 --- a/drivers/accel/qaic/mhi_controller.c +++ b/drivers/accel/qaic/mhi_controller.c @@ -404,8 +404,21 @@ static struct mhi_controller_config aic100_config = { static int mhi_read_reg...
c8b6f4ad2ff9c6d88cdeb9acf16d0c4a323dd499
Analyze and fix the following issue in the Linux kernel code: accel/qaic: Fix GEM import path code
Problem Details: Do not modify the size of dmabuf as it is immutable. Fixes: ff13be830333 ("accel/qaic: Add datapath") Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Jacek Lawr...
```diff diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c index 4a8e43a7a6a4..d42f002bc0cf 100644 --- a/drivers/accel/qaic/qaic_data.c +++ b/drivers/accel/qaic/qaic_data.c @@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_ struct dma_buf_att...
80602b6b5a23b210224a5b44d9e5b5c1dc193632
Analyze and fix the following issue in the Linux kernel code: xhci: Fix null pointer dereference during S4 resume when resetting ep0
Problem Details: During device enumeration usb core resets endpoint 0 if the max packet size value differs from the one read from the device descriptor. usb core will additionally reset endpoint 0 during S4 resume, before re-enumerating the device, if the device has a reset-resume flag set. In this case the xhci devi...
```diff diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 08fbabff23a0..7d5b94905b9c 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3077,6 +3077,9 @@ done: * of an endpoint that isn't in the halted state this function will issue a * configure endpoint command with the Drop...
c084af69a8f425b8cb56479ff0ea11e48aba0c62
Analyze and fix the following issue in the Linux kernel code: usb: dwc3: imx8mp: Fix smatch warning
Problem Details: dwc3_imx8mp_pm_resume() warn: 'dwc3_imx->suspend_clk' from clk_prepare_enable() not released Signed-off-by: Himanshu Bhavani <himanshu.bhavani@siliconsignals.io> Link: https://lore.kernel.org/r/20231215143458.158810-1-himanshu.bhavani@siliconsignals.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxf...
```diff diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index a1e15f2fffdb..8ee448068503 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -363,8 +363,10 @@ static int __maybe_unused dwc3_imx8mp_pm_resume(struct device *dev) } ret = clk_prepare_enable...
f1fd91a0924b6bff91ca1287461fb8e3b3b61d92
Analyze and fix the following issue in the Linux kernel code: usb: gadget: webcam: Make g_webcam loadable again
Problem Details: commit 588b9e85609b ("usb: gadget: uvc: add v4l2 enumeration api calls") has rendered the precomposed (aka legacy) webcam gadget unloadable. uvc_alloc() since then has depended on certain config groups being available in configfs tree related to the UVC function. However, legacy gadgets do not create ...
```diff diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 77999ed53d33..da5f28e471b0 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -959,7 +959,8 @@ static void uvc_free(struct usb_function *f) struct uvc_device *uvc = to_uvc(f)...
04e6ccfc93c5a1aa1d75a537cf27e418895e20ea
Analyze and fix the following issue in the Linux kernel code: thermal: core: Fix NULL pointer dereference in zone registration error path
Problem Details: If device_register() in thermal_zone_device_register_with_trips() returns an error, the tz variable is set to NULL and subsequently dereferenced in kfree(tz->tzp). Commit adc8749b150c ("thermal/drivers/core: Use put_device() if device_register() fails") added the tz = NULL assignment in question to av...
```diff diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 2415dc50c31d..5e5fcbd81dda 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1393,7 +1393,6 @@ unregister: device_del(&tz->device); release_device: put_device(&tz->device); - tz = NULL; re...
65a618dd73216e111baab144a837f842dbb6a738
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: svm range always mapped flag not working on APU
Problem Details: On gfx943 APU there is no VRAM and page migration, queue CWSR area, svm range with always mapped flag, is not mapped to GPU correctly. This works fine if retry fault on CWSR area can be recovered, but could cause deadlock if there is another retry fault recover waiting for CWSR to finish. Fix this by ...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index 617d20f0380f..fb0011f80277 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -1607,18 +1607,24 @@ static int svm_range_validate_and_map(struct mm_struct *mm, if (test_...
24149412dfc71f7f4a54868702e9145e396263d3
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: only flush mes process context if mes support is there
Problem Details: Fix up on mes process context flush to prevent non-mes devices from spamming error messages or running into undefined behaviour during process termination. Fixes: bd33bb1409b4 ("drm/amdkfd: fix mes set shader debugger process management") Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Reviewed-by:...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c index 8e55e78fce4e..43eff221eae5 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c @@ -87,7 +87,8 @@ void kf...
2e07e8348ea454615e268222ae3fc240421be768
Analyze and fix the following issue in the Linux kernel code: Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg
Problem Details: This can cause a race with bt_sock_ioctl() because bt_sock_recvmsg() gets the skb from sk->sk_receive_queue and then frees it without holding lock_sock. A use-after-free for a skb occurs with the following flow. ``` bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram() bt_sock_ioctl() -> skb_...
```diff diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 336a76165454..b93464ac3517 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -309,11 +309,14 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, if (flags & MSG_OOB) return -...
59b047bc98084f8af2c41483e4d68a5adf2fa7f7
Analyze and fix the following issue in the Linux kernel code: Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE
Problem Details: If two Bluetooth devices both support BR/EDR and BLE, and also support Secure Connections, then they only need to pair once. The LTK generated during the LE pairing process may be converted into a BR/EDR link key for BR/EDR transport, and conversely, a link key generated during the BR/EDR SSP pairing p...
```diff diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index fb5e3ef3ec2f..a3a1ea2696a8 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -189,6 +189,7 @@ struct blocked_key { struct smp_csrk { bdaddr_t bdaddr; u8 bdaddr_type; + u8 link_type; ...
50efc63d1a7a7b9a6ed21adae1b9a7123ec8abc0
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_core: Fix hci_conn_hash_lookup_cis
Problem Details: hci_conn_hash_lookup_cis shall always match the requested CIG and CIS ids even when they are unset as otherwise it result in not being able to bind/connect different sockets to the same address as that would result in having multiple sockets mapping to the same hci_conn which doesn't really work and pr...
```diff diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 20988623c5cc..fb5e3ef3ec2f 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1227,11 +1227,11 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev, continu...
a5812c68d849505ea657f653446512b85887f813
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_event: shut up a false-positive warning
Problem Details: Turning on -Wstringop-overflow globally exposed a misleading compiler warning in bluetooth: net/bluetooth/hci_event.c: In function 'hci_cc_read_class_of_dev': net/bluetooth/hci_event.c:524:9: error: 'memcpy' writing 3 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]...
```diff diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a94decff233e..cc5fd290d529 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -516,6 +516,9 @@ static u8 hci_cc_read_class_of_dev(struct hci_dev *hdev, void *data, { struct hci_rp_read_class_of_dev *rp = data; +...
99e67d46e5ff3c7c901af6009edec72d3d363be8
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent
Problem Details: Before setting HCI_INQUIRY bit check if HCI_OP_INQUIRY was really sent otherwise the controller maybe be generating invalid events or, more likely, it is a result of fuzzing tools attempting to test the right behavior of the stack when unexpected events are generated. Cc: stable@vger.kernel.org Link: ...
```diff diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 5b6fd625fc09..a94decff233e 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2302,7 +2302,8 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) return; } - set_bit(HCI_INQUIRY, &hdev->flags); + ...
769bf60e17ee1a56a81e7c031192c3928312c52e
Analyze and fix the following issue in the Linux kernel code: Bluetooth: Fix deadlock in vhci_send_frame
Problem Details: syzbot found a potential circular dependency leading to a deadlock: -> #3 (&hdev->req_lock){+.+.}-{3:3}: __mutex_lock_common+0x1b6/0x1bc2 kernel/locking/mutex.c:599 __mutex_lock kernel/locking/mutex.c:732 [inline] mutex_lock_nested+0x17/0x1c kernel/locking/mutex.c:784 hci_dev_do_clo...
```diff diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index f3892e9ce800..572d68d52965 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -11,6 +11,7 @@ #include <linux/module.h> #include <asm/unaligned.h> +#include <linux/atomic.h> #include <linux/kernel.h> ...
bda910d81843228c18d1ac51af6b149f2e8261c7
Analyze and fix the following issue in the Linux kernel code: VMCI: Remove handle_arr_calc_size()
Problem Details: Use struct_size() instead of handle_arr_calc_size(). This is much more conventional. While at it, use size_add() when computing the needed size in vmci_handle_arr_append_entry(). This prevents from (unlikely) overflow when computing the new size to reallocate. Suggested-by: Kees Cook <keescook@chromi...
```diff diff --git a/drivers/misc/vmw_vmci/vmci_handle_array.c b/drivers/misc/vmw_vmci/vmci_handle_array.c index de7fee7ead1b..681b3500125a 100644 --- a/drivers/misc/vmw_vmci/vmci_handle_array.c +++ b/drivers/misc/vmw_vmci/vmci_handle_array.c @@ -8,12 +8,6 @@ #include <linux/slab.h> #include "vmci_handle_array.h" -...
f3e67fc406909fca9429b4283f243e855fab5c59
Analyze and fix the following issue in the Linux kernel code: spmi: mtk-pmif: Reorder driver remove sequence
Problem Details: This driver enables clocks and then adds SPMI controller in probing, so we expect the reversed sequence in removal. Fix the order in the remove callback. Signed-off-by: Fei Shao <fshao@chromium.org> Link: https://lore.kernel.org/r/20230824104101.4083400-4-fshao@chromium.org Reviewed-by: AngeloGioacchi...
```diff diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c index 6ebc6901490a..cc660da6a037 100644 --- a/drivers/spmi/spmi-mtk-pmif.c +++ b/drivers/spmi/spmi-mtk-pmif.c @@ -515,9 +515,9 @@ static void mtk_spmi_remove(struct platform_device *pdev) struct spmi_controller *ctrl = platform_get_drvda...
e821d50ab5b956ed0effa49faaf29912fd4106d9
Analyze and fix the following issue in the Linux kernel code: spmi: mediatek: Fix UAF on device remove
Problem Details: The pmif driver data that contains the clocks is allocated along with spmi_controller. On device remove, spmi_controller will be freed first, and then devres , including the clocks, will be cleanup. This leads to UAF because putting the clocks will access the clocks in the pmif driver data, which is al...
```diff diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c index 54c35f5535cb..1261f381cae6 100644 --- a/drivers/spmi/spmi-mtk-pmif.c +++ b/drivers/spmi/spmi-mtk-pmif.c @@ -475,7 +475,7 @@ static int mtk_spmi_probe(struct platform_device *pdev) for (i = 0; i < arb->nclks; i++) arb->clks[i].id...
f200fff8d019f2754f91f5d715652e3e3fdf3604
Analyze and fix the following issue in the Linux kernel code: spmi: mtk-pmif: Serialize PMIF status check and command submission
Problem Details: Before writing the read or write command to the SPMI arbiter through the PMIF interface, the current status of the channel is checked to ensure it is idle. However, since the status only changes from idle when the command is written, it is possible for two concurrent calls to determine that the channel...
```diff diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c index b3c991e1ea40..54c35f5535cb 100644 --- a/drivers/spmi/spmi-mtk-pmif.c +++ b/drivers/spmi/spmi-mtk-pmif.c @@ -50,6 +50,7 @@ struct pmif { struct clk_bulk_data clks[PMIF_MAX_CLKS]; size_t nclks; const struct pmif_data *data; + raw...
aaee477e3e2c7305a95ffc528bf831a13da3dacb
Analyze and fix the following issue in the Linux kernel code: cdx: Explicitly include correct DT includes, again
Problem Details: The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it was merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a...
```diff diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c index 4461c6c9313f..d84d153078d7 100644 --- a/drivers/cdx/cdx.c +++ b/drivers/cdx/cdx.c @@ -57,7 +57,10 @@ #include <linux/init.h> #include <linux/kernel.h> +#include <linux/of.h> #include <linux/of_device.h> +#include <linux/of_platform.h> +#include <linu...
ff6d413b0b59466e5acf2e42f294b1842ae130a1
Analyze and fix the following issue in the Linux kernel code: kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to strscpy()
Problem Details: One of the last remaining users of strlcpy() in the kernel is kernfs_path_from_node_locked(), which passes back the problematic "length we _would_ have copied" return value to indicate truncation. Convert the chain of all callers to use the negative return value (some of which already doing this expli...
```diff diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index d23bf7883b08..bce1d7ac95ca 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -127,7 +127,7 @@ static struct kernfs_node *kernfs_common_ancestor(struct kernfs_node *a, * * [3] when @kn_to is %NULL result will be "(null)" * - * Return: the length of t...
5b56bf5cdb8b7c989055fe4d73fe3f409427d1d5
Analyze and fix the following issue in the Linux kernel code: kernfs: Convert kernfs_name_locked() from strlcpy() to strscpy()
Problem Details: strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destination ...
```diff diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index fa9077576e02..d23bf7883b08 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -54,9 +54,9 @@ static bool kernfs_lockdep(struct kernfs_node *kn) static int kernfs_name_locked(struct kernfs_node *kn, char *buf, size_t buflen) { if (!kn) - return strlcpy...
792e04768efbf2a1b49a7162a9fa06c1fa584723
Analyze and fix the following issue in the Linux kernel code: kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy()
Problem Details: strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destination ...
```diff diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 62d39ecf0a46..fa9077576e02 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -862,16 +862,16 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent, const unsigned char *path, const void *ns) { - size_t len; + ssize_t len...
f67eabffb57d0bee379994a18ec5f462b2cbdf86
Analyze and fix the following issue in the Linux kernel code: Bluetooth: Fix not notifying when connection encryption changes
Problem Details: Some layers such as SMP depend on getting notified about encryption changes immediately as they only allow certain PDU to be transmitted over an encrypted link which may cause SMP implementation to reject valid PDUs received thus causing pairing to fail when it shouldn't. Fixes: 7aca0ac4792e ("Bluetoo...
```diff diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0849e0dafa95..5b6fd625fc09 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -820,8 +820,6 @@ static u8 hci_cc_write_auth_payload_timeout(struct hci_dev *hdev, void *data, if (!rp->status) conn->auth_payload_ti...
5133bee62f0ea5d4c316d503cc0040cac5637601
Analyze and fix the following issue in the Linux kernel code: fs/kernfs/dir: obey S_ISGID
Problem Details: Handling of S_ISGID is usually done by inode_init_owner() in all other filesystems, but kernfs doesn't use that function. In kernfs, struct kernfs_node is the primary data structure, and struct inode is only created from it on demand. Therefore, inode_init_owner() can't be used and we need to imitate...
```diff diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 8b2bd65d70e7..62d39ecf0a46 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -676,6 +676,18 @@ struct kernfs_node *kernfs_new_node(struct kernfs_node *parent, { struct kernfs_node *kn; + if (parent->mode & S_ISGID) { + /* this code block imitates in...
b77fdd6a48e60a0ed1865edbe6d9bf0538551f85
Analyze and fix the following issue in the Linux kernel code: scripts/kernel-doc: restore warning for Excess struct/union
Problem Details: The warning for Excess struct or union member description was removed when the $nested parameter of check_sections() was removed. This causes some kernel-doc notation warnings to be missed. Recently the kernel test robot somehow reported an Excess member. The code in kernel-doc has not issued that war...
```diff diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 08a3e603db19..cb1af401d3ff 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1654,6 +1654,13 @@ sub check_sections($$$$$) { "'$sects[$sx]' " . "description in '$decl_name'\n"); } + elsif (($decl_type eq "struct") or + ...
ce8df3f4d0d99ee2f76d1260fe69793ad05a13bf
Analyze and fix the following issue in the Linux kernel code: mcb: core: fix kernel-doc warnings
Problem Details: Correct function comments to prevent warnings from scripts/kernel-doc. mcb-core.c:270: warning: Function parameter or member 'carrier' not described in 'mcb_alloc_bus' mcb-core.c:336: warning: expecting prototype for mcb_bus_put(). Prototype was for mcb_bus_get() instead mcb-core.c:463: warning: Funct...
```diff diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index ba4530459de8..61994da7bad0 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c @@ -263,6 +263,7 @@ static void mcb_free_bus(struct device *dev) /** * mcb_alloc_bus() - Allocate a new @mcb_bus + * @carrier: generic &struct devic...
95171e45663307fc33a939f0220b39afadfe7cb9
Analyze and fix the following issue in the Linux kernel code: mei: fix vsc dependency
Problem Details: CONFIG_INTEL_MEI_VSC_HW can be set to built-in even with CONFIG_MEI=m, but then the driver is not built because Kbuild never enters the drivers/misc/mei directory for built-in files, leading to a link failure: ERROR: modpost: "vsc_tp_reset" [drivers/misc/mei/mei-vsc.ko] undefined! ERROR: modpost: "vsc...
```diff diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index 858bd701d68c..1e28ca23a74a 100644 --- a/drivers/misc/mei/Kconfig +++ b/drivers/misc/mei/Kconfig @@ -62,6 +62,7 @@ config INTEL_MEI_GSC config INTEL_MEI_VSC_HW tristate "Intel visual sensing controller device transport driver" + depends ...
a7565fc8399725d00cc006c35d0621a5cb5f9554
Analyze and fix the following issue in the Linux kernel code: mei: fix spellos in mei.h
Problem Details: For include/uapi/linux/mei.h, correct spellos reported by codespell. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Tomas Winkler <tomas.winkler@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20231213224014.23187-1-rdunlap@infradead.org Signed-o...
```diff diff --git a/include/uapi/linux/mei.h b/include/uapi/linux/mei.h index 171c5cce3641..68a0272e99b7 100644 --- a/include/uapi/linux/mei.h +++ b/include/uapi/linux/mei.h @@ -100,14 +100,14 @@ struct mei_connect_client_data_vtag { * a FW client on a tagged channel. From this point on, every read * and write wil...
0a10d107818cc4def73723ba3101aae0d25ea353
Analyze and fix the following issue in the Linux kernel code: gpiolib: allocate memory atomically with a spinlock held
Problem Details: We will eventually switch to protecting the GPIO descriptors with a mutex but until then, we need to allocate memory for the label copy atomically while we're holding the global spinlock. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/linux-gpio/62588146-eed6-42f...
```diff diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e190be75dc2..6efe44570333 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2399,7 +2399,15 @@ char *gpiochip_dup_line_label(struct gpio_chip *gc, unsigned int offset) if (!test_bit(FLAG_REQUESTED, &desc->flags)) return ...
1bd773b4f0c90123af19a853244be61518ae0556
Analyze and fix the following issue in the Linux kernel code: nfsd: hold nfsd_mutex across entire netlink operation
Problem Details: Rather than using svc_get() and svc_put() to hold a stable reference to the nfsd_svc for netlink lookups, simply hold the mutex for the entire time. The "entire" time isn't very long, and the mutex is not often contented. This makes way for us to remove the refcounts of svc, which is more confusing t...
```diff diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 79efb1075f38..05b55db33424 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1515,11 +1515,10 @@ int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb) int ret = -ENODEV; mutex_lock(&nfsd_mutex); - if (nn->nfsd_serv) { - svc_get(nn->nfs...
2a501f55cd641eb4d3c16a2eab0d678693fac663
Analyze and fix the following issue in the Linux kernel code: nfsd: call nfsd_last_thread() before final nfsd_put()
Problem Details: If write_ports_addfd or write_ports_addxprt fail, they call nfsd_put() without calling nfsd_last_thread(). This leaves nn->nfsd_serv pointing to a structure that has been freed. So remove 'static' from nfsd_last_thread() and call it when the nfsd_serv is about to be destroyed. Fixes: ec52361df99b ("...
```diff diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 739ed5bf71cd..79efb1075f38 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -705,8 +705,10 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred err = svc_addsock(nn->nfsd_serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT...
fca8a117c1c9a0f8b8feed117db34cf58134dc2c
Analyze and fix the following issue in the Linux kernel code: arm64: dts: armada-3720-turris-mox: set irq type for RTC
Problem Details: The rtc on the mox shares its interrupt line with the moxtet bus. Set the interrupt type to be consistent between both devices. This ensures correct setup of the interrupt line regardless of probing order. Signed-off-by: Sjoerd Simons <sjoerd@collabora.com> Cc: <stable@vger.kernel.org> # v6.2+ Fixes: ...
```diff diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts index a89747d2a600..f1a9f2234359 100644 --- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts @@ -130,7 +130,7 @@ co...
3f034c374ad55773c12dd8f3c1607328e17c0072
Analyze and fix the following issue in the Linux kernel code: block: prevent an integer overflow in bvec_try_merge_hw_page
Problem Details: Reordered a check to avoid a possible overflow when adding len to bv_len. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://lore.kernel.org/r/20231204173419.782378-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
```diff diff --git a/block/bio.c b/block/bio.c index 5eba53ca953b..270f6b99926e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -944,7 +944,7 @@ bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv, if ((addr1 | mask) != (addr2 | mask)) return false; - if (bv->bv_len + len > queue_max_segment_si...
fedb923aaf611e36adad4cd8c91d35bc283d3eea
Analyze and fix the following issue in the Linux kernel code: ARM64: dts: marvell: Fix some common switch mistakes
Problem Details: Fix some errors in the Marvell MV88E6xxx switch descriptions: - The top node had no address size or cells. - switch0@0 is not OK, should be ethernet-switch@0. - ports should be ethernet-ports - port@0 should be ethernet-port@0 - PHYs should be named ethernet-phy@ Reviewed-by: Andrew Lunn <andrew@lunn....
```diff diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts index f9abef8dcc94..870bb380a40a 100644 --- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts +++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.d...
6e75ac5a824e1551764cd4bfce5ede3d5fafc407
Analyze and fix the following issue in the Linux kernel code: ARM: dts: marvell: Fix some common switch mistakes
Problem Details: Fix some errors in the Marvell MV88E6xxx switch descriptions: - The top node had no address size or cells. - switch0@0 is not OK, should be ethernet-switch@0. - The ports node should be named ethernet-ports - The ethernet-ports node should have port@0 etc children, no plural "ports" in the children. ...
```diff diff --git a/arch/arm/boot/dts/marvell/armada-370-rd.dts b/arch/arm/boot/dts/marvell/armada-370-rd.dts index b459a670f615..1b241da11e94 100644 --- a/arch/arm/boot/dts/marvell/armada-370-rd.dts +++ b/arch/arm/boot/dts/marvell/armada-370-rd.dts @@ -149,39 +149,37 @@ }; }; - switch: switch@10 { + switch: et...