id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
6ba912f1c081448cf3d1fa9ada9115aae4594ac4
Analyze and fix the following issue in the Linux kernel code: kcsan: select CONFIG_CONSTRUCTORS
Problem Details: Building a kcsan enabled kernel for x86_64 with gcc-11 results in a lot of build warnings or errors without CONFIG_CONSTRUCTORS: x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/copy_mc.o' x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/li...
```diff diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan index 375575a5a0e3..cb926b393556 100644 --- a/lib/Kconfig.kcsan +++ b/lib/Kconfig.kcsan @@ -14,6 +14,7 @@ menuconfig KCSAN bool "KCSAN: dynamic data race detector" depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER depends on DEBUG_KERNEL && !KASAN + selec...
d649c34cb916b015fdcb487e51409fcc5caeca8d
Analyze and fix the following issue in the Linux kernel code: vfio: Fix NULL pointer dereference caused by uninitialized group->iommufd
Problem Details: group->iommufd is not initialized for the iommufd_ctx_put() [20018.331541] BUG: kernel NULL pointer dereference, address: 0000000000000000 [20018.377508] RIP: 0010:iommufd_ctx_put+0x5/0x10 [iommufd] ... [20018.476483] Call Trace: [20018.479214] <TASK> [20018.481555] vfio_group_fops_unl_ioctl+0x506/0...
```diff diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c index 0e9036e2b9c4..160deff6649b 100644 --- a/drivers/vfio/group.c +++ b/drivers/vfio/group.c @@ -137,7 +137,7 @@ static int vfio_group_ioctl_set_container(struct vfio_group *group, ret = iommufd_vfio_compat_ioas_id(iommufd, &ioas_id); if (ret) { ...
f3dd0c53370e70c0f9b7e931bbec12916f3bb8cc
Analyze and fix the following issue in the Linux kernel code: bpf: add missing header file include
Problem Details: Commit 74e19ef0ff80 ("uaccess: Add speculation barrier to copy_from_user()") built fine on x86-64 and arm64, and that's the extent of my local build testing. It turns out those got the <linux/nospec.h> include incidentally through other header files (<linux/kvm_host.h> in particular), but that was not...
```diff diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 933869983e2a..b297e9f60ca1 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -34,6 +34,7 @@ #include <linux/log2.h> #include <linux/bpf_verifier.h> #include <linux/nodemask.h> +#include <linux/nospec.h> #include <linux/bpf_mem_alloc.h> #inclu...
48ba08374e779421ca34bd14b4834aae19fc3e6a
Analyze and fix the following issue in the Linux kernel code: io_uring: fix size calculation when registering buf ring
Problem Details: Using struct_size() to calculate the size of io_uring_buf_ring will sum the size of the struct and of the bufs array. However, the struct's fields are overlaid with the array making the calculated size larger than it should be. When registering a ring with N * PAGE_SIZE / sizeof(struct io_uring_buf) e...
```diff diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c index 4a6401080c1f..3002dc827195 100644 --- a/io_uring/kbuf.c +++ b/io_uring/kbuf.c @@ -505,7 +505,7 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg) } pages = io_pin_pages(reg.ring_addr, - struct_size(br, bufs, reg.ring_entries)...
6bf65a1b3668b04bb6c8126494d00303104eb9e5
Analyze and fix the following issue in the Linux kernel code: io_uring/rsrc: fix a comment in io_import_fixed()
Problem Details: io_import_fixed() supports offsets, but "may not" means the opposite. Replace it with "might not" so the comments rather speaks about possible cases. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Link: https://lore.kernel.org/r/5b5f799584...
```diff diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index a59fc02de598..4e6191904c9e 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1335,7 +1335,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter, return -EFAULT; /* - * May not be a start of buffer, set size appropriately + * Might not be a st...
e034b8a18d4badceecb672c58b488bad1e901d95
Analyze and fix the following issue in the Linux kernel code: drm/msm: Fix possible uninitialized access in fbdev
Problem Details: Do not run drm_fb_helper_unprepare() if fbdev allocation fails. Avoids access to an uninitialized pointer. Original bug report is at [1]. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 3fb1f62f80a1 ("drm/fb-helper: Remove drm_fb_helper_unpr...
```diff diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index c804e5ba682a..d26aa52217ce 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -136,13 +136,13 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { struct drm_fb_helper *msm_fbde...
e74a68468062d7ebd8ce17069e12ccc64cc6a58c
Analyze and fix the following issue in the Linux kernel code: arm64: Reset KASAN tag in copy_highpage with HW tags only
Problem Details: During page migration, the copy_highpage function is used to copy the page data to the target page. If the source page is a userspace page with MTE tags, the KASAN tag of the target page must have the match-all tag in order to avoid tag check faults during subsequent accesses to the page by the kernel....
```diff diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c index 8dd5a8fe64b4..4aadcfb01754 100644 --- a/arch/arm64/mm/copypage.c +++ b/arch/arm64/mm/copypage.c @@ -22,7 +22,8 @@ void copy_highpage(struct page *to, struct page *from) copy_page(kto, kfrom); if (system_supports_mte() && page_mte_tagge...
b48279af636de613e9dd03857d9cadd4beca8e7e
Analyze and fix the following issue in the Linux kernel code: perf test: Fix offcpu test prev_state check
Problem Details: On Fedora 36, the 'perf record' offcpu profiling tests are failing. It was because the BPF checks the prev task's state being S or D but actually it has more bits set. Let's check the LSB 8 bits for the purpose of offcpu profiling. Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org> Signed-off-...
```diff diff --git a/tools/perf/util/bpf_skel/off_cpu.bpf.c b/tools/perf/util/bpf_skel/off_cpu.bpf.c index 38e3b287dbb2..d877a0a9731f 100644 --- a/tools/perf/util/bpf_skel/off_cpu.bpf.c +++ b/tools/perf/util/bpf_skel/off_cpu.bpf.c @@ -277,7 +277,7 @@ int on_switch(u64 *ctx) else prev_state = get_task_state(prev); ...
eb9be8310c58c166f9fae3b71c0ad9d6741b4897
Analyze and fix the following issue in the Linux kernel code: RISC-V: add a spin_shadow_stack declaration
Problem Details: The patchwork automation reported a sparse complaint that spin_shadow_stack was not declared and should be static: ../arch/riscv/kernel/traps.c:335:15: warning: symbol 'spin_shadow_stack' was not declared. Should it be static? However, this is used in entry.S and therefore shouldn't be static. The sam...
```diff diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index 67322f878e0d..f704c8dd57e0 100644 --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h @@ -43,6 +43,7 @@ #ifndef __ASSEMBLY__ extern long shadow_stack[SHADOW_OVERFLOW_STACK_SIZE / ...
9b07d27d0fbb7f7441aa986859a0f53ec93a0335
Analyze and fix the following issue in the Linux kernel code: swiotlb: mark swiotlb_memblock_alloc() as __init
Problem Details: swiotlb_memblock_alloc() calls memblock_alloc(), which calls (__init) memblock_alloc_try_nid(). However, swiotlb_membloc_alloc() can be marked as __init since it is only called by swiotlb_init_remap(), which is already marked as __init. This prevents a modpost build warning/error: WARNING: modpost: vm...
```diff diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index f35d934f6e58..03e3251cd9d2 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -292,7 +292,8 @@ static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, return; } -static void *swiotlb_memblock_alloc(unsigned l...
0d1f7ff19d4f8a6da5a6b60d2afd1d34b5d5ebfc
Analyze and fix the following issue in the Linux kernel code: wifi: rtw89: refine FW feature judgement on packet drop
Problem Details: The newer chips use the newer firmware branches, e.g. v027, v029. And, those firmware branches are supposed to support packet drop when they are just branched out. The initial firmware branch used by each chip is as below. * 8852A: v009 * 8852C: v027 * 8852B: v027 So, only 8852A may use firmware whic...
```diff diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h index 41365ffb7e5e..b1a886898c5a 100644 --- a/drivers/net/wireless/realtek/rtw89/core.h +++ b/drivers/net/wireless/realtek/rtw89/core.h @@ -3023,7 +3023,7 @@ enum rtw89_fw_feature { RTW89_FW_FEATURE_SCAN_OFFLOAD...
b9b1e4fe2957f361c86e288ecf373dc7895cf7c7
Analyze and fix the following issue in the Linux kernel code: wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo
Problem Details: Fix a new smatch warning: drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:1580 rtl8xxxu_print_chipinfo() warn: always true condition '(priv->chip_cut <= 15) => (0-15 <= 15)' Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202302140753.71IgU77A-lkp@intel...
```diff diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 620a5cc2bfdd..54ca6f2ced3f 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1575,11 +1575,7 @@ rtl8xx...
db5e4b3645534bc8f8d6c24537e9564a62073ac8
Analyze and fix the following issue in the Linux kernel code: wifi: rtlwifi: rtl8192de: Remove the unused variable bcnfunc_enable
Problem Details: Variable bcnfunc_enable is not effectively used, so delete it. drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c:1050:5: warning: variable 'bcnfunc_enable' set but not used. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4110 Signed-off-by: J...
```diff diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c index 2aecb2583f75..df1e36fbc348 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c @@ -1047,7 +1047,6 @@ static int _rtl...
59e6ded57cc1b3b5117cef66dabe6d7977208ba0
Analyze and fix the following issue in the Linux kernel code: wifi: rtlwifi: rtl8192ce: fix dealing empty EEPROM values
Problem Details: On OpenWRT platform, RTL8192CE could be soldered on board, but not standard PCI module. In this case, some EEPROM values aren't programmed and left 0xff. Load default values when the EEPROM values are empty to avoid problems. Signed-off-by: Lu jicong <jiconglu58@gmail.com> Acked-by: Ping-Ke Shih <pksh...
```diff diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c index b9c62640d2cb..dc480323c9cb 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c @@ -1428,7 +1428,9 @@ static void _rt...
a783c962619271a8b905efad1d89adfec11ae0c8
Analyze and fix the following issue in the Linux kernel code: rtc: allow rtc_read_alarm without read_alarm callback
Problem Details: .read_alarm is not necessary to read the current alarm because it is recorded in the aie_timer and so rtc_read_alarm() will never call rtc_read_alarm_internal() which is the only function calling the callback. Reported-by: Zhipeng Wang <zhipeng.wang_1@nxp.com> Reported-by: Marcel Ziswiler <marcel.zisw...
```diff diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 7c30cb3c764d..499d89150afc 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -392,7 +392,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) return err; if (!rtc->ops) { err = -ENODEV; - } else...
cbb60951ce18c9b6e91d2eb97deb41d8ff616622
Analyze and fix the following issue in the Linux kernel code: gfs2: jdata writepage fix
Problem Details: The ->writepage() and ->writepages() operations are supposed to write entire pages. However, on filesystems with a block size smaller than PAGE_SIZE, __gfs2_jdata_writepage() only adds the first block to the current transaction instead of adding the entire page. Fix that. Fixes: 18ec7d5c3f43 ("[GFS2...
```diff diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index e782b4f1d104..2f04c0ff7470 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -127,7 +127,6 @@ static int __gfs2_jdata_writepage(struct page *page, struct writeback_control *w { struct inode *inode = page->mapping->host; struct gfs2_inode *ip = GFS2_I(ino...
deaeeda2051fa280884bf5769021bcdeae5de44e
Analyze and fix the following issue in the Linux kernel code: backlight: pwm_bl: Don't rely on a disabled PWM emiting inactive state
Problem Details: Most but not all PWMs drive the PWM pin to its inactive state when disabled. However if there is no enable_gpio and no regulator the PWM must drive the inactive state to actually disable the backlight. So keep the PWM on in this case. Note that to determine if there is a regulator some effort is requ...
```diff diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 0509fecd5715..fb388148d98f 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -45,9 +45,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb) if (pb->enabled) return; - e...
3a396f9859755e822775319516cd71dabc2b4e69
Analyze and fix the following issue in the Linux kernel code: backlight: sky81452: Fix sky81452_bl_platform_data kernel-doc
Problem Details: Correct the struct name and add a short struct description to fix the kernel-doc notation. Prevents this kernel-doc warning: drivers/video/backlight/sky81452-backlight.c:64: warning: expecting prototype for struct sky81452_platform_data. Prototype was for struct sky81452_bl_platform_data instead Sign...
```diff diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c index c95e0de7f4e7..0172438c38ce 100644 --- a/drivers/video/backlight/sky81452-backlight.c +++ b/drivers/video/backlight/sky81452-backlight.c @@ -41,7 +41,7 @@ #define SKY81452_MAX_BRIGHTNESS (SKY81452_CS +...
3755b46a1bf47a6778f4ce33def1e6122796f57c
Analyze and fix the following issue in the Linux kernel code: backlight: backlight: Fix doc for backlight_device_get_by_name
Problem Details: backlight_put() has been dropped, we should call put_device() to drop the reference taken by backlight_device_get_by_name(). Fixes: 0f6a3256fd81 ("backlight: backlight: Drop backlight_put()") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Sig...
```diff diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index b788ff3d0f45..6eea72aa8dbf 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -501,7 +501,7 @@ EXPORT_SYMBOL(backlight_device_get_by_type); * * This function looks up a bac...
7c15430822e71e90203d87e6d0cfe83fa058b0dc
Analyze and fix the following issue in the Linux kernel code: wifi: ath11k: allow system suspend to survive ath11k
Problem Details: When ath11k runs into internal errors upon suspend, it returns an error code to pci_pm_suspend, which aborts the entire system suspend. The driver should not abort system suspend, but should keep its internal errors to itself, and allow the system to suspend. Otherwise, a user can suspend a laptop by...
```diff diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 776362d151cb..0aeef2948ff5 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -981,7 +981,7 @@ static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev) if ...
60b7d62ba8cdbd073997bff0f1cdae8d844002c0
Analyze and fix the following issue in the Linux kernel code: wifi: ath11k: fix SAC bug on peer addition with sta band migration
Problem Details: Fix sleep in atomic context warning detected by Smatch static checker analyzer. Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex always even if sta is not transitioning to another band. This is peer_add function and a more secure locking should not cause performance regression....
```diff diff --git a/drivers/net/wireless/ath/ath11k/peer.c b/drivers/net/wireless/ath/ath11k/peer.c index 1ae7af02c364..1380811827a8 100644 --- a/drivers/net/wireless/ath/ath11k/peer.c +++ b/drivers/net/wireless/ath/ath11k/peer.c @@ -382,22 +382,23 @@ int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,...
7c4c511f74ba65a18f0beeb9b2fc0e34f28ee79d
Analyze and fix the following issue in the Linux kernel code: wifi: ath10k: Remove redundant assignment to changed_flags
Problem Details: Variable changed_flags is assigned, but is not effectively used, so delete it. drivers/net/wireless/ath/ath10k/mac.c:6024:22: warning: parameter 'changed_flags' set but not used. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3963 Signed-off-by...
```diff diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index ec8d5b29bc72..7675858f069b 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6030,7 +6030,6 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw, mutex_...
4c856ee12df85aabd437c3836ed9f68d94268358
Analyze and fix the following issue in the Linux kernel code: wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()
Problem Details: This loop checks that i < max at the start of loop but then it does i++ which could put it past the end of the array. It's harmless to check again and prevent a potential out of bounds. Fixes: 1048643ea94d ("ath5k: Clean up eeprom parsing and add missing calibration data") Signed-off-by: Dan Carpente...
```diff diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index d444b3d70ba2..58d3e86f6256 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c @@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int...
95c95251d0547b46d6571e4fbd51b42865c15a4a
Analyze and fix the following issue in the Linux kernel code: wifi: ath5k: Use platform_get_irq() to get the interrupt
Problem Details: As of commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core"), we need to use platform_get_irq() instead of platform_get_resource() to get our IRQs because platform_get_resource() simply won't get them anymore. This was already fixed in several other Atheros WiFi drivers, a...
```diff diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 2c9cec8b53d9..28a1e5eff204 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c @@ -113,15 +113,13 @@ static int ath_ahb_probe(struct platform_device *pdev) goto err_out; }...
f117276638b7600b981b3fe28550823cfbe1ef23
Analyze and fix the following issue in the Linux kernel code: wifi: ath11k: Use platform_get_irq() to get the interrupt
Problem Details: As of commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core"), we need to use platform_get_irq() instead of platform_get_resource() to get our IRQs because platform_get_resource() simply won't get them anymore. This was already fixed in several other Atheros WiFi drivers, a...
```diff diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index 022caacd2822..6b6059d5dc38 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -874,11 +874,11 @@ static int ath11k_ahb_setup_msi_resources(struct ath11k_base *ab) ab-...
80e396586d0a94c42015dd9472176d89a3b0e4ca
Analyze and fix the following issue in the Linux kernel code: wifi: ath12k: PCI ops for wakeup/release MHI
Problem Details: Wakeup/release MHI is not needed before pci_read/write for QCN9274. Since wakeup & release MHI is enabled for all QCN9274 and WCN7850, below MHI assert is seen in QCN9274 [ 784.906613] BUG: sleeping function called from invalid context at drivers/bus/mhi/host/pm.c:989 [ 784.906633] in_atomic(): 1, i...
```diff diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index ae7f6083c9fc..d32637b0113d 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -119,6 +119,30 @@ static const char *irq_name[ATH12K_IRQ_NUM_MAX] = { "tcl2host-status-r...
0af8c09c896810879387decfba8c942994bb61f5
Analyze and fix the following issue in the Linux kernel code: netfilter: x_tables: fix percpu counter block leak on error path when creating new netns
Problem Details: Here is the stack where we allocate percpu counter block: +-< __alloc_percpu +-< xt_percpu_counter_alloc +-< find_check_entry # {arp,ip,ip6}_tables.c +-< translate_table And it can be leaked on this code path: +-> ip6t_register_table +-> translate_table # allocates percpu c...
```diff diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index ffc0cab7cf18..2407066b0fec 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@ -1525,6 +1525,10 @@ int arpt_register_table(struct net *net, new_table = xt_register_table(net, table, &bootst...
81435ed2bdea54bef20a898827b127d8ce087495
Analyze and fix the following issue in the Linux kernel code: mfd: simple-mfd-i2c: Fix incoherent comment regarding DT registration
Problem Details: Signed-off-by: Lee Jones <lee@kernel.org>
```diff diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index f4c8fc3ee463..e31f13fd6a79 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -48,7 +48,7 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c) if (IS_ERR(regmap)) return PTR_ERR(regmap); - /*...
88a32c2c5e98d72765846db83c1739e7b036770a
Analyze and fix the following issue in the Linux kernel code: mfd: core: Spelling s/compement/complement/
Problem Details: Fix a misspelling of "complement". Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/aa7abd7103a0e4be954ea63de78f12e8251b2964.1673271092.git.geert+renesas@glider.be
```diff diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index 0bc7cba798a3..14ca7b471576 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h @@ -88,7 +88,7 @@ struct mfd_cell { const char *of_compatible; /* - * Address as defined in Device Tree. Used to compement 'of_compatibl...
8aa06dbe50a612e32b5c367421e2a51ae3f1acc9
Analyze and fix the following issue in the Linux kernel code: mfd: max8925: Remove the unused function irq_to_max8925()
Problem Details: The function irq_to_max8925() is defined in the max8925-core.c file, but not called elsewhere, so remove this unused function. drivers/mfd/max8925-core.c:472:40: warning: unused function 'irq_to_max8925'. Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3561 Reported-by: Abaci Robot <abaci@linu...
```diff diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index eb3f061c8ee6..0246bbe80354 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -469,12 +469,6 @@ static struct max8925_irq_data max8925_irqs[] = { }, }; -static inline struct max8925_irq_data *irq_to_max8925(...
49184844b6653292b2954304005357ef6828b0fa
Analyze and fix the following issue in the Linux kernel code: mfd: qcom-pm8xxx: Remove set but unused variable 'rev'
Problem Details: Variable rev is not effectively used in the function, so delete it. drivers/mfd/qcom-pm8xxx.c:513:6: warning: variable 'rev' set but not used. Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3558 Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@lin...
```diff diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c index 601106580e2e..9a948df8c28d 100644 --- a/drivers/mfd/qcom-pm8xxx.c +++ b/drivers/mfd/qcom-pm8xxx.c @@ -510,7 +510,6 @@ static int pm8xxx_probe(struct platform_device *pdev) struct regmap *regmap; int irq, rc; unsigned int val; - u32 r...
ccc91b3ed3f641efa8e9050c587ef509b0e2be3a
Analyze and fix the following issue in the Linux kernel code: mfd: twl: Fix TWL6032 phy vbus detection
Problem Details: TWL6032 has a few charging registers prepended before the charging registers the TWL6030 has. To be able to use common register defines declare the additional registers as additional module. At the moment this affects the access to CHARGERUSB_CTRL1 in phy-twl6030-usb. Without this patch, it is accessi...
```diff diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 62be2326c9b2..e2d9a93be43b 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -110,8 +110,8 @@ #define TWL6030_BASEADD_PWM 0x00BA #define TWL6030_BASEADD_GASGAUGE 0x00C0 #define TWL6030_BASEADD_PIH 0x00D0 -#define TWL6030_B...
8b450dcff23aa254844492831a8e2b508a9d522d
Analyze and fix the following issue in the Linux kernel code: mfd: pcf50633-adc: Fix potential memleak in pcf50633_adc_async_read()
Problem Details: `req` is allocated in pcf50633_adc_async_read(), but adc_enqueue_request() could fail to insert the `req` into queue. We need to check the return value and free it in the case of failure. Fixes: 08c3e06a5eb2 ("mfd: PCF50633 adc driver") Signed-off-by: Qiheng Lin <linqiheng@huawei.com> Signed-off-by: L...
```diff diff --git a/drivers/mfd/pcf50633-adc.c b/drivers/mfd/pcf50633-adc.c index 5cd653e61512..191b1bc6141c 100644 --- a/drivers/mfd/pcf50633-adc.c +++ b/drivers/mfd/pcf50633-adc.c @@ -136,6 +136,7 @@ int pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg, void *callback_param) { struct pcf506...
5ec32a3e4053c1a726b45381d56aa9e39eaf3911
Analyze and fix the following issue in the Linux kernel code: mfd: cs5535: Don't build on UML
Problem Details: The cs5535-mfd driver uses CPU-specific data that is not available for ARCH=um builds, so don't allow it to be built for UML. Prevents these build errors: In file included from ../arch/x86/include/asm/olpc.h:7, from ../drivers/mfd/cs5535-mfd.c:17: ../arch/x86/include/asm/geode.h: In ...
```diff diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 2632ca2162de..d90b4258fc44 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -15,6 +15,7 @@ config MFD_CS5535 tristate "AMD CS5535 and CS5536 southbridge core functions" select MFD_CORE depends on PCI && (X86_32 || (X86 && COMPILE_TE...
8781ba7f45695af3ab8e8d1b55a31f527c9201a3
Analyze and fix the following issue in the Linux kernel code: mfd: axp20x: Fix order of pek rise and fall events
Problem Details: The power button can get "stuck" if the rising edge and falling edge irq are read in the same pass. This can often be triggered when resuming from suspend if the power button is released before the kernel handles the interrupt. Swapping the order of the rise and fall events makes sure that the press e...
```diff diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 9ab0e2fca7ea..2058194807bd 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -432,8 +432,9 @@ enum { AXP152_IRQ_PEK_SHORT, AXP152_IRQ_PEK_LONG, AXP152_IRQ_TIMER, - AXP152_IRQ_PEK_RIS_EDGE, + /* out of bit ...
5d69b181cd0db10dc8327d28ce837b3623cd531a
Analyze and fix the following issue in the Linux kernel code: mfd: rk808: Re-add rk808-clkout to RK818
Problem Details: Fixes RK818 (e.g. on Pinephone Pro) to register its clock, without which dependent devices (e.g. wifi/BT, via sdio-wifi-pwrseq) fail to probe. This line was removed in commit 3633daacea2e ("mfd: rk808: Permit having multiple PMIC instances"), but only from RK818. Fixes: 3633daacea2e ("mfd: rk808: Per...
```diff diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index f44fc3f080a8..0f22ef61e817 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -189,6 +189,7 @@ static const struct mfd_cell rk817s[] = { }; static const struct mfd_cell rk818s[] = { + { .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE,...
f82cdc37c4bd4ba905bf99ade9782a639b5c12e9
Analyze and fix the following issue in the Linux kernel code: powerpc/pseries: Avoid hcall in plpks_is_available() on non-pseries
Problem Details: plpks_is_available() can be called on any platform via kexec but calls _plpks_get_config() which makes a hcall, which will only work on pseries. Fix this by returning early in plpks_is_available() if hcalls aren't possible. Fixes: 119da30d037d ("powerpc/pseries: Expose PLPKS config values, support add...
```diff diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c index cdf09e5bd741..6f7bf3fc3aea 100644 --- a/arch/powerpc/platforms/pseries/plpks.c +++ b/arch/powerpc/platforms/pseries/plpks.c @@ -22,6 +22,7 @@ #include <asm/hvcall.h> #include <asm/machdep.h> #include <asm/plpks...
442336a5a999d4aae6221e3496dad071a152b1fb
Analyze and fix the following issue in the Linux kernel code: scsi: lpfc: Fix double word in comments
Problem Details: Remove the repeated word "the" in comments. [mkp: fixed additional typos in the changed lines] Link: https://lore.kernel.org/r/20230217083046.4090-1-liubo03@inspur.com Signed-off-by: Bo Liu <liubo03@inspur.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Martin K. Petersen <marti...
```diff diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 76c3434f8976..22f2e046e8eb 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -2541,7 +2541,7 @@ lpfc_sriov_hw_max_virtfn_show(struct device *dev, /** * lpfc_enable_bbcr_set: Sets an attribute va...
fc663711b94468f4e1427ebe289c9f05669699c9
Analyze and fix the following issue in the Linux kernel code: scsi: core: Remove the /proc/scsi/${proc_name} directory earlier
Problem Details: Remove the /proc/scsi/${proc_name} directory earlier to fix a race condition between unloading and reloading kernel modules. This fixes a bug introduced in 2009 by commit 77c019768f06 ("[SCSI] fix /proc memory leak in the SCSI core"). Fix the following kernel warning: proc_dir_entry 'scsi/scsi_debug'...
```diff diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index b28375f9e019..f7f62e56afca 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -181,6 +181,7 @@ void scsi_remove_host(struct Scsi_Host *shost) scsi_forget_host(shost); mutex_unlock(&shost->scan_mutex); scsi_proc_host_rm(shost); + s...
f4407e6033a69ff633ee9d6acf6d241223c7c9fb
Analyze and fix the following issue in the Linux kernel code: scsi: core: Fix a source code comment
Problem Details: Fix an incorrect reference to the scsi_remove_host() function in a source code comment. Link: https://lore.kernel.org/r/20230210205200.36973-2-bvanassche@acm.org Fixes: b49493f99690 ("Fix a memory leak in scsi_host_dev_release()") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Mart...
```diff diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 12346e2297fd..b28375f9e019 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -356,7 +356,7 @@ static void scsi_host_dev_release(struct device *dev) /* * Free the shost_dev device name here if scsi_host_alloc() * and scsi_hos...
e39ea831ebad4ab15c4748cb62a397a8abcca36e
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Fix missing mrioc->evtack_cmds initialization
Problem Details: Commit c1af985d27da ("scsi: mpi3mr: Add Event acknowledgment logic") introduced an array mrioc->evtack_cmds but initialization of the array elements was missed. They are just zero cleared. The function mpi3mr_complete_evt_ack() refers host_tag field of the elements. Due to the zero value of the host_ta...
```diff diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 3306de7170f6..6eaeba41072c 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -4952,6 +4952,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) mpi3mr_init_drv_cmd(&mri...
339e61565f81a6534afdc18fd854b2e2628bf5db
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Use number of bits to manage bitmap sizes
Problem Details: To allocate bitmaps, the mpi3mr driver calculates sizes of bitmaps using byte as unit. However, bitmap helper functions assume that bitmaps are allocated using unsigned long as unit. This gap causes memory access beyond the bitmap sizes and results in "BUG: KASAN: slab-out-of-bounds". The BUG was obse...
```diff diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index def4c5e15cd8..8a438f248a82 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -955,19 +955,16 @@ struct scmd_priv { * @chain_buf_count: Chain buffer count * @chain_buf_pool: Chain buffer pool * @cha...
eeb270aee3e085411399f129fc14fa04bd6d83cf
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Remove unnecessary memcpy() to alltgt_info->dmi
Problem Details: In the function mpi3mr_get_all_tgt_info(), devmap_info points to alltgt_info->dmi then there is no need to memcpy() data from devmap_info to alltgt_info->dmi. Remove the unnecessary memcpy(). This also allows to remove the local variable 'rval' and the goto label 'out'. Link: https://lore.kernel.org/r...
```diff diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c index 72054e3a26cb..bff637702397 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_app.c +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c @@ -293,7 +293,6 @@ out: static long mpi3mr_get_all_tgt_info(struct mpi3mr_ioc *mrioc, struct bsg_job *job) {...
fb428a2005fc1260d18b989cc5199f281617f44d
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Fix issues in mpi3mr_get_all_tgt_info()
Problem Details: The function mpi3mr_get_all_tgt_info() has four issues: 1) It calculates valid entry length in alltgt_info assuming the header part of the struct mpi3mr_device_map_info would equal to sizeof(u32). The correct size is sizeof(u64). 2) When it calculates the valid entry length kern_entrylen, it e...
```diff diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c index 9baac224b213..72054e3a26cb 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_app.c +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c @@ -312,7 +312,7 @@ static long mpi3mr_get_all_tgt_info(struct mpi3mr_ioc *mrioc, num_devices++; spin_unlock...
ae7d45f5283d30274039b95d3e6d53d33c66e991
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Fix an issue found by KASAN
Problem Details: Write only correct size (32 instead of 64 bytes). Link: https://lore.kernel.org/r/20230213193752.6859-1-thenzl@redhat.com Fixes: 42fc9fee116f ("scsi: mpi3mr: Add helper functions to manage device's port") Signed-off-by: Tomas Henzl <thenzl@redhat.com> Acked-by: Sathya Prakash Veerichetty <sathya.praka...
```diff diff --git a/drivers/scsi/mpi3mr/mpi3mr_transport.c b/drivers/scsi/mpi3mr/mpi3mr_transport.c index 3fc897336b5e..3b61815979da 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_transport.c +++ b/drivers/scsi/mpi3mr/mpi3mr_transport.c @@ -1280,7 +1280,7 @@ void mpi3mr_sas_host_add(struct mpi3mr_ioc *mrioc) if (mrioc->s...
c6f2e6b6eaaf883df482cb94f302acad9b80a2a4
Analyze and fix the following issue in the Linux kernel code: scsi: mpi3mr: Replace 1-element array with flex-array
Problem Details: Nothing else defined MPI3_NVME_ENCAP_CMD_MAX, so the "command" buffer was being defined as a fake flexible array of size 1. Replace this with a proper flex array. Avoids this GCC 13 warning under -fstrict-flex-arrays=3: In function 'fortify_memset_chk', inlined from 'mpi3mr_build_nvme_sgl' at ../d...
```diff diff --git a/include/uapi/scsi/scsi_bsg_mpi3mr.h b/include/uapi/scsi/scsi_bsg_mpi3mr.h index fdc3517f9e19..907d345f04f9 100644 --- a/include/uapi/scsi/scsi_bsg_mpi3mr.h +++ b/include/uapi/scsi/scsi_bsg_mpi3mr.h @@ -455,12 +455,6 @@ struct mpi3mr_bsg_packet { } cmd; }; - -/* MPI3: NVMe Encasulation related ...
ee4e7dfe4ffc9ca50c6875757bd119abfe22b5c5
Analyze and fix the following issue in the Linux kernel code: scsi: ipr: Work around fortify-string warning
Problem Details: The ipr_log_vpd_compact() function triggers a fortified memcpy() warning about a potential string overflow with all versions of clang: In file included from drivers/scsi/ipr.c:43: In file included from include/linux/string.h:254: include/linux/fortify-string.h:520:4: error: call to '__write_overflow_f...
```diff diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 5feffda0ef68..b9f6a16cc1c6 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -1516,23 +1516,22 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd) } /** - * strip_and_pad_whitespace - Strip and pad trailing whitespace. - * @i: index ...
8ac6e619d9d51b3eb5bae817db8aa94e780a0db4
Analyze and fix the following issue in the Linux kernel code: riscv: Add header include guards to insn.h
Problem Details: Add header include guards to insn.h to prevent repeating declaration of any identifiers in insn.h. Fixes: edde5584c7ab ("riscv: Add SW single-step support for KDB") Signed-off-by: Liao Chang <liaochang1@huawei.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Fixes: c9c1af3f186a ("RISC-V: renam...
```diff diff --git a/arch/riscv/include/asm/insn.h b/arch/riscv/include/asm/insn.h index 6567cd5ed6ba..8d5c84f2d5ef 100644 --- a/arch/riscv/include/asm/insn.h +++ b/arch/riscv/include/asm/insn.h @@ -3,6 +3,9 @@ * Copyright (C) 2020 SiFive */ +#ifndef _ASM_RISCV_INSN_H +#define _ASM_RISCV_INSN_H + #include <linux...
130aee3fd9981297ff9354e5d5609cd59aafbbea
Analyze and fix the following issue in the Linux kernel code: riscv: Avoid enabling interrupts in die()
Problem Details: While working on something else, I noticed that the kernel would start accepting interrupts again after crashing in an interrupt handler. Since the kernel is already in inconsistent state, enabling interrupts is dangerous and opens up risk of kernel state deteriorating further. Interrupts do get enable...
```diff diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 549bde5c970a..70c98ce23be2 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -34,10 +34,11 @@ void die(struct pt_regs *regs, const char *str) static int die_counter; int ret; long cause; + unsigned long flags;...
416721ff05fddc58ca531b6f069de250301de6e5
Analyze and fix the following issue in the Linux kernel code: riscv, mm: Perform BPF exhandler fixup on page fault
Problem Details: Commit 21855cac82d3 ("riscv/mm: Prevent kernel module to access user memory without uaccess routines") added early exits/deaths for page faults stemming from accesses to user-space without using proper uaccess routines (where sstatus.SUM is set). Unfortunatly, this is too strict for some BPF programs,...
```diff diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index d86f7cebd4a7..eb0774d9c03b 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -267,10 +267,12 @@ asmlinkage void do_page_fault(struct pt_regs *regs) if (user_mode(regs)) flags |= FAULT_FLAG_USER; - if (!user_mode(regs) && add...
9493e6f3ce02f44c21aa19f3cbf3b9aa05479d06
Analyze and fix the following issue in the Linux kernel code: RISC-V: take text_mutex during alternative patching
Problem Details: Guenter reported a splat during boot, that Samuel pointed out was the lockdep assertion failing in patch_insn_write(): WARNING: CPU: 0 PID: 0 at arch/riscv/kernel/patch.c:63 patch_insn_write+0x222/0x2f6 epc : patch_insn_write+0x222/0x2f6 ra : patch_insn_write+0x21e/0x2f6 epc : ffffffff800068c6 ra : f...
```diff diff --git a/arch/riscv/errata/sifive/errata.c b/arch/riscv/errata/sifive/errata.c index ef9a4eec0dba..da55cb247e89 100644 --- a/arch/riscv/errata/sifive/errata.c +++ b/arch/riscv/errata/sifive/errata.c @@ -4,6 +4,7 @@ */ #include <linux/kernel.h> +#include <linux/memory.h> #include <linux/module.h> #inc...
1eac28201ac0725192f5ced34192d281a06692e5
Analyze and fix the following issue in the Linux kernel code: RISC-V: fix ordering of Zbb extension
Problem Details: As Andrew reported, Zb* comes after Zi* according 27.11 "Subset Naming Convention" so fix the ordering accordingly. Reported-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Andrew...
```diff diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 420228e219f7..8400f0cc9704 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -185,9 +185,9 @@ arch_initcall(riscv_cpuinfo_init); * New entries to this struct should follow the ordering rules described above. */ static ...
9ddfc3cd806081ce1f6c9c2f988cbb031f35d28f
Analyze and fix the following issue in the Linux kernel code: riscv: jump_label: Fixup unaligned arch_static_branch function
Problem Details: Runtime code patching must be done at a naturally aligned address, or we may execute on a partial instruction. We have encountered problems traced back to static jump functions during the test. We switched the tracer randomly for every 1~5 seconds on a dual-core QEMU setup and found the kernel sucking...
```diff diff --git a/arch/riscv/include/asm/jump_label.h b/arch/riscv/include/asm/jump_label.h index 6d58bbb5da46..14a5ea8d8ef0 100644 --- a/arch/riscv/include/asm/jump_label.h +++ b/arch/riscv/include/asm/jump_label.h @@ -18,6 +18,7 @@ static __always_inline bool arch_static_branch(struct static_key * const key, ...
b49f700668fff7565b945dce823def79bff59bb0
Analyze and fix the following issue in the Linux kernel code: riscv: mm: fix regression due to update_mmu_cache change
Problem Details: This is a partial revert of the commit 4bd1d80efb5a ("riscv: mm: notify remote harts about mmu cache updates"). Original commit included two loosely related changes serving the same purpose of fixing stale TLB entries causing user-space application crash: - introduce deferred per-ASID TLB flush for CPU...
```diff diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 2a88362dffa5..039dee5fb76e 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -415,7 +415,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, * Relying on flush_tlb_fix...
00b242509c8f2b9041c4c16d67d51eae3c9ab1d9
Analyze and fix the following issue in the Linux kernel code: scripts/decodecode: Add support for RISC-V
Problem Details: RISC-V has some GNU disassembly quirks, e.g. it requires '-D' to properly disassemble .2byte directives similar to Arm [1]. Further, GNU objdump groups RISC-V instruction by 2 or 4 byte chunks, instead doing byte-for-byte. Add the required switches, and translate from short/word to bytes when ARCH is ...
```diff diff --git a/scripts/decodecode b/scripts/decodecode index b28fd2686561..8fe71c292381 100755 --- a/scripts/decodecode +++ b/scripts/decodecode @@ -93,6 +93,11 @@ disas() { ${CROSS_COMPILE}strip $t.o fi + if [ "$ARCH" = "riscv" ]; then + OBJDUMPFLAGS="-M no-aliases --section=.text -D" + ${CROSS_COMPILE}...
eb165bfa8eafc3d306e34b238e53aafb35dce102
Analyze and fix the following issue in the Linux kernel code: riscv: Add instruction dump to RISC-V splats
Problem Details: Add instruction dump (Code:) output to RISC-V splats. Dump 16b parcels. An example: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Oops [#1] Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.2.0-rc3-00302-g840ff44c571d-dirty #27 Hardware nam...
```diff diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c index 549bde5c970a..fbdcdbc792d3 100644 --- a/arch/riscv/kernel/traps.c +++ b/arch/riscv/kernel/traps.c @@ -29,6 +29,27 @@ int show_unhandled_signals = 1; static DEFINE_SPINLOCK(die_lock); +static void dump_kernel_instr(const char *loglvl, ...
fdf6491193e411087ae77bcbc6468e3e1cff99ed
Analyze and fix the following issue in the Linux kernel code: netfilter: ctnetlink: make event listener tracking global
Problem Details: pernet tracking doesn't work correctly because other netns might have set NETLINK_LISTEN_ALL_NSID on its event socket. In this case its expected that events originating in other net namespaces are also received. Making pernet-tracking work while also honoring NETLINK_LISTEN_ALL_NSID requires much mor...
```diff diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index d8817d381c14..bef8db9d6c08 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -488,4 +488,9 @@ extern const struct nfnl_ct_hook __rcu *nfnl_ct_hook; */ DECLARE_PER_CPU(bool, nf_skb_duplicated); +/** + * Contains...
05c07c0c6cc8ec2278ace9871618c41f1365d1f5
Analyze and fix the following issue in the Linux kernel code: netfilter: xt_length: use skb len to match in length_mt6
Problem Details: For IPv6 Jumbo packets, the ipv6_hdr(skb)->payload_len is always 0, and its real payload_len ( > 65535) is saved in hbh exthdr. With 0 length for the jumbo packets, it may mismatch. To fix this, we can just use skb->len instead of parsing exthdrs, as the hbh exthdr parsing has been done before coming ...
```diff diff --git a/net/netfilter/xt_length.c b/net/netfilter/xt_length.c index 1873da3a945a..9fbfad13176f 100644 --- a/net/netfilter/xt_length.c +++ b/net/netfilter/xt_length.c @@ -30,8 +30,7 @@ static bool length_mt6(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_length_info *info = pa...
cf8c59a3756b2735c409a9b3ac1e4ec556546a7a
Analyze and fix the following issue in the Linux kernel code: tools/bootconfig: fix single & used for logical condition
Problem Details: A single & will create a background process and return true, so the grep command will run even if the file checked in the first condition does not exist. Link: https://lore.kernel.org/all/20230112114215.17103-1-antonio.feijoo@suse.com/ Fixes: 1eaad3ac3f39 ("tools/bootconfig: Use per-group/all enable ...
```diff diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh index 6183b36c6846..1603801cf126 100755 --- a/tools/bootconfig/scripts/ftrace2bconf.sh +++ b/tools/bootconfig/scripts/ftrace2bconf.sh @@ -93,7 +93,7 @@ referred_vars() { } event_is_enabled() { # enable-file - te...
e58a171d35e32e6e8c37cfe0e8a94406732a331f
Analyze and fix the following issue in the Linux kernel code: netfilter: ebtables: fix table blob use-after-free
Problem Details: We are not allowed to return an error at this point. Looking at the code it looks like ret is always 0 at this point, but its not. t = find_table_lock(net, repl->name, &ret, &ebt_mutex); ... this can return a valid table, with ret != 0. This bug causes update of table->private with the new blob, but...
```diff diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index ce5dfa3babd2..757ec46fc45a 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -1090,7 +1090,7 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl, audit_log_nfcfg(rep...
efb056e5f1f0036179b2f92c1c15f5ea7a891d70
Analyze and fix the following issue in the Linux kernel code: netfilter: ip6t_rpfilter: Fix regression with VRF interfaces
Problem Details: When calling ip6_route_lookup() for the packet arriving on the VRF interface, the result is always the real (slave) interface. Expect this when validating the result. Fixes: acc641ab95b66 ("netfilter: rpfilter/fib: Populate flowic_l3mdev field") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: ...
```diff diff --git a/net/ipv6/netfilter/ip6t_rpfilter.c b/net/ipv6/netfilter/ip6t_rpfilter.c index a01d9b842bd0..67c87a88cde4 100644 --- a/net/ipv6/netfilter/ip6t_rpfilter.c +++ b/net/ipv6/netfilter/ip6t_rpfilter.c @@ -72,7 +72,9 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb, got...
2076f57f2ca0a2034afac7832257b2bc509c1a87
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: mcq: Fix incorrectly set queue depth
Problem Details: ufshcd_config_mcq() may change the can_queue value. The current code invokes scsi_add_host() before ufshcd_config_mcq() so the tags are limited to the original can_queue value. Fix this by invoking scsi_add_host() after ufshcd_config_mcq(). Link: https://lore.kernel.org/r/8840cea4a57b46dabce18acc39af...
```diff diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0baeec4ca304..47c7739b9a86 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8521,7 +8521,9 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params) return ret; if (is_mcq_supported(hba) &...
e6d57e9ff0aec323717ee36fc9ea34ad89217151
Analyze and fix the following issue in the Linux kernel code: netfilter: conntrack: fix rmmod double-free race
Problem Details: nf_conntrack_hash_check_insert() callers free the ct entry directly, via nf_conntrack_free. This isn't safe anymore because nf_conntrack_hash_check_insert() might place the entry into the conntrack table and then delteted the entry again because it found that a conntrack extension has been removed at ...
```diff diff --git a/net/netfilter/nf_conntrack_bpf.c b/net/netfilter/nf_conntrack_bpf.c index 24002bc61e07..e1af14e3b63c 100644 --- a/net/netfilter/nf_conntrack_bpf.c +++ b/net/netfilter/nf_conntrack_bpf.c @@ -381,7 +381,6 @@ struct nf_conn *bpf_ct_insert_entry(struct nf_conn___init *nfct_i) struct nf_conn *nfct = (...
19873b03f1daeffd9d5e089b855dd926975ab5b7
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: ufs-mediatek: Guard power management functions with CONFIG_PM
Problem Details: Fix the following compilation error when CONFIG_PM is set to 'n': drivers/ufs/host/ufs-mediatek.c: In function `ufs_mtk_runtime_suspend`: drivers/ufs/host/ufs-mediatek.c:1623:8: error: implicit declaration of function `ufshcd_runtime_suspend`; did you mean `ufs_mtk_runtime_suspend`? [-Werror=implici...
```diff diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 21d9b047539f..73e217260390 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1613,6 +1613,7 @@ static int ufs_mtk_system_resume(struct device *dev) } #endif +#ifdef CONFIG_PM static int...
7dafc3e007918384c8693ff8d70381b5c1e9c247
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: core: Initialize devfreq synchronously
Problem Details: During UFS initialization, devfreq initialization is asynchronous: ufshcd_async_scan() calls ufshcd_add_lus(), which in turn initializes devfreq for UFS. The simple ondemand governor is then loaded. If it is built as a module, request_module() is called and throws a warning: WARNING: CPU: 7 PID: 167...
```diff diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 3b3cf78d3b10..0baeec4ca304 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1411,6 +1411,13 @@ static int ufshcd_devfreq_target(struct device *dev, struct ufs_clk_info *clki; unsigned long irq_flags; + /* + ...
ac4893980bbe79ce383daf9a0885666a30fe4c83
Analyze and fix the following issue in the Linux kernel code: netfilter: ctnetlink: fix possible refcount leak in ctnetlink_create_conntrack()
Problem Details: nf_ct_put() needs to be called to put the refcount got by nf_conntrack_find_get() to avoid refcount leak when nf_conntrack_hash_check_insert() fails. Fixes: 7d367e06688d ("netfilter: ctnetlink: fix soft lockup when netlink adds new entries (v2)") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Acked-by: ...
```diff diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 1286ae7d4609..ca4d5bb1ea52 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -2375,12 +2375,15 @@ ctnetlink_create_conntrack(struct net *net, err = nf_conntrack_hash_c...
473025a6b6f8a4a8de3120c78588d32cf4ba7324
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: Make the TC G210 driver dependent on CONFIG_OF
Problem Details: The TC G210 driver only supports devices declared in the device tree. Hence make this driver dependent on CONFIG_OF. This patch fixes the following compiler error: drivers/ufs/host/tc-dwc-g210-pltfrm.c:36:34: error: ‘tc_dwc_g210_pltfm_match’ defined but not used [-Werror=unused-const-variable=] 36 ...
```diff diff --git a/drivers/ufs/host/Kconfig b/drivers/ufs/host/Kconfig index 663881437921..8793e3433580 100644 --- a/drivers/ufs/host/Kconfig +++ b/drivers/ufs/host/Kconfig @@ -48,7 +48,7 @@ config SCSI_UFS_CDNS_PLATFORM config SCSI_UFS_DWC_TC_PLATFORM tristate "DesignWare platform support using a G210 Test Chip...
3fe97ff3d94934649abb0652028dd7296170c8d0
Analyze and fix the following issue in the Linux kernel code: scsi: ses: Don't attach if enclosure has no components
Problem Details: An enclosure with no components can't usefully be operated by the driver (since effectively it has nothing to manage), so report the problem and don't attach. Not attaching also fixes an oops which could occur if the driver tries to manage a zero component enclosure. [mkp: Switched to KERN_WARNING sin...
```diff diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 9d4fb09acc1e..b11a9162e73a 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -733,6 +733,12 @@ static int ses_intf_add(struct device *cdev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; } + + if (comp...
578797f0c8cbc2e3ec5fc0dab87087b4c7073686
Analyze and fix the following issue in the Linux kernel code: scsi: ses: Fix slab-out-of-bounds in ses_intf_remove()
Problem Details: A fix for: BUG: KASAN: slab-out-of-bounds in ses_intf_remove+0x23f/0x270 [ses] Read of size 8 at addr ffff88a10d32e5d8 by task rmmod/12013 When edev->components is zero, accessing edev->component[0] members is wrong. Link: https://lore.kernel.org/r/20230202162451.15346-5-thenzl@redhat.com Cc: stable...
```diff diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index f8031d0782f7..9d4fb09acc1e 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -856,7 +856,8 @@ static void ses_intf_remove_enclosure(struct scsi_device *sdev) kfree(ses_dev->page2); kfree(ses_dev); - kfree(edev->component[0].scratch); + i...
801ab13d50cf3d26170ee073ea8bb4eececb76ab
Analyze and fix the following issue in the Linux kernel code: scsi: ses: Fix possible desc_ptr out-of-bounds accesses
Problem Details: Sanitize possible desc_ptr out-of-bounds accesses in ses_enclosure_data_process(). Link: https://lore.kernel.org/r/20230202162451.15346-4-thenzl@redhat.com Cc: stable@vger.kernel.org Signed-off-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
```diff diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 458ca7abbbef..f8031d0782f7 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -578,15 +578,19 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, int max_desc_len; if (desc_ptr) { - if (desc_ptr >= buf + page7_...
db95d4df71cb55506425b6e4a5f8d68e3a765b63
Analyze and fix the following issue in the Linux kernel code: scsi: ses: Fix possible addl_desc_ptr out-of-bounds accesses
Problem Details: Sanitize possible addl_desc_ptr out-of-bounds accesses in ses_enclosure_data_process(). Link: https://lore.kernel.org/r/20230202162451.15346-3-thenzl@redhat.com Cc: stable@vger.kernel.org Signed-off-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
```diff diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 034d605c3076..458ca7abbbef 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -439,8 +439,8 @@ int ses_match_host(struct enclosure_device *edev, void *data) } #endif /* 0 */ -static void ses_process_descriptor(struct enclosure_component ...
9b4f5028e493cb353a5c8f5c45073eeea0303abd
Analyze and fix the following issue in the Linux kernel code: scsi: ses: Fix slab-out-of-bounds in ses_enclosure_data_process()
Problem Details: A fix for: BUG: KASAN: slab-out-of-bounds in ses_enclosure_data_process+0x949/0xe30 [ses] Read of size 1 at addr ffff88a1b043a451 by task systemd-udevd/3271 Checking after (and before in next loop) addl_desc_ptr[1] is sufficient, we expect the size to be sanitized before first access to addl_desc_ptr...
```diff diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 869ca9c7f23f..034d605c3076 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -609,9 +609,11 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, /* these elements are optional */ type_ptr[0] == ENCLOSURE_C...
586dc36226dd748b197eea8642c087cae611129b
Analyze and fix the following issue in the Linux kernel code: Input: hp_sdc_rtc - mark an unused function as __maybe_unused
Problem Details: When CONFIG_PROC_FS is not set, one procfs-related function is not used, causing a build error or warning. Mark this function as __maybe_unused to quieten the build. ../drivers/input/misc/hp_sdc_rtc.c:268:12: warning: 'hp_sdc_rtc_proc_show' defined but not used [-Wunused-function] 268 | static int h...
```diff diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index 199bc17ddb1d..afc0d6dc5787 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c @@ -265,7 +265,7 @@ static inline int hp_sdc_rtc_read_ct(struct timespec64 *res) { return 0; } -static int hp_sd...
c6f3b684c2c4e8d4700fe8c4a173c0a70df6cc14
Analyze and fix the following issue in the Linux kernel code: dt-bindings: google,cros-ec-keyb: Fix spelling error
Problem Details: The dependency had an obvious spelling error. Fix it. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230220135531.1987351-1-linus.walleij@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torok...
```diff diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml index e05690b3e963..a8abdb39623b 100644 --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml +++ b/Documentation/devicetree/bindings/input/google,cro...
f1aa2eb5ea05ccd1fd92d235346e60e90a1ed949
Analyze and fix the following issue in the Linux kernel code: sysctl: fix proc_dobool() usability
Problem Details: Currently proc_dobool expects a (bool *) in table->data, but sizeof(int) in table->maxsize, because it uses do_proc_dointvec() directly. This is unsafe for at least two reasons: 1. A sysctl table definition may use { .data = &variable, .maxsize = sizeof(variable) }, not realizing that this makes th...
```diff diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 59ef8a1f843f..914ea1c3537d 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -496,7 +496,7 @@ static struct ctl_table nlm_sysctls[] = { { .procname = "nsm_use_hostnames", .data = &nsm_use_hostnames, - .maxlen = sizeof(int), + .maxlen = sizeof(boo...
02d7bd1efb4280ea1a75ad1eece3f19537f82a19
Analyze and fix the following issue in the Linux kernel code: clk: imx: pll14xx: fix recalc_rate for negative kdiv
Problem Details: kdiv is a signed 16 bit value in the DEV_CTL1 register. Commit 53990cf9d5b4 ("clk: imx: pll14xx: consolidate rate calculation") changed the kdiv variable from a short int to just int. When the value read from the DIV_CTL1 register is assigned directly to an int the sign of the value is lost resulting i...
```diff diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index 828336873a98..7150c59bbfc9 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c @@ -256,7 +256,7 @@ static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw, if (pll->type == PLL_1443X) { pll_...
a00da30c052f07d67da56efd6a4f1fc85956c979
Analyze and fix the following issue in the Linux kernel code: net: ethtool: fix __ethtool_dev_mm_supported() implementation
Problem Details: The MAC Merge layer is supported when ops->get_mm() returns 0. The implementation was changed during review, and in this process, a bug was introduced. Link: https://lore.kernel.org/netdev/20230111161706.1465242-5-vladimir.oltean@nxp.com/ Fixes: 04692c9020b7 ("net: ethtool: netlink: retrieve stats fro...
```diff diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c index e612856eed8c..fce3cc2734f9 100644 --- a/net/ethtool/mm.c +++ b/net/ethtool/mm.c @@ -247,5 +247,5 @@ bool __ethtool_dev_mm_supported(struct net_device *dev) if (ops && ops->get_mm) ret = ops->get_mm(dev, &state); - return !!ret; + return !ret; } ```
7ec077744aade63729d58c2d26861c3147a4d8aa
Analyze and fix the following issue in the Linux kernel code: ethtool: pse-pd: Fix double word in comments
Problem Details: Remove the repeated word "for" in comments. Signed-off-by: Bo Liu <liubo03@inspur.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20230221083036.2414-1-liubo03@inspur.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
```diff diff --git a/net/ethtool/pse-pd.c b/net/ethtool/pse-pd.c index a5b607b0a652..530b8b99e6df 100644 --- a/net/ethtool/pse-pd.c +++ b/net/ethtool/pse-pd.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only // -// ethtool interface for for Ethernet PSE (Power Sourcing Equipment) +// ethtool interface for Eth...
951bce29c8988209cc359e1fa35a4aaa35542fd5
Analyze and fix the following issue in the Linux kernel code: xsk: add linux/vmalloc.h to xsk.c
Problem Details: Fix the failure of the compilation under the sh4. Because we introduced remap_vmalloc_range() earlier, this has caused the compilation failure on the sh4 platform. So this introduction of the header file of linux/vmalloc.h. config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20230221/202...
```diff diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 45eef5af0a51..2ac58b282b5e 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -22,6 +22,7 @@ #include <linux/net.h> #include <linux/netdevice.h> #include <linux/rculist.h> +#include <linux/vmalloc.h> #include <net/xdp_sock_drv.h> #include <net/busy_poll.h> #...
b4858dc61647e5439cbba79022bfc87328c1fb84
Analyze and fix the following issue in the Linux kernel code: of: dynamic: Fix spelling mistake "kojbect" -> "kobject"
Problem Details: There is a spelling mistake in a pr_err message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Frank Rowand <frowand.list@gmail.com> Link: https://lore.kernel.org/r/20230220144422.873356-1-colin.i.king@gmail.com Signed-off-by: Rob Herring <robh@kernel.org>
```diff diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 12aa99018969..07d93753b12f 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -350,7 +350,7 @@ void of_node_release(struct kobject *kobj) if (!IS_ENABLED(CONFIG_OF_UNITTEST) || strcmp(node->parent->full_name, "testcase-data"))...
3fb1f62f80a1d249260db5ea9e22c51e52fab9ae
Analyze and fix the following issue in the Linux kernel code: drm/fb-helper: Remove drm_fb_helper_unprepare() from drm_fb_helper_fini()
Problem Details: Move drm_fb_helper_unprepare() from drm_fb_helper_fini() into the calling fbdev implementation. Avoids a possible stale mutex with generic fbdev code. As indicated by its name, drm_fb_helper_prepare() prepares struct drm_fb_helper before setting up the fbdev support with a call to drm_fb_helper_init()...
```diff diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 07e410c62b7a..0e44f53e9fa4 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c @@ -147,6 +147,7 @@ int armada_fbdev_init(struct drm_device *dev) err_fb_setup: drm_fb_he...
f922c7b1c1c45740d329bf248936fdb78c0cff6e
Analyze and fix the following issue in the Linux kernel code: sefltests: netdevsim: wait for devlink instance after netns removal
Problem Details: When devlink instance is put into network namespace and that network namespace gets deleted, devlink instance is moved back into init_ns. This is done as a part of cleanup_net() routine. Since cleanup_net() is called asynchronously from workqueue, there is no guarantee that the devlink instance move is...
```diff diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh index a08c02abde12..7f7d20f22207 100755 --- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh +++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh @@ -17,6 +17,18 @...
b60417a9f2b890a8094477b2204d4f73c535725e
Analyze and fix the following issue in the Linux kernel code: selftest: fib_tests: Always cleanup before exit
Problem Details: Usage of `set -e` before executing a command causes immediate exit on failure, without cleanup up the resources allocated at setup. This can affect the next tests that use the same resources, leading to a chain of failures. A simple fix is to always call cleanup function when the script exists. This a...
```diff diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 5637b5dadabd..70ea8798b1f6 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh @@ -2065,6 +2065,8 @@ EOF ######################################################...
df57109bd50b9ed6911f3c2aa914189fe4c1fe2c
Analyze and fix the following issue in the Linux kernel code: cifs: use tcon allocation functions even for dummy tcon
Problem Details: In smb2_reconnect_server, we allocate a dummy tcon for calling reconnect for just the session. This should be allocated using tconInfoAlloc, and not kmalloc. Fixes: 3663c9045f51 ("cifs: check reconnects for channels of active tcons too") Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Reviewed-b...
```diff diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0954fedfd1bc..ca9d7110ddcb 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3906,7 +3906,7 @@ void smb2_reconnect_server(struct work_struct *work) goto done; /* allocate a dummy tcon struct used for reconnect */ - tcon = kzalloc(sizeof(st...
bec46462567032afb05017cb10c545aab0810a73
Analyze and fix the following issue in the Linux kernel code: powerpc: dts: turris1x.dts: Set lower priority for CPLD syscon-reboot
Problem Details: Due to CPLD firmware bugs, set CPLD syscon-reboot priority level to 64 (between rstcr and watchdog) to ensure that rstcr's global-utilities reset method which is preferred stay as default one, and to ensure that CPLD syscon-reboot is more preferred than watchdog reset method. Fixes: 0531a4abd1c6 ("pow...
```diff diff --git a/arch/powerpc/boot/dts/turris1x.dts b/arch/powerpc/boot/dts/turris1x.dts index e9cda34a140e..c9b619f6ed5c 100644 --- a/arch/powerpc/boot/dts/turris1x.dts +++ b/arch/powerpc/boot/dts/turris1x.dts @@ -367,11 +367,34 @@ }; reboot@d { + /* + * CPLD firmware which manages system reset an...
1b9b4f922f96108da3bb5d87b2d603f5dfbc5650
Analyze and fix the following issue in the Linux kernel code: drm/nouveau/fb/gp102-: cache scrubber binary on first load
Problem Details: During system shutdown nouveau might not be able to request firmware from Userspace, which then leads to a regression preventing the system from shutting down. Cache the scrubber binary for this case. Fixes: 0e44c21708761 ("drm/nouveau/flcn: new code to load+boot simple HS FWs (VPR scrubber)") Signed...
```diff diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h index c5a4f49ee206..01a22a13b452 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h @@ -2,6 +2,7 @@ #ifndef __NVKM_FB_H__ #define _...
3638a820c5c3b52f327cebb174fd4274bee08aa7
Analyze and fix the following issue in the Linux kernel code: drm/nouveau/kms/nv50: fix nv50_wndw_new_ prototype
Problem Details: gcc-13 warns about mismatching types for enums. That revealed switched arguments of nv50_wndw_new_(): drivers/gpu/drm/nouveau/dispnv50/wndw.c:696:1: error: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane...
```diff diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h index 591c852f326b..76a6ae5d5652 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -35,8 +35,9 @@ struct nv50_wndw { int nv50_wndw_new_(const struct nv50_wndw_fun...
4d5a2cce47a8e1e7119a881a4714f0eee557c1cd
Analyze and fix the following issue in the Linux kernel code: drm/nouveau/kms/nv50: fix nv50_wndw_new_ prototype
Problem Details: gcc-13 warns about mismatching types for enums. That revealed switched arguments of nv50_wndw_new_(): drivers/gpu/drm/nouveau/dispnv50/wndw.c:696:1: error: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane...
```diff diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h index 591c852f326b..76a6ae5d5652 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -35,8 +35,9 @@ struct nv50_wndw { int nv50_wndw_new_(const struct nv50_wndw_fun...
f2b6cfda76d2119871e10fa01ecdc7178401ef22
Analyze and fix the following issue in the Linux kernel code: net/mlx5e: Align IPsec ASO result memory to be as required by hardware
Problem Details: Hardware requires an alignment to 64 bytes to return ASO data. Missing this alignment caused to unpredictable results while ASO events were generated. Fixes: 8518d05b8f9a ("net/mlx5e: Create Advanced Steering Operation object for IPsec") Reported-by: Emeel Hakim <ehakim@nvidia.com> Signed-off-by: Leon...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h index ddd7be05f18f..12f044330639 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h @@ -129,7 +129,7 ...
5f22c3b6215d34b8af45c390c8d5ea2cef2ef5d2
Analyze and fix the following issue in the Linux kernel code: sfc: fix builds without CONFIG_RTC_LIB
Problem Details: Add an embarrassingly missed semicolon plus and embarrassingly missed parenthesis breaking kernel building when CONFIG_RTC_LIB is not set like the one reported with ia64 config. Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202302170047.EjCPizu3-lkp@intel.c...
```diff diff --git a/drivers/net/ethernet/sfc/efx_devlink.c b/drivers/net/ethernet/sfc/efx_devlink.c index 52fe2b2658f3..381b805659d3 100644 --- a/drivers/net/ethernet/sfc/efx_devlink.c +++ b/drivers/net/ethernet/sfc/efx_devlink.c @@ -323,7 +323,7 @@ static void efx_devlink_info_running_v2(struct efx_nic *efx, ...
5feeaba1063102baf789f4df263f655333924ccb
Analyze and fix the following issue in the Linux kernel code: sfc: clean up some inconsistent indentings
Problem Details: Fix some indentngs and remove the warning below: drivers/net/ethernet/sfc/mae.c:657 efx_mae_enumerate_mports() warn: inconsistent indenting Reported-by: Abaci Robot <abaci@linux.alibaba.com> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4117 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> A...
```diff diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c index 6321fd393fc3..2d32abe5f478 100644 --- a/drivers/net/ethernet/sfc/mae.c +++ b/drivers/net/ethernet/sfc/mae.c @@ -654,8 +654,8 @@ int efx_mae_enumerate_mports(struct efx_nic *efx) MAE_MPORT_DESC_VNIC_FUNCTION_INTERFAC...
f8f185e39b4de91bc5235e5be0d829bea69d9b06
Analyze and fix the following issue in the Linux kernel code: net/mlx4_en: Introduce flexible array to silence overflow warning
Problem Details: The call "skb_copy_from_linear_data(skb, inl + 1, spc)" triggers a FORTIFY memcpy() warning on ppc64 platform: In function ‘fortify_memcpy_chk’, inlined from ‘skb_copy_from_linear_data’ at ./include/linux/skbuff.h:4029:2, inlined from ‘build_inline_wqe’ at drivers/net/ethernet/mellanox/mlx4/en...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index c5758637b7be..2f79378fbf6e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -699,32 +699,32 @@ static void build_inline_wqe(struct mlx4_en_tx_desc...
3a70e0d4c9d74cb00f7c0ec022f5599f9f7ba07d
Analyze and fix the following issue in the Linux kernel code: net: lan966x: Fix possible deadlock inside PTP
Problem Details: When doing timestamping in lan966x and having PROVE_LOCKING enabled the following warning is shown. ======================================================== WARNING: possible irq lock inversion dependency detected 6.2.0-rc7-01749-gc54e1f7f7e36 #2786 Tainted: G N -----------------------...
```diff diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c index a8348437dd87..61fbabf5bebc 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c @@ -524,9 +524,9 @@ irqreturn_t l...
275487b4be8969fdb15fd2d47510d358963629d6
Analyze and fix the following issue in the Linux kernel code: vdpa: fix improper error message when adding vdpa dev
Problem Details: In below example, before the fix, mtu attribute is supported by the parent mgmtdev, but the error message showing "All provided are not supported" is just misleading. $ vdpa mgmtdev show vdpasim_net: supported_classes net max_supported_vqs 3 dev_features MTU MAC CTRL_VQ CTRL_MAC_ADDR ANY_LAYOUT ...
```diff diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index a1bb5b92212d..e71898ec5ce7 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -627,9 +627,11 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i err = PTR_ERR(mdev); goto err; } + if ((config.mask &...
c04e2145b8c9e1429ad2134291a830d2ba39657a
Analyze and fix the following issue in the Linux kernel code: vdpa/mlx5: Initialize CVQ iotlb spinlock
Problem Details: Initialize itolb spinlock. Fixes: 5262912ef3cf ("vdpa/mlx5: Add support for control VQ and MAC setting") Signed-off-by: Eli Cohen <elic@nvidia.com> Message-Id: <20230206122016.1149373-1-elic@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
```diff diff --git a/drivers/vdpa/mlx5/core/resources.c b/drivers/vdpa/mlx5/core/resources.c index 45ad41287a31..d5a59c9035fb 100644 --- a/drivers/vdpa/mlx5/core/resources.c +++ b/drivers/vdpa/mlx5/core/resources.c @@ -233,6 +233,7 @@ static int init_ctrl_vq(struct mlx5_vdpa_dev *mvdev) if (!mvdev->cvq.iotlb) retu...
aef24311bd2d8a6d39a80c34f278b0fd1692aed3
Analyze and fix the following issue in the Linux kernel code: vdpa/mlx5: Don't clear mr struct on destroy MR
Problem Details: Clearing the mr struct erases the lock owner and causes warnings to be emitted. It is not required to clear the mr so remove the memset call. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Eli Cohen <elic@nvidia.com> Message-Id: <20230206121956.1149356-1-elic@nvi...
```diff diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c index 0a1e0b0dc37e..03e543229791 100644 --- a/drivers/vdpa/mlx5/core/mr.c +++ b/drivers/vdpa/mlx5/core/mr.c @@ -503,7 +503,6 @@ void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev) else destroy_dma_mr(mvdev, mr); - memset(mr, 0, siz...
446062e6adc48f1e963ce57621b5bfcbf999cda7
Analyze and fix the following issue in the Linux kernel code: vdpa/mlx5: Directly assign memory key
Problem Details: When creating a memory key, the key value should be assigned to the passed pointer and not or'ed to. No functional issue was observed due to this bug. Fixes: 29064bfdabd5 ("vdpa/mlx5: Add support library for mlx5 VDPA implementation") Signed-off-by: Eli Cohen <elic@nvidia.com> Message-Id: <2023020507...
```diff diff --git a/drivers/vdpa/mlx5/core/resources.c b/drivers/vdpa/mlx5/core/resources.c index 9800f9bec225..45ad41287a31 100644 --- a/drivers/vdpa/mlx5/core/resources.c +++ b/drivers/vdpa/mlx5/core/resources.c @@ -213,7 +213,7 @@ int mlx5_vdpa_create_mkey(struct mlx5_vdpa_dev *mvdev, u32 *mkey, u32 *in, return ...
2e44ca3f1f0ba2022f949003f02cc091144e54a3
Analyze and fix the following issue in the Linux kernel code: vringh: fix a typo in comments for vringh_kiov
Problem Details: Probably it is a simple copy error from struct vring_iov. Signed-off-by: Shunsuke Mie <mie@igel.co.jp> Message-Id: <20230202104248.2040652-1-mie@igel.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
```diff diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 212892cf9822..1991a02c6431 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h @@ -92,7 +92,7 @@ struct vringh_iov { }; /** - * struct vringh_iov - kvec mangler. + * struct vringh_kiov - kvec mangler. * * Mangles kvec in pla...
08707b5c3344864d8948cb67706bad489b86773d
Analyze and fix the following issue in the Linux kernel code: scsi: virtio_scsi: fix handling of kmalloc failure
Problem Details: There is no check about the return value of kmalloc in virtscsi_rescan_hotunplug. Add the check to avoid use of null pointer 'inq_result' in case of the failure of kmalloc. Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Message-Id: <20230202064124.22277-1-zyytlz.wz@163.com> Signed-off-by: Michael S. Ts...
```diff diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index d07d24c06b54..15067234b566 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -330,7 +330,7 @@ static void virtscsi_handle_param_change(struct virtio_scsi *vscsi, scsi_device_put(sdev); } -static void virtsc...
699209fcc55cb97ede9ee8c2160095e0f5dfc73c
Analyze and fix the following issue in the Linux kernel code: vdpa: Fix a couple of spelling mistakes in some messages
Problem Details: There are two spelling mistakes in some literal strings. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Message-Id: <20230130092644.37002-1-colin.i.king@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
```diff diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index 6821b2850bbb..a1bb5b92212d 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -1016,7 +1016,7 @@ static int vdpa_dev_vendor_stats_fill(struct vdpa_device *vdev, switch (device_id) { case VIRTIO_ID_NET: if (index > VIRTIO_NET_CTRL_MQ_...