id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
0066623d40085bb5d0af8d645a3bba27fc5cfced
Analyze and fix the following issue in the Linux kernel code: net: netconsole: Eliminate redundant setting of enabled field
Problem Details: When disabling a netconsole target, enabled_store() is called with enabled=false. Currently, this results in updating the nt->enabled field twice: 1. Inside the if/else block, with the target_list_lock spinlock held 2. Later, without the target_list_lock This patch eliminates the redundancy by settin...
```diff diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index de0d89e4e4e2..5ef680cf994a 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -369,6 +369,7 @@ static ssize_t enabled_store(struct config_item *item, if (err) goto out_unlock; + nt->enabled = true; pr_info("...
36a5c03f232719eb4e2d925f4d584e09cfaf372c
Analyze and fix the following issue in the Linux kernel code: md/raid1: set max_sectors during early return from choose_slow_rdev()
Problem Details: Linux 6.9+ is unable to start a degraded RAID1 array with one drive, when that drive has a write-mostly flag set. During such an attempt, the following assertion in bio_split() is hit: BUG_ON(sectors <= 0); Call Trace: ? bio_split+0x96/0xb0 ? exc_invalid_op+0x53/0x70 ? bio_split+0x96/0xb0 ? asm_...
```diff diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 04a0c2ca1732..7acfe7c9dc8d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, len = r1_bio->sectors; read_len = raid1_check_read_range(rdev, this_sect...
35a0a409fa269c287c4378f1aefe84ae8b5211a1
Analyze and fix the following issue in the Linux kernel code: md-cluster: fix no recovery job when adding/re-adding a disk
Problem Details: The commit db5e653d7c9f ("md: delay choosing sync action to md_start_sync()") delays the start of the sync action. In a clustered environment, this will cause another node to first activate the spare disk and skip recovery. As a result, no nodes will perform recovery when a disk is added or re-added. ...
```diff diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index f2bd37d72a46..6ce75c82969c 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -57,6 +57,7 @@ struct resync_info { #define MD_CLUSTER_ALREADY_IN_CLUSTER 6 #define MD_CLUSTER_PENDING_RECV_EVENT 7 #define MD_CLUSTER_HOL...
fff42f213824fa434a4b6cf906b4331fe6e9302b
Analyze and fix the following issue in the Linux kernel code: md-cluster: fix hanging issue while a new disk adding
Problem Details: The commit 1bbe254e4336 ("md-cluster: check for timeout while a new disk adding") is correct in terms of code syntax but not suite real clustered code logic. When a timeout occurs while adding a new disk, if recv_daemon() bypasses the unlock for ack_lockres:CR, another node will be waiting to grab EX ...
```diff diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 139fe2019c1d..f2bd37d72a46 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -15,6 +15,7 @@ #define LVB_SIZE 64 #define NEW_DEV_TIMEOUT 5000 +#define WAIT_DLM_LOCK_TIMEOUT (30 * HZ) struct dlm_lock_resource { dlm_l...
5e724cb688a207ae7a348d57f9ea77f475998883
Analyze and fix the following issue in the Linux kernel code: selftests: openvswitch: retry instead of sleep
Problem Details: There are a couple of places where the test script "sleep"s to wait for some external condition to be met. This is error prone, specially in slow systems (identified in CI by "KSFT_MACHINE_SLOW=yes"). To fix this, add a "ovs_wait" function that tries to execute a command a few times until it succeeds...
```diff diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index bc71dbc18b21..cc0bfae2bafa 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -11,6 +11,11 @@ ksft_s...
8341eee81c794db0d8dd503c2b0ea2f55eba7334
Analyze and fix the following issue in the Linux kernel code: net: psample: fix flag being set in wrong skb
Problem Details: A typo makes PSAMPLE_ATTR_SAMPLE_RATE netlink flag be added to the wrong sk_buff. Fix the error and make the input sk_buff pointer "const" so that it doesn't happen again. Acked-by: Eelco Chaudron <echaudro@redhat.com> Fixes: 7b1b2b60c63f ("net: psample: allow using rate as probability") Signed-off-b...
```diff diff --git a/include/net/psample.h b/include/net/psample.h index c52e9ebd88dd..5071b5fc2b59 100644 --- a/include/net/psample.h +++ b/include/net/psample.h @@ -38,13 +38,15 @@ struct sk_buff; #if IS_ENABLED(CONFIG_PSAMPLE) -void psample_sample_packet(struct psample_group *group, struct sk_buff *skb, - ...
c9741a03dc8e491e57b95fba0058ab46b7e506da
Analyze and fix the following issue in the Linux kernel code: bna: adjust 'name' buf size of bna_tcb and bna_ccb structures
Problem Details: To have enough space to write all possible sprintf() args. Currently 'name' size is 16, but the first '%s' specifier may already need at least 16 characters, since 'bnad->netdev->name' is used there. For '%d' specifiers, assume that they require: * 1 char for 'tx_id + tx_info->tcb[i]->id' sum, BNAD_M...
```diff diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h b/drivers/net/ethernet/brocade/bna/bna_types.h index a5ebd7110e07..986f43d27711 100644 --- a/drivers/net/ethernet/brocade/bna/bna_types.h +++ b/drivers/net/ethernet/brocade/bna/bna_types.h @@ -416,7 +416,7 @@ struct bna_ib { /* Tx object */ /* Tx dat...
8b9b59e27aa88ba133fbac85def3f8be67f2d5a8
Analyze and fix the following issue in the Linux kernel code: i40e: fix: remove needless retries of NVM update
Problem Details: Remove wrong EIO to EGAIN conversion and pass all errors as is. After commit 230f3d53a547 ("i40e: remove i40e_status"), which should only replace F/W specific error codes with Linux kernel generic, all EIO errors suddenly started to be converted into EAGAIN which leads nvmupdate to retry until it time...
```diff diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h index ee86d2c53079..55b5bb884d73 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h @@ -109,10 +109,6 @@ static inline int i40e_aq_rc_to_posix(in...
503757c809281a24d50ac2538401d3b1302b301c
Analyze and fix the following issue in the Linux kernel code: net: ethtool: Fix RSS setting
Problem Details: When user submits a rxfh set command without touching XFRM_SYM_XOR, rxfh.input_xfrm is set to RXH_XFRM_NO_CHANGE, which is equal to 0xff. Testing if (rxfh.input_xfrm & RXH_XFRM_SYM_XOR && !ops->cap_rss_sym_xor_supported) return -EOPNOTSUPP; Will always be true on devices that don't set cap_rss...
```diff diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index e645d751a5e8..223dcd25d88a 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1306,7 +1306,8 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, if (rxfh.input_xfrm && rxfh.input_xfrm != RXH_XFRM_SYM_XOR && rx...
1841027c7de47527ed819a935b7aa340b9171eb5
Analyze and fix the following issue in the Linux kernel code: bcachefs: bch2_gc_btree() should not use btree_root_lock
Problem Details: btree_root_lock is for the root keys in btree_root, not the pointers to the nodes themselves; this fixes a lock ordering issue between btree_root_lock and btree node locks. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
```diff diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index 7c72a9e6f511..a0deb8266011 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -641,16 +641,30 @@ static int bch2_gc_btree(struct btree_trans *trans, enum btree_id btree, bool in target_depth = 0; /* root */ - mutex_lock(&...
ea5ea84c9d3570dc06e8fc5ee2273eaa584aa3ac
Analyze and fix the following issue in the Linux kernel code: i2c: rcar: ensure Gen3+ reset does not disturb local targets
Problem Details: R-Car Gen3+ needs a reset before every controller transfer. That erases configuration of a potentially in parallel running local target instance. To avoid this disruption, avoid controller transfers if a local target is running. Also, disable SMBusHostNotify because it requires being a controller and l...
```diff diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index f0724c8e4b21..185a5d60f101 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -883,6 +883,10 @@ static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv) { int ret; + /* Don't reset if a slave ins...
861f96a785149a0062cce6578e0fa7cb95435a7e
Analyze and fix the following issue in the Linux kernel code: iommufd: Remove IOMMUFD_PAGE_RESP_FAILURE
Problem Details: The response code of IOMMUFD_PAGE_RESP_FAILURE was defined to be equivalent to the "Response Failure" in PCI spec, section 10.4.2.1. This response code indicates that one or more pages within the associated request group have encountered or caused an unrecoverable error. Therefore, this response disabl...
```diff diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h index ede2b464a761..e31385b75d0b 100644 --- a/include/uapi/linux/iommufd.h +++ b/include/uapi/linux/iommufd.h @@ -765,14 +765,10 @@ struct iommu_hwpt_pgfault { * @IOMMUFD_PAGE_RESP_INVALID: Could not handle this fault, don't retry the ...
82a3e3a235633aa0575fac9507d648dd80f3437f
Analyze and fix the following issue in the Linux kernel code: cxl/region: Verify target positions using the ordered target list
Problem Details: When a root decoder is configured the interleave target list is read from the BIOS populated CFMWS structure. Per the CXL spec 3.1 Table 9-22 the target list is in interleave order. The CXL driver populates its decoder target list in the same order and stores it in 'struct cxl_switch_decoder' field "@t...
```diff diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 23abd0f7b856..2772828ca6ca 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1559,10 +1559,13 @@ static int cxl_region_attach_position(struct cxl_region *cxlr, const struct cxl_dport *dport, int pos) { ...
3b2fedcd75e3991e77c2a8c3ebcab0ea68b2d69d
Analyze and fix the following issue in the Linux kernel code: cxl: Restore XOR'd position bits during address translation
Problem Details: When a device reports a DPA in events like poison, general_media, and dram, the driver translates that DPA back to an HPA. Presently, the CXL driver translation only considers the Modulo position and will report the wrong HPA for XOR configured root decoders. Add a helper function that restores the XO...
```diff diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index 571069863c62..6b6ae9c81368 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -74,6 +74,43 @@ static struct cxl_dport *cxl_hb_xor(struct cxl_root_decoder *cxlrd, int pos) return cxlrd->cxlsd.target[n]; } +static u64 cxl_xor_hpa_to_spa(stru...
19af457573838785290d27dd09a59140f541d1d8
Analyze and fix the following issue in the Linux kernel code: workqueue: Remove cpus_read_lock() from apply_wqattrs_lock()
Problem Details: 1726a1713590 ("workqueue: Put PWQ allocation and WQ enlistment in the same lock C.S.") led to the following possible deadlock: WARNING: possible recursive locking detected 6.10.0-rc5-00004-g1d4c6111406c #1 Not tainted -------------------------------------------- swapper/0/1 is trying to acqu...
```diff diff --git a/kernel/workqueue.c b/kernel/workqueue.c index a345a72395e7..9b7c1fcd934b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5113,15 +5113,12 @@ static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq, static void apply_wqattrs_lock(void) { - /* CPUs should stay sta...
1d302f626c2a23e4fd05bb810eff300e8f2174fd
Analyze and fix the following issue in the Linux kernel code: perf build: Conditionally add feature check flags for libtrace{event,fs}
Problem Details: This avoids reported warnings when the packages are not installed. [namhyung]: Removed the dummy assignment and unnecessary ifeq checks. Fixes: 0f0e1f445690 ("perf build: Use pkg-config for feature check for libtrace{event,fs}") Signed-off-by: Guilherme Amadio <amadio@gentoo.org> Cc: Leo Yan <leo.yan...
```diff diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5271a4c1d2b3..a4829b6532d8 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -182,13 +182,19 @@ endif FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) +if...
2899d58462ba868287d6ff3acad3675e7adf934f
Analyze and fix the following issue in the Linux kernel code: ethtool: fail closed if we can't get max channel used in indirection tables
Problem Details: Commit 0d1b7d6c9274 ("bnxt: fix crashes when reducing ring count with active RSS contexts") proves that allowing indirection table to contain channels with out of bounds IDs may lead to crashes. Currently the max channel check in the core gets skipped if driver can't fetch the indirection table or when...
```diff diff --git a/net/ethtool/channels.c b/net/ethtool/channels.c index 7b4bbd674bae..cee188da54f8 100644 --- a/net/ethtool/channels.c +++ b/net/ethtool/channels.c @@ -171,11 +171,9 @@ ethnl_set_channels(struct ethnl_req_info *req_info, struct genl_info *info) */ if (ethtool_get_max_rxnfc_channel(dev, &max_rxnf...
f00059b4c1b068df108c70f86749b23f9080d2ba
Analyze and fix the following issue in the Linux kernel code: drm/vboxvideo: fix mapping leaks
Problem Details: When the PCI devres API was introduced to this driver, it was wrongly assumed that initializing the device with pcim_enable_device() instead of pci_enable_device() will make all PCI functions managed. This is wrong and was caused by the quite confusing PCI devres API in which some, but not all, functi...
```diff diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c index 42c2d8a99509..d4ade9325401 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -42,12 +42,11 @@ static int vbox_accel_init(struct vbox_private *vbox) /* Take a command...
25216afc9db53d85dc648aba8fb7f6d31f2c8731
Analyze and fix the following issue in the Linux kernel code: PCI: Add managed pcim_intx()
Problem Details: pci_intx() is a "hybrid" function, i.e., it is managed if pcim_enable_device() has been called, but unmanaged otherwise. Add pcim_intx(), which is always managed, and implement pci_intx() using it. Remove the now-unused struct pci_devres.orig_intx and .restore_intx and find_pci_dr(). Link: https://l...
```diff diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index d3c29ec30ad7..f7b718438412 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -43,6 +43,11 @@ struct pcim_iomap_devres { void __iomem *table[PCI_STD_NUM_BARS]; }; +/* Used to restore the old INTx state on driver detach. */ +struct ...
0477d5168bbb8767275822830b47112519a8446d
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Expose SFs IRQs
Problem Details: Expose the sysfs files for the IRQs that the mlx5 PCI SFs are using. These entries are similar to PCI PFs and VFs in 'msi_irqs' directory. Reviewed-by: Parav Pandit <parav@nvidia.com> Signed-off-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> --- v8-v9: - add Przem...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 5693986ae656..5661f047702e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -714,7 +714,7 @@ err2: err1: mlx5_cmd_allowed_opcode(dev, C...
a808878308a8041ae10a151d69e2d22f94cae9f4
Analyze and fix the following issue in the Linux kernel code: driver core: auxiliary bus: show auxiliary device IRQs
Problem Details: PCI subfunctions (SF) are anchored on the auxiliary bus. PCI physical and virtual functions are anchored on the PCI bus. The irq information of each such function is visible to users via sysfs directory "msi_irqs" containing files for each irq entry. However, for PCI SFs such information is unavailable...
```diff diff --git a/Documentation/ABI/testing/sysfs-bus-auxiliary b/Documentation/ABI/testing/sysfs-bus-auxiliary new file mode 100644 index 000000000000..cc856079690f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-auxiliary @@ -0,0 +1,9 @@ +What: /sys/bus/auxiliary/devices/.../irqs/ +Date: April, 2024 +Con...
b3470da314fd8018ee237e382000c4154a942420
Analyze and fix the following issue in the Linux kernel code: bpf: annotate BTF show functions with __printf
Problem Details: -Werror=suggest-attribute=format warns about two functions in kernel/bpf/btf.c [1]; add __printf() annotations to silence these warnings since for CONFIG_WERROR=y they will trigger build failures. [1] https://lore.kernel.org/bpf/a8b20c72-6631-4404-9e1f-0410642d7d20@gmail.com/ Fixes: 31d0bc81637d ("bp...
```diff diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 4ff11779699e..d5019c4454d6 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -7538,8 +7538,8 @@ static void btf_type_show(const struct btf *btf, u32 type_id, void *obj, btf_type_ops(t)->show(btf, t, type_id, obj, 0, show); } -static void btf_seq_...
d5cfecfe7f3293a4773c4486ac92d742143e8659
Analyze and fix the following issue in the Linux kernel code: dm vdo: replace max_discard_sectors with max_hw_discard_sectors
Problem Details: Commit 4f563a64732d ("block: add a max_user_discard_sectors queue limit") changed block core to set max_discard_sectors to: min(lim->max_hw_discard_sectors, lim->max_user_discard_sectors) Commit 825d8bbd2f32 ("dm: always manage discard support in terms of max_hw_discard_sectors") fixed most dm targets...
```diff diff --git a/drivers/md/dm-vdo/dm-vdo-target.c b/drivers/md/dm-vdo/dm-vdo-target.c index 5a4b0a927f56..af77084969e0 100644 --- a/drivers/md/dm-vdo/dm-vdo-target.c +++ b/drivers/md/dm-vdo/dm-vdo-target.c @@ -945,7 +945,7 @@ static void vdo_io_hints(struct dm_target *ti, struct queue_limits *limits) * The valu...
211ad49cf8ccfdc798a719b4d1e000d0a8a9e588
Analyze and fix the following issue in the Linux kernel code: drm/i915/dp: Don't switch the LTTPR mode on an active link
Problem Details: Switching to transparent mode leads to a loss of link synchronization, so prevent doing this on an active link. This happened at least on an Intel N100 system / DELL UD22 dock, the LTTPR residing either on the host or the dock. To fix the issue, keep the current mode on an active link, adjusting the LT...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c index 1bc4ef84ff3b..d044c8e36bb3 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c @@ -117,10 +117,24 @@ intel_d...
b84111cda99845b2ff248bae37b34f57882d513c
Analyze and fix the following issue in the Linux kernel code: selftests/x86: fix printk warnings reported by clang
Problem Details: These warnings are all of the form, "the format specified a short (signed or unsigned) int, but the value is a full length int". Acked-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Signed-off-by: John Hubbard <jhubbard@nvidia.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
```diff diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c index 5d7961a5f7f6..0b75b29f794b 100644 --- a/tools/testing/selftests/x86/sigreturn.c +++ b/tools/testing/selftests/x86/sigreturn.c @@ -487,7 +487,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void) g...
7d17b29b0e4b9a97426873f72e9cc6d35cfaf88f
Analyze and fix the following issue in the Linux kernel code: selftests/x86: remove (or use) unused variables and functions
Problem Details: When building with clang, via: make LLVM=1 -C tools/testing/selftests ...quite a few functions are variables are generating "unused" warnings. Fix the warnings by deleting the unused items. One item, the "nerrs" variable in vsdo_restorer.c's main(), is unused but probably wants to be returned fr...
```diff diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c index 95aad6d8849b..1fdf35a4d7f6 100644 --- a/tools/testing/selftests/x86/amx.c +++ b/tools/testing/selftests/x86/amx.c @@ -39,16 +39,6 @@ struct xsave_buffer { }; }; -static inline uint64_t xgetbv(uint32_t index) -{ - uint3...
2ab9c93d6104e36110754d0778103f7f8719d969
Analyze and fix the following issue in the Linux kernel code: selftests/x86: build sysret_rip.c with clang
Problem Details: When building with clang, via: make LLVM=1 -C tools/testing/selftests ...the build fails because clang's inline asm doesn't support all of the features that are used in the asm() snippet in sysret_rip.c. Fix this by moving the asm code into the clang_helpers_64.S file, where it can be built with...
```diff diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 99bc2ef84f5a..d0bb32bd5538 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -115,6 +115,7 @@ $(eval $(call extra-files,ptrace_syscall_32,raw_syscall_helper_32.S)) $(eval...
1158655317b6b6e71980533939dce9ab91d9716b
Analyze and fix the following issue in the Linux kernel code: selftests/x86: build fsgsbase_restore.c with clang
Problem Details: When building with clang, via: make LLVM=1 -C tools/testing/selftests Fix this by moving the inline asm to "pure" assembly, in two new files: clang_helpers_32.S, clang_helpers_64.S. As a bonus, the pure asm avoids the need for ifdefs, and is now very simple and easy on the eyes. Acked-by: Muham...
```diff diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index c1269466e0f8..99bc2ef84f5a 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -113,6 +113,8 @@ endef $(eval $(call extra-files,sysret_ss_attrs_64,thunks.S)) $(eval $(call...
bf967fb39e020f4426d13e634d21283758aea3c8
Analyze and fix the following issue in the Linux kernel code: selftests: x86: test_FISTTP: use fisttps instead of ambiguous fisttp
Problem Details: Use fisttps instead of fisttp to specify correctly that the output variable is of size short. test_FISTTP.c:28:3: error: ambiguous instructions require an explicit suffix (could be 'fisttps', or 'fisttpl') 28 | " fisttp res16""\n" | ^ <inline asm>:3:2: note: instantiat...
```diff diff --git a/tools/testing/selftests/x86/test_FISTTP.c b/tools/testing/selftests/x86/test_FISTTP.c index 09789c0ce3e9..b9ae9d8cebcb 100644 --- a/tools/testing/selftests/x86/test_FISTTP.c +++ b/tools/testing/selftests/x86/test_FISTTP.c @@ -25,7 +25,7 @@ int test(void) feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_I...
825658b790330ed474547d2b1f87436879ca7da6
Analyze and fix the following issue in the Linux kernel code: selftests/x86: fix Makefile dependencies to work with clang
Problem Details: When building with clang, via: make LLVM=1 -C tools/testing/selftests ...the following build failure occurs in selftests/x86: clang: error: cannot specify -o when generating multiple output files This happens because, although gcc doesn't complain if you invoke it like this: gcc file1.c...
```diff diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 0b872c0a42d2..c1269466e0f8 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -73,10 +73,10 @@ all_64: $(BINARIES_64) EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64) $(BIN...
4eddfafc902b28119c24189c5ba9469bd1607878
Analyze and fix the following issue in the Linux kernel code: selftests/timers: remove unused irqcount variable
Problem Details: When building with clang, via: make LLVM=1 -C tools/testing/selftest ...clang warns about an unused irqcount variable. clang is correct: the variable is incremented and then ignored. Fix this by deleting the irqcount variable. Signed-off-by: John Hubbard <jhubbard@nvidia.com> Acked-by: John Stu...
```diff diff --git a/tools/testing/selftests/timers/rtcpie.c b/tools/testing/selftests/timers/rtcpie.c index 4ef2184f1558..7c07edd0d450 100644 --- a/tools/testing/selftests/timers/rtcpie.c +++ b/tools/testing/selftests/timers/rtcpie.c @@ -29,7 +29,7 @@ static const char default_rtc[] = "/dev/rtc0"; int main(int argc...
2704b2d117c52cd156bcdcad1eefd9c2dad1794d
Analyze and fix the following issue in the Linux kernel code: selftests/resctrl: Make "bandwidth" consistent in comments & prints
Problem Details: Resctrl selftests refer to "bandwidth" currently in two other forms in the code ("B/W" and "band width"). Use "bandwidth" consistently everywhere. While at it, fix also one "over flow" -> "overflow" on a line that is touched by the change. Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Sig...
```diff diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index 3c7f6793c261..5fad7e757af3 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -361,11 +361,11 @@ static void do_imc_mem_bw_test(void) }...
c44000b6535dc9806b9128d1aed403862b2adab9
Analyze and fix the following issue in the Linux kernel code: selftests/resctrl: Fix closing IMC fds on error and open-code R+W instead of loops
Problem Details: The imc perf fd close() calls are missing from all error paths. In addition, get_mem_bw_imc() handles fds in a for loop but close() is based on two fixed indexes READ and WRITE. Open code inner for loops to READ+WRITE entries for clarity and add a function to close() IMC fds properly in all cases. Fi...
```diff diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c index 445f306d4c2f..f55f5989de72 100644 --- a/tools/testing/selftests/resctrl/resctrl_val.c +++ b/tools/testing/selftests/resctrl/resctrl_val.c @@ -293,6 +293,18 @@ static int initialize_mem_bw_imc(void) ...
b47619a3a3f79f75edf774275798aad1a37609ad
Analyze and fix the following issue in the Linux kernel code: selftests/sched: fix code format issues
Problem Details: There are extra spaces in the middle of #define. It is recommended to delete the spaces to make the code look more comfortable. Signed-off-by: aigourensheng <shechenglong001@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
```diff diff --git a/tools/testing/selftests/sched/cs_prctl_test.c b/tools/testing/selftests/sched/cs_prctl_test.c index 62fba7356af2..52d97fae4dbd 100644 --- a/tools/testing/selftests/sched/cs_prctl_test.c +++ b/tools/testing/selftests/sched/cs_prctl_test.c @@ -42,11 +42,11 @@ static pid_t gettid(void) #ifndef PR_S...
a6a9fcb10836105e525ccb8bc1a6af4b20a113be
Analyze and fix the following issue in the Linux kernel code: net: pse-pd: pd692x0: Fix spelling mistake "availables" -> "available"
Problem Details: There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Acked-by: Kory Maincent <Kory.maincent@bootlin.com> Link: https://patch.msgid.link/20240709105222.168306-1-colin.i.king@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
```diff diff --git a/drivers/net/pse-pd/pd692x0.c b/drivers/net/pse-pd/pd692x0.c index 29cc76a66c13..0af7db80b2f8 100644 --- a/drivers/net/pse-pd/pd692x0.c +++ b/drivers/net/pse-pd/pd692x0.c @@ -589,7 +589,7 @@ static int pd692x0_pi_set_pw_from_table(struct device *dev, if (pw < pw_table->class_pw) { dev_err(d...
f48ecbd2ce1ca2b0c92843f67879b583b1f85cda
Analyze and fix the following issue in the Linux kernel code: Input: twl4030-pwrbutton - fix kernel-doc warning
Problem Details: Do not use kernel-doc style for comment describing contents of the source file, as it trips the script: scripts/kernel-doc -none drivers/input/misc/twl4030-pwrbutton.c drivers/input/misc/twl4030-pwrbutton.c:2: info: Scanning doc for function twl4030 drivers/input/misc/twl4030-pwrbutton.c:33: warni...
```diff diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index e3ee0638ffba..f85cc289c053 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c @@ -1,5 +1,5 @@ -/** - * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver +/* + * ...
f7d43dd206e7e18c182f200e67a8db8c209907fa
Analyze and fix the following issue in the Linux kernel code: tick/broadcast: Make takeover of broadcast hrtimer reliable
Problem Details: Running the LTP hotplug stress test on a aarch64 machine results in rcu_sched stall warnings when the broadcast hrtimer was owned by the un-plugged CPU. The issue is the following: CPU1 (owns the broadcast hrtimer) CPU2 tick_broadcast_enter() // shutdown local timer device broadcast_s...
```diff diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 771d1e040303..b4843099a8da 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -1141,6 +1141,7 @@ void tick_broadcast_switch_to_oneshot(void) #ifdef CONFIG_HOTPLUG_CPU void hotplug_cpu__broadcast_tick_pu...
19d3c179a37730caf600a97fed3794feac2b197b
Analyze and fix the following issue in the Linux kernel code: bpf, arm64: Fix trampoline for BPF_TRAMP_F_CALL_ORIG
Problem Details: When BPF_TRAMP_F_CALL_ORIG is set, the trampoline calls __bpf_tramp_enter() and __bpf_tramp_exit() functions, passing them the struct bpf_tramp_image *im pointer as an argument in R0. The trampoline generation code uses emit_addr_mov_i64() to emit instructions for moving the bpf_tramp_image address in...
```diff diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 751331f5ba90..dd0bb069df4b 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -2147,7 +2147,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, emit(A64_STR64I(A64_R(...
16198eef11c1929374381d7f6271b4bf6aa44615
Analyze and fix the following issue in the Linux kernel code: mmc: davinci_mmc: Prevent transmitted data size from exceeding sgm's length
Problem Details: No check is done on the size of the data to be transmiited. This causes a kernel panic when this size exceeds the sg_miter's length. Limit the number of transmitted bytes to sgm->length. Cc: stable@vger.kernel.org Fixes: ed01d210fd91 ("mmc: davinci_mmc: Use sg_miter for PIO") Signed-off-by: Bastien C...
```diff diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c index d7427894e0bc..c302eb380e42 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c @@ -224,6 +224,9 @@ static void davinci_fifo_data_trans(struct mmc_davinci_host *host, } p = sgm->addr; + if (n > s...
63d20a94f24fc1cbaf44d0e7c0e0a8077fde0aef
Analyze and fix the following issue in the Linux kernel code: mmc: sdhci: Fix max_seg_size for 64KiB PAGE_SIZE
Problem Details: blk_queue_max_segment_size() ensured: if (max_size < PAGE_SIZE) max_size = PAGE_SIZE; whereas: blk_validate_limits() makes it an error: if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE)) return -EINVAL; The change from one to the other, exposed sdhci which was setting maximum segment size ...
```diff diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 112584aa0772..fbf7a91bed35 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -4727,6 +4727,21 @@ int sdhci_setup_host(struct sdhci_host *host) if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) { host->max_...
b4e891901ed5409f4c33d12fd92011be925ef5b3
Analyze and fix the following issue in the Linux kernel code: fixmap: Remove unused set_fixmap_offset_io()
Problem Details: The macro set_fixmap_offset_io() was added in commit f774b7d10e21 ("arm64: fixmap: fix missing sub-page offset for earlyprintk") but then commit 8ef0ed95ee04 ("arm64: remove arch specific earlyprintk") removed the file causing the only user to be removed when the two commits were merged. Since this has...
```diff diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index 8cc7b09c1bc7..29cab7947980 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -97,8 +97,5 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) #define set_fixmap_io(idx, phys) \ __set_...
609458abd5a10180f513ca364d6c0ae30128c821
Analyze and fix the following issue in the Linux kernel code: drm/xe/display/xe_hdcp_gsc: Free arbiter on driver removal
Problem Details: Free arbiter allocated in intel_hdcp_gsc_init(). Fixes: 152f2df954d8 ("drm/xe/hdcp: Enable HDCP for XE") Cc: Suraj Kandpal <suraj.kandpal@intel.com> Cc: Arun R Murthy <arun.r.murthy@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Rodrigo...
```diff diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c index d46f87a039f2..b3d3c065dd9d 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -159,12 +159,16 @@ void intel_hdcp_gsc_fini(struct xe_device *xe) { struct ...
5207c393d3e7dda9aff813d6b3e2264370d241be
Analyze and fix the following issue in the Linux kernel code: drm/xe: Use write-back caching mode for system memory on DGFX
Problem Details: The caching mode for buffer objects with VRAM as a possible placement was forced to write-combined, regardless of placement. However, write-combined system memory is expensive to allocate and even though it is pooled, the pool is expensive to shrink, since it involves global CPU TLB flushes. Moreover...
```diff diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index bc1f794e3e61..b6f3a43d637f 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -317,7 +317,7 @@ static struct ttm_tt *xe_ttm_tt_create(struct ttm_buffer_object *ttm_bo, struct xe_device *xe = xe_bo_device(bo); ...
68a3ebd18bc8c4e766250d5c43d30ff75b8aec0b
Analyze and fix the following issue in the Linux kernel code: btrfs: use delayed iput during extent map shrinking
Problem Details: When putting an inode during extent map shrinking we're doing a standard iput() but that may take a long time in case the inode is dirty and we are doing the final iput that triggers eviction - the VFS will have to wait for writeback before calling the btrfs evict callback (see fs/inode.c:evict()). Th...
```diff diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 744e8952abb0..cb74d382a24f 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -1115,7 +1115,7 @@ static long btrfs_scan_root(struct btrfs_root *root, long *scanned, long nr_to_s min_ino = btrfs_ino(inode) + 1; fs_info->exten...
556bc13776a7e27d1b8f4bfc92340428846774f4
Analyze and fix the following issue in the Linux kernel code: dt-bindings: trivial-devices: document the Sierra Wireless mangOH Green SPI IoT interface
Problem Details: Document the Sierra Wireless mangOH Green SPI IoT interface as a trivial device. This fixes the following check: qcom-mdm9615-wp8548-mangoh-green.dtb: /soc/gsbi@16200000/spi@16280000/spi@0: failed to match any schema with compatible: ['swir,mangoh-iotport-spi'] Signed-off-by: Neil Armstrong <neil.arm...
```diff diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 0a419453d183..bb288cfaa185 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -354,6 +354,8 @@ prope...
942d917cb92af2277db9e3be0d62345d770d5996
Analyze and fix the following issue in the Linux kernel code: xen: make multicall debug boot time selectable
Problem Details: Today Xen multicall debugging needs to be enabled via modifying a define in a source file for getting debug data of multicall errors encountered by users. Switch multicall debugging to depend on a boot parameter "xen_mc_debug" instead, enabling affected users to boot with the new parameter set in orde...
```diff diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 27ec49af1bf2..b33d048e01d8 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -7427,6 +7427,12 @@ Crash from Xen panic notif...
359bc01d2ecc9093216d21cfa03a545c44413cb6
Analyze and fix the following issue in the Linux kernel code: libceph: fix crush_choose_firstn() kernel-doc warnings
Problem Details: Currently, when built with "make W=1", the following warnings are generated: net/ceph/crush/mapper.c:466: warning: Function parameter or struct member 'work' not described in 'crush_choose_firstn' net/ceph/crush/mapper.c:466: warning: Function parameter or struct member 'weight' not described in 'crus...
```diff diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 6f305fb18524..3a5bd1cd1e99 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -429,7 +429,10 @@ static int is_out(const struct crush_map *map, /** * crush_choose_firstn - choose numrep distinct items of given type * @ma...
8e7860543a94784d744c7ce34b78a2e11beefa5c
Analyze and fix the following issue in the Linux kernel code: btrfs: fix extent map use-after-free when adding pages to compressed bio
Problem Details: At add_ra_bio_pages() we are accessing the extent map to calculate 'add_size' after we dropped our reference on the extent map, resulting in a use-after-free. Fix this by computing 'add_size' before dropping our extent map reference. Reported-by: syzbot+853d80cba98ce1157ae6@syzkaller.appspotmail.com L...
```diff diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index a149f3659b15..a8e2c461aff7 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -515,6 +515,7 @@ static noinline int add_ra_bio_pages(struct inode *inode, put_page(page); break; } + add_size = min(em->start + em->len, ...
6463c360d6579dc68786cc3621aaa1ebf513e50b
Analyze and fix the following issue in the Linux kernel code: libceph: suppress crush_choose_indep() kernel-doc warnings
Problem Details: Currently, when built with "make W=1", the following warnings are generated: net/ceph/crush/mapper.c:655: warning: Function parameter or struct member 'map' not described in 'crush_choose_indep' net/ceph/crush/mapper.c:655: warning: Function parameter or struct member 'work' not described in 'crush_ch...
```diff diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 1daf95e17d67..6f305fb18524 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -636,9 +636,8 @@ reject: } -/** +/* * crush_choose_indep: alternative breadth-first positionally stable mapping - * */ static void crush...
a3da15389112a28633e4c340e4841faab29df3b7
Analyze and fix the following issue in the Linux kernel code: sparc64: Fix prototype warnings in hibernate.c
Problem Details: Fix the following warnings: arch/sparc/power/hibernate.c:22:5: warning: no previous prototype for ‘pfn_is_nosave’ arch/sparc/power/hibernate.c:30:6: warning: no previous prototype for ‘save_processor_state’ arch/sparc/power/hibernate.c:35:6: warning: no previous prototype for ‘restore_processor_state’ ...
```diff diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c index 47b06f4af1f9..da8e2bc2e516 100644 --- a/arch/sparc/power/hibernate.c +++ b/arch/sparc/power/hibernate.c @@ -5,6 +5,7 @@ * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru) */ +#include <linux/suspend.h> #include <linux/mm.h>...
a9f52913ac60e7fc14306e7149e6c4e81e771f92
Analyze and fix the following issue in the Linux kernel code: sparc64: Fix prototype warning for prom_get_mmu_ihandle
Problem Details: arch/sparc/prom/misc_64.c:165:5: warning: no previous prototype for ‘prom_get_mmu_ihandle’ The function prom_get_mmu_ihandle has no users outside of misc_64.c so declare it static. Link: https://lore.kernel.org/r/20240710094155.458731-4-andreas@gaisler.com Signed-off-by: Andreas Larsson <andreas@gais...
```diff diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index aed94cd4a1e7..3792736ff21f 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c @@ -162,7 +162,7 @@ unsigned char prom_get_idprom(char *idbuf, int num_bytes) return 0xff; } -int prom_get_mmu_ihandle(void) +static int...
a6c3ea1ec96307dbfbb2f16d96c674c5cc80f445
Analyze and fix the following issue in the Linux kernel code: sparc64: Fix incorrect function signature and add prototype for prom_cif_init
Problem Details: Remove the unused cif_stack argument and add a protype in oplib_64.h Commit ef3e035c3a9b ("sparc64: Fix register corruption in top-most kernel stack frame during boot.") removed the cif_stack argument to prom_cif init in the declaration at the caller site and the usage of it within prom_cif_init, but n...
```diff diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h index a67abebd4359..1b86d02a8455 100644 --- a/arch/sparc/include/asm/oplib_64.h +++ b/arch/sparc/include/asm/oplib_64.h @@ -247,6 +247,7 @@ void prom_sun4v_guest_soft_state(void); int prom_ihandle2path(int handle, char *buffer, ...
4c207db87d003c0dd1c59e41b355ab0a14f7a445
Analyze and fix the following issue in the Linux kernel code: sparc64: Fix prototype warnings for floppy_64.h
Problem Details: Fix the following warnings: arch/sparc/include/asm/floppy_64.h:200:13: warning: no previous prototype for ‘sparc_floppy_irq’ arch/sparc/include/asm/floppy_64.h:437:6: warning: no previous prototype for ‘sun_pci_fd_dma_callback’ Both sparc_floppy_irq and sun_pci_fd_dma_callback are only used within ar...
```diff diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h index 83decacd0a2d..b0f633ce3518 100644 --- a/arch/sparc/include/asm/floppy_64.h +++ b/arch/sparc/include/asm/floppy_64.h @@ -197,7 +197,7 @@ static void sun_fd_enable_dma(void) pdma_areasize = pdma_size; } -irqreturn_t sp...
a7ec177ebc447d541cf25171ba3f5c36e4acc206
Analyze and fix the following issue in the Linux kernel code: sparc32: Fix truncated relocation errors when linking large kernels
Problem Details: Use jumps instead of branches when jumping from one section to another to avoid branches to addresses further away than 22 bit offsets can handle that results in errors such as arch/sparc/kernel/signal_32.o:(.fixup+0x0): relocation truncated to fit: R_SPARC_WDISP22 against `.text' This is the same ap...
```diff diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index 9fd6c53644b6..43284b6ec46a 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h @@ -95,7 +95,8 @@ __asm__ __volatile__( \ ".section .fixup,#alloc,#execinstr\n\t" \ ".a...
26d289158e491d5ae34b10eab40b093a40fab7d7
Analyze and fix the following issue in the Linux kernel code: drm/xe: Drop trace_xe_hw_fence_free
Problem Details: fence->ctx may be stale memory when trace_xe_hw_fence_free is called resuling UAF bug when deriving the device name. This tracepoint is not all that useful, so just drop it. Fixes: 501c4255c409 ("drm/xe/trace: Print device_id in xe_trace events") Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: L...
```diff diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c index 35c0063a831a..45a9789cf501 100644 --- a/drivers/gpu/drm/xe/xe_hw_fence.c +++ b/drivers/gpu/drm/xe/xe_hw_fence.c @@ -187,7 +187,6 @@ static void xe_hw_fence_release(struct dma_fence *dma_fence) { struct xe_hw_fence *fence =...
63347fe031e3bd738a2a16aee8eba889376e49a8
Analyze and fix the following issue in the Linux kernel code: drm/xe/uapi: Rename xe perf layer as xe observation layer
Problem Details: In Xe, the perf layer allows capture of HW counter streams. These HW counters are generally performance related but don't have to be necessarily so. Also, the name "perf" is a carryover from i915 and is not preferred. Here we propose the name "observation" for this common layer which allows capture of...
```diff diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index b1e03bfe4a68..628c245c4822 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -96,10 +96,10 @@ xe-y += xe_bb.o \ xe_mocs.o \ xe_module.o \ xe_oa.o \ + xe_observation.o \ xe_pat.o \ xe_pci.o \ xe_p...
320d8dc612660da84c3b70a28658bb38069e5a9a
Analyze and fix the following issue in the Linux kernel code: btrfs: fix bitmap leak when loading free space cache on duplicate entry
Problem Details: If we failed to link a free space entry because there's already a conflicting entry for the same offset, we free the free space entry but we don't free the associated bitmap that we had just allocated before. Fix that by freeing the bitmap before freeing the entry. Reviewed-by: Johannes Thumshirn <joh...
```diff diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index c29c8ef9bd6a..3f9b7507543a 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -857,6 +857,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, spin_unlock(&ctl->tree_lock...
a39484371dd29ed9ba67bfd211e51d72b1a35c3d
Analyze and fix the following issue in the Linux kernel code: btrfs: remove the BUG_ON() inside extent_range_clear_dirty_for_io()
Problem Details: Previously we had a BUG_ON() inside extent_range_clear_dirty_for_io(), as we expected all involved folios to be still locked, thus no folio should be missing. However for extent_range_clear_dirty_for_io() itself, we can skip the missing folio and handle the remaining ones, and return an error if there...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0ebe96ca4eb2..8f38eefc8acd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -867,19 +867,24 @@ static inline void inode_should_defrag(struct btrfs_inode *inode, btrfs_add_inode_defrag(NULL, inode, small_write); } -static void extent_range_clear...
ca84529a842f3a15a5f17beac6252aa11955923f
Analyze and fix the following issue in the Linux kernel code: btrfs: fix data race when accessing the last_trans field of a root
Problem Details: KCSAN complains about a data race when accessing the last_trans field of a root: [ 199.553628] BUG: KCSAN: data-race in btrfs_record_root_in_trans [btrfs] / record_root_in_trans [btrfs] [ 199.555186] read to 0x000000008801e308 of 8 bytes by task 2812 on cpu 1: [ 199.555210] btrfs_record_roo...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e33f9f5a228d..451203055bbf 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -321,7 +321,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, WARN_ON(test_bit(BTRFS_ROOT_SHAREABLE, &root->state) && trans->transid != fs_info->running_transac...
240b129d597cb8a8880eb3a381ff10eb98ca0c07
Analyze and fix the following issue in the Linux kernel code: pwm: axi-pwmgen: add .max_register to regmap
Problem Details: This was missed in the basic driver and is useful for debug, so add it. Example regmap output before the patch: |root@zed-tg:~# cat /sys/kernel/debug/regmap/44a60000.pwm/registers |0: 00020100 And with it: |root@zed-tg:~# cat /sys/kernel/debug/regmap/44a60000.pwm/registers |00: 00020100 |04: 000000...
```diff diff --git a/drivers/pwm/pwm-axi-pwmgen.c b/drivers/pwm/pwm-axi-pwmgen.c index aac4f395497b..3ad60edf20a5 100644 --- a/drivers/pwm/pwm-axi-pwmgen.c +++ b/drivers/pwm/pwm-axi-pwmgen.c @@ -51,6 +51,7 @@ static const struct regmap_config axi_pwmgen_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits...
5fc070a9246d8d7d5dbccecf211085be43e0e8e5
Analyze and fix the following issue in the Linux kernel code: btrfs: tree-checker: add extra ram_bytes and disk_num_bytes check
Problem Details: This is to ensure non-compressed file extents (both regular and prealloc) should have matching ram_bytes and disk_num_bytes. This is only for CONFIG_BTRFS_DEBUG and CONFIG_BTRFS_ASSERT case, furthermore this will not return error, but just a kernel warning to inform developers. Reviewed-by: Filipe Ma...
```diff diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index 1e140f6dabc6..6388786fd8b5 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -340,6 +340,24 @@ static int check_extent_data_item(struct extent_buffer *leaf, } } + /* + * For non-compressed data extents, ram_bytes sh...
896c8b92dda6ca20c6a591db996039aa8931478b
Analyze and fix the following issue in the Linux kernel code: btrfs: fix the ram_bytes assignment for truncated ordered extents
Problem Details: [HICCUP] After adding extra checks on btrfs_file_extent_item::ram_bytes to tree-checker, running fsstress leads to tree-checker warning at write time, as we created file extent items with an invalid ram_bytes. All those offending file extents have offset 0, and ram_bytes matching num_bytes, and smalle...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 90f26b0464b8..a208ec47b6bd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2960,10 +2960,8 @@ static int insert_ordered_extent_file_extent(struct btrfs_trans_handle *trans, btrfs_set_stack_file_extent_disk_num_bytes(&stack_fi, oe->disk_...
0102ab54e497c8dc6f9d9588aca16500207fdfce
Analyze and fix the following issue in the Linux kernel code: btrfs: fix typo in error message in btrfs_validate_super()
Problem Details: There's a typo in an error message when checking the block group tree feature, it mentions fres-space-tree instead of free-space-tree. Fix that. Signed-off-by: Mark Harmstone <maharmstone@fb.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5870e76d20e2..0fd248292d28 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2452,7 +2452,7 @@ int btrfs_validate_super(const struct btrfs_fs_info *fs_info, (!btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE_VALID) || !btrfs_fs_incomp...
e2c1887329086148625fef5205719112ceb4a829
Analyze and fix the following issue in the Linux kernel code: btrfs: print-tree: add generation and type dump for EXTENT_DATA_KEY
Problem Details: When debugging the recent ram_bytes mismatch bug, I can hit it with enhanced tree-checker for file extent items at write time. But the bug is not that easy to trigger (mostly triggered with btrfs/06*, which uses 20 threads fsstress), and when I hit it, the only info is the kernel leaf dump, but it doe...
```diff diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index ffe89db24bec..453cd8358760 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c @@ -310,6 +310,9 @@ void btrfs_print_leaf(const struct extent_buffer *l) case BTRFS_EXTENT_DATA_KEY: fi = btrfs_item_ptr(l, i, struct btrfs_...
bb3868033a4cccff7be57e9145f2117cbdc91c11
Analyze and fix the following issue in the Linux kernel code: btrfs: do not BUG_ON() when freeing tree block after error
Problem Details: When freeing a tree block, at btrfs_free_tree_block(), if we fail to create a delayed reference we don't deal with the error and just do a BUG_ON(). The error most likely to happen is -ENOMEM, and we have a comment mentioning that only -ENOMEM can happen, but that is not true, because in case qgroups a...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 48aa14046343..a155dbc0bffa 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -620,10 +620,16 @@ int btrfs_force_cow_block(struct btrfs_trans_handle *trans, atomic_inc(&cow->refs); rcu_assign_pointer(root->node, cow); - btrfs_free_tree_block(t...
90df2c10a47eeed31efe62fb77ba61fef82956cb
Analyze and fix the following issue in the Linux kernel code: btrfs: subpage: remove the unused error bitmap dumping
Problem Details: Since commit 2b2553f12355 ("btrfs: stop setting PageError in the data I/O path") btrfs no longer utilizes subpage error bitmaps anymore, but the commit forgot to remove the error bitmap in btrfs_subpage_dump_bitmap(), resulting in possible meaningless result for the error bitmap. Fix it by just removi...
```diff diff --git a/fs/btrfs/subpage.c b/fs/btrfs/subpage.c index fc7db52e8f58..1a4717bcce23 100644 --- a/fs/btrfs/subpage.c +++ b/fs/btrfs/subpage.c @@ -909,7 +909,6 @@ void __cold btrfs_subpage_dump_bitmap(const struct btrfs_fs_info *fs_info, struct btrfs_subpage_info *subpage_info = fs_info->subpage_info; struc...
87128f520a6b7573f8086f2c89b9381ee7e85e51
Analyze and fix the following issue in the Linux kernel code: btrfs: uapi: record temporary super flags used by btrfstune
Problem Details: [BUG] There is a bug report that a canceled checksum conversion (still experimental feature) results in unexpected super block flags: csum_type 0 (crc32c) csum_size 4 csum 0x14973811 [match] bytenr 65536 flags 0x1000000001 ( WRITTEN | CHANGING_FSID_V2 ) magic _BHRfS_M [match] While ...
```diff diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h index d24e8e121507..c7636331e566 100644 --- a/include/uapi/linux/btrfs_tree.h +++ b/include/uapi/linux/btrfs_tree.h @@ -777,6 +777,14 @@ struct btrfs_stripe_extent { #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35) #define BTRFS...
ebc7c7678eb04b739544d9caaa0a4797adb24392
Analyze and fix the following issue in the Linux kernel code: btrfs: remove pointless code when creating and deleting a subvolume
Problem Details: When creating and deleting a subvolume, after starting a transaction we are explicitly calling btrfs_record_root_in_trans() for the root which we passed to btrfs_start_transaction(). This is pointless because at transaction.c:start_transaction() we end up doing that call, regardless of whether we actua...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index eb3c44ca765b..cc8db6b818bf 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4552,11 +4552,6 @@ int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry) ret = PTR_ERR(trans); goto out_release; } - ret = btrfs_record_root_in_...
8b62f14d990213de8fb3b15d7fab18816314aab3
Analyze and fix the following issue in the Linux kernel code: btrfs: update panic message when splitting ordered extent
Problem Details: During ordered extent splitting if we find a duplicated ordered extent when attempting to insert the new ordered extent we panic but with a message that has the "zoned:" prefix. This is because the splitting used to be exclusive for zoned filesystems, but as of commit b73a6fd1b1ef ("btrfs: split partia...
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index c98c8fdc14a1..a3343656e0a7 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -1305,7 +1305,7 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent( node = tree_insert(&inode->ordered_tree, new->file_offset, &new->rb_...
c27b1dbb713ad0d81f3bbd5ede92caaaedfd8947
Analyze and fix the following issue in the Linux kernel code: btrfs: do not directly include rwlock_types.h
Problem Details: There is already an error inside that header: #if !defined(__LINUX_SPINLOCK_TYPES_H) # error "Do not include directly, include spinlock_types.h" #endif Thankfully it never get triggered as some other headers have already included spinlock_types.h. However clangd would still do a proper warning on...
```diff diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h index d3d1e5b7528d..5154a8f1d26c 100644 --- a/fs/btrfs/extent_map.h +++ b/fs/btrfs/extent_map.h @@ -4,7 +4,7 @@ #define BTRFS_EXTENT_MAP_H #include <linux/compiler_types.h> -#include <linux/rwlock_types.h> +#include <linux/spinlock_types.h> #includ...
97713b1a2ced1e4a2a6c40045903797ebd44d7e0
Analyze and fix the following issue in the Linux kernel code: btrfs: do not clear page dirty inside extent_write_locked_range()
Problem Details: [BUG] For subpage + zoned case, the following workload can lead to rsv data leak at unmount time: # mkfs.btrfs -f -s 4k $dev # mount $dev $mnt # fsstress -w -n 8 -d $mnt -s 1709539240 0/0: fiemap - no filename 0/1: copyrange read - no filename 0/2: write - no filename 0/3: rename - no so...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index cc4c55c0733c..bf762b52b319 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2341,10 +2341,8 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page, page = find_get_page(mapping, cur >> PAGE_SHIFT); AS...
21b5bef20ef89795882f0b1bf5517fb283c16461
Analyze and fix the following issue in the Linux kernel code: btrfs: make __extent_writepage_io() to write specified range only
Problem Details: Function __extent_writepage_io() is designed to find all dirty ranges of a page, and add the dirty ranges to the bio_ctrl for submission. It requires all the dirtied ranges to be covered by an ordered extent. It gets called in two locations, but one call site is not subpage aware: - __extent_writepag...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 7ae1bd91f182..643243a0a010 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1339,20 +1339,23 @@ static void find_next_dirty_byte(struct btrfs_fs_info *fs_info, * < 0 if there were errors (page still locked) */ static noinline_fo...
95359f63223c432bd0ed1f1d9180a823f19f0712
Analyze and fix the following issue in the Linux kernel code: btrfs: add MODULE_DESCRIPTION()
Problem Details: Fix the 'make W=1' warning: WARNING: modpost: missing MODULE_DESCRIPTION() in fs/btrfs/btrfs.o Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 21d986e07500..70274a438049 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2581,6 +2581,7 @@ static int __init init_btrfs_fs(void) late_initcall(init_btrfs_fs); module_exit(exit_btrfs_fs) +MODULE_DESCRIPTION("B-Tree File System (BTRFS)"); MODU...
ced1b1bd214fab463f35438c63d9bc6b1a743cae
Analyze and fix the following issue in the Linux kernel code: btrfs: rename err to ret in btrfs_recover_relocation()
Problem Details: Fix coding style: rename the return variable to 'ret' in the function btrfs_recover_relocation instead of 'err'. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index db99d0f9f999..81836a38325a 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4221,7 +4221,7 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) struct reloc_control *rc = NULL; struct btrfs_trans_handle *trans; in...
ba69f42af2a568f30904a11dc257eb892c5e8c0e
Analyze and fix the following issue in the Linux kernel code: btrfs: rename ret to err in btrfs_recover_relocation()
Problem Details: In the function btrfs_recover_relocation(), currently the variable 'err' carries the return value and 'ret' holds the intermediary return value. However, in some lines, we don't need this two-step approach; we can directly use 'err'. So, optimize them, which requires reinitializing 'err' to zero at two...
```diff diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index bcb665613e78..e0cb67a62d89 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4233,17 +4233,16 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info) key.offset = (u64)-1; while (1) { - ret = btrfs_search_slot(NULL, ...
839d6ea4f86de1d2e36a1b02561b4ccd597643b9
Analyze and fix the following issue in the Linux kernel code: btrfs: automatically remove the subvolume qgroup
Problem Details: Currently if we fully clean a subvolume (not only delete its directory, but fully clean all it's related data and root item), the associated qgroup would not be removed. We have "btrfs qgroup clear-stale" to handle such 0 level qgroups. Change the behavior to automatically removie the qgroup of a ful...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3774c191e36d..32f03c0a7b9e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5833,6 +5833,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) struct btrfs_root_item *root_item = &root->root_i...
a776bf5f3c2300cfdf8a195663460b1793ac9847
Analyze and fix the following issue in the Linux kernel code: btrfs: slightly loosen the requirement for qgroup removal
Problem Details: [BUG] Currently if one is utilizing "qgroups/drop_subtree_threshold" sysfs, and a snapshot with level higher than that value is dropped, we will not be able to delete the qgroup until next qgroup rescan: uuid=ffffffff-eeee-dddd-cccc-000000000000 wipefs -fa $dev mkfs.btrfs -f $dev -O quota -s 4k...
```diff diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b23a1aac3953..57169f474e4c 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1748,13 +1748,55 @@ out: return ret; } -static bool qgroup_has_usage(struct btrfs_qgroup *qgroup) +/* + * Return 0 if we can not delete the qgroup (not empty or has...
5100c4eb527ebe175d3dbaeb0b8cc04f312183d7
Analyze and fix the following issue in the Linux kernel code: btrfs: remove unused define EXTENT_SIZE_PER_ITEM
Problem Details: This was added in c61a16a701a126 ("Btrfs: fix the confusion between delalloc bytes and metadata bytes") and removed in 03fe78cc2942c5 ("btrfs: use delalloc_bytes to determine flush amount for shrink_delalloc") where the calculation was reworked to use a non-constant numbers. This was found by 'make W=...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index ae8c56442549..293eb009188e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -605,8 +605,6 @@ static inline u64 calc_reclaim_items_nr(const struct btrfs_fs_info *fs_info, return nr; } -#define EXTENT_SIZE_PER_ITEM SZ_256K - /...
91629e6dea437c6e7f01431e423a90ed1bab5db3
Analyze and fix the following issue in the Linux kernel code: btrfs: rename macro local variables that clash with other variables
Problem Details: Fix variable names in two macros where there's a local function variable of the same name. In subpage_calc_start_bit() it's in several callers, in btrfs_abort_transaction() it's only in replace_file_extents(). Found by 'make W=2'. Reviewed-by: Boris Burkov <boris@bur.io> Reviewed-by: Anand Jain <anan...
```diff diff --git a/fs/btrfs/subpage.c b/fs/btrfs/subpage.c index 54736f6238e6..86468305cd73 100644 --- a/fs/btrfs/subpage.c +++ b/fs/btrfs/subpage.c @@ -242,12 +242,12 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info, #define subpage_calc_start_bit(fs_info, folio, name, start, len) \ ({ ...
70559abf6241c9ffe23e526a66960ac76d258e0e
Analyze and fix the following issue in the Linux kernel code: btrfs: drop bytenr_orig and fix comment in btrfs_scan_one_device()
Problem Details: Drop the single-use variable bytenr_orig and instead use btrfs_sb_offset() in the function argument passing. Fix a stale comment about not automatically fixing a bad primary superblock from the backup mirror copies. Also, move the comment closer to where the primary superblock read occurs. Signed-off...
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c22178b9a51f..d67acd3882b9 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1380,19 +1380,12 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, blk_mode_t flags, bool new_device_added = false; struct btrfs_device *device = N...
e2844cce75c9e61a27dcc29f0773afe970cde296
Analyze and fix the following issue in the Linux kernel code: btrfs: remove inode_lock from struct btrfs_root and use xarray locks
Problem Details: Currently we use the spinlock inode_lock from struct btrfs_root to serialize access to two different data structures: 1) The delayed inodes xarray (struct btrfs_root::delayed_nodes); 2) The inodes xarray (struct btrfs_root::inodes). Instead of using our own lock, we can use the spinlock that is part ...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index aa2568f86dc9..1004cb934b4a 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -221,7 +221,6 @@ struct btrfs_root { struct list_head root_list; - spinlock_t inode_lock; /* * Xarray that keeps track of in-memory inodes, protected by the lock ...
3441b070f82b721473547cba9e4cd7914006b67c
Analyze and fix the following issue in the Linux kernel code: btrfs: fix function name in comment for btrfs_remove_ordered_extent()
Problem Details: Due to a refactoring introduced by commit 53d9981ca20e ("btrfs: split btrfs_alloc_ordered_extent to allocation and insertion helpers"), the function btrfs_alloc_ordered_extent() was renamed to alloc_ordered_extent(), so the comment at btrfs_remove_ordered_extent() is no longer very accurate. Update the...
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 35a413ce935d..7d175d10a6d0 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -626,7 +626,7 @@ void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode, freespace_inode = btrfs_is_free_space_inode(btrfs_inode); ...
416d6ab49d43570a52484677a864bda52e27db6c
Analyze and fix the following issue in the Linux kernel code: btrfs: fix misspelled end IO compression callbacks
Problem Details: Fix typo in the end IO compression callbacks, from "comprssed" to "compressed". Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 6441e47d8a5e..7b4843df0752 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -261,7 +261,7 @@ void btrfs_free_compr_folio(struct folio *folio) folio_put(folio); } -static void end_bbio_comprssed_read(struct btrfs_bio *bbio...
f2005ced20eedbfe4d6f2313088936994f13b7ca
Analyze and fix the following issue in the Linux kernel code: i2c: viperboard: reword according to newest specification
Problem Details: Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2 specifications and replace "master/slave" with more appropriate terms. Remove a superfluous debug output which is already available via tracing. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Andi Shyti...
```diff diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index 3784b07f5371..2ed4130c0339 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Nano River Technologies viperb...
664e69d2e511b3fef2b856916f942c626d0314ed
Analyze and fix the following issue in the Linux kernel code: i2c: tiny-usb: reword according to newest specification
Problem Details: Change the wording of this driver wrt. the newest I2C v7 and SMBus 3.2 specifications and replace "master/slave" with more appropriate terms. Remove a superfluous debug output which is already available via tracing. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Andi Shyti...
```diff diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c index 1bffe36c40ad..0f2ed181b266 100644 --- a/drivers/i2c/busses/i2c-tiny-usb.c +++ b/drivers/i2c/busses/i2c-tiny-usb.c @@ -54,8 +54,6 @@ static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) struct i2...
87e552ad654554be73e62dd43c923bcee215287d
Analyze and fix the following issue in the Linux kernel code: leds: flash: leds-qcom-flash: Test the correct variable in init
Problem Details: This code was passing the incorrect pointer to PTR_ERR_OR_ZERO() so it always returned success. It should have been checking the array element instead of the array itself. Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs") Signed-off-by: Dan Carpenter <dan.carpe...
```diff diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index 7c99a3039171..bf70bf6fb0d5 100644 --- a/drivers/leds/flash/leds-qcom-flash.c +++ b/drivers/leds/flash/leds-qcom-flash.c @@ -505,6 +505,7 @@ qcom_flash_v4l2_init(struct device *dev, struct qcom_flash_led *led, struct f...
833cd3e9ad8360785b6c23c82dd3856df00732d9
Analyze and fix the following issue in the Linux kernel code: drm/fb-helper: Don't schedule_work() to flush frame buffer during panic()
Problem Details: Sometimes the system [1] hangs on x86 I/O machine checks. However, the expected behavior is to reboot the system, as the machine check handler ultimately triggers a panic(), initiating a reboot in the last step. The root cause is that sometimes the panic() is blocked when drm_fb_helper_damage() invoki...
```diff diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 117237d3528b..618b04523033 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -631,6 +631,17 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, u static void dr...
bbddfa2255dd0800209697fd12378e02ed05f833
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix mbx timing out before CMD execution is completed
Problem Details: When a large number of tasks are issued, the speed of HW processing mbx will slow down. The standard for judging mbx timeout in the current firmware is 30ms, and the current timeout standard for the driver is also 30ms. Considering that firmware scheduling in multi-function scenarios takes a certain a...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index aecd137c1e60..621b057fb9da 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -1275,12 +1275,38 @@ static int hns_roce_cmd_err_convert_errno(u16 des...
0b8e658f70ffd5dc7cda3872fd524d657d4796b7
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix insufficient extend DB for VFs.
Problem Details: VFs and its PF will share the memory of the extend DB. Currently, the number of extend DB allocated by driver is only enough for PF. This leads to a probability of DB loss and some other problems in scenarios where both PF and VFs use a large number of QPs. Fixes: 6b63597d3540 ("RDMA/hns: Add TSQ link...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index cbbc142afc1b..aecd137c1e60 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -2463,14 +2463,16 @@ static int set_llm_cfg_to_hw(struct hns_roce_dev ...
36397b907355e2fdb5a25a02a7921a937fd8ef4c
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix undifined behavior caused by invalid max_sge
Problem Details: If max_sge has been set to 0, roundup_pow_of_two() in set_srq_basic_param() may have undefined behavior. Fixes: 9dd052474a26 ("RDMA/hns: Allocate one more recv SGE for HIP08") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: ht...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index f1997abc97ca..c9b8233f4b05 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c @@ -297,7 +297,7 @@ static int set_srq_basic_param(struct hns_roce_srq *srq, ...
24c6291346d98c7ece4f4bfeb5733bec1d6c7b4f
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix shift-out-bounds when max_inline_data is 0
Problem Details: A shift-out-bounds may occur, if the max_inline_data has not been set. The related log: UBSAN: shift-out-of-bounds in kernel/include/linux/log2.h:57:13 shift exponent 64 is too large for 64-bit type 'long unsigned int' Call trace: dump_backtrace+0xb0/0x118 show_stack+0x20/0x38 dump_stack_lvl+0xbc/0...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index db34665d1dfb..1de384ce4d0e 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -532,13 +532,15 @@ static unsigned int get_sge_num_from_max_inl_data(bool is_ud_or...
d387d4b54eb84208bd4ca13572e106851d0a0819
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix missing pagesize and alignment check in FRMR
Problem Details: The offset requires 128B alignment and the page size ranges from 4K to 128M. Fixes: 68a997c5d28c ("RDMA/hns: Add FRMR support for hip08") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240710133705...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index 3cc5a4ff404a..0b1e21cb6d2d 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -83,6 +83,7 @@ #define MR_TYPE_DMA 0x03 #define HNS_ROCE_FR...
543fb987bd63ed27409b5dea3d3eec27b9c1eac9
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix unmatch exception handling when init eq table fails
Problem Details: The hw ctx should be destroyed when init eq table fails. Fixes: a5073d6054f7 ("RDMA/hns: Add eq support of hip08") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240710133705.896445-4-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel....
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 2f16554c96be..cbbc142afc1b 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -6368,9 +6368,16 @@ static void hns_roce_v2_int_mask_enable(struct hns...
2fdf34038369c0a27811e7b4680662a14ada1d6b
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Fix soft lockup under heavy CEQE load
Problem Details: CEQEs are handled in interrupt handler currently. This may cause the CPU core staying in interrupt context too long and lead to soft lockup under heavy load. Handle CEQEs in BH workqueue and set an upper limit for the number of CEQE handled by a single call of work handler. Fixes: a5073d6054f7 ("RDMA...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index bf7f966c89fc..3cc5a4ff404a 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -717,6 +717,7 @@ struct hns_roce_eq { int shift; int eve...
6afa2c0bfb8ef69f65715ae059e5bd5f9bbaf03b
Analyze and fix the following issue in the Linux kernel code: RDMA/hns: Check atomic wr length
Problem Details: 8 bytes is the only supported length of atomic. Add this check in set_rc_wqe(). Besides, stop processing WQEs and return from set_rc_wqe() if there is any error. Fixes: 384f88185112 ("RDMA/hns: Add atomic support") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.or...
```diff diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index ef50cd03f489..bf7f966c89fc 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -91,6 +91,8 @@ /* Configure to HW for PAGE_SIZE larger than 4KB *...
b851268018f0d63cb2069b5589bf4dbee1c74287
Analyze and fix the following issue in the Linux kernel code: RDMA/ocrdma: Don't inline statistics functions
Problem Details: Fix the problem of KASAN causing the stack frame size to increase drivers/infiniband/hw/ocrdma/ocrdma_stats.c:686:16: error: stack frame size (20664) exceeds limit (8192) in 'ocrdma_dbgfs_ops_read' [-Werror,-Wframe-larger-than] static ssize_t ocrdma_dbgfs_ops_read(struct file *filp, char __user *buffe...
```diff diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c index 5f831e3bdbad..0834416cb3f8 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c @@ -46,7 +46,7 @@ static struct dentry *ocrdma_dbgfs_dir; -stati...
626dfed5fa3bfb41e0dffd796032b555b69f9cde
Analyze and fix the following issue in the Linux kernel code: net, sunrpc: Remap EPERM in case of connection failure in xs_tcp_setup_socket
Problem Details: When using a BPF program on kernel_connect(), the call can return -EPERM. This causes xs_tcp_setup_socket() to loop forever, filling up the syslog and causing the kernel to potentially freeze up. Neil suggested: This will propagate -EPERM up into other layers which might not be ready to handle it...
```diff diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index dfc353eea8ed..0e1691316f42 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2441,6 +2441,13 @@ static void xs_tcp_setup_socket(struct work_struct *work) transport->srcport = 0; status = -EAGAIN; break; + case -EPERM: + ...
26488172b0292bed837b95a006a3f3431d1898c3
Analyze and fix the following issue in the Linux kernel code: net/sched: Fix UAF when resolving a clash
Problem Details: KASAN reports the following UAF: BUG: KASAN: slab-use-after-free in tcf_ct_flow_table_process_conn+0x12b/0x380 [act_ct] Read of size 1 at addr ffff888c07603600 by task handler130/6469 Call Trace: <IRQ> dump_stack_lvl+0x48/0x70 print_address_description.constprop.0+0x33/0x3d0 print_report+0...
```diff diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 2a96d9c1db65..6fa3cca87d34 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1077,6 +1077,14 @@ do_nat: */ if (nf_conntrack_confirm(skb) != NF_ACCEPT) goto drop; + + /* The ct may be dropped if a clash has been resolved, + * so ...
8b5ea9029b03efda74292c57e0377a98ed0b7434
Analyze and fix the following issue in the Linux kernel code: fbdev: viafb: Make I2C terminology more inclusive
Problem Details: I2C v7, SMBus 3.2, and I3C 1.1.1 specifications have replaced "master/slave" with more appropriate terms. Inspired by Wolfram's series to fix drivers/i2c/, fix the terminology for users of I2C_ALGOBIT bitbanging interface, now that the approved verbiage exists in the specification. Acked-by: Thomas Zi...
```diff diff --git a/drivers/video/fbdev/via/chip.h b/drivers/video/fbdev/via/chip.h index f0a19cbcb9e5..f81af13630e2 100644 --- a/drivers/video/fbdev/via/chip.h +++ b/drivers/video/fbdev/via/chip.h @@ -69,7 +69,7 @@ #define VT1632_TMDS 0x01 #define INTEGRATED_TMDS 0x42 -/* Definition TM...
3cf12cabc3be2855466e1433d943455b1032fd86
Analyze and fix the following issue in the Linux kernel code: fbdev: smscufx: Make I2C terminology more inclusive
Problem Details: I2C v7, SMBus 3.2, and I3C 1.1.1 specifications have replaced "master/slave" with more appropriate terms. Inspired by Wolfram's series to fix drivers/i2c/, fix the terminology for users of I2C_ALGOBIT bitbanging interface, now that the approved verbiage exists in the specification. Acked-by: Thomas Zi...
```diff diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c index 35d682b110c4..5f0dd01fd834 100644 --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -1292,7 +1292,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) return 0; } -/* set...