id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
dc10cf1368af8cb816dcaa2502ba7d44fff20612
Analyze and fix the following issue in the Linux kernel code: smb: client: relax WARN_ON_ONCE(SMBDIRECT_SOCKET_*) checks in recv_done() and smbd_conn_upcall()
Problem Details: sc->first_error might already be set and sc->status is thus unexpected, so this should avoid the WARN[_ON]_ONCE() if sc->first_error is already set and have a usable error path. While there set sc->first_error as soon as possible. This is done based on a problem seen in similar places on the server. ...
```diff diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index c6c428c2e08d..788a0670c4a8 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -7,6 +7,7 @@ #include <linux/module.h> #include <linux/highmem.h> #include <linux/folio_queue.h> +#define __SMBDIRECT_SOCKET_DISCONNECT...
425c32750b48956a6e156b6a4609d281ee471359
Analyze and fix the following issue in the Linux kernel code: smb: server: relax WARN_ON_ONCE(SMBDIRECT_SOCKET_*) checks in recv_done() and smb_direct_cm_handler()
Problem Details: Namjae reported the following: I have a simple file copy test with windows 11 client, and get the following error message. [ 894.140312] ------------[ cut here ]------------ [ 894.140316] WARNING: CPU: 1 PID: 116 at fs/smb/server/transport_rdma.c:642 recv_done+0x308/0x360 [ksmbd] [ 894.140335] Mod...
```diff diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c index e2be9a496154..4e7ab8d9314f 100644 --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -19,6 +19,8 @@ #include <rdma/rdma_cm.h> #include <rdma/rw.h> +#define __SMBDIRECT_SOCKET_DISCONNECT(__sc) smb_dir...
1f3fd108c5c5a9885c6c276a2489c49b60a6b90d
Analyze and fix the following issue in the Linux kernel code: smb: smbdirect: introduce SMBDIRECT_DEBUG_ERR_PTR() helper
Problem Details: This can be used like this: int err = somefunc(); pr_warn("err=%1pe\n", SMBDIRECT_DEBUG_ERR_PTR(err)); This will be used in the following fixes in order to be prepared to identify real world problems more easily. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <...
```diff diff --git a/fs/smb/common/smbdirect/smbdirect_socket.h b/fs/smb/common/smbdirect/smbdirect_socket.h index ee5a90d691c8..611986827a5e 100644 --- a/fs/smb/common/smbdirect/smbdirect_socket.h +++ b/fs/smb/common/smbdirect/smbdirect_socket.h @@ -74,6 +74,19 @@ const char *smbdirect_socket_status_string(enum smbdir...
991f8a79db99b14c48d20d2052c82d65b9186cad
Analyze and fix the following issue in the Linux kernel code: ksmbd: vfs: fix race on m_flags in vfs_cache
Problem Details: ksmbd maintains delete-on-close and pending-delete state in ksmbd_inode->m_flags. In vfs_cache.c this field is accessed under inconsistent locking: some paths read and modify m_flags under ci->m_lock while others do so without taking the lock at all. Examples: - ksmbd_query_inode_status() and __ksmb...
```diff diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c index dfed6fce8904..6ef116585af6 100644 --- a/fs/smb/server/vfs_cache.c +++ b/fs/smb/server/vfs_cache.c @@ -112,40 +112,62 @@ int ksmbd_query_inode_status(struct dentry *dentry) read_lock(&inode_hash_lock); ci = __ksmbd_inode_lookup(dentry...
dc81b8f4f0fc9e1be0c9ce8a918503e175b2c9b2
Analyze and fix the following issue in the Linux kernel code: ksmbd: Replace strcpy + strcat to improve convert_to_nt_pathname
Problem Details: strcpy() is deprecated [1] and using strcat() is discouraged. Replace them by assigning the prefix directly and by using memcpy() to copy the pathname. Using memcpy() is safe because we already know the length of the source string and that it is guaranteed to be NUL-terminated. Allocate only as many b...
```diff diff --git a/fs/smb/server/misc.c b/fs/smb/server/misc.c index cb2a11ffb23f..a543ec9d3581 100644 --- a/fs/smb/server/misc.c +++ b/fs/smb/server/misc.c @@ -164,6 +164,8 @@ char *convert_to_nt_pathname(struct ksmbd_share_config *share, { char *pathname, *ab_pathname, *nt_pathname; int share_path_len = share-...
b39a1833cc4a2755b02603eec3a71a85e9dff926
Analyze and fix the following issue in the Linux kernel code: ksmbd: fix use-after-free in ksmbd_tree_connect_put under concurrency
Problem Details: Under high concurrency, A tree-connection object (tcon) is freed on a disconnect path while another path still holds a reference and later executes *_put()/write on it. Reported-by: Qianchang Zhao <pioooooooooip@gmail.com> Reported-by: Zhitong Liu <liuzhitong1993@gmail.com> Signed-off-by: Namjae Jeon ...
```diff diff --git a/fs/smb/server/mgmt/tree_connect.c b/fs/smb/server/mgmt/tree_connect.c index ecfc57508671..d3483d9c757c 100644 --- a/fs/smb/server/mgmt/tree_connect.c +++ b/fs/smb/server/mgmt/tree_connect.c @@ -78,7 +78,6 @@ ksmbd_tree_conn_connect(struct ksmbd_work *work, const char *share_name) tree_conn->t_sta...
4a7f9607803203fe637c12b4ffce9973d85ee169
Analyze and fix the following issue in the Linux kernel code: smb/client: fix CAP_BULK_TRANSFER value
Problem Details: See MS-CIFS 2.2.4.52.2. Keep it consistent with the value in the documentation. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
```diff diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h index c86a329e5822..aba9caee8302 100644 --- a/fs/smb/client/cifspdu.h +++ b/fs/smb/client/cifspdu.h @@ -711,7 +711,12 @@ struct ntlmv2_resp { #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" -/* Capabilities bits (for NTLM SessSetup reque...
a3c4445fdbbb83aa94ea1778717ef57006164814
Analyze and fix the following issue in the Linux kernel code: smb/server: fix return value of smb2_oplock_break()
Problem Details: smb2_oplock_break() should return error code when an error occurs, __process_request() will print the error messages. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
```diff diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 2e6f3d96d3e6..98d7f7259fe3 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -8748,7 +8748,7 @@ err_out: * smb2_oplock_break() - dispatcher for smb2.0 and 2.1 oplock/lease break * @work: smb work containing oplock/lease...
269df046c1e15ab34fa26fd90db9381f022a0963
Analyze and fix the following issue in the Linux kernel code: smb/server: fix return value of smb2_ioctl()
Problem Details: __process_request() will not print error messages if smb2_ioctl() always returns 0. Fix this by returning the correct value at the end of function. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
```diff diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index a3b7b648227a..2e6f3d96d3e6 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -8154,7 +8154,7 @@ int smb2_ioctl(struct ksmbd_work *work) id = req->VolatileFileId; if (req->Flags != cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL)) ...
dafe22bc676d4fcb1ccb193c8cc3dda57942509d
Analyze and fix the following issue in the Linux kernel code: smb/server: fix return value of smb2_query_dir()
Problem Details: __process_request() will not print error messages if smb2_query_dir() always returns 0. Fix this by returning the correct value at the end of function. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.c...
```diff diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index d676558f7bb6..a3b7b648227a 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -4550,7 +4550,7 @@ err_out2: smb2_set_err_rsp(work); ksmbd_fd_put(work, dir_fp); ksmbd_revert_fsids(work); - return 0; + return rc; } /*...
d1a30b9ddc3d4c0e38666bd166d51863cb39f1c4
Analyze and fix the following issue in the Linux kernel code: smb/server: fix return value of smb2_notify()
Problem Details: smb2_notify() should return error code when an error occurs, __process_request() will print the error messages. I may implement the SMB2 CHANGE_NOTIFY response (see MS-SMB2 2.2.36) in the future. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signe...
```diff diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 6a482e4c1d62..d676558f7bb6 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -8777,7 +8777,7 @@ int smb2_oplock_break(struct ksmbd_work *work) * smb2_notify() - handler for smb2 notify request * @work: smb work contai...
c5b462e35373a68a5a7954f5e00383998cc7fe92
Analyze and fix the following issue in the Linux kernel code: smb/server: fix return value of smb2_read()
Problem Details: STATUS_END_OF_FILE maps to the linux error -ENODATA. Perhaps in the future we can move client/smb2maperror.c into common/ and then call map_smb2_to_linux_error() to get the linux error. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: S...
```diff diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 17ce41fb9995..6a482e4c1d62 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -6832,7 +6832,7 @@ int smb2_read(struct ksmbd_work *work) rsp->hdr.Status = STATUS_END_OF_FILE; smb2_set_err_rsp(work); ksmbd_fd_put(work...
205dd7a5d6ad6f4c8e8fcd3c3b95a7c0e7067fee
Analyze and fix the following issue in the Linux kernel code: virtio_pci: drop kernel.h
Problem Details: virtio UAPI headers really have no business pulling in kernel.h Replace it with const.h which seems to be what's needed for __KERNEL_DIV_ROUND_UP. Fixes: 7c1ae151e812 ("virtio_pci: Introduce device parts access commands") Cc: Yishai Hadas <yishaih@nvidia.com> Cc: Alex Williamson <alex.williamson@redha...
```diff diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index c691ac210ce2..e732e3456e27 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -40,7 +40,7 @@ #define _LINUX_VIRTIO_PCI_H #include <linux/types.h> -#include <linux/kernel.h> +#include <linu...
b276445e98fe28609688fb85b89a81b803910e63
Analyze and fix the following issue in the Linux kernel code: clk: keystone: fix compile testing
Problem Details: Some keystone clock drivers can be selected when COMPILE_TEST is enabled but since commit b745c0794e2f ("clk: keystone: Add sci-clk driver support") they are never actually built. Enable compile testing by allowing the build system to process the keystone drivers. Fixes: b745c0794e2f ("clk: keystone:...
```diff diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index b74a1767ca27..61ec08404442 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -125,8 +125,7 @@ obj-$(CONFIG_ARCH_HISI) += hisilicon/ obj-y += imgtec/ obj-y += imx/ obj-y += ingenic/ -obj-$(CONFIG_ARCH_K3) += keystone/...
9c75986a298f121ed2c6599b05e51d9a34e77068
Analyze and fix the following issue in the Linux kernel code: clk: keystone: syscon-clk: fix regmap leak on probe failure
Problem Details: The mmio regmap allocated during probe is never freed. Switch to using the device managed allocator so that the regmap is released on probe failures (e.g. probe deferral) and on driver unbind. Fixes: a250cd4c1901 ("clk: keystone: syscon-clk: Do not use syscon helper to build regmap") Cc: stable@vger....
```diff diff --git a/drivers/clk/keystone/syscon-clk.c b/drivers/clk/keystone/syscon-clk.c index c509929da854..ecf180a7949c 100644 --- a/drivers/clk/keystone/syscon-clk.c +++ b/drivers/clk/keystone/syscon-clk.c @@ -129,7 +129,7 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) if (IS_ERR(base)) ...
1413717ad0c6d3887192b0119ad6420dbf0c26ae
Analyze and fix the following issue in the Linux kernel code: clk: qcom: Mark camcc_sm7150_hws static
Problem Details: This isn't used outside this file. Mark it static. Fixes: 9f0532da4226 ("clk: qcom: Add Camera Clock Controller driver for SM7150") Signed-off-by: Stephen Boyd <sboyd@kernel.org>
```diff diff --git a/drivers/clk/qcom/camcc-sm7150.c b/drivers/clk/qcom/camcc-sm7150.c index 8b06af8d1509..ee963ed341c3 100644 --- a/drivers/clk/qcom/camcc-sm7150.c +++ b/drivers/clk/qcom/camcc-sm7150.c @@ -1895,7 +1895,7 @@ static struct gdsc camcc_titan_top_gdsc = { .pwrsts = PWRSTS_OFF_ON, }; -struct clk_hw *ca...
cf33f0b7df13685234ccea7be7bfe316b60db4db
Analyze and fix the following issue in the Linux kernel code: clk: samsung: exynos-clkout: Assign .num before accessing .hws
Problem Details: Commit f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' with __counted_by, which informs the bounds sanitizer (UBSAN_BOUNDS) about the number of elements in .hws[], so that it can warn when .hws[] is accessed out of bou...
```diff diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 5f1a4f5e2e59..5b21025338bd 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -175,6 +175,7 @@ static int exynos_clkout_probe(struct platform_device *pdev) cl...
a913d1f6a7f607c110aeef8b58c8988f47a4b24e
Analyze and fix the following issue in the Linux kernel code: md/raid5: fix IO hang when array is broken with IO inflight
Problem Details: Following test can cause IO hang: mdadm -CvR /dev/md0 -l10 -n4 /dev/sd[abcd] --assume-clean --chunk=64K --bitmap=none sleep 5 echo 1 > /sys/block/sda/device/delete echo 1 > /sys/block/sdb/device/delete echo 1 > /sys/block/sdc/device/delete echo 1 > /sys/block/sdd/device/delete dd if=/dev/md0 of=/dev/...
```diff diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index cdbc7eba5c54..e57ce3295292 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -4956,7 +4956,8 @@ static void handle_stripe(struct stripe_head *sh) goto finish; if (s.handle_bad_blocks || - test_bit(MD_SB_CHANGE_PENDING, &conf->mddev-...
46f21952c492243b138281dc4cb755ab63b637c4
Analyze and fix the following issue in the Linux kernel code: md/raid0: fix NULL pointer dereference in create_strip_zones() for dm-raid
Problem Details: Commit 2107457e31fa ("md/raid0: Move queue limit setup before r0conf initialization") dereference mddev->gendisk unconditionally, which is NULL for dm-raid. Fix this problem by reverting to old codes for dm-raid. Link: https://lore.kernel.org/linux-raid/20251116021816.107648-1-yukuai@fnnas.com Fixes:...
```diff diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 47aee1b1d4d1..985c377356eb 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -68,7 +68,10 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) struct strip_zone *zone; int cnt; struct r0conf *conf = kzalloc...
a2a8fc27dd668e7562b5326b5ed2f1604cb1e2e9
Analyze and fix the following issue in the Linux kernel code: NFS: Fix up the automount fs_context to use the correct cred
Problem Details: When automounting, the fs_context should be fixed up to use the cred from the parent filesystem, since the operation is just extending the namespace. Authorisation to enter that namespace will already have been provided by the preceding lookup. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspa...
```diff diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 9e4d94f41fc6..af9be0c5f516 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -170,6 +170,11 @@ struct vfsmount *nfs_d_automount(struct path *path) if (!ctx->clone_data.fattr) goto out_fc; + if (fc->cred != server->cred) { + put_cred(fc...
2b092175f5e301cdaa935093edfef2be9defb6df
Analyze and fix the following issue in the Linux kernel code: NFS: Fix inheritance of the block sizes when automounting
Problem Details: Only inherit the block sizes that were actually specified as mount parameters for the parent mount. Fixes: 62a55d088cd8 ("NFS: Additional refactoring for fs_context conversion") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
```diff diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 54699299d5b1..2aaea9c98c2c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -784,10 +784,18 @@ static int nfs_init_server(struct nfs_server *server, server->fattr_valid = NFS_ATTR_FATTR_V4; } - if (ctx->rsize) + if (ctx->bsize) { + server->bsize ...
8675c69816e4276b979ff475ee5fac4688f80125
Analyze and fix the following issue in the Linux kernel code: NFS: Automounted filesystems should inherit ro,noexec,nodev,sync flags
Problem Details: When a filesystem is being automounted, it needs to preserve the user-set superblock mount options, such as the "ro" flag. Reported-by: Li Lingfeng <lilingfeng3@huawei.com> Link: https://lore.kernel.org/all/20240604112636.236517-3-lilingfeng@huaweicloud.com/ Fixes: f2aedb713c28 ("NFS: Add fs_context s...
```diff diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 5a4d193da1a9..dca055676c4f 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -149,6 +149,7 @@ struct vfsmount *nfs_d_automount(struct path *path) struct vfsmount *mnt = ERR_PTR(-ENOMEM); struct nfs_server *server = NFS_SB(path->dentry->d_s...
d4a26d34f1946142f9d32e540490e4926ae9a46b
Analyze and fix the following issue in the Linux kernel code: Revert "nfs: ignore SB_RDONLY when mounting nfs"
Problem Details: This reverts commit 52cb7f8f177878b4f22397b9c4d2c8f743766be3. Silently ignoring the "ro" and "rw" mount options causes user confusion, and regressions. Reported-by: Alkis Georgopoulos<alkisg@gmail.com> Cc: Li Lingfeng <lilingfeng3@huawei.com> Fixes: 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting ...
```diff diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 2ecd38e1d17a..ffd382aa31ac 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -13,7 +13,7 @@ #include <linux/nfslocalio.h> #include <linux/wait_bit.h> -#define NFS_SB_MASK (SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS) +#define NFS_SB_MASK (SB_R...
d216b698d44e33417ad4cc796cb04ccddbb8c0ee
Analyze and fix the following issue in the Linux kernel code: Revert "nfs: clear SB_RDONLY before getting superblock"
Problem Details: This reverts commit 8cd9b785943c57a136536250da80ba1eb6f8eb18. Silently ignoring the "ro" and "rw" mount options causes user confusion, and regressions. Reported-by: Alkis Georgopoulos<alkisg@gmail.com> Cc: Li Lingfeng <lilingfeng3@huawei.com> Fixes: 8cd9b785943c ("nfs: clear SB_RDONLY before getting ...
```diff diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 527000f5d150..9b9464e70a7f 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1308,17 +1308,8 @@ int nfs_get_tree_common(struct fs_context *fc) if (IS_ERR(server)) return PTR_ERR(server); - /* - * When NFS_MOUNT_UNSHARED is not set, NFS forces the sha...
400fa37afbb11a601c204b72af0f0e5bc2db695c
Analyze and fix the following issue in the Linux kernel code: Revert "nfs: ignore SB_RDONLY when remounting nfs"
Problem Details: This reverts commit 80c4de6ab44c14e910117a02f2f8241ffc6ec54a. Silently ignoring the "ro" and "rw" mount options causes user confusion, and regressions. Reported-by: Alkis Georgopoulos<alkisg@gmail.com> Cc: Li Lingfeng <lilingfeng3@huawei.com> Fixes: 80c4de6ab44c ("nfs: ignore SB_RDONLY when remountin...
```diff diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 72dee6f3050e..527000f5d150 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1051,16 +1051,6 @@ int nfs_reconfigure(struct fs_context *fc) sync_filesystem(sb); - /* - * The SB_RDONLY flag has been removed from the superblock during - * mounts to prev...
7e81fa8d809ed1e67ae9ecd52d20a20c2c65d877
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom_q6v5_wcss: fix parsing of qcom,halt-regs
Problem Details: The "qcom,halt-regs" consists of a phandle reference followed by the three offsets within syscon for halt registers. Thus, we need to request 4 integers from of_property_read_variable_u32_array(), with the halt_reg ofsets at indexes 1, 2, and 3. Offset 0 is the phandle. With MAX_HALT_REG at 3, of_prop...
```diff diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c index d96af0e0f665..83fe5b9a0240 100644 --- a/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c @@ -85,7 +85,7 @@ #define TCSR_WCSS_CLK_MASK 0x1F #define TCSR_WCSS_CLK_ENABLE 0x14 -#define MAX_...
62cd5d480b9762ce70d720a81fa5b373052ae05f
Analyze and fix the following issue in the Linux kernel code: KEYS: trusted: Fix a memory leak in tpm2_load_cmd
Problem Details: 'tpm2_load_cmd' allocates a tempoary blob indirectly via 'tpm2_key_decode' but it is not freed in the failure paths. Address this by wrapping the blob into with a cleanup helper. Cc: stable@vger.kernel.org # v5.13+ Fixes: f2219745250f ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs"...
```diff diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c index edd7b9d7e4dc..91656e44b326 100644 --- a/security/keys/trusted-keys/trusted_tpm2.c +++ b/security/keys/trusted-keys/trusted_tpm2.c @@ -372,6 +372,7 @@ static int tpm2_load_cmd(struct tpm_chip *chip, stru...
6ac3484fb13b2fc7f31cfc7f56093e7d0ce646a5
Analyze and fix the following issue in the Linux kernel code: scsi: ipr: Enable/disable IRQD_NO_BALANCING during reset
Problem Details: A dynamic remove/add storage adapter test hits EEH on PowerPC: EEH: [c00000000004f75c] __eeh_send_failure_event+0x7c/0x160 EEH: [c000000000048444] eeh_dev_check_failure.part.0+0x254/0x650 EEH: [c008000001650678] eeh_readl+0x60/0x90 [ipr] EEH: [c00800000166746c] ipr_cancel_op+0x2b8/0x524 [ipr] ...
```diff diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 44214884deaf..d62bb7d0e416 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -61,8 +61,8 @@ #include <linux/hdreg.h> #include <linux/reboot.h> #include <linux/stringify.h> +#include <linux/irq.h> #include <asm/io.h> -#include <asm/irq.h> ...
ab58153ec64fa3fc9aea09ca09dc9322e0b54a7c
Analyze and fix the following issue in the Linux kernel code: scsi: imm: Fix use-after-free bug caused by unfinished delayed work
Problem Details: The delayed work item 'imm_tq' is initialized in imm_attach() and scheduled via imm_queuecommand() for processing SCSI commands. When the IMM parallel port SCSI host adapter is detached through imm_detach(), the imm_struct device instance is deallocated. However, the delayed work might still be pendi...
```diff diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 5c602c057798..45b0e33293a5 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -1260,6 +1260,7 @@ static void imm_detach(struct parport *pb) imm_struct *dev; list_for_each_entry(dev, &imm_hosts, list) { if (dev->dev->port == pb) { + dis...
267c2e633af6e9461477bed91e428993f8b36ee8
Analyze and fix the following issue in the Linux kernel code: perf trace: Skip internal syscall arguments
Problem Details: Recent changes in the linux-next kernel will add new field for syscalls to have contents in the userspace like below. # cat /sys/kernel/tracing/events/syscalls/sys_enter_write/format name: sys_enter_write ID: 758 format: field:unsigned short common_type; offset:0; size:2;...
```diff diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index a743bda294bd..baee1f695600 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2069,6 +2069,15 @@ static const struct syscall_arg_fmt *syscall_arg_fmt__find_by_name(const char *n return __syscall_arg_fmt_...
cda5dc12eb12cd1dd125c2bfc8952bc498a77cba
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom_wcnss: Fix NULL vs IS_ERR() bug in wcnss_alloc_memory_region()
Problem Details: The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the checking to match. Fixes: c70b9d5fdcd7 ("remoteproc: qcom: Use of_reserved_mem_region_* functions for "memory-region"") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.o...
```diff diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index 14005fb049a2..ee18bf2e8054 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -538,9 +538,9 @@ static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) wcnss->mem_phys = wcnss->mem_rel...
cb200e41ed61c571f9b7fe9fbeb5dd8976e80c60
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom: q6v5: Fix NULL vs IS_ERR() bug in q6v5_alloc_memory_region()
Problem Details: The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the checking to match. Fixes: c70b9d5fdcd7 ("remoteproc: qcom: Use of_reserved_mem_region_* functions for "memory-region"") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.o...
```diff diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c index ca748e3bcc7f..d96af0e0f665 100644 --- a/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c @@ -887,9 +887,9 @@ static int q6v5_alloc_memory_region(struct q6v5_wcss *wcss) wcss->mem_reloc = r...
e7839f773eef2072144fc858b4456aa346fcd665
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom: pas: Fix a couple NULL vs IS_ERR() bugs
Problem Details: The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the checking to match. Fixes: c70b9d5fdcd7 ("remoteproc: qcom: Use of_reserved_mem_region_* functions for "memory-region"") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.o...
```diff diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 609df141ecb1..52680ac99589 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -559,9 +559,9 @@ static int qcom_pas_alloc_memory_region(struct qcom_pas *pas) pas->mem_phys = pas->...
5e6fee736ee0d85acd74f955cab0110b15de4d11
Analyze and fix the following issue in the Linux kernel code: remoteproc: qcom_q6v5_adsp: Fix a NULL vs IS_ERR() check in adsp_alloc_memory_region()
Problem Details: The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the check to match. Fixes: c70b9d5fdcd7 ("remoteproc: qcom: Use of_reserved_mem_region_* functions for "memory-region"") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/...
```diff diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index d3933a66ed3d..b5c8d6d38c9c 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -637,9 +637,10 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) adsp->mem_phys = a...
5053eab38a4c4543522d0c320c639c56a8b59908
Analyze and fix the following issue in the Linux kernel code: scsi: target: Reset t_task_cdb pointer in error case
Problem Details: If allocation of cmd->t_task_cdb fails, it remains NULL but is later dereferenced in the 'err' path. In case of error, reset NULL t_task_cdb value to point at the default fixed-size buffer. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 9e95fb805dc0 ("scsi: target: Fix NULL...
```diff diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index e8b7955d40f2..50d21888a0c9 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1524,6 +1524,7 @@ target_cmd_init_cdb(struct se_cmd *cmd, unsigned char *cdb, gfp_t g...
b4bb6daf4ac4d4560044ecdd81e93aa2f6acbb06
Analyze and fix the following issue in the Linux kernel code: scsi: ufs: core: Fix EH failure after W-LUN resume error
Problem Details: When a W-LUN resume fails, its parent devices in the SCSI hierarchy, including the scsi_target, may be runtime suspended. Subsequently, the error handler in ufshcd_recover_pm_error() fails to set the W-LUN device back to active because the parent target is not active. This results in the following err...
```diff diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 040a0ceb170a..1b3fe1d8655e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -6504,6 +6504,11 @@ static void ufshcd_clk_scaling_suspend(struct ufs_hba *hba, bool suspend) static void ufshcd_err_handling_prepare(s...
faf3c923523e5c8fc3baaa413d62e913774ae52f
Analyze and fix the following issue in the Linux kernel code: mm: fix vma_start_write_killable() signal handling
Problem Details: If we get a signal, we need to restore the vm_refcnt. We don't think that the refcount can actually be decremented to zero here as it requires the VMA to be detached, and the vma_mark_detached() uses TASK_UNINTERRUPTIBLE. However, that's a bit subtle, so handle it as if the refcount was zero at the st...
```diff diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c index e6e5570d1ec7..7421b7ea8001 100644 --- a/mm/mmap_lock.c +++ b/mm/mmap_lock.c @@ -74,6 +74,14 @@ static inline int __vma_enter_locked(struct vm_area_struct *vma, refcount_read(&vma->vm_refcnt) == tgt_refcnt, state); if (err) { + if (refcount_sub_an...
f9e82f99b3771eef396dbf97e0f3c76e20af60dd
Analyze and fix the following issue in the Linux kernel code: mm/swapfile: fix list iteration when next node is removed during discard
Problem Details: Patch series "mm/swapfile: fix and cleanup swap list iterations", v2. This series fixes a potential list iteration issue in swap_sync_discard() when devices are removed, and includes a cleanup for __folio_throttle_swaprate(). This patch (of 2): When the next node is removed from the plist (e.g. by...
```diff diff --git a/mm/swapfile.c b/mm/swapfile.c index d12332423a06..8116f36e440b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1387,9 +1387,10 @@ static bool swap_sync_discard(void) bool ret = false; struct swap_info_struct *si, *next; - spin_lock(&swap_avail_lock); - plist_for_each_entry_safe(si, next, &...
12f0cd393369d700c16b47bc33e4120dc8b2c608
Analyze and fix the following issue in the Linux kernel code: fs/proc/task_mmu.c: fix make_uffd_wp_huge_pte() huge pte handling
Problem Details: make_uffd_wp_huge_pte() should return after handling a huge_pte_none() pte. Link: https://lkml.kernel.org/r/66178124-ebdf-4e23-b8ca-ed3eb8030c81@lucifer.local Fixes: 03bfbc3ad6e4 ("mm: remove is_hugetlb_entry_[migration, hwpoisoned]()") Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Repor...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index d00ac179d973..81dfc26bfae8 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2500,9 +2500,11 @@ static void make_uffd_wp_huge_pte(struct vm_area_struct *vma, const unsigned long psize = huge_page_size(hstate_vma(vma)); softleaf_t entry; ...
ce2bba89566bef9d4a0ff2122ee75739a72a92be
Analyze and fix the following issue in the Linux kernel code: mm/kfence: add reboot notifier to disable KFENCE on shutdown
Problem Details: During system shutdown, KFENCE can cause IPI synchronization issues if it remains active through the reboot process. To prevent this, register a reboot notifier that disables KFENCE and cancels any pending timer work early in the shutdown sequence. This is only necessary when CONFIG_KFENCE_STATIC_KEY...
```diff diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 727c20c94ac5..162a026871ab 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -26,6 +26,7 @@ #include <linux/panic_notifier.h> #include <linux/random.h> #include <linux/rcupdate.h> +#include <linux/reboot.h> #include <linux/sched/clock.h> #include...
0384c8ea96bfe49e82e624e53bfd5f80c3230ea9
Analyze and fix the following issue in the Linux kernel code: selftests/mm/uffd: initialize char variable to Null
Problem Details: In "uffd-stress.c" & "uffd-unit-tests.c". address of char variable having garbage value (uninitialized) is passed to 'write' syscall triggers warning. uffd-stress.c:246:39: warning: variable 'c' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] uffd-un...
```diff diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index b51c89e1cd1a..700fbaa18d44 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -241,7 +241,7 @@ static int stress(struct uffd_args *args) return 1; f...
f65372cd7acbe3c4980d404e99a7017afed607b4
Analyze and fix the following issue in the Linux kernel code: mm: fix DEBUG_RODATA_TEST indentation in Kconfig
Problem Details: Most of the DEBUG_RODATA_TEST section is indented by four spaces instead of the customary single TAB. Link: https://lkml.kernel.org/r/74f39b1bffc6ed802088cb3e7d17b4c82330e8b3.1764058676.git.geert@linux-m68k.org Fixes: 2959a5f726f6 ("mm: add arch-independent testcases for RODATA") Signed-off-by: Geert ...
```diff diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index 32b65073d0cc..7638d75b27db 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -175,10 +175,10 @@ config DEBUG_PAGE_REF nil until the tracepoints are actually enabled. config DEBUG_RODATA_TEST - bool "Testcase for the marking rodata read-only"...
8f4338b1141e1e44a405ce245d18a29a834d32b6
Analyze and fix the following issue in the Linux kernel code: zram: fix a spelling mistake
Problem Details: The spelling of the word "relases" is incorrect; it should be "releases". Link: https://lkml.kernel.org/r/20251125020522.1913-1-chuguangqing@inspur.com Signed-off-by: Chu Guangqing <chuguangqing@inspur.com> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Jens Axboe <axboe@kernel.dk> Cc:...
```diff diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 1a1159a70fb4..5759823d6314 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1043,7 +1043,7 @@ static int zram_writeback_slots(struct zram *zram, index = pps->index; zram_slot_lock(zram, index...
087849cca31d35e3643dedb0d35ba3f7e9cc6758
Analyze and fix the following issue in the Linux kernel code: rqspinlock: Precede non-head waiter queueing with AA check
Problem Details: While previous commits sufficiently address the deadlocks, there are still scenarios where queueing of waiters in NMIs can exacerbate the possibility of timeouts. Consider the case below: CPU 0 <NMI> res_spin_lock(A) -> becomes non-head waiter </NMI> lock owner in CS or pending waiter spinning CPU 1...
```diff diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c index e35b06fcf9ee..f7d0c8d4644e 100644 --- a/kernel/bpf/rqspinlock.c +++ b/kernel/bpf/rqspinlock.c @@ -437,6 +437,19 @@ int __lockfunc resilient_queued_spin_lock_slowpath(rqspinlock_t *lock, u32 val) * queuing. */ queue: + /* + * Do not que...
81d5a6a438595e46be191d602e5c2d6d73992fdc
Analyze and fix the following issue in the Linux kernel code: rqspinlock: Use trylock fallback when per-CPU rqnode is busy
Problem Details: In addition to deferring to the trylock fallback in NMIs, only do so when an rqspinlock waiter is queued on the current CPU. This is detected by noticing a non-zero node index. This allows NMI waiters to join the waiter queue if it isn't interrupting an existing rqspinlock waiter, and increase the chan...
```diff diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c index d160123e2ec4..e602cbbbd029 100644 --- a/kernel/bpf/rqspinlock.c +++ b/kernel/bpf/rqspinlock.c @@ -454,7 +454,7 @@ queue: * any MCS node. This is not the most elegant solution, but is * simple enough. */ - if (unlikely(idx >= _Q_MAX_NO...
5860f5ce479f42b29fabab8f668859f13cae44bb
Analyze and fix the following issue in the Linux kernel code: rqspinlock: Perform AA checks immediately
Problem Details: Currently, while we enter the check_timeout call immediately due to the way the ts.spin is initialized, we still invoke the AA and ABBA checks in the second invocation, and only initialize the timestamp in the first one. Since each iteration is at least done with a 1ms delay, this can add delays in det...
```diff diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c index 878d641719da..d160123e2ec4 100644 --- a/kernel/bpf/rqspinlock.c +++ b/kernel/bpf/rqspinlock.c @@ -196,32 +196,21 @@ static noinline int check_deadlock_ABBA(rqspinlock_t *lock, u32 mask) return 0; } -static noinline int check_deadlock(rqsp...
beb7021a6003d9c6a463fffca0d6311efb8e0e66
Analyze and fix the following issue in the Linux kernel code: rqspinlock: Enclose lock/unlock within lock entry acquisitions
Problem Details: Ritesh reported that timeouts occurred frequently for rqspinlock despite reentrancy on the same lock on the same CPU in [0]. This patch closes one of the races leading to this behavior, and reduces the frequency of timeouts. We currently have a tiny window between the fast-path cmpxchg and the grabbin...
```diff diff --git a/include/asm-generic/rqspinlock.h b/include/asm-generic/rqspinlock.h index 6d4244d643df..0f2dcbbfee2f 100644 --- a/include/asm-generic/rqspinlock.h +++ b/include/asm-generic/rqspinlock.h @@ -129,8 +129,8 @@ dec: * <error> for lock B * release_held_lock_entry * - * try_cmpxchg_acquire for l...
5f88f44d8427a97347afda3a6114aed0df472a0b
Analyze and fix the following issue in the Linux kernel code: docs: kdoc: various fixes for grammar, spelling, punctuation
Problem Details: Correct grammar, spelling, and punctuation in comments, strings, print messages, logs. Change two instances of two spaces between words to just one space. codespell was used to find misspelled words. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: linux-d...
```diff diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kdoc_files.py index 562cdf5261c3..bfe02baf1606 100644 --- a/tools/lib/python/kdoc/kdoc_files.py +++ b/tools/lib/python/kdoc/kdoc_files.py @@ -64,7 +64,7 @@ class GlobSourceFiles: def parse_files(self, file_list, file_not_found_cb): ...
2158890a1af19e13ed222cda3623c8a11d3ec3b4
Analyze and fix the following issue in the Linux kernel code: mtd: sm_ftl: Fix typo in comment in sm_read_lba
Problem Details: s/is/if/ Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
```diff diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index 987d481bf265..5988cba30eb3 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -156,7 +156,7 @@ static int sm_read_lba(struct sm_oob *oob) if (!memcmp(oob, erased_pattern, SM_OOB_SIZE)) return -1; - /* Now check is both copies of ...
c909fec69f84b39e63876c69b9df2c178c6b76ba
Analyze and fix the following issue in the Linux kernel code: mtd: lpddr_cmds: fix signed shifts in lpddr_cmds
Problem Details: There are several places where a value of type 'int' is shifted by lpddr->chipshift. lpddr->chipshift is derived from QINFO geometry and might reach 31 when QINFO reports a 2 GiB size - the maximum supported by LPDDR(1) compliant chips. This may cause unexpected sign-extensions when casting the integer...
```diff diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c index 290fd0119e98..cd37d58abacb 100644 --- a/drivers/mtd/lpddr/lpddr_cmds.c +++ b/drivers/mtd/lpddr/lpddr_cmds.c @@ -79,7 +79,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map) mutex_init(&shared[i].lock); for (j = 0; j < ...
1cce5a5ecafeb8a79aa9165cf134c97da7bbc7db
Analyze and fix the following issue in the Linux kernel code: mtd: docg3: fix kernel-doc warnings
Problem Details: Fix kernel-doc warnings in docg3.h to avoid build warnings: Warning: ../drivers/mtd/devices/docg3.h:276 bad line: Warning: drivers/mtd/devices/docg3.h:299 struct member 'max_block' not described in 'docg3' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Miquel Raynal <miquel.rayna...
```diff diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h index 2c0c5114e4e6..af6ef0ac1f11 100644 --- a/drivers/mtd/devices/docg3.h +++ b/drivers/mtd/devices/docg3.h @@ -274,11 +274,11 @@ struct docg3_cascade { * @cascade: the cascade this device belongs to * @device_id: number of the cascaded ...
414690746d2da0dc9a931f8c02d83e5834141251
Analyze and fix the following issue in the Linux kernel code: i2c: i2c.h: fix a bad kernel-doc line
Problem Details: Change an empty line into a blank kernel-doc line to prevent a kernel-doc warning: Warning: ../include/uapi/linux/i2c.h:38 bad line: Fixes: bfb3939c51d5 ("i2c: refactor documentation of struct i2c_msg") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-...
```diff diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h index a2db2a56c8b0..2a226657d9f8 100644 --- a/include/uapi/linux/i2c.h +++ b/include/uapi/linux/i2c.h @@ -36,7 +36,7 @@ * * Only if I2C_FUNC_NOSTART is set: * %I2C_M_NOSTART: skip repeated start sequence - + * * Only if I2C_FUNC_PROT...
621e57c37ea698e7ba69434ce610de97cd5367a6
Analyze and fix the following issue in the Linux kernel code: i2c: i2c-elektor: Allow building on SMP kernels
Problem Details: In the past, the i2c-elektor driver was broken on SMP. Since then, there appear to have been some fixes and cleanup work (as pointed out by Wolfram Sang) to get rid of cli/sti usage and rely on spinlocks instead. Therefore, let's allow building the driver on SMP kernels again. I've tested this driver ...
```diff diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index fd81e49638aa..9b1473d720a0 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -1474,7 +1474,7 @@ config I2C_ACORN config I2C_ELEKTOR tristate "Elektor ISA card" - depends on ISA && HAS_IOPORT_MAP && BROKEN_O...
cb2dc6d2869a4fb7ef8d792a81a74bc6f0958a72
Analyze and fix the following issue in the Linux kernel code: can: Kconfig: select CAN driver infrastructure by default
Problem Details: The CAN bus support enabled with CONFIG_CAN provides a socket-based access to CAN interfaces. With the introduction of the latest CAN protocol CAN XL additional configuration status information needs to be exposed to the network layer than formerly provided by standard Linux network drivers. This requ...
```diff diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 52c8be5c160e..f6416a56e95d 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -111,7 +111,14 @@ struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, void free_candev(struct net_device *dev); /*...
841ecc979b18d3227fad5e2d6a1e6f92688776b5
Analyze and fix the following issue in the Linux kernel code: MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow
Problem Details: Owing to Config4.MMUSizeExt and VTLB/FTLB MMU features later MIPSr2+ cores can have more than 64 TLB entries. Therefore allocate an array for uniquification instead of placing too an small array on the stack. Fixes: 35ad7e181541 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init") Co-developed-by: Mac...
```diff diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 3facf7cc6c7d..44a662536148 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c @@ -12,6 +12,7 @@ #include <linux/init.h> #include <linux/sched.h> #include <linux/smp.h> +#include <linux/memblock.h> #include <linux/mm.h> #includ...
324f3e03e8a85931ce0880654e3c3eb38b0f0bba
Analyze and fix the following issue in the Linux kernel code: ALSA: dice: fix buffer overflow in detect_stream_formats()
Problem Details: The function detect_stream_formats() reads the stream_count value directly from a FireWire device without validating it. This can lead to out-of-bounds writes when a malicious device provides a stream_count value greater than MAX_STREAMS. Fix by applying the same validation to both TX and RX stream co...
```diff diff --git a/sound/firewire/dice/dice-extension.c b/sound/firewire/dice/dice-extension.c index 02f4a8318e38..48bfb3ad93ce 100644 --- a/sound/firewire/dice/dice-extension.c +++ b/sound/firewire/dice/dice-extension.c @@ -116,7 +116,7 @@ static int detect_stream_formats(struct snd_dice *dice, u64 section_addr) ...
e5235eb6cfe02a51256013a78f7b28779a7740d5
Analyze and fix the following issue in the Linux kernel code: net: netpoll: initialize work queue before error checks
Problem Details: Prevent a kernel warning when netconsole setup fails on devices with IFF_DISABLE_NETPOLL flag. The warning (at kernel/workqueue.c:4242 in __flush_work) occurs because the cleanup path tries to cancel an uninitialized work queue. When __netpoll_setup() encounters a device with IFF_DISABLE_NETPOLL, it f...
```diff diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 331764845e8f..09f72f10813c 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -554,6 +554,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) int err; skb_queue_head_init(&np->skb_pool); + INIT_WORK(&np->refill_wq, refil...
2c28ee720ad14f58eb88a97ec3efe7c5c315ea5d
Analyze and fix the following issue in the Linux kernel code: selftests: bonding: add delay before each xvlan_over_bond connectivity check
Problem Details: Jakub reported increased flakiness in bond_macvlan_ipvlan.sh on regular kernel, while the tests consistently pass on a debug kernel. This suggests a timing-sensitive issue. To mitigate this, introduce a short sleep before each xvlan_over_bond connectivity check. The delay helps ensure neighbor and rou...
```diff diff --git a/tools/testing/selftests/drivers/net/bonding/bond_macvlan_ipvlan.sh b/tools/testing/selftests/drivers/net/bonding/bond_macvlan_ipvlan.sh index c4711272fe45..559f300f965a 100755 --- a/tools/testing/selftests/drivers/net/bonding/bond_macvlan_ipvlan.sh +++ b/tools/testing/selftests/drivers/net/bonding/...
1adc241f3940c172c8c674a62004d3c34b360ab3
Analyze and fix the following issue in the Linux kernel code: ynl: fix schema check errors
Problem Details: Fix two schema check errors that have lurked since the attribute name validation was made more strict: not ok 2 conntrack.yaml schema validation 'labels mask' does not match '^[0-9a-z-]+$' not ok 13 nftables.yaml schema validation 'set id' does not match '^[0-9a-z-]+$' Signed-off-by: Donald Hunter <...
```diff diff --git a/Documentation/netlink/specs/conntrack.yaml b/Documentation/netlink/specs/conntrack.yaml index bef528633b17..db7cddcda50a 100644 --- a/Documentation/netlink/specs/conntrack.yaml +++ b/Documentation/netlink/specs/conntrack.yaml @@ -457,7 +457,7 @@ attribute-sets: name: labels type: ...
acce9d7200e23de310c2cf8cd5439e86cd9ddc41
Analyze and fix the following issue in the Linux kernel code: ynl: fix a yamllint warning in ethtool spec
Problem Details: Fix warning reported by yamllint: ../../../Documentation/netlink/specs/ethtool.yaml 1272:21 warning truthy value should be one of [false, true] (truthy) Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20251127123502.89142-4-donald.hunter@gmail.com Signed-of...
```diff diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml index 05d2b6508b59..0a2d2343f79a 100644 --- a/Documentation/netlink/specs/ethtool.yaml +++ b/Documentation/netlink/specs/ethtool.yaml @@ -1269,7 +1269,7 @@ attribute-sets: - name: hist type:...
a6c121a2432eee2c4ebceb1483ccd4a50a52983d
Analyze and fix the following issue in the Linux kernel code: net: phy: aquantia: check for NVMEM deferral
Problem Details: Currently, if NVMEM provider is probed later than Aquantia, loading the firmware will fail with -EINVAL. To fix this, simply check for -EPROBE_DEFER when NVMEM is attempted and return it. Fixes: e93984ebc1c8 ("net: phy: aquantia: add firmware load support") Signed-off-by: Robert Marko <robimarko@gmai...
```diff diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c index bbbcc9736b00..569256152689 100644 --- a/drivers/net/phy/aquantia/aquantia_firmware.c +++ b/drivers/net/phy/aquantia/aquantia_firmware.c @@ -369,7 +369,7 @@ int aqr_firmware_load(struct phy_device *phyd...
91ef18b567dae84c0cea9b996d933c856e366f52
Analyze and fix the following issue in the Linux kernel code: ext4: mark inodes without acls in __ext4_iget()
Problem Details: Mark inodes without acls with cache_no_acl() in __ext4_iget() so that path lookup can run in RCU mode from the start. This is interesting in particular for the case where the file owner does the lookup because in that case end up constantly hitting the slow path otherwise. We drop out from the fast pat...
```diff diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7510fce3d0f0..eeb3ec4c2a9a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5508,7 +5508,9 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, if (ret) goto bad_inode; brelse(iloc.bh); - + /* Initialize the "no ACL's" state fo...
0ad55fa104a2aa5980c12f88546fab328d34644b
Analyze and fix the following issue in the Linux kernel code: ext4: support large block size in ext4_mb_init_cache()
Problem Details: Currently, ext4_mb_init_cache() uses blocks_per_page to calculate the folio index and offset. However, when blocksize is larger than PAGE_SIZE, blocks_per_page becomes zero, leading to a potential division-by-zero bug. Since we now have the folio, we know its exact size. This allows us to convert {blo...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index c1941afce6e2..4801cea6badd 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1346,26 +1346,25 @@ static void mb_regenerate_buddy(struct ext4_buddy *e4b) * block bitmap and buddy information. The information are * stored in the inode as * - ...
3938fc29f89fff132929b2fea2fe00b0f43617ca
Analyze and fix the following issue in the Linux kernel code: ext4: support large block size in ext4_mb_get_buddy_page_lock()
Problem Details: Currently, ext4_mb_get_buddy_page_lock() uses blocks_per_page to calculate folio index and offset. However, when blocksize is larger than PAGE_SIZE, blocks_per_page becomes zero, leading to a potential division-by-zero bug. To support BS > PS, use bytes to compute folio index and offset within folio t...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 38af89f5da56..c1941afce6e2 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1527,50 +1527,52 @@ out: } /* - * Lock the buddy and bitmap pages. This make sure other parallel init_group - * on the same buddy page doesn't happen whild holding t...
6117f1806a7328e8d316eeeac66b2ba4e4539ba5
Analyze and fix the following issue in the Linux kernel code: ext4: support large block size in ext4_mb_load_buddy_gfp()
Problem Details: Currently, ext4_mb_load_buddy_gfp() uses blocks_per_page to calculate the folio index and offset. However, when blocksize is larger than PAGE_SIZE, blocks_per_page becomes zero, leading to a potential division-by-zero bug. To support BS > PS, use bytes to compute folio index and offset within folio to...
```diff diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 65335248825c..38af89f5da56 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1659,17 +1659,15 @@ err: /* * Locking note: This routine calls ext4_mb_init_cache(), which takes the - * block group lock of all groups for this page; do not hold ...
609c5e0081b432caaa557ffcf1318aefe1187c4e
Analyze and fix the following issue in the Linux kernel code: ext4: support large block size in ext4_readdir()
Problem Details: In ext4_readdir(), page_cache_sync_readahead() is used to readahead mapped physical blocks. With LBS support, this can lead to a negative right shift. To fix this, the page index is now calculated by first converting the physical block number (pblk) to a file position (pos) before converting it to a p...
```diff diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index d4164c507a90..256fe2c1d4c1 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -192,13 +192,13 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) continue; } if (err > 0) { - pgoff_t index = map.m_pblk >> - (PAGE_SHIFT - inode->i...
d37a7ddd3a384bd34f985273d6e776d3d50b0edd
Analyze and fix the following issue in the Linux kernel code: ext4: make ext4_punch_hole() support large block size
Problem Details: When preparing for bs > ps support, clean up unnecessary PAGE_SIZE references in ext4_punch_hole(). Previously, when a hole extended beyond i_size, we aligned the hole end upwards to PAGE_SIZE to handle partial folio invalidation. Now that truncate_inode_pages_range() already handles partial folio inv...
```diff diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d232154cc14d..5cf392142c8c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4408,10 +4408,10 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) /* * If the hole extends beyond i_size, set the hole to end after - * the page t...
19eef1d98eeda3745df35839190b7d4a4adea656
Analyze and fix the following issue in the Linux kernel code: afs: Fix uninit var in afs_alloc_anon_key()
Problem Details: Fix an uninitialised variable (key) in afs_alloc_anon_key() by setting it to cell->anonymous_key. Without this change, the error check may return a false failure with a bad error number. Most of the time this is unlikely to happen because the first encounter with afs_alloc_anon_key() will usually be ...
```diff diff --git a/fs/afs/security.c b/fs/afs/security.c index ff8830e6982f..55ddce94af03 100644 --- a/fs/afs/security.c +++ b/fs/afs/security.c @@ -26,7 +26,8 @@ static int afs_alloc_anon_key(struct afs_cell *cell) struct key *key; mutex_lock(&afs_key_lock); - if (!cell->anonymous_key) { + key = cell->anonymou...
b4bf1d23dc1da236c92a9d9be68cc63358d1f750
Analyze and fix the following issue in the Linux kernel code: bpf: Disable file_alloc_security hook
Problem Details: A use-after-free bug may be triggered by calling bpf_inode_storage_get() in a BPF LSM program hooked to file_alloc_security. Disable the hook to prevent this from happening. The cause of the bug is shown in the trace below. In alloc_file(), a file struct is first allocated through kmem_cache_alloc(). ...
```diff diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index 0a59df1c550a..7cb6e8d4282c 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -51,6 +51,7 @@ BTF_ID(func, bpf_lsm_key_getsecurity) BTF_ID(func, bpf_lsm_audit_rule_match) #endif BTF_ID(func, bpf_lsm_ismaclabel) +BTF_ID(func, bpf_lsm_f...
7feff23cdf2ecd30909872f3be1da820df839ab0
Analyze and fix the following issue in the Linux kernel code: bpf: force BPF_F_RDONLY_PROG on insn array creation
Problem Details: The original implementation added a hack to check_mem_access() to prevent programs from writing into insn arrays. To get rid of this hack, enforce BPF_F_RDONLY_PROG on map creation. Also fix the corresponding selftest, as the error message changes with this patch. Suggested-by: Alexei Starovoitov <as...
```diff diff --git a/kernel/bpf/bpf_insn_array.c b/kernel/bpf/bpf_insn_array.c index 61ce52882632..c96630cb75bf 100644 --- a/kernel/bpf/bpf_insn_array.c +++ b/kernel/bpf/bpf_insn_array.c @@ -55,6 +55,9 @@ static struct bpf_map *insn_array_alloc(union bpf_attr *attr) bpf_map_init_from_attr(&insn_array->map, attr); ...
01c724aa7bf84e9d081a56e0cbf1d282678ce144
Analyze and fix the following issue in the Linux kernel code: drm/xe/pf: Enable SR-IOV VF migration
Problem Details: All of the necessary building blocks are now in place to support SR-IOV VF migration. Flip the enable/disable logic to match VF code and disable the feature only for platforms that don't meet the necessary prerequisites. To allow more testing and experiments, on DEBUG builds any missing prerequisites w...
```diff diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c index d5d918ddce4f..3174a8dee779 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c @@ -17,6 +17,7 @@ #include "xe_gt_sriov_pf_helpers.h" #incl...
d133e30aabc7c8eb8206827f8fbe0f3679adb911
Analyze and fix the following issue in the Linux kernel code: ubi: fastmap: fix ubi->fm memory leak
Problem Details: The problem is that scan_fast() allocate memory for ubi->fm and ubi->fm->e[x], but if the following attach process fails in ubi_wl_init or ubi_read_volume_table, the whole attach process will fail without executing ubi_wl_close to free the memory under ubi->fm. Fix this by add a new ubi_free_fastmap f...
```diff diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index adc47b87b38a..884171871d0e 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -1600,7 +1600,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan) err = ubi_read_volume_table(ubi, ai); if (err) - goto out_ai;...
81d431130ae1af4e64030f6a956ee9137e6fc1b0
Analyze and fix the following issue in the Linux kernel code: regulator: fp9931: Fix spelling mistake "failid" -> "failed"
Problem Details: There is a spelling mistake in a dev_err_probe message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://patch.msgid.link/20251128173330.318309-1-colin.i.king@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
```diff diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c index 875d875d1a50..fef0bb07fd5d 100644 --- a/drivers/regulator/fp9931.c +++ b/drivers/regulator/fp9931.c @@ -444,7 +444,7 @@ static int fp9931_probe(struct i2c_client *client) data->vin_reg = devm_regulator_get_optional(&client->dev, "vin")...
9a659d74f2a455cbc595c6cb4dfefc16b09f86ed
Analyze and fix the following issue in the Linux kernel code: vfio: selftests: Rename struct vfio_dma_region to dma_region
Problem Details: Rename struct vfio_dma_region to dma_region. This is in preparation for separating the VFIO PCI device library code from the IOMMU library code. This name change also better reflects the fact that DMA mappings can be managed by either VFIO or IOMMUFD. i.e. the "vfio_" prefix is misleading. Reviewed-by...
```diff diff --git a/tools/testing/selftests/vfio/lib/include/vfio_util.h b/tools/testing/selftests/vfio/lib/include/vfio_util.h index babbf90688e8..7784422116de 100644 --- a/tools/testing/selftests/vfio/lib/include/vfio_util.h +++ b/tools/testing/selftests/vfio/lib/include/vfio_util.h @@ -80,7 +80,7 @@ typedef u64 iov...
c48545442e18219cca7f658ecdf7562ef58cfac6
Analyze and fix the following issue in the Linux kernel code: vfio: selftests: Prefix logs with device BDF where relevant
Problem Details: Prefix log messages with the device's BDF where relevant. This will help understanding VFIO selftests logs when tests are run with multiple devices. Reviewed-by: Alex Mastro <amastro@fb.com> Tested-by: Alex Mastro <amastro@fb.com> Reviewed-by: Raghavendra Rao Ananta <rananta@google.com> Signed-off-by:...
```diff diff --git a/tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c b/tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c index 0ca2cbc2a316..8d667be80229 100644 --- a/tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c +++ b/tools/testing/selftests/vfio/lib/drivers/dsa/dsa.c @@ -70,7 +70,7 @@ static int dsa_probe(st...
f7ef7de6b9bcec1314af2cdcfd0c952eadd6a779
Analyze and fix the following issue in the Linux kernel code: landlock: Improve variable scope
Problem Details: This is now possible thanks to the disconnected directory fix. Cc: Günther Noack <gnoack@google.com> Cc: Song Liu <song@kernel.org> Cc: Tingmao Wang <m@maowtm.org> Link: https://lore.kernel.org/r/20251128172200.760753-3-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
```diff diff --git a/security/landlock/fs.c b/security/landlock/fs.c index 2521acde6039..6fadb54496a0 100644 --- a/security/landlock/fs.c +++ b/security/landlock/fs.c @@ -838,7 +838,6 @@ static bool is_access_to_paths_allowed( * restriction. */ while (true) { - struct dentry *parent_dentry; const struct lan...
49c9e09d961025b22e61ef9ad56aa1c21b6ce2f1
Analyze and fix the following issue in the Linux kernel code: landlock: Fix handling of disconnected directories
Problem Details: Disconnected files or directories can appear when they are visible and opened from a bind mount, but have been renamed or moved from the source of the bind mount in a way that makes them inaccessible from the mount point (i.e. out of scope). Previously, access rights tied to files or directories opene...
```diff diff --git a/security/landlock/errata/abi-1.h b/security/landlock/errata/abi-1.h new file mode 100644 index 000000000000..e8a2bff2e5b6 --- /dev/null +++ b/security/landlock/errata/abi-1.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/** + * DOC: erratum_3 + * + * Erratum 3: Disconnected dire...
7d055071d73bac7acc3a0b441f0632f564f048fe
Analyze and fix the following issue in the Linux kernel code: vfio/nvgrace-gpu: split the code to wait for GPU ready
Problem Details: Split the function that check for the GPU device being ready on the probe. Move the code to wait for the GPU to be ready through BAR0 register reads to a separate function. This would help reuse the code. This also fixes a bug where the return status in case of timeout gets overridden by return from ...
```diff diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c index 3034d6adf576..5f122929dd44 100644 --- a/drivers/vfio/pci/nvgrace-gpu/main.c +++ b/drivers/vfio/pci/nvgrace-gpu/main.c @@ -131,6 +131,20 @@ static void nvgrace_gpu_close_device(struct vfio_device *core_vdev) vfio_pci_c...
590d745680309f8d956c3f0a97270fe65013b272
Analyze and fix the following issue in the Linux kernel code: dma-buf: fix integer overflow in fill_sg_entry() for buffers >= 8GiB
Problem Details: fill_sg_entry() splits large DMA buffers into multiple scatter-gather entries, each holding up to UINT_MAX bytes. When calculating the DMA address for entries beyond the second one, the expression (i * UINT_MAX) causes integer overflow due to 32-bit arithmetic. This manifests when the input arg length...
```diff diff --git a/drivers/dma-buf/dma-buf-mapping.c b/drivers/dma-buf/dma-buf-mapping.c index b4819811a64a..b7352e609fbd 100644 --- a/drivers/dma-buf/dma-buf-mapping.c +++ b/drivers/dma-buf/dma-buf-mapping.c @@ -24,7 +24,7 @@ static struct scatterlist *fill_sg_entry(struct scatterlist *sgl, size_t length, * does...
98693e0897f754e3f51ce6626ed5f785f625ba2b
Analyze and fix the following issue in the Linux kernel code: vfio/pci: Use RCU for error/request triggers to avoid circular locking
Problem Details: Thanks to a device generating an ACS violation during bus reset, lockdep reported the following circular locking issue: CPU0: SET_IRQS (MSI/X): holds igate, acquires memory_lock CPU1: HOT_RESET: holds memory_lock, acquires pci_bus_sem CPU2: AER: holds pci_bus_sem, acquires igate This results in a pot...
```diff diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 79a1a50a4ef7..2b01bfbce3ea 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -42,6 +42,40 @@ static bool nointxmask; static bool disable_vga; static bool disable_idle_d3; +static void...
b8d5acdcf525f44e521ca4ef51dce4dac403dab4
Analyze and fix the following issue in the Linux kernel code: hwmon: (max16065) Use local variable to avoid TOCTOU
Problem Details: In max16065_current_show, data->curr_sense is read twice: once for the error check and again for the calculation. Since i2c_smbus_read_byte_data returns negative error codes on failure, if the data changes to an error code between the check and the use, ADC_TO_CURR results in an incorrect calculation. ...
```diff diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index 0ccb5eb596fc..4c9e7892a73c 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c @@ -216,12 +216,13 @@ static ssize_t max16065_current_show(struct device *dev, struct device_attribute *da, char *buf) { struct max1...
07272e883fc61574b8367d44de48917f622cdd83
Analyze and fix the following issue in the Linux kernel code: hwmon: (w83l786ng) Convert macros to functions to avoid TOCTOU
Problem Details: The macros FAN_FROM_REG and TEMP_FROM_REG evaluate their arguments multiple times. When used in lockless contexts involving shared driver data, this causes Time-of-Check to Time-of-Use (TOCTOU) race conditions. Convert the macros to static functions. This guarantees that arguments are evaluated only o...
```diff diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 9b81bd406e05..1d9109ca1585 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c @@ -76,15 +76,25 @@ FAN_TO_REG(long rpm, int div) return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); } -#define FAN_FROM...
418de94e7593081c29066555bf9059f1f7dd9d79
Analyze and fix the following issue in the Linux kernel code: sbitmap: fix all kernel-doc warnings
Problem Details: Modify kernel-doc comments in sbitmap.h to prevent warnings: Warning: include/linux/sbitmap.h:84 struct member 'alloc_hint' not described in 'sbitmap' Warning: include/linux/sbitmap.h:151 struct member 'ws_active' not described in 'sbitmap_queue' Warning: include/linux/sbitmap.h:552 No description f...
```diff diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index ffb9907c7070..cc7ad189caa5 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -75,7 +75,7 @@ struct sbitmap { */ struct sbitmap_word *map; - /* + /** * @alloc_hint: Cache of last successfully allocated or freed bit...
82d12088c297fa1cef670e1718b3d24f414c23f7
Analyze and fix the following issue in the Linux kernel code: char: applicom: fix NULL pointer dereference in ac_ioctl
Problem Details: Discovered by Atuin - Automated Vulnerability Discovery Engine. In ac_ioctl, the validation of IndexCard and the check for a valid RamIO pointer are skipped when cmd is 6. However, the function unconditionally executes readb(apbs[IndexCard].RamIO + VERS) at the end. If cmd is 6, IndexCard may referen...
```diff diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 9fed9706d9cd..c138c468f3a4 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -835,7 +835,10 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -ENOTTY; break; } - Dummy = readb(apb...
89e1fb7ceffd898505ad7fa57acec0585bfaa2cc
Analyze and fix the following issue in the Linux kernel code: blk-mq: fix potential uaf for 'queue_hw_ctx'
Problem Details: This is just apply Kuai's patch in [1] with mirror changes. blk_mq_realloc_hw_ctxs() will free the 'queue_hw_ctx'(e.g. undate submit_queues through configfs for null_blk), while it might still be used from other context(e.g. switch elevator to none): t1 t2 elevator_switch blk_mq_unquiesce_queue ...
```diff diff --git a/block/blk-mq.c b/block/blk-mq.c index 1ef81110eb8a..4e96bb246247 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4535,7 +4535,12 @@ static void __blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, if (hctxs) memcpy(new_hctxs, hctxs, q->nr_hw_queues * sizeof(*hctxs)); - q->qu...
357797f272c70f9b796636d2e795056f9e2e2b4f
Analyze and fix the following issue in the Linux kernel code: i915/display/intel_ddi: Reduce severity of failed FEC enabling
Problem Details: During some IGT tests (e.g. xe_pm@s2idle-exec-after, xe_pm@s2idle-mocs) sink disconnects across suspend/resume, reconnecting later during resume at some point. Hence during resume, where the driver is restoring the pre-suspend mode, all the AUX transfers to the sink are expected to fail. Switch error ...
```diff diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index ed9798b0ec00..974d0b85db79 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -2448,7 +2448,7 @@ static void intel_ddi_enable_fec(struct intel_encoder *enco...
e3cee98f2fcc2234be7813c0e55a7f7a5e77aaf2
Analyze and fix the following issue in the Linux kernel code: mailbox: th1520: fix clock imbalance on probe failure
Problem Details: The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice. Fixes: 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver") Cc: Michal Wilc...
```diff diff --git a/drivers/mailbox/mailbox-th1520.c b/drivers/mailbox/mailbox-th1520.c index a6b2aa9ae952..626957c2e435 100644 --- a/drivers/mailbox/mailbox-th1520.c +++ b/drivers/mailbox/mailbox-th1520.c @@ -435,10 +435,8 @@ static int th1520_mbox_probe(struct platform_device *pdev) } ret = devm_add_action_or_...
e5efd56fa157d2e7d789949d1d64eccbac18a897
Analyze and fix the following issue in the Linux kernel code: arm64/pageattr: Propagate return value from __change_memory_common
Problem Details: The rodata=on security measure requires that any code path which does vmalloc -> set_memory_ro/set_memory_rox must protect the linear map alias too. Therefore, if such a call fails, we must abort set_memory_* and caller must take appropriate action; currently we are suppressing the error, and there is ...
```diff diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c index 5135f2d66958..b4ea86cd3a71 100644 --- a/arch/arm64/mm/pageattr.c +++ b/arch/arm64/mm/pageattr.c @@ -148,6 +148,7 @@ static int change_memory_common(unsigned long addr, int numpages, unsigned long size = PAGE_SIZE * numpages; unsigned lon...
ff0e4d4c97c94af34cc9cad37b5a5cdbe597a3b0
Analyze and fix the following issue in the Linux kernel code: mailbox: pcc: don't zero error register
Problem Details: The error status mask for a type 3/4 subspace is used for reading the error status, and the bitwise inverse is used for clearing the error with the intent being to preserve any of the non-error bits. However, we were previously applying the mask to extract the status and then applying the inverse to t...
```diff diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 0a00719b2482..ff292b9e0be9 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -276,9 +276,8 @@ static int pcc_mbox_error_check_and_clear(struct pcc_chan_info *pchan) if (ret) return ret; - val &= pchan->error.status_mask; - i...
094b53ecaa3ef227f9c800f8de90a9b44f1c1bb4
Analyze and fix the following issue in the Linux kernel code: mailbox: mtk-gpueb: Add missing 'static' to mailbox ops struct
Problem Details: mtk_gpueb_mbox_ops should be declared static. However, due to its const nature, this specifier was missed, as it compiled fine without it and with no warning by the compiler. arc-linux-gcc (GCC) 12.5.0 doesn't seem to like it however, so add the static to fix that. Reported-by: kernel test robot <lkp...
```diff diff --git a/drivers/mailbox/mtk-gpueb-mailbox.c b/drivers/mailbox/mtk-gpueb-mailbox.c index 925bcf21f650..f6d2beccd91b 100644 --- a/drivers/mailbox/mtk-gpueb-mailbox.c +++ b/drivers/mailbox/mtk-gpueb-mailbox.c @@ -200,7 +200,7 @@ static bool mtk_gpueb_mbox_last_tx_done(struct mbox_chan *chan) return !(readl(...
a195c7ccfb7a21b8118139835e25936ec8722596
Analyze and fix the following issue in the Linux kernel code: mailbox: mtk-cmdq: Refine DMA address handling for the command buffer
Problem Details: GCE can only fetch the command buffer address from a 32-bit register. Some SoCs support a 35-bit command buffer address for GCE, which requires a right shift of 3 bits before setting the address into the 32-bit register. A comment has been added to the header of cmdq_get_shift_pa() to explain this requ...
```diff diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 654a60f63756..5791f80f995a 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -92,6 +92,18 @@ struct gce_plat { u32 gce_num; }; +static inline u32 cmdq_convert_gce_addr(dma_ad...
3acf1028f5003731977f750a7070f3321a9cb740
Analyze and fix the following issue in the Linux kernel code: mailbox: mailbox-test: Fix debugfs_create_dir error checking
Problem Details: The debugfs_create_dir() function returns ERR_PTR() on error, not NULL. The current null-check fails to catch errors. Use IS_ERR() to correctly check for errors. Fixes: 8ea4484d0c2b ("mailbox: Add generic mechanism for testing Mailbox Controllers") Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Sig...
```diff diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c index c9dd8c42c0cd..3a28ab5c42e5 100644 --- a/drivers/mailbox/mailbox-test.c +++ b/drivers/mailbox/mailbox-test.c @@ -268,7 +268,7 @@ static int mbox_test_add_debugfs(struct platform_device *pdev, return 0; tdev->root_debugfs_di...
060e4e835f9394816584942511f22d771f05100c
Analyze and fix the following issue in the Linux kernel code: mailbox: omap-mailbox: Check for pending msgs only when mbox is exclusive
Problem Details: On TI K3 devices, the mailbox resides in the Always-On power domain (LPSC_main_alwayson) and is shared among multiple processors. The mailbox is not solely exclusive to Linux. Currently, the suspend path checks all FIFO queues for pending messages and blocks suspend if any are present. This behavior i...
```diff diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c index 680243751d62..17fe6545875d 100644 --- a/drivers/mailbox/omap-mailbox.c +++ b/drivers/mailbox/omap-mailbox.c @@ -68,6 +68,7 @@ struct omap_mbox_fifo { struct omap_mbox_match_data { u32 intr_type; + bool is_exclusive; }; s...
e85e9ccf3f8404007f62dff9a02273fcdeb44206
Analyze and fix the following issue in the Linux kernel code: drm/panic: Report invalid or unsupported panic modes
Problem Details: Currently the user can write anything into the drm.panic_screen modparam, either at runtime via sysfs, or as a kernel boot time argument. Invalid strings will be silently accepted and ignored at use time by defaulting to the 'user' panic mode. Let instead add some validation in order to have immediate...
```diff diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index 1d6312fa1429..2635f95cbde5 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -39,12 +39,6 @@ MODULE_AUTHOR("Jocelyn Falempe"); MODULE_DESCRIPTION("DRM panic handler"); MODULE_LICENSE("GPL"); -static char...
dae9750105cf93ac1e156ef91f4beeb53bd64777
Analyze and fix the following issue in the Linux kernel code: gpio: loongson: Switch 2K2000/3000 GPIO to BYTE_CTRL_MODE
Problem Details: The manuals of 2K2000 says both BIT_CTRL_MODE and BYTE_CTRL_MODE are supported but the latter is recommended. Also on 2K3000, per the ACPI DSDT the GPIO controller is compatible with 2K2000, but it fails to operate GPIOs 62 and 63 (and maybe others) using BIT_CTRL_MODE. Using BYTE_CTRL_MODE also makes...
```diff diff --git a/drivers/gpio/gpio-loongson-64bit.c b/drivers/gpio/gpio-loongson-64bit.c index d4e291b275f0..77d07e31366f 100644 --- a/drivers/gpio/gpio-loongson-64bit.c +++ b/drivers/gpio/gpio-loongson-64bit.c @@ -408,11 +408,11 @@ static const struct loongson_gpio_chip_data loongson_gpio_ls2k2000_data0 = { sta...
f01c0f7ee59fce16e5bae92a2d388a8a6fdf3f0f
Analyze and fix the following issue in the Linux kernel code: gpio: regmap: fix kernel-doc notation
Problem Details: Add a ':' to the end of struct member names to prevent kernel-doc warnings: Warning: include/linux/gpio/regmap.h:108 struct member 'regmap_irq_line' not described in 'gpio_regmap_config' Warning: include/linux/gpio/regmap.h:108 struct member 'regmap_irq_flags' not described in 'gpio_regmap_config' ...
```diff diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h index 87983a5f3681..12d154732ca9 100644 --- a/include/linux/gpio/regmap.h +++ b/include/linux/gpio/regmap.h @@ -50,8 +50,8 @@ struct regmap; * @regmap_irq_chip: (Optional) Pointer on an regmap_irq_chip structure. If * set, a regmap-irq...
545d1287e40a55242f6ab68bcc1ba3b74088b1bc
Analyze and fix the following issue in the Linux kernel code: spi: ch341: fix out-of-bounds memory access in ch341_transfer_one
Problem Details: Discovered by Atuin - Automated Vulnerability Discovery Engine. The 'len' variable is calculated as 'min(32, trans->len + 1)', which includes the 1-byte command header. When copying data from 'trans->tx_buf' to 'ch341->tx_buf + 1', using 'len' as the length is incorrect because: 1. It causes an out-...
```diff diff --git a/drivers/spi/spi-ch341.c b/drivers/spi/spi-ch341.c index 46bc208f2d05..79d2f9ab4ef0 100644 --- a/drivers/spi/spi-ch341.c +++ b/drivers/spi/spi-ch341.c @@ -78,7 +78,7 @@ static int ch341_transfer_one(struct spi_controller *host, ch341->tx_buf[0] = CH341A_CMD_SPI_STREAM; - memcpy(ch341->tx_buf +...
b025f01ee952593d583716505764f116a9d578e0
Analyze and fix the following issue in the Linux kernel code: ASoC: SDCA: Fixup some more Kconfig issues
Problem Details: As the class driver is manually selectable, it needs to depend on SOUNDWIRE, which is obviously necessary. Also the depends on in SND_SOC_SDCA_HID needs to be pulled into SND_SOC_SDCA_CLASS as well, since HID is selected by the class driver. Fixes: 2d877d0659cb ("ASoC: SDCA: Add basic SDCA class drive...
```diff diff --git a/sound/soc/sdca/Kconfig b/sound/soc/sdca/Kconfig index 3c6bf0e2c2f0..fabb69a3450d 100644 --- a/sound/soc/sdca/Kconfig +++ b/sound/soc/sdca/Kconfig @@ -39,6 +39,8 @@ config SND_SOC_SDCA_OPTIONAL config SND_SOC_SDCA_CLASS tristate "SDCA Class Driver" + depends on SOUNDWIRE + depends on HID=y || H...
3fd5edfe1d6fcc67410be753dcb704d8a1d0bfd7
Analyze and fix the following issue in the Linux kernel code: tty: convert ptm_open_peer() to FD_ADD()
Problem Details: Christian Brauner <brauner@kernel.org> says: The fix sent in [1] was squashed into this commit. Fixes: https://lore.kernel.org/37ac7af5-584f-4768-a462-4d1071c43eaf@sirena.org.uk [1] Reported-by: Mark Brown <broonie@kernel.org> [1] Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> [1] Link:...
```diff diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 8bb1a01fef2a..41c1d909525c 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -589,6 +589,23 @@ static inline void legacy_pty_init(void) { } #ifdef CONFIG_UNIX98_PTYS static struct cdev ptmx_cdev; +static struct file *ptm_open_peer_file(struct ...
6d3789d347a7af5c4b0b2da3af47b8d9da607ab2
Analyze and fix the following issue in the Linux kernel code: papr-hvpipe: convert papr_hvpipe_dev_create_handle() to FD_PREPARE()
Problem Details: Fixes a UAF for src_info as well. Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-33-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
```diff diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c index 21a2f447c43f..dd7b668799d9 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -479,10 +479,7 @@ static const struct file_operations papr_hvp...