id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
4969bccd5f4e9d59e9aca7e873834be9519be013
Analyze and fix the following issue in the Linux kernel code: drm/msm: Avoid rounding down to zero jiffies
Problem Details: If userspace asked for a timeout greater than zero, but less than a jiffy, they clearly weren't planning on spinning. So it is better to round up to one. This fixes an issue with supertuxkart that was (for some reason) spinning on a gl sync with 1ms timeout. CPU time for a demo lap drops from: 15...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9f0c184b02a0..7936aa6cad03 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -548,7 +548,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) remaining_jiffies = ktime_divns...
45d96836978701f7e507ddc0f6cfc5e6d5c33d01
Analyze and fix the following issue in the Linux kernel code: dt-bindings: display: msm: sm8450-mdss: Fix DSI compatible
Problem Details: The DSI compatible changed between patchset revisions, but that wasn't reflected in the bindings. Fix it. Fixes: 0eda3c6cb1c5 ("dt-bindings: display/msm: add support for the display on SM8450") Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlow...
```diff diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml b/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml index 4c6929e2534c..f26eb5643aed 100644 --- a/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml +++ b/Documentation/devicetree/bindings/display...
a75b49db6529b2af049eafd938fae888451c3685
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix workqueue leak on bind errors
Problem Details: Make sure to destroy the workqueue also in case of early errors during bind (e.g. a subcomponent failing to bind). Since commit c3b790ea07a1 ("drm: Manage drm_mode_config_init with drmm_") the mode config will be freed when the drm device is released also when using the legacy interface, but add an ex...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 2a9a363afe50..1d0082ee255c 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -459,7 +459,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev); ...
ca090c837b430752038b24e56dd182010d77f6f6
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix missing wq allocation error handling
Problem Details: Add the missing sanity check to handle workqueue allocation failures. Fixes: c8afe684c95c ("drm/msm: basic KMS driver for snapdragon") Cc: stable@vger.kernel.org # 3.12 Cc: Rob Clark <robdclark@gmail.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry....
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 4d85ca0ba0c1..2a9a363afe50 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -433,6 +433,10 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) priv->dev = ddev; priv->...
60d476af96015891c7959f30838ae7a9749932bf
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix vram leak on bind errors
Problem Details: Make sure to release the VRAM buffer also in a case a subcomponent fails to bind. Fixes: d863f0c7b536 ("drm/msm: Call msm_init_vram before binding the gpu") Cc: stable@vger.kernel.org # 5.11 Cc: Craig Tatlor <ctatlor97@gmail.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: ...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ee05ba8cbd8e..4d85ca0ba0c1 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -52,6 +52,8 @@ #define MSM_VERSION_MINOR 10 #define MSM_VERSION_PATCHLEVEL 0 +static void msm_deinit_vram(struct drm_d...
214b09db61978497df24efcb3959616814bca46b
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix drm device leak on bind errors
Problem Details: Make sure to free the DRM device also in case of early errors during bind(). Fixes: 2027e5b3413d ("drm/msm: Initialize MDSS irq domain at probe time") Cc: stable@vger.kernel.org # 5.17 Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewe...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ffc25e3db031..ee05ba8cbd8e 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -445,12 +445,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev)...
cd459c005de3e2b855a8cc7768e633ce9d018e9f
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix NULL-deref on irq uninstall
Problem Details: In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: f026e431cf86 ("drm/msm: Convert to Linux IRQ interfaces") Cc: stable@vger.kernel.org # 5.14 Cc: Thomas Zimmermann <tzimmermann@sus...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 91d60608a19a..ffc25e3db031 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -252,9 +252,11 @@ static int msm_drm_uninit(struct device *dev) drm_bridge_remove(priv->bridges[i]); priv->num_bridge...
a465353b9250802f87b97123e33a17f51277f0b1
Analyze and fix the following issue in the Linux kernel code: drm/msm: fix NULL-deref on snapshot tear down
Problem Details: In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: 98659487b845 ("drm/msm: add support to take dpu snapshot") Cc: stable@vger.kernel.org # 5.14 Cc: Abhinav Kumar <quic_abhinavk...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 3286ba78f89a..91d60608a19a 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -243,7 +243,8 @@ static int msm_drm_uninit(struct device *dev) msm_fbdev_free(ddev); #endif - msm_disp_snapshot_dest...
652eadfde81031c7b3d8b21bdbcfdd6eb217dec8
Analyze and fix the following issue in the Linux kernel code: Revert "drm/msm: Fix failure paths in msm_drm_init()"
Problem Details: This reverts commit 8636500300a01740d92b345c680b036b94555b1b. A recent commit tried to address a drm device leak in the early msm_drm_uninit() error paths but ended up making things worse. Specifically, it moved the drm device reference put in msm_drm_uninit() to msm_drm_init() which means that the d...
```diff diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c index b73031cd48e4..e75b97127c0d 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c @@ -129,9 +129,6 @@ void msm_disp_snapshot_destroy(struct drm_dev...
dfa70344d1b5f5ff08525a8c872c8dd5e82fc5d9
Analyze and fix the following issue in the Linux kernel code: Revert "drm/msm: Add missing check and destroy for alloc_ordered_workqueue"
Problem Details: This reverts commit 643b7d0869cc7f1f7a5ac7ca6bd25d88f54e31d0. A recent patch that tried to fix up the msm_drm_init() paths with respect to the workqueue but only ended up making things worse: First, the newly added calls to msm_drm_uninit() on early errors would trigger NULL-pointer dereferences, for...
```diff diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9b6f17b1261f..df88d948fc70 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -421,8 +421,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) priv->dev = ddev; priv->w...
5da7cb193db32da783a3f3e77d8b639989321d48
Analyze and fix the following issue in the Linux kernel code: rcu/kvfree: Avoid freeing new kfree_rcu() memory after old grace period
Problem Details: Memory passed to kvfree_rcu() that is to be freed is tracked by a per-CPU kfree_rcu_cpu structure, which in turn contains pointers to kvfree_rcu_bulk_data structures that contain pointers to memory that has not yet been handed to RCU, along with an kfree_rcu_cpu_work structure that tracks the memory th...
```diff diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8e880c09ab59..7b95ee98a1a5 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3024,6 +3024,18 @@ need_offload_krc(struct kfree_rcu_cpu *krcp) return !!READ_ONCE(krcp->head); } +static bool +need_wait_for_krwp_work(struct kfree_rcu_cpu_work *k...
d769ccaf957fe7391f357c0a923de71f594b8a2b
Analyze and fix the following issue in the Linux kernel code: xsk: Fix unaligned descriptor validation
Problem Details: Make sure unaligned descriptors that straddle the end of the UMEM are considered invalid. Currently, descriptor validation is broken for zero-copy mode which only checks descriptors at page granularity. For example, descriptors in zero-copy mode that overrun the end of the UMEM but not a page boundary ...
```diff diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h index 3e952e569418..d318c769b445 100644 --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -180,13 +180,8 @@ static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool, if (likely(!cross_pg)) return ...
919e659ed12568b5b8ba6c2ffdd82d8d31fc28af
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: fix xdp_redirect xdp-features selftest for veth driver
Problem Details: xdp-features supported by veth driver are no more static, but they depends on veth configuration (e.g. if GRO is enabled/disabled or TX/RX queue configuration). Take it into account in xdp_redirect xdp-features selftest for veth driver. Fixes: fccca038f300 ("veth: take into account device reconfigurat...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c b/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c index 7271a18ab3e2..8251a0fc6ee9 100644 --- a/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c @@ -167,8 +167,7 ...
dc70eb868b9cd2ca01313e5a394e6ea001d513e9
Analyze and fix the following issue in the Linux kernel code: fpga: bridge: properly initialize bridge device before populating children
Problem Details: The current code path can lead to warnings because of uninitialized device, which contains, as a consequence, uninitialized kobject. The uninitialized device is passed to of_platform_populate, which will at some point, while creating child device, try to get a reference on uninitialized parent, resulti...
```diff diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index 5cd40acab5bf..0953e6e4db04 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -363,7 +363,6 @@ fpga_bridge_register(struct device *parent, const char *name, bridge->dev.parent = parent; bridge->dev.of_node = ...
17c9b6ec35c0d6228db4f94590702a0cb03cd96a
Analyze and fix the following issue in the Linux kernel code: ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links
Problem Details: Extend hdac_ext_link to store information needed for ALT links. Follow-up patches will include more functional patches for power-up and down. Note that this patch suggests the use of an 'eml_lock' to serialize access to shared registers. SoundWire-specific sequence require the lock to be taken at a hi...
```diff diff --git a/include/sound/hda-mlink.h b/include/sound/hda-mlink.h index beef5f509e47..8048bf01c133 100644 --- a/include/sound/hda-mlink.h +++ b/include/sound/hda-mlink.h @@ -10,7 +10,7 @@ struct hdac_bus; #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_MLINK) -int hda_bus_ml_get_capabilities(struct hdac_bus *bus); ...
539adfedbd2d5cda2f9e2d83b35b364834b67d58
Analyze and fix the following issue in the Linux kernel code: USB: core: Fix docs warning caused by wireless_status feature
Problem Details: Fix wrongly named 'dev' parameter in doc block, should have been iface: drivers/usb/core/message.c:1939: warning: Function parameter or member 'iface' not described in 'usb_set_wireless_status' drivers/usb/core/message.c:1939: warning: Excess function parameter 'dev' description in 'usb_set_wireless_st...
```diff diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 33392a6f4972..b5811620f1de 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1926,7 +1926,7 @@ static void __usb_wireless_status_intf(struct work_struct *ws) /** * usb_set_wireless_status - sets the wirele...
8fbc10b995a506e173f1080dfa2764f232a65e02
Analyze and fix the following issue in the Linux kernel code: net: stmmac: check fwnode for phy device before scanning for phy
Problem Details: Some DT devices already have phy device configured in the DT/ACPI. Current implementation scans for a phy unconditionally even though there is a phy listed in the DT/ACPI and already attached. We should check the fwnode if there is any phy device listed in fwnode and decide whether to scan for a phy t...
```diff diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 38abc898f149..d7fcab057032 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1134,22 +1134,26 @@ static void stmmac_ch...
2a2d8c51defb446e8d89a83f42f8e5cd529111e9
Analyze and fix the following issue in the Linux kernel code: ftrace: Fix issue that 'direct->addr' not restored in modify_ftrace_direct()
Problem Details: Syzkaller report a WARNING: "WARN_ON(!direct)" in modify_ftrace_direct(). Root cause is 'direct->addr' was changed from 'old_addr' to 'new_addr' but not restored if error happened on calling ftrace_modify_direct_caller(). Then it can no longer find 'direct' by that 'old_addr'. To fix it, restore 'dir...
```diff diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 0feea145bb29..c67bcc89a771 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5667,12 +5667,15 @@ int modify_ftrace_direct(unsigned long ip, ret = 0; } - if (unlikely(ret && new_direct)) { - direct->count++; - list_del_rcu...
bbb73a103fbbed6f63cb738d3783261c4241b4b2
Analyze and fix the following issue in the Linux kernel code: swiotlb: fix a braino in the alignment check fix
Problem Details: The alignment mask in swiotlb_do_find_slots() masks off the high bits which are not relevant for the alignment, so multiple requirements are combined with a bitwise OR rather than AND. In plain English, the stricter the alignment, the more bits must be set in iotlb_align_mask. Confusion may arise from...
```diff diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 5b919ef832b6..dac42a2ad588 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -623,7 +623,7 @@ static int swiotlb_do_find_slots(struct device *dev, int area_index, phys_to_dma_unencrypted(dev, mem->start) & boundary_mask; unsigned ...
fb4a624f88f658c7b7ae124452bd42eaa8ac7168
Analyze and fix the following issue in the Linux kernel code: ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()
Problem Details: Smatch Warns: sound/firewire/tascam/tascam-stream.c:493 snd_tscm_stream_start_duplex() warn: missing unwind goto? The direct return will cause the stream list of "&tscm->domain" unemptied and the session in "tscm" unfinished if amdtp_domain_start() returns with an error. Fix this by changing the dire...
```diff diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c index 53e094cc411f..dfe783d01d7d 100644 --- a/sound/firewire/tascam/tascam-stream.c +++ b/sound/firewire/tascam/tascam-stream.c @@ -490,7 +490,7 @@ int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate...
68d99ab0e9221ef54506f827576c5a914680eeaf
Analyze and fix the following issue in the Linux kernel code: btrfs: fix fast csum implementation detection
Problem Details: The BTRFS_FS_CSUM_IMPL_FAST flag is currently set whenever a non-generic crc32c is detected, which is the incorrect check if the file system uses a different checksumming algorithm. Refactor the code to only check this if crc32c is actually used. Note that in an ideal world the information if an algo...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b53f0e30ce2b..9e1596bb208d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2250,6 +2250,20 @@ static int btrfs_init_csum_hash(struct btrfs_fs_info *fs_info, u16 csum_type) fs_info->csum_shash = csum_shash; + /* + * Check if the check...
40fac6472f22a59f5694496e179988ab4a1dfe07
Analyze and fix the following issue in the Linux kernel code: btrfs: restore the thread_pool= behavior in remount for the end I/O workqueues
Problem Details: Commit d7b9416fe5c5 ("btrfs: remove btrfs_end_io_wq") converted the read and I/O handling from btrfs_workqueues to Linux workqueues, and as part of that lost the code to apply the thread_pool= based max_active limit on remount. Restore it. Fixes: d7b9416fe5c5 ("btrfs: remove btrfs_end_io_wq") CC: sta...
```diff diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 581845bc206a..dd6d5b6844f1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1631,6 +1631,8 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, btrfs_workqueue_set_max(fs_info->hipri_workers, new_pool_size); btrfs_workqueue_set...
b16c310115f2084b8826a35b77ef42bab6786d9f
Analyze and fix the following issue in the Linux kernel code: pwm: mtk-disp: Configure double buffering before reading in .get_state()
Problem Details: The DISP_PWM controller's default behavior is to always use register double buffering: all reads/writes are then performed on shadow registers instead of working registers and this becomes an issue in case our chosen configuration in Linux is different from the default (or from the one that was pre-app...
```diff diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index ea361976eb34..79e321e96f56 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -196,6 +196,16 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip, return err; } + /* + * Apply DISP_PWM_DEBUG setting...
36dd7f530ae7d9ce9e853ffb8aa337de65c6600b
Analyze and fix the following issue in the Linux kernel code: pwm: mtk-disp: Disable shadow registers before setting backlight values
Problem Details: If shadow registers usage is not desired, disable that before performing any write to CON0/1 registers in the .apply() callback, otherwise we may lose clkdiv or period/width updates. Fixes: cd4b45ac449a ("pwm: Add MediaTek MT2701 display PWM driver support") Signed-off-by: AngeloGioacchino Del Regno <...
```diff diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index 4cfe88d54652..ea361976eb34 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -138,6 +138,19 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, high_width = mul_u64_u64_div_u64(stat...
1d1665279a845d16c93687389e364386e3fe0f38
Analyze and fix the following issue in the Linux kernel code: block: ublk: make sure that block size is set correctly
Problem Details: block size is one very key setting for block layer, and bad block size could panic kernel easily. Make sure that block size is set correctly. Meantime if ublk_validate_params() fails, clear ub->params so that disk is prevented from being added. Fixes: 71f28f3136af ("ublk_drv: add io_uring based user...
```diff diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index a36934ee9739..604c1a13c76e 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -246,7 +246,7 @@ static int ublk_validate_params(const struct ublk_device *ub) if (ub->params.types & UBLK_PARAM_TYPE_BASIC) { const stru...
c52615e494f17f44b076ac8ae5a53cfc0041a0dd
Analyze and fix the following issue in the Linux kernel code: ASoC: qcom: q6apm-lpass-dai: close graphs before opening a new one
Problem Details: On multiple prepare calls, its possible that the playback graphs are not unloaded from the DSP, which can have some wierd side-effects, one of them is that the data not consumed without any errors. Fixes: c2ac3aec474d("ASoC: qcom: q6apm-lpass-dai: unprepare stream if its already prepared") Signed-off-...
```diff diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index 23d23bc6fbaa..420e8aa11f42 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -130,6 +130,9 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *subs...
cba6cfdc7c3f1516f0d08ddfb24e689af0932573
Analyze and fix the following issue in the Linux kernel code: regulator: core: Avoid lockdep reports when resolving supplies
Problem Details: An automated bot told me that there was a potential lockdep problem with regulators. This was on the chromeos-5.15 kernel, but I see nothing that would be different downstream compared to upstream. The bot said: ============================================ WARNING: possible recursive locking detect...
```diff diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9a13240f3084..08726bc0da9d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -207,6 +207,78 @@ static void regulator_unlock(struct regulator_dev *rdev) mutex_unlock(&regulator_nesting_mutex); } +/** + * regulator_l...
b83a1772be854f87602de14726737d3e5b06e1f4
Analyze and fix the following issue in the Linux kernel code: regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
Problem Details: When a codepath locks a rdev using ww_mutex_lock_slow() directly then that codepath is responsible for incrementing the "ref_cnt" and also setting the "mutex_owner" to "current". The regulator core consistently got that right for "ref_cnt" but didn't always get it right for "mutex_owner". Let's fix th...
```diff diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1490eb40c973..9a13240f3084 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -334,6 +334,7 @@ static void regulator_lock_dependent(struct regulator_dev *rdev, ww_mutex_lock_slow(&new_contended_rdev->mutex, ww_ctx); ...
fa359c1938adbd04cf7e68786ea58366dddc3ad7
Analyze and fix the following issue in the Linux kernel code: pwm: stm32-lp: Drop of_match_ptr for ID table
Problem Details: The driver can match only via the DT table so the table should be always used and the of_match_ptr does not have any sense (this also allows ACPI matching via PRP0001, even though it might not be relevant here). This also fixes the following compile error: drivers/pwm/pwm-stm32-lp.c:245:34: error: ‘...
```diff diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index f315fa106be8..bb3a045a7334 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -252,7 +252,7 @@ static struct platform_driver stm32_pwm_lp_driver = { .probe = stm32_pwm_lp_probe, .driver = { .name = "stm32-...
d6a436c76dd5789a22b091c0a32dee72684f17ce
Analyze and fix the following issue in the Linux kernel code: pwm: rcar: Drop of_match_ptr for ID table
Problem Details: The driver can match only via the DT table so the table should be always used and the of_match_ptr does not have any sense (this also allows ACPI matching via PRP0001, even though it might not be relevant here). This also fixes the following compiler warning: drivers/pwm/pwm-rcar.c:252:34: error: ‘r...
```diff diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index e9d8646dc331..5b5f357c44de 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c @@ -258,7 +258,7 @@ static struct platform_driver rcar_pwm_driver = { .remove_new = rcar_pwm_remove, .driver = { .name = "pwm-rcar", - .of_match_...
194c9e20954a0b08418aa452be8c4fce5258fe04
Analyze and fix the following issue in the Linux kernel code: drm/omapdrm: Remove bo from struct omap_fbdev
Problem Details: Fbdev's framebuffer stores a pointer to the GEM object. Remove struct omap_fbdev.bo, which contains the same value. No functional changes. v2: * fix commit message (Tomi) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by:...
```diff diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index b3d57fe4e6ac..d04a20f95e3d 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -10,6 +10,7 @@ #include <drm/drm_file.h> #include <drm/drm_fourcc.h> #include <drm/drm_fram...
b358793c3bf231c455c55e0173256a86483997a8
Analyze and fix the following issue in the Linux kernel code: drm/i915/wakeref: fix kernel-doc comment
Problem Details: Fix the warning: drivers/gpu/drm/i915/intel_wakeref.h:118: warning: expecting prototype for intel_wakeref_get_if_in_use(). Prototype was for intel_wakeref_get_if_active() instead Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Link: ...
```diff diff --git a/drivers/gpu/drm/i915/intel_wakeref.h b/drivers/gpu/drm/i915/intel_wakeref.h index 71b8a63f6f10..0b6b4852ab23 100644 --- a/drivers/gpu/drm/i915/intel_wakeref.h +++ b/drivers/gpu/drm/i915/intel_wakeref.h @@ -105,7 +105,7 @@ __intel_wakeref_get(struct intel_wakeref *wf) } /** - * intel_wakeref_get...
efd8127454054d6d52040c17f7fa1656ac3befdc
Analyze and fix the following issue in the Linux kernel code: drm/i915/tc: demote a kernel-doc comment to a regular comment
Problem Details: There's not much point in a static work function having a kernel-doc comment. Just clean it up and make it a regular comment. This fixes the kernel-doc warnings: drivers/gpu/drm/i915/display/intel_tc.c:1370: warning: Function parameter or member 'work' not described in 'intel_tc_port_disconnect_phy_w...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c index 2bb02d4e6859..3b60995e9dfb 100644 --- a/drivers/gpu/drm/i915/display/intel_tc.c +++ b/drivers/gpu/drm/i915/display/intel_tc.c @@ -1358,10 +1358,7 @@ void intel_tc_port_lock(struct intel_digital_port *dig_port) ...
fb131c472df92b2885262e747906c0a4038c82e5
Analyze and fix the following issue in the Linux kernel code: platform/x86: apple-gmux: Fix iomem_base __iomem annotation
Problem Details: Fix the __iomem annotation of the iomem_base pointers in the apple-gmux code. The __iomem should go before the *. This fixes a bunch of sparse warnings like this one: drivers/platform/x86/apple-gmux.c:224:48: sparse: expected void const [noderef] __iomem * got unsigned char [usertype] * Fixes: 0c1...
```diff diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 4c311e1dedad..e02b4aea4f1e 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -57,7 +57,7 @@ struct apple_gmux_config; struct apple_gmux_data { - u8 *__iomem iomem_base; + u8 __iom...
2429b3c529da29d4277d519bd66d034842dcd70c
Analyze and fix the following issue in the Linux kernel code: drm/tegra: Avoid potential 32-bit integer overflow
Problem Details: In tegra_sor_compute_config(), the 32-bit value mode->clock is multiplied by 1000, and assigned to the u64 variable pclk. We can avoid a potential 32-bit integer overflow by casting mode->clock to u64 before we do the arithmetic and assignment. Signed-off-by: Nur Hussein <hussein@unixcat.org> Signed-o...
```diff diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index cd25f409979c..8d910695775c 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -1153,7 +1153,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, struct drm_dp_link *link) { const u64 f ...
905a9eb5f636f3312964b162362e4d6ca4e37378
Analyze and fix the following issue in the Linux kernel code: selftests/net: fix typo in tcp_mmap
Problem Details: kernel test robot reported the following warning: All warnings (new ones prefixed by >>): tcp_mmap.c: In function 'child_thread': >> tcp_mmap.c:211:61: warning: 'lu' may be used uninitialized in this function [-Wmaybe-uninitialized] 211 | zc.length = min(chunk_size, FI...
```diff diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c index 607cc9ad8d1b..6e59b1461dcc 100644 --- a/tools/testing/selftests/net/tcp_mmap.c +++ b/tools/testing/selftests/net/tcp_mmap.c @@ -208,7 +208,7 @@ void *child_thread(void *arg) memset(&zc, 0, sizeof(zc)); z...
e82882cdd241b78d305df1441c624fbbbd07af05
Analyze and fix the following issue in the Linux kernel code: platform/x86: Add driver for Yoga Tablet Mode switch
Problem Details: This WMI driver for the tablet mode control switch for Lenovo Yoga notebooks was originally written by Gergo Koteles. The mode is mapped to a SW_TABLET_MODE switch capable input device. Andrew followed the suggestions that were posted in reply to Gergo's RFC patch, and on the v1 & v2 versions of this ...
```diff diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 1899be67dc0c..22052031c719 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -461,6 +461,15 @@ config IDEAPAD_LAPTOP This is a driver for Lenovo IdeaPad netbooks contains drivers for rfkill switc...
430cac487400494c19a8b85299e979bb07b4671f
Analyze and fix the following issue in the Linux kernel code: xfrm: don't check the default policy if the policy allows the packet
Problem Details: The current code doesn't let a simple "allow" policy counteract a default policy blocking all incoming packets: ip x p setdefault in block ip x p a src 192.168.2.1/32 dst 192.168.2.2/32 dir in action allow At this stage, we have an allow policy (with or without transforms) for this packet. It...
```diff diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5c61ec04b839..62be042f2ebc 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -3712,12 +3712,6 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, } xfrm_nr = ti; - if (net->xfrm.policy_default[dir...
d95debbdc528d50042807754d6085c15abc21768
Analyze and fix the following issue in the Linux kernel code: selftests/clone3: fix number of tests in ksft_set_plan
Problem Details: Commit 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME") added an additional test, so the number passed to ksft_set_plan needs to be bumped accordingly. Also use ksft_finished() to print results and exit. This will catch future mismatches between ksft_set_plan() and the number of tests...
```diff diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c index 4fce46afe6db..e495f895a2cd 100644 --- a/tools/testing/selftests/clone3/clone3.c +++ b/tools/testing/selftests/clone3/clone3.c @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) uid_t uid = getuid(); ksft...
af0acf22aea359e04412237d68787401f96bb583
Analyze and fix the following issue in the Linux kernel code: netfilter: nf_tables: Modify nla_memdup's flag to GFP_KERNEL_ACCOUNT
Problem Details: For memory alloc that store user data from nla[NFTA_OBJ_USERDATA], use GFP_KERNEL_ACCOUNT is more suitable. Fixes: 33758c891479 ("memcg: enable accounting for nft objects") Signed-off-by: Chen Aotian <chenaotian2@163.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
```diff diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 6004d4b24451..cd52109e674a 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -7052,7 +7052,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, } if (nla[NFTA_OBJ...
94623f579ce338b5fa61b5acaa5beb8aa657fb9e
Analyze and fix the following issue in the Linux kernel code: netfilter: br_netfilter: fix recent physdev match breakage
Problem Details: Recent attempt to ensure PREROUTING hook is executed again when a decrypted ipsec packet received on a bridge passes through the network stack a second time broke the physdev match in INPUT hook. We can't discard the nf_bridge info strct from sabotage_in hook, as this is needed by the physdev match. ...
```diff diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ff7ad331fb82..1ec3530c8191 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -294,6 +294,7 @@ struct nf_bridge_info { u8 pkt_otherhost:1; u8 in_prerouting:1; u8 bridged_dnat:1; + u8 sabotage_in_done:1; __u16 f...
45121ad4a1750ca47ce3f32bd434bdb0cdbf0043
Analyze and fix the following issue in the Linux kernel code: crypto: ccp - Clear PSP interrupt status register before calling handler
Problem Details: The PSP IRQ is edge-triggered (MSI or MSI-X) in all cases supported by the psp module so clear the interrupt status register early in the handler to prevent missed interrupts. sev_irq_handler() calls wake_up() on a wait queue, which can result in a new command being submitted from a different CPU. This...
```diff diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index ec98f19800de..e3d6955d3265 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -43,15 +43,15 @@ static irqreturn_t psp_irq_handler(int irq, void *data) /* Read the interrupt status: */ status = ioread3...
686cd976b6ddedeeb1a1fb09ba53a891d3cc9a03
Analyze and fix the following issue in the Linux kernel code: crypto: drbg - Only fail when jent is unavailable in FIPS mode
Problem Details: When jent initialisation fails for any reason other than ENOENT, the entire drbg fails to initialise, even when we're not in FIPS mode. This is wrong because we can still use the kernel RNG when we're not in FIPS mode. Change it so that it only fails when we are in FIPS mode. Fixes: 57225e679788 ("c...
```diff diff --git a/crypto/drbg.c b/crypto/drbg.c index 982d4ca4526d..ff4ebbc68efa 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1546,7 +1546,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg) const int err = PTR_ERR(drbg->jent); drbg->jent = NULL; - if (fips_enabled || err != -ENOENT) + if (fip...
3fde2fe99aa6dacd4151c87382b07ce7f30f0a52
Analyze and fix the following issue in the Linux kernel code: crypto: jitter - permanent and intermittent health errors
Problem Details: According to SP800-90B, two health failures are allowed: the intermittend and the permanent failure. So far, only the intermittent failure was implemented. The permanent failure was achieved by resetting the entire entropy source including its health test state and waiting for two or more back-to-back ...
```diff diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c index 2d115bec15ae..b9edfaa51b27 100644 --- a/crypto/jitterentropy-kcapi.c +++ b/crypto/jitterentropy-kcapi.c @@ -37,6 +37,7 @@ * DAMAGE. */ +#include <linux/fips.h> #include <linux/kernel.h> #include <linux/module.h> #include <li...
379989e7cbdc7aa7496a00ee286ec146c7599cf0
Analyze and fix the following issue in the Linux kernel code: drm/ttm/pool: Fix ttm_pool_alloc error path
Problem Details: When hitting an error, the error path forgot to unmap dma mappings and could call set_pages_wb() on already uncached pages. Fix this by introducing a common ttm_pool_free_range() function that does the right thing. v2: - Simplify that common function (Christian König) v3: - Rename that common functio...
```diff diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index aa116a7bbae3..dfce896c4bae 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -367,6 +367,43 @@ static int ttm_pool_page_allocated(struct ttm_pool *pool, unsigned int order, return 0; } +/** ...
b09c551c77c7e01dc6e4f3c8bf06b5ffa7b06db5
Analyze and fix the following issue in the Linux kernel code: ALSA: emu10k1: fix capture interrupt handler unlinking
Problem Details: Due to two copy/pastos, closing the MIC or EFX capture device would make a running ADC capture hang due to unsetting its interrupt handler. In principle, this would have also allowed dereferencing dangling pointers, but we're actually rather thorough at disabling and flushing the ints. While it may so...
```diff diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 48af77ae8020..908f76f1bb9f 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -1236,7 +1236,7 @@ static int snd_emu10k1_capture_mic_close(struct snd_pcm_substream *substream) { struct snd_emu10k1 *emu = snd_pc...
f342ac00da1064eb4f94b1f4bcacbdfea955797a
Analyze and fix the following issue in the Linux kernel code: ALSA: hda/sigmatel: fix S/PDIF out on Intel D*45* motherboards
Problem Details: The BIOS botches this one completely - it says the 2nd S/PDIF output is used, while in fact it's the 1st one. This is tested on DP45SG, but I'm assuming it's valid for the other boards in the series as well. Also add some comments regarding the pins. FWIW, the codec is apparently still sold by Tempo S...
```diff diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 64a97d8c1b03..61258b0aac8d 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1707,6 +1707,7 @@ static const struct snd_pci_quirk stac925x_fixup_tbl[] = { }; static const struct hda_pintbl re...
e98e7a82bca2b6dce3e03719cff800ec913f9af7
Analyze and fix the following issue in the Linux kernel code: ALSA: i2c/cs8427: fix iec958 mixer control deactivation
Problem Details: snd_cs8427_iec958_active() would always delete SNDRV_CTL_ELEM_ACCESS_INACTIVE, even though the function has an argument `active`. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20230405201219.2197811-1-oswald.buddenhagen@gmx.d...
```diff diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 65012af6a36e..f58b14b49045 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c @@ -561,10 +561,13 @@ int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active) if (snd_BUG_ON(!cs8427)) return -ENXIO; chip = cs8427->private_data;...
f2c7ca890182d24ac817fa321489346000271c5c
Analyze and fix the following issue in the Linux kernel code: drm/atomic-helper: Don't set deadline for modesets
Problem Details: If the crtc is being switched on or off then the semantics of computing the timestampe of the next vblank is somewhat ill-defined. And indeed, the code splats with a warning in the timestamp computation code. Specifically it hits the check to make sure that atomic drivers have full set up the timing co...
```diff diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d4d2a2ce40f8..2c2c9caf0be5 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1528,6 +1528,12 @@ static void set_fence_deadline(struct drm_device *dev, for_each_new_crtc_in_...
93cdf49f6eca5e23f6546b8f28457b2e6a6961d9
Analyze and fix the following issue in the Linux kernel code: ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()
Problem Details: When the length of best extent found is less than the length of goal extent we need to make sure that the best extent atleast covers the start of the original request. This is done by adjusting the ac_b_ex.fe_logical (logical start) of the extent. While doing so, the current logic sometimes results in...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index e8d660ff8c45..7294251a7d96 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4329,6 +4329,7 @@ static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac, BUG_ON(start < pa->pa_pstart); BUG_ON(end > pa->pa_pstart + EXT4_C2B(sbi, pa->...
0830344c953aeabee91ac88281585756d047df39
Analyze and fix the following issue in the Linux kernel code: ext4: Abstract out overlap fix/check logic in ext4_mb_normalize_request()
Problem Details: Abstract out the logic of fixing PA overlaps in ext4_mb_normalize_request to improve readability of code. This also makes it easier to make changes to the overlap logic in future. There are no functional changes in this patch Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Reviewed-by: Ritesh Ha...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index db46998fca0e..e8d660ff8c45 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4001,6 +4001,73 @@ ext4_mb_pa_assert_overlap(struct ext4_allocation_context *ac, rcu_read_unlock(); } +/* + * Given an allocation context "ac" and a range "start", ...
1221b235019f9e3bbc38cfc53f7c03456bee53b4
Analyze and fix the following issue in the Linux kernel code: ext4: fix typos in mballoc
Problem Details: pa_plen -> pa_len pa_start -> pa_pstart Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Link: https://lore.kernel.org/r/20230311170949.1047958-2-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f09eb7f7fa5a..0b03a3b90207 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4146,7 +4146,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, * provide gurantee on number of contiguous blocks allocation since that * depends u...
c7f2bafa3c242d4c69ba347d8983858a5137387b
Analyze and fix the following issue in the Linux kernel code: ext4: remove unnecessary count2 in ext4_free_data_in_buddy
Problem Details: count2 is always 1 in mb_debug, just remove unnecessary count2. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://lore.kernel.org/r/20230303172120.3800725-17-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 4364343bbcef..f7cff3b5d740 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3590,7 +3590,7 @@ static void ext4_free_data_in_buddy(struct super_block *sb, { struct ext4_buddy e4b; struct ext4_group_info *db; - int err, count = 0, count2 = 0;...
1afdc5889427110c8466da2b23360a27be711ff0
Analyze and fix the following issue in the Linux kernel code: ext4: correct start of used group pa for debug in ext4_mb_use_group_pa
Problem Details: As we don't correct pa_lstart here, so there is no need to subtract pa_lstart with consumed len. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://lore.kernel.org/r/20230303172120.3800725-6-shikemeng@huaweicloud.com Signed-off-by: Th...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index e549e88c304b..0af2ac678170 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4323,7 +4323,7 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac, * Other CPUs are prevented from allocating from this pa by lg_mutex */ mb_...
34bf93472f8fb60b4189aa2872471017e739cf0a
Analyze and fix the following issue in the Linux kernel code: kallsyms: move module-related functions under correct configs
Problem Details: Functions for searching module kallsyms should have non-empty definitions only if CONFIG_MODULES=y and CONFIG_KALLSYMS=y. Until now, only CONFIG_MODULES check was used for many of these, which may have caused complilation errors on some configs. This patch moves all relevant functions under the correc...
```diff diff --git a/include/linux/module.h b/include/linux/module.h index 41cfd3be57e5..886d24877c7c 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -608,16 +608,6 @@ static inline bool within_module(unsigned long addr, const struct module *mod) /* Search for module by name: must be in a RCU-sched...
67cf52cdb6c8fa6365d29106555dacf95c9fd374
Analyze and fix the following issue in the Linux kernel code: bpftool: Fix bug for long instructions in program CFG dumps
Problem Details: When dumping the control flow graphs for programs using the 16-byte long load instruction, we need to skip the second part of this instruction when looking for the next instruction to process. Otherwise, we end up printing "BUG_ld_00" from the kernel disassembler in the CFG. Fixes: efcef17a6d65 ("tool...
```diff diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c index 6fe3134ae45d..3daa05d9bbb7 100644 --- a/tools/bpf/bpftool/xlated_dumper.c +++ b/tools/bpf/bpftool/xlated_dumper.c @@ -372,8 +372,15 @@ void dump_xlated_for_graph(struct dump_data *dd, void *buf_start, void *buf_end, struc...
e27f0f1620b693ecf312c21ff8a52affb8a5be08
Analyze and fix the following issue in the Linux kernel code: bpftool: Fix documentation about line info display for prog dumps
Problem Details: The documentation states that when line_info is available when dumping a program, the source line will be displayed "by default". There is no notion of "default" here: the line is always displayed if available, there is no way currently to turn it off. In the next sentence, the documentation states th...
```diff diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst index 14de72544995..06d1e4314406 100644 --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst @@ -106,9 +106,8 @@ DESCRIPTION CFG in DOT f...
c7f8f31c00d187a2c71a241c7f2bd6aa102a4e6f
Analyze and fix the following issue in the Linux kernel code: mm: separate vma->lock from vm_area_struct
Problem Details: vma->lock being part of the vm_area_struct causes performance regression during page faults because during contention its count and owner fields are constantly updated and having other parts of vm_area_struct used during page fault handling next to them causes constant cache line bouncing. Fix that by...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index f31c75dc190e..f5487a86b154 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -628,12 +628,6 @@ struct vm_operations_struct { }; #ifdef CONFIG_PER_VMA_LOCK -static inline void vma_init_lock(struct vm_area_struct *vma) -{ - init_rwsem(&vma->...
70d4cbc80c88251de0a5b3e8df3275901f1fa99a
Analyze and fix the following issue in the Linux kernel code: powerc/mm: try VMA lock-based page fault handling first
Problem Details: Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails. Copied from "x86/mm: try VMA lock-based page fault handling first" [ldufour@linux.ibm.com: powerpc/mm: fix mmap_lock bad unlock] Link: https://lkml.kernel.org/r/20230306154244.175...
```diff diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index af46aa88422b..531177a4ee08 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -474,6 +474,40 @@ static int ___do_page_fault(struct pt_regs *regs, unsigned long address, if (is_exec) flags |= FAULT_FLAG_INSTRUCTION; +#...
55fd6fccad3172c0feaaa817f0a1283629ff183e
Analyze and fix the following issue in the Linux kernel code: mm/khugepaged: write-lock VMA while collapsing a huge page
Problem Details: Protect VMA from concurrent page fault handler while collapsing a huge page. Page fault handler needs a stable PMD to use PTL and relies on per-VMA lock to prevent concurrent PMD changes. pmdp_collapse_flush(), set_huge_pmd() and collapse_and_free_pmd() can modify a PMD, which will not be detected by...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index d0a6c99aba09..d6a2abc51e3d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -665,18 +665,23 @@ static inline void vma_end_read(struct vm_area_struct *vma) rcu_read_unlock(); } -static inline void vma_start_write(struct vm_area_struct *vm...
3f9bea2b8a7e4952f03582d8137ab8bf6e96985b
Analyze and fix the following issue in the Linux kernel code: selftests/mm: change NR_CHUNKS_HIGH for aarch64
Problem Details: Although there is a provision for 52 bit VA on arm64 platform, it remains unutilised and higher addresses are not allocated. In order to accommodate 4PB [2^52] virtual address space where supported, NR_CHUNKS_HIGH is changed accordingly. Array holding addresses is changed from static allocation to dy...
```diff diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 50564512c5ee..bae0ceaf95b1 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -36,13 +36,15 @@ * till it reaches 5...
3cce258ea4009992b7b4b64c2bebaf98948180ae
Analyze and fix the following issue in the Linux kernel code: selftests/mm: change MAP_CHUNK_SIZE
Problem Details: Patch series "selftests: Fix virtual address range for arm64", v2. When the virtual address range selftest is run on arm64 and x86 platforms, it is observed that both the low and high VA range iterations are skipped when the MAP_CHUNK_SIZE is set to 16GB. The MAP_CHUNK_SIZE is changed to 1GB to resol...
```diff diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index c0592646ed93..50564512c5ee 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -15,11 +15,15 @@ /* * Maximum add...
dd31bad21980990d903133d2855ea0e2eccade5e
Analyze and fix the following issue in the Linux kernel code: mm: be less noisy during memory hotplug
Problem Details: Turn a pr_info() into a pr_debug() to prevent dmesg spamming on systems where memory hotplug is a frequent operation. Link: https://lkml.kernel.org/r/20230323174349.35990-1-krckatom@amazon.de Signed-off-by: Tomas Krcka <krckatom@amazon.de> Suggested-by: Jan H. Schönherr <jschoenh@amazon.de> Acked-by: ...
```diff diff --git a/mm/mm_init.c b/mm/mm_init.c index c88fbe74137c..dd3a6ed9663f 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1086,7 +1086,7 @@ void __ref memmap_init_zone_device(struct zone *zone, compound_nr_pages(altmap, pfns_per_compound)); } - pr_info("%s initialised %lu pages in %ums\n", __func...
4c91c07c93bbbdd7f2d9de2beb7ee5c2a48ad8e7
Analyze and fix the following issue in the Linux kernel code: mm: vmalloc: convert vread() to vread_iter()
Problem Details: Having previously laid the foundation for converting vread() to an iterator function, pull the trigger and do so. This patch attempts to provide minimal refactoring and to reflect the existing logic as best we can, for example we continue to zero portions of memory not read, as before. Overall, there...
```diff diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 08b795fd80b4..25b44b303b35 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -307,13 +307,9 @@ static void append_kcore_note(char *notes, size_t *i, const char *name, *i = ALIGN(*i + descsz, 4); } -static ssize_t -read_kcore_iter(struct kiocb *iocb, ...
12b9ac6d4385e6a2ffe08e94f810cd34ee53dcdb
Analyze and fix the following issue in the Linux kernel code: mips: fix comment about pgtable_init()
Problem Details: Patch series "mm: move core MM initialization to mm/mm_init.c", v2. This set moves most of the core MM initialization to mm/mm_init.c. This largely includes free_area_init() and its helpers, functions used at boot time, mm_init() from init/main.c and some of the functions it calls. Aside from gainin...
```diff diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h index beea14761cef..b037718d7e8b 100644 --- a/arch/mips/include/asm/fixmap.h +++ b/arch/mips/include/asm/fixmap.h @@ -70,7 +70,7 @@ enum fixed_addresses { #include <asm-generic/fixmap.h> /* - * Called from pgtable_init() + * Called...
1c06b6a599b5b7be74a6baffafa00b0f70cbe523
Analyze and fix the following issue in the Linux kernel code: mm: compaction: fix the possible deadlock when isolating hugetlb pages
Problem Details: When trying to isolate a migratable pageblock, it can contain several normal pages or several hugetlb pages (e.g. CONT-PTE 64K hugetlb on arm64) in a pageblock. That means we may hold the lru lock of a normal page to continue to isolate the next hugetlb page by isolate_or_dissolve_huge_page() in the sa...
```diff diff --git a/mm/compaction.c b/mm/compaction.c index 0bddf869bbeb..e689d66cedf4 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -894,6 +894,11 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, } if (PageHuge(page) && cc->alloc_contig) { + if (locked) { + unlock_...
4bfbe371dbc508411162d1a62e3211ed9f47f614
Analyze and fix the following issue in the Linux kernel code: mm/mremap: simplify vma expansion again
Problem Details: This effectively reverts d014cd7c1c35 ("mm, mremap: fix mremap() expanding for vma's with vm_ops->close()"). After the recent changes, vma_merge() is able to handle the expansion properly even when the vma being expanded has a vm_ops->close operation, so we don't need to special case it anymore. Link...
```diff diff --git a/mm/mremap.c b/mm/mremap.c index 1ddf7beb62e9..0eaa11c845b9 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -1040,23 +1040,11 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, * vma (expand operation itself) and possibly also with * the next vma if it becomes adjacent t...
714965ca8252f880d794f9524c6eae5f97f408c1
Analyze and fix the following issue in the Linux kernel code: mm/mmap: start distinguishing if vma can be removed in mergeability test
Problem Details: Since pre-git times, is_mergeable_vma() returns false for a vma with vm_ops->close, so that no owner assumptions are violated in case the vma is removed as part of the merge. This check is currently very conservative and can prevent merging even situations where vma can't be removed, such as simple ex...
```diff diff --git a/mm/mmap.c b/mm/mmap.c index 6893eb8c66e5..62dce9578242 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -742,12 +742,13 @@ int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma, /* * If the vma has a ->close operation then the driver probably needs to release - * per-vma resources, so w...
50dac01113ad7ecac86384998103d6a98020d0c4
Analyze and fix the following issue in the Linux kernel code: mm/mmap/vma_merge: use only primary pointers for preparing merge
Problem Details: Patch series "cleanup vma_merge() and improve mergeability tests". My initial goal here was to try making the check for vm_ops->close in is_mergeable_vma() only be applied for vma's that would be truly removed as part of the merge (see Patch 9). This would then allow reverting the quick fix d014cd7c1...
```diff diff --git a/mm/mmap.c b/mm/mmap.c index ad499f7b767f..bbb8d1226281 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -950,16 +950,16 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, is_mergeable_anon_vma(prev->anon_vma, next->anon_vma, NULL)) { remove = mid; /* case 1 */ ...
61883d3c32418f16e35e030ca0cfd5d2de95a649
Analyze and fix the following issue in the Linux kernel code: iommu: fix MAX_ORDER usage in __iommu_dma_alloc_pages()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in __iommu_dma_alloc_pages(). Also use GENMASK() instead of hard to read "(2U << order) - 1" magic. Link: https://lkml.kernel.org/r/20230315113133.11326-10-kirill.shutemov@linux.i...
```diff diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 99b2646cb5c7..ac996fd6bd9c 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -736,7 +736,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev, struct page **pages; unsigned int i = 0, nid = dev_t...
7a16d7c7619b26e5e9bfc1360de0d02a94f7d9eb
Analyze and fix the following issue in the Linux kernel code: mm/slub: fix MAX_ORDER usage in calculate_order()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in calculate_order(). Link: https://lkml.kernel.org/r/20230315113133.11326-9-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc:...
```diff diff --git a/mm/slub.c b/mm/slub.c index 39327e98fce3..32eb6b50fe18 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4171,7 +4171,7 @@ static inline int calculate_order(unsigned int size) /* * Doh this slab cannot be placed using slub_max_order. */ - order = calc_slab_order(size, 1, MAX_ORDER, 1); + order = c...
668a89907c6b908c4a72ef22e70bbc95efca2000
Analyze and fix the following issue in the Linux kernel code: mm/page_reporting: fix MAX_ORDER usage in page_reporting_register()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in page_reporting_register(). Link: https://lkml.kernel.org/r/20230315113133.11326-8-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel....
```diff diff --git a/mm/page_reporting.c b/mm/page_reporting.c index c65813a9dc78..275b466de37b 100644 --- a/mm/page_reporting.c +++ b/mm/page_reporting.c @@ -370,7 +370,7 @@ int page_reporting_register(struct page_reporting_dev_info *prdev) */ if (page_reporting_order == -1) { - if (prdev->order > 0 && prdev->...
934487e98fdd2d7762e893af7cbe788cfd39ff84
Analyze and fix the following issue in the Linux kernel code: perf/core: fix MAX_ORDER usage in rb_alloc_aux_page()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in rb_alloc_aux_page(). Link: https://lkml.kernel.org/r/20230315113133.11326-7-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> C...
```diff diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 273a0fe7910a..d6bbdb7830b2 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -609,8 +609,8 @@ static struct page *rb_alloc_aux_page(int node, int order) { struct page *page; - if (order > MAX_ORDER) - ...
fd54349ddb61445a8a42459b3dc09237c55e6f78
Analyze and fix the following issue in the Linux kernel code: genwqe: fix MAX_ORDER usage
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in genwqe driver. Link: https://lkml.kernel.org/r/20230315113133.11326-6-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Fra...
```diff diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 55fc5b80e649..d0e27438a73c 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -443,7 +443,7 @@ static int genwqe_mmap(struct file *filp, struct vm_area_struct *vma) if (vsize == 0) return -EI...
50c00d2c686e52c0dd9b5bddc6727f6c442cbcc0
Analyze and fix the following issue in the Linux kernel code: drm/i915: fix MAX_ORDER usage in i915_gem_object_get_pages_internal()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in i915_gem_object_get_pages_internal(). Link: https://lkml.kernel.org/r/20230315113133.11326-5-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@l...
```diff diff --git a/drivers/gpu/drm/i915/gem/i915_gem_internal.c b/drivers/gpu/drm/i915/gem/i915_gem_internal.c index 6bc26b4b06b8..eae9e9f6d3bf 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_internal.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_internal.c @@ -36,7 +36,7 @@ static int i915_gem_object_get_pages_internal(s...
5f29298fba1ad1e7139381e19e09c272db337b13
Analyze and fix the following issue in the Linux kernel code: floppy: fix MAX_ORDER usage
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in floppy code. Also allocation buffer exactly PAGE_SIZE << MAX_ORDER bytes is okay. Fix MAX_LEN check. Link: https://lkml.kernel.org/r/20230315113133.11326-4-kirill.shutemov@linu...
```diff diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 487840e3564d..90d2dfb6448e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3079,7 +3079,7 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) } } -#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) +#define MAX_LEN (...
254ca6d261d4b6ce00591de110f6f96c3556dfbe
Analyze and fix the following issue in the Linux kernel code: um: fix MAX_ORDER usage in linux_main()
Problem Details: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in linux_main(). Link: https://lkml.kernel.org/r/20230315113133.11326-3-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by...
```diff diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 8dcda617b8bf..5e5a9c8e0e5d 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -368,10 +368,10 @@ int __init linux_main(int argc, char **argv) max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC; /* - ...
75558ad315488d40a18cb2c230ccacee24d20526
Analyze and fix the following issue in the Linux kernel code: sparc/mm: fix MAX_ORDER usage in tsb_grow()
Problem Details: Patch series "Fix confusion around MAX_ORDER". MAX_ORDER currently defined as number of orders page allocator supports: user can ask buddy allocator for page order between 0 and MAX_ORDER-1. This definition is counter-intuitive and lead to number of bugs all over the kernel. Fix the bugs and then ch...
```diff diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index 912205787161..dba8dffe2113 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c @@ -402,8 +402,8 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss) unsigned long new_rss_limit; gfp_t gfp_flags; - if (max_tsb...
2bad466cc9d9b4c3b4b16eb9c03c919b59561316
Analyze and fix the following issue in the Linux kernel code: mm/uffd: UFFD_FEATURE_WP_UNPOPULATED
Problem Details: Patch series "mm/uffd: Add feature bit UFFD_FEATURE_WP_UNPOPULATED", v4. The new feature bit makes anonymous memory acts the same as file memory on userfaultfd-wp in that it'll also wr-protect none ptes. It can be useful in two cases: (1) Uffd-wp app that needs to wr-protect none ptes like QEMU snap...
```diff diff --git a/Documentation/admin-guide/mm/userfaultfd.rst b/Documentation/admin-guide/mm/userfaultfd.rst index 7dc823b56ca4..bd2226299583 100644 --- a/Documentation/admin-guide/mm/userfaultfd.rst +++ b/Documentation/admin-guide/mm/userfaultfd.rst @@ -219,6 +219,23 @@ former will have ``UFFD_PAGEFAULT_FLAG_WP`` ...
c6a690e0c978bda8106e7a489c13323f90b087d0
Analyze and fix the following issue in the Linux kernel code: kasan: suppress recursive reports for HW_TAGS
Problem Details: KASAN suppresses reports for bad accesses done by the KASAN reporting code. The reporting code might access poisoned memory for reporting purposes. Software KASAN modes do this by suppressing reports during reporting via current->kasan_depth, the same way they suppress reports during accesses to pois...
```diff diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 89078f912827..892a9dc9d4d3 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -72,10 +72,18 @@ static int __init kasan_set_multi_shot(char *str) __setup("kasan_multi_shot", kasan_set_multi_shot); /* - * Used to suppress reports within kasan_dis...
66dabbb65d673aef40dd17bf62c042be8f6d4a4b
Analyze and fix the following issue in the Linux kernel code: mm: return an ERR_PTR from __filemap_get_folio
Problem Details: Instead of returning NULL for all errors, distinguish between: - no entry found and not asked to allocated (-ENOENT) - failed to allocate memory (-ENOMEM) - would block (-EAGAIN) so that callers don't have to guess the error based on the passed in flags. Also pass through the error through the di...
```diff diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 82690d1dd49a..f92b9e62d567 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -319,16 +319,16 @@ expand: struct folio *folio; folio = filemap_get_folio(mapping, i); - if (!folio) { + if (IS_ERR(folio)) { if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &dvnod...
9d062a8a4c6d5e6d1591cde41ac844d11f953ad8
Analyze and fix the following issue in the Linux kernel code: dmapool: don't memset on free twice
Problem Details: If debug is enabled, dmapool will poison the range, so no need to clear it to 0 immediately before writing over it. Link: https://lkml.kernel.org/r/20230126215125.4069751-11-kbusch@meta.com Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Matthew Wilcox <w...
```diff diff --git a/mm/dmapool.c b/mm/dmapool.c index 4dea2a0dbd33..21e6d362c726 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -160,6 +160,8 @@ static void pool_check_block(struct dma_pool *pool, void *retval, static bool pool_page_err(struct dma_pool *pool, struct dma_page *page, void *vaddr, dma_addr_t dma)...
52e7d56539794b20fb9458c06292dfd24bba6a2d
Analyze and fix the following issue in the Linux kernel code: dmapool: move debug code to own functions
Problem Details: Clean up the normal path by moving the debug code outside it. Link: https://lkml.kernel.org/r/20230126215125.4069751-7-kbusch@meta.com Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Matthew Wilcox <willy@infradead.org> Cc: Tony Battersby <tonyb@cyberneti...
```diff diff --git a/mm/dmapool.c b/mm/dmapool.c index eaed3ffb42aa..30b069e99996 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -96,6 +96,78 @@ static ssize_t pools_show(struct device *dev, struct device_attribute *attr, cha static DEVICE_ATTR_RO(pools); +#ifdef DMAPOOL_DEBUG +static void pool_check_block(struct...
19f504584038f6d27846b19ee413a6ac1ee0f765
Analyze and fix the following issue in the Linux kernel code: dmapool: speedup DMAPOOL_DEBUG with init_on_alloc
Problem Details: Avoid double-memset of the same allocated memory in dma_pool_alloc() when both DMAPOOL_DEBUG is enabled and init_on_alloc=1. Link: https://lkml.kernel.org/r/20230126215125.4069751-6-kbusch@meta.com Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Rev...
```diff diff --git a/mm/dmapool.c b/mm/dmapool.c index ee993bb59fc2..eaed3ffb42aa 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -356,7 +356,7 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, break; } } - if (!(mem_flags & __GFP_ZERO)) + if (!want_init_on_alloc(mem_flags)) memset(retval, POO...
24e3fce00c0b557491ff596c0682a29dee6fe848
Analyze and fix the following issue in the Linux kernel code: net: stmmac: Add queue reset into stmmac_xdp_open() function
Problem Details: Queue reset was moved out from __init_dma_rx_desc_rings() and __init_dma_tx_desc_rings() functions. Thus, the driver fails to transmit and receive packet after XDP prog setup. This commit adds the missing queue reset into stmmac_xdp_open() function. Fixes: f9ec5723c3db ("net: ethernet: stmicro: stmma...
```diff diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 59cbf3597eb4..38abc898f149 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6624,6 +6624,8 @@ int stmmac_xdp_open(str...
38e058cc7d245dc8034426415bee8fec16ace1bd
Analyze and fix the following issue in the Linux kernel code: selftests: net: rps_default_mask.sh: delete veth link specifically
Problem Details: When deleting the netns and recreating a new one while re-adding the veth interface, there is a small window of time during which the old veth interface has not yet been removed. This can cause the new addition to fail. To resolve this issue, we can either wait for a short while to ensure that the old ...
```diff diff --git a/tools/testing/selftests/net/rps_default_mask.sh b/tools/testing/selftests/net/rps_default_mask.sh index 0fd0d2db3abc..a26c5624429f 100755 --- a/tools/testing/selftests/net/rps_default_mask.sh +++ b/tools/testing/selftests/net/rps_default_mask.sh @@ -60,6 +60,7 @@ ip link set dev $VETH up ip -n $NE...
abc33494ddd5c1e4bd0e17c4abe361038fb6693f
Analyze and fix the following issue in the Linux kernel code: net: fec: make use of MDIO C45 quirk
Problem Details: Not all fec MDIO bus drivers support C45 mode transactions. The older fec hardware block in many ColdFire SoCs does not appear to support them, at least according to most of the different ColdFire SoC reference manuals. The bits used to generate C45 access on the iMX parts, in the OP field of the MMFR ...
```diff diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 5ba1e0d71c68..9939ccafb556 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -507,6 +507,11 @@ struct bufdesc_ex { /* i.MX6Q adds pm_qos support */ #define FEC_QUIRK_HAS...
b0d87ed27be7853af8f897c3cfcb9ddc5179a2a3
Analyze and fix the following issue in the Linux kernel code: net/mlx5e: Fix SQ SW state layout in SQ devlink health diagnostics
Problem Details: Remove nesting level before SQ's SW state title and before SQ's SW state capabilities line. Preceding the SQ's SW state with a nameless nesting, wraps the inner SW state map/dictionary with a nameless dictionary which is prohibited in JSON file format. Removing preceding SW state nest by removing fun...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c index 44c1926843a1..b35ff289af49 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c @@ -57,10 +57,6 @...
6bd0f349ae70ce1fd325edee23fbe1d27dfbecb6
Analyze and fix the following issue in the Linux kernel code: net/mlx5e: Fix RQ SW state layout in RQ devlink health diagnostics
Problem Details: Remove nesting level before RQ's SW state title and before RQ's SW state capabilities line. Preceding the RQ's SW state with a nameless nesting, wraps the inner SW state map/dictionary with a nameless dictionary which is prohibited in JSON file format. Removing preceding SW state nest by removing fun...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c index a047a2a4ddac..e8eea9ffd5eb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c @@ -259,10 +259,6...
86d5b27b379256cd5d48974b4cd7ad03091eea6b
Analyze and fix the following issue in the Linux kernel code: ARM: imx_v6_v7_defconfig: Fix unintentional disablement of PCI
Problem Details: Since commit 75c2f26da03f ("PCI: imx6: Add i.MX PCIe EP mode support") the i.MX6 PCI driver is no longer selected by default. The existing PCI_IMX6 was made a hidden option, selected by new options PCI_IMX6_HOST (for the existing support) and PCI_IMX6_EP (for the endpoint mode), but there has been no c...
```diff diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 6dc6fed12af8..8d002c6e6cb3 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -76,7 +76,7 @@ CONFIG_RFKILL=y CONFIG_RFKILL_INPUT=y CONFIG_PCI=y CONFIG_PCI_MSI=y -CONFIG_...
5e4f393ccbf0af0828ab0914695649a5b90db230
Analyze and fix the following issue in the Linux kernel code: ARM: dts: imx6ull: Add chargebyte Tarragon support
Problem Details: This adds the support for chargebyte Tarragon, which is an Electrical Vehicle Supply Equipment (EVSE) for AC charging stations (according to IEC 61851, ISO 15118). The Tarragon board is based on an i.MX6ULL SoC and is available in 4 variants (Master, Slave, SlaveXT, Micro), which provide more or less ...
```diff diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index fd4f7230cb55..404e6f5a1cc7 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -760,6 +760,10 @@ dtb-$(CONFIG_SOC_IMX6UL) += \ imx6ull-phytec-segin-lc-rdk-nand.dtb \ imx6ull-phytec-tauri-emmc.dtb \ imx6ull-p...
c45ea315a602d45569b08b93e9ab30f6a63a38aa
Analyze and fix the following issue in the Linux kernel code: maple_tree: fix a potential concurrency bug in RCU mode
Problem Details: There is a concurrency bug that may cause the wrong value to be loaded when a CPU is modifying the maple tree. CPU1: mtree_insert_range() mas_insert() mas_store_root() ... mas_root_expand() ... rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node)); ma...
```diff diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b8a230f5d94e..db60edb55f2f 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3725,10 +3725,9 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) slot++; mas->depth = 1; mas_set_height(mas); - + ma_set_meta(node, maple_leaf_...
ec07967d7523adb3670f9dfee0232e3bc868f3de
Analyze and fix the following issue in the Linux kernel code: maple_tree: fix get wrong data_end in mtree_lookup_walk()
Problem Details: if (likely(offset > end)) max = pivots[offset]; The above code should be changed to if (likely(offset < end)), which is correct. This affects the correctness of ma_data_end(). Now it seems that the final result will not be wrong, but it is best to change it. This patch does not change the code as ...
```diff diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b1db0bd71aed..b8a230f5d94e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3941,18 +3941,13 @@ static inline void *mtree_lookup_walk(struct ma_state *mas) end = ma_data_end(node, type, pivots, max); if (unlikely(ma_dead_node(node))) goto ...
6fe7d6b992113719e96744d974212df3fcddc76c
Analyze and fix the following issue in the Linux kernel code: mm/swap: fix swap_info_struct race between swapoff and get_swap_pages()
Problem Details: The si->lock must be held when deleting the si from the available list. Otherwise, another thread can re-add the si to the available list, which can lead to memory corruption. The only place we have found where this happens is in the swapoff path. This case can be described as below: core 0 ...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index 62ba2bf577d7..2c718f45745f 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -679,6 +679,7 @@ static void __del_from_avail_list(struct swap_info_struct *p) { int nid; + assert_spin_locked(&p->lock); for_each_node(nid) plist_del(&p->avail_lists[nid], &sw...
42560f9c92cc43dce75dbf06cc0d840dced39b12
Analyze and fix the following issue in the Linux kernel code: nilfs2: fix sysfs interface lifetime
Problem Details: The current nilfs2 sysfs support has issues with the timing of creation and deletion of sysfs entries, potentially leading to null pointer dereferences, use-after-free, and lockdep warnings. Some of the sysfs attributes for nilfs2 per-filesystem instance refer to metadata file "cpfile", "sufile", or "...
```diff diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 1422b8ba24ed..77f1e5778d1c 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -482,6 +482,7 @@ static void nilfs_put_super(struct super_block *sb) up_write(&nilfs->ns_sem); } + nilfs_sysfs_delete_device_group(nilfs); iput(nilfs->ns_sufile)...
7c7b962938ddda6a9cd095de557ee5250706ea88
Analyze and fix the following issue in the Linux kernel code: mm: take a page reference when removing device exclusive entries
Problem Details: Device exclusive page table entries are used to prevent CPU access to a page whilst it is being accessed from a device. Typically this is used to implement atomic operations when the underlying bus does not support atomic access. When a CPU thread encounters a device exclusive entry it locks the page...
```diff diff --git a/mm/memory.c b/mm/memory.c index f456f3b5049c..01a23ad48a04 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3563,8 +3563,21 @@ static vm_fault_t remove_device_exclusive_entry(struct vm_fault *vmf) struct vm_area_struct *vma = vmf->vma; struct mmu_notifier_range range; - if (!folio_lock_or_retry...
7397031622e05ca206e2d674ec199d6bb66fc9ba
Analyze and fix the following issue in the Linux kernel code: nilfs2: initialize "struct nilfs_binfo_dat"->bi_pad field
Problem Details: nilfs_btree_assign_p() and nilfs_direct_assign_p() are not initializing "struct nilfs_binfo_dat"->bi_pad field, causing uninit-value reports when being passed to CRC function. Link: https://lkml.kernel.org/r/20230326152146.15872-1-konishi.ryusuke@gmail.com Reported-by: syzbot <syzbot+048585f3f4227bb2b...
```diff diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 2681a449edc1..13592e82eaf6 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -2219,6 +2219,7 @@ static int nilfs_btree_assign_p(struct nilfs_bmap *btree, /* on-disk format */ binfo->bi_dat.bi_blkoff = cpu_to_le64(key); binfo->bi_dat.bi_level...
6be49d100c22ffea3287a4b19d7639d259888e33
Analyze and fix the following issue in the Linux kernel code: nilfs2: fix potential UAF of struct nilfs_sc_info in nilfs_segctor_thread()
Problem Details: The finalization of nilfs_segctor_thread() can race with nilfs_segctor_kill_thread() which terminates that thread, potentially causing a use-after-free BUG as KASAN detected. At the end of nilfs_segctor_thread(), it assigns NULL to "sc_task" member of "struct nilfs_sc_info" to indicate the thread has ...
```diff diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 19446a8243d7..6ad41390fa74 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -2609,11 +2609,10 @@ static int nilfs_segctor_thread(void *arg) goto loop; end_thread: - spin_unlock(&sci->sc_state_lock); - /* end sync. */ sci->sc_tas...
618a8a917dbf5830e2064d2fa0568940eb5d2584
Analyze and fix the following issue in the Linux kernel code: zsmalloc: document freeable stats
Problem Details: When freeable class stat was added to classes file (back in 2016) we forgot to update zsmalloc documentation. Fix that. Link: https://lkml.kernel.org/r/20230325024631.2817153-3-senozhatsky@chromium.org Fixes: 1120ed548394 ("mm/zsmalloc: add `freeable' column to pool stat") Signed-off-by: Sergey Senoz...
```diff diff --git a/Documentation/mm/zsmalloc.rst b/Documentation/mm/zsmalloc.rst index 3c6bf639887f..a3c26d587752 100644 --- a/Documentation/mm/zsmalloc.rst +++ b/Documentation/mm/zsmalloc.rst @@ -83,6 +83,8 @@ pages_used the number of pages allocated for the class pages_per_zspage the number of 0-order pages to...
119b57eaf09478ce9e2a8f88a12749c2658b0ed5
Analyze and fix the following issue in the Linux kernel code: zsmalloc: document new fullness grouping
Problem Details: Patch series "zsmalloc: minor documentation updates". Two minor patches that bring zsmalloc documentation up to date. This patch (of 2): Update documentation and reflect new zspages fullness grouping (we don't use almost_empty and almost_full anymore). Link: https://lkml.kernel.org/r/2023032502463...
```diff diff --git a/Documentation/mm/zsmalloc.rst b/Documentation/mm/zsmalloc.rst index 64d127bfc221..3c6bf639887f 100644 --- a/Documentation/mm/zsmalloc.rst +++ b/Documentation/mm/zsmalloc.rst @@ -39,13 +39,12 @@ With CONFIG_ZSMALLOC_STAT, we could see zsmalloc internal information via # cat /sys/kernel/debug/zsm...