id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
43a4b19c17d156786adf3515434e7d522664d75d
Analyze and fix the following issue in the Linux kernel code: dt-bindings: power: qcom,rpmhpd: Fix whitespace in RPMHPD defines
Problem Details: Some RPMHPD_* defines in the Generic RPMH Power Domain Indexes section were using spaces instead of tabs for alignment. Fix them to be consistent with the rest of the file. Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> Acked-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Ulf Hansso...
```diff diff --git a/include/dt-bindings/power/qcom,rpmhpd.h b/include/dt-bindings/power/qcom,rpmhpd.h index 67e2634fdc99..74e910150956 100644 --- a/include/dt-bindings/power/qcom,rpmhpd.h +++ b/include/dt-bindings/power/qcom,rpmhpd.h @@ -7,7 +7,7 @@ #define _DT_BINDINGS_POWER_QCOM_RPMHPD_H /* Generic RPMH Power Do...
26eb7c0a7ab09d83eec833db6a5a2bc60b9d4d9a
Analyze and fix the following issue in the Linux kernel code: drm/i915: Fix color blob reference handling in intel_plane_state
Problem Details: Take proper references for hw color blobs (degamma_lut, gamma_lut, ctm, lut_3d) in intel_plane_duplicate_state() and drop them in intel_plane_destroy_state(). v2: - handle blobs in hw state clear Cc: <stable@vger.kernel.org> #v6.19+ Fixes: 3b7476e786c2 ("drm/i915/color: Add framework to program PRE/P...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_plane.c b/drivers/gpu/drm/i915/display/intel_plane.c index 82f445c83158..07eae4176dad 100644 --- a/drivers/gpu/drm/i915/display/intel_plane.c +++ b/drivers/gpu/drm/i915/display/intel_plane.c @@ -144,6 +144,15 @@ intel_plane_duplicate_state(struct drm_plane *plane)...
8ee4e6dc8b960122b4c8504978d20774634b6633
Analyze and fix the following issue in the Linux kernel code: clocksource/drivers/timer-ti-dm: Fix property name in comment
Problem Details: ti,always-on property doesn't exist. ti,timer-alwon is meant here. Fix this minor bug in the comment. Signed-off-by: Markus Schneider-Pargmann (TI) <msp@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Reviewed-by: Dhruva Gole <d-...
```diff diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c index eb0dfe4b9b7c..3804c1234522 100644 --- a/drivers/clocksource/timer-ti-dm-systimer.c +++ b/drivers/clocksource/timer-ti-dm-systimer.c @@ -226,7 +226,7 @@ static bool __init dmtimer_is_preferred(struct device...
6951e870868d0b4bc385cbc851b871effa595330
Analyze and fix the following issue in the Linux kernel code: dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description
Problem Details: The arm,arch_timer DT binding is extremely imprecise in describing the requirements for interrupts. Follow the architecture by making it explicit that: - the EL1 secure timer irq is required if EL3 is implemented - the EL1 physical timer irq is always required - the EL1 virtual timer irq is always req...
```diff diff --git a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml index c5fc3b6c8bd0..c65e48a155ab 100644 --- a/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +++ b/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml @@ -1...
e8694f7cc29287e843648d1075177b9a2000d957
Analyze and fix the following issue in the Linux kernel code: wifi: fix leak if split 6 GHz scanning fails
Problem Details: rdev->int_scan_req is leaked if cfg80211_scan() fails. Note that it's supposed to be released at ___cfg80211_scan_done() but this doesn't happen as rdev->scan_req is NULL at that point, too, leading to the early return from the freeing function. unreferenced object 0xffff8881161d0800 (size 512): co...
```diff diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 358cbc9e43d8..27a56ee2e8f0 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1071,6 +1071,7 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev) struct cfg80211_scan_request_int *request; struct cfg80211_scan_request_int *rde...
10da12d352b7b2bb330a8609fdda9a58bf0e9856
Analyze and fix the following issue in the Linux kernel code: configfs_lookup(): don't leave ->s_dentry dangling on failure
Problem Details: Normally ->s_dentry is cleared when dentry it's pointing to becomes negative (on eviction, realistically). However, that only happens if dentry gets to be positive in the first place; in case of inode allocation failure dentry never becomes positive, so ->d_iput() is not called at all. We do part of ...
```diff diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 362b6ff9b908..e84483a0836d 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -486,6 +486,9 @@ static struct dentry * configfs_lookup(struct inode *dir, inode = configfs_create(dentry, mode); if (IS_ERR(inode)) { + spin_lock(&configfs_...
995b736ad46a80af84e58596c5e23ce94035bddf
Analyze and fix the following issue in the Linux kernel code: thermal/core: Fix missing stub for devm_thermal_cooling_device_register
Problem Details: Even it is very unlikely the thermal framework is disabled, the newly added devm_thermal_cooling_device_register() function has not the stub when the thermal framework is optout in the kernel. Add it. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/2026053...
```diff diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 81be6e6061b3..083b4f533933 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -344,7 +344,11 @@ static inline struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct t...
6d0c207c0a95bc4832fe0189973f64734ef5bfc0
Analyze and fix the following issue in the Linux kernel code: dt-bindings: thermal: cooling-devices: Update support for 3 cells cooling device
Problem Details: Extend the thermal cooling device binding to support a 3 cells specifier along with the 2 cells format. Update #cooling-cells property to enum to support both 2 and 3 arguments. Fix pwm-fan.yaml to restrict the number of cells to 'const: 2' Signed-off-by: Gaurav Kohli <gaurav.kohli@oss.qualcomm.com>...
```diff diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml index a84cc3a4cfdc..6a24851fd80d 100644 --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml @@ -63,7 +63,8 @@ properties: ...
375a4a81968cc8bb56685c99bf1153bc70eb3b29
Analyze and fix the following issue in the Linux kernel code: thermal/of: Fix trailing whitespace and repeated word
Problem Details: Correct a trailing whitespace error on line 101 and remove a duplicated "which" in the kernel-doc comment for thermal_of_zone_register. Signed-off-by: Mayur Kumar <kmayur809@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20260511161854.193573-1-kmay...
```diff diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 99085c806a1f..75fb7663c507 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -98,7 +98,7 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n int ret, count; *ntrips ...
4bb840492cedf89d5bed72ede6e0f8e848141977
Analyze and fix the following issue in the Linux kernel code: thermal/drivers/qcom: Fix typo in comment
Problem Details: Fix a typo in the struct tsens_irq_data comment. Replace "uppper" with "upper". Signed-off-by: Jinseok Kim <always.starving0@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Acked-by: Amit Kucheria <amitk@kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>...
```diff diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index a2422ebee816..5e19c7588e03 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -27,7 +27,7 @@ * @up_viol: upper threshold violated * @up_thresh: upper threshold temperature value * @up_ir...
18d65de8157c93666b2d42f1d46330ee4cb030b7
Analyze and fix the following issue in the Linux kernel code: thermal/drivers/amlogic: Add support for secure monitor calibration readout
Problem Details: Some SoCs (e.g. T7) expose thermal calibration data through the secure monitor rather than a directly accessible eFuse register. Add a use_sm flag to amlogic_thermal_data to select this path, and retrieve the firmware handle and tsensor_id from the "amlogic,secure-monitor" DT phandle with one fixed arg...
```diff diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index 5448d772db12..a0b530624b60 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -25,6 +25,7 @@ #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/thermal.h> ...
5f1e4f65d3002a814c690434f1dd37facc1df6ca
Analyze and fix the following issue in the Linux kernel code: thermal/drivers/amlogic: Add missing dependency on MESON_SM
Problem Details: The amlogic thermal driver calls meson_sm_get() and meson_sm_get_thermal_calib() which are exported by the meson_sm driver. Without CONFIG_MESON_SM enabled, the build fails with undefined references to these symbols. Add a proper Kconfig dependency on MESON_SM instead of relying on stub functions, whi...
```diff diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index b10080d61860..40a376cf9936 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -436,6 +436,7 @@ config AMLOGIC_THERMAL tristate "Amlogic Thermal Support" default ARCH_MESON depends on OF && ARCH_MESON + depends on MESON...
560000d619ef162568746ce287f0c725e24ea967
Analyze and fix the following issue in the Linux kernel code: dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments
Problem Details: In dma_direct_map_sg(), the case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE incorrectly used 'break' instead of falling through to MAP_NONE. As a result, segments traversing the host bridge skipped the required dma_direct_map_phys() call entirely, leaving sg->dma_address uninitialized and leading to DMA failures....
```diff diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 583c5922bca2..4391b797d4db 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -476,7 +476,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents, * must be mapped with CPU physical address and not PCI * ...
5e50d4b8ae3ea622122d3c6a38d7f6fe68dfddca
Analyze and fix the following issue in the Linux kernel code: batman-adv: prevent ELP transmission interval underflow
Problem Details: batadv_v_elp_start_timer() enqeues a delayed work. The time when it starts is randomly chosen between (elp_interval - BATADV_JITTER) and (elp_interval + BATADV_JITTER). The configured elp_interval must therefore be larger or equal to BATADV_JITTER to avoid that it causes an underflow of the unsigned in...
```diff diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index e5463003a3bd..1ba206e40273 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -919,9 +919,15 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb, #ifdef CONFIG_BATMAN_ADV_BATMAN_V if (info->attrs[BATADV_ATTR...
98b0fb191c878a64cbaebfe231d96d57576acf8c
Analyze and fix the following issue in the Linux kernel code: batman-adv: bla: annotate lasttime access with READ/WRITE_ONCE
Problem Details: The lasttime field for claim, backbone_gw, and loopdetect tracks the jiffies value of the most recent activity and is used to detect timeouts. These accesses are not consistently protected by a lock, so READ_ONCE/WRITE_ONCE must be used to prevent data races caused by compiler optimizations. Cc: stabl...
```diff diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 87d6b11161e4..0461f11227d0 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -513,7 +513,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *or...
15ccbf685222274f5add1387af58c2a41a95f81e
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: add only finished tp_vars to lists
Problem Details: When the receiver variables (aka "session") are initialized, then they are added to the list of sessions before the timer is set up. A RCU protected reader could therefore find the entry and run mod_setup before batadv_tp_init_recv() finished the timer initialization. The same is true for batadv_tp_st...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 3d3d06c88e1c..5498cdc972e9 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1096,21 +1096,21 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst, tp_vars->prerandom_offset = 0; spin_lock_init(&...
f54c85ed42a1b27a516cf2a4728f5a612b799e07
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: handle seqno wrap-around for fast recovery detection
Problem Details: The recover variable and the last_sent sequence number are initialized on purpose as a really high value which will wrap-around after the first 2000 bytes. The fast recovery precondition must therefore not use simple integer comparisons but use helpers which are aware of the sequence number wrap-around...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index ae6acbc60c8e..3d3d06c88e1c 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -733,7 +733,7 @@ static void batadv_tp_recv_ack(struct batadv_priv *bat_priv, if (atomic_read(&tp_vars->dup_acks) != 3) goto out; ...
2b0d08f08ed3b2174f05c43089ec65f3543a025b
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: fix fast recovery precondition
Problem Details: The fast recovery precondition checks if the recover (initialized to BATADV_TP_FIRST_SEQ) is bigger than the received ack. But since recover is only updated when this check is successful, it will never enter the fast recovery mode. According to RFC6582 Section 3.2 step 2, the check should actually be ...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 1655f181c929..ae6acbc60c8e 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -733,7 +733,7 @@ static void batadv_tp_recv_ack(struct batadv_priv *bat_priv, if (atomic_read(&tp_vars->dup_acks) != 3) goto out; ...
33ccd52f3cc9ed46ce395199f89aa3234dc83314
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: avoid divide-by-zero for dec_cwnd
Problem Details: The cwnd is always MSS <= cwnd <= 0x20000000. But the calculation in batadv_tp_update_cwnd() assumes unsigned 32 bit arithmetics. ((mss * 8) ** 2) / (cwnd * 8) In case cwnd is actually 0x20000000, it will be shifted by 3 bit to the left end up at 0x100000000 or U32_MAX + 1. It will therefore wrap...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 9ecbc6023cfc..1655f181c929 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -154,9 +154,12 @@ static void batadv_tp_update_cwnd(struct batadv_tp_vars *tp_vars, u32 mss) return; } + /* prevent overflow in (ms...
765947b81fb54b6ebb0bc1cfe55c0fa399e002b8
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: avoid window underflow
Problem Details: In batadv_tp_avail(), win_left is calculated with 32-bit unsigned arithmetic: win_left = win_limit - tp_vars->last_sent; During Fast Recovery, cwnd is inflated and last_sent advances rapidly. When Fast Recovery ends, cwnd drops abruptly back to ss_threshold. If the newly shrunk win_limit is less than ...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index beabc264a4f1..9ecbc6023cfc 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -817,10 +817,15 @@ out: static bool batadv_tp_avail(struct batadv_tp_vars *tp_vars, size_t payload_len) { + u32 last_sent = READ...
febfb1b86224489535312296ecfa3d4bf467f339
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: initialize dec_cwnd explicitly
Problem Details: When batadv_tp_update_cwnd() is called, dec_cwnd is increased. But dec_cwnd is only initialixed (to 0) when a duplicate Ack was received or when cwnd is below the ss_threshold. Just initialize the cwnd during the initialization to avoid any potential access of uninitialized data. Cc: stable@kernel.or...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 8d7308327a9b..beabc264a4f1 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1055,6 +1055,8 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst, * mesh_interface, hence its MTU */ tp_vars->c...
b2b68b32a715e0328662801576974aa37b942b00
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: initialize dup_acks explicitly
Problem Details: When an ack with a sequence number equal to the last_acked is received, the dup_acks counter is increased to decide whether fast retransmit should be performed. Only when the sequence numbers are not equal, the dup_acks is set to the initial value (0). But if the initial packet would have the sequence...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 0e39ea33e5f2..8d7308327a9b 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1045,6 +1045,7 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst, tp_vars->icmp_uid = icmp_uid; tp_vars->last_sen...
5aa8651527ea0b610e7a09fb3b8204c1398b9525
Analyze and fix the following issue in the Linux kernel code: batman-adv: tp_meter: keep unacked list in ascending ordered
Problem Details: When batadv_tp_handle_out_of_order inserts a new entry in the list of unacked (out of order) packets, it searches from the entry with the newest sequence number towards oldest sequence number. If an entry is found which is older than the newly entry, the new entry has to be added after the found one to...
```diff diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index aefe757277b2..0e39ea33e5f2 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1325,7 +1325,7 @@ static bool batadv_tp_handle_out_of_order(struct batadv_tp_vars *tp_vars, * one is attached _after_ it. In this way...
f723ccaff2fb72b71ae8a9fd283f0dee4d9ae7a3
Analyze and fix the following issue in the Linux kernel code: ipv6: anycast: insert aca into global hash under idev->lock
Problem Details: syzbot reported a splat [1]: a slab-use-after-free in ipv6_chk_acast_addr(), which walks the global inet6_acaddr_lst[] hash under RCU and dereferences a struct ifacaddr6 that has already been freed while still linked in the hash, so a later reader walks into a dangling node. In __ipv6_dev_ac_inc() the...
```diff diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 67a42e01dfc3..be6dac8a8566 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c @@ -243,16 +243,16 @@ static void ipv6_add_acaddr_hash(struct net *net, struct ifacaddr6 *aca) { unsigned int hash = inet6_acaddr_hash(net, &aca->aca_addr); - spin_...
dfcc2ff12925d99e858eaf539eaa4aaaf81fe2a6
Analyze and fix the following issue in the Linux kernel code: selftests/net: bind_bhash: fix memory leak in bind_socket
Problem Details: The getaddrinfo() call in bind_socket() dynamically allocates memory for the result linked list that must be freed with freeaddrinfo(). However, none of the code paths after a successful getaddrinfo() call free this memory, causing a leak in every invocation of bind_socket(). Signed-off-by: longlong y...
```diff diff --git a/tools/testing/selftests/net/bind_bhash.c b/tools/testing/selftests/net/bind_bhash.c index da04b0b19b73..2bd100777448 100644 --- a/tools/testing/selftests/net/bind_bhash.c +++ b/tools/testing/selftests/net/bind_bhash.c @@ -52,18 +52,19 @@ static int bind_socket(int opt, const char *addr) err = se...
e23d7c8c1d4ba435c457d7ffb2669175ec819b07
Analyze and fix the following issue in the Linux kernel code: dpaa2-switch: fix handling of NAPI on the remove path
Problem Details: All the NAPI instances for a DPSW device are attached to the first switch port's net_device but shared by all ports. The NAPI instances get disabled only once the last port goes down. This causes an issue on the .remove() path where each port is unregistered and freed one at a time, causing the NAPI i...
```diff diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 505ccaa93ee4..a0bf5b50aae5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -3304,7 +3304,6 @@ static void dpa...
9111f02861175854bcbd1d7ca4fff9d2b48bac62
Analyze and fix the following issue in the Linux kernel code: dpaa2-switch: support VLAN flag changes on existing VIDs
Problem Details: The switchdev core notifies the driver on VLAN flag changes on existing VIDs through the changed field of the switchdev_obj_port_vlan structure. Without this patch, the driver was erroring out from the start if the same VID was inserted twice, from its perspective, even though the second call was actua...
```diff diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 4022635171b5..505ccaa93ee4 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -298,49 +298,68 @@ set_tci_error: ...
74c1c9f5c0c30bbd0c2cf87b6e3507e7ea46c13d
Analyze and fix the following issue in the Linux kernel code: dpaa2-switch: fix the error path in dpaa2_switch_rx()
Problem Details: In case of an error in dpaa2_switch_rx(), the dpaa2_switch_free_fd() function is called in order to free the FD. This is incorrect since the dpaa2_switch_free_fd() is intended to be used on Tx frame descriptors, meaning that it expects in the software annotation area of the FD data to find a valid skb ...
```diff diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 782fef26b78e..53a32b21b959 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -2429,18 +2429,13 @@ static int dp...
efc1d92eacf03afa6f4d53bf7120e059b6f961f2
Analyze and fix the following issue in the Linux kernel code: dpaa2-switch: rework FDB management on the bridge leave path
Problem Details: On bridge leave, the dpaa2_switch_port_set_fdb() function always allocates a new FDB for the port which is becoming standalone. In case no FDB is found, then the port leaving a bridge will continue to use the current one. The above logic does not cover the case in which there are multiple bridges whic...
```diff diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c index 52c1cb9cb7e0..782fef26b78e 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c @@ -54,27 +54,44 @@ dpaa2_switch_filt...
a7e658907686528fe06a11828b04a3e42df9ef18
Analyze and fix the following issue in the Linux kernel code: riscv: dts: sophgo: sg2042: use hex for CPU unit address
Problem Details: Previous the CPU unit address cpu of sg2042 use decimal, it is not following the general convention for unit addresses of the OF. Convent the unit address to hex to resolve this problem. The introduces a small change for the CPU node name, but it should affect nothing since there is no direct full-pat...
```diff diff --git a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi index 509488eee432..fd8906b313d2 100644 --- a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi +++ b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi @@ -263,7 +263,7 @@ "zifencei", "zihpm", "zfh", ...
207cbc477406a72952e27ace2eadbae55164f129
Analyze and fix the following issue in the Linux kernel code: riscv: dts: sophgo: sg2044: use hex for CPU unit address
Problem Details: Previous the CPU unit address cpu of sg2044 use decimal, it is not following the general convention for unit addresses of the OF. Convent the unit address to hex to resolve this problem. The introduces a small change for the CPU node name, but it should nothing since there is no direct full-path refer...
```diff diff --git a/arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi b/arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi index 3135409c2149..f66a382c95bd 100644 --- a/arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi +++ b/arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi @@ -14,7 +14,7 @@ cpu0: cpu@0 { compatible = "thead,c920", "...
a48bd961fb203a7ce68f8110fc53a85f90e24b33
Analyze and fix the following issue in the Linux kernel code: kbuild: Remove unnecessary 'T' modifier in cmd_ar_builtin_fixup
Problem Details: In cmd_ar_builtin_fixup, the 'T' modifier was added to '$(AR) mPi' to work around a bug in llvm-ar that caused thin archives to be silently converted to full archives [1]. Since commit 20c098928356 ("kbuild: Bump minimum version of LLVM for building the kernel to 15.0.0"), all supported versions of llv...
```diff diff --git a/scripts/Makefile.vmlinux_a b/scripts/Makefile.vmlinux_a index bd141b893748..395e29998d7d 100644 --- a/scripts/Makefile.vmlinux_a +++ b/scripts/Makefile.vmlinux_a @@ -10,12 +10,11 @@ include $(srctree)/scripts/Makefile.lib # Link of built-in-fixup.a # ----------------------------------------------...
3f1eccd37282de91efd0575ee8e212af4bde39b1
Analyze and fix the following issue in the Linux kernel code: n64cart: use strscpy in n64cart_probe
Problem Details: strcpy() has been deprecated [1] because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. While the current code works correctly, replace strcpy() with the safer strscpy() to follow secure coding best practices. [1] https://www.kernel.org/doc/html/latest/pr...
```diff diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c index b9fdeff31caf..328da73b6f2c 100644 --- a/drivers/block/n64cart.c +++ b/drivers/block/n64cart.c @@ -12,6 +12,7 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/string.h> enum { PI_D...
12e4d4bb6e5a4845f0c22e5d8820fdc6244653a4
Analyze and fix the following issue in the Linux kernel code: Docs/{ABI,admin-guide}/damon: fix various typoes
Problem Details: ``damon_target_idx`` was wrongly written as ``target_idx`` in the docs. Fix it all over the place, as well as the wrong directory count, grammar, etc. Link: https://lore.kernel.org/20260520012104.93602-4-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Zenghui Yu <zenghui.yu@...
```diff diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentation/ABI/testing/sysfs-kernel-mm-damon index ee29d4e204ff..b73e6bc28ea5 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -452,7 +452,7 @@ Description: If 'hugepage_size' i...
de5480aeffc59d0792855c59c98624038ce67b67
Analyze and fix the following issue in the Linux kernel code: Docs/mm/damon/design: fix three typos
Problem Details: L140: "unsinged" -> "unsigned" L371: "sampleing" -> "sampling" L387: "multipled" -> "multiplied" Link: https://lore.kernel.org/20260520012104.93602-3-sj@kernel.org Signed-off-by: Sakurai Shun <ssh1326@icloud.com> Signed-off-by: SeongJae Park <sj@kernel.org> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org...
```diff diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index a24f9f00d183..2da7ca0d3d17 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -147,7 +147,7 @@ as Idle page tracking does. Address Unit ------------ -DAMON core layer uses ``unsing...
e186709b0a2d5a05c3cb38e46d13b399f5f5d3f9
Analyze and fix the following issue in the Linux kernel code: mm/damon/core: clarify next_intervals_tune_sis update path
Problem Details: Patch series "mm/damon: documentation and comment fixes". This patch (of 3): damon_set_attrs() updates next_aggregation_sis and next_ops_update_sis for online attrs updates, but it does not update next_intervals_tune_sis there. This can look like a missing update when reading damon_set_attrs() alon...
```diff diff --git a/mm/damon/core.c b/mm/damon/core.c index 4e223857a0f9..68b3b4bbc8fc 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -909,6 +909,9 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs) attrs->aggr_interval / sample_interval; ctx->next_ops_update_sis = ctx->passed_sample_...
c33afe6f972d7bfada751c9ee83d9875ea38d6dc
Analyze and fix the following issue in the Linux kernel code: Documentation/admin-guide/mm: fix typos in transhuge.rst
Problem Details: Fix these two typos: 1. approporiately -> appropriately 2. presure -> pressure Link: https://lore.kernel.org/20260520051751.74396-1-leon.hwang@linux.dev Signed-off-by: Leon Hwang <leon.hwang@linux.dev> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: David Hildenbrand (Arm) <david@k...
```diff diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index 5fbc3d89bb07..76f4eb14e262 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -57,7 +57,7 @@ prominent because the size of each page isn't as huge a...
a10848d98ec9c5372a979d7aa91a8b8fe50fd8f8
Analyze and fix the following issue in the Linux kernel code: mm/memory-failure: use zone_pcp_disable() for poison handling
Problem Details: __page_handle_poison() used drain_all_pages() instead of zone_pcp_disable() because dissolve_free_hugetlb_folio() could restore HVO vmemmap pages and decrement hugetlb_optimize_vmemmap_key. That static key update took cpu_hotplug_lock through static_key_slow_dec(), while zone_pcp_disable() holds pcp_b...
```diff diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 1b8d0bade04a..51508a55c405 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -172,23 +172,11 @@ static int __page_handle_poison(struct page *page) { int ret; - /* - * zone_pcp_disable() can't be used here. It will - * hold pcp_batch...
a2b8d7827f48ee54a686cb80e4a1d0ff954ec42a
Analyze and fix the following issue in the Linux kernel code: drivers/base/memory: set mem->altmap after successful device registration
Problem Details: If __add_memory_block() fails at xa_store() (under memory pressure for example), device_unregister() is called, which eventually triggers memory_block_release() with mem->altmap still set, causing a WARN_ON(mem->altmap). This was triggered by modifying virtio-mem driver. Fix this by delaying the assi...
```diff diff --git a/drivers/base/memory.c b/drivers/base/memory.c index d31a421f7483..b318344426fa 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -797,7 +797,6 @@ static int add_memory_block(unsigned long block_id, int nid, unsigned long state mem->start_section_nr = block_id * sections_per_block;...
6fa411adff39e4955f11aa3e854a876680444d2a
Analyze and fix the following issue in the Linux kernel code: lib/test_hmm: fix error path in dmirror_devmem_fault()
Problem Details: Handle migrate_vma_setup() failure via goto err for unified cleanup. Link: https://lore.kernel.org/20260515070312.130435-1-liuqiangneo@163.com Signed-off-by: Qiang Liu <liuqiang@kylinos.cn> Reviewed-by: Alistair Popple <apopple@nvidia.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@k...
```diff diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 38996c4baa40..63bf77dee987 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1679,8 +1679,14 @@ static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf) if (order) args.flags |= MIGRATE_VMA_SELECT_COMPOUND; - if (migrate_vma_setup(&args)) - retur...
0c946c54a7013742157b8f79b241140b0c670764
Analyze and fix the following issue in the Linux kernel code: docs/mm: fix typo in process_addrs.rst
Problem Details: Replace "presense" with "presence" Link: https://lore.kernel.org/20260517103640.45444-1-ssh1326@icloud.com Signed-off-by: Sakurai Shun <ssh1326@icloud.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
```diff diff --git a/Documentation/mm/process_addrs.rst b/Documentation/mm/process_addrs.rst index 851680ead45f..042d64d72421 100644 --- a/Documentation/mm/process_addrs.rst +++ b/Documentation/mm/process_addrs.rst @@ -775,7 +775,7 @@ lock, releasing or downgrading the mmap write lock also releases the VMA write lock ...
d9ceded101a142cd56f1e88fc7e893560ee59f4d
Analyze and fix the following issue in the Linux kernel code: mm, swap: merge zeromap into swap table
Problem Details: By allocating one additional bit in the swap table entry's flags field alongside the count, we can store the zeromap inline For 64 bit systems, zeromap will store in the swap table, avoiding zeromap allocation. It reduces the allocated memory. That is the happy path. For certain 32-bit archs, there...
```diff diff --git a/include/linux/swap.h b/include/linux/swap.h index 200e7c345f26..8c43bc3055c9 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -252,7 +252,6 @@ struct swap_info_struct { struct plist_node list; /* entry in swap_active_head */ signed char type; /* strange name for an index */ u...
b197d41462c2076bc88c79fead7f400e48881c19
Analyze and fix the following issue in the Linux kernel code: mm/memcg, swap: store cgroup id in cluster table directly
Problem Details: Drop the usage of the swap_cgroup_ctrl, and use the dynamic cluster table instead. The per-cluster memcg table is 1024 / 512 bytes on most archs, and does not need RCU protection: the cgroup data is only read and written under the cluster lock. That keeps things simple, lets the allocation use plain ...
```diff diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index a013f37f24aa..8f2662db166b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -29,6 +29,7 @@ struct obj_cgroup; struct page; struct mm_struct; struct kmem_cache; +struct swap_cluster_info; /* Cgroup-specifi...
63b02a9409cb5180398491b093e48bcb5315f5fb
Analyze and fix the following issue in the Linux kernel code: mm: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host
Problem Details: lookup_swap_cgroup_id() passes swap_cgroup_ctrl[type].map to __swap_cgroup_id_lookup() without checking that the type was ever registered via swap_cgroup_swapon(). On a swapless host every ctrl->map is NULL, so __swap_cgroup_id_lookup() dereferences NULL + a scaled swp_offset(). Since commit bea67dcc...
```diff diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c index de779fed8c21..95c38e54dd58 100644 --- a/mm/swap_cgroup.c +++ b/mm/swap_cgroup.c @@ -124,6 +124,8 @@ unsigned short lookup_swap_cgroup_id(swp_entry_t ent) return 0; ctrl = &swap_cgroup_ctrl[swp_type(ent)]; + if (unlikely(!ctrl->map)) + return 0; re...
3687c0fd67249cb971990b382a47f02f19ed9f67
Analyze and fix the following issue in the Linux kernel code: mm: rejig pageblock mask definitions
Problem Details: - Add a PAGEBLOCK_ prefix to the names to avoid polluting the "global namespace" too much. - This new prefix makes MIGRATETYPE_AND_ISO_MASK look pretty long. Well, that global mask only exists for quite a specific purpose, and is quite a weird thing to have a name for anyway. So drop it and take...
```diff diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index e046278a01fa..9a6c3ea17684 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -36,12 +36,12 @@ enum pageblock_bits { #define NR_PAGEBLOCK_BITS (roundup_pow_of_two(__NR_PAGEBLOCK_BITS)) -#...
88e09fffeef5825931e6374b9e88d4b1a1d5f6f8
Analyze and fix the following issue in the Linux kernel code: mm/filemap: fix page_cache_prev_miss() when no hole is found
Problem Details: page_cache_prev_miss() is documented to return a value outside the searched range when no gap is found. However, the no-gap-found path returns xas.xa_index, which after a successful loop is the first index in the range. As such, that index is misreported as a gap. The sole caller, page_cache_sync_ra...
```diff diff --git a/mm/filemap.c b/mm/filemap.c index ab34cab2416a..4263d9775998 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1808,9 +1808,8 @@ pgoff_t page_cache_next_miss(struct address_space *mapping, pgoff_t index, unsigned long max_scan) { XA_STATE(xas, &mapping->i_pages, index); - unsigned long n...
3fb355431eb864a95be3b832605d0575f43d6971
Analyze and fix the following issue in the Linux kernel code: tools/mm/page-types: fix kpageflags option argument in getopt_long
Problem Details: The --kpageflags option requires an argument to specify the kpageflags file path, but has_arg was set to 0 (no_argument) in the long options table. Change it to 1 (required_argument) so getopt_long correctly parses the argument. Link: https://lore.kernel.org/20260513022120.58033-4-ye.liu@linux.dev Si...
```diff diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index 66f429f2b698..7fc5a8be5997 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -1261,7 +1261,7 @@ static const struct option opts[] = { { "no-summary", 0, NULL, 'N' }, { "hwpoison" , 0, NULL, 'X' }, { "unpoison" , 0, NULL, 'x...
e696ff06db374c1adb877d20e56085abe1d109a3
Analyze and fix the following issue in the Linux kernel code: tools/mm/page-types: fix ternary operator precedence in sigbus handler
Problem Details: The ternary operator (?:) has lower precedence than addition (+), so the expression `off + sigbus_addr ? sigbus_addr - ptr : 0` was parsed as `(off + sigbus_addr) ? (sigbus_addr - ptr) : 0` rather than the intended `off + (sigbus_addr ? sigbus_addr - ptr : 0)`. Add explicit parentheses to ensure th...
```diff diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index 6594245217a8..66f429f2b698 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -1000,7 +1000,7 @@ static void walk_file_range(const char *name, int fd, fatal("madvise failed: %s", name); if (sigsetjmp(sigbus_jmp, 1)) { - e...
96f9fb92126a4fb5b24a54964eaef8f82cc2ab7f
Analyze and fix the following issue in the Linux kernel code: tools/mm/page-types: fix typo in madvise() error message
Problem Details: Patch series "tools/mm/page-types: Fix misc bugs". This series fixes three issues in tools/mm/page-types.c: 1. Fix two typos in madvise() error messages ("madvice" -> "madvise") 2. Fix operator precedence bug in the sigbus handler where the ternary operator binds looser than addition, producing in...
```diff diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index d7e5e8902af8..6594245217a8 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -997,7 +997,7 @@ static void walk_file_range(const char *name, int fd, /* turn off readahead */ if (madvise(ptr, len, MADV_RANDOM)) - fatal("mad...
0496a59745b0723ea74274db16fd5c8b1379b9a9
Analyze and fix the following issue in the Linux kernel code: userfaultfd: ensure mremap_userfaultfd_fail() releases mmap_changing
Problem Details: Sashiko says: mremap_userfaultfd_prep() increments ctx->mmap_changing to stall concurrent operations, but mremap_userfaultfd_fail() does not decrement it before dropping the context reference. If an mremap operation fails, ctx->mmap_changing remains elevated. This will causes subsequent userfau...
```diff diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 4b53dc4a3266..390e4b7d9cb9 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -786,6 +786,8 @@ void mremap_userfaultfd_fail(struct vm_userfaultfd_ctx *vm_ctx) if (!ctx) return; + atomic_dec(&ctx->mmap_changing); + VM_WARN_ON_ONCE(atomic_read(&ct...
59f19bf6f119eecfa16355186b593abba8eb5198
Analyze and fix the following issue in the Linux kernel code: lib/test_hmm: use kvfree() to free kvcalloc() allocations
Problem Details: Coccinelle scripts/coccinelle/api/kfree_mismatch.cocci reports the following warnings: lib/test_hmm.c:1256:15-16: WARNING kvmalloc is used to allocate this memory at line 1191 lib/test_hmm.c:1257:15-16: WARNING kvmalloc is used to allocate this memory at line 1196 Fix this by replacing kfree() wi...
```diff diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 213504915737..38996c4baa40 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1253,8 +1253,8 @@ out: mmap_read_unlock(mm); mmput(mm); free_mem: - kfree(src_pfns); - kfree(dst_pfns); + kvfree(src_pfns); + kvfree(dst_pfns); return ret; } ```
395085eacdfa37a64b37ae16a6dc467fb8670faf
Analyze and fix the following issue in the Linux kernel code: mm, swap: avoid leaving unused extend table after alloc race
Problem Details: Allocating an extend table requires dropping the ci lock first. While the lock is dropped, a concurrent put can decrease the slot's swap count to a value that is no longer maxed out, so the extend table is no longer required. The current allocation path still attach the new extend table to the cluste...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index 74a1e324449d..ee515a6fbccd 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1443,8 +1443,10 @@ start_over: } static int swap_extend_table_alloc(struct swap_info_struct *si, - struct swap_cluster_info *ci, gfp_t gfp) + struct swap_cluster_info *c...
80eacd489a50ab2a560bc233b26b94ad9df68410
Analyze and fix the following issue in the Linux kernel code: mm/mmu_notifier: fix a begin vs. start typo in the invalidate range comment
Problem Details: Fix a goof in the block comment for invalidate_range_{start,end}() where start() is incorrectly referred to as begin(). No functional change intended. [seanjc@google.com: split to separate patch, write changelog] Link: https://lore.kernel.org/20260513163546.1176742-1-seanjc@google.com Signed-off-by: ...
```diff diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 69c304b467df..a11a44eef521 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -134,8 +134,8 @@ struct mmu_notifier_ops { * Invalidation of multiple concurrent ranges may be * optionally permitted by...
13f263b60fee0c463f3a9a6c728cd010d8802d69
Analyze and fix the following issue in the Linux kernel code: selftests/mm: ksm-functional-tests: fix partial write handling
Problem Details: Update write() checks to properly detect and handle partial writes. Previously, the write() calls used <= 0 to detect failure. This condition is never true for partial writes (ret > 0 but ret < len), so partial writes were silently treated as success. Fix this by verifying that write() returns the f...
```diff diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c index 8d874c4754f3..31c06c72203f 100644 --- a/tools/testing/selftests/mm/ksm_functional_tests.c +++ b/tools/testing/selftests/mm/ksm_functional_tests.c @@ -498,6 +498,7 @@ static void test_prctl_fo...
8e0c2085c978ed6d9764d79fc785920360096f21
Analyze and fix the following issue in the Linux kernel code: lib/test_meminit: use && for bools
Problem Details: As pointed out by Dan Carpenter, test_kmemcache() was using a bitwise AND on two bools instead of a boolean AND. Fix this for the sake of code cleanliness. Link: https://lore.kernel.org/20260504100637.1535762-1-glider@google.com Fixes: 5015a300a522 ("lib: introduce test_meminit module") Signed-off-by...
```diff diff --git a/lib/test_meminit.c b/lib/test_meminit.c index 6298f66c964b..d028a6552cd6 100644 --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -387,7 +387,7 @@ static int __init test_kmemcache(int *total_failures) ctor = flags & 1; rcu = flags & 2; zero = flags & 4; - if (ctor & zero) + if (c...
62b21c6f1d88c66a200c2c54b704e503e2e5a60f
Analyze and fix the following issue in the Linux kernel code: mm/shrinker: avoid out-of-bounds read in set_shrinker_bit()
Problem Details: set_shrinker_bit() reads info->unit[shrinker_id_to_index(shrinker_id)] before checking shrinker_id against info->map_nr_max, so an id past the currently visible map_nr_max reads past the unit[] array before the WARN_ON_ONCE() catches it. Determined from code inspection. Move the load into the bounded...
```diff diff --git a/mm/shrinker.c b/mm/shrinker.c index 76b3f750cf65..49256f81199f 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -197,12 +197,13 @@ void set_shrinker_bit(struct mem_cgroup *memcg, int nid, int shrinker_id) { if (shrinker_id >= 0 && memcg && !mem_cgroup_is_root(memcg)) { struct shrinker_info *...
a9920428f19481d1227992ecbf1c73efd5b93001
Analyze and fix the following issue in the Linux kernel code: mm/khugepaged: fix inconsistent MMF_VM_HUGEPAGE flag due to allocation failure order
Problem Details: __khugepaged_enter() sets MMF_VM_HUGEPAGE before allocating the corresponding mm_slot. If mm_slot_alloc() fails, the function returns with the flag set but without inserting the mm into the khugepaged tracking structures, leaving the mm in an inconsistent state where future registration attempts are s...
```diff diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 28a843f30b32..a4b97ec8ce56 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -437,13 +437,16 @@ void __khugepaged_enter(struct mm_struct *mm) /* __khugepaged_exit() must not run from under us */ VM_BUG_ON_MM(collapse_test_exit(mm), mm); - if (unlike...
da7bfa6a39fd4d72e03b6bc5f01148ac22fd216e
Analyze and fix the following issue in the Linux kernel code: mm/damon/lru_sort: validate min_region_size to be power of 2
Problem Details: Patch series "mm/damon: validate min_region_size to be power of 2", v5. Problem ======= When a user sets an invalid 'addr_unit' (e.g., 3) via DAMON_LRU_SORT or DAMON_RECLAIM, 'min_region_sz' becomes a non-power-of-2 value. While damon_commit_ctx() correctly detects this and returns -EINVAL, it sets th...
```diff diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 2eb559d913b6..eca88ed941b3 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -286,6 +286,11 @@ static int damon_lru_sort_apply_parameters(void) param_ctx->addr_unit = addr_unit; param_ctx->min_region_sz = max(DAMON_MIN_REGION_SZ / addr...
d200cfc81c069e2192c6cc082c38d1c8b0427989
Analyze and fix the following issue in the Linux kernel code: mm/damon/sysfs-schemes: fix double increment of nr_regions
Problem Details: damos_sysfs_populate_region_dir() increments sysfs_regions->nr_regions twice when adding a new region: once explicitly before kobject_init_and_add(), and once again through the post-increment used for the kobject name. As a result, nr_regions no longer matches the actual number of live regions, and re...
```diff diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index ab2153fff9a8..0d3021db0b99 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -2995,7 +2995,7 @@ void damos_sysfs_populate_region_dir(struct damon_sysfs_schemes *sysfs_schemes, if (kobject_init_and_add(&region->kobj, ...
42791eddab096b67e368ff0c1f3e331b4b72971a
Analyze and fix the following issue in the Linux kernel code: sparc/mm: remove register_page_bootmem_info()
Problem Details: Patch series "mm: remove CONFIG_HAVE_BOOTMEM_INFO_NODE (Part 1)". We want to remove CONFIG_HAVE_BOOTMEM_INFO_NODE. As a first step, let's limit the remaining harm to x86 and core code, removing sparc, ppc and s390 leftovers, starting the stepwise removal by removing and simplifying some code. Once a...
```diff diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 367c269305e5..3b679b1d1d72 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -27,7 +27,6 @@ #include <linux/percpu.h> #include <linux/mmzone.h> #include <linux/gfp.h> -#include <linux/bootmem_info.h> #include <asm/hea...
2b117897d5c7c5ffdaca3ea40aa7658c54ae7cb8
Analyze and fix the following issue in the Linux kernel code: selftests/mm: fix mmap() return value check in run_migration_benchmark
Problem Details: mmap() returns MAP_FAILED on error, not NULL. The current check uses !buffer->ptr, which evaluates to false when mmap() fails (since MAP_FAILED is (void *)-1, not 0), so the error path is never taken. Link: https://lore.kernel.org/20260512101305.139509-1-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <...
```diff diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c index 77fb4c5d871b..7a4daadfb0c8 100644 --- a/tools/testing/selftests/mm/hmm-tests.c +++ b/tools/testing/selftests/mm/hmm-tests.c @@ -2738,7 +2738,7 @@ static inline int run_migration_benchmark(int fd, int use_thp, size...
cfa5274a5dc2a23b957da5dc806d2ac0c7a66af0
Analyze and fix the following issue in the Linux kernel code: net: dsa: sja1105: flower: reject cross-chip redirect
Problem Details: dsa_port_from_netdev() may return a valid port from a different switch chip. Programming another chip's port index into the local hardware causes redirection to the wrong port, or an out-of-bounds access if the index exceeds the local chip's port count. Apply a minimal fix that adds a check to catch t...
```diff diff --git a/drivers/net/dsa/sja1105/sja1105_flower.c b/drivers/net/dsa/sja1105/sja1105_flower.c index fba926f85b47..7547999a113f 100644 --- a/drivers/net/dsa/sja1105/sja1105_flower.c +++ b/drivers/net/dsa/sja1105/sja1105_flower.c @@ -391,9 +391,9 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port, ...
02e545c4297a26dbbc41df81b831e7f605bcd306
Analyze and fix the following issue in the Linux kernel code: sched_ext: Don't warn on NULL cgrp_moving_from in scx_cgroup_move_task()
Problem Details: A WARN fires when systemd's user manager writes "+cpu +memory +pids" to its own subtree_control while a sched_ext scheduler is loaded: WARNING: at kernel/sched/ext.c:3227 scx_cgroup_move_task+0xa8/0xb0 scx_cgroup_move_task+0xa8/0xb0 sched_move_task+0x134/0x290 cpu_cgroup_attach+0x39/0x70 ...
```diff diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index c1762420cc35..8e88a25bc602 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -4402,11 +4402,13 @@ void scx_cgroup_move_task(struct task_struct *p) return; /* - * @p must have ops.cgroup_prep_move() called on it and thus - * cgrp_movin...
5eba3e48d78edd7551b992cb7ba687019b3a78da
Analyze and fix the following issue in the Linux kernel code: sctp: diag: reject stale associations in dump_one path
Problem Details: The SCTP exact sock_diag lookup can hold a transport reference, block on lock_sock(sk), and then resume after sctp_association_free() has marked the association dead and freed its bind address list. When that happens, inet_assoc_attr_size() and inet_diag_msg_sctpasoc_fill() can still dereference assoc...
```diff diff --git a/net/sctp/diag.c b/net/sctp/diag.c index 2afb376299fe..d758f5c3e06e 100644 --- a/net/sctp/diag.c +++ b/net/sctp/diag.c @@ -266,15 +266,15 @@ static int sctp_sock_dump_one(struct sctp_endpoint *ep, struct sctp_transport *t lock_sock(sk); - rep = nlmsg_new(inet_assoc_attr_size(sk, assoc), GFP_KE...
b455410146bf723c7ebcb49ecd5becc0d6611482
Analyze and fix the following issue in the Linux kernel code: net: fec: fix pinctrl default state restore order on resume
Problem Details: In fec_resume(), fec_enet_clk_enable() is called before pinctrl_pm_select_default_state() in the non-WoL path, inverting the ordering used in fec_suspend() which correctly switches to the sleep pinctrl state before disabling clocks. For PHYs with the PHY_RST_AFTER_CLK_EN flag (e.g. TI DP83848 or SMSC ...
```diff diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index f89aa94ce020..6ebde65d7f1b 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -5594,6 +5594,7 @@ static int fec_resume(struct device *dev) if (fep->r...
10400b9455e735601d94e7293db1c48a685547f0
Analyze and fix the following issue in the Linux kernel code: media: qcom: iris: Fix FPS calculation and VPP FW overhead
Problem Details: Use div_u64() instead of mult_fract as u64 operator division fails on 32 bit systems which don't link against libgcc. Fixes: 5c66647a5c3e ("media: iris: add FPS calculation and VPP FW overhead in frequency formula") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbui...
```diff diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/platform/qcom/iris/iris_vpu_common.c index 5a85568c5ee1..37dbfe433a08 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c @@ -444,7 +444,7 @@ u64 iris_vpu3x_vpu4x_...
8173d22b211f615015f7b35f48ab11a6dd78dc99
Analyze and fix the following issue in the Linux kernel code: net: lan743x: permit VLAN-tagged packets up to configured MTU
Problem Details: VLAN-tagged interfaces on lan743x devices were previously unreachable via SSH and failed to respond to large ping packets (e.g. "ping -s 1469" given MTU=1500). In these scenarios, "ethtool -S" reports non-zero "RX Oversize Frame Errors". According to Microchip AN2948, the MAC_RX FSE (VLAN field size en...
```diff diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index f3332417162e..ffac22883e49 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -1219,6 +1219,36 @@ static void lan743x_mac_set_address(st...
8545eda00fdf3d7e17933ce0f706d005b1bad42d
Analyze and fix the following issue in the Linux kernel code: arm64: dts: rockchip: Fix vcc_sdio regulator max voltage on Pinebook Pro
Problem Details: The vcc_sdio regulator supports 1.8V to 3.4V output range according to its datasheet. The current DT incorrectly limits the max voltage to 3.0V. This limit causes issues issues downstream with u-boot, which refuses to apply the out-of range value, and falls back to the minimum in that range: 1.8V. Thi...
```diff diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts index b5c05928142c..f21fcdc1b49a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts @@ -526,7 +526,7 @@ regulato...
20cf0fb715c41111469577e85e35d15f099473e0
Analyze and fix the following issue in the Linux kernel code: net: rds: clear i_sends on setup unwind
Problem Details: The RDS IB connection teardown path is written so it can run during partial startup and on repeated shutdown attempts. It uses NULL pointers to distinguish resources that are still owned from resources that have already been released. When rds_ib_setup_qp() fails after allocating i_sends but before al...
```diff diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index 0c64c504f79d..4001de0c4959 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -656,6 +656,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn) sends_out: vfree(ic->i_sends); + ic->i_sends = NULL; ack_dma_out: rds_dma_hdr_free(rds_ibdev->d...
74e144274af39935b0f410c0ee4d2b91c3730414
Analyze and fix the following issue in the Linux kernel code: futex/requeue: Prevent NULL pointer dereference in remove_waiter() on self-deadlock
Problem Details: When FUTEX_CMP_REQUEUE_PI requeues a non-top waiter that already owns the target PI futex, task_blocks_on_rt_mutex() returns -EDEADLK before setting waiter->task. The subsequent remove_waiter() in rt_mutex_start_proxy_lock() dereferences the NULL waiter->task, causing a kernel crash. Add a self-deadl...
```diff diff --git a/kernel/futex/requeue.c b/kernel/futex/requeue.c index b597cb3d17fc..1d99a84dc9ad 100644 --- a/kernel/futex/requeue.c +++ b/kernel/futex/requeue.c @@ -643,6 +643,12 @@ retry_private: continue; } + /* Self-deadlock: non-top waiter already owns the PI futex. */ + if (rt_mutex_owner(&pi_...
962c17dd287887aa87a6f30d64239d7e1e4e05fa
Analyze and fix the following issue in the Linux kernel code: net: airoha: Move {cpu,fwd}_tx_packets in airoha_gdm_dev struct
Problem Details: Since now multiple net_devices connected to different QDMA blocks can share the same GDM port, cpu_tx_packets and fwd_tx_packets fields can be overwritten with the value from a different QDMA block. In order to fix the issue move cpu_tx_packets and fwd_tx_packets fields from airoha_gdm_port struct to a...
```diff diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c index 4f77a0c22162..72c6f554508c 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c @@ -2315,19 +2315,17 @@ static int airoha_qdma_get_tx_ets_stats(struct net_device...
069626af6dfaa26b82119900f4aff1fec38d5983
Analyze and fix the following issue in the Linux kernel code: net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct
Problem Details: Since now multiple net_devices connected to different QDMA blocks can share the same GDM port, qos_sq_bmap field can be overwritten with the configuration obtained from a net_device connected to a different QDMA block. In order to fix the issue move qos_sq_bmap field from airoha_gdm_port struct to airo...
```diff diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c index c5d25f7640ac..4f77a0c22162 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c @@ -2602,30 +2602,40 @@ static int airoha_qdma_set_tx_rate_limit(struct net_devic...
5996b5ab8b37f32b62f8a25f27c9888b628fefb1
Analyze and fix the following issue in the Linux kernel code: doc/netlink: rt-link: fix binary attributes marked as strings
Problem Details: These link-attrs attributes were previously marked as strings: - wireless - struct iw_event - protinfo - a nest of ifla6-attrs or linkinfo-brport-attrs - cost, priority - unused Signed-off-by: Remy D. Farley <one-d-wide@protonmail.com> Link: https://patch.msgid.link/20260529121355.1564817-1-one-d-wid...
```diff diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml index 79c89f204415..a5c0297818c6 100644 --- a/Documentation/netlink/specs/rt-link.yaml +++ b/Documentation/netlink/specs/rt-link.yaml @@ -880,19 +880,21 @@ attribute-sets: struct: rtnl-link-stats - ...
163bea8010bdf785b6dadeab0cb199e94e1f99bd
Analyze and fix the following issue in the Linux kernel code: netdevsim: psp: use atomic64 for psp stats counters
Problem Details: The existing u64_stats_t-based psp counters had two preexisting api usage bugs: u64_stats_init() was never called on the syncp object, and the writer side of the u64_stats_update_begin()/end() api was not serialized. Switch the counters to atomic64_t instead. Atomics need no initialization and are inhe...
```diff diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index d909c4160ea1..4c9cc96dcec3 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -22,7 +22,6 @@ #include <linux/list.h> #include <linux/netdevice.h> #include <linux/ptp_mock.h> -#inclu...
abaef7e966fdc236ee57ea30c019365110d00f48
Analyze and fix the following issue in the Linux kernel code: netdevsim: psp: update rx stats on the peer netdevsim
Problem Details: nsim_do_psp() handles both tx and rx psp processing in the sending device's nsim_start_xmit() path. The existing code has a logical bug, where we erroneously increment rx_bytes and rx_packets on the sending devices stats, instead of the peer device. Additionally, compute psp_len after psp_dev_encapsul...
```diff diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c index c6000ebc6bc8..c6c1acaa99a3 100644 --- a/drivers/net/netdevsim/psp.c +++ b/drivers/net/netdevsim/psp.c @@ -22,6 +22,7 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns, struct psp_dev *peer_psd; struct psp_assoc *pas; struc...
5893cc75a19146b1365867dcf7f01ed420f702ed
Analyze and fix the following issue in the Linux kernel code: netdevsim: fib: fix use-after-free of FIB data via debugfs
Problem Details: Writing to the netdevsim debugfs file "netdevsim/netdevsimN/fib/nexthop_bucket_activity" enters nsim_nexthop_bucket_activity_write(), which looks up a nexthop in data->nexthop_ht under rtnl_lock(). If a network namespace teardown, devlink reload or device deletion runs concurrently, nsim_fib_destroy() ...
```diff diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index 1a42bdbfaa41..55bcdefadc9b 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -1562,14 +1562,11 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink, data->devlink = devlink; nsim_dev = devl...
3f7fbde4cdd4a25c199a60849897459a63907ca5
Analyze and fix the following issue in the Linux kernel code: vdso/datastore: Mark vdso_k_*_data pointers as __ro_after_init
Problem Details: These pointers are only modified once in vdso_setup_data_pages(), during the init phase. Make them read-only after that. Drop __refdata as that would conflict with __ro_after_init. Modpost does accept the reference from a __ro_after_init symbol to an __init one. Fixes: 05988dba1179 ("vdso/datastore: ...
```diff diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c index cf5d784a4a5a..17d37b82ebc6 100644 --- a/lib/vdso/datastore.c +++ b/lib/vdso/datastore.c @@ -11,21 +11,21 @@ static u8 vdso_initdata[VDSO_NR_PAGES * PAGE_SIZE] __aligned(PAGE_SIZE) __initdata = {}; #ifdef CONFIG_GENERIC_GETTIMEOFDAY -struct vdso_...
571d4242c466e558c9fd57a9b3d9a045b1f400d1
Analyze and fix the following issue in the Linux kernel code: rust/drm: Introduce DeviceContext
Problem Details: One of the tricky things about DRM bindings in Rust is the fact that initialization of a DRM device is a multi-step process. It's quite normal for a device driver to start making use of its DRM device for tasks like creating GEM objects before userspace registration happens. This is an issue in rust th...
```diff diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs index 4289df7de01c..33fe088dd3b9 100644 --- a/drivers/gpu/drm/nova/driver.rs +++ b/drivers/gpu/drm/nova/driver.rs @@ -23,7 +23,7 @@ pub(crate) struct Nova { } /// Convienence type alias for the DRM device type for this driver -pub(...
d4f198c13611257f7f29d3c614721d0ac5d362f5
Analyze and fix the following issue in the Linux kernel code: timers/migration: Deactivate per-capacity hierarchies under nohz_full
Problem Details: NOHZ_FULL CPUs global timers are guaranteed to be handled by the timekeeper CPU, which never stops its tick and therefore remains active in the hierarchy. But since the introduction of per-capacity hierarchies, this guarantee is broken because the timekeeper may not belong to the same hierarchy as all...
```diff diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 8032b0044f44..8ba53ad49173 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1464,8 +1464,24 @@ static long tmigr_trigger_active(void *unused) return 0; } -static struct tmigr_hierarchy *__tmig...
e4a70f5fbd43f55b474028a2cee3d78e4b443dd7
Analyze and fix the following issue in the Linux kernel code: timers/migration: Fix hotplug migrator selection target on asymetric capacity machines
Problem Details: When a top-level migrator is deactivated, either at CPU down hotplug time or when a CPU is domain isolated, a new migrator is elected among the available CPUs and woken up to take over the migration duty. However that election must happen at the scope of a given hierarchy and not globally, which the i...
```diff diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 25e3c563eb74..8032b0044f44 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1464,6 +1464,18 @@ static long tmigr_trigger_active(void *unused) return 0; } +static struct tmigr_hierarchy *__tmig...
7198e3927a14535475a24cce559f41f97e6c0b66
Analyze and fix the following issue in the Linux kernel code: sched/cputime: Handle idle irqtime gracefully
Problem Details: The dyntick-idle cputime accounting always assumes that interrupt time accounting is enabled and consequently stops elapsing the idle time during dyntick-idle interrupts. This doesn't mix up well with disabled interrupt time accounting because then idle interrupts become a cputime blind-spot. Also thi...
```diff diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 335d2c127763..94be22aa5cb6 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -47,7 +47,8 @@ static void irqtime_account_delta(struct irqtime *irqtime, u64 delta, u64_stats_update_begin(&irqtime->sync); cpustat[idx] += delta...
86db4084b4b5d1a074bcc66c108a4c9d266812d4
Analyze and fix the following issue in the Linux kernel code: tick/sched: Fix TOCTOU in nohz idle time fetch
Problem Details: When the nohz idle time is fetched, the current clock timestamp is taken outside the seqcount, which can result in a race as reported by Sashiko: get_cpu_sleep_time_us() tick_nohz_start_idle() ----------------------- --------------------- now = ktime_get() ...
```diff diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index cbbb87a0c6e7..171393367b5c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -797,15 +797,16 @@ static u64 get_cpu_sleep_time_us(struct tick_sched *ts, ktime_t *sleeptime, *last_update_time = ktime_to_us(now); do...
16e408e607a94b646fb14a2a98422c6877ae4b3c
Analyze and fix the following issue in the Linux kernel code: net: garp: fix unsigned integer underflow in garp_pdu_parse_attr
Problem Details: The receive-side GARP attribute parser computes dlen with reversed operands: dlen = sizeof(*ga) - ga->len; ga->len is the on-wire attribute length and includes the GARP attribute header. For normal attributes with data, ga->len is larger than sizeof(*ga), so the subtraction underflows in unsi...
```diff diff --git a/net/802/garp.c b/net/802/garp.c index 6f563b6797d9..c7a39f298ad6 100644 --- a/net/802/garp.c +++ b/net/802/garp.c @@ -453,7 +453,7 @@ static int garp_pdu_parse_attr(struct garp_applicant *app, struct sk_buff *skb, if (!pskb_may_pull(skb, ga->len)) return -1; skb_pull(skb, ga->len); - dlen = ...
ce4abda5e12622f33450159e76c8f56d28d7f03d
Analyze and fix the following issue in the Linux kernel code: time: Fix off-by-one in settimeofday() usec validation
Problem Details: The validation check uses '>' instead of '>=' when comparing tv_usec against USEC_PER_SEC, allowing the value 1000000 through. After conversion to nanoseconds (*= 1000), this produces tv_nsec == NSEC_PER_SEC, violating the timespec invariant that tv_nsec must be less than NSEC_PER_SEC. Use '>=' to rej...
```diff diff --git a/kernel/time/time.c b/kernel/time/time.c index 0d832317d576..771cef87ad3b 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -207,7 +207,7 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv, get_user(new_ts.tv_nsec, &tv->tv_usec)) return -EFAULT; - if (n...
c1ca14ca227e92101c7ae597213275b60f4212c6
Analyze and fix the following issue in the Linux kernel code: clockevents: Fix duplicate type specifier in stub function parameter
Problem Details: The stub for arch_inlined_clockevent_set_next_coupled() has 'u64 u64 cycles' in its parameter list. Since u64 is a typedef, the compiler parses the second 'u64' as the parameter name, making 'cycles' an unused token. Remove the duplicate so the parameter is correctly named. Fixes: 89f951a1e8ad ("clock...
```diff diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 5e22697b098d..0014d163f989 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -301,7 +301,7 @@ static int clockevents_program_min_delta(struct clock_event_device *dev) #include <asm/clock_inlined.h> #else static _...
c16c205aeb16e586f645750153064cf9275aafb2
Analyze and fix the following issue in the Linux kernel code: ACPI: button: Rework device verification during probe
Problem Details: Instead of manually comparing the primary ID of the device (retuned by _HID) with each of the device IDs supported by the driver, use acpi_match_acpi_device() (which includes the ACPI companion device pointer check against NULL) and store the ACPI button type as driver_data in button_device_ids[], whic...
```diff diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 9fe8d212b606..00c56f840744 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -59,11 +59,11 @@ MODULE_DESCRIPTION("ACPI Button Driver"); MODULE_LICENSE("GPL"); static const struct acpi_device_id button_device_ids[] = { - {ACPI_B...
180a232ea78003d1dc869b217b4e49106fd58e8f
Analyze and fix the following issue in the Linux kernel code: ntsync: Honour caller's time namespace for absolute MONOTONIC timeouts
Problem Details: ntsync_schedule() takes the absolute timeout from userspace and hands it to schedule_hrtimeout_range_clock() with HRTIMER_MODE_ABS. For the default CLOCK_MONOTONIC path, it does not call timens_ktime_to_host() first. A process inside a CLOCK_MONOTONIC time namespace computes the absolute timeout in it...
```diff diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c index 30af282262ef..02c9d1192812 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -19,6 +19,7 @@ #include <linux/sched/signal.h> #include <linux/slab.h> #include <linux/spinlock.h> +#include <linux/time_namespace.h> #include <uapi/l...
afd0f17ca46258cec3a5cc48b8df9327fe772490
Analyze and fix the following issue in the Linux kernel code: hsr: Remove WARN_ONCE() in hsr_addr_is_self().
Problem Details: syzbot reported the warning [0] in hsr_addr_is_self(), whose assumption is simply wrong. hsr->self_node is cleared in hsr_del_self_node(), which is called from hsr_dellink(). Since dev->rtnl_link_ops->dellink() is called before unregister_netdevice_many(), there is a window when user can find the dev...
```diff diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index b514e43766ef..a28dfd8490c5 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -35,10 +35,8 @@ bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr) rcu_read_lock(); sn = rcu_dereference(hsr->self_node); - if (!s...
e10902df24488ca722303133acfc82490f7d59ad
Analyze and fix the following issue in the Linux kernel code: tcp: Add preempt_{disable,enable}_nested() in reqsk_queue_hash_req().
Problem Details: syzbot reported a weird reqsk->rsk_refcnt underflow in __inet_csk_reqsk_queue_drop(). The captured reqsk_put() in __inet_csk_reqsk_queue_drop() is called only when it successfully removes reqsk from ehash. Moreover, reqsk_timer_handler() calls another reqsk_put() after that. This indicates that the ...
```diff diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index dbcd37dfdc15..5b934ce8d98a 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -1148,6 +1148,9 @@ static bool reqsk_queue_hash_req(struct request_sock *req) /* The timer needs to be setup aft...
b748765019fe9e9234660327090fc1a9665cdbdd
Analyze and fix the following issue in the Linux kernel code: net: Annotate sk->sk_write_space() for UDP SOCKMAP.
Problem Details: UDP TX skb->destructor() is sock_wfree(), and UDP holds lock_sock() only for UDP_CORK / MSG_MORE sendmsg(). Otherwise, sk->sk_write_space() may be read locklessly while SOCKMAP rewrites sk->sk_write_space(). Let's use WRITE_ONCE() and READ_ONCE() for sk->sk_write_space(). Note that the write side is...
```diff diff --git a/net/core/sock.c b/net/core/sock.c index b37b664b6eb9..d097025c116a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2676,8 +2676,12 @@ void sock_wfree(struct sk_buff *skb) int old; if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) { + void (*sk_write_space)(struct sock *sk); + + sk_write_spac...
73bf3cca7de6a73f53b6a52dc3b1c82ae5667a4d
Analyze and fix the following issue in the Linux kernel code: pcnet32: stop holding device spin lock during napi_complete_done
Problem Details: napi_complete_done may call gro_flush_normal (though not currently, as GRO is unsupported at the moment), which may result in packet TX. This will eventually result in calling pcnet32_start_xmit - resulting in a deadlock while trying to re-acquire the already locked spin lock. It is safe to split the ...
```diff diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 911808ab13a7..4f3076d4ea34 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -1407,8 +1407,10 @@ static int pcnet32_poll(struct napi_struct *napi, int budget) pcnet32_restart(d...
a99ce697ea5e27b867c9ba4ee55fa5ba3b8d1188
Analyze and fix the following issue in the Linux kernel code: cgroup: Migrate tasks to the root css when a controller is rebound
Problem Details: cgroup_apply_control_disable() defers kill_css_finish() while a css is still populated, relying on css_update_populated() to fire the deferred kill once the populated count reaches zero. This deadlocks when a controller is rebound out of a hierarchy. Mounting an implicit_on_dfl controller such as perf...
```diff diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 6e92791d279e..4d442c224bf5 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -197,6 +197,14 @@ static u32 cgrp_dfl_implicit_ss_mask; /* some controllers can be threaded on the default hierarchy */ static u32 cgrp_dfl_threaded...
b230b57bd6f242aaac3b8e62c7d18c69e1e30392
Analyze and fix the following issue in the Linux kernel code: RDMA/efa: Validate SQ ring size against max LLQ size
Problem Details: Validate the SQ ring size against the device's max LLQ size. This ensures that when using 128-byte WQEs, userspace cannot exceed the queue limits. On create QP, userspace provides the SQ ring size (depth x WQE size) which is validated against the max LLQ size. Fixes: 40909f664d27 ("RDMA/efa: Add EFA ...
```diff diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c index 7bd0838ebc99..9b2b652800e4 100644 --- a/drivers/infiniband/hw/efa/efa_verbs.c +++ b/drivers/infiniband/hw/efa/efa_verbs.c @@ -613,7 +613,8 @@ err_remove_mmap: } static int efa_qp_validate_cap(struct efa_dev *dev...
f8e357ac28c3eb06a266bd10443b3eace6eebd22
Analyze and fix the following issue in the Linux kernel code: ALSA: seq: Restore created port information after insertion
Problem Details: Commit 2ee646353cd5 ("ALSA: seq: Register kernel port with full information") split sequencer port creation from list insertion so a port can be filled before it becomes visible. However, snd_seq_ioctl_create_port() still copies port->addr back to the ioctl argument before snd_seq_insert_port() assign...
```diff diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 19d6fea012f6..81ef461a9118 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1306,14 +1306,13 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg) } } - info-...
607af438e6430893a822964c841a1994b33acccc
Analyze and fix the following issue in the Linux kernel code: tools/power/x86/intel-speed-select: Harden daemon pidfile open
Problem Details: Avoid symlink-based pidfile clobbering by opening the pidfile with O_NOFOLLOW and validating it with fstat() before locking/writing. The daemon currently uses a fixed pidfile path under /tmp. A local unprivileged user can pre-create a symlink at that path and cause a root-run daemon instance to write ...
```diff diff --git a/tools/power/x86/intel-speed-select/isst-daemon.c b/tools/power/x86/intel-speed-select/isst-daemon.c index 66df21b2b573..acedb7432849 100644 --- a/tools/power/x86/intel-speed-select/isst-daemon.c +++ b/tools/power/x86/intel-speed-select/isst-daemon.c @@ -148,6 +148,7 @@ static void daemonize(char *r...
5629eec1a2829871d496f3042884cdc267612f6a
Analyze and fix the following issue in the Linux kernel code: cpufreq/amd-pstate: Fix setting EPP in performance mode
Problem Details: EPP 0 is the only supported value in the performance policy. commit 798c47593cca ("cpufreq/amd-pstate: Add support for platform profile class") changed this while adding platform profile support to the dynamic EPP feature, but this actually wasn't necessary since platform profile writes disable manual ...
```diff diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 62b5d995281d..72df461e7b39 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1428,7 +1428,7 @@ ssize_t store_energy_performance_preference(struct cpufreq_policy *policy, epp = cpudata->epp_default_d...
c1edda54a0f713412f5914f9c9080856694bddca
Analyze and fix the following issue in the Linux kernel code: KVM: s390: Remove ptep_zap_softleaf_entry()
Problem Details: Migration entries do not need to be removed. The swap subsystem has been (and still is being) heavily reworked. The current implementation of ptep_zap_softleaf_entry() has been slowly modified and is now wrong, since it unconditionally calls swap_put_entries_direct() for both swap and migration entrie...
```diff diff --git a/arch/s390/mm/gmap_helpers.c b/arch/s390/mm/gmap_helpers.c index 396207163ca6..1cfe4724fbe2 100644 --- a/arch/s390/mm/gmap_helpers.c +++ b/arch/s390/mm/gmap_helpers.c @@ -16,24 +16,6 @@ #include <linux/ksm.h> #include <asm/gmap_helpers.h> -/** - * ptep_zap_softleaf_entry() - discard a software l...
6ae67dcac742529210a23dac6c9a7de1acfb52a3
Analyze and fix the following issue in the Linux kernel code: KVM: s390: Fix possible reference leak in fault-in code
Problem Details: If kvm_s390_new_mmu_cache() fails, kvm_s390_faultin_gfn() returns without releasing the faulted page. Fix this by moving the allocation of the memory cache outside of the loop. There is no reason to check at every iteration. Opportunistically fix a comment. Fixes: e907ae530133 ("KVM: s390: Add helpe...
```diff diff --git a/arch/s390/kvm/faultin.c b/arch/s390/kvm/faultin.c index cf542b0a7e8e..fee80047bd94 100644 --- a/arch/s390/kvm/faultin.c +++ b/arch/s390/kvm/faultin.c @@ -54,6 +54,13 @@ int kvm_s390_faultin_gfn(struct kvm_vcpu *vcpu, struct kvm *kvm, struct guest_fa return 0; } + if (!mc) { + local_mc = kv...
7b53b4801884d48551f26a17f00cdc0ae4640d64
Analyze and fix the following issue in the Linux kernel code: KVM: s390: Prevent memslots outside the ASCE range
Problem Details: With KVM_S390_VM_MEM_LIMIT_SIZE, userspace can set the highest address allowed for the VM. Creating a memslot that lies over the maximum address does not make sense and is only a potential source of bugs. Prevent creation of memslots over the maximum address, and prevent the maximum address from being...
```diff diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index e09960c2e6ed..ffb20a64d328 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -999,7 +999,10 @@ static int kvm_s390_set_mem_control(struct kvm *kvm, struct kvm_device_attr *att break; } case KVM_S390_VM_MEM_LIMIT_...
ec02fe217fa66d79f8a65e8d28be9295c7f85093
Analyze and fix the following issue in the Linux kernel code: io_uring/bpf-ops: restrict ctx access to BPF
Problem Details: BPF programs should have no need in looking into struct io_ring_ctx, if anything, most of such cases would be anti patterns like looking up ring indices directly via the context. Replace it with a new empty structure, which is just an alias to struct io_ring_ctx. It'll create a new BTF type and fail v...
```diff diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index 23b8891d5704..aa4d5477f859 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -290,6 +290,8 @@ enum { IO_RING_F_IOWQ_LIMITS_SET = BIT(12), }; +struct iou_ctx {}; + struct io_ring_ctx { /* ...