id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
936206e3f6ff411581e615e930263d6f8b78df9d
Analyze and fix the following issue in the Linux kernel code: netfilter: nfnetlink_queue: make hash table per queue
Problem Details: Sharing a global hash table among all queues is tempting, but it can cause crash: BUG: KASAN: slab-use-after-free in nfqnl_recv_verdict+0x11ac/0x15e0 [nfnetlink_queue] [..] nfqnl_recv_verdict+0x11ac/0x15e0 [nfnetlink_queue] nfnetlink_rcv_msg+0x46a/0x930 kmem_cache_alloc_node_noprof+0x11e/0x450 str...
```diff diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 45eb26b2e95b..d17035d14d96 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h @@ -23,7 +23,6 @@ struct nf_queue_entry { struct nf_hook_state state; bool nf_ct_is_unconfirmed; u16 si...
f8dca15a1b190787bbd03285304b569631160eda
Analyze and fix the following issue in the Linux kernel code: netfilter: nft_ct: fix use-after-free in timeout object destroy
Problem Details: nft_ct_timeout_obj_destroy() frees the timeout object with kfree() immediately after nf_ct_untimeout(), without waiting for an RCU grace period. Concurrent packet processing on other CPUs may still hold RCU-protected references to the timeout object obtained via rcu_dereference() in nf_ct_timeout_data(...
```diff diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h index 9fdaba911de6..3a66d4abb6d6 100644 --- a/include/net/netfilter/nf_conntrack_timeout.h +++ b/include/net/netfilter/nf_conntrack_timeout.h @@ -14,6 +14,7 @@ struct nf_ct_timeout { __u16 l3num; cons...
fdce0b3590f724540795b874b4c8850c90e6b0a8
Analyze and fix the following issue in the Linux kernel code: netfilter: ip6t_eui64: reject invalid MAC header for all packets
Problem Details: `eui64_mt6()` derives a modified EUI-64 from the Ethernet source address and compares it with the low 64 bits of the IPv6 source address. The existing guard only rejects an invalid MAC header when `par->fragoff != 0`. For packets with `par->fragoff == 0`, `eui64_mt6()` can still reach `eth_hdr(skb)` e...
```diff diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index d704f7ed300c..da69a27e8332 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c @@ -22,8 +22,7 @@ eui64_mt6(const struct sk_buff *skb, struct xt_action_param *par) unsigned char eui64[8]; if ...
ff64c5bfef12461df8450e0f50bb693b5269c720
Analyze and fix the following issue in the Linux kernel code: netfilter: xt_multiport: validate range encoding in checkentry
Problem Details: ports_match_v1() treats any non-zero pflags entry as the start of a port range and unconditionally consumes the next ports[] element as the range end. The checkentry path currently validates protocol, flags and count, but it does not validate the range encoding itself. As a result, malformed rules can...
```diff diff --git a/net/netfilter/xt_multiport.c b/net/netfilter/xt_multiport.c index 44a00f5acde8..a1691ff405d3 100644 --- a/net/netfilter/xt_multiport.c +++ b/net/netfilter/xt_multiport.c @@ -105,6 +105,28 @@ multiport_mt(const struct sk_buff *skb, struct xt_action_param *par) return ports_match_v1(multiinfo, ntoh...
1f3083aec8836213da441270cdb1ab612dd82cf4
Analyze and fix the following issue in the Linux kernel code: netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator
Problem Details: When batching multiple NFLOG messages (inst->qlen > 1), __nfulnl_send() appends an NLMSG_DONE terminator with sizeof(struct nfgenmsg) payload via nlmsg_put(), but never initializes the nfgenmsg bytes. The nlmsg_put() helper only zeroes alignment padding after the payload, not the payload itself, so fou...
```diff diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index f80978c06fa0..0db908518b2f 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -361,10 +361,10 @@ static void __nfulnl_send(struct nfulnl_instance *inst) { if (inst->qlen > 1) { - struct nlmsghdr ...
9a91797e61d286805ae10a92cc48959c30800556
Analyze and fix the following issue in the Linux kernel code: ipvs: fix NULL deref in ip_vs_add_service error path
Problem Details: When ip_vs_bind_scheduler() succeeds in ip_vs_add_service(), the local variable sched is set to NULL. If ip_vs_start_estimator() subsequently fails, the out_err cleanup calls ip_vs_unbind_scheduler(svc, sched) with sched == NULL. ip_vs_unbind_scheduler() passes the cur_sched NULL check (because svc->...
```diff diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 35642de2a0fe..2aaf50f52c8e 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -1452,7 +1452,6 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, ret = ip_vs_bind_s...
4c71fd099513bfa8acab529b626e1f0097b76061
Analyze and fix the following issue in the Linux kernel code: drm/i915/gt: fix refcount underflow in intel_engine_park_heartbeat
Problem Details: A use-after-free / refcount underflow is possible when the heartbeat worker and intel_engine_park_heartbeat() race to release the same engine->heartbeat.systole request. The heartbeat worker reads engine->heartbeat.systole and calls i915_request_put() on it when the request is complete, but clears the...
```diff diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c index b279878dca29..6424ecce8bcb 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c @@ -148,10 +148,12 @@ static void heartbeat(struc...
8b016dcec9365675be81d26be88f2c09cf983bd4
Analyze and fix the following issue in the Linux kernel code: sched/rt: Skip group schedulable check with rt_group_sched=0
Problem Details: The warning from the commit 87f1fb77d87a6 ("sched: Add RT_GROUP WARN checks for non-root task_groups") is wrong -- it assumes that only task_groups with rt_rq are traversed, however, the schedulability check would iterate all task_groups even when rt_group_sched=0 is disabled at boot time but some non-...
```diff diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a48e86794913..893e54dab13e 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2690,9 +2690,6 @@ static int tg_rt_schedulable(struct task_group *tg, void *data) tg->rt_bandwidth.rt_runtime && tg_has_rt_tasks(tg)) return -EBUSY; - if (WAR...
14a857056466be9d3d907a94e92a704ac1be149b
Analyze and fix the following issue in the Linux kernel code: sched/deadline: Use revised wakeup rule for dl_server
Problem Details: John noted that commit 115135422562 ("sched/deadline: Fix 'stuck' dl_server") unfixed the issue from commit a3a70caf7906 ("sched/deadline: Fix dl_server behaviour"). The issue in commit 115135422562 was for wakeups of the server after the deadline; in which case you *have* to start a new period. The c...
```diff diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index d08b00429323..674de6a48551 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1027,7 +1027,7 @@ static void update_dl_entity(struct sched_dl_entity *dl_se) if (dl_time_before(dl_se->deadline, rq_clock(rq)) || dl_ent...
daae9c18feec74566e023fc88cfb0ce26e39d868
Analyze and fix the following issue in the Linux kernel code: thermal: core: Free thermal zone ID later during removal
Problem Details: The thermal zone removal ordering is different from the thermal zone registration rollback path ordering and the former is arguably problematic because freeing a thermal zone ID prematurely may cause it to be used during the registration of another thermal zone which may fail as a result. Prevent that...
```diff diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6e10b2fe2972..c1ec98591703 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -965,6 +965,7 @@ static void thermal_release(struct device *dev) tz = to_thermal_zone(dev); thermal_zone_destroy...
41ff66baf81c6541f4f985dd7eac4494d03d9440
Analyze and fix the following issue in the Linux kernel code: thermal: core: Fix thermal zone governor cleanup issues
Problem Details: If thermal_zone_device_register_with_trips() fails after adding a thermal governor to the thermal zone being registered, the governor is not removed from it as appropriate which may lead to a memory leak. In turn, thermal_zone_device_unregister() calls thermal_set_governor() without acquiring the ther...
```diff diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index b6b651cb2331..6e10b2fe2972 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -964,6 +964,7 @@ static void thermal_release(struct device *dev) sizeof("thermal_zone") - 1)) { tz = to_the...
62a36c2da774800bef893bc4bf8922fb9c07c1d0
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Minor improvements to job submission code documentation
Problem Details: Mixed list of clarifications and typo fixes. Signed-off-by: Alessio Belle <alessio.belle@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com> Link: https://patch.msgid.link/20260330-job-submission-fixes-cleanup-v1-8-7de8c09cef8c@imgtec.com Signed-off-by: Matt Coster <matt.coster@imgtec.co...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 303f4d6cc09e..b5bec656d13c 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -200,6 +200,13 @@ pvr_queue_fence_is_ufo_backed(struct dma_fence *f) * already b...
5c81eb2970133ad073214eb1e5b0c34a1ae793eb
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Update check to skip prepare_job() for fragment jobs
Problem Details: By the time prepare_job() is called on a paired fragment job, the paired geometry job might already be finished and its PM reference dropped. Check the fragment job's PM reference instead which is a bit more likely to be still set. This is a very minor optimization. Signed-off-by: Alessio Belle <ales...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 4a49d954562e..303f4d6cc09e 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -553,12 +553,13 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job, if (...
402562e60c6c1b15ee359ba7ffed907baa886a99
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Move repeated job fence check to its own function
Problem Details: This should make the code slightly clearer. Signed-off-by: Alessio Belle <alessio.belle@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com> Link: https://patch.msgid.link/20260330-job-submission-fixes-cleanup-v1-6-7de8c09cef8c@imgtec.com Signed-off-by: Matt Coster <matt.coster@imgtec.com...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index df0a110ed96f..4a49d954562e 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -177,6 +177,24 @@ static const struct dma_fence_ops pvr_queue_job_fence_ops = { ...
5dae1a21f1e7128a19c68212422383f700699d01
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Rename fence returned by pvr_queue_job_arm()
Problem Details: Rename from done_fence to finished_fence, both because the function returns a drm_sched_fence's finished fence, and to avoid confusion with the job fence, which is called the same but has a different purpose. Signed-off-by: Alessio Belle <alessio.belle@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.g...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_job.c b/drivers/gpu/drm/imagination/pvr_job.c index 0c2f511a6178..dd9f5df01e08 100644 --- a/drivers/gpu/drm/imagination/pvr_job.c +++ b/drivers/gpu/drm/imagination/pvr_job.c @@ -326,7 +326,7 @@ prepare_job_syncs(struct pvr_file *pvr_file, struct pvr_job_data *jo...
c162e655092de8de2e0f7776d72919dd5e3b84f2
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Rename pvr_queue_fence_is_ufo_backed() to reflect usage
Problem Details: This function is only used by the synchronization code to figure out if a fence belongs to this driver. Rename it to pvr_queue_fence_is_native() and update its documentation to reflect its current purpose. Signed-off-by: Alessio Belle <alessio.belle@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.gupt...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 527eae1309d8..df0a110ed96f 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -898,16 +898,16 @@ static const struct drm_sched_backend_ops pvr_queue_sched_ops =...
18998b3cb7595850b8b2da55adb3fdc7aef8bc22
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Skip check on paired job fence during job submission
Problem Details: While submitting a paired fragment job, there is no need to manually look for, and skip, the paired job fence, as the existing logic to resolve dependencies to pvr_queue_fence objects will have failed to resolve it already and continued with the next one. Point this out where the fence is actually acc...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index f1e54e6d940d..527eae1309d8 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -646,10 +646,6 @@ static void pvr_queue_submit_job_to_cccb(struct pvr_job *job) ...
4baf9e70cb756d78dd56419f8baee2978a72d0c3
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Fit paired fragment job in the correct CCCB
Problem Details: For geometry jobs with a paired fragment job, at the moment, the DRM scheduler's prepare_job() callback: - checks for internal (driver) dependencies for the geometry job; - calls into pvr_queue_get_paired_frag_job_dep() to check for external dependencies for the fragment job (the two jobs are submit...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 836feaa0b295..f1e54e6d940d 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -488,10 +488,11 @@ pvr_queue_get_job_kccb_fence(struct pvr_queue *queue, struct pv...
9cd74f935306cd857f46686975c43383e1d95f94
Analyze and fix the following issue in the Linux kernel code: drm/imagination: Count paired job fence as dependency in prepare_job()
Problem Details: The DRM scheduler's prepare_job() callback counts the remaining non-signaled native dependencies for a job, preventing job submission until those (plus job data and fence update) can fit in the job queue's CCCB. This means checking which dependencies can be waited upon in the firmware, i.e. whether th...
```diff diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index dd88949f6194..836feaa0b295 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -179,7 +179,7 @@ static const struct dma_fence_ops pvr_queue_job_fence_ops = { ...
c5538d0141b383808f440186fcd0bc2799af2853
Analyze and fix the following issue in the Linux kernel code: entry: Split kernel mode logic from irqentry_{enter,exit}()
Problem Details: The generic irqentry code has entry/exit functions specifically for exceptions taken from user mode, but doesn't have entry/exit functions specifically for exceptions taken from kernel mode. It would be helpful to have separate entry/exit functions specifically for exceptions taken from kernel mode. T...
```diff diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h index d1e8591a5919..66bc168bc6b5 100644 --- a/include/linux/irq-entry-common.h +++ b/include/linux/irq-entry-common.h @@ -304,6 +304,8 @@ static __always_inline void irqentry_enter_from_user_mode(struct pt_regs *regs) */ static ...
22f66e7ef4ce9414b4bd18abe50ead4a1284b01a
Analyze and fix the following issue in the Linux kernel code: entry: Remove local_irq_{enable,disable}_exit_to_user()
Problem Details: local_irq_enable_exit_to_user() and local_irq_disable_exit_to_user() are never overridden by architecture code, and are always equivalent to local_irq_enable() and local_irq_disable(). These functions were added on the assumption that arm64 would override them to manage 'DAIF' exception masking, as de...
```diff diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index f83ca0abf2cd..dbaa153100f4 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -321,7 +321,7 @@ static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs) { instrumentation_begin(); s...
1f0d117cd6ca8e74e70e415e89b059fce37674c6
Analyze and fix the following issue in the Linux kernel code: entry: Fix stale comment for irqentry_enter()
Problem Details: The kerneldoc comment for irqentry_enter() refers to idtentry_exit(), which is an accidental holdover from the x86 entry code that the generic irqentry code was based on. Correct this to refer to irqentry_exit(). Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Thomas Gleixner <tglx@...
```diff diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h index d26d1b1bcbfb..3cf4d21168ba 100644 --- a/include/linux/irq-entry-common.h +++ b/include/linux/irq-entry-common.h @@ -394,7 +394,7 @@ typedef struct irqentry_state { * establish the proper context for NOHZ_FULL. Otherwise sch...
8b1858aaaa20255a42d8eefe7e913c161331af0c
Analyze and fix the following issue in the Linux kernel code: drm/i915/pci: move intel_pci_config.h under include/drm/intel
Problem Details: Since the PCI registers are used from both i915 display and core, move intel_pci_config.h to include/drm/intel/pci_config.h. Drop the intel_ prefix from the name to reduce tautology. With this, we can drop the corresponding xe display compat header. v2: Rebase Reviewed-by: Ville Syrjälä <ville.syrja...
```diff diff --git a/drivers/gpu/drm/i915/display/i9xx_display_sr.c b/drivers/gpu/drm/i915/display/i9xx_display_sr.c index 935419441709..1eb2f636cc65 100644 --- a/drivers/gpu/drm/i915/display/i9xx_display_sr.c +++ b/drivers/gpu/drm/i915/display/i9xx_display_sr.c @@ -4,13 +4,13 @@ */ #include <drm/drm_device.h> +#i...
d96366c7027aa1f335d1391983ff3c140f02c64e
Analyze and fix the following issue in the Linux kernel code: drm/i915/mchbar: move intel_mchbar_regs.h under include/drm/intel
Problem Details: Since the mchbar registers are used from both i915 display and core, move intel_mchbar_regs.h to include/drm/intel/mchbar_regs.h. Drop the intel_ prefix from the name to reduce tautology. With this, we can drop the corresponding xe display compat header. v2: Rebase Reviewed-by: Ville Syrjälä <ville....
```diff diff --git a/drivers/gpu/drm/i915/display/intel_mchbar.h b/drivers/gpu/drm/i915/display/intel_mchbar.h index 51ecd6075bdf..fb645c64796c 100644 --- a/drivers/gpu/drm/i915/display/intel_mchbar.h +++ b/drivers/gpu/drm/i915/display/intel_mchbar.h @@ -8,8 +8,9 @@ #include <linux/types.h> +#include <drm/intel/mc...
53217ef45611a14d32d77f6a0627069780d23f3e
Analyze and fix the following issue in the Linux kernel code: drm/ast: Fix open-coded scu_rev access
Problem Details: Replace all open-coded access to P2A and SCU registers in the device detection with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use P2A and MCR register constants. Name variables according to registers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <j...
```diff diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index 6fe549f16309..ba6cf5fa901c 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -242,7 +242,7 @@ static int ast_detect_chip(struct pci_dev *pdev, enum ast_config_mode config_mode = ast_use_defaults; ...
e60dccc256c89b9ce86dcbddad27dd7d1c6c095c
Analyze and fix the following issue in the Linux kernel code: drm/ast: dp501: Fix open-coded register access
Problem Details: Replace all open-coded access to SCU registers in DP501 support with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use SCU register constants. Name variables according to registers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Lin...
```diff diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c index 23142119d733..98d8491ce6c9 100644 --- a/drivers/gpu/drm/ast/ast_dp501.c +++ b/drivers/gpu/drm/ast/ast_dp501.c @@ -347,68 +347,65 @@ static int ast_dp512_read_edid_block(void *data, u8 *buf, unsigned int block, si static bool a...
562aa0d24d9ef22f3e39c6e4dd99eeba4617edb2
Analyze and fix the following issue in the Linux kernel code: drm/ast: Gen6: Fix open-coded register access
Problem Details: Replace all open-coded access to MCR and SCU registers in Gen6 with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use MCR and SCU register constants. Name variables according to registers. v2: - also fix MCR constants Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Joce...
```diff diff --git a/drivers/gpu/drm/ast/ast_2500.c b/drivers/gpu/drm/ast/ast_2500.c index 39f401dd1f47..03a67ec9684b 100644 --- a/drivers/gpu/drm/ast/ast_2500.c +++ b/drivers/gpu/drm/ast/ast_2500.c @@ -280,15 +280,13 @@ static void enable_cache_2500(struct ast_device *ast) static void set_mpll_2500(struct ast_devic...
24946c2aa0f1bbafe8089187aa08fb5d417fd069
Analyze and fix the following issue in the Linux kernel code: drm/ast: Gen4: Fix open-coded register access
Problem Details: Replace all open-coded access to MCR and SCU registers in Gen4 with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use MCR and SCU register constants. Name variables according to registers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.c...
```diff diff --git a/drivers/gpu/drm/ast/ast_2300.c b/drivers/gpu/drm/ast/ast_2300.c index 96d9909d942c..cbeac6990c27 100644 --- a/drivers/gpu/drm/ast/ast_2300.c +++ b/drivers/gpu/drm/ast/ast_2300.c @@ -1245,22 +1245,15 @@ static void ast_post_chip_2300(struct ast_device *ast) reg = ast_get_index_reg_mask(ast, AST_...
fe727ff281239eeefea4e9d2ffb9544b82d7c46f
Analyze and fix the following issue in the Linux kernel code: drm/ast: Gen2: Fix open-coded register access
Problem Details: Replace all open-coded access to MCR and SCU registers in Gen2 with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use MCR and SCU register constants. Name variables according to registers. The values in MCR04 that control VRAM allocation do not look correct. Leave a FIXME comment for later ...
```diff diff --git a/drivers/gpu/drm/ast/ast_2100.c b/drivers/gpu/drm/ast/ast_2100.c index 930e9f2d0ccf..5cf8ad9c3446 100644 --- a/drivers/gpu/drm/ast/ast_2100.c +++ b/drivers/gpu/drm/ast/ast_2100.c @@ -40,21 +40,19 @@ static enum ast_dram_layout ast_2100_get_dram_layout_p2a(struct ast_device *ast) { - u32 mcr_cfg;...
d467bcab7b8a8c4494290f830bd6c3b6830a8ebf
Analyze and fix the following issue in the Linux kernel code: drm/ast: Gen1: Fix open-coded register access
Problem Details: Replace all open-coded access to MCR registers in Gen1 with the appropriate calls to ast_moutdwm() and ast_mindwm(). Use MCR register constants. For the poll loop on MCR100, add ast_moutdwm_poll(). The helper polls the register until it has been updated to the given value. Relax the CPU while busy-wai...
```diff diff --git a/drivers/gpu/drm/ast/ast_2000.c b/drivers/gpu/drm/ast/ast_2000.c index e683edf595e2..4cf951b3533d 100644 --- a/drivers/gpu/drm/ast/ast_2000.c +++ b/drivers/gpu/drm/ast/ast_2000.c @@ -99,20 +99,15 @@ static const struct ast_dramstruct ast2000_dram_table_data[] = { static void ast_post_chip_2000(stru...
06c076cb300b9eabb016e4898d5743e5fad959bb
Analyze and fix the following issue in the Linux kernel code: drm/ast: Use constants for SCU registers
Problem Details: SCU is the System Control Unit. SCU registers are located in the memory range at [0x1e6e2000, 0x1e6e2fff]. Refer to them with constants named AST_REG_SCU<n>, where <n> is the byte offset into the range. Replacing the magic values in the ast driver was done with grep and sed as shown below git grep ...
```diff diff --git a/drivers/gpu/drm/ast/ast_2300.c b/drivers/gpu/drm/ast/ast_2300.c index 56fe9e9f5c66..1fe947178124 100644 --- a/drivers/gpu/drm/ast/ast_2300.c +++ b/drivers/gpu/drm/ast/ast_2300.c @@ -516,10 +516,10 @@ static void get_ddr3_info(struct ast_device *ast, struct ast2300_dram_param *par { u32 trap, tra...
94b1152fb80c1cba5d6706f0b5b2137511e57fbd
Analyze and fix the following issue in the Linux kernel code: drm/ast: Move 32-bit register-access helpers to ast_drv.{c, h}
Problem Details: The helpers ast_mindwm() and ast_moutdwm() access the I/O memory of the various IP modules on the Aspeed device. This is based on the "P-Bus to AHB Bridge" interface. Reimplement the access function with properly defined constants and helper macros. - Define P2A constants for the related registers an...
```diff diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index b9a9b050b546..05ec3542ab62 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -47,6 +47,65 @@ static int ast_modeset = -1; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named...
c95ac578846326994c8006713acaad77bc8edd38
Analyze and fix the following issue in the Linux kernel code: drm/panthor: Fix kernel-doc warning in panthor_sched.c
Problem Details: Fix the following W=1 kerneldoc warnings by adding the missing parameter descriptions for @ptdev and @events in panthor_sched_report_fw_events() and @ptdev in panthor_sched_report_mmu_fault() Warning: drivers/gpu/drm/panthor/panthor_sched.c:1898 function parameter 'ptdev' not described in 'panthor_sch...
```diff diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c index 97581943a138..3bb1cb5a2656 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.c +++ b/drivers/gpu/drm/panthor/panthor_sched.c @@ -1893,6 +1893,8 @@ static void process_fw_events_work(struct work_struct *work) ...
292286b2d229fb732421429b027d38ac3f969383
Analyze and fix the following issue in the Linux kernel code: ALSA: usb-audio: qcom: Fix incorrect type in enable_audio_stream
Problem Details: Fix sparse warning: sound/usb/qcom/qc_audio_offload.c:943:27: sparse: incorrect type in argument 2 expected unsigned int val but got snd_pcm_format_t. Explicitly cast pcm_format to unsigned int for snd_mask_leave(). Fixes: 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support"...
```diff diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index f161eb29f911..9c0d370860f3 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -947,7 +947,7 @@ static int enable_audio_stream(struct snd_usb_substream *subs, _snd_pcm_hw_params_any(&...
37d9c4c055c3b3357c61dba2335ab21340e33553
Analyze and fix the following issue in the Linux kernel code: USB: serial: iuu_phoenix: fix iuutool author name
Problem Details: The original iuutool author is Juan Carlos Borrás - fix the spelling. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Johan Hovold <johan@kernel.org>
```diff diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index f8d6aa30a3e1..0ca111b111c7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -6,7 +6,7 @@ * Copyright (C) 2007 Alain Degreffe (eczema@ecze.com) * - * Original code taken from iuutoo...
91e901c65b4da02a6fd543e3f0049829ae9645b7
Analyze and fix the following issue in the Linux kernel code: um: drivers: call kernel_strrchr() explicitly in cow_user.c
Problem Details: Building ARCH=um on glibc >= 2.43 fails: arch/um/drivers/cow_user.c: error: implicit declaration of function 'strrchr' [-Wimplicit-function-declaration] glibc 2.43's C23 const-preserving strrchr() macro does not survive UML's global -Dstrrchr=kernel_strrchr remap from arch/um/Makefile. Call kerne...
```diff diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 29b46581ddd1..dc1d1bcd85ec 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c @@ -15,6 +15,12 @@ #include "cow.h" #include "cow_sys.h" +/* + * arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel +...
828ec7f803f41588a120e6d804297e74a482ab9d
Analyze and fix the following issue in the Linux kernel code: gpio: bd72720: handle missing regmap
Problem Details: Currently the probe does not check whether getting the regmap succeeded. This can cause crash when regmap is used, if it wasn't successfully obtained. Failing to get the regmap is unlikely, especially since this driver is expected to be kicked by the MFD driver only after registering the regmap - but i...
```diff diff --git a/drivers/gpio/gpio-bd72720.c b/drivers/gpio/gpio-bd72720.c index 6549dbf4c7ad..d0f936ed80af 100644 --- a/drivers/gpio/gpio-bd72720.c +++ b/drivers/gpio/gpio-bd72720.c @@ -256,6 +256,8 @@ static int gpo_bd72720_probe(struct platform_device *pdev) g->dev = dev; g->chip.parent = parent; g->regmap...
8e57338c3601d0cde806bd7e70c377109106c983
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_tables: add netlink policy based cap on registers
Problem Details: Should have no effect in practice; all of these use the nft_parse_register_load/store apis which is mandatory anyway due to the need to further validate the register load/store, e.g. that the size argument doesn't result in out-of-bounds load/store. OTOH this is a simple method to reject obviously wro...
```diff diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h index dca9e72b0558..0b708153469c 100644 --- a/include/uapi/linux/netfilter/nf_tables.h +++ b/include/uapi/linux/netfilter/nf_tables.h @@ -46,6 +46,10 @@ enum nft_registers { }; #define NFT_REG_MAX (__NFT_REG_MAX -...
390a57dd61af837fcf5ad0681267890bd6cdd594
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_conntrack_h323: remove unreliable debug code in decode_octstr
Problem Details: The debug code (not enabled in any build) reads up to 6 octets of the inpt buffer, but does so without bound checks. Zap this. Signed-off-by: Florian Westphal <fw@strlen.de>
```diff diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c index 7b1497ed97d2..09e0f724644f 100644 --- a/net/netfilter/nf_conntrack_h323_asn1.c +++ b/net/netfilter/nf_conntrack_h323_asn1.c @@ -21,7 +21,6 @@ #if H323_TRACE #define TAB_SIZE 4 -#define IFTHEN(cond, act) if(con...
1f290c497cb644dd3b52e69b2eaa24a5ffb66094
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_tables: Fix typo in enum description
Problem Details: Fix the spelling of "options". Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> Signed-off-by: Florian Westphal <fw@strlen.de>
```diff diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h index 45c71f7d21c2..dca9e72b0558 100644 --- a/include/uapi/linux/netfilter/nf_tables.h +++ b/include/uapi/linux/netfilter/nf_tables.h @@ -884,7 +884,7 @@ enum nft_exthdr_flags { * @NFT_EXTHDR_OP_TCPOPT: match agai...
4cda78d6f8bf2b700529f2fbccb994c3e826d7c2
Analyze and fix the following issue in the Linux kernel code: Input: uinput - fix circular locking dependency with ff-core
Problem Details: A lockdep circular locking dependency warning can be triggered reproducibly when using a force-feedback gamepad with uinput (for example, playing ELDEN RING under Wine with a Flydigi Vader 5 controller): ff->mutex -> udev->mutex -> input_mutex -> dev->mutex -> ff->mutex The cycle is caused by four ...
```diff diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 13336a2fd49c..a973e82205b5 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -57,6 +57,7 @@ struct uinput_device { struct input_dev *dev; struct mutex mutex; enum uinput_state state; + spinlock_t sta...
e6ef4eb871ed884f5f480579b2e5f4fc9d2cb003
Analyze and fix the following issue in the Linux kernel code: powerpc32/bpf: fix loading fsession func metadata using PPC_LI32
Problem Details: PPC_RAW_LI32 is not a valid macro in the PowerPC BPF JIT. Use PPC_LI32, which correctly handles immediate loads for large values. Fixes the build error introduced when adding fsession support on ppc32. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/2026040...
```diff diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c index f3ae89e1d1d0..bfdc50740da8 100644 --- a/arch/powerpc/net/bpf_jit_comp32.c +++ b/arch/powerpc/net/bpf_jit_comp32.c @@ -150,11 +150,11 @@ void store_func_meta(u32 *image, struct codegen_context *ctx, * func_meta := argumen...
102d44b3a8fad96e94e9ccd0579986c14a1f2f75
Analyze and fix the following issue in the Linux kernel code: drm/i915/backlight: Fix VESA backlight possible check condition
Problem Details: VESA backlight enable is possible when BACKLIGHT_AUX_ENABLE_CAPABLE is true via AUX command or when BACKLIGHT_PIN_ENABLE_CAPABLE is true via eDP connector pin. Similarly, backlight brightness adjustment can be done via AUX-based control or PWM pin-based control. It means there can be three configuratio...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index d0c76632a946..a8d56ebf06a2 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -615,8 +615,13 @@ check_if...
c3812651b522fe8437ebb7063b75ddb95b571643
Analyze and fix the following issue in the Linux kernel code: seg6: separate dst_cache for input and output paths in seg6 lwtunnel
Problem Details: The seg6 lwtunnel uses a single dst_cache per encap route, shared between seg6_input_core() and seg6_output_core(). These two paths can perform the post-encap SID lookup in different routing contexts (e.g., ip rules matching on the ingress interface, or VRF table separation). Whichever path runs first ...
```diff diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index 3e1b9991131a..d6a0f7df9080 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c @@ -48,7 +48,8 @@ static size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo) } struct seg6_lwt { - struct dst_cache cache; + struct...
efaa71faf212324ecbf6d5339e9717fe53254f58
Analyze and fix the following issue in the Linux kernel code: selftests: net: bridge_vlan_mcast: wait for h1 before querier check
Problem Details: The querier-interval test adds h1 (currently a slave of the VRF created by simple_if_init) to a temporary bridge br1 acting as an outside IGMP querier. The kernel VRF driver (drivers/net/vrf.c) calls cycle_netdev() on every slave add and remove, toggling the interface admin-down then up. Phylink takes ...
```diff diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh index 72dfbeaf56b9..e8031f68200a 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh @@ -4...
7fb4c19670110f052c04e1ec1d2b953b9f4f57e4
Analyze and fix the following issue in the Linux kernel code: net: pull headers in qdisc_pkt_len_segs_init()
Problem Details: Most ndo_start_xmit() methods expects headers of gso packets to be already in skb->head. net/core/tso.c users are particularly at risk, because tso_build_hdr() does a memcpy(hdr, skb->data, hdr_len); qdisc_pkt_len_segs_init() already does a dissection of gso packets. Use pskb_may_pull() instead of s...
```diff diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h index de61dd5dbfd9..51855de5d208 100644 --- a/include/net/dropreason-core.h +++ b/include/net/dropreason-core.h @@ -74,6 +74,7 @@ FN(UNHANDLED_PROTO) \ FN(SKB_CSUM) \ FN(SKB_GSO_SEG) \ + FN(SKB_BAD_GSO) \ FN(SKB_UCOPY_FAUL...
944b3b734cfbbe9502274c092bc3b8220764cc92
Analyze and fix the following issue in the Linux kernel code: net: avoid nul-deref trying to bind mp to incapable device
Problem Details: Sashiko points out that we use qops in __net_mp_open_rxq() but never validate they are null. This was introduced when check was moved from netdev_rx_queue_restart(). Look at ops directly instead of the locking config. qops imply netdev_need_ops_lock(). We used netdev_need_ops_lock() initially to signi...
```diff diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c index 668a90658f25..05fd2875d725 100644 --- a/net/core/netdev_rx_queue.c +++ b/net/core/netdev_rx_queue.c @@ -117,7 +117,7 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx, struct netdev_rx_queue *rxq; int ret; - if ...
f2777d5cb5c094e20f2323d953b1740baee5f8e8
Analyze and fix the following issue in the Linux kernel code: net: stmmac: dwmac-motorcomm: fix eFUSE MAC address read failure
Problem Details: This patch fixes an issue where reading the MAC address from the eFUSE fails due to a race condition. The root cause was identified by comparing the driver's behavior with a custom U-Boot port. In U-Boot, the MAC address was read successfully every time because the driver was loaded later in the boot ...
```diff diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c index 8b45b9cf7202..663d87ccfa0f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c @@ -6,6 +6,7 @@ */ #incl...
cac16ce1e3786bd98cec0c108e3bc06ed3d3c6a9
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Add tests for stale delta leaking through id reassignment
Problem Details: Extend the verifier_linked_scalars BPF selftest with a stale delta test such that the div-by-zero path is rejected in the fixed case. # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t verifier_linked_scalars [...] ./test_progs -t verifier_linked_scalars #612/1 ...
```diff diff --git a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c index 09146e5db061..60a6f246e2d1 100644 --- a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c +++ b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c @@ -5...
ed2eecdc0c6613353bc1565e900d2b23237713da
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Add tests for delta tracking when src_reg == dst_reg
Problem Details: Extend the verifier_linked_scalars BPF selftest with a rX += rX test such that the div-by-zero path is rejected in the fixed case. # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t verifier_linked_scalars [...] ./test_progs -t verifier_linked_scalars #612/1 ver...
```diff diff --git a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c index f4f8a055af8a..09146e5db061 100644 --- a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c +++ b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c @@ -5...
1b327732c84640c1e3da487eefe9d00cc9f2dd34
Analyze and fix the following issue in the Linux kernel code: bpf: Clear delta when clearing reg id for non-{add,sub} ops
Problem Details: When a non-{add,sub} alu op such as xor is performed on a scalar register that previously had a BPF_ADD_CONST delta, the else path in adjust_reg_min_max_vals() only clears dst_reg->id but leaves dst_reg->delta unchanged. This stale delta can propagate via assign_scalar_id_before_mov() when the registe...
```diff diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d83e17cccd38..40584ab48fb4 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5257,27 +5257,30 @@ static bool __is_pointer_value(bool allow_ptr_leaks, return reg->type != SCALAR_VALUE; } +static void clear_scalar_id(struct bpf...
d7f14173c0d5866c3cae759dee560ad1bed10d2e
Analyze and fix the following issue in the Linux kernel code: bpf: Fix linked reg delta tracking when src_reg == dst_reg
Problem Details: Consider the case of rX += rX where src_reg and dst_reg are pointers to the same bpf_reg_state in adjust_reg_min_max_vals(). The latter first modifies the dst_reg in-place, and later in the delta tracking, the subsequent is_reg_const(src_reg)/reg_const_value(src_reg) reads the post-{add,sub} value inst...
```diff diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 1bebbdb3b693..d83e17cccd38 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -16722,7 +16722,8 @@ static int adjust_reg_min_max_vals(struct bpf_verifier_env *env, */ if (env->bpf_capable && (BPF_OP(insn->code) == BPF_ADD...
9a34a59c6086ae731a06b3e61b0951feef758648
Analyze and fix the following issue in the Linux kernel code: wifi: ath10k: fix station lookup failure during disconnect
Problem Details: Recent commit [1] moved station statistics collection to an earlier stage of the disconnect flow. With this change in place, ath10k fails to resolve the station entry when handling a peer stats event triggered during disconnect, resulting in log messages such as: wlp58s0: deauthenticating from 74:1a:e...
```diff diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index ec8e91707f84..01f2d1fa9d7d 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -3,7 +3,7 @@ * Copyright (c) 2005-2011 Atheros Communications Inc. * C...
0ec4b904be72f78ba6ce6bb9a8aaf2eb6b9b1004
Analyze and fix the following issue in the Linux kernel code: wifi: ath12k: Create symlink for each radio in a wiphy
Problem Details: In single-wiphy design, when more than one radio is registered as a single-wiphy in the mac80211 layer, the following warnings are seen: 1. debugfs: File 'ath12k' in directory 'phy0' already present! 2. debugfs: File 'simulate_fw_crash' in directory 'pci-0000:57:00.0' already present! debugfs: File...
```diff diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index c31c47fb5a73..2519e2400d58 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -835,8 +835,6 @@ static int ath12k_core_soc_create(struct ath12k_base *ab) goto err...
af5708ed67fc562bc45fafbd0f95789c464c0105
Analyze and fix the following issue in the Linux kernel code: wifi: ath12k: Support channel change stats
Problem Details: Add support to request channel change stats from the firmware through HTT stats type 76. These stats give channel switch details like the channel that the radio changed to, its center frequency, time taken for the switch, chainmask details, etc. Sample output: echo 76 > /sys/kernel/debug/ath12k/pci-00...
```diff diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c index 7f6ca07fb335..b772181a496e 100644 --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c @@ -5722,6 +5722,75 @@ ath12k_htt_pri...
1870ddcd94b061f54613b90d6300a350f29fc2f4
Analyze and fix the following issue in the Linux kernel code: bpf: Prefer vmlinux symbols over module symbols for unqualified kprobes
Problem Details: When an unqualified kprobe target exists in both vmlinux and a loaded module, number_of_same_symbols() returns a count greater than 1, causing kprobe attachment to fail with -EADDRNOTAVAIL even though the vmlinux symbol is unambiguous. When no module qualifier is given and the symbol is found in vmlin...
```diff diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index a5dbb72528e0..058724c41c46 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -765,6 +765,14 @@ static unsigned int number_of_same_symbols(const char *mod, const char *func_nam if (!mod) kallsyms_on_each...
3df690bba28edec865cf7190be10708ad0ddd67e
Analyze and fix the following issue in the Linux kernel code: smb: client: fix OOB reads parsing symlink error response
Problem Details: When a CREATE returns STATUS_STOPPED_ON_SYMLINK, smb2_check_message() returns success without any length validation, leaving the symlink parsers as the only defense against an untrusted server. symlink_data() walks SMB 3.1.1 error contexts with the loop test "p < end", but reads p->ErrorId at offset 4...
```diff diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c index ed651c946251..b292aa94a593 100644 --- a/fs/smb/client/smb2file.c +++ b/fs/smb/client/smb2file.c @@ -27,10 +27,11 @@ static struct smb2_symlink_err_rsp *symlink_data(const struct kvec *iov) { struct smb2_err_rsp *err = iov->iov_base; str...
3d8b9d06bd3ac4c6846f5498800b0f5f8062e53b
Analyze and fix the following issue in the Linux kernel code: smb: client: fix off-by-8 bounds check in check_wsl_eas()
Problem Details: The bounds check uses (u8 *)ea + nlen + 1 + vlen as the end of the EA name and value, but ea_data sits at offset sizeof(struct smb2_file_full_ea_info) = 8 from ea, not at offset 0. The strncmp() later reads ea->ea_data[0..nlen-1] and the value bytes follow at ea_data[nlen+1..nlen+vlen], so the actual ...
```diff diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c index 364bdcff9c9d..fe1c9d776580 100644 --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -128,7 +128,7 @@ static int check_wsl_eas(struct kvec *rsp_iov) nlen = ea->ea_name_length; vlen = le16_to_cpu(ea->ea_value_length); ...
74b4dbb946060a3233604d91859a9abd3708141d
Analyze and fix the following issue in the Linux kernel code: gfs2: prevent NULL pointer dereference during unmount
Problem Details: When flushing out outstanding glock work during an unmount, gfs2_log_flush() can be called when sdp->sd_jdesc has already been deallocated and sdp->sd_jdesc is NULL. Commit 35264909e9d1 ("gfs2: Fix NULL pointer dereference in gfs2_log_flush") added a check for that to gfs2_log_flush() itself, but it m...
```diff diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 3a01d4e7667a..78bba8cc10b8 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -467,8 +467,9 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) { atomic_add(blks, &sdp->sd_log_blks_free); trace_gfs2_log_blocks(sdp, blks); - gfs2_assert_withdraw(...
bb47cce7a1eea1d9d165260328270ddc39e19526
Analyze and fix the following issue in the Linux kernel code: gfs2: gfs2_log_flush withdraw fixes
Problem Details: When a withdraw occurs in gfs2_log_flush() and we are left with an unsubmitted bio, fail that bio. Otherwise, the bh's in that bio will remain locked and gfs2_evict_inode() -> truncate_inode_pages() -> gfs2_invalidate_folio() -> gfs2_discard() will hang trying to discard the locked bh's. In addition,...
```diff diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index a96f9b9331e8..3a01d4e7667a 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -983,33 +983,38 @@ static void empty_ail1_list(struct gfs2_sbd *sdp) } } -static void gfs2_trans_drain_list(struct list_head *list) +static void gfs2_trans_drain_list(struct gfs2_sb...
fe2c8d051150b90b3ccb85f89e3b1d636cb88ec8
Analyze and fix the following issue in the Linux kernel code: gfs2: add some missing log locking
Problem Details: Function gfs2_logd() calls the log flushing functions gfs2_ail1_start(), gfs2_ail1_wait(), and gfs2_ail1_empty() without holding sdp->sd_log_flush_lock, but these functions require exclusion against concurrent transactions. To fix that, add a non-locking __gfs2_log_flush() function. Then, in gfs2_log...
```diff diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 31ee7a0e86a2..a96f9b9331e8 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -1053,14 +1053,15 @@ void gfs2_remove_from_journal(struct buffer_head *bh, int meta) } /** - * gfs2_log_flush - flush incore transaction(s) + * __gfs2_log_flush - flush incore transa...
f4e4c4e6acdc20a9065064dd164db52e2e0d44ad
Analyze and fix the following issue in the Linux kernel code: gfs2: fix address space truncation during withdraw
Problem Details: When a withdrawn filesystem's inodes are being evicted, the address spaces of those inodes still need to be truncated but we can no longer start new transactions. We still don't want gfs2_invalidate_folio() to race with gfs2_log_flush(), so take a read lock on sdp->sd_log_flush_lock in that case. (It ...
```diff diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 8397d34527a4..31ee7a0e86a2 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -1024,17 +1024,22 @@ void gfs2_remove_from_journal(struct buffer_head *bh, int meta) trace_gfs2_pin(bd, 0); atomic_dec(&sdp->sd_log_pinned); list_del_init(&bd->bd_list); - if (...
7596459f3c93d8d45a1bf12d4d7526b50c15baa2
Analyze and fix the following issue in the Linux kernel code: drm/xe: Fix bug in idledly unit conversion
Problem Details: We only need to convert to picosecond units before writing to RING_IDLEDLY. Fixes: 7c53ff050ba8 ("drm/xe: Apply Wa_16023105232") Cc: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com> Acked-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com> Signed-off-by: Vinay Belgaumkar <vi...
```diff diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c index 688d645e0e73..aa0b7a427f0b 100644 --- a/drivers/gpu/drm/xe/xe_hw_engine.c +++ b/drivers/gpu/drm/xe/xe_hw_engine.c @@ -595,9 +595,8 @@ static void adjust_idledly(struct xe_hw_engine *hwe) maxcnt *= maxcnt_units_ns; i...
679343977588781bd3effba79e9644aee4ee046c
Analyze and fix the following issue in the Linux kernel code: cpufreq/amd-pstate: Add POWER_SUPPLY select for dynamic EPP
Problem Details: The dynamic EPP feature uses power_supply_reg_notifier() and power_supply_unreg_notifier() but doesn't declare a dependency on POWER_SUPPLY, causing linker errors when POWER_SUPPLY is not enabled. Add POWER_SUPPLY to the selects. Suggested-by: K Prateek Nayak <kprateek.nayak@amd.com> Fixes: e30ca6dd5...
```diff diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index a0dbb9808ae9..027e6ea2e038 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 @@ -41,6 +41,7 @@ config X86_AMD_PSTATE select ACPI_CPPC_LIB if X86_64 select CPU_FREQ_GOV_SCHEDUTIL if SMP select ACPI_PLATFOR...
393754191b85b3f76d9cc44dda5209ef23337e8a
Analyze and fix the following issue in the Linux kernel code: sched_ext: Documentation: Fix scx_bpf_move_to_local kfunc name
Problem Details: The correct kfunc name is scx_bpf_dsq_move_to_local(), not scx_bpf_move_to_local(). Fix the two references in the Scheduling Cycle section. Signed-off-by: fangqiurong <fangqiurong@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
```diff diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst index 9f03650abfeb..ec594ae8086d 100644 --- a/Documentation/scheduler/sched-ext.rst +++ b/Documentation/scheduler/sched-ext.rst @@ -375,9 +375,9 @@ The following briefly shows how a waking task is scheduled and executed. ...
3cd181cc46d36aa7bd4af85f14639d86a25beaec
Analyze and fix the following issue in the Linux kernel code: btrfs: fix silent IO error loss in encoded writes and zoned split
Problem Details: can_finish_ordered_extent() and btrfs_finish_ordered_zoned() set BTRFS_ORDERED_IOERR via bare set_bit(). Later, btrfs_mark_ordered_extent_error() in btrfs_finish_one_ordered() uses test_and_set_bit(), finds it already set, and skips mapping_set_error(). The error is never recorded on the inode's addres...
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index d39f1c49d1cf..e5a24b3ff95e 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -386,7 +386,7 @@ static bool can_finish_ordered_extent(struct btrfs_ordered_extent *ordered, } if (!uptodate) - set_bit(BTRFS_ORDERED_IOERR...
3666dc0c47c399695d01fde7c36e08b14f834fa0
Analyze and fix the following issue in the Linux kernel code: ASoC: amd: ps: fix the pcm device numbering for acp pdm dmic
Problem Details: Fixed PCM device numbering is required for acp pdm dmic pcm device to have a common UCM changes. Set the 'use_dai_pcm_id' flag true in acp pdm dma driver for acp 6.3 platform. This will fix the pcm device numbering based on dai_link->id. Fixes: 33cea6bbe488 ("ASoC: amd: add acp6.2 pdm platform driver"...
```diff diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c index c6cd844d458c..04c014349347 100644 --- a/sound/soc/amd/ps/ps-pdm-dma.c +++ b/sound/soc/amd/ps/ps-pdm-dma.c @@ -352,6 +352,7 @@ static const struct snd_soc_component_driver acp63_pdm_component = { .hw_params = acp63_pdm_dma_hw_para...
f844177c6811fd322aa84ed5c32f0e39743446c2
Analyze and fix the following issue in the Linux kernel code: accel/amdxdna: Handle DETACH_DEBUG_BO through config_debug_bo path
Problem Details: Route DETACH_DEBUG_BO through aie2_config_debug_bo() the same way as ATTACH_DEBUG_BO. The scheduler switch in aie2_sched_job_run() already handles ATTACH_DEBUG_BO with aie2_config_debug_bo(), but DETACH_DEBUG_BO was not included in that path. Add an explicit fallthrough so both attach and detach opera...
```diff diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index 8db32f8e2362..f97755d60fa3 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -360,6 +360,7 @@ aie2_sched_job_run(struct drm_sched_job *sched_job) ret = aie2_sync_bo(hwctx, job, aie2_s...
3f487be81292702a59ea9dbc4088b3360a50e837
Analyze and fix the following issue in the Linux kernel code: btrfs: fix double free in create_space_info() error path
Problem Details: When kobject_init_and_add() fails, the call chain is: create_space_info() -> btrfs_sysfs_add_space_info_type() -> kobject_init_and_add() -> failure -> kobject_put(&space_info->kobj) -> space_info_release() -> kfree(space_info) Then control returns to create_space_info(): btrfs_sysfs_add_space_info_t...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 8278e7998bc9..f0436eea1544 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -320,7 +320,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) ret = btrfs_sysfs_add_space_info_type(space_info); if (ret) - ...
a7449edf96143f192606ec8647e3167e1ecbd728
Analyze and fix the following issue in the Linux kernel code: btrfs: fix double free in create_space_info_sub_group() error path
Problem Details: When kobject_init_and_add() fails, the call chain is: create_space_info_sub_group() -> btrfs_sysfs_add_space_info_type() -> kobject_init_and_add() -> failure -> kobject_put(&sub_group->kobj) -> space_info_release() -> kfree(sub_group) Then control returns to create_space_info_sub_group(), where: btr...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index e017bb182c8c..8278e7998bc9 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -287,10 +287,8 @@ static int create_space_info_sub_group(struct btrfs_space_info *parent, u64 flag sub_group->subgroup_id = id; ret = btrfs_sysfs_ad...
3c0c45a4dff73845ba93d41365fc14e45ee32bd7
Analyze and fix the following issue in the Linux kernel code: btrfs: do not reject a valid running dev-replace
Problem Details: [BUG] There is a bug report that a btrfs with running dev-replace got rejected with the following messages: BTRFS error (device sdk1): devid 0 path /dev/sdk1 is registered but not found in chunk tree BTRFS error (device sdk1): remove the above devices or use 'btrfs device scan --forget <dev>' to u...
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 33fa73668534..d8f2722311c8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -8667,7 +8667,12 @@ bool btrfs_verify_dev_items(const struct btrfs_fs_info *fs_info) mutex_lock(&uuid_mutex); list_for_each_entry(dev, &fs_info->fs_devices->dev...
48aa5c0e2bb85dae61a6cb405094eb135c711a04
Analyze and fix the following issue in the Linux kernel code: btrfs: only invalidate btree inode pages after all ebs are released
Problem Details: In close_ctree(), we call invalidate_inode_pages2() to invalidate all pages from btree inode. But the problem is, it never returns 0, but always -EBUSY. The problem is that we are still holding all the essential tree root nodes, thus pages holding those tree blocks can not be invalidated thus invalid...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index c835141ee384..14ce9bfc981b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4434,13 +4434,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info) btrfs_put_block_group_cache(fs_info); - /* - * we must make sure there is not any re...
b48c980b6a7e409050bb3067165db31cc6205e3e
Analyze and fix the following issue in the Linux kernel code: btrfs: fix deadlock between reflink and transaction commit when using flushoncommit
Problem Details: When using the flushoncommit mount option, we can have a deadlock between a transaction commit and a reflink operation that copied an inline extent to an offset beyond the current i_size of the destination node. The deadlock happens like this: 1) Task A clones an inline extent from inode X to an offs...
```diff diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c index fca00c0f5387..49865a463780 100644 --- a/fs/btrfs/reflink.c +++ b/fs/btrfs/reflink.c @@ -322,6 +322,51 @@ copy_to_page: ret = copy_inline_to_page(inode, new_key->offset, inline_data, size, datal, comp_type); + + /* + * If we copied the inline...
da08c02bc705694f51edb67b094f1e5db629c1e2
Analyze and fix the following issue in the Linux kernel code: btrfs: tree-checker: add checker for items in remap tree
Problem Details: Add write-time checking of items in the remap tree, to catch errors before they are written to disk. We're checking: * That remap items, remap backrefs, and identity remaps aren't written unless the REMAP_TREE incompat flag is set * That identity remaps have a size of 0 * That remap items and remap...
```diff diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index 495d1dd61e66..d5146ea8ff28 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -1879,6 +1879,71 @@ static int check_raid_stripe_extent(const struct extent_buffer *leaf, return 0; } +static int check_remap_key(const struc...
0e6a169c6487ca3a13d19a9ec6dc9673af5a1cf7
Analyze and fix the following issue in the Linux kernel code: btrfs: fix unnecessary flush on close when truncating zero-sized files
Problem Details: In btrfs_setsize(), when a file is truncated to size 0, the BTRFS_INODE_FLUSH_ON_CLOSE flag is unconditionally set to ensure pending writes get flushed on close. This flag was designed to protect the "truncate-then-rewrite" pattern, where an application truncates a file with existing data down to zero ...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8d97a8ad3858..1a4e6a9239ae 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5442,7 +5442,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) * zero. Make sure any new writes to the file get on disk * on close. */ - if...
973e57c726c1f8e77259d1c8e519519f1e9aea77
Analyze and fix the following issue in the Linux kernel code: btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak
Problem Details: btrfs_ioctl_space_info() has a TOCTOU race between two passes over the block group RAID type lists. The first pass counts entries to determine the allocation size, then the second pass fills the buffer. The groups_sem rwlock is released between passes, allowing concurrent block group removal to reduce ...
```diff diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a4d715bbed57..b2e447f5005c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2897,7 +2897,7 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info, return -ENOMEM; space_args.total_spaces = 0; - dest = kmalloc(alloc_size, GFP_KERN...
e35577706ec90791ac9a1379b3ef44591ad1a0f6
Analyze and fix the following issue in the Linux kernel code: btrfs: remove unused qgroup functions for pertrans reservation and freeing
Problem Details: They have no more users since commit a6496849671a ("btrfs: fix start transaction qgroup rsv double free"), so remove them. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h index a979fd59a4da..419f3c4120ce 100644 --- a/fs/btrfs/qgroup.h +++ b/fs/btrfs/qgroup.h @@ -397,14 +397,7 @@ int btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, enum...
6fc58dec5b83685dee058bf0e86effa8fff0c96a
Analyze and fix the following issue in the Linux kernel code: btrfs: use extent_io_tree_panic() instead of BUG_ON()
Problem Details: There's no need to call BUG_ON(), instead call extent_io_tree_panic(), which also calls BUG(), but it prints an additional error message with some useful information before hitting BUG(). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David...
```diff diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index 5972fe28716e..c2ede01f1762 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -395,7 +395,8 @@ static void set_state_bits(struct extent_io_tree *tree, btrfs_set_delalloc_extent(tree->inode, state, bits); ret =...
598c10a9e9e80d776f32a2174f6dced705b74178
Analyze and fix the following issue in the Linux kernel code: btrfs: turn extent_io_tree_panic() into a macro for better error reporting
Problem Details: When extent_io_tree_panic() is called we get a stace trace that is not very useful since the error message reports the location inside the extent_io_tree_panic() function and not in the caller of the function. Example: [ 7830.424291] BTRFS critical (device sdb): panic in extent_io_tree_panic:334: e...
```diff diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index 4ba916cb27ac..68e48b493950 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -326,15 +326,10 @@ static inline struct extent_state *tree_search(struct extent_io_tree *tree, u64 return tree_search_for_insert(tree, o...
232770bcf3aa65ae83fd7389961fa651f09f7b3a
Analyze and fix the following issue in the Linux kernel code: btrfs: check type flags in alloc_ordered_extent()
Problem Details: Unlike other flags used in btrfs, BTRFS_ORDERED_* macros are different as they cannot be directly used as flags. They are defined as bit values, thus they should be utilized with bit operations, not directly with logical operations. Unfortunately sometimes I forgot this and passed the incorrect flags...
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 8405d07b49cd..de6b60c52292 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -156,6 +156,19 @@ static struct btrfs_ordered_extent *alloc_ordered_extent( const bool is_nocow = (flags & ((1U << BTRFS_ORDERED_NOCOW)...
f04c6475c2db778e7a9657a7f7b4a5033c933ff1
Analyze and fix the following issue in the Linux kernel code: btrfs: revalidate cached tree blocks on the uptodate path
Problem Details: read_extent_buffer_pages_nowait() returns immediately when an extent buffer is already marked uptodate. On that cache-hit path, the caller supplied btrfs_tree_parent_check is not re-run. This can let read_tree_root_path() accept a cached tree block whose actual header level/owner does not match the ex...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 71e7ada95477..cdd6c1422b53 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1499,7 +1499,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p, reada_for_search(fs_info, p, parent_level, slot, key->objectid); /* first we ...
52e71eb95cc73e544f36041973bd3c4cd460a4fb
Analyze and fix the following issue in the Linux kernel code: btrfs: tree-checker: introduce checks for FREE_SPACE_INFO
Problem Details: Introduce checks for FREE_SPACE_INFO item, which include: - Key alignment check The objectid is the logical bytenr of the chunk/bg, and offset is the length of the chunk/bg, thus they should all be aligned to the fs block size. - Item size check The FREE_SPACE_INFO should a fix size. - Flags...
```diff diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index b4e114efff45..c4826b0484e6 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -1945,6 +1945,53 @@ static int check_dev_extent_item(const struct extent_buffer *leaf, return 0; } +static int check_free_space_info(struct e...
b6193a891653efcd8d6d39610ace204e157bed00
Analyze and fix the following issue in the Linux kernel code: btrfs: fix placement of unlikely() in btrfs_insert_one_raid_extent()
Problem Details: Fix the unlikely added to btrfs_insert_one_raid_extent() by commit a929904cf73b65 ("btrfs: add unlikely annotations to branches leading to transaction abort"): the exclamation point is in the wrong place, so we are telling the compiler that allocation failure is actually expected. Reviewed-by: Filipe ...
```diff diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 2987cb7c686e..638c4ad572c9 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -300,7 +300,7 @@ int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans, int ret; stripe_extent = kzalloc(item_si...
2e0e3716c7b6f8d71df2fbe709b922e54700f71b
Analyze and fix the following issue in the Linux kernel code: btrfs: do not mark inode incompressible after inline attempt fails
Problem Details: [BUG] The following sequence will set the file with nocompress flag: # mkfs.btrfs -f $dev # mount $dev $mnt -o max_inline=4,compress # xfs_io -f -c "pwrite 0 2k" -c sync $mnt/foobar The inode will have NOCOMPRESS flag, even if the content itself (all 0xcd) can still be compressed very well: i...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6daa7bb027fc..2ae5a9b2f951 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1061,6 +1061,12 @@ again: mapping_set_error(mapping, -EIO); return; } + /* + * If a single block at file offset 0 cannot be inlined, fall back to + * regular writ...
6fa972956830b17b0bf905a5b3da87517300dc0b
Analyze and fix the following issue in the Linux kernel code: btrfs: pass literal booleans to functions that take boolean arguments
Problem Details: We have several functions with parameters defined as booleans but then we have callers passing integers, 0 or 1, instead of false and true. While this isn't a bug since 0 and 1 are converted to false and true, it is odd and less readable. Change the callers to pass true and false literals instead. Sig...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index f2c925e90a87..b9004345cf3c 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -3887,7 +3887,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, goto err; } - ret = split_leaf(trans, root, &key, path, ins_len, 1); + r...
258e46a6385c57a3caef3fb1dc888e2efcfe5b18
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: move partially zone_unusable block groups to reclaim list
Problem Details: On zoned block devices, block groups accumulate zone_unusable space (space between the write pointer and zone end that cannot be allocated until the zone is reset). When a block group becomes mostly zone_unusable but still contains some valid data and it gets added to the unused_bgs list it can never b...
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index a021a6dab8f9..d0d7051d4417 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1613,6 +1613,24 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) spin_lock(&space_info->lock); spin_lock(&block_group->lock); +...
7bcb04de982ff0718870112ad9f38c35cbca528b
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: cap delayed refs metadata reservation to avoid overcommit
Problem Details: On zoned filesystems metadata space accounting can become overly optimistic due to delayed refs reservations growing without a hard upper bound. The delayed_refs_rsv block reservation is allowed to speculatively grow and is only backed by actual metadata space when refilled. On zoned devices this can ...
```diff diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 3766ff29fbbb..605858c2d9a9 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -207,6 +207,30 @@ void btrfs_dec_delayed_refs_rsv_bg_updates(struct btrfs_fs_info *fs_info) * This will refill the delayed block_rsv up to 1 items s...
883adb6dcff0f96dbbdb6488842a38b121ebd68c
Analyze and fix the following issue in the Linux kernel code: btrfs: fix the inline compressed extent check in inode_need_compress()
Problem Details: [BUG] Since commit 59615e2c1f63 ("btrfs: reject single block sized compression early"), the following script will result the inode to have NOCOMPRESS flag, meanwhile old kernels don't: # mkfs.btrfs -f $dev # mount $dev $mnt -o max_inline=2k,compress=zstd # truncate -s 8k $mnt/foobar # xfs_io -...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f643a0520872..a4ad37fd65fb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -811,7 +811,8 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start, * do not even bother try compression, as there will be no space saving * an...
574d93fc62e2b03ab39c8f92fb44ded89ca6274d
Analyze and fix the following issue in the Linux kernel code: btrfs: be less aggressive with metadata overcommit when we can do full flushing
Problem Details: Over the years we often get reports of some -ENOSPC failure while updating metadata that leads to a transaction abort. I have seen this happen for filesystems of all sizes and with workloads that are very user/customer specific and unable to reproduce, but Aleksandar recently reported a simple way to r...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 0bd671e90643..227178f8b589 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -492,10 +492,10 @@ static u64 calc_available_free_space(const struct btrfs_space_info *space_info, /* * If we aren't flushing all things, let us over...
52fead5eb8a743384bab24ca8c3695257c755f0f
Analyze and fix the following issue in the Linux kernel code: btrfs: introduce the device layout aware per-profile available space
Problem Details: [BUG] There is a long known bug that if metadata is using RAID1 on two disks with unbalanced sizes, there is a very high chance to hit ENOSPC related transaction abort. [CAUSE] The root cause is in the available space estimation code: - Factor based calculation Just use all unallocated space, divid...
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6b8e810a35ce..9eb07f48cf82 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -392,6 +392,7 @@ static struct btrfs_fs_devices *alloc_fs_devices(const u8 *fsid) INIT_LIST_HEAD(&fs_devs->alloc_list); INIT_LIST_HEAD(&fs_devs->fs_list); INIT_...
f3da62571ba25bf6c71076ee21420ed5257b84eb
Analyze and fix the following issue in the Linux kernel code: btrfs: remove duplicate system chunk array max size overflow check
Problem Details: We check it twice, once in validate_sys_chunk_array() and then again in its caller, btrfs_validate_super(), right after it calls validate_sys_chunk_array(). So remove the duplicated check from btrfs_validate_super(). Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1b0eb246b714..1b5fa0681331 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2545,12 +2545,6 @@ int btrfs_validate_super(const struct btrfs_fs_info *fs_info, * Obvious sys_chunk_array corruptions, it must hold at least one key * and one...
f433fd3fa275e52fc1c7107e8aa57f1d037ee341
Analyze and fix the following issue in the Linux kernel code: selftests/landlock: Check that coredump sockets stay unrestricted
Problem Details: Even when a process is restricted with the new LANDLOCK_ACCESS_FS_RESOLVE_UNIX right, the kernel can continue writing its coredump to the configured coredump socket. In the test, we create a local server and rewire the system to write coredumps into it. We then create a child process within a Landloc...
```diff diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index 3dad643741f7..af0f0b16129a 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -22,6 +22,7 @@ #include <sys/ioctl.h> #include <sys/mount.h> #inclu...
ae97330d1bd6a97646c2842d117577236cb40913
Analyze and fix the following issue in the Linux kernel code: landlock: Control pathname UNIX domain socket resolution by path
Problem Details: * Add a new access right LANDLOCK_ACCESS_FS_RESOLVE_UNIX, which controls the lookup operations for named UNIX domain sockets. The resolution happens during connect() and sendmsg() (depending on socket type). * Change access_mask_t from u16 to u32 (see below) * Hook into the path lookup in unix_f...
```diff diff --git a/Documentation/security/landlock.rst b/Documentation/security/landlock.rst index 3e4d4d04cfae..c5186526e76f 100644 --- a/Documentation/security/landlock.rst +++ b/Documentation/security/landlock.rst @@ -7,7 +7,7 @@ Landlock LSM: kernel documentation ================================== :Author: Mi...
eb25e202b3d60cdc239f14e0e5f6f7465fcc506c
Analyze and fix the following issue in the Linux kernel code: lsm: Add LSM hook security_unix_find
Problem Details: Add an LSM hook security_unix_find. This hook is called to check the path of a named UNIX socket before a connection is initiated. The peer socket may be inspected as well. Why existing hooks are unsuitable: Existing socket hooks, security_unix_stream_connect(), security_unix_may_send(), and securit...
```diff diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h index 8c42b4bde09c..7a0fd3dbfa29 100644 --- a/include/linux/lsm_hook_defs.h +++ b/include/linux/lsm_hook_defs.h @@ -317,6 +317,11 @@ LSM_HOOK(int, 0, post_notification, const struct cred *w_cred, LSM_HOOK(int, 0, watch_key, struct key *...
64617ec0339f3f52accf5614bc918a940a503f7a
Analyze and fix the following issue in the Linux kernel code: landlock: Fix kernel-doc warning for pointer-to-array parameters
Problem Details: The insert_rule() and create_rule() functions take a pointer-to-flexible-array parameter declared as: const struct landlock_layer (*const layers)[] The kernel-doc parser cannot handle a qualifier between * and the parameter name in this syntax, producing spurious "Invalid param" and "not described"...
```diff diff --git a/security/landlock/ruleset.c b/security/landlock/ruleset.c index 3234a5bc11ff..181df7736bb9 100644 --- a/security/landlock/ruleset.c +++ b/security/landlock/ruleset.c @@ -107,7 +107,7 @@ static bool is_object_pointer(const enum landlock_key_type key_type) static struct landlock_rule * create_rul...
aba1de96e80a26648a8e3b593a106041e3e1e2a1
Analyze and fix the following issue in the Linux kernel code: landlock: Fix formatting in tsync.c
Problem Details: Fix comment formatting in tsync.c to fit in 80 columns. Cc: Günther Noack <gnoack@google.com> Reviewed-by: Günther Noack <gnoack3000@gmail.com> Link: https://lore.kernel.org/r/20260304193134.250495-4-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
```diff diff --git a/security/landlock/tsync.c b/security/landlock/tsync.c index 64ca3ad4b5a0..c5730bbd9ed3 100644 --- a/security/landlock/tsync.c +++ b/security/landlock/tsync.c @@ -85,12 +85,14 @@ static void restrict_one_thread(struct tsync_shared_context *ctx) /* * Switch out old_cred with new_cred, if possi...
fa20aeb95d72da9dd78a3c9b24e996b5d9219888
Analyze and fix the following issue in the Linux kernel code: landlock: Improve kernel-doc "Return:" section consistency
Problem Details: The canonical kernel-doc form is "Return:" (singular, without trailing "s"). Normalize all existing "Returns:" occurrences across the Landlock source tree to the canonical form. Also fix capitalization for consistency. Balance descriptions to describe all possible returned values. Consolidate bulle...
```diff diff --git a/security/landlock/cred.h b/security/landlock/cred.h index c10a06727eb1..f287c56b5fd4 100644 --- a/security/landlock/cred.h +++ b/security/landlock/cred.h @@ -115,7 +115,7 @@ static inline bool landlocked(const struct task_struct *const task) * @handle_layer: returned youngest layer handling a sub...
e89dea254dce44c629d98639c05fe5ca7add7241
Analyze and fix the following issue in the Linux kernel code: landlock: Add missing kernel-doc "Return:" sections
Problem Details: The kernel-doc -Wreturn check warns about functions with documentation comments that lack a "Return:" section. Add "Return:" documentation to all functions missing it so that kernel-doc -Wreturn passes cleanly. Convert existing function descriptions into a formal "Return:" section. Also fix the inacc...
```diff diff --git a/security/landlock/domain.c b/security/landlock/domain.c index f0d83f43afa1..7bf6296162b0 100644 --- a/security/landlock/domain.c +++ b/security/landlock/domain.c @@ -114,6 +114,8 @@ static struct landlock_details *get_current_details(void) * restriction. The subjective credentials must not be in...
a060ac0b8c3345639f5f4a01e2c435d34adf7e3d
Analyze and fix the following issue in the Linux kernel code: selftests/landlock: Fix format warning for __u64 in net_test
Problem Details: On architectures where __u64 is unsigned long (e.g. powerpc64), using %llx to format a __u64 triggers a -Wformat warning because %llx expects unsigned long long. Cast the argument to unsigned long long. Cc: Günther Noack <gnoack@google.com> Cc: stable@vger.kernel.org Fixes: a549d055a22e ("selftests/l...
```diff diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c index b34b139b3f89..4c528154ea92 100644 --- a/tools/testing/selftests/landlock/net_test.c +++ b/tools/testing/selftests/landlock/net_test.c @@ -1356,7 +1356,7 @@ TEST_F(mini, network_access_rights) &...
07c2572a87573b2a2f0fd6b9f538cd1aeef2eee7
Analyze and fix the following issue in the Linux kernel code: selftests/landlock: Skip stale records in audit_match_record()
Problem Details: Domain deallocation records are emitted asynchronously from kworker threads (via free_ruleset_work()). Stale deallocation records from a previous test can arrive during the current test's deallocation read loop and be picked up by audit_match_record() instead of the expected record, causing a domain I...
```diff diff --git a/tools/testing/selftests/landlock/audit.h b/tools/testing/selftests/landlock/audit.h index 74e1c3d763be..834005b2b0f0 100644 --- a/tools/testing/selftests/landlock/audit.h +++ b/tools/testing/selftests/landlock/audit.h @@ -249,9 +249,9 @@ static __maybe_unused char *regex_escape(const char *const sr...