id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
4b8c63c6a2811c23995c5d8cc8bb63d26caab299
Analyze and fix the following issue in the Linux kernel code: dt-bindings: vendor-prefixes: Add Verbatim Corporation
Problem Details: Verbatim Corporation has manufactured a few electronics items over the years. Link: https://en.wikipedia.org/wiki/Verbatim_(company) Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
```diff diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 28784d66ae7b..5a043ad75cb1 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1783,6 +1783,8 @@ pat...
23add15a3f66ace513e3b8b3f434d135d33b2e7b
Analyze and fix the following issue in the Linux kernel code: wifi: cfg80211: use strscpy in cfg80211_wext_giwname
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/p...
```diff diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index c3aa56977243..5dbf3ef4b257 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -16,6 +16,7 @@ #include <linux/if_arp.h> #include <linux/etherdevice.h> #include <linux/slab.h> +#include <linux/string.h> #includ...
f1a389fcc3f13a00c1202b0f63e073a2054184cc
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: fix channel evacuation logic
Problem Details: When we try to assign a chanctx to a link, if ieee80211_find_or_create_chanctx() failed, we try to evacuate a NAN channel and call it again. This logic is broken: In case there are not enough chanctxs we will fail earlier, when we check ieee80211_check_combinations(). To fix this, do the following in...
```diff diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index c64a99131954..23d46cd57137 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -2216,6 +2216,64 @@ ieee80211_find_or_create_chanctx(struct ieee80211_sub_if_data *sdata, assign_on_failure, radio_idx); } +static bool +ieee80211_na...
847f7ead7bdcd6ef4aef12fb1efbd4bf276d0a13
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211_hwsim: add debug messages for link changes
Problem Details: It's useful to be able to see the link addresses when the interface links change, so add some prints to hwsim for the vif link change callback. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Benjamin Berg <benjamin.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.koren...
```diff diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c index 1512e160e41a..6ea082157307 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c @@ -3534,8 +3534,13 @@ static int mac8021...
f31ce7e3154487ec1957b10b620b396b25760b82
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: add KUnit coverage for negotiated TTLM parser
Problem Details: Add KUnit coverage for ieee80211_parse_neg_ttlm() to lock the sparse link_map_presence layout against future regressions. The sparse_presence_no_oob_read case crafts a negotiated TTLM element with link_map_presence = BIT(0) | BIT(7) and bm_size = 2 in a buffer sized exactly to the validated element le...
```diff diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index fc4424b125c1..1360522649c2 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2926,6 +2926,10 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, struct ieee80211_chan_req *chanreq, ...
17065203e1bc7e7f2786998d532cd93a06265156
Analyze and fix the following issue in the Linux kernel code: ALSA: hda/realtek:ALC269 fixup for Yoga Pro 7 15ASH11 mic mute LED
Problem Details: Lenovo Yoga Pro 7 15ASH11 with AMD RYZEN AI MAX+ 388 (Strix Halo, ACP 7.0) uses Realtek ALC287 series codec. The ALC269_FIXUP_LENOVO_XPAD_ACPI in alc269_fixup_vendor_tbl[] can load lenovo_wmi_hotkey_utilities module by default in this laptop, but the driver doesn't control mic mute LED. If users run b...
```diff diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c index cd7818fea7a1..40471aa1976d 100644 --- a/sound/hda/codecs/realtek/alc269.c +++ b/sound/hda/codecs/realtek/alc269.c @@ -4088,6 +4088,7 @@ enum { ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, ALC298_FIXUP_LENOVO_C940_DUET7, ALC287_...
8df560fefe6fed6a20b7e06720eeaeccec349ac0
Analyze and fix the following issue in the Linux kernel code: ALSA: aoa: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. In layout.c, the function does not check the return value before dereferencing ctl->id.name or passing to aoa_snd_ctl_add(), which can lead to a NULL pointer dereference. Add NULL checks after snd_ctl_new1() calls and return early if any fai...
```diff diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index c3ebb6de4789..7bb541577a26 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c @@ -948,6 +948,8 @@ static void layout_attached_codec(struct aoa_codec *codec) if (lineout == 1) ldev->gpio.methods->set_lineout...
c205bd1b28fb7e5f1061a4e78813fad7d315cb3e
Analyze and fix the following issue in the Linux kernel code: ALSA: cmipci: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. snd_cmipci_spdif_controls() does not check the return value before dereferencing kctl->id.device, which can lead to a NULL pointer dereference. Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any fails. Assisted-by: Opencod...
```diff diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index f5382b10865a..9d9f784e3a8c 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -2637,16 +2637,22 @@ static int snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device) } if (cm->can_ac3_hw) { kctl = snd_ctl_new1(&snd_cmipci_spdif_...
e64d170346d00b580c0043de3e5ccb3e331c47d4
Analyze and fix the following issue in the Linux kernel code: ALSA: ymfpci: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. snd_ymfpci_create_spdif_controls() does not check the return value before dereferencing kctl->id.device, which can lead to a NULL pointer dereference. Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any fails. Assisted-by: ...
```diff diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index b9a09568afc9..2ccb976e68e0 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -1781,16 +1781,22 @@ int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch) if (snd_BUG_ON(!chip->pcm_spdif)...
2b929b91b0f3bc6de8a844370049cd99ee8e31ff
Analyze and fix the following issue in the Linux kernel code: ALSA: ice1712: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. The ice1712 driver calls snd_ctl_new1() without checking the return value before dereferencing the pointer in multiple places (ice1712.c, ice1724.c, aureon.c), which can lead to NULL pointer dereferences. Add NULL checks after snd_ctl_new1()...
```diff diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 1191a2686dfd..d6abff2978f3 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -1891,6 +1891,8 @@ static int aureon_add_controls(struct snd_ice1712 *ice) for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) { ...
c7fa99d30c7a166a5e5db5a585ce7501ff68326b
Analyze and fix the following issue in the Linux kernel code: ALSA: gus: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. snd_gf1_pcm_volume_control() does not check the return value before dereferencing kctl->id.index, which can lead to a NULL pointer dereference. Add a NULL check after snd_ctl_new1() and return -ENOMEM if it fails. Assisted-by: Opencode:Deep...
```diff diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index a0757e1ede46..08ccb4d80ade 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -851,6 +851,8 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control1...
1edd1f02dddd20aeb6066ded41017615766ea42f
Analyze and fix the following issue in the Linux kernel code: ALSA: es1938: check snd_ctl_new1() return value
Problem Details: snd_ctl_new1() can return NULL when memory allocation fails. snd_es1938_mixer() does not check the return value before dereferencing the pointer, which can lead to a NULL pointer dereference. Add a NULL check after snd_ctl_new1() and return -ENOMEM if it fails. Assisted-by: Opencode:DeepSeek-V4-Flash...
```diff diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index f4c7a9532f4a..217beb9376ac 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1655,6 +1655,8 @@ static int snd_es1938_mixer(struct es1938 *chip) for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) { struct snd_kcontrol *kctl; k...
80b0d3546ce18c5bbae7cebec014beb2fbe81580
Analyze and fix the following issue in the Linux kernel code: iommu: vsi: avoid -Wformat-security warning
Problem Details: When -Wformat-security is enabled, it catches a call to iommu_device_sysfs_add() that passes a string variable in place of a format: drivers/iommu/vsi-iommu.c: In function 'vsi_iommu_probe': drivers/iommu/vsi-iommu.c:717:9: error: format not a string literal and no format arguments [-Werror=format-sec...
```diff diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c index 5d0721bd2c7a..23913720d484 100644 --- a/drivers/iommu/vsi-iommu.c +++ b/drivers/iommu/vsi-iommu.c @@ -714,7 +714,8 @@ static int vsi_iommu_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(dev); pm_runtime_enable(dev); -...
283d245468a2b61c41aa8b582f25ed5615d1c304
Analyze and fix the following issue in the Linux kernel code: iommu/amd: Fix premature break in init_iommu_one()
Problem Details: In init_iommu_one(), when processing IOMMU EFR attributes, the code checks whether GASUP is enabled. If GASUP is not enabled, the code falls back to legacy guest IR mode and then breaks out of the switch statement. This break incorrectly skips the subsequent initialization steps that follow the GASUP ...
```diff diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 16073b5614b9..a7dfbd515863 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -1917,12 +1917,11 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h, /* XT and GAM require GA mode. */ ...
3470274dca4887e2b56684bd6a482097318d95a5
Analyze and fix the following issue in the Linux kernel code: drm/exynos: fix size_t format string
Problem Details: The exynos_gem->base.size argument is a size_t rather than an unsigned long, so adapt the printk() format string accordingly: In file included from drivers/gpu/drm/exynos/exynos_drm_gem.c:16: drivers/gpu/drm/exynos/exynos_drm_gem.c: In function 'exynos_drm_alloc_buf': drivers/gpu/drm/exynos/exynos_drm...
```diff diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index d9d42809a1a9..9a6270f3dca6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -66,8 +66,8 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem, ...
4178de898c341e6c259851a2be1c7649ac4f40ad
Analyze and fix the following issue in the Linux kernel code: platform/chrome: cros_ec_chardev: Introduce rwsem for protecting ec_dev
Problem Details: Introduce a rwsem for protecting `ec_dev` to prevent Use-After-Free on the `ec_dev`. - Writers: In driver's probe() and remove(). - Readers: In file operations. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20260525052654.4076429-5-tzungbi@kernel.org Signed-off-by: Tzu...
```diff diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index 7e046fc56998..47e03014dcbe 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -23,6 +23,7 @@ #include <linux/platform_data/cros_ec_proto.h> #include <...
9b85fe7e7b0f347a1d39984c086d9ba3d1aa39fa
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix/unify peakbw calculations
Problem Details: We have several copies of the same memory peak bandwidth calculations, and the rounding directions are all over the place in some of them. Unify it all into one small function (with rounding matching what Bspec says). Note that 'channel_width' is always a multiple of 8 anyway, so for 'channel_width / ...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 6ebf33e6e343..f1af6f2f7d4c 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -578,6 +578,11 @@ static int icl_get_bw_info(struct intel_display *display, retu...
7ceffa346ee993796cb207a60b8d33e9674c80e6
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix DEPROGBWPCLIMIT handling on BMG
Problem Details: DEPROGBWPCLIMIT is specified in %, so divide by 100 instead of 10. Fortunately the deprobbwlimit is much lower than the peak memory bandwidth on BMG, so whether we take 60% or 600% of the peak bandwidth doesn't matter as the min() will pick the lower deprobbwlimit anyway. Eg. on the BMG here I get (w...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 53e83eb1a425..6ebf33e6e343 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -738,7 +738,7 @@ static int xe2_hpd_get_bw_info(struct intel_display *display, }...
ee0421aad3273b29151461bf684c492581dcbb27
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix rounding direction in clperchgroup calculation
Problem Details: The '8/num_channels' in the clperchgroup is supposed to be rounded down according to the spec. Make it so. Not sure we can ever actually have a non-power of two number of channels, so this might not matter. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 65f626b1a90e..53e83eb1a425 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -624,7 +624,7 @@ static int tgl_get_bw_info(struct intel_display *display, * cl...
67309d7fbe2084d5470e46754be9e4ff26068d34
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix 'deinterleave' rounding direction
Problem Details: For some reason we're rounding up when calculating the deinterleave value. But the spec says we should round down. Fix it. But I suppose this doesn't actually matter since the deinterleave values should always be power of two. The only exception is therefore the deinterleave==1 case, which gets handle...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 76aab2965858..65f626b1a90e 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -607,7 +607,7 @@ static int tgl_get_bw_info(struct intel_display *display, qi.de...
615b23a7d2a8e75a48ed04c6ff129809a817cf3a
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix bw rounding direction
Problem Details: The DRAM bandwidth value should be rounded down, not up. Bspec: 64631 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260522200346.17377-4-ville.syrjala@linux.intel.com Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> Reviewed-by: Vinod Govindapillai...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 0530eb68aade..76aab2965858 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -555,7 +555,7 @@ static int icl_get_bw_info(struct intel_display *display, */...
1f0d572b27ad43982bbba9854513311f1cfa55eb
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix DCLK rounding mess
Problem Details: Fix up the total mess when calculating the DCLK frequency. Some codepaths are trying to do both DIV_ROUND_UP() and an open coded "round to nearest" at the same time. The MTL+ codepath was the only one that was correct (using DIV_ROUND_CLOSEST()). Let's unify all of them, and borrow the actual '100/6' ...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index c7b59cad176a..0530eb68aade 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -67,25 +67,31 @@ struct intel_qgv_info { u8 deinterleave; }; +static int dclk...
85bfe1cec2d1fb67db2bd8603df391466f4ae29f
Analyze and fix the following issue in the Linux kernel code: drm/i915/bw: Fix num_planes handling on TGL+
Problem Details: The TGL+ bw code has an off by one error on the num_planes calculation, and tgl_max_bw_index() incorrectly bumps the num_planes to 1 from 0. That approach made sense on ICL where num_planes is more or less a minimum number of planes to consider for the group, but on TGL+ num_planes really is a maximum...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index d5aac5abea6f..c7b59cad176a 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -636,8 +636,7 @@ static int tgl_get_bw_info(struct intel_display *display, bi_...
9d5e7a46a9f6d8f503b41bfefef70659845f1679
Analyze and fix the following issue in the Linux kernel code: ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
Problem Details: ipv6_rpl_srh_decompress() computes: outhdr->hdrlen = (((n + 1) * sizeof(struct in6_addr)) >> 3); hdrlen is __u8. For n >= 127 the result exceeds 255 and silently truncates. With n=127 (cmpri=15, cmpre=15, pad=0, hdrlen=16): (128 * 16) >> 3 = 256, truncated to 0 as __u8 The caller in ipv6_rp...
```diff diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index aca2a2abd2df..43f46ef9c53b 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c @@ -548,7 +548,7 @@ looped_back: * unsigned char which is segments_left field. Should not be * higher than that. */ - if (r || (n + 1) > 255) { + if (r || (n + ...
2ed72677a5c1025edb1398bbfda0f558ee19b4df
Analyze and fix the following issue in the Linux kernel code: KVM: x86/pmu: Disable counters based on Host-Only/Guest-Only bits in SVM
Problem Details: Introduce an optional per-vendor PMU callback for checking if a counter is disabled in the current mode, and register a callback on AMD to disable a counter based on the vCPU's setting of Host-Only or Guest-Only EVENT_SELECT bits with the mediated PMU. If EFER.SVME is set, all events are counted if bo...
```diff diff --git a/arch/x86/include/asm/kvm-x86-pmu-ops.h b/arch/x86/include/asm/kvm-x86-pmu-ops.h index 0616243c84cf..4a223c2793e3 100644 --- a/arch/x86/include/asm/kvm-x86-pmu-ops.h +++ b/arch/x86/include/asm/kvm-x86-pmu-ops.h @@ -24,6 +24,7 @@ KVM_X86_PMU_OP(init) KVM_X86_PMU_OP_OPTIONAL(reset) KVM_X86_PMU_OP_OP...
103cd7deda589c47f10cdf0f65cae21dbca35b9c
Analyze and fix the following issue in the Linux kernel code: KVM: x86/pmu: Rename reprogram_counters() to clarify usage
Problem Details: Rename reprogram_counters() to kvm_pmu_request_counters_reprogram() clarifying that it is more similar to kvm_pmu_request_counter_reprogram(), and less similar to reprogram_counter(). The kvm_pmu_* prefix is also appropriate as the function is exposed in the header. Opportunistically rename the argume...
```diff diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index d6ac3c55fce5..afbc731e7217 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -889,7 +889,7 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) if (pmu->global_ctrl != data) { diff = pmu->global_ctrl ^ data; pmu-...
42ff88db18a5a42f619eab1d862e04e6505e8ee6
Analyze and fix the following issue in the Linux kernel code: KVM: nSVM: Bail early out of VMRUN emulation if advancing RIP fails
Problem Details: If svm_skip_emulation_instruction() fails, then RIP could not be advanced correctly (e.g. decode failure when NextRIP is not available). KVM will exit to userspace to handle the emulation failure, but only after stuffing the wrong RIP into vmcb01 and entering guest mode. Bail early and exit to userspa...
```diff diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index a7ed06d88697..6e26c8e1b771 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1154,9 +1154,10 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) * FIXME: If TF is set on VMRUN should inject a #DB (or handle guest ...
8862376260c4a19329c8ba8b31d2e12510d2401d
Analyze and fix the following issue in the Linux kernel code: KVM: nSVM: Stop leaking single-stepping on VMRUN into L2
Problem Details: According to the APM, TF on VMRUN causes a #DB after VMRUN completes on the _host_ side. However, KVM injects a #DB in L2 context instead (or exits to userspace if KVM_GUESTDBG_SINGLESTEP is set) in kvm_skip_emulated_instruction(). Avoid single-step handling on VMRUN by open-coding the rest of kvm_ski...
```diff diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index b326420ac883..a7ed06d88697 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -30,6 +30,7 @@ #include "lapic.h" #include "svm.h" #include "hyperv.h" +#include "pmu.h" #define CC KVM_NESTED_VMENTER_CONSISTENCY_C...
e08f0ea6daf2e5ffdb38844460bfd2db3b091015
Analyze and fix the following issue in the Linux kernel code: net: phy: Rename Airoha common BuckPBus register accessors
Problem Details: Rename the BuckPBus register accessors functions present in air_phy_lib and their calls in air_en8811h driver, so all exported functions start with the same prefix. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> Link: https://patch.msgid...
```diff diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c index 2498bd3f7993..a42898ae4135 100644 --- a/drivers/net/phy/air_en8811h.c +++ b/drivers/net/phy/air_en8811h.c @@ -287,8 +287,8 @@ static int en8811h_wait_mcu_ready(struct phy_device *phydev) { int ret, reg_value; - ret = air_buckp...
27db54b90bcc7c37867fe664107fa25ea6a116e4
Analyze and fix the following issue in the Linux kernel code: net/sched: cls_bpf: prevent unbounded recursion in offload rollback
Problem Details: Quan Sun reported [1] a stack overflow in cls_bpf_offload_cmd(). Reproducer on netdevsim: add a skip_sw cls_bpf filter, set the bpf_tc_accept debugfs knob to 0, then `tc filter replace`. The replace calls tc_setup_cb_replace() which fails. cls_bpf_offload_cmd() then swaps prog/oldprog and recursively ...
```diff diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 9a346b6221b3..001d8c4ebfed 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c @@ -142,7 +142,8 @@ static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog) static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, ...
67cfdd9210b99f260b3e0afeb9525e0acc7be31e
Analyze and fix the following issue in the Linux kernel code: ethtool: eeprom: add more safeties to EEPROM Netlink fallback
Problem Details: The Netlink fallback path for reading module EEPROM (fallback_set_params()) validates that offset < eeprom_len, but does not check that offset + length stays within eeprom_len. The ioctl equivalent (ethtool_get_any_eeprom() in ioctl.c) has always enforced both bounds: if (eeprom.offset + eeprom.len ...
```diff diff --git a/net/ethtool/eeprom.c b/net/ethtool/eeprom.c index 836316df3092..0b8cfeddb014 100644 --- a/net/ethtool/eeprom.c +++ b/net/ethtool/eeprom.c @@ -44,6 +44,9 @@ static int fallback_set_params(struct eeprom_req_info *request, if (offset >= modinfo->eeprom_len) return -EINVAL; + if (length > modinf...
2376586f85f972fefe701f095bb37dcfe7405d21
Analyze and fix the following issue in the Linux kernel code: ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback
Problem Details: All ethtool driver op calls should be sandwiched between ethnl_ops_begin() / ethnl_ops_complete(). In Netlink eeprom code, if the paged access failed we fall back to old API, but we first call _complete() and the fallback never does its own ethnl_ops_begin(). Move the fallback into the _begin() / _comp...
```diff diff --git a/net/ethtool/eeprom.c b/net/ethtool/eeprom.c index a557e3996c85..836316df3092 100644 --- a/net/ethtool/eeprom.c +++ b/net/ethtool/eeprom.c @@ -141,12 +141,11 @@ static int eeprom_prepare_data(const struct ethnl_req_info *req_base, return 0; err_ops: + if (ret == -EOPNOTSUPP) + ret = eeprom_fal...
a8d8bef6b45bf7cc0b1f6110c5cd8d0160a9bad7
Analyze and fix the following issue in the Linux kernel code: ethtool: strset: fix header attribute index in ethnl_req_get_phydev()
Problem Details: strset_prepare_data() passes ETHTOOL_A_HEADER_FLAGS (3) as the header attribute to ethnl_req_get_phydev(). This is incorrect, in the main attr space 3 is ETHTOOL_A_STRSET_COUNTS_ONLY, not the request header attr. The correct constant is ETHTOOL_A_STRSET_HEADER (1). ethnl_req_get_phydev() only uses thi...
```diff diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c index bb1e829ba099..94c4718d31ae 100644 --- a/net/ethtool/strset.c +++ b/net/ethtool/strset.c @@ -311,7 +311,7 @@ static int strset_prepare_data(const struct ethnl_req_info *req_base, return 0; } - phydev = ethnl_req_get_phydev(req_base, tb, ETHTOO...
c3fc9976f686f9a95baf87db9d387f218fd65394
Analyze and fix the following issue in the Linux kernel code: ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure
Problem Details: The goto err label leads to: genlmsg_cancel(skb, ehdr); return ret; If ethnl_tsinfo_prepare_dump() failed, it has not started a genlmsg. There's nothing to cancel, and passing an error pointer to genlmsg_cancel() would cause a crash. Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to su...
```diff diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c index f54fe6b662b2..14bf01e3b55c 100644 --- a/net/ethtool/tsinfo.c +++ b/net/ethtool/tsinfo.c @@ -407,10 +407,8 @@ static int ethnl_tsinfo_dump_one_netdev(struct sk_buff *skb, continue; ehdr = ethnl_tsinfo_prepare_dump(skb, dev, reply_data, cb); ...
1de405699c62c3a9544bcdcfb9eff8a01cfc7582
Analyze and fix the following issue in the Linux kernel code: ethtool: tsinfo: fix uninitialized stats on the by-PHC path
Problem Details: tsinfo_prepare_data() has two code paths: a "by-PHC" path for user-specified hardware timestamping providers, and the old path. Commit 89e281ebff72 ("ethtool: init tsinfo stats if requested") added ethtool_stats_init() to mark stat slots as ETHTOOL_STAT_NOT_SET before the driver callback populates them...
```diff diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c index a865f0fdd26b..f54fe6b662b2 100644 --- a/net/ethtool/tsinfo.c +++ b/net/ethtool/tsinfo.c @@ -83,6 +83,11 @@ tsinfo_parse_request(struct ethnl_req_info *req_base, if (!tb[ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER]) return 0; + if (req_base->flags & ET...
6386bd772de64e6760306eb91c7e86163af6c22f
Analyze and fix the following issue in the Linux kernel code: ethtool: tsconfig: fix missing ethnl_ops_complete()
Problem Details: tsconfig_prepare_data() calls ethnl_ops_begin(), we need to call ethnl_ops_complete() before returning the error. Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config") Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: Kory Maincent <kory....
```diff diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c index e9db4ee2299d..fc4f93cfa459 100644 --- a/net/ethtool/tsconfig.c +++ b/net/ethtool/tsconfig.c @@ -69,8 +69,10 @@ static int tsconfig_prepare_data(const struct ethnl_req_info *req_base, if (ret) goto out; - if (ts_info.phc_index == -1) - ...
ab5bf428fb6bd361163c7247b92750d1d24ca2ed
Analyze and fix the following issue in the Linux kernel code: ethtool: pse-pd: fix missing ethnl_ops_complete()
Problem Details: pse_prepare_data() is missing ethnl_ops_complete() if ethnl_req_get_phydev() returned an error. Move getting phydev up so that we don't have to worry about this (similar order to linkstate_prepare_data()). Note that phydev may still be NULL (this is checked in pse_get_pse_attributes()), the goal isn't...
```diff diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c index 2eb9bdc2dcb9..757c9e0cc856 100644 --- a/net/ethtool/pse-pd.c +++ b/net/ethtool/pse-pd.c @@ -62,14 +62,14 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base, struct phy_device *phydev; int ret; - ret = ethnl_ops_begin(dev); - ...
596c51ed9e125b12c4d85b4530dfd4c7847634b7
Analyze and fix the following issue in the Linux kernel code: ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error
Problem Details: linkstate_prepare_data() calls ethnl_req_get_phydev() before ethnl_ops_begin(), but routes its error path through "goto out" which calls ethnl_ops_complete(). Fixes: fe55b1d401c6 ("ethtool: linkstate: migrate linkstate functions to support multi-PHY setups") Reviewed-by: Maxime Chevallier <maxime.chev...
```diff diff --git a/net/ethtool/linkstate.c b/net/ethtool/linkstate.c index 8a5985fd7712..24569e92942c 100644 --- a/net/ethtool/linkstate.c +++ b/net/ethtool/linkstate.c @@ -106,10 +106,8 @@ static int linkstate_prepare_data(const struct ethnl_req_info *req_base, phydev = ethnl_req_get_phydev(req_base, tb, ETHTOOL...
a888bbd43940cada72f7686337741ce86d1cf869
Analyze and fix the following issue in the Linux kernel code: ethtool: tsconfig: fix reply error handling
Problem Details: A couple of trivial bugs in error handling in tsconfig_send_reply(). If we failed to allocate rskb we need to set the error. If we did allocate it but failed to send it - we need to remember to free it. Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config") R...
```diff diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c index e4f518e49d4c..e9db4ee2299d 100644 --- a/net/ethtool/tsconfig.c +++ b/net/ethtool/tsconfig.c @@ -224,16 +224,21 @@ static int tsconfig_send_reply(struct net_device *dev, struct genl_info *info) reply_len = ret + ethnl_reply_header_size(); rsk...
7281b096b072f6c6e30420e3467d738f2e4c4b57
Analyze and fix the following issue in the Linux kernel code: ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES
Problem Details: ethnl_update_profile() walks the ETHTOOL_A_PROFILE_IRQ_MODERATION nest list with an index 'i' and writes new_profile[i++] without bounding i. The destination is kmemdup()'d at NET_DIM_PARAMS_NUM_PROFILES entries (5), but the Netlink nest count is entirely user-controlled. Netlink policies do not have s...
```diff diff --git a/net/ethtool/coalesce.c b/net/ethtool/coalesce.c index 1e2c5c7048a8..e73fc3e5a02b 100644 --- a/net/ethtool/coalesce.c +++ b/net/ethtool/coalesce.c @@ -472,6 +472,12 @@ static int ethnl_update_profile(struct net_device *dev, nla_for_each_nested_type(nest, ETHTOOL_A_PROFILE_IRQ_MODERATION, n...
36d0d876c45f7ee7935edfce7f5687a2969a2249
Analyze and fix the following issue in the Linux kernel code: net: page_pool: silence static analysis warnings in page_pool_nl_stats_fill()
Problem Details: nla_nest_start() can return NULL if the skb runs out of space. Jakub: There is no bug here, if nla_nest_start() failed there's not space left in the message. Next nla_put_uint() will also fail and we will exit via nla_nest_cancel() which handles NULL just fine. Various people keep sending us this patc...
```diff diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c index 01509d1b3cba..1cdef13e6cea 100644 --- a/net/core/page_pool_user.c +++ b/net/core/page_pool_user.c @@ -135,6 +135,8 @@ page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool, return -EMSGSIZE; nest = nla_nest_start...
507541c2a8eeb76c02bd2511958f73a8cfa3e1bc
Analyze and fix the following issue in the Linux kernel code: ipv6: guard against possible NULL deref in __in6_dev_stats_get()
Problem Details: dev_get_by_index_rcu() could return NULL if the original physical device is unregistered. Found by Sashiko. Fixes: e1ae5c2ea478 ("vrf: Increment Icmp6InMsgs on the original netdev") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Stephen Suryaputra <ssuryaextr@gmail.com> Reviewed-by: Ido Schimm...
```diff diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 9e96776945e5..539bbbe54b14 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -369,8 +369,11 @@ static inline struct inet6_dev *__in6_dev_get_rtnl_net(const struct net_device * static inline struct inet6_dev *__in6_dev_stats_ge...
147f3b1f23cbd74f1022cc5689570a06f6bc47c8
Analyze and fix the following issue in the Linux kernel code: selftests: rtnetlink: Add bridge promiscuity tests
Problem Details: Add two test cases that always pass, but trigger sleeping in atomic context BUGs without "bridge: Fix sleep in atomic context in netlink path" and "bridge: Fix sleep in atomic context in sysfs path". Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> ...
```diff diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index c499953d4885..ace3a99023ed 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -24,6 +24,8 @@ ALL_TESTS=" kci_test_macsec kci_test_macsec_vlan kci_test...
6d34594cc619d0d4b07d5afcad8b5984f3526dcf
Analyze and fix the following issue in the Linux kernel code: bridge: Fix sleep in atomic context in sysfs path
Problem Details: Since the start of the git history, brport_store() always acquired the bridge lock. Back then this decision made sense: The bridge lock protects the STP state of the bridge and its ports and at that time the function was only used by two STP related attributes (cost and priority). Nowadays, brport_sto...
```diff diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index 18b558a931ad..ee3ad9dfbab9 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -99,7 +99,6 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, attr.u.brport_flags.val = flags; attr.u.brport_flags.mask = m...
5eec4427b89c2fb2beac54920101e55a2f1c0c21
Analyze and fix the following issue in the Linux kernel code: bridge: Fix sleep in atomic context in netlink path
Problem Details: Since the introduction of the netlink configuration path for bridge ports in commit 25c71c75ac87 ("bridge: bridge port parameters over netlink"), br_setport() was always called with the bridge lock held around it. Back then this decision made sense: The bridge lock protects the STP state of the bridge ...
```diff diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index c04a4d0889ae..b9591dd755f9 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -1000,19 +1000,25 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[], br_port_flags_change(p, changed_mask); if (tb[IFL...
41367d77ee4eba4b062835723b1756b0b6a86324
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Drop KVM_BUG_ON() on shared lock to zap child external PTEs
Problem Details: Drop the KVM_BUG_ON() in the KVM MMU core before zapping child external PTEs, since requiring zapping PTEs to be protected by exclusive mmu_lock is TDX's specific requirement. No need to plumb the shared/exclusive info into the remove_external_spte() op or move the KVM_BUG_ON() to TDX, because - There...
```diff diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 3c3e73ce8da9..3ba7556a8d2f 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -473,10 +473,8 @@ static void handle_removed_pt(struct kvm *kvm, tdp_ptep_t pt, bool shared) } handle_changed_spte(kvm, sp, gfn,...
447e04178b776c82dad431f8af26086b5ce9a391
Analyze and fix the following issue in the Linux kernel code: selinux: comment spelling fix in ibpkey.c
Problem Details: Signed-off-by: Kalevi Kolttonen <kalevi@kolttonen.fi> [PM: updated subject line] Signed-off-by: Paul Moore <paul@paul-moore.com>
```diff diff --git a/security/selinux/ibpkey.c b/security/selinux/ibpkey.c index 93a5637fbcd8..ae09d59aaa06 100644 --- a/security/selinux/ibpkey.c +++ b/security/selinux/ibpkey.c @@ -2,7 +2,7 @@ /* * Pkey table * - * SELinux must keep a mapping of Infinband PKEYs to labels/SIDs. This + * SELinux must keep a mappi...
626e33fa20c852caef037edef77fac590e7a9dc0
Analyze and fix the following issue in the Linux kernel code: selinux: comment typo fix in selinuxfs.c
Problem Details: Signed-off-by: Kalevi Kolttonen <kalevi@kolttonen.fi> [PM: updated subject line] Signed-off-by: Paul Moore <paul@paul-moore.com>
```diff diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 5150361ed1bb..c95ec5c46420 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -859,7 +859,7 @@ static const struct file_operations transaction_ops = { /* * payload - write methods * If the method has...
8ba68464e4787b6a7ec938826e16124df20fd23d
Analyze and fix the following issue in the Linux kernel code: bonding: refuse to enslave CAN devices
Problem Details: syzbot reported a kernel paging request crash in can_rx_unregister() inside net/can/af_can.c. The crash occurs because a virtual CAN device (vxcan) is being enslaved to a bonding master. During the enslavement process, the bonding driver mutates and modifies the network device states to fit an Etherne...
```diff diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index af82a3df2c5d..82e779f7916b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1890,6 +1890,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, struct sockaddr_...
ca674df13b195eb6d124ab059799d4e03fa40624
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: Handle bad values on proxied writes to LBR MSRs
Problem Details: Use the "safe" WRMSR API when writing LBRs on behalf of the guest (or host userspace), and propagate any errors back to the instigator, as the value being written is untrusted. E.g. if the guest (or host userspace) attempts to set reserved bits in LBR_SELECT, then KVM needs to return an error, and not...
```diff diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 27eb76e6b6a0..22138c487216 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -308,13 +308,15 @@ static bool intel_pmu_handle_lbr_msrs_access(struct kvm_vcpu *vcpu, */ local_irq_disable(); if (lbr_...
81905b5acbe77284734438df3fbec1158e6429a3
Analyze and fix the following issue in the Linux kernel code: audit: fix recursive locking deadlock in audit_dupe_exe()
Problem Details: A deadlock occurs in the audit subsystem when duplicating executable-related rules. When a file is moved (e.g., via do_renameat2()), the VFS layer locks the parent directory (I_MUTEX_PARENT), which synchronously triggers an fsnotify_move event. If an existing executable audit rule matches the file bei...
```diff diff --git a/kernel/audit.h b/kernel/audit.h index a5926c83e61b..92d5e723d570 100644 --- a/kernel/audit.h +++ b/kernel/audit.h @@ -256,8 +256,13 @@ extern int audit_del_rule(struct audit_entry *entry); extern void audit_free_rule_rcu(struct rcu_head *head); extern struct list_head audit_filter_list[]; -exte...
016a25e4b0df4d77e7c258edee4aaf982e4ee809
Analyze and fix the following issue in the Linux kernel code: Drivers: hv: vmbus: Improve the logic of reserving fb_mmio on Gen2 VMs
Problem Details: If vmbus_reserve_fb() in the kdump/kexec kernel fails to properly reserve the framebuffer MMIO range (which is below 4GB) due to a Gen2 VM's screen.lfb_base being zero [1], there is an MMIO conflict between the drivers hyperv-drm and pci-hyperv: when the driver pci-hyperv's hv_allocate_config_window() ...
```diff diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index c9eeb2ec365d..b80a35c778ab 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2327,8 +2327,8 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) return AE_NO_MEMORY; /* If this range overlaps...
c53763aa2b9c96fbabee68ebe1e13074cb09bfb2
Analyze and fix the following issue in the Linux kernel code: mshv: use kmalloc_array in mshv_root_scheduler_init
Problem Details: Replace kmalloc() with kmalloc_array() to prevent potential overflow, as recommended in Documentation/process/deprecated.rst. No functional change. Signed-off-by: Can Peng <pengcan@kylinos.cn> Signed-off-by: Wei Liu <wei.liu@kernel.org>
```diff diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index bd1359eb58dd..146726cc4e9b 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -2241,7 +2241,7 @@ static int mshv_root_scheduler_init(unsigned int cpu) outputarg = (void **)this_cpu_ptr(root_scheduler_output...
a17dc12bfed8868e6a86f3b45c16065a70641acb
Analyze and fix the following issue in the Linux kernel code: x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines
Problem Details: With CONFIG_CALL_DEPTH_TRACKING enabled on an x86 retbleed-affected platform (eg: Skylake), with retbleed=stuff, registering a dynamic ftrace trampoline crashes on the first call into the traced function: BUG: unable to handle page fault for address: ffff88817ae18880 #PF: supervisor write access i...
```diff diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 0543b57f54ee..17d6edfcb7e0 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -375,6 +375,13 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) goto fail; } + /* + * Generated trampoline may ...
7b3281fcb43c5fce8d4d2b0996d3ac719cb5068b
Analyze and fix the following issue in the Linux kernel code: x86/build: Drop unnecessary '-ffreestanding' addition to KBUILD_CFLAGS
Problem Details: Now that the minimum supported version of LLVM for building the kernel has been raised to 17.0.1, the addition of '-ffreestanding' to KBUILD_CFLAGS for 32-bit x86 is unnecessary, as the linked LLVM bug is resolved in all supported LLVM versions. 16cb16e0d285 ("x86/build: Remove -ffreestanding on i38...
```diff diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 46fec0b08487..5720f2470cfc 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -124,11 +124,6 @@ ifeq ($(CONFIG_X86_32),y) include $(srctree)/arch/x86/Makefile_32.cpu KBUILD_CFLAGS += $(cflags-y) - ifneq ($(call clang-min-vers...
ce3267a39a92be732429fa1a1f6d95a807a31fa7
Analyze and fix the following issue in the Linux kernel code: kbuild: Bump minimum version of LLVM for building the kernel to 17.0.1
Problem Details: The current minimum version of LLVM for building the kernel is 15.0.0. However, there are two deficiencies compared to GCC that were fixed in LLVM 17 that are starting to become more noticeable. The first was a bug in LLVM's scope checker [1], where all labels in a function were validated as potential...
```diff diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index 9a99037270ff..b9afce768446 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst @@ -36,7 +36,7 @@ bindgen (optional) 0.71.1 bindgen --version binutils 2.30 ...
9d2491197a00acf8c423512078458c2855102b66
Analyze and fix the following issue in the Linux kernel code: smb: client: fix uninitialized variable in smb2_writev_callback
Problem Details: compiling with W=2 pointed out that "written may be used uninitialized" Fixes: 20d72b00ca81 ("netfs: Fix the request's work item to not require a ref") Cc: stable@vger.kernel.org Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
```diff diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 3bd300347f16..fbeb2156ddb6 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4955,7 +4955,7 @@ smb2_writev_callback(struct TCP_Server_Info *server, struct mid_q_entry *mid) unsigned int rreq_debug_id = wdata->rreq->debug...
4d9a902be374aea023f2193f729c26612e56b542
Analyze and fix the following issue in the Linux kernel code: counter: interrupt-cnt: use devm_mutex_init()
Problem Details: interrupt_cnt_probe() calls mutex_init() but neither this driver nor the counter core issues a matching mutex_destroy() on unbind, so the lock debug state is leaked. Switch to devm_mutex_init() so the mutex is torn down in the same devm scope it was set up in. Signed-off-by: Stepan Ionichev <sozdayve...
```diff diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c index e6100b5fb082..cd475382ab6a 100644 --- a/drivers/counter/interrupt-cnt.c +++ b/drivers/counter/interrupt-cnt.c @@ -233,7 +233,9 @@ static int interrupt_cnt_probe(struct platform_device *pdev) if (ret) return ret; - mutex_...
b400c076fe4b63576fa22fbb59078b030000970c
Analyze and fix the following issue in the Linux kernel code: counter: ftm-quaddec: use devm_mutex_init()
Problem Details: ftm_quaddec_probe() calls mutex_init() but neither the cleanup action nor a remove callback issues a matching mutex_destroy(), so the lock debug state is leaked on driver unbind. Switch to devm_mutex_init() so the mutex is torn down in the same devm scope it was set up in. Signed-off-by: Stepan Ionic...
```diff diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c index c47741292ae1..8455f16d62cb 100644 --- a/drivers/counter/ftm-quaddec.c +++ b/drivers/counter/ftm-quaddec.c @@ -292,7 +292,9 @@ static int ftm_quaddec_probe(struct platform_device *pdev) counter->signals = ftm_quaddec_signals; co...
840b740a35bf969734e0f2e44c21289fdd03079e
Analyze and fix the following issue in the Linux kernel code: mshv: Add conditional VMBus dependency
Problem Details: When the VMBus driver is not part of the kernel (CONFIG_HYPERV_VMBUS=n), the MSHV root driver fails to link: ERROR: modpost: "hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined! Fix this while meeting these requirements: * It must be possible to include the MSHV root driver without the VMBus driv...
```diff diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 2d0b3fcb0ff8..aa11bcefddf2 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -74,6 +74,7 @@ config MSHV_ROOT # e.g. When withdrawing memory, the hypervisor gives back 4k pages in # no particular order, making it impossible to reassemble la...
83eb00f31eb1b10735d48e469df72cc2b0e06f6d
Analyze and fix the following issue in the Linux kernel code: hyperv: Clean up and fix the guest ID comment in hvgdk.h
Problem Details: Change the "64 bit" to "64-bit", and the "Os" to "OS". Remove the obsolete paragraph since the guideline has been published in the Hypervisor Top Level Functional Specification for many years. The "OS Type" is 0x1 for Linux, not 0x100. No functional change. Fixes: 83ba0c4f3f31 ("Drivers: hv: Cleanu...
```diff diff --git a/include/hyperv/hvgdk.h b/include/hyperv/hvgdk.h index 384c3f3ff4a5..f538144280ca 100644 --- a/include/hyperv/hvgdk.h +++ b/include/hyperv/hvgdk.h @@ -10,18 +10,12 @@ /* * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of t...
e42e53ae23b7d41df22ccd7788192bf578f24da2
Analyze and fix the following issue in the Linux kernel code: bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
Problem Details: On configs with CONFIG_BPF=y but CONFIG_BPF_SYSCALL=n (e.g. arm multi_v7_defconfig), kernel/bpf/core.c defines a __weak bpf_arena_handle_page_fault() while bpf_defs.h already supplies a static inline stub for it, causing a redefinition error. Build the __weak definition only under CONFIG_BPF_SYSCALL, m...
```diff diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 8ecba2989d88..a656a8572bdb 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -3376,13 +3376,14 @@ __weak u64 bpf_arena_get_kern_vm_start(struct bpf_arena *arena) { return 0; } + +#ifdef CONFIG_BPF_SYSCALL __weak bool bpf_arena_handle_page_fau...
fa21e86caba2347e89eb65af926205a36a097c53
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_qca: Use 100 ms SSR delay for rampatch and NVM loading
Problem Details: When bt_en is pulled high by hardware, the host does not re-download the firmware after SSR. The controller loads the rampatch and NVM internally. On HMT chip, the rampatch is ~264 KB and the NVM is ~9.4 KB. The loading process takes approximately 70 ms. The previous 50 ms delay is too short, causing ...
```diff diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index ed280399bf47..34500137df2c 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1680,8 +1680,8 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) mod_timer(&qca->tx_idle_timer, jiffies + msec...
bfea6091e0fffb270c20e74384b660910277eb6c
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_sync: fix UAF in hci_le_create_cis_sync
Problem Details: hci_le_create_cis_sync() dereferences conn->conn_timeout after releasing both rcu_read_lock() and hci_dev_lock(hdev). The conn pointer was obtained from an RCU-protected iteration over hdev->conn_hash.list and is not valid once these locks are dropped. A concurrent disconnect can free the hci_conn be...
```diff diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index aff8562a8690..1faf8df6d159 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -6699,6 +6699,7 @@ int hci_le_create_cis_sync(struct hci_dev *hdev) DEFINE_FLEX(struct hci_cp_le_create_cis, cmd, cis, num_cis, 0x1f); siz...
3c40d381ce04f9575a5d8b542898183c3b4b38dc
Analyze and fix the following issue in the Linux kernel code: Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt()
Problem Details: The skb_clone() function can return NULL if memory allocation fails. send_mcast_pkt() calls skb_clone() without checking the return value, which can lead to a NULL pointer dereference in send_pkt() when it dereferences skb->data. Add a NULL check after skb_clone() and skip the peer if the clone fails. ...
```diff diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 2f03b780b40d..960a19b3e26d 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -486,6 +486,8 @@ static int send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev) int ret; local_skb = skb_clone(skb, GFP_ATOMI...
82855073c1081732656734b74d7d1d5e4cfd0da7
Analyze and fix the following issue in the Linux kernel code: Bluetooth: btusb: Allow firmware re-download when version matches
Problem Details: The Bluetooth host decides whether to download firmware by reading the controller firmware download completion flag and firmware version information. If a USB error occurs during the firmware download process (for example due to a USB disconnect), the download is aborted immediately. An incomplete fir...
```diff diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 7f5fce93d984..830fefb342c6 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3540,7 +3540,13 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev, "firmware rome 0x%x build 0x%x", rver_rom...
2a3ac9ee11dbb9845f3947cef4a79dba658cf6f6
Analyze and fix the following issue in the Linux kernel code: Bluetooth: HIDP: fix missing length checks in hidp_input_report()
Problem Details: hidp_input_report() reads keyboard and mouse payload data from an skb without first verifying that skb->len contains enough data. hidp_recv_intr_frame() pulls the 1-byte HIDP header before dispatching to hidp_input_report(). If a paired device sends a truncated packet, the handler reads beyond the val...
```diff diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 976f91eeb745..70344bd3248a 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -179,12 +179,21 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) { struct input_dev *dev = session->...
8c8e620467a7b51562dbcefbd1f09f288d7d710d
Analyze and fix the following issue in the Linux kernel code: Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()
Problem Details: l2cap_chan_close() removes the channel from conn->chan_l, which must be done under conn->lock. cleanup_listen() runs under the parent sk_lock, so acquiring conn->lock would invert the established conn->lock -> chan->lock -> sk_lock order. Instead of calling l2cap_chan_close() directly, schedule l2cap...
```diff diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index b34e7da8d906..c138aa4ae266 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -1499,6 +1499,10 @@ static void l2cap_sock_cleanup_listen(struct sock *parent) * pin it (hold_unless_zero() additionally skips a ch...
9dbd84990394c51f5cee1e8871bb5ff8af5ed939
Analyze and fix the following issue in the Linux kernel code: Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
Problem Details: __set_chan_timer() takes a l2cap_chan reference via l2cap_chan_hold() before scheduling the delayed work. The normal path in l2cap_chan_timeout() drops this reference with l2cap_chan_put() at the end, but the early return when chan->conn is NULL skips the put, leaking the reference. Add the missing l...
```diff diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index fdccd62ccca8..5668c92b3f58 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -411,8 +411,10 @@ static void l2cap_chan_timeout(struct work_struct *work) BT_DBG("chan %p state %s", chan, state_to_string(chan->...
bfa9d28960ed677d556bdf097073bc3129686229
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_conn: Fix memory leak in hci_le_big_terminate()
Problem Details: hci_le_big_terminate() allocates iso_list_data via kzalloc_obj but returns 0 without freeing it when neither pa_sync_term nor big_sync_term flags are set after evaluating the PA and BIG sync connection state. This early-return path was introduced when hci_le_big_terminate() was refactored to take stru...
```diff diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 17b46ad6a349..54eabaa46960 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -870,8 +870,10 @@ static int hci_le_big_terminate(struct hci_dev *hdev, struct hci_conn *conn) d->big_sync_term = true; } - if (!d->pa...
b565a73baec275a3f4b49c1300ab396daf4a748e
Analyze and fix the following issue in the Linux kernel code: tools/sched_ext: Fix scx_show_state per-scheduler state reads
Problem Details: scx_show_state.py still reads scx_aborting and scx_bypass_depth as global symbols. Those symbols no longer exist after the state was moved into struct scx_sched, so the drgn script fails when it reaches either field. Read aborting and bypass_depth from scx_root instead. This preserves the script's cur...
```diff diff --git a/tools/sched_ext/scx_show_state.py b/tools/sched_ext/scx_show_state.py index 02e43c184d43..446d82807f90 100644 --- a/tools/sched_ext/scx_show_state.py +++ b/tools/sched_ext/scx_show_state.py @@ -27,18 +27,25 @@ def read_static_key(name): def state_str(state): return prog['scx_enable_state_str'...
0a68853de27b522bca2b9934127277185374a24f
Analyze and fix the following issue in the Linux kernel code: cgroup/cpuset: Use effective_xcpus in partcmd_update add/del mask calculation
Problem Details: When sibling CPU exclusion occurs, a partition's user_xcpus may contain CPUs that were never actually granted to it. These CPUs are present in user_xcpus(cs) but not in cs->effective_xcpus. The partcmd_update path in update_parent_effective_cpumask() uses user_xcpus(cs) (via the local variable xcpus) ...
```diff diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 5c33ab20cc20..c9e14fda3d6f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -1811,9 +1811,9 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, * Compute add/delete mask to/from effective_cpus * ...
39406c05f8f150f1685839acd38ffdd69ff92031
Analyze and fix the following issue in the Linux kernel code: x86/mm: Fix freeing of PMD-sized vmemmap pages
Problem Details: Commit bf9e4e30f353 ("x86/mm: use pagetable_free()"), switched from freeing non-boot page tables through __free_pages() to pagetable_free(). However, the function is also called to free vmemmap pages. Given that vmemmap pages are not page tables, already the page_ptdesc(page) is wrong. But worse, pag...
```diff diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index df2261fa4f98..7e20b22d658b 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1014,7 +1014,7 @@ static void __meminit free_pagetable(struct page *page, int order) #ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE enum bootmem_type type = bo...
611583a76ea97991b0f65ec1ff099eac7fe0bae4
Analyze and fix the following issue in the Linux kernel code: workqueue: drop spurious '*' from print_worker_info() fn declaration
Problem Details: print_worker_info() declares its local 'fn' as work_func_t * but worker->current_func has type work_func_t (a function pointer). The extra level of indirection is wrong and only happens to be harmless today because every supported Linux architecture has sizeof(work_func_t) == sizeof(work_func_t *): cop...
```diff diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 9adee917e2bb..35b0c8f4f10f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -6286,7 +6286,7 @@ EXPORT_SYMBOL_GPL(set_worker_desc); */ void print_worker_info(const char *log_lvl, struct task_struct *task) { - work_func_t *fn = NULL; + work...
be7fd7c3e8bcfd3a1804567ce5cf9ca3b254c1ba
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Prioritize CPUID faulting over CPUID VM-exits in nested VMX
Problem Details: Per the Intel SDM, "Certain exceptions have priority over VM exits. These include invalid-opcode exceptions, faults based on privilege level, and general-protection exceptions that are based on checking I/O permission bits in the task-state segment (TSS)." Ensure that when L2 executes CPUID at CPL > ...
```diff diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index a78ce0080963..30dcabc899a2 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6552,6 +6552,8 @@ static bool nested_vmx_l0_wants_exit(struct kvm_vcpu *vcpu, nested_evmcs_l2_tlb_flush_enabled(vcpu) && kvm_hv_i...
cf7d65d1d6f50daadfe7c475f0c2b1bfdc288b56
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Consolidate CPUID fault handling for emulator and interception logic
Problem Details: Extract the logic for emulating CPUID faulting (where CPUID #GPs at CPL>0 outside of SMM) into a dedicated helper and use the helper for both the full emulator and the intercepted-CPUID paths. Opportunistically drop kvm_require_cpl(), as kvm_emulate_cpuid() was the one and only user. No functional ch...
```diff diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index beb83eea65ef..f5a35136ebb8 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -2320,7 +2320,6 @@ static inline void kvm_inject_emulated_page_fault(struct kvm_vcpu *vcpu, __kvm_inject_emulate...
6bf8973ddeeec0ead87b0dfe9a3ae6072432e334
Analyze and fix the following issue in the Linux kernel code: sched_ext: idle: Fix errno loss in scx_idle_init()
Problem Details: || is a boolean operator, any nonzero (error) return short-circuits to 1 rather than the actual errno. The caller in scx_init() logs and propagates this value, so the wrong code reaches upper layers. Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
```diff diff --git a/kernel/sched/ext_idle.c b/kernel/sched/ext_idle.c index bbb845f36a0a..6ff80722f645 100644 --- a/kernel/sched/ext_idle.c +++ b/kernel/sched/ext_idle.c @@ -1509,13 +1509,9 @@ static const struct btf_kfunc_id_set scx_kfunc_set_select_cpu = { int scx_idle_init(void) { - int ret; - - ret = register_...
bdc35754012906dbf094be104b103ca3adfef6f7
Analyze and fix the following issue in the Linux kernel code: ACPICA: add boundary checks in two places
Problem Details: Add boundary checks in acpi_ps_get_next_namestring() and acpi_ps_peek_opcode() to prevent out-of-bounds access. Link: https://github.com/acpica/acpica/commit/cfdc96896d8d Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid....
```diff diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 95d540bda4fb..4643c839df7f 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c @@ -148,10 +148,16 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) /* Point past any namestring p...
d27d48a528e437aed690f977e69a6fe73fe82ab5
Analyze and fix the following issue in the Linux kernel code: ACPICA: Add package limit checks in parser functions
Problem Details: Add package limit checks in parser functions to prevent out-of-bounds access. Link: https://github.com/acpica/acpica/commit/b31b45af2122 Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/3212937.CbtlEUcBR6@rafael.j.w...
```diff diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index fabae9b08e31..b6534187cd43 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c @@ -512,6 +512,10 @@ acpi_status acpi_install_method(u8 *buffer) parser_state.aml += acpi_ps_get_opcode_size(opcode);...
fe64bc7954b57df49cec0eee21e8f5960d9b8713
Analyze and fix the following issue in the Linux kernel code: ACPICA: Remove spurious precision from format used to dump parse trees
Problem Details: The debug code in acpi_ps_delete_parse_tree() uses ("%*.s", level * 4, " ") to indent traces. POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'. Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by o...
```diff diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index 2f3ebcd8aebe..a6a6e969e498 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c @@ -49,8 +49,8 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) /* This debug option will print th...
485829e6999b7909f50761a1c708660304edc945
Analyze and fix the following issue in the Linux kernel code: ACPICA: Enhance OEM ID and Table ID validation in acpi_ex_load_table_op()
Problem Details: Enhance OEM ID and Table ID validation in acpi_ex_load_table_op() to prevent buffer overflows. Link: https://github.com/acpica/acpica/commit/f85a43098d65 Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/2230782.OBFZ...
```diff diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 4d7dd0fc6b07..894695db0cf9 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c @@ -90,6 +90,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, union acpi_operand_object *return_obj; un...
f8d14b7bb0063bbbd86c0e4d73edb8cea7b362bc
Analyze and fix the following issue in the Linux kernel code: ACPICA: Fix NULL pointer dereference in acpi_ns_custom_package()
Problem Details: acpi_ns_custom_package() unconditionally dereferences the first element of the package to read the _BIX version number, without checking for NULL: if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER) When firmware returns a _BIX package whose first element is an unresolvable reference, ACPICA evalu...
```diff diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index ca137ce5674f..c32770570120 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c @@ -631,6 +631,13 @@ acpi_ns_custom_package(struct acpi_evaluate_info *info, /* Get version number, must be Integer *...
b2e21fe8c3361c3d0d57ee56d359bea9b51fda3d
Analyze and fix the following issue in the Linux kernel code: ACPICA: Enhance buffer validation in acpi_ut_walk_aml_resources()
Problem Details: Enhance buffer validation in acpi_ut_walk_aml_resources() to prevent buffer overflows. Link: https://github.com/acpica/acpica/commit/975cb20c7992 Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/2481429.NG923GbCHz@r...
```diff diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index e1cc3d348750..86ebd9fb869a 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c @@ -165,6 +165,28 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, /* Walk the byte list, abort on any inv...
96b2b616870e46e2bc04efec03879683a0036e66
Analyze and fix the following issue in the Linux kernel code: ACPICA: Add validation for node in acpi_ns_build_normalized_path()
Problem Details: Add validation for node in acpi_ns_build_normalized_path() to prevent use-after-free vulnerabilities. Link: https://github.com/acpica/acpica/commit/b35adf49e89a Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/11866...
```diff diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 22aeeeb56cff..19802da865c5 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c @@ -222,6 +222,12 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, goto build_trailing_null; } + /* ...
0e2021f49e64b3c8a9aa880d0c62a218bfe147ce
Analyze and fix the following issue in the Linux kernel code: ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
Problem Details: Add overflow check for Index + Length to prevent integer overflow when calculating the truncation length. This prevents negative size parameter being passed to memcpy(). Link: https://github.com/acpica/acpica/commit/d281ec1ac84e Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysoc...
```diff diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index 2fc8070814e3..2790bf1a12e7 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c @@ -159,7 +159,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) /* Truncate request if l...
6e8c55e13a5e3a9f38921d62924f18ceba3330eb
Analyze and fix the following issue in the Linux kernel code: ACPICA: Prevent adding invalid references
Problem Details: Prevent adding references for local, argument, and debug objects in acpi_ut_copy_simple_object(). Link: https://github.com/acpica/acpica/commit/f576898d7814 Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/4511989.e...
```diff diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 80458e70ac2b..9ecf5c3f49ba 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c @@ -731,7 +731,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, break; } - acpi_ut_add_referenc...
e15aa60de0256d63df2331bf5a4bc4dd287504cd
Analyze and fix the following issue in the Linux kernel code: ACPICA: add boundary checks in acpi_ps_get_next_field()
Problem Details: Add boundary checks in acpi_ps_get_next_field() to prevent out-of-bounds access. Link: https://github.com/acpica/acpica/commit/c39183ea84bc Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/24388159.6Emhk5qWAg@rafael...
```diff diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 87d32fbba0a6..3526ea109414 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c @@ -491,6 +491,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state ASL_CV_CAPTURE_COMMENTS_ONL...
945e87267cfd90937b3c637f87324cbb56998b72
Analyze and fix the following issue in the Linux kernel code: ACPICA: Fix use-after-free in acpi_ds_terminate_control_method()
Problem Details: Fix use-after-free issue in acpi_ds_terminate_control_method() by clearing references to method locals and arguments. Link: https://github.com/acpica/acpica/commit/36f22a94cb1b Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch....
```diff diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 45ec32e81903..08bfe8303083 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c @@ -705,6 +705,8 @@ void acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, struct acpi_walk...
2543fbb21642f740288e3c292cab03cd611f35a4
Analyze and fix the following issue in the Linux kernel code: ACPICA: fix I2C LVR item count in the conversion table
Problem Details: For ACPI_RSC_MOVE8, the 'Value' field in struct acpi_rsconvert_info is the item count count and not a bit position like for the bitflags. Set 'Value' as '1' to fix this. Conversion still works coincidentally with '0' because item_count is not reset between table entries, and the previous count value w...
```diff diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c index 7d7ee3af7272..5ab41e9b9039 100644 --- a/drivers/acpi/acpica/rsserial.c +++ b/drivers/acpi/acpica/rsserial.c @@ -394,7 +394,7 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[18] = { /* Read LVR from Type Specific Fl...
15a07a5a96d5c813f601f95a5baaf901c6112789
Analyze and fix the following issue in the Linux kernel code: ACPICA: Fix FADT 32/64X length mismatch warning
Problem Details: When the 64-bit address is set but bit_width is 0, the spec says the legacy length should be used. That is valid firmware. Skip the warning if bit_width is 0. This avoids false warnings like: 32/64X length mismatch in FADT/gpe0_block: 128/0 Tested on free_BSD 16.0-CURRENT. Link: https://github.co...
```diff diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index c6658b2f3027..80d3a39a82d7 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c @@ -553,8 +553,11 @@ static void acpi_tb_convert_fadt(void) * Note: If the legacy length field is > 0xFF bits, ignore ...
8de27e2d83c0d07ae9443c6304575b0609394bfd
Analyze and fix the following issue in the Linux kernel code: ACPICA: Fix condition check in acpi_ps_parse_loop()
Problem Details: Fix condition check for AML_ELSE_OP in acpi_ps_parse_loop() to prevent out-of-bounds access. Link: https://github.com/acpica/acpica/commit/3b537b92336e Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/1959692.tdWV9S...
```diff diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index c989cadf271c..35111ff2526b 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c @@ -425,7 +425,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "...
880fa3a1e5c493d0deafe9153f8c2bed427b9428
Analyze and fix the following issue in the Linux kernel code: rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
Problem Details: Commit 47ac2a4b5cd8 ("rust: kvec: implement shrink_to for KVVec") introduced a call to bindings::is_vmalloc_addr(). However, this fails to compile on architectures where CONFIG_MMU is disabled, resulting in the following build error: error[E0425]: cannot find function `is_vmalloc_addr` in crate `b...
```diff diff --git a/rust/helpers/vmalloc.c b/rust/helpers/vmalloc.c index 326b030487a2..6aed13292313 100644 --- a/rust/helpers/vmalloc.c +++ b/rust/helpers/vmalloc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 +#include <linux/mm.h> #include <linux/vmalloc.h> __rust_helper void *__must_check __realloc_s...
a192b8cfa447e1b3701a13434a31c392b2e7ed29
Analyze and fix the following issue in the Linux kernel code: nvme-pci: fix out-of-bounds access in nvme_setup_descriptor_pools
Problem Details: nvme_setup_descriptor_pools() indexes dev->descriptor_pools[] using the numa_node forwarded from hctx->numa_node by its single caller, nvme_init_hctx_common(). On a non-NUMA kernel hctx->numa_node is NUMA_NO_NODE (-1). Because the parameter was declared 'unsigned', the value becomes UINT_MAX and the ...
```diff diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 35affda088f4..d20d8722ad96 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -587,11 +587,16 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, __le32 *dbbuf_db, } static struct nvme_descriptor_pools * -nvme_se...
1c824497d8acd3187d585d6187cedc1897dcc871
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix calling VM invalidation in amdgpu_hmm_invalidate_gfx
Problem Details: Otherwise we don't invalidate page tables on next CS. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <ale...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c index 0a9582da3a33..5bfa5a84b09c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c @@ -76,6 +76,7 @@ static bool amdgpu_hmm_invalidate_gfx(struct mmu_interval_notifier ...
962d684b5dc0741dcd93485d41b450de402d5592
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix amdgpu_hmm_range_get_pages
Problem Details: The notifier sequence must only be read once or otherwise we could work with invalid pages. While at it also fix the coding style, e.g. drop the pre-initialized return value and use the common define for 2G range. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Vitaly Prosyak <...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c index f72990ac046e..0a9582da3a33 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c @@ -51,8 +51,6 @@ #include "amdgpu_amdkfd.h" #include "amdgpu_hmm.h" -#define MAX...
93f5534b35a05ef8a0109c1eefa800062fee810a
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: fix a vulnerability of integer overflow in kfd debugger
Problem Details: get_queue_ids() computes array_size = num_queues * sizeof(uint32_t), which could overflow on 32-bit size_t build. using array_size() instead, it saturates to SIZE_MAX on overflow. Signed-off-by: Eric Huang <jinhuieric.huang@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Ale...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index e0a31e11f0ff..0d7296c739ed 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -3308,12 +3308,14 @@ stati...
dd4f3ee535b3b0ac027f75dbf9dc5fc88733c765
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm/si: Disregard vblank time when no displays are connected
Problem Details: When no displays are connected, there is no vblank happening so the power management code shouldn't worry about it. This fixes a regression that caused the memory clock to be stuck at maximum when there were no displays connected to a SI GPU. Fixes: 9003a0746864 ("drm/amd/pm: Treat zero vblank time a...
```diff diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c index 36942467d4ad..c3aff5d0c53d 100644 --- a/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c @@ -3076,6 +3076,10 @@ static bool si_dpm_vblank_too_short(void *handle) ...
0fb4a8e64a9db74eeda8da7d0b78985392ae483b
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix potential overflow in fs_info.debugfs_name
Problem Details: Use snprintf() with sizeof(fs_info.debugfs_name) so a long RAS block name plus the "_err_inject" suffix cannot overflow the 32-byte buffer. Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picke...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 6c644cfe6695..fc9f3adf9912 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -2280,7 +2280,8 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) ...
cf4aafdccefccc7f8236fed028d06725246e289e
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu/userq: make sure queue is valid in the hang_detect_work
Problem Details: Thread 1: Running amdgpu_userq_destroy which eventually remove the queue from door bell and set userq_mgr = NULL. Thread2: An interrupt might have scheduled the hang_detect_work which still need userq_mgr to be valid but could get an NULL ptrs. To fix that make sure we cancel the hang_detect_work aga...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c index 5da107dffcce..8d7dad1d30eb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c @@ -427,8 +427,6 @@ static void amdgpu_userq_cleanup(struct amdgpu_usermode_q...
a00caed2302c604c19a5cab781e34d7ba4fa7558
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu/userq: reserve root bo without interruption
Problem Details: Fix the code to make it an uninterruptible reservation for root bo. Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit d409ab4e387d94b2e593d558b54b7bfd315e0e75)
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c index 34c0d9ee94f2..5da107dffcce 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c @@ -620,11 +620,7 @@ amdgpu_userq_destroy(struct amdgpu_userq_mgr *uq_mgr, st...