6.1.129-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 447/578 io_uring: fix io_req_prep_async with provided buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
io_req_prep_async() can import provided buffers, commit the ring state by giving up on that before, it'll be reimported later if needed.
--- io_uring/io_uring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
io_uring/io_uring.c +4 -1
@@ -1624,6 +1624,7 @@ bool io_alloc_async_data(struct io_kiocbint io_req_prep_async (struct io_kiocb *req) {const struct io_op_def *def = &io_op_defs[req->opcode]; +int ret;/* assign early for deferred execution for non-fixed file */ if (def->needs_file && !(req->flags &REQ_F_FIXED_FILE ) && !req->file)
@@ -1636,7 +1637,9 @@ int io_req_prep_async(struct io_kiocb *rif (io_alloc_async_data (req))return -EAGAIN ; } -return def->prep_async (req); + ret = def->prep_async (req); +io_kbuf_recycle (req,0 ); +return ret; }static u32 io_get_sequence (struct io_kiocb *req)
Greg Kroah-Hartman
maintainerPATCH 448/578 io_uring/rw: commit provided buffer state on async
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
When we get -EIOCBQUEUED, we need to ensure that the buffer is consumed from the provided buffer ring, which can be done with io_kbuf_recycle()
+ REQ_F_PARTIAL_IO.
--- io_uring/rw.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
io_uring/rw.c +10 -0
@@ -772,6 +772,8 @@ static int __io_read(struct io_kiocb *re goto done; ret =0 ; }else if (ret == -EIOCBQUEUED ) { + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags);if (iovec)kfree (iovec);return IOU_ISSUE_SKIP_COMPLETE ;
@@ -795,6 +797,9 @@ static int __io_read(struct io_kiocb *re goto done; } + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags); + io = req->async_data; s = &io->s;/*
@@ -935,6 +940,11 @@ int io_write(struct io_kiocb *req, unsigelse ret2 = -EINVAL ; +if (ret2 == -EIOCBQUEUED ) { + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags); + } +if (req->flags &REQ_F_REISSUE ) { req->flags &= ~REQ_F_REISSUE ; ret2 = -EAGAIN ;
Greg Kroah-Hartman
maintainerPATCH 449/578 MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit ddd068d81445b17ac0bed084dfeb9e58b4df3ddd upstream.
Declare ftrace_get_parent_ra_addr() as static to suppress clang compiler warning that 'no previous prototype'. This function is not intended to be called from other parts.
Fix follow error with clang-19:
arch/mips/kernel/ftrace.c:251:15: error: no previous prototype for function 'ftrace_get_parent_ra_addr' [-Werror,-Wmissing-prototypes]
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^arch/mips/kernel/ftrace.c:251:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^
| static1 error generated.
--- arch/mips/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/ftrace.c +1 -1
@@ -248,7 +248,7 @@ int ftrace_disable_ftrace_graph_caller(v#define S_R_SP (0xafb0 << 16)/* s{d,w} R, offset(sp) */ #define OFFSET_MASK 0xffff/* stack offset range: 0 ~ PT_SIZE */ -unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long +static unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long old_parent_ra,unsigned long parent_ra_addr,unsigned long fp) {unsigned long sp, ip, tmp;
Greg Kroah-Hartman
maintainerPATCH 450/578 net/ncsi: use dev_set_mac_address() for Get MC MAC Address handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 05d91cdb1f9108426b14975ef4eeddf15875ca05 upstream.
Copy of the rationale from 790071347a0a1a89e618eedcd51c687ea783aeb3:
Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep using old one which set from network adapter driver.
As example, DHCP client from systemd do not update MAC address without notification from net subsystem which leads to the problem with acquiring the right address from DHCP server.
Since dev_set_mac_address requires RTNL lock the operation can not be performed directly in the response handler, see 9e2bbab94b88295dcc57c7580393c9ee08d7314d.
The way of selecting the first suitable MAC address from the list is changed, instead of having the driver check it this patch just assumes any valid MAC should be good.
--- net/ncsi/ncsi-rsp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
net/ncsi/ncsi-rsp.c +8 -10
@@ -1089,14 +1089,12 @@ static int ncsi_rsp_handler_netlink(strustatic int ncsi_rsp_handler_gmcma (struct ncsi_request *nr) {struct ncsi_dev_priv *ndp = nr->ndp; +struct sockaddr *saddr = &ndp->pending_mac;struct net_device *ndev = ndp->ndev.dev;struct ncsi_rsp_gmcma_pkt *rsp; -struct sockaddr saddr; -int ret =-1 ;int i; rsp = (struct ncsi_rsp_gmcma_pkt *)skb_network_header (nr->rsp); - saddr.sa_family = ndev->type; ndev->priv_flags |=IFF_LIVE_ADDR_CHANGE ; netdev_info(ndev, "NCSI: Received %d provisioned MAC addresses\n",
@@ -1108,20 +1106,20 @@ static int ncsi_rsp_handler_gmcma(struct rsp->addresses[i][4], rsp->addresses[i][5]); } + saddr->sa_family = ndev->type;for (i =0 ; i < rsp->address_count; i++) { -memcpy (saddr.sa_data, &rsp->addresses[i],ETH_ALEN ); - ret = ndev->netdev_ops->ndo_set_mac_address (ndev, &saddr); -if (ret <0 ) { +if (!is_valid_ether_addr (rsp->addresses[i])) {netdev_warn (ndev,"NCSI: Unable to assign %pM to device\n" , - saddr.sa_data); + rsp->addresses[i]);continue ; } -netdev_warn (ndev,"NCSI: Set MAC address to %pM\n" , saddr.sa_data); +memcpy (saddr->sa_data, rsp->addresses[i],ETH_ALEN ); +netdev_warn (ndev,"NCSI: Will set MAC address to %pM\n" , saddr->sa_data);break ; } - ndp->gma_flag = ret ==0 ; -return ret; + ndp->gma_flag =1 ; +return 0 ; } static struct ncsi_rsp_handler {
Greg Kroah-Hartman
maintainerPATCH 451/578 gpio: xilinx: remove excess kernel doc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 4c7fcbf5077532b80bc233c83d56e09a6bfa16b0 upstream.
The irqchip field has been removed from struct xgpio_instance so remove the doc as well.
--- drivers/gpio/gpio-xilinx.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpio/gpio-xilinx.c +0 -1
@@ -52,7 +52,6 @@* @dir: GPIO direction shadow register * @gpio_lock: Lock used for synchronization * @irq: IRQ used by GPIO device -* @irqchip: IRQ chip * @enable: GPIO IRQ enable/disable bitfield * @rising_edge: GPIO IRQ rising edge enable/disable bitfield * @falling_edge: GPIO IRQ falling edge enable/disable bitfield
Greg Kroah-Hartman
maintainerPATCH 452/578 ocfs2: check dir i_size in ocfs2_find_entry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b0fce54b8c0d8e5f2b4c243c803c5996e73baee8 upstream.
syz reports an out of bounds read:
==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334 [inline] BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802 CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Sched_ext: serialise (enabled+all), task: runnable_at=-10ms Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x164/0x530 mm/kasan/report.c:489 kasan_report+0x147/0x180 mm/kasan/report.c:602 ocfs2_match fs/ocfs2/dir.c:334 [inline] ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline] ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078 ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981 ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003 ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122 lookup_open fs/namei.c:3627 [inline] open_last_lookups fs/namei.c:3748 [inline] path_openat+0x145a/0x3870 fs/namei.c:3984 do_filp_open+0xe9/0x1c0 fs/namei.c:4014 do_sys_openat2+0x135/0x1d0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f01076903ad Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
</TASK> ==================================================================
And a general protection fault in ocfs2_prepare_dir_for_insert:
==================================================================
loop0: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted 6.11.0-rc4-syzkaller-00002-gb0da640826ba #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline] RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280 Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00 e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440 RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008 RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7 R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000 R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000 FS: 000055555a677380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292 vfs_mknod+0x36d/0x3b0 fs/namei.c:4088 do_mknodat+0x3ec/0x5b0 __do_sys_mknodat fs/namei.c:4166 [inline] __se_sys_mknodat fs/namei.c:4163 [inline] __x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2dafda3a99 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
0000000000000103
RAX: ffffffffffffffda RBX: 0000000000000000 RCX:00007f2dafda3a99
RDX: 00000000000021c0 RSI: 0000000020000040 RDI:00000000ffffff9c
RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:000055555a6784c0
R10: 0000000000000103 R11: 0000000000000246 R12:00007ffe336a6680
R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:00007f2dafdec03b
</TASK> ==================================================================
The two reports are all caused invalid negative i_size of dir inode. For ocfs2, dir_inode can't be negative or zero.
Here add a check in which is called by ocfs2_check_dir_for_entry(). It fixes the second report as ocfs2_check_dir_for_entry() must be called before ocfs2_prepare_dir_for_insert(). Also set a up limit for dir with OCFS2_INLINE_DATA_FL. The i_size can't be great than blocksize.
--- fs/ocfs2/dir.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +21 -4
@@ -1065,26 +1065,39 @@ int ocfs2_find_entry(const char *name, i {struct buffer_head *bh;struct ocfs2_dir_entry *res_dir =NULL ; +int ret =0 ;if (ocfs2_dir_indexed (dir))return ocfs2_find_entry_dx (name, namelen, dir, lookup); +if (unlikely (i_size_read (dir) <=0 )) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + }/* * The unindexed dir code only uses part of the lookup * structure, so there's no reason to push it down further * than this. */ -if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) +if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +if (unlikely (i_size_read (dir) > dir->i_sb->s_blocksize)) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + } bh =ocfs2_find_entry_id (name, namelen, dir, &res_dir); -else + }else { bh =ocfs2_find_entry_el (name, namelen, dir, &res_dir); + }if (bh ==NULL )return -ENOENT ; lookup->dl_leaf_bh = bh; lookup->dl_entry = res_dir; -return 0 ; +out: +return ret; }/*
@@ -2011,6 +2024,7 @@ int ocfs2_lookup_ino_from_name(struct in* * Return 0 if the name does not exist * Return -EEXIST if the directory contains the name +* Return -EFSCORRUPTED if found corruption * * Callers should have i_rwsem + a cluster lock on dir */
@@ -2024,9 +2038,12 @@ int ocfs2_check_dir_for_entry(struct inotrace_ocfs2_check_dir_for_entry ( (unsigned long long )OCFS2_I (dir)->ip_blkno, namelen, name); -if (ocfs2_find_entry (name, namelen, dir, &lookup) ==0 ) { + ret =ocfs2_find_entry (name, namelen, dir, &lookup); +if (ret ==0 ) { ret = -EEXIST ;mlog_errno (ret); + }else if (ret == -ENOENT ) { + ret =0 ; }ocfs2_free_dir_lookup_result (&lookup);
Greg Kroah-Hartman
maintainerPATCH 453/578 cachefiles: Fix NULL pointer dereference in object->file
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <[email protected]>
commit 31ad74b20227ce6b40910ff78b1c604e42975cf1 upstream.
At present, the object->file has the NULL pointer dereference problem in ondemand-mode. The root cause is that the allocated fd and object->file lifetime are inconsistent, and the user-space invocation to anon_fd uses object->file. Following is the process that triggers the issue:
[write fd] [umount]
cachefiles_ondemand_fd_write_iter
fscache_cookie_state_machine
cachefiles_withdraw_cookie
if (!file) return -ENOBUFS
cachefiles_clean_up_object cachefiles_unmark_inode_in_use fput(object->file) object->file = NULL
// file NULL pointer dereference!
__cachefiles_write(..., file, ...)
Fix this issue by add an additional reference count to the object->file before write/llseek, and decrement after it finished.
--- fs/cachefiles/interface.c | 14 ++++++++++---- fs/cachefiles/ondemand.c | 30 ++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-)
fs/cachefiles/interface.c +10 -4
@@ -327,6 +327,8 @@ static void cachefiles_commit_object(strstatic void cachefiles_clean_up_object (struct cachefiles_object *object,struct cachefiles_cache *cache) { +struct file *file; +if (test_bit (FSCACHE_COOKIE_RETIRED , &object->cookie->flags)) {if (!test_bit (CACHEFILES_OBJECT_USING_TMPFILE , &object->flags)) {cachefiles_see_object (object, cachefiles_obj_see_clean_delete);
@@ -342,10 +344,14 @@ static void cachefiles_clean_up_object(s }cachefiles_unmark_inode_in_use (object, object->file); -if (object->file) { -fput (object->file); - object->file =NULL ; - } + +spin_lock (&object->lock); + file = object->file; + object->file =NULL ; +spin_unlock (&object->lock); + +if (file) +fput (file); }/*
fs/cachefiles/ondemand.c +24 -6
@@ -61,20 +61,26 @@ static ssize_t cachefiles_ondemand_fd_wr {struct cachefiles_object *object = kiocb->ki_filp->private_data;struct cachefiles_cache *cache = object->volume->cache; -struct file *file = object->file; +struct file *file;size_t len = iter->count;loff_t pos = kiocb->ki_pos;const struct cred *saved_cred;int ret; -if (!file) +spin_lock (&object->lock); + file = object->file; +if (!file) { +spin_unlock (&object->lock);return -ENOBUFS ; + } +get_file (file); +spin_unlock (&object->lock);cachefiles_begin_secure (cache, &saved_cred); ret =__cachefiles_prepare_write (object, file, &pos, &len, true);cachefiles_end_secure (cache, saved_cred);if (ret <0 ) -return ret; + goto out;trace_cachefiles_ondemand_fd_write (object,file_inode (file), pos, len); ret =__cachefiles_write (object, file, pos, iter,NULL ,NULL );
@@ -83,6 +89,8 @@ static ssize_t cachefiles_ondemand_fd_wr kiocb->ki_pos += ret; } +out: +fput (file);return ret; }
@@ -90,12 +98,22 @@ static loff_t cachefiles_ondemand_fd_lls int whence) {struct cachefiles_object *object = filp->private_data; -struct file *file = object->file; +struct file *file; +loff_t ret; -if (!file) +spin_lock (&object->lock); + file = object->file; +if (!file) { +spin_unlock (&object->lock);return -ENOBUFS ; + } +get_file (file); +spin_unlock (&object->lock); -return vfs_llseek (file, pos, whence); + ret =vfs_llseek (file, pos, whence); +fput (file); + +return ret; } static long cachefiles_ondemand_fd_ioctl(struct file *filp, unsigned int ioctl,
Greg Kroah-Hartman
maintainerPATCH 454/578 mptcp: pm: only set fullmesh for subflow endp
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Matthieu Baerts (NGI0)" <[email protected]>
commit 1bb0d1348546ad059f55c93def34e67cb2a034a6 upstream.
With the in-kernel path-manager, it is possible to change the 'fullmesh' flag. The code in mptcp_pm_nl_fullmesh() expects to change it only on 'subflow' endpoints, to recreate more or less subflows using the linked address.
Unfortunately, the set_flags() hook was a bit more permissive, and allowed 'implicit' endpoints to get the 'fullmesh' flag while it is not allowed before.
That's what syzbot found, triggering the following warning:
WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 __mark_subflow_endp_available net/mptcp/pm_netlink.c:1496 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_pm_nl_fullmesh net/mptcp/pm_netlink.c:1980 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_nl_set_flags net/mptcp/pm_netlink.c:2003 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_pm_nl_set_flags+0x974/0xdc0 net/mptcp/pm_netlink.c:2064 Modules linked in: CPU: 0 UID: 0 PID: 6499 Comm: syz.1.413 Not tainted 6.13.0-rc5-syzkaller-00172-gd1bf27c4e176 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:__mark_subflow_endp_available net/mptcp/pm_netlink.c:1496 [inline] RIP: 0010:mptcp_pm_nl_fullmesh net/mptcp/pm_netlink.c:1980 [inline] RIP: 0010:mptcp_nl_set_flags net/mptcp/pm_netlink.c:2003 [inline] RIP: 0010:mptcp_pm_nl_set_flags+0x974/0xdc0 net/mptcp/pm_netlink.c:2064 Code: 01 00 00 49 89 c5 e8 fb 45 e8 f5 e9 b8 fc ff ff e8 f1 45 e8 f5 4c 89 f7 be 03 00 00 00 e8 44 1d 0b f9 eb a0 e8 dd 45 e8 f5 90 <0f> 0b 90 e9 17 ff ff ff 89 d9 80 e1 07 38 c1 0f 8c c9 fc ff ff 48 RSP: 0018:ffffc9000d307240 EFLAGS: 00010293 RAX: ffffffff8bb72e03 RBX: 0000000000000000 RCX: ffff88807da88000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc9000d307430 R08: ffffffff8bb72cf0 R09: 1ffff1100b842a5e R10: dffffc0000000000 R11: ffffed100b842a5f R12: ffff88801e2e5ac0 R13: ffff88805c214800 R14: ffff88805c2152e8 R15: 1ffff1100b842a5d FS: 00005555619f6500(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020002840 CR3: 00000000247e6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2542 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:726 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2583 ___sys_sendmsg net/socket.c:2637 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5fe8785d29 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff571f5558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f5fe8975fa0 RCX: 00007f5fe8785d29 RDX: 0000000000000000 RSI: 0000000020000480 RDI: 0000000000000007 RBP: 00007f5fe8801b08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f5fe8975fa0 R14: 00007f5fe8975fa0 R15: 00000000000011f4 </TASK>
Here, syzbot managed to set the 'fullmesh' flag on an 'implicit' and used -- according to 'id_avail_bitmap' -- endpoint, causing the PM to try decrement the local_addr_used counter which is only incremented for the 'subflow' endpoint.
Note that 'no type' endpoints -- not 'subflow', 'signal', 'implicit' -- are fine, because their ID will not be marked as used in the 'id_avail' bitmap, and setting 'fullmesh' can help forcing the creation of subflow when receiving an ADD_ADDR.
[ Conflicts in pm_netlink.c, because the code has been moved around in
commit 6a42477fe449 ("mptcp: update set_flags interfaces"), but the same fix can still be applied at the original place. ]
--- net/mptcp/pm_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/pm_netlink.c +2 -1
@@ -2086,7 +2086,8 @@ static int mptcp_nl_cmd_set_flags(structreturn -EINVAL ; }if ((addr.flags &MPTCP_PM_ADDR_FLAG_FULLMESH ) && - (entry->flags &MPTCP_PM_ADDR_FLAG_SIGNAL )) { + (entry->flags & (MPTCP_PM_ADDR_FLAG_SIGNAL | +MPTCP_PM_ADDR_FLAG_IMPLICIT ))) {spin_unlock_bh (&pernet->lock);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 455/578 mptcp: prevent excessive coalescing on receive
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 56b824eb49d6258aa0bad09a406ceac3f643cdae upstream.
Currently the skb size after coalescing is only limited by the skb layout (the skb must not carry frag_list). A single coalesced skb covering several MSS can potentially fill completely the receive buffer. In such a case, the snd win will zero until the receive buffer will be empty again, affecting tput badly.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -149,6 +149,7 @@ static bool mptcp_try_coalesce(struct soint delta;if (MPTCP_SKB_CB (from)->offset || + ((to->len + from->len) > (sk->sk_rcvbuf >>3 )) || !skb_try_coalesce (to, from, &fragstolen, &delta))return false;
Greg Kroah-Hartman
maintainerPATCH 456/578 tty: xilinx_uartps: split sysrq handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
commit b06f388994500297bb91be60ffaf6825ecfd2afe upstream.
lockdep detects the following circular locking dependency:
CPU 0 CPU 1
========================== ============================cdns_uart_isr() printk()
uart_port_lock(port) console_lock()
cdns_uart_console_write()
if (!port->sysrq)
uart_port_lock(port)
uart_handle_break()
port->sysrq = ... uart_handle_sysrq_char()
printk()
console_lock()
The fixed commit attempts to avoid this situation by only taking the port lock in cdns_uart_console_write if port->sysrq unset. However, if (as shown above) cdns_uart_console_write runs before port->sysrq is set, then it will try to take the port lock anyway. This may result in a deadlock.
Fix this by splitting sysrq handling into two parts. We use the prepare helper under the port lock and defer handling until we release the lock.
--- drivers/tty/serial/xilinx_uartps.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/tty/serial/xilinx_uartps.c +4 -6
@@ -268,7 +268,7 @@ static void cdns_uart_handle_rx(void *decontinue ; } -if (uart_handle_sysrq_char (port, data)) +if (uart_prepare_sysrq_char (port, data))continue ;if (is_rxbs_support) {
@@ -371,7 +371,7 @@ static irqreturn_t cdns_uart_isr(int irq !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS))cdns_uart_handle_rx (dev_id, isrstatus); -spin_unlock (&port->lock); +uart_unlock_and_check_sysrq (port);return IRQ_HANDLED ; }
@@ -1231,10 +1231,8 @@ static void cdns_uart_console_write(struunsigned int imr, ctrl;int locked =1 ; -if (port->sysrq) - locked =0 ; -else if (oops_in_progress) - locked =spin_trylock_irqsave (&port->lock, flags); +if (oops_in_progress) + locked =uart_port_trylock_irqsave (port, &flags);else spin_lock_irqsave (&port->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 457/578 maple_tree: fix static analyser cppcheck issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam R. Howlett <[email protected]>
commit 5729e06c819184b7ba40869c1ad53e1a463040b2 upstream.
Patch series "Maple tree mas_{next,prev}_range() and cleanup", v4.
This patchset contains a number of clean ups to the code to make it more usable (next/prev range), the addition of debug output formatting, the addition of printing the maple state information in the WARN_ON/BUG_ON code.
There is also work done here to keep nodes active during iterations to reduce the necessity of re-walking the tree.
Finally, there is a new interface added to move to the next or previous range in the tree, even if it is empty.
The organisation of the patches is as follows:
0001-0004 - Small clean ups
0005-0018 - Additional debug options and WARN_ON/BUG_ON changes
0019 - Test module __init and __exit addition
0020-0021 - More functional clean ups
0022-0026 - Changes to keep nodes active
0027-0034 - Add new mas_{prev,next}_range()
0035 - Use new mas_{prev,next}_range() in mmap_region()
This patch (of 35):
Static analyser of the maple tree code noticed that the split variable is being used to dereference into an array prior to checking the variable itself. Fix this issue by changing the order of the statement to check the variable first.
--- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/maple_tree.c +3 -2
@@ -1935,8 +1935,9 @@ static inline int mab_calc_split(struct* causes one node to be deficient. * NOTE: mt_min_slots is 1 based, b_end and split are zero. */ -while (((bn->pivot[split] - min) < slot_count -1 ) && - (split < slot_count -1 ) && (b_end - split > slot_min)) +while ((split < slot_count -1 ) && + ((bn->pivot[split] - min) < slot_count -1 ) && + (b_end - split > slot_min)) split++; }
Greg Kroah-Hartman
maintainerPATCH 458/578 maple_tree: simplify split calculation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yang <[email protected]>
commit 4f6a6bed0bfef4b966f076f33eb4f5547226056a upstream.
Patch series "simplify split calculation", v3.
This patch (of 3):
The current calculation for splitting nodes tries to enforce a minimum span on the leaf nodes. This code is complex and never worked correctly to begin with, due to the min value being passed as 0 for all leaves.
The calculation should just split the data as equally as possible between the new nodes. Note that b_end will be one more than the data, so the left side is still favoured in the calculation.
The current code may also lead to a deficient node by not leaving enough data for the right side of the split. This issue is also addressed with the split calculation change.
--- lib/maple_tree.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
lib/maple_tree.c +6 -17
@@ -1890,11 +1890,11 @@ static inline int mab_no_null_split(stru* Return: The first split location. The middle split is set in @mid_split. */ static inline int mab_calc_split (struct ma_state *mas, -struct maple_big_node *bn,unsigned char *mid_split,unsigned long min) +struct maple_big_node *bn,unsigned char *mid_split) {unsigned char b_end = bn->b_end;int split = b_end /2 ;/* Assume equal split. */ -unsigned char slot_min, slot_count = mt_slots[bn->type]; +unsigned char slot_count = mt_slots[bn->type];/* * To support gap tracking, all NULL entries are kept together and a node cannot
@@ -1927,18 +1927,7 @@ static inline int mab_calc_split(struct split = b_end /3 ; *mid_split = split *2 ; }else { - slot_min = mt_min_slots[bn->type]; - *mid_split =0 ; -/* -* Avoid having a range less than the slot count unless it -* causes one node to be deficient. -* NOTE: mt_min_slots is 1 based, b_end and split are zero. -*/ -while ((split < slot_count -1 ) && - ((bn->pivot[split] - min) < slot_count -1 ) && - (b_end - split > slot_min)) - split++; }/* Avoid ending a node on a NULL entry */
@@ -2664,7 +2653,7 @@ static inline struct maple_enodestatic inline unsigned char mas_mab_to_node (struct ma_state *mas,struct maple_big_node *b_node,struct maple_enode **left,struct maple_enode **right,struct maple_enode **middle, -unsigned char *mid_split,unsigned long min) +unsigned char *mid_split) {unsigned char split =0 ;unsigned char slot_count = mt_slots[b_node->type];
@@ -2677,7 +2666,7 @@ static inline unsigned char mas_mab_to_nif (b_node->b_end < slot_count) { split = b_node->b_end; }else { - split =mab_calc_split (mas, b_node, mid_split, min); + split =mab_calc_split (mas, b_node, mid_split); *right =mas_new_ma_node (mas, b_node); }
@@ -3076,7 +3065,7 @@ static int mas_spanning_rebalance(struct mast->bn->b_end--; mast->bn->type =mte_node_type (mast->orig_l->node); split =mas_mab_to_node (mas, mast->bn, &left, &right, &middle, - &mid_split, mast->orig_l->min); + &mid_split);mast_set_split_parents (mast, left, middle, right, split, mid_split);mast_cp_to_nodes (mast, left, middle, right, split, mid_split);
@@ -3591,7 +3580,7 @@ static int mas_split(struct ma_state *maif (mas_push_data (mas, height, &mast, false))break ; - split =mab_calc_split (mas, b_node, &mid_split, prev_l_mas.min); + split =mab_calc_split (mas, b_node, &mid_split);mast_split_data (&mast, mas, split);/* * Usually correct, mab_mas_cp in the above call overwrites
Greg Kroah-Hartman
maintainerPATCH 459/578 pps: Fix a use-after-free
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calvin Owens <[email protected]>
commit c79a39dc8d060b9e64e8b0fa9d245d44befeefbe upstream.
On a board running ntpd and gpsd, I'm seeing a consistent use-after-free in sys_exit() from gpsd when rebooting:
pps pps1: removed
------------[ cut here ]------------
kobject: '(null)' (00000000db4bec24): is not initialized, yet kobject_put() is being called.
WARNING: CPU: 2 PID: 440 at lib/kobject.c:734 kobject_put+0x120/0x150
CPU: 2 UID: 299 PID: 440 Comm: gpsd Not tainted 6.11.0-rc6-00308-gb31c44928842 #1
Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : kobject_put+0x120/0x150
lr : kobject_put+0x120/0x150
sp : ffffffc0803d3ae0
x29: ffffffc0803d3ae0 x28: ffffff8042dc9738 x27: 0000000000000001
x26: 0000000000000000 x25: ffffff8042dc9040 x24: ffffff8042dc9440
x23: ffffff80402a4620 x22: ffffff8042ef4bd0 x21: ffffff80405cb600
x20: 000000000008001b x19: ffffff8040b3b6e0 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 696e6920746f6e20
x14: 7369203a29343263 x13: 205d303434542020 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
kobject_put+0x120/0x150
cdev_put+0x20/0x3c
__fput+0x2c4/0x2d8
____fput+0x1c/0x38
task_work_run+0x70/0xfc
do_exit+0x2a0/0x924
do_group_exit+0x34/0x90
get_signal+0x7fc/0x8c0
do_signal+0x128/0x13b4
do_notify_resume+0xdc/0x160
el0_svc+0xd4/0xf8
el0t_64_sync_handler+0x140/0x14c
el0t_64_sync+0x190/0x194
---[ end trace 0000000000000000 ]---...followed by more symptoms of corruption, with similar stacks:
refcount_t: underflow; use-after-free.
kernel BUG at lib/list_debug.c:62!
Kernel panic - not syncing: Oops - BUG: Fatal exception
This happens because pps_device_destruct() frees the pps_device with the embedded cdev immediately after calling cdev_del(), but, as the comment above cdev_del() notes, fops for previously opened cdevs are still callable even after cdev_del() returns. I think this bug has always been there: I can't explain why it suddenly started happening every time I reboot this particular board.
In commit d953e0e837e6 ("pps: Fix a use-after free bug when unregistering a source."), George Spelvin suggested removing the embedded cdev. That seems like the simplest way to fix this, so I've implemented his suggestion, using __register_chrdev() with pps_idr becoming the source of truth for which minor corresponds to which device.
But now that pps_idr defines userspace visibility instead of cdev_add(), we need to be sure the pps->dev refcount can't reach zero while userspace can still find it again. So, the idr_remove() call moves to pps_unregister_cdev(), and pps_idr now holds a reference to pps->dev.
pps_core: source serial1 got cdev (251:1)
<...>
pps pps1: removed
pps_core: unregistering pps1
pps_core: deallocating pps1
--- drivers/pps/clients/pps-gpio.c | 4 - drivers/pps/clients/pps-ktimer.c | 4 - drivers/pps/clients/pps-ldisc.c | 6 - drivers/pps/clients/pps_parport.c | 4 - drivers/pps/kapi.c | 10 +- drivers/pps/kc.c | 10 +- drivers/pps/pps.c | 127 +++++++++++++++++++------------------- drivers/ptp/ptp_ocp.c | 2 include/linux/pps_kernel.h | 3 9 files changed, 87 insertions(+), 83 deletions(-)
drivers/pps/clients/pps-gpio.c +2 -2
@@ -214,8 +214,8 @@ static int pps_gpio_probe(struct platforreturn -EINVAL ; } -dev_info (data->pps->dev,"Registered IRQ %d as PPS source\n" , - data->irq); +dev_dbg (&data->pps->dev,"Registered IRQ %d as PPS source\n" , + data->irq);return 0 ; }
drivers/pps/clients/pps-ktimer.c +2 -2
@@ -56,7 +56,7 @@ static struct pps_source_info pps_ktimer static void __exit pps_ktimer_exit(void) { -dev_info (pps->dev,"ktimer PPS source unregistered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source unregistered\n" );del_timer_sync (&ktimer);pps_unregister_source (pps);
@@ -74,7 +74,7 @@ static int __init pps_ktimer_init(void)timer_setup (&ktimer, pps_ktimer_event,0 );mod_timer (&ktimer, jiffies +HZ ); -dev_info (pps->dev,"ktimer PPS source registered\n" ); +dev_dbg (&pps->dev,"ktimer PPS source registered\n" );return 0 ; }
drivers/pps/clients/pps-ldisc.c +3 -3
@@ -32,7 +32,7 @@ static void pps_tty_dcd_change(struct ttpps_event (pps, &ts, active ?PPS_CAPTUREASSERT :PPS_CAPTURECLEAR ,NULL ); -dev_dbg (pps->dev,"PPS %s at %lu\n" , +dev_dbg (&pps->dev,"PPS %s at %lu\n" , active ?"assert" :"clear" , jiffies); }
@@ -69,7 +69,7 @@ static int pps_tty_open(struct tty_struc goto err_unregister; } -dev_info (pps->dev,"source \"%s\" added\n" , info.path); +dev_dbg (&pps->dev,"source \"%s\" added\n" , info.path);return 0 ;
@@ -89,7 +89,7 @@ static void pps_tty_close(struct tty_strif (WARN_ON (!pps))return ; -dev_info (pps->dev,"removed\n" ); +dev_info (&pps->dev,"removed\n" );pps_unregister_source (pps); }
drivers/pps/clients/pps_parport.c +2 -2
@@ -81,7 +81,7 @@ static void parport_irq(void *handle)/* check the signal (no signal means the pulse is lost this time) */ if (!signal_is_set (port)) {local_irq_restore (flags); -dev_err (dev->pps->dev,"lost the signal\n" ); +dev_err (&dev->pps->dev,"lost the signal\n" ); goto out_assert; }
@@ -98,7 +98,7 @@ static void parport_irq(void *handle)/* timeout */ dev->cw_err++;if (dev->cw_err >=CLEAR_WAIT_MAX_ERRORS ) { -dev_err (dev->pps->dev,"disabled clear edge capture after %d" +dev_err (&dev->pps->dev,"disabled clear edge capture after %d" " timeouts\n" , dev->cw_err); dev->cw =0 ; dev->cw_err =0 ;
drivers/pps/kapi.c +5 -5
@@ -41,7 +41,7 @@ static void pps_add_offset(struct pps_ktstatic void pps_echo_client_default (struct pps_device *pps,int event,void *data) { -dev_info (pps->dev,"echo %s %s\n" , +dev_info (&pps->dev,"echo %s %s\n" , event &PPS_CAPTUREASSERT ?"assert" :"" , event &PPS_CAPTURECLEAR ?"clear" :"" ); }
@@ -112,7 +112,7 @@ struct pps_device *pps_register_source(s goto kfree_pps; } -dev_info (pps->dev,"new PPS source %s\n" , info->name); +dev_dbg (&pps->dev,"new PPS source %s\n" , info->name);return pps;
@@ -166,7 +166,7 @@ void pps_event(struct pps_device *pps, s/* check event type */ BUG_ON ((event & (PPS_CAPTUREASSERT |PPS_CAPTURECLEAR )) ==0 ); -dev_dbg (pps->dev,"PPS event at %lld.%09ld\n" , +dev_dbg (&pps->dev,"PPS event at %lld.%09ld\n" , (s64 )ts->ts_real.tv_sec, ts->ts_real.tv_nsec);timespec_to_pps_ktime (&ts_real, ts->ts_real);
@@ -188,7 +188,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->assert_tu = ts_real; pps->assert_sequence++; -dev_dbg (pps->dev,"capture assert seq #%u\n" , +dev_dbg (&pps->dev,"capture assert seq #%u\n" , pps->assert_sequence); captured = ~0 ;
@@ -202,7 +202,7 @@ void pps_event(struct pps_device *pps, s/* Save the time stamp */ pps->clear_tu = ts_real; pps->clear_sequence++; -dev_dbg (pps->dev,"capture clear seq #%u\n" , +dev_dbg (&pps->dev,"capture clear seq #%u\n" , pps->clear_sequence); captured = ~0 ;
drivers/pps/kc.c +5 -5
@@ -43,11 +43,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel" +dev_info (&pps->dev,"unbound kernel" " consumer\n" ); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"selected kernel consumer" +dev_err (&pps->dev,"selected kernel consumer" " is not bound\n" );return -EINVAL ; }
@@ -57,11 +57,11 @@ int pps_kc_bind(struct pps_device *pps, pps_kc_hardpps_mode = bind_args->edge; pps_kc_hardpps_dev = pps;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"bound kernel consumer: " +dev_info (&pps->dev,"bound kernel consumer: " "edge=0x%x\n" , bind_args->edge); }else {spin_unlock_irq (&pps_kc_hardpps_lock); -dev_err (pps->dev,"another kernel consumer" +dev_err (&pps->dev,"another kernel consumer" " is already bound\n" );return -EINVAL ; }
@@ -83,7 +83,7 @@ void pps_kc_remove(struct pps_device *pp pps_kc_hardpps_mode =0 ; pps_kc_hardpps_dev =NULL ;spin_unlock_irq (&pps_kc_hardpps_lock); -dev_info (pps->dev,"unbound kernel consumer" +dev_info (&pps->dev,"unbound kernel consumer" " on device removal\n" ); }else spin_unlock_irq (&pps_kc_hardpps_lock);
drivers/pps/pps.c +66 -61
288 lines not on this page · raw message
drivers/ptp/ptp_ocp.c +1 -1
@@ -3589,7 +3589,7 @@ ptp_ocp_complete(struct ptp_ocp *bp) pps =pps_lookup_dev (bp->ptp);if (pps) -ptp_ocp_symlink (bp, pps->dev,"pps" ); +ptp_ocp_symlink (bp, &pps->dev,"pps" );ptp_ocp_debugfs_add_device (bp);
include/linux/pps_kernel.h +1 -2
@@ -56,8 +56,7 @@ struct pps_device {unsigned int id;/* PPS source unique ID */ void const *lookup_cookie;/* For pps_lookup_dev() only */ -struct cdev cdev; -struct device *dev; +struct device dev;struct fasync_struct *async_queue;/* fasync method */ spinlock_t lock; };
Greg Kroah-Hartman
maintainerPATCH 460/578 Revert "btrfs: avoid monopolizing a core when activating a swap file"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
This reverts commit bb8e287f596b62fac18ed84cc03a9f1752f6b3b8.
The backport for linux-6.1.y, commit bb8e287f596b ("btrfs: avoid monopolizing a core when activating a swap file"), inserted cond_resched() in the wrong location.
Revert it now; a subsequent commit will re-backport the original patch.
--- fs/btrfs/inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/inode.c +0 -2
@@ -7387,8 +7387,6 @@ noinline int can_nocow_extent(struct ino ret = -EAGAIN ; goto out; } - -cond_resched (); }if (orig_start)
Greg Kroah-Hartman
maintainerPATCH 461/578 btrfs: avoid monopolizing a core when activating a swap file
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
This commit re-attempts the backport of the change to the linux-6.1.y branch. Commit bb8e287f596b ("btrfs: avoid monopolizing a core when activating a swap file") on this branch was reverted.
During swap activation we iterate over the extents of a file and we can have many thousands of them, so we can end up in a busy loop monopolizing a core. Avoid this by doing a voluntary reschedule after processing each extent.
--- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/inode.c +2 -0
@@ -11368,6 +11368,8 @@ static int btrfs_swap_activate(struct sw } start += len; + +cond_resched (); }if (bsi.block_len)
Greg Kroah-Hartman
maintainerPATCH 462/578 nfsd: clear acl_access/acl_default after releasing them
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
commit 7faf14a7b0366f153284db0ad3347c457ea70136 upstream.
If getting acl_default fails, acl_access and acl_default will be released simultaneously. However, acl_access will still retain a pointer pointing to the released posix_acl, which will trigger a WARNING in nfs3svc_release_getacl like this:
------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 26 PID: 3199 at lib/refcount.c:28 refcount_warn_saturate+0xb5/0x170 Modules linked in: CPU: 26 UID: 0 PID: 3199 Comm: nfsd Not tainted 6.12.0-rc6-00079-g04ae226af01f-dirty #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:refcount_warn_saturate+0xb5/0x170 Code: cc cc 0f b6 1d b3 20 a5 03 80 fb 01 0f 87 65 48 d8 00 83 e3 01 75 e4 48 c7 c7 c0 3b 9b 85 c6 05 97 20 a5 03 01 e8 fb 3e 30 ff <0f> 0b eb cd 0f b6 1d 8a3 RSP: 0018:ffffc90008637cd8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff83904fde RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88871ed36380 RBP: ffff888158beeb40 R08: 0000000000000001 R09: fffff520010c6f56 R10: ffffc90008637ab7 R11: 0000000000000001 R12: 0000000000000001 R13: ffff888140e77400 R14: ffff888140e77408 R15: ffffffff858b42c0 FS: 0000000000000000(0000) GS:ffff88871ed00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000562384d32158 CR3: 000000055cc6a000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? refcount_warn_saturate+0xb5/0x170 ? __warn+0xa5/0x140 ? refcount_warn_saturate+0xb5/0x170 ? report_bug+0x1b1/0x1e0 ? handle_bug+0x53/0xa0 ? exc_invalid_op+0x17/0x40 ? asm_exc_invalid_op+0x1a/0x20 ? tick_nohz_tick_stopped+0x1e/0x40 ? refcount_warn_saturate+0xb5/0x170 ? refcount_warn_saturate+0xb5/0x170 nfs3svc_release_getacl+0xc9/0xe0 svc_process_common+0x5db/0xb60 ? __pfx_svc_process_common+0x10/0x10 ? __rcu_read_unlock+0x69/0xa0 ? __pfx_nfsd_dispatch+0x10/0x10 ? svc_xprt_received+0xa1/0x120 ? xdr_init_decode+0x11d/0x190 svc_process+0x2a7/0x330 svc_handle_xprt+0x69d/0x940 svc_recv+0x180/0x2d0 nfsd+0x168/0x200 ? __pfx_nfsd+0x10/0x10 kthread+0x1a2/0x1e0 ? kthread+0xf4/0x1e0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x60 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Kernel panic - not syncing: kernel: panic_on_warn set ...
Clear acl_access/acl_default after posix_acl_release is called to prevent UAF from being triggered.
--- fs/nfsd/nfs2acl.c | 2 ++ fs/nfsd/nfs3acl.c | 2 ++ 2 files changed, 4 insertions(+)
fs/nfsd/nfs2acl.c +2 -0
@@ -84,6 +84,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
fs/nfsd/nfs3acl.c +2 -0
@@ -76,6 +76,8 @@ out: fail:posix_acl_release (resp->acl_access);posix_acl_release (resp->acl_default); + resp->acl_access =NULL ; + resp->acl_default =NULL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 463/578 NFSD: fix hang in nfsd4_shutdown_callback
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
commit 036ac2778f7b28885814c6fbc07e156ad1624d03 upstream.
If nfs4_client is in courtesy state then there is no point to send the callback. This causes nfsd4_shutdown_callback to hang since cl_cb_inflight is not 0. This hang lasts about 15 minutes until TCP notifies NFSD that the connection was dropped.
This patch modifies nfsd4_run_cb_work to skip the RPC call if nfs4_client is in courtesy state.
--- fs/nfsd/nfs4callback.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfsd/nfs4callback.c +5 -2
@@ -1410,8 +1410,11 @@ nfsd4_run_cb_work(struct work_struct *wonfsd4_process_cb_update (cb); clnt = clp->cl_cb_client; -if (!clnt) { -/* Callback channel broken, or client killed; give up: */ +if (!clnt || clp->cl_state ==NFSD4_COURTESY ) { +/* +* Callback channel broken, client killed or +* nfs4_client in courtesy state; give up. +*/ nfsd41_destroy_cb (cb);return ; }
Greg Kroah-Hartman
maintainerPATCH 464/578 pinctrl: cy8c95x0: Respect IRQ trigger settings from firmware
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 1ddee69108d305bbc059cbf31c0b47626796be77 ]
Some of the platforms may connect the INT pin via inversion logic effectively make the triggering to be active-low.
Remove explicit trigger flag to respect the settings from firmware.
Without this change even idling chip produces spurious interrupts and kernel disables the line in the result:
irq 33: nobody cared (try booting with the "irqpoll" option)
CPU: 0 UID: 0 PID: 125 Comm: irq/33-i2c-INT3 Not tainted 6.12.0-00236-g8b874ed11dae #64 Hardware name: Intel Corp. QUARK/Galileo, BIOS 0x01000900 01/01/2014 ... handlers: [<86e86bea>] irq_default_primary_handler threaded [<d153e44a>] cy8c95x0_irq_handler [pinctrl_cy8c95x0] Disabling IRQ #33
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
@@ -1234,7 +1234,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) ret =devm_request_threaded_irq (chip->dev, irq,NULL , cy8c95x0_irq_handler, -IRQF_ONESHOT |IRQF_SHARED |IRQF_TRIGGER_HIGH , +IRQF_ONESHOT |IRQF_SHARED ,dev_name (chip->dev), chip);if (ret) {dev_err (chip->dev,"failed to request irq %d\n" , irq);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 465/578 HID: multitouch: Add NULL check in mt_input_configured
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 9b8e2220d3a052a690b1d1b23019673e612494c5 ]
devm_kasprintf() can return a NULL pointer on failure,but this returned value in mt_input_configured() is not checked. Add NULL check in mt_input_configured(), to handle kernel NULL pointer dereference error.
--- drivers/hid/hid-multitouch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +4 -1
@@ -1668,9 +1668,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) +if (suffix) { hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL ,"%s %s" , hdev->name, suffix); +if (!hi->input->name) +return -ENOMEM ; + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 466/578 HID: hid-thrustmaster: fix stack-out-of-bounds read in usb_check_int_endpoints()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tulio Fernandes <[email protected]>
[ Upstream commit 0b43d98ff29be3144e86294486b1373b5df74c0e ]
Syzbot[1] has detected a stack-out-of-bounds read of the ep_addr array from hid-thrustmaster driver. This array is passed to usb_check_int_endpoints function from usb.c core driver, which executes a for loop that iterates over the elements of the passed array. Not finding a null element at the end of the array, it tries to read the next, non-existent element, crashing the kernel.
To fix this, a 0 element was added at the end of the array to break the for loop.
[1] https://syzkaller.appspot.com/bug?extid=9c9179ac46169c56c1ad
--- drivers/hid/hid-thrustmaster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-thrustmaster.c +1 -1
@@ -171,7 +171,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev) b_ep = ep->desc.bEndpointAddress;/* Are the expected endpoints present? */ -u8 ep_addr[1 ] = {b_ep}; +u8 ep_addr[2 ] = {b_ep,0 };if (!usb_check_int_endpoints (usbif, ep_addr)) {hid_err (hdev,"Unexpected non-int endpoint\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 467/578 ax25: Fix refcount leak caused by setting SO_BINDTODEVICE sockopt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit bca0902e61731a75fc4860c8720168d9f1bae3b6 ]
If an AX25 device is bound to a socket by setting the SO_BINDTODEVICE socket option, a refcount leak will occur in ax25_release().
Commit 9fd75b66b8f6 ("ax25: Fix refcount leaks caused by ax25_cb_del()") added decrement of device refcounts in ax25_release(). In order for that to work correctly the refcounts must already be incremented when the device is bound to the socket. An AX25 device can be bound to a socket by either calling ax25_bind() or setting SO_BINDTODEVICE socket option. In both cases the refcounts should be incremented, but in fact it is done only in ax25_bind().
This bug leads to the following issue reported by Syzkaller:
================================================================refcount_t: decrement hit 0; leaking memory.
WARNING: CPU: 1 PID: 5932 at lib/refcount.c:31 refcount_warn_saturate+0x1ed/0x210 lib/refcount.c:31 Modules linked in: CPU: 1 UID: 0 PID: 5932 Comm: syz-executor424 Not tainted 6.13.0-rc4-syzkaller-00110-g4099a71718b0 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:refcount_warn_saturate+0x1ed/0x210 lib/refcount.c:31 Call Trace: <TASK> __refcount_dec include/linux/refcount.h:336 [inline] refcount_dec include/linux/refcount.h:351 [inline] ref_tracker_free+0x710/0x820 lib/ref_tracker.c:236 netdev_tracker_free include/linux/netdevice.h:4156 [inline] netdev_put include/linux/netdevice.h:4173 [inline] netdev_put include/linux/netdevice.h:4169 [inline] ax25_release+0x33f/0xa10 net/ax25/af_ax25.c:1069 __sock_release+0xb0/0x270 net/socket.c:640 sock_close+0x1c/0x30 net/socket.c:1408 ... do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f ... </TASK> ================================================================
Fix the implementation of ax25_setsockopt() by adding increment of refcounts for the new device bound, and decrement of refcounts for the old unbound device.
--- net/ax25/af_ax25.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/ax25/af_ax25.c +11 -0
@@ -685,6 +685,15 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ; } +if (ax25->ax25_dev) { +if (dev == ax25->ax25_dev->dev) { +rcu_read_unlock (); +break ; + } +netdev_put (ax25->ax25_dev->dev, &ax25->dev_tracker); +ax25_dev_put (ax25->ax25_dev); + } + ax25->ax25_dev =ax25_dev_ax25dev (dev);if (!ax25->ax25_dev) {rcu_read_unlock ();
@@ -692,6 +701,8 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ; }ax25_fillin_cb (ax25, ax25->ax25_dev); +netdev_hold (dev, &ax25->dev_tracker,GFP_ATOMIC ); +ax25_dev_hold (ax25->ax25_dev);rcu_read_unlock ();break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 468/578 ndisc: ndisc_send_redirect() must use dev_get_by_index_rcu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 48145a57d4bbe3496e8e4880b23ea6b511e6e519 ]
ndisc_send_redirect() is called under RCU protection, not RTNL.
It must use dev_get_by_index_rcu() instead of __dev_get_by_index()
--- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ndisc.c +1 -1
@@ -1684,7 +1684,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)bool ret;if (netif_is_l3_master (skb->dev)) { - dev =__dev_get_by_index (dev_net (skb->dev),IPCB (skb)->iif); + dev =dev_get_by_index_rcu (dev_net (skb->dev),IPCB (skb)->iif);if (!dev)return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 469/578 vrf: use RCU protection in l3mdev_l3_out()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6d0ce46a93135d96b7fa075a94a88fe0da8e8773 ]
l3mdev_l3_out() can be called without RCU being held:
raw_sendmsg()
ip_push_pending_frames()
ip_send_skb()
ip_local_out()
__ip_local_out()
l3mdev_ip_out()Add rcu_read_lock() / rcu_read_unlock() pair to avoid a potential UAF.
--- include/net/l3mdev.h | 2 ++ 1 file changed, 2 insertions(+)
include/net/l3mdev.h +2 -0
@@ -198,10 +198,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto)if (netif_is_l3_slave (dev)) {struct net_device *master; +rcu_read_lock (); master =netdev_master_upper_dev_get_rcu (dev);if (master && master->l3mdev_ops->l3mdev_l3_out) skb = master->l3mdev_ops->l3mdev_l3_out (master, sk, skb, proto); +rcu_read_unlock (); }return skb;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 470/578 vxlan: check vxlan_vnigroup_init() return value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5805402dcc56241987bca674a1b4da79a249bab7 ]
vxlan_init() must check vxlan_vnigroup_init() success otherwise a crash happens later, spotted by syzbot.
Oops: general protection fault, probably for non-canonical address 0xdffffc000000002c: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000160-0x0000000000000167] CPU: 0 UID: 0 PID: 7313 Comm: syz-executor147 Not tainted 6.14.0-rc1-syzkaller-00276-g69b54314c975 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:vxlan_vnigroup_uninit+0x89/0x500 drivers/net/vxlan/vxlan_vnifilter.c:912 Code: 00 48 8b 44 24 08 4c 8b b0 98 41 00 00 49 8d 86 60 01 00 00 48 89 c2 48 89 44 24 10 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 4d 04 00 00 49 8b 86 60 01 00 00 48 ba 00 00 00 RSP: 0018:ffffc9000cc1eea8 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff8672effb RDX: 000000000000002c RSI: ffffffff8672ecb9 RDI: ffff8880461b4f18 RBP: ffff8880461b4ef4 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000020000 R13: ffff8880461b0d80 R14: 0000000000000000 R15: dffffc0000000000 FS: 00007fecfa95d6c0(0000) GS:ffff88806a600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fecfa95cfb8 CR3: 000000004472c000 CR4: 0000000000352ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> vxlan_uninit+0x1ab/0x200 drivers/net/vxlan/vxlan_core.c:2942 unregister_netdevice_many_notify+0x12d6/0x1f30 net/core/dev.c:11824 unregister_netdevice_many net/core/dev.c:11866 [inline] unregister_netdevice_queue+0x307/0x3f0 net/core/dev.c:11736 register_netdevice+0x1829/0x1eb0 net/core/dev.c:10901 __vxlan_dev_create+0x7c6/0xa30 drivers/net/vxlan/vxlan_core.c:3981 vxlan_newlink+0xd1/0x130 drivers/net/vxlan/vxlan_core.c:4407 rtnl_newlink_create net/core/rtnetlink.c:3795 [inline] __rtnl_newlink net/core/rtnetlink.c:3906 [inline]
--- drivers/net/vxlan/vxlan_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/vxlan/vxlan_core.c +5 -2
@@ -2982,8 +2982,11 @@ static int vxlan_init(struct net_device *dev)struct vxlan_dev *vxlan =netdev_priv (dev);int err; -if (vxlan->cfg.flags &VXLAN_F_VNIFILTER ) -vxlan_vnigroup_init (vxlan); +if (vxlan->cfg.flags &VXLAN_F_VNIFILTER ) { + err =vxlan_vnigroup_init (vxlan); +if (err) +return err; + } dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);if (!dev->tstats) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 471/578 team: better TEAM_OPTION_TYPE_STRING validation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5bef3ac184b5626ea62385d6b82a1992b89d7940 ]
syzbot reported following splat [1]
Make sure user-provided data contains one nul byte.
[1]
BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:633 [inline] BUG: KMSAN: uninit-value in string+0x3ec/0x5f0 lib/vsprintf.c:714 string_nocheck lib/vsprintf.c:633 [inline] string+0x3ec/0x5f0 lib/vsprintf.c:714 vsnprintf+0xa5d/0x1960 lib/vsprintf.c:2843 __request_module+0x252/0x9f0 kernel/module/kmod.c:149 team_mode_get drivers/net/team/team_core.c:480 [inline] team_change_mode drivers/net/team/team_core.c:607 [inline] team_mode_option_set+0x437/0x970 drivers/net/team/team_core.c:1401 team_option_set drivers/net/team/team_core.c:375 [inline] team_nl_options_set_doit+0x1339/0x1f90 drivers/net/team/team_core.c:2662 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x1214/0x12c0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x375/0x650 net/netlink/af_netlink.c:2543 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline] netlink_unicast+0xf52/0x1260 net/netlink/af_netlink.c:1348 netlink_sendmsg+0x10da/0x11e0 net/netlink/af_netlink.c:1892 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:733 ____sys_sendmsg+0x877/0xb60 net/socket.c:2573 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2627 __sys_sendmsg net/socket.c:2659 [inline] __do_sys_sendmsg net/socket.c:2664 [inline] __se_sys_sendmsg net/socket.c:2662 [inline] __x64_sys_sendmsg+0x212/0x3c0 net/socket.c:2662 x64_sys_call+0x2ed6/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:47 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/net/team/team.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/team/team.c +3 -1
@@ -2670,7 +2670,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ctx.data.u32_val =nla_get_u32 (attr_data);break ;case TEAM_OPTION_TYPE_STRING : -if (nla_len (attr_data) >TEAM_STRING_MAX_LEN ) { +if (nla_len (attr_data) >TEAM_STRING_MAX_LEN || + !memchr (nla_data (attr_data),'\0' , +nla_len (attr_data))) { err = -EINVAL ; goto team_put; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 472/578 arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Rendec <[email protected]>
[ Upstream commit 875d742cf5327c93cba1f11e12b08d3cce7a88d2 ]
The loop that detects/populates cache information already has a bounds check on the array size but does not account for cache levels with separate data/instructions cache. Fix this by incrementing the index for any populated leaf (instead of any populated level).
--- arch/arm64/kernel/cacheinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/arm64/kernel/cacheinfo.c +7 -5
@@ -87,16 +87,18 @@ int populate_cache_leaves(unsigned int cpu)unsigned int level, idx;enum cache_type type;struct cpu_cacheinfo *this_cpu_ci =get_cpu_cacheinfo (cpu); -struct cacheinfo *this_leaf = this_cpu_ci->info_list; +struct cacheinfo *infos = this_cpu_ci->info_list;for (idx =0 , level =1 ; level <= this_cpu_ci->num_levels && - idx < this_cpu_ci->num_leaves; idx++, level++) { + idx < this_cpu_ci->num_leaves; level++) { type =get_cache_type (level);if (type ==CACHE_TYPE_SEPARATE ) { -ci_leaf_init (this_leaf++,CACHE_TYPE_DATA , level); -ci_leaf_init (this_leaf++,CACHE_TYPE_INST , level); +if (idx +1 >= this_cpu_ci->num_leaves) +break ; +ci_leaf_init (&infos[idx++],CACHE_TYPE_DATA , level); +ci_leaf_init (&infos[idx++],CACHE_TYPE_INST , level); }else { -ci_leaf_init (this_leaf++, type, level); +ci_leaf_init (&infos[idx++], type, level); } }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 473/578 cgroup: Remove steal time from usage_usec
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Adeel <[email protected]>
[ Upstream commit db5fd3cf8bf41b84b577b8ad5234ea95f327c9be ]
The CPU usage time is the time when user, system or both are using the CPU. Steal time is the time when CPU is waiting to be run by the Hypervisor. It should not be added to the CPU usage time, hence removing it from the usage_usec entry.
--- kernel/cgroup/rstat.c | 1 - 1 file changed, 1 deletion(-)
kernel/cgroup/rstat.c +0 -1
@@ -477,7 +477,6 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat) cputime->sum_exec_runtime += user; cputime->sum_exec_runtime += sys; - cputime->sum_exec_runtime += cpustat[CPUTIME_STEAL ];#ifdef CONFIG_SCHED_CORE bstat->forceidle_sum += cpustat[CPUTIME_FORCEIDLE ];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 474/578 drm/i915/selftests: avoid using uninitialized context
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Karas <[email protected]>
[ Upstream commit 53139b3f9998ea07289e7b70b909fea2264a0de9 ]
There is an error path in igt_ppgtt_alloc(), which leads to ww object being passed down to i915_gem_ww_ctx_fini() without initialization. Correct that by only putting ppgtt->vm and returning early.
--- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +2 -2
@@ -164,7 +164,7 @@ static int igt_ppgtt_alloc(void *arg)return PTR_ERR (ppgtt);if (!ppgtt->vm.allocate_va_range) - goto err_ppgtt_cleanup; + goto ppgtt_vm_put;/* * While we only allocate the page tables here and so we could
@@ -232,7 +232,7 @@ static int igt_ppgtt_alloc(void *arg) goto retry; }i915_gem_ww_ctx_fini (&ww); - +ppgtt_vm_put:i915_vm_put (&ppgtt->vm);return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 475/578 gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit de1d0d160f64ee76df1d364d521b2faf465a091c ]
The GPIO lock/unlock functions clear/write a bit to the relevant register for each bank. However, due to an oversight the bit that was being written was based on the total GPIO number, not the index of the GPIO within the relevant bank, causing it to fail for any GPIO above 32 (thus any GPIO for banks above bank 0).
Fix lock/unlock for these banks by using the correct bit.
--- drivers/gpio/gpio-bcm-kona.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-bcm-kona.c +4 -2
@@ -85,11 +85,12 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (gpio); + val |=BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
@@ -101,11 +102,12 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,u32 val;unsigned long flags;int bank_id =GPIO_BANK (gpio); +int bit =GPIO_BIT (gpio);raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (gpio); + val &= ~BIT (bit);bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val);raw_spin_unlock_irqrestore (&kona_gpio->lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 476/578 gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 57f5db77a915cc29461a679a6bcae7097967be1a ]
The settings for all GPIOs are locked by default in bcm_kona_gpio_reset. The settings for a GPIO are unlocked when requesting it as a GPIO, but not when requesting it as an interrupt, causing the IRQ settings to not get applied.
Fix this by making sure to unlock the right bits when an IRQ is requested. To avoid a situation where an IRQ being released causes a lock despite the same GPIO being used by a GPIO request or vice versa, add an unlock counter and only lock if it reaches 0.
--- drivers/gpio/gpio-bcm-kona.c | 67 +++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-)
drivers/gpio/gpio-bcm-kona.c +55 -12
@@ -68,6 +68,22 @@ struct bcm_kona_gpio {struct bcm_kona_gpio_bank {int id;int irq; +/* +* Used to keep track of lock/unlock operations for each GPIO in the +* bank. +* +* All GPIOs are locked by default (see bcm_kona_gpio_reset), and the +* unlock count for all GPIOs is 0 by default. Each unlock increments +* the counter, and each lock decrements the counter. +* +* The lock function only locks the GPIO once its unlock counter is +* down to 0. This is necessary because the GPIO is unlocked in two +* places in this driver: once for requested GPIOs, and once for +* requested IRQs. Since it is possible for a GPIO to be requested +* as both a GPIO and an IRQ, we need to ensure that we don't lock it +* too early. +*/ +u8 gpio_unlock_count[GPIO_PER_BANK ];/* Used in the interrupt handler */ struct bcm_kona_gpio *kona_gpio; };
@@ -86,14 +102,23 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +dev_err (kona_gpio->gpio_chip.parent, +"Unbalanced locks for GPIO %u\n" , gpio); +return ; + } - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val |=BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); +if (--bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val |=BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } } static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,
@@ -103,14 +128,19 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,unsigned long flags;int bank_id =GPIO_BANK (gpio);int bit =GPIO_BIT (gpio); +struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id]; -raw_spin_lock_irqsave (&kona_gpio->lock, flags); +if (bank->gpio_unlock_count[bit] ==0 ) { +raw_spin_lock_irqsave (&kona_gpio->lock, flags); - val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); - val &= ~BIT (bit); -bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); + val =readl (kona_gpio->reg_base +GPIO_PWD_STATUS (bank_id)); + val &= ~BIT (bit); +bcm_kona_gpio_write_lock_regs (kona_gpio->reg_base, bank_id, val); -raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); +raw_spin_unlock_irqrestore (&kona_gpio->lock, flags); + } + + ++bank->gpio_unlock_count[bit]; }static int bcm_kona_gpio_get_dir (struct gpio_chip *chip,unsigned gpio)
@@ -361,6 +391,7 @@ static void bcm_kona_gpio_irq_mask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MASK (bank_id));
@@ -383,6 +414,7 @@ static void bcm_kona_gpio_irq_unmask(struct irq_data *d) kona_gpio =irq_data_get_irq_chip_data (d); reg_base = kona_gpio->reg_base; +raw_spin_lock_irqsave (&kona_gpio->lock, flags); val =readl (reg_base +GPIO_INT_MSKCLR (bank_id));
@@ -478,15 +510,26 @@ static void bcm_kona_gpio_irq_handler(struct irq_desc *desc)static int bcm_kona_gpio_irq_reqres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* +* We need to unlock the GPIO before any other operations are performed +* on the relevant GPIO configuration registers +*/ +bcm_kona_gpio_unlock_gpio (kona_gpio, gpio); -return gpiochip_reqres_irq (&kona_gpio->gpio_chip, d->hwirq); +return gpiochip_reqres_irq (&kona_gpio->gpio_chip, gpio); }static void bcm_kona_gpio_irq_relres (struct irq_data *d) {struct bcm_kona_gpio *kona_gpio =irq_data_get_irq_chip_data (d); +unsigned int gpio = d->hwirq; + +/* Once we no longer use it, lock the GPIO again */ +bcm_kona_gpio_lock_gpio (kona_gpio, gpio); -gpiochip_relres_irq (&kona_gpio->gpio_chip, d->hwirq); +gpiochip_relres_irq (&kona_gpio->gpio_chip, gpio); }static struct irq_chip bcm_gpio_irq_chip = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 477/578 gpio: bcm-kona: Add missing newline to dev_err format string
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 615279db222c3ac56d5c93716efd72b843295c1f ]
Add a missing newline to the format string of the "Couldn't get IRQ for bank..." error message.
--- drivers/gpio/gpio-bcm-kona.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
@@ -667,7 +667,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) bank->irq =platform_get_irq (pdev, i); bank->kona_gpio = kona_gpio;if (bank->irq <0 ) { -dev_err (dev,"Couldn't get IRQ for bank %d" , i); +dev_err (dev,"Couldn't get IRQ for bank %d\n" , i); ret = -ENOENT ; goto err_irq_domain; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 478/578 xen/swiotlb: relax alignment requirements
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 85fcb57c983f423180ba6ec5d0034242da05cc54 ]
When mapping a buffer for DMA via .map_page or .map_sg DMA operations, there is no need to check the machine frames to be aligned according to the mapped areas size. All what is needed in these cases is that the buffer is contiguous at machine level.
So carve out the alignment check from range_straddles_page_boundary() and move it to a helper called by xen_swiotlb_alloc_coherent() and xen_swiotlb_free_coherent() directly.
--- drivers/xen/swiotlb-xen.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/xen/swiotlb-xen.c +12 -8
@@ -74,19 +74,21 @@ static inline phys_addr_t xen_dma_to_phys(struct device *dev,return xen_bus_to_phys (dev,dma_to_phys (dev, dma_addr)); } +static inline bool range_requires_alignment (phys_addr_t p,size_t size) +{ +phys_addr_t algn =1ULL << (get_order (size) +PAGE_SHIFT ); +phys_addr_t bus_addr =pfn_to_bfn (XEN_PFN_DOWN (p)) <<XEN_PAGE_SHIFT ; + +return IS_ALIGNED (p, algn) && !IS_ALIGNED (bus_addr, algn); +} +static inline int range_straddles_page_boundary (phys_addr_t p,size_t size) {unsigned long next_bfn, xen_pfn =XEN_PFN_DOWN (p);unsigned int i, nr_pages =XEN_PFN_UP (xen_offset_in_page (p) + size); -phys_addr_t algn =1ULL << (get_order (size) +PAGE_SHIFT ); next_bfn =pfn_to_bfn (xen_pfn); -/* If buffer is physically aligned, ensure DMA alignment. */ -if (IS_ALIGNED (p, algn) && - !IS_ALIGNED ((phys_addr_t )next_bfn <<XEN_PAGE_SHIFT , algn)) -return 1 ; -for (i =1 ; i < nr_pages; i++)if (pfn_to_bfn (++xen_pfn) != ++next_bfn)return 1 ;
@@ -155,7 +157,8 @@ xen_swiotlb_alloc_coherent(struct device *dev, size_t size, *dma_handle =xen_phys_to_dma (dev, phys);if (*dma_handle + size -1 > dma_mask || -range_straddles_page_boundary (phys, size)) { +range_straddles_page_boundary (phys, size) || +range_requires_alignment (phys, size)) {if (xen_create_contiguous_region (phys, order,fls64 (dma_mask), dma_handle) !=0 ) goto out_free_pages;
@@ -181,7 +184,8 @@ xen_swiotlb_free_coherent(struct device *dev, size_t size, void *vaddr, size =ALIGN (size,XEN_PAGE_SIZE );if (WARN_ON_ONCE (dma_handle + size -1 > dev->coherent_dma_mask) || -WARN_ON_ONCE (range_straddles_page_boundary (phys, size))) +WARN_ON_ONCE (range_straddles_page_boundary (phys, size) || +range_requires_alignment (phys, size)))return ;if (TestClearPageXenRemapped (virt_to_page (vaddr)))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 479/578 xen: remove a confusing comment on auto-translated guest I/O
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Tesarik <[email protected]>
[ Upstream commit d826c9e61c99120f8996f8fed6417167e32eb922 ]
After removing the conditional return from xen_create_contiguous_region(), the accompanying comment was left in place, but it now precedes an unrelated conditional and confuses readers.
Stable-dep-of: e93ec87286bd ("x86/xen: allow larger contiguous memory regions in PV guests")
--- arch/x86/xen/mmu_pv.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/xen/mmu_pv.c +0 -6
@@ -2302,12 +2302,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -/* -* Currently an auto-translated guest will not perform I/O, nor will -* it require PAE page directories below 4GB. Therefore any calls to -* this function are redundant and can be ignored. -*/ -if (unlikely (order >MAX_CONTIG_ORDER ))return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 480/578 x86/xen: allow larger contiguous memory regions in PV guests
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit e93ec87286bd1fd30b7389e7a387cfb259f297e3 ]
Today a PV guest (including dom0) can create 2MB contiguous memory regions for DMA buffers at max. This has led to problems at least with the megaraid_sas driver, which wants to allocate a 2.3MB DMA buffer.
The limiting factor is the frame array used to do the hypercall for making the memory contiguous, which has 512 entries and is just a static array in mmu_pv.c.
In order to not waste memory for non-PV guests, put the initial frame array into .init.data section and dynamically allocate an array from the .init_after_bootmem hook of PV guests.
In case a contiguous memory area larger than the initially supported 2MB is requested, allocate a larger buffer for the frame list. Note that such an allocation is tried only after memory management has been initialized properly, which is tested via a flag being set in the .init_after_bootmem hook.
--- arch/x86/xen/mmu_pv.c | 71 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 9 deletions(-)
arch/x86/xen/mmu_pv.c +62 -9
@@ -97,6 +97,51 @@ static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss;*/ static DEFINE_SPINLOCK (xen_reservation_lock); +/* Protected by xen_reservation_lock. */ +#define MIN_CONTIG_ORDER 9/* 2MB */ +static unsigned int discontig_frames_order =MIN_CONTIG_ORDER ; +static unsigned long discontig_frames_early[1UL <<MIN_CONTIG_ORDER ]__initdata ; +static unsigned long *discontig_frames__refdata = discontig_frames_early; +static bool discontig_frames_dyn; + +static int alloc_discontig_frames (unsigned int order) +{ +unsigned long *new_array, *old_array; +unsigned int old_order; +unsigned long flags; + +BUG_ON (order <MIN_CONTIG_ORDER ); +BUILD_BUG_ON (sizeof (discontig_frames_early) !=PAGE_SIZE ); + + new_array = (unsigned long *)__get_free_pages (GFP_KERNEL , + order -MIN_CONTIG_ORDER ); +if (!new_array) +return -ENOMEM ; + +spin_lock_irqsave (&xen_reservation_lock, flags); + + old_order = discontig_frames_order; + +if (order > discontig_frames_order || !discontig_frames_dyn) { +if (!discontig_frames_dyn) + old_array =NULL ; +else + old_array = discontig_frames; + + discontig_frames = new_array; + discontig_frames_order = order; + discontig_frames_dyn = true; + }else { + old_array = new_array; + } + +spin_unlock_irqrestore (&xen_reservation_lock, flags); + +free_pages ((unsigned long )old_array, old_order -MIN_CONTIG_ORDER ); + +return 0 ; +} +/* * Note about cr3 (pagetable base) values: *
@@ -797,6 +842,9 @@ static void __init xen_after_bootmem(void)SetPagePinned (virt_to_page (level3_user_vsyscall));#endif xen_pgd_walk (&init_mm, xen_mark_pinned,FIXADDR_TOP ); + +if (alloc_discontig_frames (MIN_CONTIG_ORDER )) +BUG (); } static void xen_unpin_page(struct mm_struct *mm, struct page *page,
@@ -2177,10 +2225,6 @@ void __init xen_init_mmu_ops(void)memset (dummy_mapping,0xff ,PAGE_SIZE ); } -/* Protected by xen_reservation_lock. */ -#define MAX_CONTIG_ORDER 9/* 2MB */ -static unsigned long discontig_frames[1 <<MAX_CONTIG_ORDER ]; -#define VOID_PTE (mfn_pte(0, __pgprot(0))) static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order, unsigned long *in_frames,
@@ -2297,18 +2341,25 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,unsigned int address_bits, dma_addr_t *dma_handle) { - unsigned long *in_frames = discontig_frames, out_frame; + unsigned long *in_frames, out_frame;unsigned long flags;int success;unsigned long vstart = (unsigned long )phys_to_virt (pstart); -if (unlikely (order >MAX_CONTIG_ORDER )) -return -ENOMEM ; +if (unlikely (order > discontig_frames_order)) { +if (!discontig_frames_dyn) +return -ENOMEM ; + +if (alloc_discontig_frames (order)) +return -ENOMEM ; + }memset ((void *) vstart,0 ,PAGE_SIZE << order);spin_lock_irqsave (&xen_reservation_lock, flags); + in_frames = discontig_frames; +/* 1. Zap current PTEs, remembering MFNs. */ xen_zap_pfn_range (vstart, order, in_frames,NULL );
@@ -2332,12 +2383,12 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,void xen_destroy_contiguous_region (phys_addr_t pstart,unsigned int order) { -unsigned long *out_frames = discontig_frames, in_frame; +unsigned long *out_frames, in_frame;unsigned long flags;int success;unsigned long vstart; -if (unlikely (order >MAX_CONTIG_ORDER )) +if (unlikely (order > discontig_frames_order))return ; vstart = (unsigned long )phys_to_virt (pstart);
@@ -2345,6 +2396,8 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)spin_lock_irqsave (&xen_reservation_lock, flags); + out_frames = discontig_frames; +/* 1. Find start MFN of contiguous extent. */ in_frame =virt_to_mfn (vstart);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 481/578 RDMA/efa: Reset device on probe failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Margolin <[email protected]>
[ Upstream commit 123c13f10ed3627ba112172d8bd122a72cae226d ]
Make sure the device is being reset on driver exit whatever the reason is, to keep the device aligned and allow it to close shared resources (e.g. admin queue).
--- drivers/infiniband/hw/efa/efa_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_main.c +5 -4
@@ -452,7 +452,6 @@ static void efa_ib_device_remove(struct efa_dev *dev)ibdev_info (&dev->ibdev,"Unregister ib device\n" );ib_unregister_device (&dev->ibdev);efa_destroy_eqs (dev); -efa_com_dev_reset (&dev->edev,EFA_REGS_RESET_NORMAL );efa_release_doorbell_bar (dev); }
@@ -623,12 +622,14 @@ static struct efa_dev *efa_probe_device(struct pci_dev *pdev)return ERR_PTR (err); } -static void efa_remove_device (struct pci_dev *pdev) +static void efa_remove_device (struct pci_dev *pdev, +enum efa_regs_reset_reason_types reset_reason) {struct efa_dev *dev =pci_get_drvdata (pdev);struct efa_com_dev *edev; edev = &dev->edev; +efa_com_dev_reset (edev, reset_reason);efa_com_admin_destroy (edev);efa_free_irq (dev, &dev->admin_irq);efa_disable_msix (dev);
@@ -656,7 +657,7 @@ static int efa_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return 0 ; err_remove_device: -efa_remove_device (pdev); +efa_remove_device (pdev,EFA_REGS_RESET_INIT_ERR );return err; }
@@ -665,7 +666,7 @@ static void efa_remove(struct pci_dev *pdev)struct efa_dev *dev =pci_get_drvdata (pdev);efa_ib_device_remove (dev); -efa_remove_device (pdev); +efa_remove_device (pdev,EFA_REGS_RESET_NORMAL ); }static struct pci_driver efa_pci_driver = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 482/578 fbdev: omap: use threaded IRQ for LCD DMA
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
[ Upstream commit e4b6b665df815b4841e71b72f06446884e8aad40 ]
When using touchscreen and framebuffer, Nokia 770 crashes easily with:
BUG: scheduling while atomic: irq/144-ads7846/82/0x00010000
Modules linked in: usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs omap_udc ohci_omap ohci_hcd
CPU: 0 UID: 0 PID: 82 Comm: irq/144-ads7846 Not tainted 6.12.7-770 #2
Hardware name: Nokia 770
Call trace:
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x54/0x5c
dump_stack_lvl from __schedule_bug+0x50/0x70
__schedule_bug from __schedule+0x4d4/0x5bc
__schedule from schedule+0x34/0xa0
schedule from schedule_preempt_disabled+0xc/0x10
schedule_preempt_disabled from __mutex_lock.constprop.0+0x218/0x3b4
__mutex_lock.constprop.0 from clk_prepare_lock+0x38/0xe4
clk_prepare_lock from clk_set_rate+0x18/0x154
clk_set_rate from sossi_read_data+0x4c/0x168
sossi_read_data from hwa742_read_reg+0x5c/0x8c
hwa742_read_reg from send_frame_handler+0xfc/0x300
send_frame_handler from process_pending_requests+0x74/0xd0
process_pending_requests from lcd_dma_irq_handler+0x50/0x74
lcd_dma_irq_handler from __handle_irq_event_percpu+0x44/0x130
__handle_irq_event_percpu from handle_irq_event+0x28/0x68
handle_irq_event from handle_level_irq+0x9c/0x170
handle_level_irq from generic_handle_domain_irq+0x2c/0x3c
generic_handle_domain_irq from omap1_handle_irq+0x40/0x8c
omap1_handle_irq from generic_handle_arch_irq+0x28/0x3c
generic_handle_arch_irq from call_with_stack+0x1c/0x24
call_with_stack from __irq_svc+0x94/0xa8
Exception stack(0xc5255da0 to 0xc5255de8)
5da0: 00000001 c22fc620 00000000 00000000 c08384a8 c106fc00 00000000 c240c248
5dc0: c113a600 c3f6ec30 00000001 00000000 c22fc620 c5255df0 c22fc620 c0279a94
5de0: 60000013 ffffffff
__irq_svc from clk_prepare_lock+0x4c/0xe4
clk_prepare_lock from clk_get_rate+0x10/0x74
clk_get_rate from uwire_setup_transfer+0x40/0x180
uwire_setup_transfer from spi_bitbang_transfer_one+0x2c/0x9c
spi_bitbang_transfer_one from spi_transfer_one_message+0x2d0/0x664
spi_transfer_one_message from __spi_pump_transfer_message+0x29c/0x498
__spi_pump_transfer_message from __spi_sync+0x1f8/0x2e8
__spi_sync from spi_sync+0x24/0x40
spi_sync from ads7846_halfd_read_state+0x5c/0x1c0
ads7846_halfd_read_state from ads7846_irq+0x58/0x348
ads7846_irq from irq_thread_fn+0x1c/0x78
irq_thread_fn from irq_thread+0x120/0x228
irq_thread from kthread+0xc8/0xe8
kthread from ret_from_fork+0x14/0x28As a quick fix, switch to a threaded IRQ which provides a stable system.
--- drivers/video/fbdev/omap/lcd_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/omap/lcd_dma.c +2 -2
@@ -432,8 +432,8 @@ static int __init omap_init_lcd_dma(void)spin_lock_init (&lcd_dma.lock); - r =request_irq (INT_DMA_LCD , lcd_dma_irq_handler,0 , -"LCD DMA" ,NULL ); + r =request_threaded_irq (INT_DMA_LCD ,NULL , lcd_dma_irq_handler, +IRQF_ONESHOT ,"LCD DMA" ,NULL );if (r !=0 )pr_err ("unable to request IRQ for LCD DMA (error %d)\n" , r);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 483/578 media: cxd2841er: fix 64-bit division on gcc-9
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 8d46603eeeb4c6abff1d2e49f2a6ae289dac765e ]
It appears that do_div() once more gets confused by a complex expression that ends up not quite being constant despite __builtin_constant_p() thinking it is:
ERROR: modpost: "__aeabi_uldivmod" [drivers/media/dvb-frontends/cxd2841er.ko] undefined!
Use div_u64() instead, forcing the expression to be evaluated first, and making it a bit more readable.
--- drivers/media/dvb-frontends/cxd2841er.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/cxd2841er.c +2 -6
@@ -311,12 +311,8 @@ static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv,static u32 cxd2841er_calc_iffreq_xtal (enum cxd2841er_xtal xtal,u32 ifhz) { -u64 tmp; - - tmp = (u64 ) ifhz *16777216 ; -do_div (tmp, ((xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 )); - -return (u32 ) tmp; +return div_u64 (ifhz *16777216ull , + (xtal ==SONY_XTAL_24000 ) ?48000000 :41000000 ); }static u32 cxd2841er_calc_iffreq (u32 ifhz)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 484/578 media: vidtv: Fix a null-ptr-deref in vidtv_mux_stop_thread
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 1221989555db711578a327a9367f1be46500cb48 ]
syzbot report a null-ptr-deref in vidtv_mux_stop_thread. [1]
If dvb->mux is not initialized successfully by vidtv_mux_init() in the vidtv_start_streaming(), it will trigger null pointer dereference about mux in vidtv_mux_stop_thread().
Adjust the timing of streaming initialization and check it before stopping it.
[1]
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f] CPU: 0 UID: 0 PID: 5842 Comm: syz-executor248 Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:vidtv_mux_stop_thread+0x26/0x80 drivers/media/test-drivers/vidtv/vidtv_mux.c:471 Code: 90 90 90 90 66 0f 1f 00 55 53 48 89 fb e8 82 2e c8 f9 48 8d bb 28 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 02 7e 3b 0f b6 ab 28 01 00 00 31 ff 89 ee e8 RSP: 0018:ffffc90003f2faa8 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff87cfb125 RDX: 0000000000000025 RSI: ffffffff87d120ce RDI: 0000000000000128 RBP: ffff888029b8d220 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000003 R12: ffff888029b8d188 R13: ffffffff8f590aa0 R14: ffffc9000581c5c8 R15: ffff888029a17710 FS: 00007f7eef5156c0(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f7eef5e635c CR3: 0000000076ca6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> vidtv_stop_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:209 [inline] vidtv_stop_feed+0x151/0x250 drivers/media/test-drivers/vidtv/vidtv_bridge.c:252 dmx_section_feed_stop_filtering+0x90/0x160 drivers/media/dvb-core/dvb_demux.c:1000 dvb_dmxdev_feed_stop.isra.0+0x1ee/0x270 drivers/media/dvb-core/dmxdev.c:486 dvb_dmxdev_filter_stop+0x22a/0x3a0 drivers/media/dvb-core/dmxdev.c:559 dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline] dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 get_signal+0x1d3/0x2610 kernel/signal.c:2790 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +7 -1
@@ -191,10 +191,11 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb) mux_args.mux_buf_sz = mux_buf_sz; - dvb->streaming = true; dvb->mux =vidtv_mux_init (dvb->fe[0 ], dev, &mux_args);if (!dvb->mux)return -ENOMEM ; + + dvb->streaming = true;vidtv_mux_start_thread (dvb->mux);dev_dbg_ratelimited (dev,"Started streaming\n" );
@@ -205,6 +206,11 @@ static int vidtv_stop_streaming(struct vidtv_dvb *dvb) {struct device *dev = &dvb->pdev->dev; +if (!dvb->streaming) { +dev_warn_ratelimited (dev,"No streaming. Skipping.\n" ); +return 0 ; + } + dvb->streaming = false;vidtv_mux_stop_thread (dvb->mux);vidtv_mux_destroy (dvb->mux);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 485/578 PCI/DPC: Quirk PIO log size for Intel Raptor Lake-P
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit b198499c7d2508a76243b98e7cca992f6fd2b7f7 ]
Apparently the Raptor Lake-P reference firmware configures the PIO log size correctly, but some vendor BIOSes, including at least ASUSTeK COMPUTER INC. Zenbook UX3402VA_UX3402VA, do not.
Apply the quirk for Raptor Lake-P. This prevents kernel complaints like:
DPC: RP PIO log size 0 is invalid
and also enables the DPC driver to dump the RP PIO Log registers when DPC is triggered.
Note that the bug report also mentions 8086:a76e, which has been already added by 627c6db20703 ("PCI/DPC: Quirk PIO log size for Intel Raptor Lake Root Ports").
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -6139,6 +6139,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2b, dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2d , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a2f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x9a31 , dpc_log_size); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa72f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa73f , dpc_log_size);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0xa76e , dpc_log_size);#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 486/578 PCI: switchtec: Add Microchip PCI100X device IDs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rakesh Babu Saladi <[email protected]>
[ Upstream commit a3282f84b2151d254dc4abf24d1255c6382be774 ]
Add Microchip parts to the Device ID table so the driver supports PCI100x devices.
Add a new macro to quirk the Microchip Switchtec PCI100x parts to allow DMA access via NTB to work when the IOMMU is turned on.
PCI100x family has 6 variants; each variant is designed for different application usages, different port counts and lane counts:
PCI1001 has 1 x4 upstream port and 3 x4 downstream ports PCI1002 has 1 x4 upstream port and 4 x2 downstream ports PCI1003 has 2 x4 upstream ports, 2 x2 upstream ports, and 2 x2
downstream ports
PCI1004 has 4 x4 upstream ports
PCI1005 has 1 x4 upstream port and 6 x2 downstream ports PCI1006 has 6 x2 upstream ports and 2 x2 downstream ports
[Historical note: these parts use PCI_VENDOR_ID_EFAR (0x1055), from EFAR Microsystems, which was acquired in 1996 by Standard Microsystems Corp, which was acquired by Microchip Technology in 2012. The PCI-SIG confirms that Vendor ID 0x1055 is assigned to Microchip even though it's not visible via https://pcisig.com/membership/member-companies]
--- drivers/pci/quirks.c | 11 +++++++++++ drivers/pci/switch/switchtec.c | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
drivers/pci/quirks.c +11 -0
@@ -5870,6 +5870,17 @@ SWITCHTEC_QUIRK(0x5552); /* PAXA 52XG5 */SWITCHTEC_QUIRK (0x5536 );/* PAXA 36XG5 */ SWITCHTEC_QUIRK (0x5528 );/* PAXA 28XG5 */ +#define SWITCHTEC_PCI100X_QUIRK (vid) \ + DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_EFAR, vid, \ + PCI_CLASS_BRIDGE_OTHER, 8, quirk_switchtec_ntb_dma_alias) +SWITCHTEC_PCI100X_QUIRK (0x1001 );/* PCI1001XG4 */ +SWITCHTEC_PCI100X_QUIRK (0x1002 );/* PCI1002XG4 */ +SWITCHTEC_PCI100X_QUIRK (0x1003 );/* PCI1003XG4 */ +SWITCHTEC_PCI100X_QUIRK (0x1004 );/* PCI1004XG4 */ +SWITCHTEC_PCI100X_QUIRK (0x1005 );/* PCI1005XG4 */ +SWITCHTEC_PCI100X_QUIRK (0x1006 );/* PCI1006XG4 */ + +/* * The PLX NTB uses devfn proxy IDs to move TLPs between NT endpoints. * These IDs are used to forward responses to the originator on the other
drivers/pci/switch/switchtec.c +26 -0
@@ -1739,6 +1739,26 @@ static void switchtec_pci_remove(struct pci_dev *pdev) .driver_data = gen, \ } +#define SWITCHTEC_PCI100X_DEVICE (device_id, gen) \ + { \ + .vendor = PCI_VENDOR_ID_EFAR, \ + .device = device_id, \ + .subvendor = PCI_ANY_ID, \ + .subdevice = PCI_ANY_ID, \ + .class = (PCI_CLASS_MEMORY_OTHER << 8), \ + .class_mask = 0xFFFFFFFF, \ + .driver_data = gen, \ + }, \ + { \ + .vendor = PCI_VENDOR_ID_EFAR, \ + .device = device_id, \ + .subvendor = PCI_ANY_ID, \ + .subdevice = PCI_ANY_ID, \ + .class = (PCI_CLASS_BRIDGE_OTHER << 8), \ + .class_mask = 0xFFFFFFFF, \ + .driver_data = gen, \ + } +static const struct pci_device_id switchtec_pci_tbl[] = {SWITCHTEC_PCI_DEVICE (0x8531 ,SWITCHTEC_GEN3 ),/* PFX 24xG3 */ SWITCHTEC_PCI_DEVICE (0x8532 ,SWITCHTEC_GEN3 ),/* PFX 32xG3 */
@@ -1833,6 +1853,12 @@ static const struct pci_device_id switchtec_pci_tbl[] = {SWITCHTEC_PCI_DEVICE (0x5552 ,SWITCHTEC_GEN5 ),/* PAXA 52XG5 */ SWITCHTEC_PCI_DEVICE (0x5536 ,SWITCHTEC_GEN5 ),/* PAXA 36XG5 */ SWITCHTEC_PCI_DEVICE (0x5528 ,SWITCHTEC_GEN5 ),/* PAXA 28XG5 */ +SWITCHTEC_PCI100X_DEVICE (0x1001 ,SWITCHTEC_GEN4 ),/* PCI1001 16XG4 */ +SWITCHTEC_PCI100X_DEVICE (0x1002 ,SWITCHTEC_GEN4 ),/* PCI1002 12XG4 */ +SWITCHTEC_PCI100X_DEVICE (0x1003 ,SWITCHTEC_GEN4 ),/* PCI1003 16XG4 */ +SWITCHTEC_PCI100X_DEVICE (0x1004 ,SWITCHTEC_GEN4 ),/* PCI1004 16XG4 */ +SWITCHTEC_PCI100X_DEVICE (0x1005 ,SWITCHTEC_GEN4 ),/* PCI1005 16XG4 */ +SWITCHTEC_PCI100X_DEVICE (0x1006 ,SWITCHTEC_GEN4 ),/* PCI1006 16XG4 */ {0} };MODULE_DEVICE_TABLE (pci, switchtec_pci_tbl);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 487/578 scsi: ufs: bsg: Set bsg_queue to NULL after removal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
[ Upstream commit 1e95c798d8a7f70965f0f88d4657b682ff0ec75f ]
Currently, this does not cause any issues, but I believe it is necessary to set bsg_queue to NULL after removing it to prevent potential use-after-free (UAF) access.
--- drivers/ufs/core/ufs_bsg.c | 1 + 1 file changed, 1 insertion(+)
drivers/ufs/core/ufs_bsg.c +1 -0
@@ -181,6 +181,7 @@ void ufs_bsg_remove(struct ufs_hba *hba)return ;bsg_remove_queue (hba->bsg_queue); + hba->bsg_queue =NULL ;device_del (bsg_dev);put_device (bsg_dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 488/578 rtla/timerlat_hist: Abort event processing on second signal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
[ Upstream commit d6899e560366e10141189697502bc5521940c588 ]
If either SIGINT is received twice, or after a SIGALRM (that is, after timerlat was supposed to stop), abort processing events currently left in the tracefs buffer and exit immediately.
This allows the user to exit rtla without waiting for processing all events, should that take longer than wanted, at the cost of not processing all samples.
--- tools/tracing/rtla/src/timerlat_hist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/tracing/rtla/src/timerlat_hist.c +8 -0
@@ -786,6 +786,14 @@ static int stop_tracing;static struct trace_instance *hist_inst =NULL ;static void stop_hist (int sig) { +if (stop_tracing) { +/* +* Stop requested twice in a row; abort event processing and +* exit immediately +*/ +tracefs_iterate_stop (hist_inst->inst); +return ; + } stop_tracing =1 ;if (hist_inst)trace_instance_stop (hist_inst);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 489/578 rtla/timerlat_top: Abort event processing on second signal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
[ Upstream commit 80967b354a76b360943af384c10d807d98bea5c4 ]
If either SIGINT is received twice, or after a SIGALRM (that is, after timerlat was supposed to stop), abort processing events currently left in the tracefs buffer and exit immediately.
This allows the user to exit rtla without waiting for processing all events, should that take longer than wanted, at the cost of not processing all samples.
--- tools/tracing/rtla/src/timerlat_top.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/tracing/rtla/src/timerlat_top.c +8 -0
@@ -578,6 +578,14 @@ static int stop_tracing;static struct trace_instance *top_inst =NULL ;static void stop_top (int sig) { +if (stop_tracing) { +/* +* Stop requested twice in a row; abort event processing and +* exit immediately +*/ +tracefs_iterate_stop (top_inst->inst); +return ; + } stop_tracing =1 ;if (top_inst)trace_instance_stop (top_inst);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 490/578 vfio/pci: Enable iowrite64 and ioread64 for vfio pci
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ramesh Thomas <[email protected]>
[ Upstream commit 2b938e3db335e3670475e31a722c2bee34748c5a ]
Definitions of ioread64 and iowrite64 macros in asm/io.h called by vfio pci implementations are enclosed inside check for CONFIG_GENERIC_IOMAP. They don't get defined if CONFIG_GENERIC_IOMAP is defined. Include linux/io-64-nonatomic-lo-hi.h to define iowrite64 and ioread64 macros when they are not defined. io-64-nonatomic-lo-hi.h maps the macros to generic implementation in lib/iomap.c. The generic implementation does 64 bit rw if readq/writeq is defined for the architecture, otherwise it would do 32 bit back to back rw.
Note that there are two versions of the generic implementation that differs in the order the 32 bit words are written if 64 bit support is not present. This is not the little/big endian ordering, which is handled separately. This patch uses the lo followed by hi word ordering which is consistent with current back to back implementation in the vfio/pci code.
--- drivers/vfio/pci/vfio_pci_rdwr.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/pci/vfio_pci_rdwr.c +1 -0
@@ -16,6 +16,7 @@#include <linux/io.h> #include <linux/vfio.h> #include <linux/vgaarb.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include "vfio_pci_priv.h"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 491/578 Grab mm lock before grabbing pt lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksym Planeta <[email protected]>
[ Upstream commit 6d002348789bc16e9203e9818b7a3688787e3b29 ]
Function xen_pin_page calls xen_pte_lock, which in turn grab page table lock (ptlock). When locking, xen_pte_lock expect mm->page_table_lock to be held before grabbing ptlock, but this does not happen when pinning is caused by xen_mm_pin_all.
This commit addresses lockdep warning below, which shows up when suspending a Xen VM.
[ 3680.658422] Freezing user space processes
[ 3680.660156] Freezing user space processes completed (elapsed 0.001 seconds)
[ 3680.660182] OOM killer disabled.
[ 3680.660192] Freezing remaining freezable tasks
[ 3680.661485] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 3680.685254]
[ 3680.685265] ==================================
[ 3680.685269] WARNING: Nested lock was not taken
[ 3680.685274] 6.12.0+ #16 Tainted: G W
[ 3680.685279] ----------------------------------
[ 3680.685283] migration/0/19 is trying to lock:
[ 3680.685288] ffff88800bac33c0 (ptlock_ptr(ptdesc)#2){+.+.}-{3:3}, at: xen_pin_page+0x175/0x1d0
[ 3680.685303]
[ 3680.685303] but this task is not holding:
[ 3680.685308] init_mm.page_table_lock
[ 3680.685311]
[ 3680.685311] stack backtrace:
[ 3680.685316] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685324] Tainted: [W]=WARN
[ 3680.685328] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685339] Call Trace:
[ 3680.685344] <TASK>
[ 3680.685347] dump_stack_lvl+0x77/0xb0
[ 3680.685356] __lock_acquire+0x917/0x2310
[ 3680.685364] lock_acquire+0xce/0x2c0
[ 3680.685369] ? xen_pin_page+0x175/0x1d0
[ 3680.685373] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685381] ? xen_pin_page+0x175/0x1d0
[ 3680.685386] xen_pin_page+0x175/0x1d0
[ 3680.685390] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685394] __xen_pgd_walk+0x233/0x2c0
[ 3680.685401] ? stop_one_cpu+0x91/0x100
[ 3680.685405] __xen_pgd_pin+0x5d/0x250
[ 3680.685410] xen_mm_pin_all+0x70/0xa0
[ 3680.685415] xen_pv_pre_suspend+0xf/0x280
[ 3680.685420] xen_suspend+0x57/0x1a0
[ 3680.685428] multi_cpu_stop+0x6b/0x120
[ 3680.685432] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685439] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685443] cpu_stopper_thread+0x8c/0x140
[ 3680.685448] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685454] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685458] smpboot_thread_fn+0xed/0x1f0
[ 3680.685462] kthread+0xde/0x110
[ 3680.685467] ? __pfx_kthread+0x10/0x10
[ 3680.685471] ret_from_fork+0x2f/0x50
[ 3680.685478] ? __pfx_kthread+0x10/0x10
[ 3680.685482] ret_from_fork_asm+0x1a/0x30
[ 3680.685489] </TASK>
[ 3680.685491]
[ 3680.685491] other info that might help us debug this:
[ 3680.685497] 1 lock held by migration/0/19:
[ 3680.685500] #0: ffffffff8284df38 (pgd_lock){+.+.}-{3:3}, at: xen_mm_pin_all+0x14/0xa0
[ 3680.685512]
[ 3680.685512] stack backtrace:
[ 3680.685518] CPU: 0 UID: 0 PID: 19 Comm: migration/0 Tainted: G W 6.12.0+ #16
[ 3680.685528] Tainted: [W]=WARN
[ 3680.685531] Stopper: multi_cpu_stop+0x0/0x120 <- __stop_cpus.constprop.0+0x8c/0xd0
[ 3680.685538] Call Trace:
[ 3680.685541] <TASK>
[ 3680.685544] dump_stack_lvl+0x77/0xb0
[ 3680.685549] __lock_acquire+0x93c/0x2310
[ 3680.685554] lock_acquire+0xce/0x2c0
[ 3680.685558] ? xen_pin_page+0x175/0x1d0
[ 3680.685562] _raw_spin_lock_nest_lock+0x2f/0x70
[ 3680.685568] ? xen_pin_page+0x175/0x1d0
[ 3680.685572] xen_pin_page+0x175/0x1d0
[ 3680.685578] ? __pfx_xen_pin_page+0x10/0x10
[ 3680.685582] __xen_pgd_walk+0x233/0x2c0
[ 3680.685588] ? stop_one_cpu+0x91/0x100
[ 3680.685592] __xen_pgd_pin+0x5d/0x250
[ 3680.685596] xen_mm_pin_all+0x70/0xa0
[ 3680.685600] xen_pv_pre_suspend+0xf/0x280
[ 3680.685607] xen_suspend+0x57/0x1a0
[ 3680.685611] multi_cpu_stop+0x6b/0x120
[ 3680.685615] ? update_cpumasks_hier+0x7c/0xa60
[ 3680.685620] ? __pfx_multi_cpu_stop+0x10/0x10
[ 3680.685625] cpu_stopper_thread+0x8c/0x140
[ 3680.685629] ? smpboot_thread_fn+0x20/0x1f0
[ 3680.685634] ? __pfx_smpboot_thread_fn+0x10/0x10
[ 3680.685638] smpboot_thread_fn+0xed/0x1f0
[ 3680.685642] kthread+0xde/0x110
[ 3680.685645] ? __pfx_kthread+0x10/0x10
[ 3680.685649] ret_from_fork+0x2f/0x50
[ 3680.685654] ? __pfx_kthread+0x10/0x10
[ 3680.685657] ret_from_fork_asm+0x1a/0x30
[ 3680.685662] </TASK>
[ 3680.685267] xen:grant_table: Grant tables using version 1 layout
[ 3680.685921] OOM killer enabled.
[ 3680.685934] Restarting tasks ... done.Message-ID: <[email protected]>
--- arch/x86/xen/mmu_pv.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/mmu_pv.c +4 -0
@@ -811,6 +811,7 @@ void xen_mm_pin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -821,6 +822,7 @@ void xen_mm_pin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); } static void __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
@@ -920,6 +922,7 @@ void xen_mm_unpin_all(void) {struct page *page; +spin_lock (&init_mm.page_table_lock);spin_lock (&pgd_lock);list_for_each_entry (page, &pgd_list, lru) {
@@ -931,6 +934,7 @@ void xen_mm_unpin_all(void) }spin_unlock (&pgd_lock); +spin_unlock (&init_mm.page_table_lock); }static void xen_activate_mm (struct mm_struct *prev,struct mm_struct *next)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 492/578 selftests: gpio: gpio-sim: Fix missing chip disablements
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit f8524ac33cd452aef5384504b3264db6039a455e ]
Since upstream commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on"), rmdir for an active virtual devices been prohibited.
Update gpio-sim selftest to align with the change.
--- tools/testing/selftests/gpio/gpio-sim.sh | 31 +++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-)
tools/testing/selftests/gpio/gpio-sim.sh +25 -6
@@ -46,12 +46,6 @@ remove_chip() { rmdir $CONFIGFS_DIR/$CHIP || fail "Unable to remove the chip" } -configfs_cleanup() { - for CHIP in `ls $CONFIGFS_DIR/`; do - remove_chip $CHIP - done -} - create_chip() { local CHIP=$1
@@ -105,6 +99,13 @@ disable_chip() { echo 0 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to disable the chip" } +configfs_cleanup() { + for CHIP in `ls $CONFIGFS_DIR/`; do + disable_chip $CHIP + remove_chip $CHIP + done +} + configfs_chip_name() { local CHIP=$1 local BANK=$2
@@ -181,6 +182,7 @@ create_chip chip create_bank chip bank enable_chip chip test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work" +disable_chip chip remove_chip chip echo "1.2. chip_name returns 'none' if the chip is still pending"
@@ -195,6 +197,7 @@ create_chip chip create_bank chip bank enable_chip chip test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work" +disable_chip chip remove_chip chip echo "2. Creating and configuring simulated chips"
@@ -204,6 +207,7 @@ create_chip chip create_bank chip bank enable_chip chip test "`get_chip_num_lines chip bank`" = "1" || fail "default number of lines is not 1" +disable_chip chip remove_chip chip echo "2.2. Number of lines can be specified"
@@ -212,6 +216,7 @@ create_bank chip bank set_num_lines chip bank 16 enable_chip chip test "`get_chip_num_lines chip bank`" = "16" || fail "number of lines is not 16" +disable_chip chip remove_chip chip echo "2.3. Label can be set"
@@ -220,6 +225,7 @@ create_bank chip bank set_label chip bank foobar enable_chip chip test "`get_chip_label chip bank`" = "foobar" || fail "label is incorrect" +disable_chip chip remove_chip chip echo "2.4. Label can be left empty"
@@ -227,6 +233,7 @@ create_chip chip create_bank chip bank enable_chip chip test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty" +disable_chip chip remove_chip chip echo "2.5. Line names can be configured"
@@ -238,6 +245,7 @@ set_line_name chip bank 2 bar enable_chip chip test "`get_line_name chip bank 0`" = "foo" || fail "line name is incorrect" test "`get_line_name chip bank 2`" = "bar" || fail "line name is incorrect" +disable_chip chip remove_chip chip echo "2.6. Line config can remain unused if offset is greater than number of lines"
@@ -248,6 +256,7 @@ set_line_name chip bank 5 foobar enable_chip chip test "`get_line_name chip bank 0`" = "" || fail "line name is incorrect" test "`get_line_name chip bank 1`" = "" || fail "line name is incorrect" +disable_chip chip remove_chip chip echo "2.7. Line configfs directory names are sanitized"
@@ -267,6 +276,7 @@ for CHIP in $CHIPS; do enable_chip $CHIP done for CHIP in $CHIPS; do + disable_chip $CHIP remove_chip $CHIP done
@@ -278,6 +288,7 @@ echo foobar > $CONFIGFS_DIR/chip/bank/label 2> /dev/null && \ fail "Setting label of a live chip should fail" echo 8 > $CONFIGFS_DIR/chip/bank/num_lines 2> /dev/null && \ fail "Setting number of lines of a live chip should fail" +disable_chip chip remove_chip chip echo "2.10. Can't create line items when chip is live"
@@ -285,6 +296,7 @@ create_chip chip create_bank chip bank enable_chip chip mkdir $CONFIGFS_DIR/chip/bank/line0 2> /dev/null && fail "Creating line item should fail" +disable_chip chip remove_chip chip echo "2.11. Probe errors are propagated to user-space"
@@ -316,6 +328,7 @@ mkdir -p $CONFIGFS_DIR/chip/bank/line4/hog enable_chip chip $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 4 2> /dev/null && \ fail "Setting the value of a hogged line shouldn't succeed" +disable_chip chip remove_chip chip echo "3. Controlling simulated chips"
@@ -331,6 +344,7 @@ test "$?" = "1" || fail "pull set incorrectly" sysfs_set_pull chip bank 0 pull-down $BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 1 test "$?" = "0" || fail "pull set incorrectly" +disable_chip chip remove_chip chip echo "3.2. Pull can be read from sysfs"
@@ -344,6 +358,7 @@ SYSFS_PATH=/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/pull test `cat $SYSFS_PATH` = "pull-down" || fail "reading the pull failed" sysfs_set_pull chip bank 0 pull-up test `cat $SYSFS_PATH` = "pull-up" || fail "reading the pull failed" +disable_chip chip remove_chip chip echo "3.3. Incorrect input in sysfs is rejected"
@@ -355,6 +370,7 @@ DEVNAME=`configfs_dev_name chip` CHIPNAME=`configfs_chip_name chip bank` SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/pull" echo foobar > $SYSFS_PATH 2> /dev/null && fail "invalid input not detected" +disable_chip chip remove_chip chip echo "3.4. Can't write to value"
@@ -365,6 +381,7 @@ DEVNAME=`configfs_dev_name chip` CHIPNAME=`configfs_chip_name chip bank` SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value" echo 1 > $SYSFS_PATH 2> /dev/null && fail "writing to 'value' succeeded unexpectedly" +disable_chip chip remove_chip chip echo "4. Simulated GPIO chips are functional"
@@ -382,6 +399,7 @@ $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 & sleep 0.1 # FIXME Any better way? test `cat $SYSFS_PATH` = "1" || fail "incorrect value read from sysfs" kill $! +disable_chip chip remove_chip chip echo "4.2. Bias settings work correctly"
@@ -394,6 +412,7 @@ CHIPNAME=`configfs_chip_name chip bank` SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value" $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0 test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work" +disable_chip chip remove_chip chip echo "GPIO $MODULE test PASS"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 493/578 x86/mm/tlb: Only trim the mm_cpumask once a second
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
[ Upstream commit 6db2526c1d694c91c6e05e2f186c085e9460f202 ]
Setting and clearing CPU bits in the mm_cpumask is only ever done by the CPU itself, from the context switch code or the TLB flush code.
Synchronization is handled by switch_mm_irqs_off() blocking interrupts.
Sending TLB flush IPIs to CPUs that are in the mm_cpumask, but no longer running the program causes a regression in the will-it-scale tlbflush2 test. This test is contrived, but a large regression here might cause a small regression in some real world workload.
Instead of always sending IPIs to CPUs that are in the mm_cpumask, but no longer running the program, send these IPIs only once a second.
The rest of the time we can skip over CPUs where the loaded_mm is different from the target mm.
--- arch/x86/include/asm/mmu.h | 2 ++ arch/x86/include/asm/mmu_context.h | 1 + arch/x86/include/asm/tlbflush.h | 1 + arch/x86/mm/tlb.c | 35 +++++++++++++++++++++++++++--- 4 files changed, 36 insertions(+), 3 deletions(-)
arch/x86/include/asm/mmu.h +2 -0
@@ -33,6 +33,8 @@ typedef struct {*/ atomic64_t tlb_gen; +unsigned long next_trim_cpumask; +#ifdef CONFIG_MODIFY_LDT_SYSCALL struct rw_semaphore ldt_usr_sem;struct ldt_struct *ldt;
arch/x86/include/asm/mmu_context.h +1 -0
@@ -106,6 +106,7 @@ static inline int init_new_context(struct task_struct *tsk, mm->context.ctx_id =atomic64_inc_return (&last_mm_ctx_id);atomic64_set (&mm->context.tlb_gen,0 ); + mm->context.next_trim_cpumask = jiffies +HZ ;#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS if (cpu_feature_enabled (X86_FEATURE_OSPKE )) {
arch/x86/include/asm/tlbflush.h +1 -0
@@ -208,6 +208,7 @@ struct flush_tlb_info {unsigned int initiating_cpu;u8 stride_shift;u8 freed_tables; +u8 trim_cpumask; };void flush_tlb_local (void );
arch/x86/mm/tlb.c +32 -3
@@ -878,9 +878,36 @@ static void flush_tlb_func(void *info) nr_invalidate); } -static bool tlb_is_not_lazy (int cpu,void *data) +static bool should_flush_tlb (int cpu,void *data) { -return !per_cpu (cpu_tlbstate_shared.is_lazy, cpu); +struct flush_tlb_info *info = data; + +/* Lazy TLB will get flushed at the next context switch. */ +if (per_cpu (cpu_tlbstate_shared.is_lazy, cpu)) +return false; + +/* No mm means kernel memory flush. */ +if (!info->mm) +return true; + +/* The target mm is loaded, and the CPU is not lazy. */ +if (per_cpu (cpu_tlbstate.loaded_mm, cpu) == info->mm) +return true; + +/* In cpumask, but not the loaded mm? Periodically remove by flushing. */ +if (info->trim_cpumask) +return true; + +return false; +} + +static bool should_trim_cpumask (struct mm_struct *mm) +{ +if (time_after (jiffies,READ_ONCE (mm->context.next_trim_cpumask))) { +WRITE_ONCE (mm->context.next_trim_cpumask, jiffies +HZ ); +return true; + } +return false; } DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state_shared, cpu_tlbstate_shared);
@@ -914,7 +941,7 @@ STATIC_NOPV void native_flush_tlb_multi(const struct cpumask *cpumask,if (info->freed_tables)on_each_cpu_mask (cpumask, flush_tlb_func, (void *)info, true);else -on_each_cpu_cond_mask (tlb_is_not_lazy, flush_tlb_func, +on_each_cpu_cond_mask (should_flush_tlb, flush_tlb_func, (void *)info,1 , cpumask); }
@@ -965,6 +992,7 @@ static struct flush_tlb_info *get_flush_tlb_info(struct mm_struct *mm, info->freed_tables = freed_tables; info->new_tlb_gen = new_tlb_gen; info->initiating_cpu =smp_processor_id (); + info->trim_cpumask =0 ;return info; }
@@ -1007,6 +1035,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,* flush_tlb_func_local() directly in this case. */ if (cpumask_any_but (mm_cpumask (mm), cpu) < nr_cpu_ids) { + info->trim_cpumask =should_trim_cpumask (mm);flush_tlb_multi (mm_cpumask (mm), info); }else if (mm ==this_cpu_read (cpu_tlbstate.loaded_mm)) {lockdep_assert_irqs_enabled ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 494/578 orangefs: fix a oob in orangefs_debug_write
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marshall <[email protected]>
[ Upstream commit f7c848431632598ff9bce57a659db6af60d75b39 ]
I got a syzbot report: slab-out-of-bounds Read in orangefs_debug_write... several people suggested fixes, I tested Al Viro's suggestion and made this patch.
--- fs/orangefs/orangefs-debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/orangefs/orangefs-debugfs.c +2 -2
@@ -393,9 +393,9 @@ static ssize_t orangefs_debug_write(struct file *file,* Thwart users who try to jamb a ridiculous number * of bytes into the debug file... */ -if (count >ORANGEFS_MAX_DEBUG_STRING_LEN +1 ) { +if (count >ORANGEFS_MAX_DEBUG_STRING_LEN ) { silly = count; - count =ORANGEFS_MAX_DEBUG_STRING_LEN +1 ; + count =ORANGEFS_MAX_DEBUG_STRING_LEN ; } buf =kzalloc (ORANGEFS_MAX_DEBUG_STRING_LEN ,GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 495/578 ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6917192378c1ce17ba31df51c4e0d8b1c97a453b ]
The Vexia EDU ATLA 10 tablet comes in 2 different versions with significantly different mainboards. The only outward difference is that the charging barrel on one is marked 5V and the other is marked 9V.
The 5V version mostly works with the BYTCR defaults, except that it is missing a CHAN package in its ACPI tables and the default of using SSP0-AIF2 is wrong, instead SSP0-AIF1 must be used. That and its jack detect signal is not inverted as it usually is.
Add a DMI quirk for the 5V version to fix sound not working.
--- sound/soc/intel/boards/bytcr_rt5640.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/intel/boards/bytcr_rt5640.c +16 -1
@@ -1122,7 +1122,22 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF2 | BYT_RT5640_MCLK_EN), }, - { /* Vexia Edu Atla 10 tablet */ + { +/* Vexia Edu Atla 10 tablet 5V version */ + .matches = { +/* Having all 3 of these not set is somewhat unique */ +DMI_MATCH (DMI_SYS_VENDOR ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"To be filled by O.E.M." ), +DMI_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +/* Above strings are too generic, also match on BIOS date */ + DMI_MATCH(DMI_BIOS_DATE, "05/14/2015"), + }, + .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | +BYT_RT5640_JD_NOT_INV | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, + { /* Vexia Edu Atla 10 tablet 9V version */ .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"AMI Corporation" ), DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 496/578 batman-adv: fix panic during interface removal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Strohman <[email protected]>
commit ccb7276a6d26d6f8416e315b43b45e15ee7f29e2 upstream.
Reference counting is used to ensure that batadv_hardif_neigh_node and batadv_hard_iface are not freed before/during batadv_v_elp_throughput_metric_update work is finished.
But there isn't a guarantee that the hard if will remain associated with a soft interface up until the work is finished.
This fixes a crash triggered by reboot that looks like this:
Call trace: batadv_v_mesh_free+0xd0/0x4dc [batman_adv] batadv_v_elp_throughput_metric_update+0x1c/0xa4 process_one_work+0x178/0x398 worker_thread+0x2e8/0x4d0 kthread+0xd8/0xdc ret_from_fork+0x10/0x20
(the batadv_v_mesh_free call is misleading,
and does not actually happen)
I was able to make the issue happen more reliably by changing hardif_neigh->bat_v.metric_work work to be delayed work. This allowed me to track down and confirm the fix.
[[email protected]: prevent entering batadv_v_elp_get_throughput without
soft_iface]
--- net/batman-adv/bat_v_elp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/batman-adv/bat_v_elp.c +8 -1
@@ -67,12 +67,19 @@ static void batadv_v_elp_start_timer(strstatic u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) {struct batadv_hard_iface *hard_iface = neigh->if_incoming; +struct net_device *soft_iface = hard_iface->soft_iface;struct ethtool_link_ksettings link_settings;struct net_device *real_netdev;struct station_info sinfo;u32 throughput;int ret; +/* don't query throughput when no longer associated with any +* batman-adv interface +*/ +if (!soft_iface) +return BATADV_THROUGHPUT_DEFAULT_VALUE ; +/* if the user specified a customised value for this interface, then * return it directly */
@@ -142,7 +149,7 @@ static u32 batadv_v_elp_get_throughput(s default_throughput:if (!(hard_iface->bat_v.flags &BATADV_WARNING_DEFAULT )) { - batadv_info(hard_iface->soft_iface, + batadv_info(soft_iface, "WiFi driver or ethtool info does not provide information about link speeds on interface %s, therefore defaulting to hardcoded throughput values of %u.%1u Mbps. Consider overriding the throughput manually or checking your driver.\n", hard_iface->net_dev->name, BATADV_THROUGHPUT_DEFAULT_VALUE / 10,
Greg Kroah-Hartman
maintainerPATCH 497/578 batman-adv: Ignore neighbor throughput metrics in error case
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit e7e34ffc976aaae4f465b7898303241b81ceefc3 upstream.
If a temporary error happened in the evaluation of the neighbor throughput information, then the invalid throughput result should not be stored in the throughtput EWMA.
--- net/batman-adv/bat_v_elp.c | 50 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-)
net/batman-adv/bat_v_elp.c +34 -16
@@ -60,11 +60,13 @@ static void batadv_v_elp_start_timer(str/** * batadv_v_elp_get_throughput() - get the throughput towards a neighbour * @neigh: the neighbour for which the throughput has to be obtained +* @pthroughput: calculated throughput towards the given neighbour in multiples +* of 100kpbs (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). * -* Return: The throughput towards the given neighbour in multiples of 100kpbs -* (a value of '1' equals 0.1Mbps, '10' equals 1Mbps, etc). +* Return: true when value behind @pthroughput was set */ -static u32 batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh) +static bool batadv_v_elp_get_throughput (struct batadv_hardif_neigh_node *neigh, +u32 *pthroughput) {struct batadv_hard_iface *hard_iface = neigh->if_incoming;struct net_device *soft_iface = hard_iface->soft_iface;
@@ -78,14 +80,16 @@ static u32 batadv_v_elp_get_throughput(s* batman-adv interface */ if (!soft_iface) -return BATADV_THROUGHPUT_DEFAULT_VALUE ; +return false;/* if the user specified a customised value for this interface, then * return it directly */ throughput =atomic_read (&hard_iface->bat_v.throughput_override); -if (throughput !=0 ) -return throughput; +if (throughput !=0 ) { + *pthroughput = throughput; +return true; + }/* if this is a wireless device, then ask its throughput through * cfg80211 API
@@ -112,19 +116,24 @@ static u32 batadv_v_elp_get_throughput(s* possible to delete this neighbor. For now set * the throughput metric to 0. */ -return 0 ; + *pthroughput =0 ; +return true; }if (ret) goto default_throughput; -if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) -return sinfo.expected_throughput /100 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_EXPECTED_THROUGHPUT )) { + *pthroughput = sinfo.expected_throughput /100 ; +return true; + }/* try to estimate the expected throughput based on reported tx * rates */ -if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) -return cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +if (sinfo.filled &BIT (NL80211_STA_INFO_TX_BITRATE )) { + *pthroughput =cfg80211_calculate_bitrate (&sinfo.txrate) /3 ; +return true; + } goto default_throughput; }
@@ -143,8 +152,10 @@ static u32 batadv_v_elp_get_throughput(s hard_iface->bat_v.flags &= ~BATADV_FULL_DUPLEX ; throughput = link_settings.base.speed; -if (throughput && throughput !=SPEED_UNKNOWN ) -return throughput *10 ; +if (throughput && throughput !=SPEED_UNKNOWN ) { + *pthroughput = throughput *10 ; +return true; + } } default_throughput:
@@ -158,7 +169,8 @@ default_throughput: }/* if none of the above cases apply, return the base_throughput */ -return BATADV_THROUGHPUT_DEFAULT_VALUE ; + *pthroughput =BATADV_THROUGHPUT_DEFAULT_VALUE ; +return true; }/**
@@ -170,15 +182,21 @@ void batadv_v_elp_throughput_metric_upda {struct batadv_hardif_neigh_node_bat_v *neigh_bat_v;struct batadv_hardif_neigh_node *neigh; +u32 throughput; +bool valid; neigh_bat_v = container_of(work, struct batadv_hardif_neigh_node_bat_v, metric_work); neigh = container_of(neigh_bat_v, struct batadv_hardif_neigh_node, bat_v); -ewma_throughput_add (&neigh->bat_v.throughput, -batadv_v_elp_get_throughput (neigh)); + valid =batadv_v_elp_get_throughput (neigh, &throughput); +if (!valid) + goto put_neigh; + +ewma_throughput_add (&neigh->bat_v.throughput, throughput); +put_neigh:/* decrement refcounter to balance increment performed before scheduling * this task */
Greg Kroah-Hartman
maintainerPATCH 498/578 batman-adv: Drop unmanaged ELP metric worker
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 8c8ecc98f5c65947b0070a24bac11e12e47cc65d upstream.
The ELP worker needs to calculate new metric values for all neighbors "reachable" over an interface. Some of the used metric sources require locks which might need to sleep. This sleep is incompatible with the RCU list iterator used for the recorded neighbors. The initial approach to work around of this problem was to queue another work item per neighbor and then run this in a new context.
Even when this solved the RCU vs might_sleep() conflict, it has a major
problems: Nothing was stopping the work item in case it is not needed anymore - for example because one of the related interfaces was removed or the batman-adv module was unloaded - resulting in potential invalid memory accesses.
Directly canceling the metric worker also has various problems:
* cancel_work_sync for a to-be-deactivated interface is called with rtnl_lock held. But the code in the ELP metric worker also tries to use rtnl_lock() - which will never return in this case. This also means that cancel_work_sync would never return because it is waiting for the worker to finish.
* iterating over the neighbor list for the to-be-deactivated interface is currently done using the RCU specific methods. Which means that it is possible to miss items when iterating over it without the associated spinlock - a behaviour which is acceptable for a periodic metric check but not for a cleanup routine (which must "stop" all still running workers)
The better approch is to get rid of the per interface neighbor metric worker and handle everything in the interface worker. The original problems are solved by:
* creating a list of neighbors which require new metric information inside the RCU protected context, gathering the metric according to the new list outside the RCU protected context
* only use rcu_trylock inside metric gathering code to avoid a deadlock when the cancel_delayed_work_sync is called in the interface removal code (which is called with the rtnl_lock held)
--- net/batman-adv/bat_v.c | 2 - net/batman-adv/bat_v_elp.c | 71 ++++++++++++++++++++++++++++++--------------- net/batman-adv/bat_v_elp.h | 2 - net/batman-adv/types.h | 3 - 4 files changed, 48 insertions(+), 30 deletions(-)
net/batman-adv/bat_v.c +0 -2
@@ -113,8 +113,6 @@ static void batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh) {ewma_throughput_init (&hardif_neigh->bat_v.throughput); -INIT_WORK (&hardif_neigh->bat_v.metric_work, - batadv_v_elp_throughput_metric_update); }/**
net/batman-adv/bat_v_elp.c +48 -23
143 lines not on this page · raw message
net/batman-adv/bat_v_elp.h +0 -2
@@ -10,7 +10,6 @@#include "main.h" #include <linux/skbuff.h> -#include <linux/workqueue.h> int batadv_v_elp_iface_enable (struct batadv_hard_iface *hard_iface);void batadv_v_elp_iface_disable (struct batadv_hard_iface *hard_iface);
@@ -19,6 +18,5 @@ void batadv_v_elp_iface_activate(structvoid batadv_v_elp_primary_iface_set (struct batadv_hard_iface *primary_iface);int batadv_v_elp_packet_recv (struct sk_buff *skb,struct batadv_hard_iface *if_incoming); -void batadv_v_elp_throughput_metric_update (struct work_struct *work);#endif /* _NET_BATMAN_ADV_BAT_V_ELP_H_ */
net/batman-adv/types.h +0 -3
@@ -596,9 +596,6 @@ struct batadv_hardif_neigh_node_bat_v {* neighbor */ unsigned long last_unicast_tx; - -/** @metric_work: work queue callback item for metric update */ -struct work_struct metric_work; };/**
Greg Kroah-Hartman
maintainerPATCH 499/578 drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 1abb2648698bf10783d2236a6b4a7ca5e8021699 upstream.
It malicious user provides a small pptable through sysfs and then a bigger pptable, it may cause buffer overflow attack in function smu_sys_set_pp_table().
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -516,7 +516,8 @@ static int smu_sys_set_pp_table(void *hareturn -EIO ; } -if (!smu_table->hardcode_pptable) { +if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) { +kfree (smu_table->hardcode_pptable); smu_table->hardcode_pptable =kzalloc (size,GFP_KERNEL );if (!smu_table->hardcode_pptable)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 500/578 KVM: x86: Reject Hyper-Vs SEND_IPI hypercalls if local APIC isnt in-kernel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit a8de7f100bb5989d9c3627d3a223ee1c863f3b69 upstream.
Advertise support for Hyper-V's SEND_IPI and SEND_IPI_EX hypercalls if and only if the local API is emulated/virtualized by KVM, and explicitly reject said hypercalls if the local APIC is emulated in userspace, i.e. don't rely on userspace to opt-in to KVM_CAP_HYPERV_ENFORCE_CPUID.
Rejecting SEND_IPI and SEND_IPI_EX fixes a NULL-pointer dereference if Hyper-V enlightenments are exposed to the guest without an in-kernel local APIC:
dump_stack+0xbe/0xfd __kasan_report.cold+0x34/0x84 kasan_report+0x3a/0x50 __apic_accept_irq+0x3a/0x5c0 kvm_hv_send_ipi.isra.0+0x34e/0x820 kvm_hv_hypercall+0x8d9/0x9d0 kvm_emulate_hypercall+0x506/0x7e0 __vmx_handle_exit+0x283/0xb60 vmx_handle_exit+0x1d/0xd0 vcpu_enter_guest+0x16b0/0x24c0 vcpu_run+0xc0/0x550 kvm_arch_vcpu_ioctl_run+0x170/0x6d0 kvm_vcpu_ioctl+0x413/0xb20 __se_sys_ioctl+0x111/0x160 do_syscal1_64+0x30/0x40 entry_SYSCALL_64_after_hwframe+0x67/0xd1
Note, checking the sending vCPU is sufficient, as the per-VM irqchip_mode can't be modified after vCPUs are created, i.e. if one vCPU has an in-kernel local APIC, then all vCPUs have an in-kernel local APIC.
--- arch/x86/kvm/hyperv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/hyperv.c +5 -1
@@ -1915,6 +1915,9 @@ static u64 kvm_hv_send_ipi(struct kvm_vcu32 vector;bool all_cpus; +if (!lapic_in_kernel (vcpu)) +return HV_STATUS_INVALID_HYPERCALL_INPUT ; +if (hc->code ==HVCALL_SEND_IPI ) {if (!hc->fast) { if (unlikely(kvm_read_guest(kvm, hc->ingpa, &send_ipi,
@@ -2518,7 +2521,8 @@ int kvm_get_hv_cpuid(struct kvm_vcpu *vc ent->eax |=HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED ; ent->eax |=HV_X64_APIC_ACCESS_RECOMMENDED ; ent->eax |=HV_X64_RELAXED_TIMING_RECOMMENDED ; - ent->eax |=HV_X64_CLUSTER_IPI_RECOMMENDED ; +if (!vcpu ||lapic_in_kernel (vcpu)) + ent->eax |=HV_X64_CLUSTER_IPI_RECOMMENDED ; ent->eax |=HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED ;if (evmcs_ver) ent->eax |=HV_X64_ENLIGHTENED_VMCS_RECOMMENDED ;
Greg Kroah-Hartman
maintainerPATCH 501/578 KVM: nSVM: Enter guest mode before initializing nested NPT MMU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 46d6c6f3ef0eaff71c2db6d77d4e2ebb7adac34f upstream.
When preparing vmcb02 for nested VMRUN (or state restore), "enter" guest mode prior to initializing the MMU for nested NPT so that guest_mode is set in the MMU's role. KVM's model is that all L2 MMUs are tagged with guest_mode, as the behavior of hypervisor MMUs tends to be significantly different than kernel MMUs.
Practically speaking, the bug is relatively benign, as KVM only directly queries role.guest_mode in kvm_mmu_free_guest_mode_roots() and kvm_mmu_page_ad_need_write_protect(), which SVM doesn't use, and in paths that are optimizations (mmu_page_zap_pte() and shadow_mmu_try_split_huge_pages()).
And while the role is incorprated into shadow page usage, because nested NPT requires KVM to be using NPT for L1, reusing shadow pages across L1 and L2 is impossible as L1 MMUs will always have direct=1, while L2 MMUs will have direct=0.
Hoist the TLB processing and setting of HF_GUEST_MASK to the beginning of the flow instead of forcing guest_mode in the MMU, as nothing in nested_vmcb02_prepare_control() between the old and new locations touches TLB flush requests or HF_GUEST_MASK, i.e. there's no reason to present inconsistent vCPU state to the MMU.
--- arch/x86/kvm/mmu/mmu.c | 2 +- arch/x86/kvm/svm/nested.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/kvm/mmu/mmu.c +1 -1
@@ -5150,7 +5150,7 @@ void kvm_init_shadow_npt_mmu(struct kvm_union kvm_mmu_page_role root_role;/* NPT requires CR0.PG=1. */ -WARN_ON_ONCE (cpu_role.base.direct); +WARN_ON_ONCE (cpu_role.base.direct || !cpu_role.base.guest_mode); root_role = cpu_role.base; root_role.level =kvm_mmu_get_tdp_level (vcpu);
arch/x86/kvm/svm/nested.c +5 -5
@@ -619,6 +619,11 @@ static void nested_vmcb02_prepare_controu32 pause_count12;u32 pause_thresh12; +nested_svm_transition_tlb_flush (vcpu); + +/* Enter Guest-Mode */ +enter_guest_mode (vcpu); +/* * Filled at exit: exit_code, exit_code_hi, exit_info_1, exit_info_2, * exit_int_info, exit_int_info_err, next_rip, insn_len, insn_bytes.
@@ -717,11 +722,6 @@ static void nested_vmcb02_prepare_contro } } -nested_svm_transition_tlb_flush (vcpu); - -/* Enter Guest-Mode */ -enter_guest_mode (vcpu); -/* * Merge guest and host intercepts - must be called with vcpu in * guest-mode to take effect.
Greg Kroah-Hartman
maintainerPATCH 502/578 perf/x86/intel: Ensure LBRs are disabled when a CPU is starting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit c631a2de7ae48d50434bdc205d901423f8577c65 upstream.
Explicitly clear DEBUGCTL.LBR when a CPU is starting, prior to purging the LBR MSRs themselves, as at least one system has been found to transfer control to the kernel with LBRs enabled (it's unclear whether it's a BIOS flaw or a CPU goof). Because the kernel preserves the original DEBUGCTL, even when toggling LBRs, leaving DEBUGCTL.LBR as is results in running with LBRs enabled at all times.
--- arch/x86/events/intel/core.c | 5 ++++- arch/x86/include/asm/msr-index.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +4 -1
@@ -4582,8 +4582,11 @@ static void intel_pmu_cpu_starting(int cinit_debug_store_on_cpu (cpu);/* -* Deal with CPUs that don't clear their LBRs on power-up. +* Deal with CPUs that don't clear their LBRs on power-up, and that may +* even boot with LBRs enabled. */ +if (!static_cpu_has (X86_FEATURE_ARCH_LBR ) && x86_pmu.lbr_nr) +msr_clear_bit (MSR_IA32_DEBUGCTLMSR ,DEBUGCTLMSR_LBR_BIT );intel_pmu_lbr_reset (); cpuc->lbr_sel =NULL ;
arch/x86/include/asm/msr-index.h +2 -1
@@ -357,7 +357,8 @@#define MSR_IA32_PASID_VALID BIT_ULL(31)/* DEBUGCTLMSR bits (others vary by model): */ -#define DEBUGCTLMSR_LBR (1UL << 0)/* last branch recording */ +#define DEBUGCTLMSR_LBR_BIT 0/* last branch recording */ +#define DEBUGCTLMSR_LBR (1UL << DEBUGCTLMSR_LBR_BIT)#define DEBUGCTLMSR_BTF_SHIFT 1#define DEBUGCTLMSR_BTF (1UL << 1)/* single-step on branches */ #define DEBUGCTLMSR_BUS_LOCK_DETECT (1UL << 2)
Greg Kroah-Hartman
maintainerPATCH 503/578 usb: dwc3: Fix timeout issue during controller enter/exit from halt state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
commit d3a8c28426fc1fb3252753a9f1db0d691ffc21b0 upstream.
There is a frequent timeout during controller enter/exit from halt state after toggling the run_stop bit by SW. This timeout occurs when performing frequent role switches between host and device, causing device enumeration issues due to the timeout. This issue was not present when USB2 suspend PHY was disabled by passing the SNPS quirks (snps,dis_u2_susphy_quirk and snps,dis_enblslpm_quirk) from the DTS. However, there is a requirement to enable USB2 suspend PHY by setting of GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY bits when controller starts in gadget or host mode results in the timeout issue.
This commit addresses this timeout issue by ensuring that the bits GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY are cleared before starting the dwc3_gadget_run_stop sequence and restoring them after the dwc3_gadget_run_stop sequence is completed.
--- drivers/usb/dwc3/gadget.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/usb/dwc3/gadget.c +34 -0
@@ -2485,10 +2485,38 @@ static int dwc3_gadget_run_stop(struct d {u32 reg;u32 timeout =2000 ; +u32 saved_config =0 ;if (pm_runtime_suspended (dwc->dev))return 0 ; +/* +* When operating in USB 2.0 speeds (HS/FS), ensure that +* GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY are cleared before starting +* or stopping the controller. This resolves timeout issues that occur +* during frequent role switches between host and device modes. +* +* Save and clear these settings, then restore them after completing the +* controller start or stop sequence. +* +* This solution was discovered through experimentation as it is not +* mentioned in the dwc3 programming guide. It has been tested on an +* Exynos platforms. +*/ + reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )); +if (reg &DWC3_GUSB2PHYCFG_SUSPHY ) { + saved_config |=DWC3_GUSB2PHYCFG_SUSPHY ; + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ; + } + +if (reg &DWC3_GUSB2PHYCFG_ENBLSLPM ) { + saved_config |=DWC3_GUSB2PHYCFG_ENBLSLPM ; + reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ; + } + +if (saved_config) +dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg); + reg =dwc3_readl (dwc->regs,DWC3_DCTL );if (is_on) { if (DWC3_VER_IS_WITHIN(DWC3, ANY, 187A)) {
@@ -2516,6 +2544,12 @@ static int dwc3_gadget_run_stop(struct d reg &=DWC3_DSTS_DEVCTRLHLT ; }while (--timeout && !(!is_on ^ !reg)); +if (saved_config) { + reg =dwc3_readl (dwc->regs,DWC3_GUSB2PHYCFG (0 )); + reg |= saved_config; +dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg); + } +if (!timeout)return -ETIMEDOUT ;
Greg Kroah-Hartman
maintainerPATCH 504/578 usb: roles: set switch registered flag early on
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Elson Roy Serrao <[email protected]>
commit 634775a752a86784511018a108f3b530cc3399a7 upstream.
The role switch registration and set_role() can happen in parallel as they are invoked independent of each other. There is a possibility that a driver might spend significant amount of time in usb_role_switch_register() API due to the presence of time intensive operations like component_add() which operate under common mutex. This leads to a time window after allocating the switch and before setting the registered flag where the set role notifications are dropped. Below timeline summarizes this behavior
Thread1 | Thread2usb_role_switch_register() |
| | ---> allocate switch | | | ---> component_add() | usb_role_switch_set_role() | | | | | --> Drop role notifications | | since sw->registered | | flag is not set. | | --->Set registered flag.|
To avoid this, set the registered flag early on in the switch register API.
--- drivers/usb/roles/class.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/roles/class.c +3 -2
@@ -354,14 +354,15 @@ usb_role_switch_register(struct device *dev_set_name (&sw->dev,"%s-role-switch" , desc->name ? desc->name :dev_name (parent)); + sw->registered = true; + ret =device_register (&sw->dev);if (ret) { + sw->registered = false;put_device (&sw->dev);return ERR_PTR (ret); } - sw->registered = true; -/* TODO: Symlinks for the host port and the device controller. */ return sw;
Greg Kroah-Hartman
maintainerPATCH 505/578 usb: gadget: udc: renesas_usb3: Fix compiler warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Ren <[email protected]>
commit 335a1fc1193481f8027f176649c72868172f6f8b upstream.
drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]
2638 | snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
^~~~~~~~~~~~~~~~~~~~~~~~ ^~ ^--- drivers/usb/gadget/udc/renesas_usb3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -1
@@ -309,7 +309,7 @@ struct renesas_usb3_request {struct list_head queue; }; -#define USB3_EP_NAME_SIZE 8 +#define USB3_EP_NAME_SIZE 16struct renesas_usb3_ep {struct usb_ep ep;struct renesas_usb3 *usb3;
Greg Kroah-Hartman
maintainerPATCH 506/578 usb: dwc2: gadget: remove of_node reference upon udc_stop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabrice Gasnier <[email protected]>
commit 58cd423820d5b5610977e55e4acdd06628829ede upstream.
In dwc2_hsotg_udc_start(), e.g. when binding composite driver, "of_node" is set to hsotg->dev->of_node.
It causes errors when binding the gadget driver several times, on stm32mp157c-ev1 board. Below error is seen:
"pin PA10 already requested by 49000000.usb-otg; cannot claim for gadget.0"
The first time, no issue is seen as when registering the driver, of_node isn't NULL:
-> gadget_dev_desc_UDC_store
-> usb_gadget_register_driver_owner
-> driver_register
...
-> really_probe -> pinctrl_bind_pins (no effect)Then dwc2_hsotg_udc_start() sets of_node.
The second time (stop the gadget, reconfigure it, then start it again), of_node has been set, so the probing code tries to acquire pins for the gadget. These pins are hold by the controller, hence the error.
So clear gadget.dev.of_node in udc_stop() routine to avoid the issue.
--- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -4613,6 +4613,7 @@ static int dwc2_hsotg_udc_stop(struct usspin_lock_irqsave (&hsotg->lock, flags); hsotg->driver =NULL ; + hsotg->gadget.dev.of_node =NULL ; hsotg->gadget.speed =USB_SPEED_UNKNOWN ; hsotg->enabled =0 ;
Greg Kroah-Hartman
maintainerPATCH 507/578 USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit e71f7f42e3c874ac3314b8f250e8416a706165af upstream.
LS7A EHCI controller doesn't have extended capabilities, so the EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be fixed in future, now just clear the EECP field to avoid error messages on boot:
......
[ 0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff [ 0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff ...... [ 0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff [ 0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
......
--- drivers/usb/host/pci-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/pci-quirks.c +9 -0
@@ -946,6 +946,15 @@ static void quirk_usb_disable_ehci(struc* booting from USB disk or using a usb keyboard */ hcc_params =readl (base +EHCI_HCC_PARAMS ); + +/* LS7A EHCI controller doesn't have extended capabilities, the +* EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS +* register should be 0x0 but it reads as 0xa0. So clear it to +* avoid error messages on boot. +*/ +if (pdev->vendor ==PCI_VENDOR_ID_LOONGSON && pdev->device ==0x7a14 ) + hcc_params &= ~(0xffL <<8 ); + offset = (hcc_params >>8 ) &0xff ;while (offset && --count) {pci_read_config_dword (pdev, offset, &cap);
Greg Kroah-Hartman
maintainerPATCH 508/578 usb: core: fix pipe creation for get_bMaxPacketSize0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Eichenberger <[email protected]>
commit 4aac0db5a0ebc599d4ad9bf5ebab78afa1f33e10 upstream.
When usb_control_msg is used in the get_bMaxPacketSize0 function, the USB pipe does not include the endpoint device number. This can cause failures when a usb hub port is reinitialized after encountering a bad cable connection. As a result, the system logs the following error messages:
usb usb2-port1: cannot reset (err = -32)
usb usb2-port1: Cannot enable. Maybe the USB cable is bad? usb usb2-port1: attempt power cycle
usb 2-1: new high-speed USB device number 5 using ci_hdrc usb 2-1: device descriptor read/8, error -71
The problem began after commit 85d07c556216 ("USB: core: Unite old scheme and new scheme descriptor reads"). There usb_get_device_descriptor was replaced with get_bMaxPacketSize0. Unlike usb_get_device_descriptor, the get_bMaxPacketSize0 function uses the macro usb_rcvaddr0pipe, which does not include the endpoint device number. usb_get_device_descriptor, on the other hand, used the macro usb_rcvctrlpipe, which includes the endpoint device number.
By modifying the get_bMaxPacketSize0 function to use usb_rcvctrlpipe instead of usb_rcvaddr0pipe, the issue can be resolved. This change will ensure that the endpoint device number is included in the USB pipe, preventing reinitialization failures. If the endpoint has not set the device number yet, it will still work because the device number is 0 in udev.
--- drivers/usb/core/hub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/core/hub.c +1 -2
@@ -4651,7 +4651,6 @@ void usb_ep0_reinit(struct usb_device *uEXPORT_SYMBOL_GPL (usb_ep0_reinit);#define usb_sndaddr0pipe () (PIPE_CONTROL << 30) -#define usb_rcvaddr0pipe () ((PIPE_CONTROL << 30) | USB_DIR_IN)static int hub_set_address (struct usb_device *udev,int devnum) {
@@ -4757,7 +4756,7 @@ static int get_bMaxPacketSize0(struct usfor (i =0 ; i <GET_MAXPACKET0_TRIES ; ++i) {/* Start with invalid values in case the transfer fails */ buf->bDescriptorType = buf->bMaxPacketSize0 =0 ; - rc = usb_control_msg(udev, usb_rcvaddr0pipe(), + rc = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, USB_DT_DEVICE << 8, 0, buf, size,
Greg Kroah-Hartman
maintainerPATCH 509/578 USB: quirks: add USB_QUIRK_NO_LPM quirk for Teclast dist
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lei Huang <[email protected]>
commit e169d96eecd447ff7fd7542ca5fa0911f5622054 upstream.
Teclast disk used on Huawei hisi platforms doesn't work well, losing connectivity intermittently if LPM is enabled. Add quirk disable LPM to resolve the issue.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -522,6 +522,9 @@ static const struct usb_device_id usb_qu/* Blackmagic Design UltraStudio SDI */ { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, + /* Teclast disk */ + { USB_DEVICE(0x1f75, 0x0917), .driver_info = USB_QUIRK_NO_LPM }, + /* Hauppauge HVR-950q */ { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 510/578 USB: Add USB_QUIRK_NO_LPM quirk for sony xperia xz1 smartphone
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 159daf1258227f44b26b5d38f4aa8f37b8cca663 upstream.
The fastboot tool for communicating with Android bootloaders does not work reliably with this device if USB 2 Link Power Management (LPM) is enabled.
Various fastboot commands are affected, including the following, which usually reproduces the problem within two tries:
fastboot getvar kernel
getvar:kernel FAILED (remote: 'GetVar Variable Not found')
This issue was hidden on many systems up until commit 63a1f8454962 ("xhci: stored cached port capability values in one place") as the xhci driver failed to detect USB 2 LPM support if USB 3 ports were listed before USB 2 ports in the "supported protocol capabilities".
Adding the quirk resolves the issue. No drawbacks are expected since the device uses different USB product IDs outside of fastboot mode, and since fastboot commands worked before, until LPM was enabled on the tested system by the aforementioned commit.
Based on a patch from Forest <[email protected]> from which most of the code and commit message is taken.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -432,6 +432,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0c45, 0x7056), .driver_info = USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* Sony Xperia XZ1 Compact (lilac) smartphone in fastboot mode */ + { USB_DEVICE(0x0fce, 0x0dde), .driver_info = USB_QUIRK_NO_LPM }, + /* Action Semiconductor flash disk */ { USB_DEVICE(0x10d6, 0x2200), .driver_info = USB_QUIRK_STRING_FETCH_255 },
Greg Kroah-Hartman
maintainerPATCH 511/578 usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit da1668997052ed1cb00322e1f3b63702615c9429 upstream.
While the MIDI jacks are configured correctly, and the MIDIStreaming endpoint descriptors are filled with the correct information, bNumEmbMIDIJack and bLength are set incorrectly in these descriptors.
This does not matter when the numbers of in and out ports are equal, but when they differ the host will receive broken descriptors with uninitialized stack memory leaking into the descriptor for whichever value is smaller.
The precise meaning of "in" and "out" in the port counts is not clearly defined and can be confusing. But elsewhere the driver consistently uses this to match the USB meaning of IN and OUT viewed from the host, so that "in" ports send data to the host and "out" ports receive data from it.
--- drivers/usb/gadget/function/f_midi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_midi.c +4 -4
@@ -999,11 +999,11 @@ static int f_midi_bind(struct usb_config }/* configure the endpoint descriptors ... */ - ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); - ms_out_desc.bNumEmbMIDIJack = midi->in_ports; + ms_out_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); + ms_out_desc.bNumEmbMIDIJack = midi->out_ports; - ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->out_ports); - ms_in_desc.bNumEmbMIDIJack = midi->out_ports; + ms_in_desc.bLength =USB_DT_MS_ENDPOINT_SIZE (midi->in_ports); + ms_in_desc.bNumEmbMIDIJack = midi->in_ports;/* ... and add them to the list */ endpoint_descriptor_index = i;
Greg Kroah-Hartman
maintainerPATCH 512/578 USB: hub: Ignore non-compliant devices with too many configs or interfaces
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 2240fed37afbcdb5e8b627bc7ad986891100e05d upstream.
Robert Morris created a test program which can cause usb_hub_to_struct_hub() to dereference a NULL or inappropriate pointer:
Oops: general protection fault, probably for non-canonical address 0xcccccccccccccccc: 0000 [#1] SMP DEBUG_PAGEALLOC PTI CPU: 7 UID: 0 PID: 117 Comm: kworker/7:1 Not tainted 6.13.0-rc3-00017-gf44d154d6e3d #14 Hardware name: FreeBSD BHYVE/BHYVE, BIOS 14.0 10/17/2021 Workqueue: usb_hub_wq hub_event RIP: 0010:usb_hub_adjust_deviceremovable+0x78/0x110 ... Call Trace: <TASK> ? die_addr+0x31/0x80 ? exc_general_protection+0x1b4/0x3c0 ? asm_exc_general_protection+0x26/0x30 ? usb_hub_adjust_deviceremovable+0x78/0x110 hub_probe+0x7c7/0xab0 usb_probe_interface+0x14b/0x350 really_probe+0xd0/0x2d0 ? __pfx___device_attach_driver+0x10/0x10 __driver_probe_device+0x6e/0x110 driver_probe_device+0x1a/0x90 __device_attach_driver+0x7e/0xc0 bus_for_each_drv+0x7f/0xd0 __device_attach+0xaa/0x1a0 bus_probe_device+0x8b/0xa0 device_add+0x62e/0x810 usb_set_configuration+0x65d/0x990 usb_generic_driver_probe+0x4b/0x70 usb_probe_device+0x36/0xd0
The cause of this error is that the device has two interfaces, and the hub driver binds to interface 1 instead of interface 0, which is where usb_hub_to_struct_hub() looks.
We can prevent the problem from occurring by refusing to accept hub devices that violate the USB spec by having more than one configuration or interface.
--- drivers/usb/core/hub.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/core/hub.c +11 -0
@@ -1819,6 +1819,17 @@ static int hub_probe(struct usb_interfac hdev =interface_to_usbdev (intf);/* +* The USB 2.0 spec prohibits hubs from having more than one +* configuration or interface, and we rely on this prohibition. +* Refuse to accept a device that violates it. +*/ +if (hdev->descriptor.bNumConfigurations >1 || + hdev->actconfig->desc.bNumInterfaces >1 ) { +dev_err (&intf->dev,"Invalid hub with more than one config or interface\n" ); +return -EINVAL ; + } + +/* * Set default autosuspend delay as 0 to speedup bus suspend, * based on the below considerations: *
Greg Kroah-Hartman
maintainerPATCH 513/578 USB: cdc-acm: Fill in Renesas R-Car D3 USB Download mode quirk
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 7284922f3e4fa285dff1b8bb593aa9a0b8458f30 upstream.
Add Renesas R-Car D3 USB Download mode quirk and update comments on all the other Renesas R-Car USB Download mode quirks to discern them from each other. This follows R-Car Series, 3rd Generation reference manual Rev.2.00 chapter 19.2.8 USB download mode .
--- drivers/usb/class/cdc-acm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +6 -3
@@ -1703,13 +1703,16 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ .driver_info =NO_UNION_NORMAL ,/* has no union descriptor */ }, - { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x023c), /* Renesas R-Car H3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0247), /* Renesas R-Car D3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, - { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */ + { USB_DEVICE(0x045b, 0x0248), /* Renesas R-Car M3-N USB Download mode */ + .driver_info = DISABLE_ECHO, /* Don't echo banner */ + }, + { USB_DEVICE(0x045b, 0x024D), /* Renesas R-Car E3 USB Download mode */ .driver_info = DISABLE_ECHO, /* Don't echo banner */ }, { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; [email protected] */
Greg Kroah-Hartman
maintainerPATCH 514/578 usb: cdc-acm: Check control transfer buffer size before access
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit e563b01208f4d1f609bcab13333b6c0e24ce6a01 upstream.
If the first fragment is shorter than struct usb_cdc_notification, we can't calculate an expected_size. Log an error and discard the notification instead of reading lengths from memory outside the received data, which can lead to memory corruption when the expected_size decreases between fragments, causing expected_size - acm->nb_index to wrap.
This issue has been present since the beginning of git history; however, it only leads to memory corruption since commit ea2583529cd1 ("cdc-acm: reassemble fragmented notifications").
A mitigating factor is that acm_ctrl_irq() can only execute after userspace has opened /dev/ttyACM*; but if ModemManager is running, ModemManager will do that automatically depending on the USB device's vendor/product IDs and its other interfaces.
--- drivers/usb/class/cdc-acm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +14 -3
@@ -360,7 +360,7 @@ static void acm_process_notification(strstatic void acm_ctrl_irq (struct urb *urb) {struct acm *acm = urb->context; -struct usb_cdc_notification *dr = urb->transfer_buffer; +struct usb_cdc_notification *dr;unsigned int current_size = urb->actual_length;unsigned int expected_size, copy_size, alloc_size;int retval;
@@ -387,9 +387,20 @@ static void acm_ctrl_irq(struct urb *urbusb_mark_last_busy (acm->dev); -if (acm->nb_index) +if (acm->nb_index ==0 ) { +/* +* The first chunk of a message must contain at least the +* notification header with the length field, otherwise we +* can't get an expected_size. +*/ +if (current_size <sizeof (struct usb_cdc_notification )) { +dev_dbg (&acm->control->dev,"urb too short\n" ); + goto exit; + } + dr = urb->transfer_buffer; + }else { dr = (struct usb_cdc_notification *)acm->notification_buffer; - + }/* size = notification-header + (optional) data */ expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength);
Greg Kroah-Hartman
maintainerPATCH 515/578 usb: cdc-acm: Fix handling of oversized fragments
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 12e712964f41d05ae034989892de445781c46730 upstream.
If we receive an initial fragment of size 8 bytes which specifies a wLength of 1 byte (so the reassembled message is supposed to be 9 bytes long), and we then receive a second fragment of size 9 bytes (which is not supposed to happen), we currently wrongly bypass the fragment reassembly code but still pass the pointer to the acm->notification_buffer to acm_process_notification().
Make this less wrong by always going through fragment reassembly when we expect more fragments.
Before this patch, receiving an overlong fragment could lead to newctrl in acm_process_notification() being uninitialized data (instead of data coming from the device).
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -405,7 +405,7 @@ static void acm_ctrl_irq(struct urb *urb expected_size =sizeof (struct usb_cdc_notification ) +le16_to_cpu (dr->wLength); -if (current_size < expected_size) { +if (acm->nb_index !=0 || current_size < expected_size) {/* notification is transmitted fragmented, reassemble */ if (acm->nb_size < expected_size) {u8 *new_buffer;
Greg Kroah-Hartman
maintainerPATCH 516/578 USB: serial: option: add MeiG Smart SLM828
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chester A. Unal <[email protected]>
commit db79e75460fc59b19f9c89d4b068e61cee59f37d upstream.
MeiG Smart SLM828 is an LTE-A CAT6 modem with the mPCIe form factor. The "Cls=ff(vend.) Sub=10 Prot=02" and "Cls=ff(vend.) Sub=10 Prot=03" interfaces respond to AT commands. Add these interfaces.
The product ID the modem uses is shared across multiple modems. Therefore, add comments to describe which interface is used for which modem.
T: Bus=01 Lev=01 Prnt=05 Port=01 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2dee ProdID=4d22 Rev=05.04 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=4da7ec42 C: #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=10 Prot=01 Driver=(none) E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=02 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=03 Driver=(none) E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=04 Driver=(none) E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=88(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=10 Prot=05 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +10 -5
@@ -621,7 +621,10 @@ static void option_instat_callback(struc/* MeiG Smart Technology products */ #define MEIGSMART_VENDOR_ID 0x2dee -/* MeiG Smart SRM815/SRM825L based on Qualcomm 315 */ +/* +* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is +* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. +*/ #define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41
@@ -2405,10 +2408,12 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 517/578 USB: serial: option: add Telit Cinterion FN990B compositions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit c979fb5ece2dc11cc9cc3d5c66f750e210bfdee2 upstream.
Add the following Telit Cinterion FN990B40 compositions:
0x10d0: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 17 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d0 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d1: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d1 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d2: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 18 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d2 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10d3: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
tty (diag) + DPL + QDSS (Qualcomm Debug SubSystem) + adb
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 20 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10d3 Rev=05.15 S: Manufacturer=Telit Cinterion S: Product=FN990 S: SerialNumber=43b38f19 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none) E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/serial/option.c +16 -0
@@ -1406,6 +1406,22 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c8, 0xff), /* Telit FE910C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x60) }, /* Telit FN990B (rmnet) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x30), + .driver_info = NCTRL(5) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x60) }, /* Telit FN990B (MBIM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x60) }, /* Telit FN990B (RNDIS) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x30), + .driver_info = NCTRL(6) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x60) }, /* Telit FN990B (ECM) */ + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x40) }, + { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x30), + .driver_info = NCTRL(6) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
Greg Kroah-Hartman
maintainerPATCH 518/578 USB: serial: option: fix Telit Cinterion FN990A name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit 12606fe73f33647c5e79bf666833bf0b225e649d upstream.
The correct name for FN990 is FN990A so use it in order to avoid confusion with FN990B.
--- drivers/usb/serial/option.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/serial/option.c +5 -5
@@ -1370,15 +1370,15 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990A (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990A (MBIM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990A (RNDIS) */ .driver_info = NCTRL(2) | RSVD(3) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990A (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */ .driver_info = RSVD(0) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990 (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
Greg Kroah-Hartman
maintainerPATCH 519/578 USB: serial: option: drop MeiG Smart defines
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 6aa8a63c471eb6756aabd03f880feffe6a7af6c9 upstream.
Several MeiG Smart modems apparently use the same product id, making the defines even less useful.
Drop them in favour of using comments consistently to make the id table slightly less unwieldy.
--- drivers/usb/serial/option.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/usb/serial/option.c +8 -20
@@ -619,18 +619,6 @@ static void option_instat_callback(struc/* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */ #define LUAT_PRODUCT_AIR720U 0x4e00 -/* MeiG Smart Technology products */ -#define MEIGSMART_VENDOR_ID 0x2dee -/* -* MeiG Smart SLM828, SRM815, and SRM825L use the same product ID. SLM828 is -* based on Qualcomm SDX12. SRM815 and SRM825L are based on Qualcomm 315. -*/ -#define MEIGSMART_PRODUCT_SRM825L 0x4d22 -/* MeiG Smart SLM320 based on UNISOC UIS8910 */ -#define MEIGSMART_PRODUCT_SLM320 0x4d41 -/* MeiG Smart SLM770A based on ASR1803 */ -#define MEIGSMART_PRODUCT_SLM770A 0x4d57 -/* Device flags */ /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -2366,6 +2354,14 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a05, 0xff) }, /* Fibocom FM650-CN (NCM mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a06, 0xff) }, /* Fibocom FM650-CN (RNDIS mode) */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a07, 0xff) }, /* Fibocom FM650-CN (MBIM mode) */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d41, 0xff, 0, 0) }, /* MeiG Smart SLM320 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, 0xff, 0, 0) }, /* MeiG Smart SLM770A */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
@@ -2422,14 +2418,6 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, /* MeiG Smart SRM815 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */ - { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */ { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
Greg Kroah-Hartman
maintainerPATCH 520/578 can: ctucanfd: handle skb allocation failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 9bd24927e3eeb85642c7baa3b28be8bea6c2a078 upstream.
If skb allocation fails, the pointer to struct can_frame is NULL. This is actually handled everywhere inside ctucan_err_interrupt() except for the only place.
Add the missed NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- drivers/net/can/ctucanfd/ctucanfd_base.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/can/ctucanfd/ctucanfd_base.c +6 -4
@@ -867,10 +867,12 @@ static void ctucan_err_interrupt(struct }break ;case CAN_STATE_ERROR_ACTIVE : - cf->can_id |=CAN_ERR_CNT ; - cf->data[1 ] =CAN_ERR_CRTL_ACTIVE ; - cf->data[6 ] = bec.txerr; - cf->data[7 ] = bec.rxerr; +if (skb) { + cf->can_id |=CAN_ERR_CNT ; + cf->data[1 ] =CAN_ERR_CRTL_ACTIVE ; + cf->data[6 ] = bec.txerr; + cf->data[7 ] = bec.rxerr; + }break ;default : netdev_warn(ndev, "unhandled error state (%d:%s)!\n",
Greg Kroah-Hartman
maintainerPATCH 521/578 can: c_can: fix unbalanced runtime PM disable in error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 257a2cd3eb578ee63d6bf90475dc4f4b16984139 upstream.
Runtime PM is enabled as one of the last steps of probe(), so all earlier gotos to "exit_free_device" label were not correct and were leading to unbalanced runtime PM disable depth.
--- drivers/net/can/c_can/c_can_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/c_can/c_can_platform.c +3 -2
@@ -395,15 +395,16 @@ static int c_can_plat_probe(struct platfif (ret) {dev_err (&pdev->dev,"registering %s failed (err=%d)\n" ,KBUILD_MODNAME , ret); - goto exit_free_device; + goto exit_pm_runtime; }dev_info (&pdev->dev,"%s device registered (regs=%p, irq=%d)\n" ,KBUILD_MODNAME , priv->base, dev->irq);return 0 ; -exit_free_device: +exit_pm_runtime:pm_runtime_disable (priv->device); +exit_free_device:free_c_can_dev (dev); exit:dev_err (&pdev->dev,"probe failed\n" );
Greg Kroah-Hartman
maintainerPATCH 522/578 can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Hölzl <[email protected]>
commit 44de577e61ed239db09f0da9d436866bef9b77dd upstream.
The J1939 standard requires the transmission of messages of length 0.
For example proprietary messages are specified with a data length of 0 to 1785. The transmission of such messages is not possible. Sending results in no error being returned but no corresponding can frame being generated.
Enable the transmission of zero length J1939 messages. In order to facilitate this two changes are necessary:
1) If the transmission of a new message is requested from user space the message is segmented in j1939_sk_send_loop(). Let the segmentation take into account zero length messages, do not terminate immediately, queue the corresponding skb.
2) j1939_session_skb_get_by_offset() selects the next skb to transmit for a session. Take into account that there might be zero length skbs in the queue.
--- net/can/j1939/socket.c | 4 ++-- net/can/j1939/transport.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
net/can/j1939/socket.c +2 -2
@@ -1132,7 +1132,7 @@ static int j1939_sk_send_loop(struct j19 todo_size = size; -while (todo_size) { + do { struct j1939_sk_buff_cb *skcb; segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
@@ -1177,7 +1177,7 @@ static int j1939_sk_send_loop(struct j19 todo_size -= segment_size; session->total_queued_size += segment_size; - } + }while (todo_size);switch (ret) {case 0 :/* OK */
net/can/j1939/transport.c +3 -2
@@ -382,8 +382,9 @@ sk_buff *j1939_session_skb_get_by_offset skb_queue_walk(&session->skb_queue, do_skb) { do_skcb =j1939_skb_to_cb (do_skb); -if (offset_start >= do_skcb->offset && - offset_start < (do_skcb->offset + do_skb->len)) { +if ((offset_start >= do_skcb->offset && + offset_start < (do_skcb->offset + do_skb->len)) || + (offset_start ==0 && do_skcb->offset ==0 && do_skb->len ==0 )) { skb = do_skb; } }
Greg Kroah-Hartman
maintainerPATCH 523/578 alpha: make stack 16-byte aligned (most cases)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 0a0f7362b0367634a2d5cb7c96226afc116f19c9 upstream.
The problem is that GCC expects 16-byte alignment of the incoming stack since early 2004, as Maciej found out [1]:
Having actually dug speculatively I can see that the psABI was changed in
GCC 3.5 with commit e5e10fb4a350 ("re PR target/14539 (128-bit long double improperly aligned)") back in Mar 2004, when the stack pointer alignment was increased from 8 bytes to 16 bytes, and arch/alpha/kernel/entry.S has various suspicious stack pointer adjustments, starting with SP_OFF which is not a whole multiple of 16.
Also, as Magnus noted, "ALPHA Calling Standard" [2] required the same:
D.3.1 Stack Alignment
This standard requires that stacks be octaword aligned at the time a new procedure is invoked.
However:
- the "normal" kernel stack is always misaligned by 8 bytes, thanks to the odd number of 64-bit words in 'struct pt_regs', which is the very first thing pushed onto the kernel thread stack;
- syscall, fault, interrupt etc. handlers may, or may not, receive aligned stack depending on numerous factors.
Somehow we got away with it until recently, when we ended up with a stack corruption in kernel/smp.c:smp_call_function_single() due to its use of 32-byte aligned local data and the compiler doing clever things allocating it on the stack.
This adds padding between the PAL-saved and kernel-saved registers so that 'struct pt_regs' have an even number of 64-bit words. This makes the stack properly aligned for most of the kernel code, except two handlers which need special threatment.
Note: struct pt_regs doesn't belong in uapi/asm; this should be fixed, but let's put this off until later.
--- arch/alpha/include/uapi/asm/ptrace.h | 2 ++ 1 file changed, 2 insertions(+)
arch/alpha/include/uapi/asm/ptrace.h +2 -0
@@ -42,6 +42,8 @@ struct pt_regs {unsigned long trap_a0;unsigned long trap_a1;unsigned long trap_a2; +/* This makes the stack 16-byte aligned as GCC expects */ +unsigned long __pad0;/* These are saved by PAL-code: */ unsigned long ps;unsigned long pc;
Greg Kroah-Hartman
maintainerPATCH 524/578 efi: Avoid cold plugged memory for placing the kernel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit ba69e0750b0362870294adab09339a0c39c3beaf upstream.
UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory regions that are 'cold plugged' at boot, i.e., hot pluggable memory that is available from early boot, and described as system RAM by the firmware.
Existing loaders and EFI applications running in the boot context will happily use this memory for allocating data structures that cannot be freed or moved at runtime, and this prevents the memory from being unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute should be tested, and memory annotated as such should be avoided for such allocations.
In the EFI stub, there are a couple of occurrences where, instead of the high-level AllocatePages() UEFI boot service, a low-level code sequence is used that traverses the EFI memory map and carves out the requested number of pages from a free region. This is needed, e.g., for allocating as low as possible, or for allocating pages at random.
While AllocatePages() should presumably avoid special purpose memory and cold plugged regions, this manual approach needs to incorporate this logic itself, in order to prevent the kernel itself from ending up in a hot unpluggable region, preventing it from being unplugged.
So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it where appropriate.
--- drivers/firmware/efi/efi.c | 6 ++++-- drivers/firmware/efi/libstub/randomalloc.c | 3 +++ drivers/firmware/efi/libstub/relocate.c | 3 +++ include/linux/efi.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +4 -2
@@ -835,13 +835,15 @@ char * __init efi_md_typeattr_format(chaEFI_MEMORY_WB |EFI_MEMORY_UCE |EFI_MEMORY_RO |EFI_MEMORY_WP |EFI_MEMORY_RP |EFI_MEMORY_XP |EFI_MEMORY_NV |EFI_MEMORY_SP |EFI_MEMORY_CPU_CRYPTO | - EFI_MEMORY_RUNTIME | EFI_MEMORY_MORE_RELIABLE)) +EFI_MEMORY_MORE_RELIABLE |EFI_MEMORY_HOT_PLUGGABLE | + EFI_MEMORY_RUNTIME)) snprintf(pos, size, "|attr=0x%016llx]", (unsigned long long)attr); else snprintf(pos, size, -"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , +"|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]" , attr &EFI_MEMORY_RUNTIME ?"RUN" :"" , + attr &EFI_MEMORY_HOT_PLUGGABLE ?"HP" :"" , attr &EFI_MEMORY_MORE_RELIABLE ?"MR" :"" , attr &EFI_MEMORY_CPU_CRYPTO ?"CC" :"" , attr & EFI_MEMORY_SP ? "SP" : "",
drivers/firmware/efi/libstub/randomalloc.c +3 -0
@@ -25,6 +25,9 @@ static unsigned long get_entry_num_slotsif (md->type !=EFI_CONVENTIONAL_MEMORY )return 0 ; +if (md->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +return 0 ; +if (efi_soft_reserve_enabled () && (md->attribute &EFI_MEMORY_SP ))return 0 ;
drivers/firmware/efi/libstub/relocate.c +3 -0
@@ -53,6 +53,9 @@ efi_status_t efi_low_alloc_above(unsigneif (desc->type !=EFI_CONVENTIONAL_MEMORY )continue ; +if (desc->attribute &EFI_MEMORY_HOT_PLUGGABLE ) +continue ; +if (efi_soft_reserve_enabled () && (desc->attribute &EFI_MEMORY_SP ))continue ;
include/linux/efi.h +1 -0
@@ -125,6 +125,7 @@ typedef struct {#define EFI_MEMORY_RO ((u64)0x0000000000020000ULL)/* read-only */ #define EFI_MEMORY_SP ((u64)0x0000000000040000ULL)/* soft reserved */ #define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL)/* supports encryption */ +#define EFI_MEMORY_HOT_PLUGGABLE BIT_ULL(20)/* supports unplugging at runtime */ #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL)/* range requires runtime mapping */ #define EFI_MEMORY_DESCRIPTOR_VERSION 1
Greg Kroah-Hartman
maintainerPATCH 525/578 cgroup: fix race between fork and cgroup.kill
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
commit b69bb476dee99d564d65d418e9a20acca6f32c3f upstream.
Tejun reported the following race between fork() and cgroup.kill at [1].
Tejun:
I was looking at cgroup.kill implementation and wondering whether there could be a race window. So, __cgroup_kill() does the following:
k1. Set CGRP_KILL.
k2. Iterate tasks and deliver SIGKILL.
k3. Clear CGRP_KILL.
The copy_process() does the following:
c1. Copy a bunch of stuff.
c2. Grab siglock.
c3. Check fatal_signal_pending().
c4. Commit to forking.
c5. Release siglock.
c6. Call cgroup_post_fork() which puts the task on the css_set and tests
CGRP_KILL.
The intention seems to be that either a forking task gets SIGKILL and terminates on c3 or it sees CGRP_KILL on c6 and kills the child. However, I don't see what guarantees that k3 can't happen before c6. ie. After a forking task passes c5, k2 can take place and then before the forking task reaches c6, k3 can happen. Then, nobody would send SIGKILL to the child. What am I missing?
This is indeed a race. One way to fix this race is by taking cgroup_threadgroup_rwsem in write mode in __cgroup_kill() as the fork() side takes cgroup_threadgroup_rwsem in read mode from cgroup_can_fork() to cgroup_post_fork(). However that would be heavy handed as this adds one more potential stall scenario for cgroup.kill which is usually called under extreme situation like memory pressure.
To fix this race, let's maintain a sequence number per cgroup which gets incremented on __cgroup_kill() call. On the fork() side, the cgroup_can_fork() will cache the sequence number locally and recheck it against the cgroup's sequence number at cgroup_post_fork() site. If the sequence numbers mismatch, it means __cgroup_kill() can been called and we should send SIGKILL to the newly created task.
--- include/linux/cgroup-defs.h | 6 +++--- include/linux/sched/task.h | 1 + kernel/cgroup/cgroup.c | 20 ++++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-)
include/linux/cgroup-defs.h +3 -3
@@ -71,9 +71,6 @@ enum {/* Cgroup is frozen. */ CGRP_FROZEN, - -/* Control group has to be killed. */ - CGRP_KILL, };/* cgroup_root->flags */
@@ -424,6 +421,9 @@ struct cgroup {int nr_threaded_children;/* # of live threaded child cgroups */ +/* sequence number for cgroup.kill, serialized by css_set_lock. */ +unsigned int kill_seq; +struct kernfs_node *kn;/* cgroup kernfs entry */ struct cgroup_file procs_file;/* handle for "cgroup.procs" */ struct cgroup_file events_file;/* handle for "cgroup.events" */
include/linux/sched/task.h +1 -0
@@ -38,6 +38,7 @@ struct kernel_clone_args {void *fn_arg;struct cgroup *cgrp;struct css_set *cset; +unsigned int kill_seq; };/*
kernel/cgroup/cgroup.c +12 -8
@@ -3952,7 +3952,7 @@ static void __cgroup_kill(struct cgrouplockdep_assert_held (&cgroup_mutex);spin_lock_irq (&css_set_lock); -set_bit (CGRP_KILL , &cgrp->flags); + cgrp->kill_seq++;spin_unlock_irq (&css_set_lock);css_task_iter_start (&cgrp->self,CSS_TASK_ITER_PROCS |CSS_TASK_ITER_THREADED , &it);
@@ -3968,10 +3968,6 @@ static void __cgroup_kill(struct cgroupsend_sig (SIGKILL , task,0 ); }css_task_iter_end (&it); - -spin_lock_irq (&css_set_lock); -clear_bit (CGRP_KILL , &cgrp->flags); -spin_unlock_irq (&css_set_lock); }static void cgroup_kill (struct cgroup *cgrp)
@@ -6409,6 +6405,10 @@ static int cgroup_css_set_fork(struct kespin_lock_irq (&css_set_lock); cset =task_css_set (current);get_css_set (cset); +if (kargs->cgrp) + kargs->kill_seq = kargs->cgrp->kill_seq; +else + kargs->kill_seq = cset->dfl_cgrp->kill_seq;spin_unlock_irq (&css_set_lock);if (!(kargs->flags &CLONE_INTO_CGROUP )) {
@@ -6592,6 +6592,7 @@ void cgroup_post_fork(struct task_struct struct kernel_clone_args *kargs) __releases(&cgroup_threadgroup_rwsem) __releases(&cgroup_mutex) { + unsigned int cgrp_kill_seq = 0; unsigned long cgrp_flags = 0; bool kill = false; struct cgroup_subsys *ss;
@@ -6605,10 +6606,13 @@ void cgroup_post_fork(struct task_struct/* init tasks are special, only link regular threads */ if (likely (child->pid)) { -if (kargs->cgrp) +if (kargs->cgrp) { cgrp_flags = kargs->cgrp->flags; -else + cgrp_kill_seq = kargs->cgrp->kill_seq; + }else { cgrp_flags = cset->dfl_cgrp->flags; + cgrp_kill_seq = cset->dfl_cgrp->kill_seq; + }WARN_ON_ONCE (!list_empty (&child->cg_list)); cset->nr_tasks++;
@@ -6643,7 +6647,7 @@ void cgroup_post_fork(struct task_struct* child down right after we finished preparing it for * userspace. */ - kill =test_bit (CGRP_KILL , &cgrp_flags); + kill = kargs->kill_seq != cgrp_kill_seq; }spin_unlock_irq (&css_set_lock);
Greg Kroah-Hartman
maintainerPATCH 526/578 serial: 8250: Fix fifo underflow on flush
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit 9e512eaaf8f4008c44ede3dfc0fbc9d9c5118583 upstream.
When flushing the serial port's buffer, uart_flush_buffer() calls kfifo_reset() but if there is an outstanding DMA transfer then the completion function will consume data from the kfifo via uart_xmit_advance(), underflowing and leading to ongoing DMA as the driver tries to transmit another 2^32 bytes.
This is readily reproduced with serial-generic and amidi sending even short messages as closing the device on exit will wait for the fifo to drain and in the underflow case amidi hangs for 30 seconds on exit in tty_wait_until_sent(). A trace of that gives:
kworker/1:1-84 [001] 51.769423: bprint: serial8250_tx_dma: tx_size=3 fifo_len=3
amidi-763 [001] 51.769460: bprint: uart_flush_buffer: resetting fifo
irq/21-fe530000-76 [000] 51.769474: bprint: __dma_tx_complete: tx_size=3
irq/21-fe530000-76 [000] 51.769479: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294967293
irq/21-fe530000-76 [000] 51.781295: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.781301: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294963197
irq/21-fe530000-76 [000] 51.793131: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.793135: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294959101
irq/21-fe530000-76 [000] 51.804949: bprint: __dma_tx_complete: tx_size=4096Since the port lock is held in when the kfifo is reset in uart_flush_buffer() and in __dma_tx_complete(), adding a flush_buffer hook to adjust the outstanding DMA byte count is sufficient to avoid the kfifo underflow.
--- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_dma.c | 16 ++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 9 +++++++++ 3 files changed, 27 insertions(+)
drivers/tty/serial/8250/8250.h +2 -0
@@ -344,6 +344,7 @@ static inline int is_omap1510_8250(struc#ifdef CONFIG_SERIAL_8250_DMA extern int serial8250_tx_dma (struct uart_8250_port *); +extern void serial8250_tx_dma_flush (struct uart_8250_port *);extern int serial8250_rx_dma (struct uart_8250_port *);extern void serial8250_rx_dma_flush (struct uart_8250_port *);extern int serial8250_request_dma (struct uart_8250_port *);
@@ -376,6 +377,7 @@ static inline int serial8250_tx_dma(stru {return -1 ; } +static inline void serial8250_tx_dma_flush (struct uart_8250_port *p) { }static inline int serial8250_rx_dma (struct uart_8250_port *p) {return -1 ;
drivers/tty/serial/8250/8250_dma.c +16 -0
@@ -133,6 +133,22 @@ err:return ret; } +void serial8250_tx_dma_flush (struct uart_8250_port *p) +{ +struct uart_8250_dma *dma = p->dma; + +if (!dma->tx_running) +return ; + +/* +* kfifo_reset() has been called by the serial core, avoid +* advancing and underflowing in __dma_tx_complete(). +*/ + dma->tx_size =0 ; + +dmaengine_terminate_async (dma->rxchan); +} +int serial8250_rx_dma (struct uart_8250_port *p) {struct uart_8250_dma *dma = p->dma;
drivers/tty/serial/8250/8250_port.c +9 -0
@@ -2550,6 +2550,14 @@ static unsigned int npcm_get_divisor(strreturn DIV_ROUND_CLOSEST (port->uartclk,16 * baud +2 ) -2 ; } +static void serial8250_flush_buffer (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); + +if (up->dma) +serial8250_tx_dma_flush (up); +} +static unsigned int serial8250_do_get_divisor (struct uart_port *port,unsigned int baud,unsigned int *frac)
@@ -3260,6 +3268,7 @@ static const struct uart_ops serial8250_ .break_ctl = serial8250_break_ctl, .startup = serial8250_startup, .shutdown = serial8250_shutdown, + .flush_buffer = serial8250_flush_buffer, .set_termios = serial8250_set_termios, .set_ldisc = serial8250_set_ldisc, .pm = serial8250_pm,
Greg Kroah-Hartman
maintainerPATCH 527/578 alpha: align stack for page fault and user unaligned trap handlers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 3b35a171060f846b08b48646b38c30b5d57d17ff upstream.
do_page_fault() and do_entUna() are special because they use non-standard stack frame layout. Fix them manually.
--- arch/alpha/kernel/entry.S | 20 ++++++++++---------- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
arch/alpha/kernel/entry.S +10 -10
@@ -199,8 +199,8 @@ CFI_END_OSF_FRAME entArith CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ - subq $sp, 56, $sp - .cfi_adjust_cfa_offset 56 + subq $sp, 64, $sp + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -215,7 +215,7 @@ CFI_START_OSF_FRAME entMM .cfi_rel_offset $13, 32 .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 - addq $sp, 56, $19 + addq $sp, 64, $19 /* handle the fault */ lda $8, 0x3fff bic $sp, $8, $8
@@ -228,7 +228,7 @@ CFI_START_OSF_FRAME entMM ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - addq $sp, 56, $sp + addq $sp, 64, $sp .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -236,7 +236,7 @@ CFI_START_OSF_FRAME entMM .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 /* finish up the syscall as normal. */ br ret_from_sys_call CFI_END_OSF_FRAME entMM
@@ -383,8 +383,8 @@ entUnaUser: .cfi_restore $0 .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ - lda $sp, -56($sp) - .cfi_adjust_cfa_offset 56 + lda $sp, -64($sp) + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -400,7 +400,7 @@ entUnaUser: .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 lda $8, 0x3fff - addq $sp, 56, $19 + addq $sp, 64, $19 bic $sp, $8, $8 jsr $26, do_entUnaUser ldq $9, 0($sp)
@@ -410,7 +410,7 @@ entUnaUser: ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - lda $sp, 56($sp) + lda $sp, 64($sp) .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -418,7 +418,7 @@ entUnaUser: .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 br ret_from_sys_call CFI_END_OSF_FRAME entUna
arch/alpha/kernel/traps.c +1 -1
@@ -707,7 +707,7 @@ s_reg_to_mem (unsigned long s_reg)static int unauser_reg_offsets[32 ] = {R (r0),R (r1),R (r2),R (r3),R (r4),R (r5),R (r6),R (r7),R (r8),/* r9 ... r15 are stored in front of regs. */ --56 ,-48 ,-40 ,-32 ,-24 ,-16 ,-8 , +-64 ,-56 ,-48 ,-40 ,-32 ,-24 ,-16 ,/* padding at -8 */ R (r16),R (r17),R (r18),R (r19),R (r20),R (r21),R (r22),R (r23),R (r24),R (r25),R (r26),R (r27),R (r28),R (gp),
arch/alpha/mm/fault.c +2 -2
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct */* Macro for exception fixup code to access integer registers. */ #define dpf_reg (r) \ - (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ - (r) <= 18 ? (r)+10 : (r)-10]) + (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \ + (r) <= 18 ? (r)+11 : (r)-10]) asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
Greg Kroah-Hartman
maintainerPATCH 528/578 gpiolib: acpi: Add a quirk for Acer Nitro ANV14
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 8743d66979e494c5378563e6b5a32e913380abd8 upstream.
Spurious immediate wake up events are reported on Acer Nitro ANV14. GPIO 11 is specified as an edge triggered input and also a wake source but this pin is supposed to be an output pin for an LED, so it's effectively floating.
Block the interrupt from getting set up for this GPIO on this device.
--- drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpiolib-acpi.c +14 -0
@@ -1640,6 +1640,20 @@ static const struct dmi_system_id gpioli .ignore_wake = "PNP0C50:00@8", }, }, + { + /* + * Spurious wakeups from GPIO 11 + * Found in BIOS 1.04 + * https://gitlab.freedesktop.org/drm/amd/-/issues/3954 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Acer Nitro V 14"), + }, + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { + .ignore_interrupt = "AMDI0030:00@11", + }, + }, {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 529/578 gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit b9644fbfbcab13da7f8b37bef7c51e5b8407d031 upstream.
The stmpe_reg_read function can fail, but its return value is not checked in stmpe_gpio_irq_sync_unlock. This can lead to silent failures and incorrect behavior if the hardware access fails.
This patch adds checks for the return value of stmpe_reg_read. If the function fails, an error message is logged and the function returns early to avoid further issues.
--- drivers/gpio/gpio-stmpe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpio/gpio-stmpe.c +12 -3
@@ -191,7 +191,7 @@ static void stmpe_gpio_irq_sync_unlock(s [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB, [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB, }; -int i, j; +int ret, i, j;/* * STMPE1600: to be able to get IRQ from pins,
@@ -199,8 +199,16 @@ static void stmpe_gpio_irq_sync_unlock(s* GPSR or GPCR registers */ if (stmpe->partnum ==STMPE1600 ) { -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_LSB: %d\n" , ret); + goto err; + } + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_CSB: %d\n" , ret); + goto err; + } }for (i =0 ; i <CACHE_NR_REGS ; i++) {
@@ -222,6 +230,7 @@ static void stmpe_gpio_irq_sync_unlock(s } } +err:mutex_unlock (&stmpe_gpio->irq_lock); }
Greg Kroah-Hartman
maintainerPATCH 530/578 partitions: mac: fix handling of bogus partition table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 80e648042e512d5a767da251d44132553fe04ae0 upstream.
Fix several issues in partition probing:
- The bailout for a bad partoffset must use put_dev_sector(), since the preceding read_part_sector() succeeded.
- If the partition table claims a silly sector size like 0xfff bytes (which results in partition table entries straddling sector boundaries), bail out instead of accessing out-of-bounds memory.
- We must not assume that the partition table contains proper NUL termination - use strnlen() and strncmp() instead of strlen() and strcmp().
--- block/partitions/mac.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
block/partitions/mac.c +15 -3
@@ -51,13 +51,25 @@ int mac_partition(struct parsed_partitio } secsize =be16_to_cpu (md->block_size);put_dev_sector (sect); + +/* +* If the "block size" is not a power of 2, things get weird - we might +* end up with a partition straddling a sector boundary, so we wouldn't +* be able to read a partition entry with read_part_sector(). +* Real block sizes are probably (?) powers of two, so just require +* that. +*/ +if (!is_power_of_2 (secsize)) +return -1 ; datasize =round_down (secsize,512 ); data =read_part_sector (state, datasize /512 , §);if (!data)return -1 ; partoffset = secsize %512 ; -if (partoffset +sizeof (*part) > datasize) +if (partoffset +sizeof (*part) > datasize) { +put_dev_sector (sect);return -1 ; + } part = (struct mac_partition *) (data + partoffset);if (be16_to_cpu (part->signature) !=MAC_PARTITION_MAGIC ) {put_dev_sector (sect);
@@ -110,8 +122,8 @@ int mac_partition(struct parsed_partitioint i, l; goodness++; - l =strlen (part->name); -if (strcmp (part->name,"/" ) ==0 ) + l =strnlen (part->name,sizeof (part->name)); +if (strncmp (part->name,"/" ,sizeof (part->name)) ==0 ) goodness++;for (i =0 ; i <= l -4 ; ++i) { if (strncasecmp(part->name + i, "root",
Greg Kroah-Hartman
maintainerPATCH 531/578 regmap-irq: Add missing kfree()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 32ffed055dcee17f6705f545b069e44a66067808 upstream.
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
--- drivers/base/regmap/regmap-irq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap-irq.c +2 -0
@@ -1059,6 +1059,7 @@ err_alloc:kfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_buf);kfree (d->status_reg_buf);if (d->virt_buf) {
@@ -1139,6 +1140,7 @@ void regmap_del_irq_chip(int irq, structkfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_reg_buf);kfree (d->status_buf);if (d->config_buf) {
Greg Kroah-Hartman
maintainerPATCH 532/578 arm64: Handle .ARM.attributes section in linker scripts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ca0f4fe7cf7183bfbdc67ca2de56ae1fc3a8db2b upstream.
A recent LLVM commit [1] started generating an .ARM.attributes section similar to the one that exists for 32-bit, which results in orphan section warnings (or errors if CONFIG_WERROR is enabled) from the linker because it is not handled in the arm64 linker scripts.
ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.ARM.attributes) is being placed in '.ARM.attributes'
ld.lld: error: vmlinux.a(lib/vsprintf.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes'
Discard the new sections in the necessary linker scripts to resolve the warnings, as the kernel and vDSO do not need to retain it, similar to the .note.gnu.property section.
--- arch/arm64/kernel/vdso/vdso.lds.S | 1 + arch/arm64/kernel/vmlinux.lds.S | 1 + 2 files changed, 2 insertions(+)
arch/arm64/kernel/vdso/vdso.lds.S +1 -0
@@ -38,6 +38,7 @@ SECTIONS */ /DISCARD/ : { *(.note.GNU-stack .note.gnu.property) + *(.ARM.attributes) } .note : { *(.note.*) } :text :note
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -149,6 +149,7 @@ SECTIONS /DISCARD/ : { *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) + *(.ARM.attributes) } . = KIMAGE_VADDR;
Greg Kroah-Hartman
maintainerPATCH 533/578 mmc: mtk-sd: Fix register settings for hs400(es) mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy-ld Lu <[email protected]>
commit 3e68abf2b9cebe76c6cd4b1aca8e95cd671035a3 upstream.
For hs400(es) mode, the 'hs400-ds-delay' is typically configured in the dts. However, some projects may only define 'mediatek,hs400-ds-dly3', which can lead to initialization failures in hs400es mode. CMD13 reported response crc error in the mmc_switch_status() just after switching to hs400es mode.
[ 1.914038][ T82] mmc0: mmc_select_hs400es failed, error -84 [ 1.914954][ T82] mmc0: error -84 whilst initialising MMC card
Currently, the hs400_ds_dly3 value is set within the tuning function. This means that the PAD_DS_DLY3 field is not configured before tuning process, which is the reason for the above-mentioned CMD13 response crc error.
Move the PAD_DS_DLY3 field configuration into msdc_prepare_hs400_tuning(), and add a value check of hs400_ds_delay to prevent overwriting by zero when the 'hs400-ds-delay' is not set in the dts. In addition, since hs400(es) only tune the PAD_DS_DLY1, the PAD_DS_DLY2_SEL bit should be cleared to bypass it.
--- drivers/mmc/host/mtk-sd.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/mmc/host/mtk-sd.c +20 -11
@@ -262,6 +262,7 @@#define MSDC_PAD_TUNE_CMD_SEL BIT(21)/* RW */ #define PAD_DS_TUNE_DLY_SEL BIT(0)/* RW */ +#define PAD_DS_TUNE_DLY2_SEL BIT(1)/* RW */ #define PAD_DS_TUNE_DLY1 GENMASK(6, 2)/* RW */ #define PAD_DS_TUNE_DLY2 GENMASK(11, 7)/* RW */ #define PAD_DS_TUNE_DLY3 GENMASK(16, 12)/* RW */
@@ -307,6 +308,7 @@/* EMMC50_PAD_DS_TUNE mask */ #define PAD_DS_DLY_SEL BIT(16)/* RW */ +#define PAD_DS_DLY2_SEL BIT(15)/* RW */ #define PAD_DS_DLY1 GENMASK(14, 10)/* RW */ #define PAD_DS_DLY3 GENMASK(4, 0)/* RW */
@@ -2293,13 +2295,23 @@ tune_done:static int msdc_prepare_hs400_tuning (struct mmc_host *mmc,struct mmc_ios *ios) {struct msdc_host *host =mmc_priv (mmc); + host->hs400_mode = true; -if (host->top_base) -writel (host->hs400_ds_delay, - host->top_base +EMMC50_PAD_DS_TUNE ); -else -writel (host->hs400_ds_delay, host->base +PAD_DS_TUNE ); +if (host->top_base) { +if (host->hs400_ds_dly3) +sdr_set_field (host->top_base +EMMC50_PAD_DS_TUNE , +PAD_DS_DLY3 , host->hs400_ds_dly3); +if (host->hs400_ds_delay) +writel (host->hs400_ds_delay, + host->top_base +EMMC50_PAD_DS_TUNE ); + }else { +if (host->hs400_ds_dly3) +sdr_set_field (host->base +PAD_DS_TUNE , +PAD_DS_TUNE_DLY3 , host->hs400_ds_dly3); +if (host->hs400_ds_delay) +writel (host->hs400_ds_delay, host->base +PAD_DS_TUNE ); + }/* hs400 mode must set it to 0 */ sdr_clr_bits (host->base +MSDC_PATCH_BIT2 ,MSDC_PATCH_BIT2_CFGCRCSTS );/* to improve read performance, set outstanding to 2 */
@@ -2319,14 +2331,11 @@ static int msdc_execute_hs400_tuning(strif (host->top_base) {sdr_set_bits (host->top_base +EMMC50_PAD_DS_TUNE ,PAD_DS_DLY_SEL ); -if (host->hs400_ds_dly3) -sdr_set_field (host->top_base +EMMC50_PAD_DS_TUNE , -PAD_DS_DLY3 , host->hs400_ds_dly3); +sdr_clr_bits (host->top_base +EMMC50_PAD_DS_TUNE , +PAD_DS_DLY2_SEL ); }else {sdr_set_bits (host->base +PAD_DS_TUNE ,PAD_DS_TUNE_DLY_SEL ); -if (host->hs400_ds_dly3) -sdr_set_field (host->base +PAD_DS_TUNE , -PAD_DS_TUNE_DLY3 , host->hs400_ds_dly3); +sdr_clr_bits (host->base +PAD_DS_TUNE ,PAD_DS_TUNE_DLY2_SEL ); } host->hs400_tuning = true;
Greg Kroah-Hartman
maintainerPATCH 534/578 mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit fee5d688940690cc845937459e340e4e02598e90 upstream.
Add a check for the return value of mlxsw_sp_port_get_stats_raw() in __mlxsw_sp_port_get_stats(). If mlxsw_sp_port_get_stats_raw() returns an error, exit the function to prevent further processing with potentially invalid data.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +3 -1
@@ -768,7 +768,9 @@ static void __mlxsw_sp_port_get_stats(st err =mlxsw_sp_get_hw_stats_by_group (&hw_stats, &len, grp);if (err)return ; -mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); + err =mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); +if (err) +return ;for (i =0 ; i < len; i++) { data[data_index + i] = hw_stats[i].getter (ppcnt_pl);if (!hw_stats[i].cells_bytes)
Greg Kroah-Hartman
maintainerPATCH 535/578 btrfs: fix hole expansion when writing at an offset beyond EOF
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit da2dccd7451de62b175fb8f0808d644959e964c7 upstream.
At btrfs_write_check() if our file's i_size is not sector size aligned and we have a write that starts at an offset larger than the i_size that falls within the same page of the i_size, then we end up not zeroing the file range [i_size, write_offset).
The code is this:
start_pos = round_down(pos, fs_info->sectorsize);
oldsize = i_size_read(inode);
if (start_pos > oldsize) {
/* Expand hole size to cover write data, preventing empty gap */
loff_t end_pos = round_up(pos + count, fs_info->sectorsize);
ret = btrfs_cont_expand(BTRFS_I(inode), oldsize, end_pos);
if (ret)
return ret;
}So if our file's i_size is 90269 bytes and a write at offset 90365 bytes comes in, we get 'start_pos' set to 90112 bytes, which is less than the i_size and therefore we don't zero out the range [90269, 90365) by calling btrfs_cont_expand().
This is an old bug introduced in commit 9036c10208e1 ("Btrfs: update hole handling v2"), from 2008, and the buggy code got moved around over the years.
Fix this by discarding 'start_pos' and comparing against the write offset ('pos') without any alignment.
This bug was recently exposed by test case generic/363 which tests this scenario by polluting ranges beyond EOF with an mmap write and than verify that after a file increases we get zeroes for the range which is supposed to be a hole and not what we wrote with the previous mmaped write.
We're only seeing this exposed now because generic/363 used to run only on xfs until last Sunday's fstests update.
The test was failing like this:
$ ./check generic/363 FSTYP -- btrfs PLATFORM -- Linux/x86_64 debian0 6.13.0-rc7-btrfs-next-185+ #17 SMP PREEMPT_DYNAMIC Mon Feb 3 12:28:46 WET 2025 MKFS_OPTIONS -- /dev/sdc MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
generic/363 0s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad)
# --- tests/generic/363.out 2025-02-05 15:31:14.013646509 +0000
# +++ /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad 2025-02-05 17:25:33.112630781 +0000
@@ -1 +1,46 @@
QA output created by 363
+READ BAD DATA: offset = 0xdcad, size = 0xd921, fname = /home/fdmanana/btrfs-tests/dev/junk
+OFFSET GOOD BAD RANGE
+0x1609d 0x0000 0x3104 0x0
+operation# (mod 256) for the bad data may be 4
+0x1609e 0x0000 0x0472 0x1
+operation# (mod 256) for the bad data may be 4
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/363.out /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad' to see the entire diff)
Ran: generic/363
Failures: generic/363
Failed 1 of 1 tests
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -1122,7 +1122,6 @@ static int btrfs_write_check(struct kiocloff_t pos = iocb->ki_pos;int ret;loff_t oldsize; -loff_t start_pos;/* * Quickly bail out on NOWAIT writes if we don't have the nodatacow or
@@ -1147,9 +1146,8 @@ static int btrfs_write_check(struct kioc*/ update_time_for_write (inode); - start_pos =round_down (pos, fs_info->sectorsize); oldsize =i_size_read (inode); -if (start_pos > oldsize) { +if (pos > oldsize) {/* Expand hole size to cover write data, preventing empty gap */ loff_t end_pos =round_up (pos + count, fs_info->sectorsize);
Greg Kroah-Hartman
maintainerPATCH 536/578 clocksource: Use pr_info() for "Checking clocksource synchronization" message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 1f566840a82982141f94086061927a90e79440e5 ]
The "Checking clocksource synchronization" message is normally printed when clocksource_verify_percpu() is called for a given clocksource if both the CLOCK_SOURCE_UNSTABLE and CLOCK_SOURCE_VERIFY_PERCPU flags are set.
It is an informational message and so pr_info() is the correct choice.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/time/clocksource.c +2 -1
@@ -357,7 +357,8 @@ void clocksource_verify_percpu(struct clocksource *cs)return ; } testcpu =smp_processor_id (); -pr_warn ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , + cs->name, testcpu,cpumask_pr_args (&cpus_chosen));for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 537/578 clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 6bb05a33337b2c842373857b63de5c9bf1ae2a09 ]
The following bug report happened with a PREEMPT_RT kernel:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0
It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context.
Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.
--- kernel/time/clocksource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +4 -2
@@ -348,10 +348,10 @@ void clocksource_verify_percpu(struct clocksource *cs)cpumask_clear (&cpus_ahead);cpumask_clear (&cpus_behind);cpus_read_lock (); -preempt_disable (); +migrate_disable ();clocksource_verify_choose_cpus ();if (cpumask_empty (&cpus_chosen)) { -preempt_enable (); +migrate_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);return ;
@@ -359,6 +359,7 @@ void clocksource_verify_percpu(struct clocksource *cs) testcpu =smp_processor_id ();pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +preempt_disable ();for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
@@ -378,6 +379,7 @@ void clocksource_verify_percpu(struct clocksource *cs) cs_nsec_min = cs_nsec; }preempt_enable (); +migrate_enable ();cpus_read_unlock ();if (!cpumask_empty (&cpus_ahead)) pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 538/578 ipv4: add RCU protection to ip4_dst_hoplimit()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 469308552ca4560176cfc100e7ca84add1bebd7c ]
ip4_dst_hoplimit() must use RCU protection to make sure the net structure it reads does not disappear.
--- include/net/route.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/net/route.h +7 -2
@@ -362,10 +362,15 @@ static inline int inet_iif(const struct sk_buff *skb)static inline int ip4_dst_hoplimit (const struct dst_entry *dst) {int hoplimit =dst_metric_raw (dst,RTAX_HOPLIMIT ); -struct net *net =dev_net (dst->dev); -if (hoplimit ==0 ) +if (hoplimit ==0 ) { +const struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev); hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); +rcu_read_unlock (); + }return hoplimit; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 539/578 net: treat possible_net_t net pointer as an RCU one and add read_pnet_rcu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 2034d90ae41ae93e30d492ebcf1f06f97a9cfba6 ]
Make the net pointer stored in possible_net_t structure annotated as an RCU pointer. Change the access helpers to treat it as such. Introduce read_pnet_rcu() helper to allow caller to dereference the net pointer under RCU read lock.
Stable-dep-of: 71b8471c93fa ("ipv4: use RCU protection in ipv4_default_advmss()")
--- include/net/net_namespace.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
include/net/net_namespace.h +12 -3
@@ -353,21 +353,30 @@ static inline void put_net_track(struct net *net, netns_tracker *tracker)typedef struct {#ifdef CONFIG_NET_NS -struct net *net; +struct net __rcu *net;#endif }possible_net_t ;static inline void write_pnet (possible_net_t *pnet,struct net *net) {#ifdef CONFIG_NET_NS - pnet->net = net; +rcu_assign_pointer (pnet->net, net);#endif }static inline struct net *read_pnet (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS -return pnet->net; +return rcu_dereference_protected (pnet->net, true); +#else +return &init_net; +#endif +} + +static inline struct net *read_pnet_rcu (possible_net_t *pnet) +{ +#ifdef CONFIG_NET_NS +return rcu_dereference (pnet->net);#else return &init_net;#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 540/578 net: add dev_net_rcu() helper
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 482ad2a4ace2740ca0ff1cbc8f3c7f862f3ab507 ]
dev->nd_net can change, readers should either
use rcu_read_lock() or RTNL.
We currently use a generic helper, dev_net() with no debugging support. We probably have many hidden bugs.
Add dev_net_rcu() helper for callers using rcu_read_lock() protection.
Stable-dep-of: 71b8471c93fa ("ipv4: use RCU protection in ipv4_default_advmss()")
--- include/linux/netdevice.h | 6 ++++++ include/net/net_namespace.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/netdevice.h +6 -0
@@ -2538,6 +2538,12 @@ struct net *dev_net(const struct net_device *dev)return read_pnet (&dev->nd_net); } +static inline +struct net *dev_net_rcu (const struct net_device *dev) +{ +return read_pnet_rcu (&dev->nd_net); +} +static inline void dev_net_set (struct net_device *dev,struct net *net) {
include/net/net_namespace.h +1 -1
@@ -373,7 +373,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)#endif } -static inline struct net *read_pnet_rcu (possible_net_t *pnet) +static inline struct net *read_pnet_rcu (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS return rcu_dereference (pnet->net);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 541/578 ipv4: use RCU protection in ipv4_default_advmss()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 71b8471c93fa0bcab911fcb65da1eb6c4f5f735f ]
ipv4_default_advmss() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/ipv4/route.c +8 -3
@@ -1306,10 +1306,15 @@ static void set_class_tag(struct rtable *rt, u32 tag)static unsigned int ipv4_default_advmss (const struct dst_entry *dst) { -struct net *net =dev_net (dst->dev);unsigned int header_size =sizeof (struct tcphdr ) +sizeof (struct iphdr ); - unsigned int advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, - net->ipv4.ip_rt_min_advmss); +unsigned int advmss; +struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev); + advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, + net->ipv4.ip_rt_min_advmss); +rcu_read_unlock ();return min (advmss,IPV4_MAX_PMTU - header_size); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 542/578 ipv4: use RCU protection in rt_is_expired()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dd205fcc33d92d54eee4d7f21bb073af9bd5ce2b ]
rt_is_expired() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/route.c +7 -1
@@ -393,7 +393,13 @@ static inline int ip_rt_proc_init(void)static inline bool rt_is_expired (const struct rtable *rth) { -return rth->rt_genid !=rt_genid_ipv4 (dev_net (rth->dst.dev)); +bool res; + +rcu_read_lock (); + res = rth->rt_genid !=rt_genid_ipv4 (dev_net_rcu (rth->dst.dev)); +rcu_read_unlock (); + +return res; }void rt_cache_flush (struct net *net)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 543/578 ipv4: use RCU protection in inet_select_addr()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 719817cd293e4fa389e1f69c396f3f816ed5aa41 ]
inet_select_addr() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/devinet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/devinet.c +2 -1
@@ -1320,10 +1320,11 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)__be32 addr =0 ;unsigned char localnet_scope =RT_SCOPE_HOST ;struct in_device *in_dev; -struct net *net =dev_net (dev); +struct net *net;int master_idx;rcu_read_lock (); + net =dev_net_rcu (dev); in_dev =__in_dev_get_rcu (dev);if (!in_dev) goto no_in_dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 544/578 net: ipv4: Cache pmtu for all packet paths if multipath enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Vdovin <[email protected]>
[ Upstream commit 7d3f3b4367f315a61fc615e3138f3d320da8c466 ]
Check number of paths by fib_info_num_path(), and update_or_create_fnhe() for every path. Problem is that pmtu is cached only for the oif that has received icmp message "need to frag", other oifs will still try to use "default" iface mtu.
An example topology showing the problem:
| host1
+---------+
| dummy0 | 10.179.20.18/32 mtu9000
+---------+
+-----------+----------------+
+---------+ +---------+
| ens17f0 | 10.179.2.141/31 | ens17f1 | 10.179.2.13/31
+---------+ +---------+
| (all here have mtu 9000) |
+------+ +------+
| ro1 | 10.179.2.140/31 | ro2 | 10.179.2.12/31
+------+ +------+
| |
---------+------------+-------------------+------
|
+-----+
| ro3 | 10.10.10.10 mtu1500
+-----+
|
========================================
some networks
========================================
|
+-----+
| eth0| 10.10.30.30 mtu9000
+-----+
| host2host1 have enabled multipath and
sysctl net.ipv4.fib_multipath_hash_policy = 1:
default proto static src 10.179.20.18
nexthop via 10.179.2.12 dev ens17f1 weight 1
nexthop via 10.179.2.140 dev ens17f0 weight 1When host1 tries to do pmtud from 10.179.20.18/32 to host2, host1 receives at ens17f1 iface an icmp packet from ro3 that ro3 mtu=1500. And host1 caches it in nexthop exceptions cache.
Problem is that it is cached only for the iface that has received icmp, and there is no way that ro3 will send icmp msg to host1 via another path.
Host1 now have this routes to host2:
ip r g 10.10.30.30 sport 30000 dport 443
10.10.30.30 via 10.179.2.12 dev ens17f1 src 10.179.20.18 uid 0
cache expires 521sec mtu 1500
ip r g 10.10.30.30 sport 30033 dport 443
10.10.30.30 via 10.179.2.140 dev ens17f0 src 10.179.20.18 uid 0
cache
So when host1 tries again to reach host2 with mtu>1500,
if packet flow is lucky enough to be hashed with oif=ens17f1 its ok, if oif=ens17f0 it blackholes and still gets icmp msgs from ro3 to ens17f1, until lucky day when ro3 will send it through another flow to ens17f0.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- net/ipv4/route.c | 13 ++++ tools/testing/selftests/net/pmtu.sh | 112 +++++++++++++++++++++++----- 2 files changed, 108 insertions(+), 17 deletions(-)
net/ipv4/route.c +13 -0
@@ -1046,6 +1046,19 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)struct fib_nh_common *nhc;fib_select_path (net, &res, fl4,NULL ); +#ifdef CONFIG_IP_ROUTE_MULTIPATH +if (fib_info_num_path (res.fi) >1 ) { +int nhsel; + +for (nhsel =0 ; nhsel <fib_info_num_path (res.fi); nhsel++) { + nhc =fib_info_nhc (res.fi, nhsel); +update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, + jiffies + net->ipv4.ip_rt_mtu_expires); + } +rcu_read_unlock (); +return ; + } +#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires);
tools/testing/selftests/net/pmtu.sh +95 -17
168 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 545/578 ipv4: use RCU protection in __ip_rt_update_pmtu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 139512191bd06f1b496117c76372b2ce372c9a41 ]
__ip_rt_update_pmtu() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv4/route.c +6 -5
@@ -1020,9 +1020,9 @@ out: kfree_skb_reason(skb, reason);static void __ip_rt_update_pmtu (struct rtable *rt,struct flowi4 *fl4,u32 mtu) {struct dst_entry *dst = &rt->dst; -struct net *net =dev_net (dst->dev);struct fib_result res;bool lock = false; +struct net *net;u32 old_mtu;if (ip_mtu_locked (dst))
@@ -1032,6 +1032,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (old_mtu < mtu)return ; +rcu_read_lock (); + net =dev_net_rcu (dst->dev);if (mtu < net->ipv4.ip_rt_min_pmtu) { lock = true; mtu =min (old_mtu, net->ipv4.ip_rt_min_pmtu);
@@ -1039,9 +1041,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (rt->rt_pmtu == mtu && !lock &&time_before (jiffies, dst->expires - net->ipv4.ip_rt_mtu_expires /2 )) -return ; + goto out; -rcu_read_lock ();if (fib_lookup (net, fl4, &res,0 ) ==0 ) {struct fib_nh_common *nhc;
@@ -1055,14 +1056,14 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } -rcu_read_unlock (); -return ; + goto out; }#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } +out:rcu_read_unlock (); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 546/578 ipv4: icmp: convert to dev_net_rcu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4b8474a0951e605d2a27a2c483da4eb4b8c63760 ]
__icmp_send() must ensure rcu_read_lock() is held, as spotted by Jakub.
Other ICMP uses of dev_net() seem safe, change them to dev_net_rcu() to get LOCKDEP support.
--- net/ipv4/icmp.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
net/ipv4/icmp.c +17 -14
@@ -403,10 +403,10 @@ static void icmp_push_reply(struct sock *sk,static void icmp_reply (struct icmp_bxm *icmp_param,struct sk_buff *skb) { -struct ipcm_cookie ipc;struct rtable *rt =skb_rtable (skb); -struct net *net =dev_net (rt->dst.dev); +struct net *net =dev_net_rcu (rt->dst.dev);bool apply_ratelimit = false; +struct ipcm_cookie ipc;struct flowi4 fl4;struct sock *sk;struct inet_sock *inet;
@@ -609,12 +609,14 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,struct sock *sk;if (!rt) - goto out; +return ; + +rcu_read_lock ();if (rt->dst.dev) - net =dev_net (rt->dst.dev); + net =dev_net_rcu (rt->dst.dev);else if (skb_in->dev) - net =dev_net (skb_in->dev); + net =dev_net_rcu (skb_in->dev);else goto out;
@@ -783,7 +785,8 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,icmp_xmit_unlock (sk); out_bh_enable:local_bh_enable (); -out:; +out: +rcu_read_unlock (); }EXPORT_SYMBOL (__icmp_send);
@@ -832,7 +835,7 @@ static void icmp_socket_deliver(struct sk_buff *skb, u32 info)* avoid additional coding at protocol handlers. */ if (!pskb_may_pull (skb, iph->ihl *4 +8 )) { -__ICMP_INC_STATS (dev_net (skb->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb->dev),ICMP_MIB_INERRORS );return ; }
@@ -866,7 +869,7 @@ static enum skb_drop_reason icmp_unreach(struct sk_buff *skb)struct net *net;u32 info =0 ; - net =dev_net (skb_dst (skb)->dev); + net =dev_net_rcu (skb_dst (skb)->dev);/* * Incomplete header ?
@@ -977,7 +980,7 @@ static enum skb_drop_reason icmp_unreach(struct sk_buff *skb)static enum skb_drop_reason icmp_redirect (struct sk_buff *skb) {if (skb->len <sizeof (struct iphdr )) { -__ICMP_INC_STATS (dev_net (skb->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb->dev),ICMP_MIB_INERRORS );return SKB_DROP_REASON_PKT_TOO_SMALL ; }
@@ -1009,7 +1012,7 @@ static enum skb_drop_reason icmp_echo(struct sk_buff *skb)struct icmp_bxm icmp_param;struct net *net; - net =dev_net (skb_dst (skb)->dev); + net =dev_net_rcu (skb_dst (skb)->dev);/* should there be an ICMP stat for ignored echos? */ if (READ_ONCE (net->ipv4.sysctl_icmp_echo_ignore_all))return SKB_NOT_DROPPED_YET ;
@@ -1038,9 +1041,9 @@ static enum skb_drop_reason icmp_echo(struct sk_buff *skb)bool icmp_build_probe (struct sk_buff *skb,struct icmphdr *icmphdr) { +struct net *net =dev_net_rcu (skb->dev);struct icmp_ext_hdr *ext_hdr, _ext_hdr;struct icmp_ext_echo_iio *iio, _iio; -struct net *net =dev_net (skb->dev);struct inet6_dev *in6_dev;struct in_device *in_dev;struct net_device *dev;
@@ -1179,7 +1182,7 @@ static enum skb_drop_reason icmp_timestamp(struct sk_buff *skb)return SKB_NOT_DROPPED_YET ; out_err: -__ICMP_INC_STATS (dev_net (skb_dst (skb)->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb_dst (skb)->dev),ICMP_MIB_INERRORS );return SKB_DROP_REASON_PKT_TOO_SMALL ; }
@@ -1196,7 +1199,7 @@ int icmp_rcv(struct sk_buff *skb) {enum skb_drop_reason reason =SKB_DROP_REASON_NOT_SPECIFIED ;struct rtable *rt =skb_rtable (skb); -struct net *net =dev_net (rt->dst.dev); +struct net *net =dev_net_rcu (rt->dst.dev);struct icmphdr *icmph;if (!xfrm4_policy_check (NULL ,XFRM_POLICY_IN , skb)) {
@@ -1369,9 +1372,9 @@ int icmp_err(struct sk_buff *skb, u32 info)struct iphdr *iph = (struct iphdr *)skb->data;int offset = iph->ihl<<2 ;struct icmphdr *icmph = (struct icmphdr *)(skb->data + offset); +struct net *net =dev_net_rcu (skb->dev);int type =icmp_hdr (skb)->type;int code =icmp_hdr (skb)->code; -struct net *net =dev_net (skb->dev);/* * Use ping_err to handle all icmp errors except those
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 547/578 flow_dissector: use RCU protection to fetch dev_net()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit afec62cd0a4191cde6dd3a75382be4d51a38ce9b ]
__skb_flow_dissect() can be called from arbitrary contexts.
It must extend its RCU protection section to include the call to dev_net(), which can become dev_net_rcu().
This makes sure the net structure can not disappear under us.
--- net/core/flow_dissector.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
net/core/flow_dissector.c +11 -10
@@ -1004,10 +1004,12 @@ bool __skb_flow_dissect(const struct net *net,FLOW_DISSECTOR_KEY_BASIC , target_container); +rcu_read_lock (); +if (skb) {if (!net) {if (skb->dev) - net =dev_net (skb->dev); + net =dev_net_rcu (skb->dev);else if (skb->sk) net =sock_net (skb->sk); }
@@ -1018,7 +1020,6 @@ bool __skb_flow_dissect(const struct net *net,enum netns_bpf_attach_type type =NETNS_BPF_FLOW_DISSECTOR ;struct bpf_prog_array *run_array; -rcu_read_lock (); run_array =rcu_dereference (init_net.bpf.run_array[type]);if (!run_array) run_array =rcu_dereference (net->bpf.run_array[type]);
@@ -1046,17 +1047,17 @@ bool __skb_flow_dissect(const struct net *net, prog =READ_ONCE (run_array->items[0 ].prog); result =bpf_flow_dissect (prog, &ctx, n_proto, nhoff, hlen, flags); -if (result ==BPF_FLOW_DISSECTOR_CONTINUE ) - goto dissect_continue; -__skb_flow_bpf_to_target (&flow_keys, flow_dissector, - target_container); -rcu_read_unlock (); -return result ==BPF_OK ; +if (result !=BPF_FLOW_DISSECTOR_CONTINUE ) { +__skb_flow_bpf_to_target (&flow_keys, flow_dissector, + target_container); +rcu_read_unlock (); +return result ==BPF_OK ; + } } -dissect_continue: -rcu_read_unlock (); } +rcu_read_unlock (); +if (dissector_uses_key (flow_dissector,FLOW_DISSECTOR_KEY_ETH_ADDRS )) {struct ethhdr *eth =eth_hdr (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 548/578 ipv6: use RCU protection in ip6_default_advmss()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3c8ffcd248da34fc41e52a46e51505900115fc2a ]
ip6_default_advmss() needs rcu protection to make sure the net structure it reads does not disappear.
--- net/ipv6/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/route.c +6 -1
@@ -3190,13 +3190,18 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) {struct net_device *dev = dst->dev;unsigned int mtu =dst_mtu (dst); -struct net *net =dev_net (dev); +struct net *net; mtu -=sizeof (struct ipv6hdr ) +sizeof (struct tcphdr ); +rcu_read_lock (); + + net =dev_net_rcu (dev);if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) mtu = net->ipv6.sysctl.ip6_rt_min_advmss; +rcu_read_unlock (); +/* * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 549/578 ndisc: use RCU protection in ndisc_alloc_skb()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 628e6d18930bbd21f2d4562228afe27694f66da9 ]
ndisc_alloc_skb() can be called without RTNL or RCU being held.
Add RCU protection to avoid possible UAF.
--- net/ipv6/ndisc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv6/ndisc.c +4 -6
@@ -418,15 +418,11 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev, {int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct sock *sk =dev_net (dev)->ipv6.ndisc_sk;struct sk_buff *skb; skb =alloc_skb (hlen +sizeof (struct ipv6hdr ) + len + tlen,GFP_ATOMIC ); -if (!skb) { -ND_PRINTK (0 , err,"ndisc: %s failed to allocate an skb\n" , - __func__); +if (!skb)return NULL ; - } skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -437,7 +433,9 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev,/* Manually assign socket ownership as we avoid calling * sock_alloc_send_pskb() to bypass wmem buffer limits */ -skb_set_owner_w (skb, sk); +rcu_read_lock (); +skb_set_owner_w (skb,dev_net_rcu (dev)->ipv6.ndisc_sk); +rcu_read_unlock ();return skb; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 550/578 neighbour: delete redundant judgment statements
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zetao <[email protected]>
[ Upstream commit c25bdd2ac8cf7da70a226f1a66cdce7af15ff86f ]
The initial value of err is -ENOBUFS, and err is guaranteed to be less than 0 before all goto errout. Therefore, on the error path of errout, there is no need to repeatedly judge that err is less than 0, and delete redundant judgments to make the code more concise.
Stable-dep-of: becbd5850c03 ("neighbour: use RCU protection in __neigh_notify()")
--- net/core/neighbour.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/neighbour.c +1 -2
@@ -3516,8 +3516,7 @@ static void __neigh_notify(struct neighbour *n, int type, int flags,rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC );return ; errout: -if (err <0 ) -rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 551/578 neighbour: use RCU protection in __neigh_notify()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit becbd5850c03ed33b232083dd66c6e38c0c0e569 ]
__neigh_notify() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/core/neighbour.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/neighbour.c +6 -2
@@ -3498,10 +3498,12 @@ static const struct seq_operations neigh_stat_seq_ops = {static void __neigh_notify (struct neighbour *n,int type,int flags,u32 pid) { -struct net *net =dev_net (n->dev);struct sk_buff *skb;int err = -ENOBUFS ; +struct net *net; +rcu_read_lock (); + net =dev_net_rcu (n->dev); skb =nlmsg_new (neigh_nlmsg_size (),GFP_ATOMIC );if (skb ==NULL ) goto errout;
@@ -3514,9 +3516,11 @@ static void __neigh_notify(struct neighbour *n, int type, int flags, goto errout; }rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); -return ; + goto out; errout:rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +out: +rcu_read_unlock (); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 552/578 arp: use RCU protection in arp_xmit()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a42b69f692165ec39db42d595f4f65a4c8f42e44 ]
arp_xmit() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/ipv4/arp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/arp.c +3 -1
@@ -658,10 +658,12 @@ static int arp_xmit_finish(struct net *net, struct sock *sk, struct sk_buff *skb*/ void arp_xmit (struct sk_buff *skb) { +rcu_read_lock ();/* Send it off, maybe filter it using firewalling first. */ NF_HOOK (NFPROTO_ARP ,NF_ARP_OUT , -dev_net (skb->dev),NULL , skb,NULL , skb->dev, +dev_net_rcu (skb->dev),NULL , skb,NULL , skb->dev, arp_xmit_finish); +rcu_read_unlock (); }EXPORT_SYMBOL (arp_xmit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 553/578 openvswitch: use RCU protection in ovs_vport_cmd_fill_info()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 90b2f49a502fa71090d9f4fe29a2f51fe5dff76d ]
ovs_vport_cmd_fill_info() can be called without RTNL or RCU.
Use RCU protection and dev_net_rcu() to avoid potential UAF.
--- net/openvswitch/datapath.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +9 -3
@@ -2076,6 +2076,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, {struct ovs_header *ovs_header;struct ovs_vport_stats vport_stats; +struct net *net_vport;int err; ovs_header = genlmsg_put(skb, portid, seq, &dp_vport_genl_family,
@@ -2092,12 +2093,15 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex)) goto nla_put_failure; -if (!net_eq (net,dev_net (vport->dev))) { -int id =peernet2id_alloc (net,dev_net (vport->dev), gfp); +rcu_read_lock (); + net_vport =dev_net_rcu (vport->dev); +if (!net_eq (net, net_vport)) { +int id =peernet2id_alloc (net, net_vport,GFP_ATOMIC );if (nla_put_s32 (skb,OVS_VPORT_ATTR_NETNSID , id)) - goto nla_put_failure; + goto nla_put_failure_unlock; } +rcu_read_unlock ();ovs_vport_get_stats (vport, &vport_stats); if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS,
@@ -2115,6 +2119,8 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,genlmsg_end (skb, ovs_header);return 0 ; +nla_put_failure_unlock: +rcu_read_unlock (); nla_put_failure: err = -EMSGSIZE ; error:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 554/578 ndisc: extend RCU protection in ndisc_send_skb()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ed6ae1f325d3c43966ec1b62ac1459e2b8e45640 ]
ndisc_send_skb() can be called without RTNL or RCU held.
Acquire rcu_read_lock() earlier, so that we can use dev_net_rcu() and avoid a potential UAF.
--- net/ipv6/ndisc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +8 -4
@@ -471,16 +471,20 @@ static void ip6_nd_hdr(struct sk_buff *skb,void ndisc_send_skb (struct sk_buff *skb,const struct in6_addr *daddr,const struct in6_addr *saddr) { +struct icmp6hdr *icmp6h =icmp6_hdr (skb);struct dst_entry *dst =skb_dst (skb); -struct net *net =dev_net (skb->dev); -struct sock *sk = net->ipv6.ndisc_sk;struct inet6_dev *idev; +struct net *net; +struct sock *sk;int err; -struct icmp6hdr *icmp6h =icmp6_hdr (skb);u8 type; type = icmp6h->icmp6_type; +rcu_read_lock (); + + net =dev_net_rcu (skb->dev); + sk = net->ipv6.ndisc_sk;if (!dst) {struct flowi6 fl6;int oif = skb->dev->ifindex;
@@ -488,6 +492,7 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,icmpv6_flow_init (sk, &fl6, type, saddr, daddr, oif); dst =icmp6_dst_alloc (skb->dev, &fl6);if (IS_ERR (dst)) { +rcu_read_unlock ();kfree_skb (skb);return ; }
@@ -502,7 +507,6 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,ip6_nd_hdr (skb, saddr, daddr,inet6_sk (sk)->hop_limit, skb->len); -rcu_read_lock (); idev =__in6_dev_get (dst->dev);IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUT , skb->len);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 555/578 ipv6: mcast: add RCU protection to mld_newpack()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a527750d877fd334de87eef81f1cb5f0f0ca3373 ]
mld_newpack() can be called without RTNL or RCU being held.
Note that we no longer can use sock_alloc_send_skb() because ipv6.igmp_sk uses GFP_KERNEL allocations which can sleep.
Instead use alloc_skb() and charge the net->ipv6.igmp_sk socket under RCU protection.
--- net/ipv6/mcast.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv6/mcast.c +10 -4
@@ -1731,21 +1731,19 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)struct net_device *dev = idev->dev;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct net *net =dev_net (dev);const struct in6_addr *saddr;struct in6_addr addr_buf;struct mld2_report *pmr;struct sk_buff *skb;unsigned int size;struct sock *sk; -int err; +struct net *net; - sk = net->ipv6.igmp_sk;/* we assume size > sizeof(ra) here * Also try to not allocate high-order pages for big MTU */ size =min_t (int, mtu,PAGE_SIZE /2 ) + hlen + tlen; - skb =sock_alloc_send_skb (sk, size,1 , &err); + skb =alloc_skb (size,GFP_KERNEL );if (!skb)return NULL ;
@@ -1753,6 +1751,12 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)skb_reserve (skb, hlen);skb_tailroom_reserve (skb, mtu, tlen); +rcu_read_lock (); + + net =dev_net_rcu (dev); + sk = net->ipv6.igmp_sk; +skb_set_owner_w (skb, sk); +if (ipv6_get_lladdr (dev, &addr_buf,IFA_F_TENTATIVE )) {/* <draft-ietf-magma-mld-source-05.txt>: * use unspecified address as the source address
@@ -1764,6 +1768,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)ip6_mc_hdr (sk, skb, dev, saddr, &mld2_all_mcr,NEXTHDR_HOP ,0 ); +rcu_read_unlock (); +skb_put_data (skb, ra,sizeof (ra));skb_set_transport_header (skb,skb_tail_pointer (skb) - skb->data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 556/578 drm/tidss: Fix issue in irq handling causing irq-flood issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 44b6730ab53ef04944fbaf6da0e77397531517b7 upstream.
It has been observed that sometimes DSS will trigger an interrupt and the top level interrupt (DISPC_IRQSTATUS) is not zero, but the VP and VID level interrupt-statuses are zero.
As the top level irqstatus is supposed to tell whether we have VP/VID interrupts, the thinking of the driver authors was that this particular case could never happen. Thus the driver only clears the DISPC_IRQSTATUS bits which has corresponding interrupts in VP/VID status. So when this issue happens, the driver will not clear DISPC_IRQSTATUS, and we get an interrupt flood.
It is unclear why the issue happens. It could be a race issue in the driver, but no such race has been found. It could also be an issue with the HW. However a similar case can be easily triggered by manually writing to DISPC_IRQSTATUS_RAW. This will forcibly set a bit in the DISPC_IRQSTATUS and trigger an interrupt, and as the driver never clears the bit, we get an interrupt flood.
To fix the issue, always clear DISPC_IRQSTATUS. The concern with this solution is that if the top level irqstatus is the one that triggers the interrupt, always clearing DISPC_IRQSTATUS might leave some interrupts unhandled if VP/VID interrupt statuses have bits set. However, testing shows that if any of the irqstatuses is set (i.e. even if DISPC_IRQSTATUS == 0, but a VID irqstatus has a bit set), we will get an interrupt.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +4 -8
@@ -679,24 +679,20 @@ staticvoid dispc_k3_clear_irqstatus (struct dispc_device *dispc,dispc_irq_t clearmask) {unsigned int i; -u32 top_clear =0 ;for (i =0 ; i < dispc->feat->num_vps; ++i) { -if (clearmask &DSS_IRQ_VP_MASK (i)) { +if (clearmask &DSS_IRQ_VP_MASK (i))dispc_k3_vp_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (i); - } }for (i =0 ; i < dispc->feat->num_planes; ++i) { -if (clearmask &DSS_IRQ_PLANE_MASK (i)) { +if (clearmask &DSS_IRQ_PLANE_MASK (i))dispc_k3_vid_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (4 + i); - } }if (dispc->feat->subrev ==DISPC_K2G )return ; -dispc_write (dispc,DISPC_IRQSTATUS , top_clear); +/* always clear the top level irqstatus */ +dispc_write (dispc,DISPC_IRQSTATUS ,dispc_read (dispc,DISPC_IRQSTATUS ));/* Flush posted writes */ dispc_read (dispc,DISPC_IRQSTATUS );
Re: [PATCH 6.1 556/578] drm/tidss: Fix issue in irq handling causing irq-flood issue
Quoted 2 lines · Greg Kroah-Hartman
6.1-stable review patch. If anyone has any objections, please let me know.
Looks good to me
Quoted 84 lines
------------------
From: Tomi Valkeinen <[email protected]>
commit
44b6730ab53ef04944fbaf6da0e77397531517b7upstream.It has been observed that sometimes DSS will trigger an interrupt and the top level interrupt (
DISPC_IRQSTATUS) is not zero, but the VP and VID level interrupt-statuses are zero.As the top level irqstatus is supposed to tell whether we have VP/VID interrupts, the thinking of the driver authors was that this particular case could never happen. Thus the driver only clears the
DISPC_IRQSTATUSbits which has corresponding interrupts in VP/VID status. So when this issue happens, the driver will not clearDISPC_IRQSTATUS, and we get an interrupt flood.It is unclear why the issue happens. It could be a race issue in the driver, but no such race has been found. It could also be an issue with the HW. However a similar case can be easily triggered by manually writing to
DISPC_IRQSTATUS_RAW. This will forcibly set a bit in theDISPC_IRQSTATUSand trigger an interrupt, and as the driver never clears the bit, we get an interrupt flood.To fix the issue, always clear
DISPC_IRQSTATUS. The concern with this solution is that if the top level irqstatus is the one that triggers the interrupt, always clearingDISPC_IRQSTATUSmight leave some interrupts unhandled if VP/VID interrupt statuses have bits set. However, testing shows that if any of the irqstatuses is set (i.e. even ifDISPC_IRQSTATUS== 0, but a VID irqstatus has a bit set), we will get an interrupt.Co-developed-by Bin Liu <[email protected]>Signed-off-by Bin Liu <[email protected]>Co-developed-by Devarsh Thakkar <[email protected]>Signed-off-by Devarsh Thakkar <[email protected]>Co-developed-by Jonathan Cormier <[email protected]>Signed-off-by Jonathan Cormier <[email protected]>Fixes 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")Tested-by Jonathan Cormier <[email protected]>Reviewed-by Aradhya Bhatia <[email protected]>Signed-off-by Tomi Valkeinen <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/tidss/tidss_dispc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/gpu/drm/tidss/tidss_dispc.c +4
-8@@ -679,24 +679,20 @@ staticvoid dispc_k3_clear_irqstatus (struct dispc_device *dispc,dispc_irq_t clearmask) {unsigned int i; -u32 top_clear =0 ;for (i =0 ; i < dispc->feat->num_vps; ++i) { -if (clearmask &DSS_IRQ_VP_MASK (i)) { +if (clearmask &DSS_IRQ_VP_MASK (i))dispc_k3_vp_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (i); - } }for (i =0 ; i < dispc->feat->num_planes; ++i) { -if (clearmask &DSS_IRQ_PLANE_MASK (i)) { +if (clearmask &DSS_IRQ_PLANE_MASK (i))dispc_k3_vid_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (4 + i); - } }if (dispc->feat->subrev ==DISPC_K2G )return ; -dispc_write (dispc,DISPC_IRQSTATUS , top_clear); +/* always clear the top level irqstatus */ +dispc_write (dispc,DISPC_IRQSTATUS ,dispc_read (dispc,DISPC_IRQSTATUS ));/* Flush posted writes */ dispc_read (dispc,DISPC_IRQSTATUS );
Signature · 7 lines
Jonathan Cormier Senior Software Engineer Voice: 315.425.4045 x222 http://www.CriticalLink.com 6712 Brooklawn Parkway, Syracuse, NY 13211
Greg Kroah-Hartman
maintainerPATCH 557/578 drm/tidss: Clear the interrupt status for interrupts being disabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devarsh Thakkar <[email protected]>
commit 361a2ebb5cad211732ec3c5d962de49b21895590 upstream.
The driver does not touch the irqstatus register when it is disabling interrupts. This might cause an interrupt to trigger for an interrupt that was just disabled.
To fix the issue, clear the irqstatus registers right after disabling the interrupts.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +8 -2
@@ -599,7 +599,7 @@ void dispc_k2g_set_irqenable(struct disp {dispc_irq_t old_mask =dispc_k2g_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & mask);dispc_k2g_vp_set_irqenable (dispc,0 , mask);
@@ -607,6 +607,9 @@ void dispc_k2g_set_irqenable(struct dispdispc_write (dispc,DISPC_IRQENABLE_SET , (1 <<0 ) | (1 <<7 )); +/* clear the irqstatus for irqs that were disabled */ +dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & old_mask); +/* flush posted write */ dispc_k2g_read_irqenable (dispc); }
@@ -738,7 +741,7 @@ static void dispc_k3_set_irqenable(struc old_mask =dispc_k3_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & mask);for (i =0 ; i < dispc->feat->num_vps; ++i) {
@@ -763,6 +766,9 @@ static void dispc_k3_set_irqenable(strucif (main_disable)dispc_write (dispc,DISPC_IRQENABLE_CLR , main_disable); +/* clear the irqstatus for irqs that were disabled */ +dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & old_mask); +/* Flush posted writes */ dispc_read (dispc,DISPC_IRQENABLE_SET ); }
Re: [PATCH 6.1 557/578] drm/tidss: Clear the interrupt status for interrupts being disabled
Quoted 2 lines · Greg Kroah-Hartman
6.1-stable review patch. If anyone has any objections, please let me know.
Looks good to me
Quoted 72 lines
------------------
From: Devarsh Thakkar <[email protected]>
commit
361a2ebb5cad211732ec3c5d962de49b21895590upstream.The driver does not touch the irqstatus register when it is disabling interrupts. This might cause an interrupt to trigger for an interrupt that was just disabled.
To fix the issue, clear the irqstatus registers right after disabling the interrupts.
Fixes 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")Reported-by Jonathan Cormier <[email protected]>Signed-off-by Devarsh Thakkar <[email protected]>[Tomi: mostly rewrote the patch]Reviewed-by Jonathan Cormier <[email protected]>Tested-by Jonathan Cormier <[email protected]>Reviewed-by Aradhya Bhatia <[email protected]>Signed-off-by Tomi Valkeinen <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/tidss/tidss_dispc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/tidss/tidss_dispc.c +8
-2@@ -599,7 +599,7 @@ void dispc_k2g_set_irqenable(struct disp {dispc_irq_t old_mask =dispc_k2g_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & mask);dispc_k2g_vp_set_irqenable (dispc,0 , mask);@@ -607,6 +607,9 @@ void dispc_k2g_set_irqenable(struct dispdispc_write (dispc,DISPC_IRQENABLE_SET , (1 <<0 ) | (1 <<7 )); +/* clear the irqstatus for irqs that were disabled */ +dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & old_mask); +/* flush posted write */ dispc_k2g_read_irqenable (dispc); }@@ -738,7 +741,7 @@ static void dispc_k3_set_irqenable(struc old_mask =dispc_k3_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & mask);for (i =0 ; i < dispc->feat->num_vps; ++i) {@@ -763,6 +766,9 @@ static void dispc_k3_set_irqenable(strucif (main_disable)dispc_write (dispc,DISPC_IRQENABLE_CLR , main_disable); +/* clear the irqstatus for irqs that were disabled */ +dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & old_mask); +/* Flush posted writes */ dispc_read (dispc,DISPC_IRQENABLE_SET ); }
Signature · 7 lines
Jonathan Cormier Senior Software Engineer Voice: 315.425.4045 x222 http://www.CriticalLink.com 6712 Brooklawn Parkway, Syracuse, NY 13211
Greg Kroah-Hartman
maintainerPATCH 558/578 drm/v3d: Stop active perfmon if it is being destroyed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Gmeiner <[email protected]>
commit 21f1435b1e6b012a07c42f36b206d2b66fc8f13b upstream.
If the active performance monitor (v3d->active_perfmon) is being destroyed, stop it first. Currently, the active perfmon is not stopped during destruction, leaving the v3d->active_perfmon pointer stale. This can lead to undefined behavior and instability.
This patch ensures that the active perfmon is stopped before being destroyed, aligning with the behavior introduced in commit 7d1fd3638ee3 ("drm/v3d: Stop the active perfmon before being destroyed").
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/v3d/v3d_perfmon.c +5 -0
@@ -175,6 +175,7 @@ int v3d_perfmon_destroy_ioctl(struct drm {struct v3d_file_priv *v3d_priv = file_priv->driver_priv;struct drm_v3d_perfmon_destroy *req = data; +struct v3d_dev *v3d = v3d_priv->v3d;struct v3d_perfmon *perfmon;mutex_lock (&v3d_priv->perfmon.lock);
@@ -184,6 +185,10 @@ int v3d_perfmon_destroy_ioctl(struct drmif (!perfmon)return -EINVAL ; +/* If the active perfmon is being destroyed, stop it first */ +if (perfmon == v3d->active_perfmon) +v3d_perfmon_stop (v3d, perfmon, false); +v3d_perfmon_put (perfmon);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 559/578 kdb: Do not assume write() callback available
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
commit 6d3e0d8cc63221dec670d0ee92ac57961581e975 upstream.
It is allowed for consoles to not provide a write() callback. For example ttynull does this.
Check if a write() callback is available before using it.
--- kernel/debug/kdb/kdb_io.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/debug/kdb/kdb_io.c +2 -0
@@ -576,6 +576,8 @@ static void kdb_msg_write(const char *mscontinue ;if (c == dbg_io_ops->cons)continue ; +if (!c->write) +continue ;/* * Set oops_in_progress to encourage the console drivers to * disregard their internal spin locks: in the current calling
Greg Kroah-Hartman
maintainerPATCH 560/578 x86/static-call: Remove early_boot_irqs_disabled check to fix Xen PVH dom0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Cooper <[email protected]>
commit 5cc2db37124bb33914996d6fdbb2ddb3811f2945 upstream.
__static_call_update_early() has a check for early_boot_irqs_disabled, but is used before early_boot_irqs_disabled is set up in start_kernel().
Xen PV has always special cased early_boot_irqs_disabled, but Xen PVH does not and falls over the BUG when booting as dom0.
It is very suspect that early_boot_irqs_disabled starts as 0, becomes 1 for a time, then becomes 0 again, but as this needs backporting to fix a breakage in a security fix, dropping the BUG_ON() is the far safer option.
--- arch/x86/kernel/static_call.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/static_call.c +0 -1
@@ -173,7 +173,6 @@ EXPORT_SYMBOL_GPL(arch_static_call_trans noinstr void __static_call_update_early(void *tramp, void *func) {BUG_ON (system_state !=SYSTEM_BOOTING ); -BUG_ON (!early_boot_irqs_disabled);BUG_ON (static_call_initialized);__text_gen_insn (tramp,JMP32_INSN_OPCODE , tramp, func,JMP32_INSN_SIZE );sync_core ();
Greg Kroah-Hartman
maintainerPATCH 561/578 iommu: Return right value in iommu_sva_bind_device()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 89e8a2366e3bce584b6c01549d5019c5cda1205e upstream.
iommu_sva_bind_device() should return either a sva bond handle or an ERR_PTR value in error cases. Existing drivers (idxd and uacce) only check the return value with IS_ERR(). This could potentially lead to a kernel NULL pointer dereference issue if the function returns NULL instead of an error pointer.
In reality, this doesn't cause any problems because iommu_sva_bind_device() only returns NULL when the kernel is not configured with CONFIG_IOMMU_SVA. In this case, iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) will return an error, and the device drivers won't call iommu_sva_bind_device() at all.
--- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iommu.h +1 -1
@@ -999,7 +999,7 @@ iommu_dev_disable_feature(struct devicestatic inline struct iommu_sva *iommu_sva_bind_device (struct device *dev,struct mm_struct *mm,void *drvdata) { -return NULL ; +return ERR_PTR (-ENODEV ); }static inline void iommu_sva_unbind_device (struct iommu_sva *handle)
Greg Kroah-Hartman
maintainerPATCH 562/578 arm64: tegra: Fix typo in Tegra234 dce-fabric compatible
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Gupta <[email protected]>
commit 604120fd9e9df50ee0e803d3c6e77a1f45d2c58e upstream.
The compatible string for the Tegra DCE fabric is currently defined as 'nvidia,tegra234-sce-fabric' but this is incorrect because this is the compatible string for SCE fabric. Update the compatible for the DCE fabric to correct the compatible string.
This compatible needs to be correct in order for the interconnect to catch things such as improper data accesses.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +1 -1
@@ -1558,7 +1558,7 @@ }; dce-fabric@de00000 { - compatible = "nvidia,tegra234-sce-fabric"; + compatible = "nvidia,tegra234-dce-fabric"; reg = <0xde00000 0x40000>; interrupts = <GIC_SPI 381 IRQ_TYPE_LEVEL_HIGH>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 563/578 mm: gup: fix infinite loop within __get_longterm_locked
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhaoyang Huang <[email protected]>
commit 1aaf8c122918aa8897605a9aa1e8ed6600d6f930 upstream.
We can run into an infinite loop in __get_longterm_locked() when collect_longterm_unpinnable_folios() finds only folios that are isolated from the LRU or were never added to the LRU. This can happen when all folios to be pinned are never added to the LRU, for example when vm_ops->fault allocated pages using cma_alloc() and never added them to the LRU.
Fix it by simply taking a look at the list in the single caller, to see if anything was added.
--- mm/gup.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
mm/gup.c +4 -10
@@ -1944,14 +1944,14 @@ struct page *get_dump_page(unsigned long/* * Returns the number of collected pages. Return value is always >= 0. */ -static unsigned long collect_longterm_unpinnable_pages ( +static void collect_longterm_unpinnable_pages (struct list_head *movable_page_list,unsigned long nr_pages,struct page **pages) { -unsigned long i, collected =0 ;struct folio *prev_folio =NULL ;bool drain_allow = true; +unsigned long i;for (i =0 ; i < nr_pages; i++) {struct folio *folio =page_folio (pages[i]);
@@ -1963,8 +1963,6 @@ static unsigned long collect_longterm_unif (folio_is_longterm_pinnable (folio))continue ; - collected++; -if (folio_is_device_coherent (folio))continue ;
@@ -1986,8 +1984,6 @@ static unsigned long collect_longterm_unNR_ISOLATED_ANON +folio_is_file_lru (folio), folio_nr_pages(folio)); } - -return collected; }/*
@@ -2080,12 +2076,10 @@ err:static long check_and_migrate_movable_pages (unsigned long nr_pages,struct page **pages) { -unsigned long collected;LIST_HEAD (movable_page_list); - collected =collect_longterm_unpinnable_pages (&movable_page_list, - nr_pages, pages); -if (!collected) +collect_longterm_unpinnable_pages (&movable_page_list, nr_pages, pages); +if (list_empty (&movable_page_list))return 0 ; return migrate_longterm_unpinnable_pages(&movable_page_list, nr_pages,
Greg Kroah-Hartman
maintainerPATCH 564/578 alpha: replace hardcoded stack offsets with autogenerated ones
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 77b823fa619f97d16409ca37ad4f7936e28c5f83 upstream.
This allows the assembly in entry.S to automatically keep in sync with changes in the stack layout (struct pt_regs and struct switch_stack).
--- arch/alpha/kernel/asm-offsets.c | 2 ++ arch/alpha/kernel/entry.S | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/alpha/kernel/asm-offsets.c +2 -0
@@ -32,7 +32,9 @@ void foo(void)DEFINE (CRED_EGID , offsetof(struct cred , egid));BLANK (); +DEFINE (SP_OFF , offsetof(struct pt_regs , ps));DEFINE (SIZEOF_PT_REGS ,sizeof (struct pt_regs )); +DEFINE (SWITCH_STACK_SIZE ,sizeof (struct switch_stack ));DEFINE (PT_PTRACED ,PT_PTRACED );DEFINE (CLONE_VM ,CLONE_VM );DEFINE (CLONE_UNTRACED ,CLONE_UNTRACED );
arch/alpha/kernel/entry.S +0 -4
@@ -15,10 +15,6 @@ .set noat .cfi_sections .debug_frame -/* Stack offsets. */ -#define SP_OFF 184 -#define SWITCH_STACK_SIZE 320 - .macro CFI_START_OSF_FRAME func .align 4 .globl \func
Greg Kroah-Hartman
maintainerPATCH 565/578 i3c: master: cdns: Fix use after free vulnerability in cdns_i3c_master Driver Due to Race Condition
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaixin Wang <[email protected]>
commit 609366e7a06d035990df78f1562291c3bf0d4a12 upstream.
In the cdns_i3c_master_probe function, &master->hj_work is bound with cdns_i3c_master_hj. And cdns_i3c_master_interrupt can call cnds_i3c_master_demux_ibis function to start the work.
If we remove the module which will call cdns_i3c_master_remove to make cleanup, it will free master->base through i3c_master_unregister while the work mentioned above will be used. The sequence of operations that may lead to a UAF bug is as follows:
CPU0 CPU1
| cdns_i3c_master_hj
cdns_i3c_master_remove |
i3c_master_unregister(&master->base) |
device_unregister(&master->dev) |
device_release |
//free master->base |
| i3c_master_do_daa(&master->base)
| //use master->baseFix it by ensuring that the work is canceled before proceeding with the cleanup in cdns_i3c_master_remove.
--- drivers/i3c/master/i3c-master-cdns.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/i3c-master-cdns.c +1 -0
@@ -1667,6 +1667,7 @@ static int cdns_i3c_master_remove(struct {struct cdns_i3c_master *master =platform_get_drvdata (pdev); +cancel_work_sync (&master->hj_work);i3c_master_unregister (&master->base);clk_disable_unprepare (master->sysclk);
Greg Kroah-Hartman
maintainerPATCH 566/578 nilfs2: do not output warnings when clearing dirty buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 299910dcb4525ac0274f3efa9527876315ba4f67 upstream.
After detecting file system corruption and degrading to a read-only mount, dirty folios and buffers in the page cache are cleared, and a large number of warnings are output at that time, often filling up the kernel log.
In this case, since the degrading to a read-only mount is output to the kernel log, these warnings are not very meaningful, and are rather a nuisance in system management and debugging.
The related nilfs2-specific page/folio routines have a silent argument that suppresses the warning output, but since it is not currently used meaningfully, remove both the silent argument and the warning output.
Stable-dep-of: ca76bb226bf4 ("nilfs2: do not force clear folio if buffer is referenced")
--- fs/nilfs2/inode.c | 4 ++-- fs/nilfs2/mdt.c | 6 +++--- fs/nilfs2/page.c | 20 +++----------------- fs/nilfs2/page.h | 4 ++-- 4 files changed, 10 insertions(+), 24 deletions(-)
fs/nilfs2/inode.c +2 -2
@@ -162,7 +162,7 @@ static int nilfs_writepages(struct addreint err =0 ;if (sb_rdonly (inode->i_sb)) { -nilfs_clear_dirty_pages (mapping, false); +nilfs_clear_dirty_pages (mapping);return -EROFS ; }
@@ -185,7 +185,7 @@ static int nilfs_writepage(struct page ** have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
fs/nilfs2/mdt.c +3 -3
@@ -411,7 +411,7 @@ nilfs_mdt_write_page(struct page *page,* have dirty pages that try to be flushed in background. * So, here we simply discard this dirty page. */ -nilfs_clear_dirty_page (page, false); +nilfs_clear_dirty_page (page);unlock_page (page);return -EROFS ; }
@@ -634,10 +634,10 @@ void nilfs_mdt_restore_from_shadow_map(sif (mi->mi_palloc_cache)nilfs_palloc_clear_cache (inode); -nilfs_clear_dirty_pages (inode->i_mapping, true); +nilfs_clear_dirty_pages (inode->i_mapping);nilfs_copy_back_pages (inode->i_mapping, shadow->inode->i_mapping); -nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping, true); +nilfs_clear_dirty_pages (ii->i_assoc_inode->i_mapping);nilfs_copy_back_pages (ii->i_assoc_inode->i_mapping,NILFS_I (shadow->inode)->i_assoc_inode->i_mapping);
fs/nilfs2/page.c +3 -17
@@ -354,9 +354,8 @@ repeat:/** * nilfs_clear_dirty_pages - discard dirty pages in address space * @mapping: address space with dirty pages for discarding -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_pages (struct address_space *mapping,bool silent) +void nilfs_clear_dirty_pages (struct address_space *mapping) {struct pagevec pvec;unsigned int i;
@@ -377,7 +376,7 @@ void nilfs_clear_dirty_pages(struct addr* was acquired. Skip processing in that case. */ if (likely (page->mapping == mapping)) -nilfs_clear_dirty_page (page, silent); +nilfs_clear_dirty_page (page);unlock_page (page); }
@@ -389,19 +388,11 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded -* @silent: suppress [true] or print [false] warning messages */ -void nilfs_clear_dirty_page (struct page *page,bool silent) +void nilfs_clear_dirty_page (struct page *page) { -struct inode *inode = page->mapping->host; -struct super_block *sb = inode->i_sb; -BUG_ON (!PageLocked (page)); -if (!silent) -nilfs_warn (sb,"discard dirty page: offset=%lld, ino=%lu" , -page_offset (page), inode->i_ino); -ClearPageUptodate (page);ClearPageMappedToDisk (page);ClearPageChecked (page);
@@ -417,11 +408,6 @@ void nilfs_clear_dirty_page(struct page bh = head =page_buffers (page);do {lock_buffer (bh); -if (!silent) -nilfs_warn (sb, -"discard dirty block: blocknr=%llu, size=%zu" , - (u64 )bh->b_blocknr, bh->b_size); -set_mask_bits (&bh->b_state, clear_bits,0 );unlock_buffer (bh); }while (bh = bh->b_this_page, bh != head);
fs/nilfs2/page.h +2 -2
@@ -41,8 +41,8 @@ void nilfs_page_bug(struct page *);int nilfs_copy_dirty_pages (struct address_space *,struct address_space *);void nilfs_copy_back_pages (struct address_space *,struct address_space *); -void nilfs_clear_dirty_page (struct page *,bool ); -void nilfs_clear_dirty_pages (struct address_space *,bool ); +void nilfs_clear_dirty_page (struct page *page); +void nilfs_clear_dirty_pages (struct address_space *mapping);unsigned int nilfs_page_count_clean_buffers (struct page *,unsigned int ,unsigned int ); unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
Greg Kroah-Hartman
maintainerPATCH 567/578 nilfs2: do not force clear folio if buffer is referenced
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit ca76bb226bf47ff04c782cacbd299f12ddee1ec1 upstream.
Patch series "nilfs2: protect busy buffer heads from being force-cleared".
This series fixes the buffer head state inconsistency issues reported by syzbot that occurs when the filesystem is corrupted and falls back to read-only, and the associated buffer head use-after-free issue.
This patch (of 2):
Syzbot has reported that after nilfs2 detects filesystem corruption and falls back to read-only, inconsistencies in the buffer state may occur.
One of the inconsistencies is that when nilfs2 calls mark_buffer_dirty() to set a data or metadata buffer as dirty, but it detects that the buffer is not in the uptodate state:
WARNING: CPU: 0 PID: 6049 at fs/buffer.c:1177 mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177 ... Call Trace: <TASK> nilfs_palloc_commit_alloc_entry+0x4b/0x160 fs/nilfs2/alloc.c:598 nilfs_ifile_create_inode+0x1dd/0x3a0 fs/nilfs2/ifile.c:73 nilfs_new_inode+0x254/0x830 fs/nilfs2/inode.c:344 nilfs_mkdir+0x10d/0x340 fs/nilfs2/namei.c:218 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
The other is when nilfs_btree_propagate(), which propagates the dirty state to the ancestor nodes of a b-tree that point to a dirty buffer, detects that the origin buffer is not dirty, even though it should be:
WARNING: CPU: 0 PID: 5245 at fs/nilfs2/btree.c:2089 nilfs_btree_propagate+0xc79/0xdf0 fs/nilfs2/btree.c:2089 ... Call Trace: <TASK> nilfs_bmap_propagate+0x75/0x120 fs/nilfs2/bmap.c:345 nilfs_collect_file_data+0x4d/0xd0 fs/nilfs2/segment.c:587 nilfs_segctor_apply_buffers+0x184/0x340 fs/nilfs2/segment.c:1006 nilfs_segctor_scan_file+0x28c/0xa50 fs/nilfs2/segment.c:1045 nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1216 [inline] nilfs_segctor_collect fs/nilfs2/segment.c:1540 [inline] nilfs_segctor_do_construct+0x1c28/0x6b90 fs/nilfs2/segment.c:2115 nilfs_segctor_construct+0x181/0x6b0 fs/nilfs2/segment.c:2479 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2587 [inline] nilfs_segctor_thread+0x69e/0xe80 fs/nilfs2/segment.c:2701 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>
Both of these issues are caused by the callbacks that handle the page/folio write requests, forcibly clear various states, including the working state of the buffers they hold, at unexpected times when they detect read-only fallback.
Fix these issues by checking if the buffer is referenced before clearing the page/folio state, and skipping the clear if it is.
--- fs/nilfs2/page.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
fs/nilfs2/page.c +29 -6
@@ -388,24 +388,44 @@ void nilfs_clear_dirty_pages(struct addr/** * nilfs_clear_dirty_page - discard dirty page * @page: dirty page that will be discarded +* +* nilfs_clear_dirty_page() clears working states including dirty state for +* the page and its buffers. If the page has buffers, clear only if it is +* confirmed that none of the buffer heads are busy (none have valid +* references and none are locked). */ void nilfs_clear_dirty_page (struct page *page) {BUG_ON (!PageLocked (page)); -ClearPageUptodate (page); -ClearPageMappedToDisk (page); -ClearPageChecked (page); -if (page_has_buffers (page)) { -struct buffer_head *bh, *head; +struct buffer_head *bh, *head =page_buffers (page);const unsigned long clear_bits = (BIT (BH_Uptodate) |BIT (BH_Dirty) |BIT (BH_Mapped) |BIT (BH_Async_Write) |BIT (BH_NILFS_Volatile) |BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected) |BIT (BH_Delay)); +bool busy, invalidated = false; - bh = head =page_buffers (page); +recheck_buffers: + busy = false; + bh = head; +do { +if (atomic_read (&bh->b_count) |buffer_locked (bh)) { + busy = true; +break ; + } + }while (bh = bh->b_this_page, bh != head); + +if (busy) { +if (invalidated) +return ; +invalidate_bh_lrus (); + invalidated = true; + goto recheck_buffers; + } + + bh = head; do { lock_buffer(bh); set_mask_bits(&bh->b_state, clear_bits, 0);
@@ -413,6 +433,9 @@ void nilfs_clear_dirty_page(struct page }while (bh = bh->b_this_page, bh != head); } +ClearPageUptodate (page); +ClearPageMappedToDisk (page); +ClearPageChecked (page);__nilfs_clear_page_dirty (page); }
Greg Kroah-Hartman
maintainerPATCH 568/578 nilfs2: protect access to buffers with no active references
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 367a9bffabe08c04f6d725032cce3d891b2b9e1a upstream.
nilfs_lookup_dirty_data_buffers(), which iterates through the buffers attached to dirty data folios/pages, accesses the attached buffers without locking the folios/pages.
For data cache, nilfs_clear_folio_dirty() may be called asynchronously when the file system degenerates to read only, so nilfs_lookup_dirty_data_buffers() still has the potential to cause use after free issues when buffers lose the protection of their dirty state midway due to this asynchronous clearing and are unintentionally freed by try_to_free_buffers().
Eliminate this race issue by adjusting the lock section in this function.
--- fs/nilfs2/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nilfs2/segment.c +3 -1
@@ -732,7 +732,6 @@ static size_t nilfs_lookup_dirty_data_bu }if (!page_has_buffers (page))create_empty_buffers (page,i_blocksize (inode),0 ); -unlock_page (page); bh = head =page_buffers (page); do {
@@ -742,11 +741,14 @@ static size_t nilfs_lookup_dirty_data_bulist_add_tail (&bh->b_assoc_buffers, listp); ndirties++;if (unlikely (ndirties >= nlimit)) { +unlock_page (page);pagevec_release (&pvec);cond_resched ();return ndirties; } }while (bh = bh->b_this_page, bh != head); + +unlock_page (page); }pagevec_release (&pvec);cond_resched ();
Greg Kroah-Hartman
maintainerPATCH 569/578 can: ems_pci: move ASIX AX99100 ids to pci_ids.h
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 3029ad91335353a70feb42acd24d580d70ab258b upstream.
Move PCI Vendor and Device ID of ASIX AX99100 PCIe to Multi I/O Controller to pci_ids.h for its serial and parallel port driver support in subsequent patches.
--- include/linux/pci_ids.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/pci_ids.h +4 -0
@@ -1754,6 +1754,10 @@#define PCI_SUBDEVICE_ID_AT_2700FX 0x2701#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 +#define PCI_VENDOR_ID_ASIX 0x125b +#define PCI_DEVICE_ID_ASIX_AX99100 0x9100 +#define PCI_DEVICE_ID_ASIX_AX99100_LB 0x9110 +#define PCI_VENDOR_ID_ESS 0x125d#define PCI_DEVICE_ID_ESS_ESS1968 0x1968#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
Greg Kroah-Hartman
maintainerPATCH 570/578 serial: 8250_pci: add support for ASIX AX99100
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 0b32216557ce3b2a468d1282d99b428bf72ff532 upstream.
Each of the 4 PCI functions on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port serial port controller. The subvendor id is 0x1000 when configured as serial port and MSI interrupts are supported.
--- drivers/tty/serial/8250/8250_pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/8250/8250_pci.c +10 -0
@@ -66,6 +66,8 @@ static const struct pci_device_id pci_us 0xA000, 0x1000) }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9922 , 0xA000, 0x1000) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x1000) }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, PCI_ANY_ID, PCI_ANY_ID) }, { }
@@ -5890,6 +5892,14 @@ static const struct pci_device_id serial {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 ,0xA000 ,0x3004 , 0, 0, pbn_b0_bt_4_115200 }, + +/* +* ASIX AX99100 PCIe to Multi I/O Controller +*/ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, +0xA000 ,0x1000 , + 0, 0, pbn_b0_1_115200 }, +/* Intel CE4100 */ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CE4100_UART, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
Greg Kroah-Hartman
maintainerPATCH 571/578 parport_pc: add support for ASIX AX99100
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaqing Zhao <[email protected]>
commit 16aae4c64600a6319a6f10dbff833fa198bf9599 upstream.
The PCI function 2 on ASIX AX99100 PCIe to Multi I/O Controller can be configured as a single-port parallel port controller. The subvendor id is 0x2000 when configured as parallel port. It supports IEEE-1284 EPP / ECP with its ECR on BAR1.
--- drivers/parport/parport_pc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/parport/parport_pc.c +5 -0
@@ -2612,6 +2612,7 @@ enum parport_pc_pci_cards { netmos_9815, netmos_9901, netmos_9865, + asix_ax99100, quatech_sppxp100, wch_ch382l, brainboxes_uc146,
@@ -2678,6 +2679,7 @@ static struct parport_pc_pci { /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* netmos_9901 */ { 1, { { 0, -1 }, } }, /* netmos_9865 */ { 1, { { 0, -1 }, } }, + /* asix_ax99100 */ { 1, { { 0, 1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, /* wch_ch382l */ { 1, { { 2, -1 }, } }, /* brainboxes_uc146 */ { 1, { { 3, -1 }, } },
@@ -2770,6 +2772,9 @@ static const struct pci_device_id parpor 0xA000, 0x1000, 0, 0, netmos_9865 }, {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 , 0xA000, 0x2000, 0, 0, netmos_9865 }, +/* ASIX AX99100 PCIe to Multi I/O Controller */ + { PCI_VENDOR_ID_ASIX, PCI_DEVICE_ID_ASIX_AX99100, + 0xA000, 0x2000, 0, 0, asix_ax99100 },/* Quatech SPPXP-100 Parallel port PCI ExpressCard */ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
Greg Kroah-Hartman
maintainerPATCH 572/578 net: dsa: fix netdev_priv() dereference before check on non-DSA netdevice events
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
commit 844f104790bd69c2e4dbb9ee3eba46fde1fcea7b upstream.
After the blamed commit, we started doing this dereference for every NETDEV_CHANGEUPPER and NETDEV_PRECHANGEUPPER event in the system.
static inline struct dsa_port *dsa_user_to_port(const struct net_device *dev)
{
struct dsa_user_priv *p = netdev_priv(dev);
return p->dp;
}Which is obviously bogus, because not all net_devices have a netdev_priv() of type struct dsa_user_priv. But struct dsa_user_priv is fairly small, and p->dp means dereferencing 8 bytes starting with offset 16. Most drivers allocate that much private memory anyway, making our access not fault, and we discard the bogus data quickly afterwards, so this wasn't caught.
But the dummy interface is somewhat special in that it calls alloc_netdev() with a priv size of 0. So every netdev_priv() dereference is invalid, and we get this when we emit a NETDEV_PRECHANGEUPPER event with a VLAN as its new upper:
$ ip link add dummy1 type dummy $ ip link add link dummy1 name dummy1.100 type vlan id 100 [ 43.309174] ================================================================== [ 43.316456] BUG: KASAN: slab-out-of-bounds in dsa_user_prechangeupper+0x30/0xe8 [ 43.323835] Read of size 8 at addr ffff3f86481d2990 by task ip/374 [ 43.330058] [ 43.342436] Call trace: [ 43.366542] dsa_user_prechangeupper+0x30/0xe8 [ 43.371024] dsa_user_netdevice_event+0xb38/0xee8 [ 43.375768] notifier_call_chain+0xa4/0x210 [ 43.379985] raw_notifier_call_chain+0x24/0x38 [ 43.384464] __netdev_upper_dev_link+0x3ec/0x5d8 [ 43.389120] netdev_upper_dev_link+0x70/0xa8 [ 43.393424] register_vlan_dev+0x1bc/0x310 [ 43.397554] vlan_newlink+0x210/0x248 [ 43.401247] rtnl_newlink+0x9fc/0xe30 [ 43.404942] rtnetlink_rcv_msg+0x378/0x580
Avoid the kernel oops by dereferencing after the type check, as customary.
--- net/dsa/slave.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/dsa/slave.c +5 -2
@@ -2592,13 +2592,14 @@ EXPORT_SYMBOL_GPL(dsa_slave_dev_check);static int dsa_slave_changeupper (struct net_device *dev,struct netdev_notifier_changeupper_info *info) { -struct dsa_port *dp =dsa_slave_to_port (dev);struct netlink_ext_ack *extack;int err =NOTIFY_DONE ; +struct dsa_port *dp;if (!dsa_slave_dev_check (dev))return err; + dp =dsa_slave_to_port (dev); extack =netdev_notifier_info_to_extack (&info->info);if (netif_is_bridge_master (info->upper_dev)) {
@@ -2652,11 +2653,13 @@ static int dsa_slave_changeupper(structstatic int dsa_slave_prechangeupper (struct net_device *dev,struct netdev_notifier_changeupper_info *info) { -struct dsa_port *dp =dsa_slave_to_port (dev); +struct dsa_port *dp;if (!dsa_slave_dev_check (dev))return NOTIFY_DONE ; + dp =dsa_slave_to_port (dev); +if (netif_is_bridge_master (info->upper_dev) && !info->linking)dsa_port_pre_bridge_leave (dp, info->upper_dev);else if (netif_is_lag_master (info->upper_dev) && !info->linking)
Greg Kroah-Hartman
maintainerPATCH 573/578 netdevsim: print human readable IP address
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit c71bc6da6198a6d88df86094f1052bb581951d65 upstream.
Currently, IPSec addresses are printed in hexadecimal format, which is not user-friendly. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=2 tx=20 sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0 sa[0] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000 sa[1] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627
This patch updates the code to print the IPSec address in a human-readable format for easier debug. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=4 tx=40 sa[0] tx ipaddr=0.0.0.0 sa[0] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] rx ipaddr=192.168.0.1 sa[1] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627 sa[2] tx ipaddr=:: sa[2] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[2] key=0x3167608a ca4f1397 43565909 941fa627 sa[3] rx ipaddr=2000::1 sa[3] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[3] key=0x3167608a ca4f1397 43565909 941fa627
--- drivers/net/netdevsim/ipsec.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/netdevsim/ipsec.c +8 -4
@@ -39,10 +39,14 @@ static ssize_t nsim_dbg_netdev_ops_read(if (!sap->used)continue ; - p +=scnprintf (p, bufsize - (p - buf), -"sa[%i] %cx ipaddr=0x%08x %08x %08x %08x\n" , - i, (sap->rx ?'r' :'t' ), sap->ipaddr[0 ], - sap->ipaddr[1 ], sap->ipaddr[2 ], sap->ipaddr[3 ]); +if (sap->xs->props.family ==AF_INET6 ) + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI6c\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr); +else + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI4\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr[3 ]); p += scnprintf(p, bufsize - (p - buf), "sa[%i] spi=0x%08x proto=0x%x salt=0x%08x crypt=%d\n", i, be32_to_cpu(sap->xs->id.spi),
Greg Kroah-Hartman
maintainerPATCH 574/578 selftests: rtnetlink: update netdevsim ipsec output format
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit 3ec920bb978ccdc68a7dfb304d303d598d038cb1 upstream.
After the netdevsim update to use human-readable IP address formats for IPsec, we can now use the source and destination IPs directly in testing. Here is the result:
# ./rtnetlink.sh -t kci_test_ipsec_offload PASS: ipsec_offload
--- tools/testing/selftests/net/rtnetlink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/rtnetlink.sh +2 -2
@@ -813,10 +813,10 @@ kci_test_ipsec_offload() # does driver have correct offload info diff $sysfsf - << EOF SA count=2 tx=3 -sa[0] tx ipaddr=0x00000000 00000000 00000000 00000000 +sa[0] tx ipaddr=$dstip sa[0] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[0] key=0x34333231 38373635 32313039 36353433 -sa[1] rx ipaddr=0x00000000 00000000 00000000 037ba8c0 +sa[1] rx ipaddr=$srcip sa[1] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[1] key=0x34333231 38373635 32313039 36353433 EOF
Greg Kroah-Hartman
maintainerPATCH 575/578 ARM: dts: dra7: Add bus_dma_limit for l4 cfg bus
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Naour <[email protected]>
commit c1472ec1dc4419d0bae663c1a1e6cb98dc7881ad upstream.
A bus_dma_limit was added for l3 bus by commit cfb5d65f2595 ("ARM: dts: dra7: Add bus_dma_limit for L3 bus") to fix an issue observed only with SATA on DRA7-EVM with 4GB RAM and CONFIG_ARM_LPAE enabled.
Since kernel 5.13, the SATA issue can be reproduced again following the SATA node move from L3 bus to L4_cfg in commit 8af15365a368 ("ARM: dts: Configure interconnect target module for dra7 sata").
Fix it by adding an empty dma-ranges property to l4_cfg and segment@100000 nodes (parent device tree node of SATA controller) to inherit the 2GB dma ranges limit from l3 bus node.
Note: A similar fix was applied for PCIe controller by commit 90d4d3f4ea45 ("ARM: dts: dra7: Fix bus_dma_limit for PCIe").
--- arch/arm/boot/dts/dra7-l4.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/dra7-l4.dtsi +2 -0
@@ -12,6 +12,7 @@ ranges = <0x00000000 0x4a000000 0x100000>, /* segment 0 */ <0x00100000 0x4a100000 0x100000>, /* segment 1 */ <0x00200000 0x4a200000 0x100000>; /* segment 2 */ + dma-ranges; segment@0 { /* 0x4a000000 */ compatible = "simple-pm-bus";
@@ -557,6 +558,7 @@ <0x0007e000 0x0017e000 0x001000>, /* ap 124 */ <0x00059000 0x00159000 0x001000>, /* ap 125 */ <0x0005a000 0x0015a000 0x001000>; /* ap 126 */ + dma-ranges; target-module@2000 { /* 0x4a102000, ap 27 3c.0 */ compatible = "ti,sysc";
Greg Kroah-Hartman
maintainerPATCH 576/578 f2fs: fix to wait dio completion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 96cfeb0389530ae32ade8a48ae3ae1ac3b6c009d upstream.
It should wait all existing dio write IOs before block removal, otherwise, previous direct write IO may overwrite data in the block which may be reused by other inode.
--- fs/f2fs/file.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/f2fs/file.c +13 -0
@@ -1048,6 +1048,13 @@ int f2fs_setattr(struct user_namespace *return err; } +/* +* wait for inflight dio, blocks should be removed after +* IO completion. +*/ +if (attr->ia_size < old_size) +inode_dio_wait (inode); +f2fs_down_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]);filemap_invalidate_lock (inode->i_mapping);
@@ -1880,6 +1887,12 @@ static long f2fs_fallocate(struct file *if (ret) goto out; +/* +* wait for inflight dio, blocks should be removed after IO +* completion. +*/ +inode_dio_wait (inode); +if (mode &FALLOC_FL_PUNCH_HOLE ) {if (offset >= inode->i_size) goto out;
Greg Kroah-Hartman
maintainerPATCH 577/578 drm/amd/display: Add NULL pointer check for kzalloc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hersen Wu <[email protected]>
commit 8e65a1b7118acf6af96449e1e66b7adbc9396912 upstream.
[Why & How]
Check return pointer of kzalloc before using it.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c | 8 ++++++++ drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 8 ++++++++ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c | 3 +++ drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 5 +++++ drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 5 +++++ drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c | 2 ++ drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c | 2 ++ drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 5 +++++ drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c | 2 ++ 9 files changed, 40 insertions(+)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +8 -0
@@ -568,11 +568,19 @@ void dcn3_clk_mgr_construct(dce_clock_read_ss_info (clk_mgr); clk_mgr->base.bw_params =kzalloc (sizeof (*clk_mgr->base.bw_params),GFP_KERNEL ); +if (!clk_mgr->base.bw_params) { +BREAK_TO_DEBUGGER (); +return ; + }/* need physical address of table to give to PMFW */ clk_mgr->wm_range_table =dm_helpers_allocate_gpu_mem (clk_mgr->base.ctx,DC_MEM_ALLOC_TYPE_GART ,sizeof (WatermarksExternal_t), &clk_mgr->wm_range_table_addr); +if (!clk_mgr->wm_range_table) { +BREAK_TO_DEBUGGER (); +return ; + } }void dcn3_clk_mgr_destroy (struct clk_mgr_internal *clk_mgr)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +8 -0
@@ -816,11 +816,19 @@ void dcn32_clk_mgr_construct( clk_mgr->smu_present = false; clk_mgr->base.bw_params =kzalloc (sizeof (*clk_mgr->base.bw_params),GFP_KERNEL ); +if (!clk_mgr->base.bw_params) { +BREAK_TO_DEBUGGER (); +return ; + }/* need physical address of table to give to PMFW */ clk_mgr->wm_range_table =dm_helpers_allocate_gpu_mem (clk_mgr->base.ctx,DC_MEM_ALLOC_TYPE_GART ,sizeof (WatermarksExternal_t), &clk_mgr->wm_range_table_addr); +if (!clk_mgr->wm_range_table) { +BREAK_TO_DEBUGGER (); +return ; + } }void dcn32_clk_mgr_destroy (struct clk_mgr_internal *clk_mgr)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +3 -0
@@ -2062,6 +2062,9 @@ bool dcn30_validate_bandwidth(struct dcBW_VAL_TRACE_COUNT (); +if (!pipes) + goto validate_fail; +DC_FP_START (); out =dcn30_internal_validate_bw (dc, context, pipes, &pipe_cnt, &vlevel, fast_validate, true);DC_FP_END ();
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +5 -0
@@ -1324,6 +1324,8 @@ static struct hpo_dp_link_encoder *dcn31/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ hpo_dp_link_encoder31_construct(hpo_dp_enc31, ctx, inst, &hpo_dp_link_enc_regs[inst],
@@ -1773,6 +1775,9 @@ bool dcn31_validate_bandwidth(struct dcBW_VAL_TRACE_COUNT (); +if (!pipes) + goto validate_fail; +DC_FP_START (); out =dcn30_internal_validate_bw (dc, context, pipes, &pipe_cnt, &vlevel, fast_validate, true);DC_FP_END ();
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +5 -0
@@ -1372,6 +1372,8 @@ static struct hpo_dp_link_encoder *dcn31/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ hpo_dp_link_encoder31_construct(hpo_dp_enc31, ctx, inst, &hpo_dp_link_enc_regs[inst],
@@ -1743,6 +1745,9 @@ bool dcn314_validate_bandwidth(struct dcBW_VAL_TRACE_COUNT (); +if (!pipes) + goto validate_fail; +if (filter_modes_for_single_channel_workaround (dc, context)) goto validate_fail;
drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c +2 -0
@@ -1325,6 +1325,8 @@ static struct hpo_dp_link_encoder *dcn31/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ hpo_dp_link_encoder31_construct(hpo_dp_enc31, ctx, inst, &hpo_dp_link_enc_regs[inst],
drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c +2 -0
@@ -1322,6 +1322,8 @@ static struct hpo_dp_link_encoder *dcn31/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ hpo_dp_link_encoder31_construct(hpo_dp_enc31, ctx, inst, &hpo_dp_link_enc_regs[inst],
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +5 -0
@@ -1310,6 +1310,8 @@ static struct hpo_dp_link_encoder *dcn32/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ #undef REG_STRUCT#define REG_STRUCT hpo_dp_link_enc_regs
@@ -1855,6 +1857,9 @@ bool dcn32_validate_bandwidth(struct dcBW_VAL_TRACE_COUNT (); +if (!pipes) + goto validate_fail; +DC_FP_START (); out =dcn32_internal_validate_bw (dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);DC_FP_END ();
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c +2 -0
@@ -1296,6 +1296,8 @@ static struct hpo_dp_link_encoder *dcn32/* allocate HPO link encoder */ hpo_dp_enc31 =kzalloc (sizeof (struct dcn31_hpo_dp_link_encoder ),GFP_KERNEL ); +if (!hpo_dp_enc31) +return NULL ;/* out of memory */ #undef REG_STRUCT#define REG_STRUCT hpo_dp_link_enc_regs
Greg Kroah-Hartman
maintainerPATCH 578/578 x86/i8253: Disable PIT timer 0 when not in use
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 70e6b7d9ae3c63df90a7bba7700e8d5c300c3c60 upstream.
Leaving the PIT interrupt running can cause noticeable steal time for virtual guests. The VMM generally has a timer which toggles the IRQ input to the PIC and I/O APIC, which takes CPU time away from the guest. Even on real hardware, running the counter may use power needlessly (albeit not much).
Make sure it's turned off if it isn't going to be used.
--- arch/x86/kernel/i8253.c | 11 +++++++++-- drivers/clocksource/i8253.c | 13 +++++++++---- include/linux/i8253.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)
arch/x86/kernel/i8253.c +9 -2
@@ -8,6 +8,7 @@#include <linux/timex.h> #include <linux/i8253.h> +#include <asm/hypervisor.h> #include <asm/apic.h> #include <asm/hpet.h> #include <asm/time.h>
@@ -39,9 +40,15 @@ static bool __init use_pit(void)bool __init pit_timer_init (void ) { -if (!use_pit ()) +if (!use_pit ()) { +/* +* Don't just ignore the PIT. Ensure it's stopped, because +* VMMs otherwise steal CPU time just to pointlessly waggle +* the (masked) IRQ. +*/ +clockevent_i8253_disable ();return false; - + }clockevent_i8253_init (true); global_clock_event = &i8253_clockevent;return true;
drivers/clocksource/i8253.c +9 -4
@@ -108,11 +108,8 @@ int __init clocksource_i8253_init(void)#endif #ifdef CONFIG_CLKEVT_I8253 -static int pit_shutdown (struct clock_event_device *evt) +void clockevent_i8253_disable (void ) { -if (!clockevent_state_oneshot (evt) && !clockevent_state_periodic (evt)) -return 0 ; -raw_spin_lock (&i8253_lock);outb_p (0x30 ,PIT_MODE );
@@ -123,6 +120,14 @@ static int pit_shutdown(struct clock_eve }raw_spin_unlock (&i8253_lock); +} + +static int pit_shutdown (struct clock_event_device *evt) +{ +if (!clockevent_state_oneshot (evt) && !clockevent_state_periodic (evt)) +return 0 ; + +clockevent_i8253_disable ();return 0 ; }
include/linux/i8253.h +1 -0
@@ -24,6 +24,7 @@ extern raw_spinlock_t i8253_lock;extern bool i8253_clear_counter_on_shutdown;extern struct clock_event_device i8253_clockevent;extern void clockevent_i8253_init (bool oneshot); +extern void clockevent_i8253_disable (void );extern void setup_pit_timer (void );
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Am 19.02.2025 um 09:20 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
The kernel, bpf tool, and kselftest builds fine for v6.1.129-rc1 on x86 Azure VM.
perf build fails with the following error:
CC util/trace-event-parse.outil/namespaces.c: In function 'nsinfo__set_in_pidns':util/namespaces.c:247:9: error: implicit declaration of function 'RC_CHK_ACCESS' [-Werror=implicit-function-declaration]
247 | RC_CHK_ACCESS(nsi)->in_pidns = true;
| ^~~~~~~~~~~~~util/namespaces.c:247:27: error: invalid type argument of '->' (have 'int')
247 | RC_CHK_ACCESS(nsi)->in_pidns = true;
| ^~
cc1: all warnings being treated as errors
make[5]: *** [/home/hgarg2/upstream-kernel/linux-stable-rc/tools/build/Makefile.build:97: util/namespaces.o] Error 1 make[5]: *** Waiting for unfinished jobs....
CC tests/unit_number__scnprintf.o
Thanks,
Hardik
Greg KH
maintainerQuoted 17 lines · Hardik Garg
The kernel, bpf tool, and kselftest builds fine for v6.1.129-rc1 on x86 Azure VM.
perf build fails with the following error:
CCutil/trace-event-parse.outil/namespaces.c: In function 'nsinfo__set_in_pidns':util/namespaces.c:247:9: error: implicit declaration of function 'RC_CHK_ACCESS' [-Werror=implicit-function-declaration]247 | RC_CHK_ACCESS(nsi)->in_pidns = true; | ^~~~~~~~~~~~~
util/namespaces.c:247:27: error: invalid type argument of '->' (have 'int')
247 | RC_CHK_ACCESS(nsi)->in_pidns = true;
| ^~
cc1: all warnings being treated as errors
make[5]: *** [/home/hgarg2/upstream-kernel/linux-stable-rc/tools/build/Makefile.build:97:util/namespaces.o] Error 1 make[5]: *** Waiting for unfinished jobs....
CCtests/unit_number__scnprintf.o
Quoted 1 line
Tested-by Hardik Garg <[email protected]>
Ugh, I'm just going to drop all perf patches from 6.1.y for now.
thanks,
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Hi Greg,
No regressions or any sort of issues to speak of. Builds fine on my x86_64 test machine.
All the best,
Slade
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 21 Feb 2025 08:25:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.129-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 21 Feb 2025 08:25:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.129-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.1:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
115 tests: 115 pass, 0 failLinux version: 6.1.129-rc1-ga377a8af64e7
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 21 Feb 2025 08:25:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.129-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.1.129-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: a377a8af64e7b08203073eef8cb7633b9c1b9af0
* git describe: v6.1.128-579-ga377a8af64e7
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.128-579-ga377a8af64e7
## Test Regressions (compared to v6.1.126-65-gc5148ca733b3)
## Metric Regressions (compared to v6.1.126-65-gc5148ca733b3)
## Test Fixes (compared to v6.1.126-65-gc5148ca733b3)
## Metric Fixes (compared to v6.1.126-65-gc5148ca733b3)
## Test result summary
total: 29597, pass: 22716, fail: 1253, skip: 5516, xfail: 112
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 133 total, 133 passed, 0 failed
* arm64: 20 total, 20 passed, 0 failed
* i386: 26 total, 22 passed, 4 failed
* mips: 24 total, 24 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 31 total, 30 passed, 1 failed
* riscv: 9 total, 9 passed, 0 failed
* s390: 11 total, 11 passed, 0 failed
* sh: 12 total, 10 passed, 2 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 32 total, 32 passed, 0 failed
## Test suites summary
* boot
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-crypto
* ltp-cve
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.129 release. There are 578 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 21 Feb 2025 08:25:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.129-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah