5.4.75-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 10/214 xen/events: switch user event channels to lateeoi model
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit c44b849cee8c3ac587da3b0980e01f77500d158c upstream.
Instead of disabling the irq when an event is received and enabling it again when handled by the user process use the lateeoi model.
This is part of XSA-332.
--- drivers/xen/evtchn.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/xen/evtchn.c +3 -4
@@ -166,7 +166,6 @@ static irqreturn_t evtchn_interrupt(int"Interrupt for port %d, but apparently not enabled; per-user %p\n" , evtchn->port, u); -disable_irq_nosync (irq); evtchn->enabled = false;spin_lock (&u->ring_prod_lock);
@@ -292,7 +291,7 @@ static ssize_t evtchn_write(struct file evtchn =find_evtchn (u, port);if (evtchn && !evtchn->enabled) { evtchn->enabled = true; -enable_irq (irq_from_evtchn (port)); +xen_irq_lateeoi (irq_from_evtchn (port),0 ); } }
@@ -392,8 +391,8 @@ static int evtchn_bind_to_user(struct peif (rc <0 ) goto err; - rc =bind_evtchn_to_irqhandler (port, evtchn_interrupt,0 , - u->name, evtchn); + rc =bind_evtchn_to_irqhandler_lateeoi (port, evtchn_interrupt,0 , + u->name, evtchn);if (rc <0 ) goto err;
Greg Kroah-Hartman
maintainerPATCH 1/214 xen/events: avoid removing an event channel while handling it
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 073d0552ead5bfc7a3a9c01de590e924f11b5dd2 upstream.
Today it can happen that an event channel is being removed from the system while the event handling loop is active. This can lead to a race resulting in crashes or WARN() splats when trying to access the irq_info structure related to the event channel.
Fix this problem by using a rwlock taken as reader in the event handling loop and as writer when deallocating the irq_info structure.
As the observed problem was a NULL dereference in evtchn_from_irq() make this function more robust against races by testing the irq_info pointer to be not NULL before dereferencing it.
And finally make all accesses to evtchn_to_irq[row][col] atomic ones in order to avoid seeing partial updates of an array element in irq handling. Note that irq handling can be entered only for event channels which have been valid before, so any not populated row isn't a problem in this regard, as rows are only ever added and never removed.
This is XSA-331.
--- drivers/xen/events/events_base.c | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-)
drivers/xen/events/events_base.c +35 -5
@@ -33,6 +33,7 @@#include <linux/slab.h> #include <linux/irqnr.h> #include <linux/pci.h> +#include <linux/spinlock.h> #ifdef CONFIG_X86 #include <asm/desc.h>
@@ -70,6 +71,23 @@ const struct evtchn_ops *evtchn_ops;*/ static DEFINE_MUTEX (irq_mapping_update_lock); +/* +* Lock protecting event handling loop against removing event channels. +* Adding of event channels is no issue as the associated IRQ becomes active +* only after everything is setup (before request_[threaded_]irq() the handler +* can't be entered for an event, as the event channel will be unmasked only +* then). +*/ +static DEFINE_RWLOCK (evtchn_rwlock); + +/* +* Lock hierarchy: +* +* irq_mapping_update_lock +* evtchn_rwlock +* IRQ-desc lock +*/ +static LIST_HEAD (xen_irq_list_head);/* IRQ <-> VIRQ mapping. */
@@ -104,7 +122,7 @@ static void clear_evtchn_to_irq_row(unsiunsigned col;for (col =0 ; col <EVTCHN_PER_ROW ; col++) - evtchn_to_irq[row][col] =-1 ; +WRITE_ONCE (evtchn_to_irq[row][col],-1 ); }static void clear_evtchn_to_irq_all (void )
@@ -141,7 +159,7 @@ static int set_evtchn_to_irq(unsigned evclear_evtchn_to_irq_row (row); } - evtchn_to_irq[row][col] = irq; +WRITE_ONCE (evtchn_to_irq[row][col], irq);return 0 ; }
@@ -151,7 +169,7 @@ int get_evtchn_to_irq(unsigned evtchn)return -1 ;if (evtchn_to_irq[EVTCHN_ROW (evtchn)] ==NULL )return -1 ; -return evtchn_to_irq[EVTCHN_ROW (evtchn)][EVTCHN_COL (evtchn)]; +return READ_ONCE (evtchn_to_irq[EVTCHN_ROW (evtchn)][EVTCHN_COL (evtchn)]); }/* Get info for IRQ */
@@ -260,10 +278,14 @@ static void xen_irq_info_cleanup(struct*/ unsigned int evtchn_from_irq (unsigned irq) { -if (WARN (irq >= nr_irqs,"Invalid irq %d!\n" , irq)) +const struct irq_info *info =NULL ; + +if (likely (irq < nr_irqs)) + info =info_for_irq (irq); +if (!info)return 0 ; -return info_for_irq (irq)->evtchn; +return info->evtchn; }unsigned irq_from_evtchn (unsigned int evtchn)
@@ -439,16 +461,21 @@ static int __must_check xen_allocate_irqstatic void xen_free_irq (unsigned irq) {struct irq_info *info =info_for_irq (irq); +unsigned long flags;if (WARN_ON (!info))return ; +write_lock_irqsave (&evtchn_rwlock, flags); +list_del (&info->list);set_info_for_irq (irq,NULL );WARN_ON (info->refcnt >0 ); +write_unlock_irqrestore (&evtchn_rwlock, flags); +kfree (info);/* Legacy IRQ descriptors are managed by the arch. */
@@ -1234,6 +1261,8 @@ static void __xen_evtchn_do_upcall(void)int cpu =get_cpu ();unsigned count; +read_lock (&evtchn_rwlock); + do { vcpu_info->evtchn_upcall_pending = 0;
@@ -1249,6 +1278,7 @@ static void __xen_evtchn_do_upcall(void) }while (count !=1 || vcpu_info->evtchn_upcall_pending); out: +read_unlock (&evtchn_rwlock);put_cpu (); }
Greg Kroah-Hartman
maintainerPATCH 13/214 xen/events: block rogue events for some time
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 5f7f77400ab5b357b5fdb7122c3442239672186c upstream.
In order to avoid high dom0 load due to rogue guests sending events at high frequency, block those events in case there was no action needed in dom0 to handle the events.
This is done by adding a per-event counter, which set to zero in case an EOI without the XEN_EOI_FLAG_SPURIOUS is received from a backend driver, and incremented when this flag has been set. In case the counter is 2 or higher delay the EOI by 1 << (cnt - 2) jiffies, but not more than 1 second.
In order not to waste memory shorten the per-event refcnt to two bytes (it should normally never exceed a value of 2). Add an overflow check to evtchn_get() to make sure the 2 bytes really won't overflow.
This is part of XSA-332.
--- drivers/xen/events/events_base.c | 27 ++++++++++++++++++++++----- drivers/xen/events/events_internal.h | 3 ++- 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/xen/events/events_base.c +22 -5
@@ -460,17 +460,34 @@ static void lateeoi_list_add(struct irq_spin_unlock_irqrestore (&eoi->eoi_list_lock, flags); } -static void xen_irq_lateeoi_locked (struct irq_info *info) +static void xen_irq_lateeoi_locked (struct irq_info *info,bool spurious) {evtchn_port_t evtchn;unsigned int cpu; +unsigned int delay =0 ; evtchn = info->evtchn;if (!VALID_EVTCHN (evtchn) || !list_empty (&info->eoi_list))return ; +if (spurious) { +if ((1 << info->spurious_cnt) < (HZ <<2 )) + info->spurious_cnt++; +if (info->spurious_cnt >1 ) { + delay =1 << (info->spurious_cnt -2 ); +if (delay >HZ ) + delay =HZ ; +if (!info->eoi_time) + info->eoi_cpu =smp_processor_id (); + info->eoi_time =get_jiffies_64 () + delay; + } + }else { + info->spurious_cnt =0 ; + } + cpu = info->eoi_cpu; -if (info->eoi_time && info->irq_epoch ==per_cpu (irq_epoch, cpu)) { +if (info->eoi_time && + (info->irq_epoch ==per_cpu (irq_epoch, cpu) || delay)) {lateeoi_list_add (info);return ; }
@@ -507,7 +524,7 @@ static void xen_irq_lateeoi_worker(struc info->eoi_time =0 ; -xen_irq_lateeoi_locked (info); +xen_irq_lateeoi_locked (info, false); }if (info)
@@ -536,7 +553,7 @@ void xen_irq_lateeoi(unsigned int irq, u info =info_for_irq (irq);if (info) -xen_irq_lateeoi_locked (info); +xen_irq_lateeoi_locked (info, eoi_flags &XEN_EOI_FLAG_SPURIOUS );read_unlock_irqrestore (&evtchn_rwlock, flags); }
@@ -1439,7 +1456,7 @@ int evtchn_get(unsigned int evtchn) goto done; err = -EINVAL ; -if (info->refcnt <=0 ) +if (info->refcnt <=0 || info->refcnt ==SHRT_MAX ) goto done; info->refcnt++;
drivers/xen/events/events_internal.h +2 -1
@@ -31,7 +31,8 @@ enum xen_irq_type {struct irq_info {struct list_head list;struct list_head eoi_list; -int refcnt; +short refcnt; +short spurious_cnt;enum xen_irq_type type;/* type */ unsigned irq;unsigned int evtchn;/* event channel */
Greg Kroah-Hartman
maintainerPATCH 16/214 x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
[ Upstream commit f2ac57a4c49d40409c21c82d23b5706df9b438af ]
GCC 10 optimizes the scheduler code differently than its predecessors.
When CONFIG_DEBUG_SECTION_MISMATCH=y, the Makefile forces GCC not to inline some functions (-fno-inline-functions-called-once). Before GCC 10, "no-inlined" __schedule() starts with the usual prologue:
push %bp
mov %sp, %bp
So the ORC unwinder simply picks stack pointer from %bp and unwinds from __schedule() just perfectly:
$ cat /proc/1/stack [<0>] ep_poll+0x3e9/0x450 [<0>] do_epoll_wait+0xaa/0xc0 [<0>] __x64_sys_epoll_wait+0x1a/0x20 [<0>] do_syscall_64+0x33/0x40 [<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
But now, with GCC 10, there is no %bp prologue in __schedule():
$ cat /proc/1/stack <nothing>
The ORC entry of the point in __schedule() is:
sp:sp+88 bp:last_sp-48 type:call end:0
In this case, nobody subtracts sizeof "struct inactive_task_frame" in __unwind_start(). The struct is put on the stack by __switch_to_asm() and only then __switch_to_asm() stores %sp to task->thread.sp. But we start unwinding from a point in __schedule() (stored in frame->ret_addr by 'call') and not in __switch_to_asm().
So for these example values in __unwind_start():
sp=ffff94b50001fdc8 bp=ffff8e1f41d29340 ip=__schedule+0x1f0
The stack is:
ffff94b50001fdc8: ffff8e1f41578000 # struct inactive_task_frame
ffff94b50001fdd0: 0000000000000000
ffff94b50001fdd8: ffff8e1f41d29340
ffff94b50001fde0: ffff8e1f41611d40 # ...
ffff94b50001fde8: ffffffff93c41920 # bx
ffff94b50001fdf0: ffff8e1f41d29340 # bp
ffff94b50001fdf8: ffffffff9376cad0 # ret_addr (and end of the struct)
0xffffffff9376cad0 is __schedule+0x1f0 (after the call to __switch_to_asm). Now follow those 88 bytes from the ORC entry (sp+88). The entry is correct, __schedule() really pushes 48 bytes (8*7) + 32 bytes via subq to store some local values (like 4U below). So to unwind, look at the offset 88-sizeof(long) = 0x50 from here:
ffff94b50001fe00: ffff8e1f41578618
ffff94b50001fe08: 00000cc000000255
ffff94b50001fe10: 0000000500000004
ffff94b50001fe18: 7793fab6956b2d00 # NOTE (see below)
ffff94b50001fe20: ffff8e1f41578000
ffff94b50001fe28: ffff8e1f41578000
ffff94b50001fe30: ffff8e1f41578000
ffff94b50001fe38: ffff8e1f41578000
ffff94b50001fe40: ffff94b50001fed8
ffff94b50001fe48: ffff8e1f41577ff0
ffff94b50001fe50: ffffffff9376cf12
Here ^^^^^^^^^^^^^^^^ is the correct ret addr from__schedule(). It translates to schedule+0x42 (insn after a call to __schedule()).
BUT, unwind_next_frame() tries to take the address starting from 0xffff94b50001fdc8. That is exactly from thread.sp+88-sizeof(long) = 0xffff94b50001fdc8+88-8 = 0xffff94b50001fe18, which is garbage marked as NOTE above. So this quits the unwinding as 7793fab6956b2d00 is obviously not a kernel address.
There was a fix to skip 'struct inactive_task_frame' in unwind_get_return_address_ptr in the following commit:
187b96db5ca7 ("x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks")
But we need to skip the struct already in the unwinder proper. So subtract the size (increase the stack pointer) of the structure in __unwind_start() directly. This allows for removal of the code added by commit 187b96db5ca7 completely, as the address is now at '(unsigned long *)state->sp - 1', the same as in the generic case.
[ mingo: Cleaned up the changelog a bit, for better readability. ]
--- arch/x86/kernel/unwind_orc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/kernel/unwind_orc.c +1 -8
@@ -311,19 +311,12 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);unsigned long *unwind_get_return_address_ptr (struct unwind_state *state) { -struct task_struct *task = state->task; -if (unwind_done (state))return NULL ;if (state->regs)return &state->regs->ip; -if (task != current && state->sp == task->thread.sp) { -struct inactive_task_frame *frame = (void *)task->thread.sp; -return &frame->ret_addr; - } -if (state->sp)return (unsigned long *)state->sp -1 ;
@@ -653,7 +646,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task, }else {struct inactive_task_frame *frame = (void *)task->thread.sp; - state->sp = task->thread.sp; + state->sp = task->thread.sp +sizeof (*frame); state->bp =READ_ONCE_NOCHECK (frame->bp); state->ip =READ_ONCE_NOCHECK (frame->ret_addr); state->signal = (void *)state->ip == ret_from_fork;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 17/214 mlxsw: core: Fix use-after-free in mlxsw_emad_trans_finish()
In reply to Greg Kroah-HartmanFrom: Amit Cohen <[email protected]>
[ Upstream commit 0daf2bf5a2dcf33d446b76360908f109816e2e21 ]
Each EMAD transaction stores the skb used to issue the EMAD request ('trans->tx_skb') so that the request could be retried in case of a timeout. The skb can be freed when a corresponding response is received or as part of the retry logic (e.g., failed retransmit, exceeded maximum number of retries).
The two tasks (i.e., response processing and retransmits) are synchronized by the atomic 'trans->active' field which ensures that responses to inactive transactions are ignored.
In case of a failed retransmit the transaction is finished and all of its resources are freed. However, the current code does not mark it as inactive. Syzkaller was able to hit a race condition in which a concurrent response is processed while the transaction's resources are being freed, resulting in a use-after-free [1].
Fix the issue by making sure to mark the transaction as inactive after a failed retransmit and free its resources only if a concurrent task did not already do that.
[1]
BUG: KASAN: use-after-free in consume_skb+0x30/0x370
net/core/skbuff.c:833
Read of size 4 at addr ffff88804f570494 by task syz-executor.0/1004
CPU: 0 PID: 1004 Comm: syz-executor.0 Not tainted 5.8.0-rc7+ #68
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xf6/0x16e lib/dump_stack.c:118
print_address_description.constprop.0+0x1c/0x250
mm/kasan/report.c:383
__kasan_report mm/kasan/report.c:513 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
check_memory_region_inline mm/kasan/generic.c:186 [inline]
check_memory_region+0x14e/0x1b0 mm/kasan/generic.c:192
instrument_atomic_read include/linux/instrumented.h:56 [inline]
atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
refcount_read include/linux/refcount.h:147 [inline]
skb_unref include/linux/skbuff.h:1044 [inline]
consume_skb+0x30/0x370 net/core/skbuff.c:833
mlxsw_emad_trans_finish+0x64/0x1c0 drivers/net/ethernet/mellanox/mlxsw/core.c:592
mlxsw_emad_process_response drivers/net/ethernet/mellanox/mlxsw/core.c:651 [inline]
mlxsw_emad_rx_listener_func+0x5c9/0xac0 drivers/net/ethernet/mellanox/mlxsw/core.c:672
mlxsw_core_skb_receive+0x4df/0x770 drivers/net/ethernet/mellanox/mlxsw/core.c:2063
mlxsw_pci_cqe_rdq_handle drivers/net/ethernet/mellanox/mlxsw/pci.c:595 [inline]
mlxsw_pci_cq_tasklet+0x12a6/0x2520 drivers/net/ethernet/mellanox/mlxsw/pci.c:651
tasklet_action_common.isra.0+0x13f/0x3e0 kernel/softirq.c:550
__do_softirq+0x223/0x964 kernel/softirq.c:292
asm_call_on_stack+0x12/0x20 arch/x86/entry/entry_64.S:711
Allocated by task 1006:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc mm/kasan/common.c:494 [inline]
__kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:467
slab_post_alloc_hook mm/slab.h:586 [inline]
slab_alloc_node mm/slub.c:2824 [inline]
slab_alloc mm/slub.c:2832 [inline]
kmem_cache_alloc+0xcd/0x2e0 mm/slub.c:2837
__build_skb+0x21/0x60 net/core/skbuff.c:311
__netdev_alloc_skb+0x1e2/0x360 net/core/skbuff.c:464
netdev_alloc_skb include/linux/skbuff.h:2810 [inline]
mlxsw_emad_alloc drivers/net/ethernet/mellanox/mlxsw/core.c:756 [inline]
mlxsw_emad_reg_access drivers/net/ethernet/mellanox/mlxsw/core.c:787 [inline]
mlxsw_core_reg_access_emad+0x1ab/0x1420 drivers/net/ethernet/mellanox/mlxsw/core.c:1817
mlxsw_reg_trans_query+0x39/0x50 drivers/net/ethernet/mellanox/mlxsw/core.c:1831
mlxsw_sp_sb_pm_occ_clear drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c:260 [inline]
mlxsw_sp_sb_occ_max_clear+0xbff/0x10a0 drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c:1365
mlxsw_devlink_sb_occ_max_clear+0x76/0xb0 drivers/net/ethernet/mellanox/mlxsw/core.c:1037
devlink_nl_cmd_sb_occ_max_clear_doit+0x1ec/0x280 net/core/devlink.c:1765
genl_family_rcv_msg_doit net/netlink/genetlink.c:669 [inline]
genl_family_rcv_msg net/netlink/genetlink.c:714 [inline]
genl_rcv_msg+0x617/0x980 net/netlink/genetlink.c:731
netlink_rcv_skb+0x152/0x440 net/netlink/af_netlink.c:2470
genl_rcv+0x24/0x40 net/netlink/genetlink.c:742
netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
netlink_unicast+0x53a/0x750 net/netlink/af_netlink.c:1330
netlink_sendmsg+0x850/0xd90 net/netlink/af_netlink.c:1919
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg+0x150/0x190 net/socket.c:671
____sys_sendmsg+0x6d8/0x840 net/socket.c:2359
___sys_sendmsg+0xff/0x170 net/socket.c:2413
__sys_sendmsg+0xe5/0x1b0 net/socket.c:2446
do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:384
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 73:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
kasan_set_free_info mm/kasan/common.c:316 [inline]
__kasan_slab_free+0x12c/0x170 mm/kasan/common.c:455
slab_free_hook mm/slub.c:1474 [inline]
slab_free_freelist_hook mm/slub.c:1507 [inline]
slab_free mm/slub.c:3072 [inline]
kmem_cache_free+0xbe/0x380 mm/slub.c:3088
kfree_skbmem net/core/skbuff.c:622 [inline]
kfree_skbmem+0xef/0x1b0 net/core/skbuff.c:616
__kfree_skb net/core/skbuff.c:679 [inline]
consume_skb net/core/skbuff.c:837 [inline]
consume_skb+0xe1/0x370 net/core/skbuff.c:831
mlxsw_emad_trans_finish+0x64/0x1c0 drivers/net/ethernet/mellanox/mlxsw/core.c:592
mlxsw_emad_transmit_retry.isra.0+0x9d/0xc0 drivers/net/ethernet/mellanox/mlxsw/core.c:613
mlxsw_emad_trans_timeout_work+0x43/0x50 drivers/net/ethernet/mellanox/mlxsw/core.c:625
process_one_work+0xa3e/0x17a0 kernel/workqueue.c:2269
worker_thread+0x9e/0x1050 kernel/workqueue.c:2415
kthread+0x355/0x470 kernel/kthread.c:291
ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:293
The buggy address belongs to the object at ffff88804f5703c0
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 212 bytes inside of
224-byte region [ffff88804f5703c0, ffff88804f5704a0)
The buggy address belongs to the page:
page:ffffea00013d5c00 refcount:1 mapcount:0 mapping:0000000000000000
index:0x0
flags: 0x100000000000200(slab)
raw: 0100000000000200 dead000000000100 dead000000000122 ffff88806c625400
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88804f570380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff88804f570400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804f570480: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88804f570500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88804f570580: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc--- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/core.c +3 -0
@@ -493,6 +493,9 @@ static void mlxsw_emad_transmit_retry(struct mlxsw_core *mlxsw_core, err =mlxsw_emad_transmit (trans->core, trans);if (err ==0 )return ; + +if (!atomic_dec_and_test (&trans->active)) +return ; }else { err = -EIO ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 2/214 xen/events: add a proper barrier to 2-level uevent unmasking
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 4d3fe31bd993ef504350989786858aefdb877daa upstream.
A follow-up patch will require certain write to happen before an event channel is unmasked.
While the memory barrier is not strictly necessary for all the callers, the main one will need it. In order to avoid an extra memory barrier when using fifo event channels, mandate evtchn_unmask() to provide write ordering.
The 2-level event handling unmask operation is missing an appropriate barrier, so add it. Fifo event channels are fine in this regard due to using sync_cmpxchg().
This is part of XSA-332.
--- drivers/xen/events/events_2l.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/xen/events/events_2l.c +2 -0
@@ -91,6 +91,8 @@ static void evtchn_2l_unmask(unsigned poBUG_ON (!irqs_disabled ()); +smp_wmb ();/* All writes before unmask must be visible. */ +if (unlikely ((cpu !=cpu_from_evtchn (port)))) do_hypercall =1 ;else {
Greg Kroah-Hartman
maintainerPATCH 19/214 ata: sata_nv: Fix retrieving of active qcs
In reply to Greg Kroah-HartmanFrom: Sascha Hauer <[email protected]>
[ Upstream commit 8e4c309f9f33b76c09daa02b796ef87918eee494 ]
ata_qc_complete_multiple() has to be called with the tags physically active, that is the hw tag is at bit 0. ap->qc_active has the same tag at bit ATA_TAG_INTERNAL instead, so call ata_qc_get_active() to fix that up. This is done in the vein of 8385d756e114 ("libata: Fix retrieving of active qcs").
--- drivers/ata/sata_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/sata_nv.c +1 -1
@@ -2100,7 +2100,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap) pp->dhfis_bits &= ~done_mask; pp->dmafis_bits &= ~done_mask; pp->sdbfis_bits |= done_mask; -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);if (!ap->qc_active) {DPRINTK ("over\n" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 21/214 powerpc/powernv/smp: Fix spurious DBG() warning
In reply to Greg Kroah-HartmanFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit f6bac19cf65c5be21d14a0c9684c8f560f2096dd ]
When building with W=1 we get the following warning:
arch/powerpc/platforms/powernv/smp.c: In function ‘pnv_smp_cpu_kill_self’:
arch/powerpc/platforms/powernv/smp.c:276:16: error: suggest braces around
empty body in an ‘if’ statement [-Werror=empty-body]
276 | cpu, srr1);
| ^
cc1: all warnings being treated as errors
The full context is this block:
if (srr1 && !generic_check_cpu_restart(cpu))
DBG("CPU%d Unexpected exit while offline srr1=%lx!\n",
cpu, srr1);
When building with DEBUG undefined DBG() expands to nothing and GCC emits the warning due to the lack of braces around an empty statement.
--- arch/powerpc/platforms/powernv/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/smp.c +1 -1
@@ -43,7 +43,7 @@#include <asm/udbg.h> #define DBG(fmt...) udbg_printf(fmt)#else -#define DBG(fmt...) +#define DBG(fmt...) do { } while (0)#endif static void pnv_smp_setup_cpu (int cpu)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 23/214 powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 66acd46080bd9e5ad2be4b0eb1d498d5145d058e ]
powerpc uses IPIs in some situations to switch a kernel thread away from a lazy tlb mm, which is subject to the TLB flushing race described in the changelog introducing ARCH_WANT_IRQS_OFF_ACTIVATE_MM.
--- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/mmu_context.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -0
@@ -147,6 +147,7 @@ config PPC select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF if PPC64 select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_WANT_IRQS_OFF_ACTIVATE_MM select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_EXTABLE_SORT
arch/powerpc/include/asm/mmu_context.h +1 -1
@@ -216,7 +216,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,*/ static inline void activate_mm (struct mm_struct *prev,struct mm_struct *next) { -switch_mm (prev, next, current); +switch_mm_irqs_off (prev, next, current); }/* We don't currently use enter_lazy_tlb() for anything */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 26/214 f2fs: fix uninit-value in f2fs_lookup
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 6d7ab88a98c1b7a47c228f8ffb4f44d631eaf284 ]
As syzbot reported:
Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x21c/0x280 lib/dump_stack.c:118 kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:122 __msan_warning+0x58/0xa0 mm/kmsan/kmsan_instr.c:219 f2fs_lookup+0xe05/0x1a80 fs/f2fs/namei.c:503 lookup_open fs/namei.c:3082 [inline] open_last_lookups fs/namei.c:3177 [inline] path_openat+0x2729/0x6a90 fs/namei.c:3365 do_filp_open+0x2b8/0x710 fs/namei.c:3395 do_sys_openat2+0xa88/0x1140 fs/open.c:1168 do_sys_open fs/open.c:1184 [inline] __do_compat_sys_openat fs/open.c:1242 [inline] __se_compat_sys_openat+0x2a4/0x310 fs/open.c:1240 __ia32_compat_sys_openat+0x56/0x70 fs/open.c:1240 do_syscall_32_irqs_on arch/x86/entry/common.c:80 [inline] __do_fast_syscall_32+0x129/0x180 arch/x86/entry/common.c:139 do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:162 do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:205 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
In f2fs_lookup(), @res_page could be used before being initialized, because in __f2fs_find_entry(), once F2FS_I(dir)->i_current_depth was been fuzzed to zero, then @res_page will never be initialized, causing this kmsan warning, relocating @res_page initialization place to fix this bug.
--- fs/f2fs/dir.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/f2fs/dir.c +3 -5
@@ -303,16 +303,15 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,unsigned int max_depth;unsigned int level; + *res_page =NULL ; +if (f2fs_has_inline_dentry (dir)) { - *res_page =NULL ; de =f2fs_find_in_inline_dir (dir, fname, res_page); goto out; } -if (npages ==0 ) { - *res_page =NULL ; +if (npages ==0 ) goto out; - } max_depth =F2FS_I (dir)->i_current_depth;if (unlikely (max_depth >MAX_DIR_HASH_DEPTH )) {
@@ -323,7 +322,6 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, }for (level =0 ; level < max_depth; level++) { - *res_page =NULL ; de =find_in_level (dir, level, fname, res_page);if (de ||IS_ERR (*res_page))break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 27/214 f2fs: fix to check segment boundary during SIT page readahead
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 6a257471fa42c8c9c04a875cd3a2a22db148e0f0 ]
As syzbot reported:
kernel BUG at fs/f2fs/segment.h:657!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 16220 Comm: syz-executor.0 Not tainted 5.9.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:f2fs_ra_meta_pages+0xa51/0xdc0 fs/f2fs/segment.h:657 Call Trace: build_sit_entries fs/f2fs/segment.c:4195 [inline] f2fs_build_segment_manager+0x4b8a/0xa3c0 fs/f2fs/segment.c:4779 f2fs_fill_super+0x377d/0x6b80 fs/f2fs/super.c:3633 mount_bdev+0x32e/0x3f0 fs/super.c:1417 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x89/0x2f0 fs/super.c:1547 do_new_mount fs/namespace.c:2875 [inline] path_mount+0x1387/0x2070 fs/namespace.c:3192 do_mount fs/namespace.c:3205 [inline] __do_sys_mount fs/namespace.c:3413 [inline] __se_sys_mount fs/namespace.c:3390 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3390 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9
@blkno in f2fs_ra_meta_pages could exceed max segment count, causing panic in following sanity check in current_sit_addr(), add check condition to avoid this issue.
--- fs/f2fs/checkpoint.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/checkpoint.c +2 -0
@@ -243,6 +243,8 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, blkno * NAT_ENTRY_PER_BLOCK);break ;case META_SIT : +if (unlikely (blkno >=TOTAL_SEGS (sbi))) + goto out;/* get sit block addr */ fio.new_blkaddr =current_sit_addr (sbi, blkno *SIT_ENTRY_PER_BLOCK );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 29/214 um: change sigio_spinlock to a mutex
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit f2d05059e15af3f70502074f4e3a504530af504a ]
Lockdep complains at boot:
=============================
[ BUG: Invalid wait context ]
5.7.0-05093-g46d91ecd597b #98 Not tainted
-----------------------------
swapper/1 is trying to lock:0000000060931b98 (&desc[i].request_mutex){+.+.}-{3:3}, at: __setup_irq+0x11d/0x623 other info that might help us debug this:
context-{4:4}
1 lock held by swapper/1:
#0: 000000006074fed8 (sigio_spinlock){+.+.}-{2:2}, at: sigio_lock+0x1a/0x1c
stack backtrace: CPU: 0 PID: 1 Comm: swapper Not tainted 5.7.0-05093-g46d91ecd597b #98 Stack: 7fa4fab0 6028dfd1 0000002a 6008bea5 7fa50700 7fa50040 7fa4fac0 6028e016 7fa4fb50 6007f6da 60959c18 00000000 Call Trace: [<60023a0e>] show_stack+0x13b/0x155 [<6028e016>] dump_stack+0x2a/0x2c [<6007f6da>] __lock_acquire+0x515/0x15f2 [<6007eb50>] lock_acquire+0x245/0x273 [<6050d9f1>] __mutex_lock+0xbd/0x325 [<6050dc76>] mutex_lock_nested+0x1d/0x1f [<6008e27e>] __setup_irq+0x11d/0x623 [<6008e8ed>] request_threaded_irq+0x169/0x1a6 [<60021eb0>] um_request_irq+0x1ee/0x24b [<600234ee>] write_sigio_irq+0x3b/0x76 [<600383ca>] sigio_broken+0x146/0x2e4 [<60020bd8>] do_one_initcall+0xde/0x281
Because we hold sigio_spinlock and then get into requesting an interrupt with a mutex.
Change the spinlock to a mutex to avoid that.
--- arch/um/kernel/sigio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/um/kernel/sigio.c +3 -3
@@ -35,14 +35,14 @@ int write_sigio_irq(int fd) }/* These are called from os-Linux/sigio.c to protect its pollfds arrays. */ -static DEFINE_SPINLOCK (sigio_spinlock); +static DEFINE_MUTEX (sigio_mutex);void sigio_lock (void ) { -spin_lock (&sigio_spinlock); +mutex_lock (&sigio_mutex); }void sigio_unlock (void ) { -spin_unlock (&sigio_spinlock); +mutex_unlock (&sigio_mutex); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 3/214 xen/events: fix race in evtchn_fifo_unmask()
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit f01337197419b7e8a492e83089552b77d3b5fb90 upstream.
Unmasking a fifo event channel can result in unmasking it twice, once directly in the kernel and once via a hypercall in case the event was pending.
Fix that by doing the local unmask only if the event is not pending.
This is part of XSA-332.
--- drivers/xen/events/events_fifo.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/xen/events/events_fifo.c +9 -4
@@ -227,19 +227,25 @@ static bool evtchn_fifo_is_masked(unsignreturn sync_test_bit (EVTCHN_FIFO_BIT (MASKED , word),BM (word)); }/* -* Clear MASKED, spinning if BUSY is set. +* Clear MASKED if not PENDING, spinning if BUSY is set. +* Return true if mask was cleared. */ -static void clear_masked (volatile event_word_t *word) +static bool clear_masked_cond (volatile event_word_t *word) {event_word_t new, old, w; w = *word;do { +if (w & (1 <<EVTCHN_FIFO_PENDING )) +return false; + old = w & ~(1 <<EVTCHN_FIFO_BUSY ); new = old & ~(1 <<EVTCHN_FIFO_MASKED ); w =sync_cmpxchg (word, old, new); }while (w != old); + +return true; }static void evtchn_fifo_unmask (unsigned port)
@@ -248,8 +254,7 @@ static void evtchn_fifo_unmask(unsignedBUG_ON (!irqs_disabled ()); -clear_masked (word); -if (evtchn_fifo_is_pending (port)) { +if (!clear_masked_cond (word)) {struct evtchn_unmask unmask = { .port = port }; (void )HYPERVISOR_event_channel_op (EVTCHNOP_unmask, &unmask); }
Greg Kroah-Hartman
maintainerPATCH 28/214 s390/startup: avoid save_area_sync overflow
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 2835c2ea95d50625108e47a459e1a47f6be836ce ]
Currently we overflow save_area_sync and write over save_area_async. Although this is not a real problem make startup_pgm_check_handler consistent with late pgm check handler and store [%r0,%r7] directly into gpregs_save_area.
--- arch/s390/boot/head.S | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
arch/s390/boot/head.S +11 -10
@@ -360,22 +360,23 @@ ENTRY(startup_kdump) # the save area and does disabled wait with a faulty address. # ENTRY(startup_pgm_check_handler) - stmg %r0,%r15,__LC_SAVE_AREA_SYNC - la %r1,4095 - stctg %c0,%c15,__LC_CREGS_SAVE_AREA-4095(%r1) - mvc __LC_GPREGS_SAVE_AREA-4095(128,%r1),__LC_SAVE_AREA_SYNC - mvc __LC_PSW_SAVE_AREA-4095(16,%r1),__LC_PGM_OLD_PSW + stmg %r8,%r15,__LC_SAVE_AREA_SYNC + la %r8,4095 + stctg %c0,%c15,__LC_CREGS_SAVE_AREA-4095(%r8) + stmg %r0,%r7,__LC_GPREGS_SAVE_AREA-4095(%r8) + mvc __LC_GPREGS_SAVE_AREA-4095+64(64,%r8),__LC_SAVE_AREA_SYNC + mvc __LC_PSW_SAVE_AREA-4095(16,%r8),__LC_PGM_OLD_PSW mvc __LC_RETURN_PSW(16),__LC_PGM_OLD_PSW ni __LC_RETURN_PSW,0xfc # remove IO and EX bits ni __LC_RETURN_PSW+1,0xfb # remove MCHK bit oi __LC_RETURN_PSW+1,0x2 # set wait state bit - larl %r2,.Lold_psw_disabled_wait - stg %r2,__LC_PGM_NEW_PSW+8 - l %r15,.Ldump_info_stack-.Lold_psw_disabled_wait(%r2) + larl %r9,.Lold_psw_disabled_wait + stg %r9,__LC_PGM_NEW_PSW+8 + l %r15,.Ldump_info_stack-.Lold_psw_disabled_wait(%r9) brasl %r14,print_pgm_check_info .Lold_psw_disabled_wait: - la %r1,4095 - lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1) + la %r8,4095 + lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r8) lpswe __LC_RETURN_PSW # disabled wait .Ldump_info_stack: .long 0x5000 + PAGE_SIZE - STACK_FRAME_OVERHEAD
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 6/214 xen/netback: use lateeoi irq binding
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 23025393dbeb3b8b3b60ebfa724cdae384992e27 upstream.
In order to reduce the chance for the system becoming unresponsive due to event storms triggered by a misbehaving netfront use the lateeoi irq binding for netback and unmask the event channel only just before going to sleep waiting for new events.
Make sure not to issue an EOI when none is pending by introducing an eoi_pending element to struct xenvif_queue.
When no request has been consumed set the spurious flag when sending the EOI for an interrupt.
This is part of XSA-332.
--- drivers/net/xen-netback/common.h | 15 ++++++++ drivers/net/xen-netback/interface.c | 61 ++++++++++++++++++++++++++++++------ drivers/net/xen-netback/netback.c | 11 +++++- drivers/net/xen-netback/rx.c | 13 +++++-- 4 files changed, 86 insertions(+), 14 deletions(-)
drivers/net/xen-netback/common.h +15 -0
@@ -140,6 +140,20 @@ struct xenvif_queue { /* Per-queue datachar name[QUEUE_NAME_SIZE ];/* DEVNAME-qN */ struct xenvif *vif;/* Parent VIF */ +/* +* TX/RX common EOI handling. +* When feature-split-event-channels = 0, interrupt handler sets +* NETBK_COMMON_EOI, otherwise NETBK_RX_EOI and NETBK_TX_EOI are set +* by the RX and TX interrupt handlers. +* RX and TX handler threads will issue an EOI when either +* NETBK_COMMON_EOI or their specific bits (NETBK_RX_EOI or +* NETBK_TX_EOI) are set and they will reset those bits. +*/ +atomic_t eoi_pending; +#define NETBK_RX_EOI 0x01 +#define NETBK_TX_EOI 0x02 +#define NETBK_COMMON_EOI 0x04 +/* Use NAPI for guest TX */ struct napi_struct napi;/* When feature-split-event-channels = 0, tx_irq = rx_irq. */
@@ -375,6 +389,7 @@ int xenvif_dealloc_kthread(void *data);irqreturn_t xenvif_ctrl_irq_fn (int irq,void *data); +bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread);void xenvif_rx_action (struct xenvif_queue *queue);void xenvif_rx_queue_tail (struct xenvif_queue *queue,struct sk_buff *skb);
drivers/net/xen-netback/interface.c +52 -9
111 lines not on this page · raw message
drivers/net/xen-netback/netback.c +10 -1
@@ -162,6 +162,10 @@ void xenvif_napi_schedule_or_enable_evenif (more_to_do)napi_schedule (&queue->napi); +else if (atomic_fetch_andnot (NETBK_TX_EOI |NETBK_COMMON_EOI , + &queue->eoi_pending) & + (NETBK_TX_EOI |NETBK_COMMON_EOI )) +xen_irq_lateeoi (queue->tx_irq,0 ); }static void tx_add_credit (struct xenvif_queue *queue)
@@ -1622,9 +1626,14 @@ static bool xenvif_ctrl_work_todo(structirqreturn_t xenvif_ctrl_irq_fn (int irq,void *data) {struct xenvif *vif = data; +unsigned int eoi_flag =XEN_EOI_FLAG_SPURIOUS ; -while (xenvif_ctrl_work_todo (vif)) +while (xenvif_ctrl_work_todo (vif)) {xenvif_ctrl_action (vif); + eoi_flag =0 ; + } + +xen_irq_lateeoi (irq, eoi_flag);return IRQ_HANDLED ; }
drivers/net/xen-netback/rx.c +9 -4
@@ -490,13 +490,13 @@ static bool xenvif_rx_queue_ready(structreturn queue->stalled && prod - cons >=1 ; } -static bool xenvif_have_rx_work (struct xenvif_queue *queue) +bool xenvif_have_rx_work (struct xenvif_queue *queue,bool test_kthread) {return xenvif_rx_ring_slots_available (queue) || (queue->vif->stall_timeout && (xenvif_rx_queue_stalled (queue) ||xenvif_rx_queue_ready (queue))) || -kthread_should_stop () || + (test_kthread &&kthread_should_stop ()) || queue->vif->disabled; }
@@ -527,15 +527,20 @@ static void xenvif_wait_for_rx_work(stru {DEFINE_WAIT (wait); -if (xenvif_have_rx_work (queue)) +if (xenvif_have_rx_work (queue, true))return ;for (;;) {long ret;prepare_to_wait (&queue->wq, &wait,TASK_INTERRUPTIBLE ); -if (xenvif_have_rx_work (queue)) +if (xenvif_have_rx_work (queue, true))break ; +if (atomic_fetch_andnot (NETBK_RX_EOI |NETBK_COMMON_EOI , + &queue->eoi_pending) & + (NETBK_RX_EOI |NETBK_COMMON_EOI )) +xen_irq_lateeoi (queue->rx_irq,0 ); + ret =schedule_timeout (xenvif_rx_queue_timeout (queue));if (!ret)break ;
Greg Kroah-Hartman
maintainercover 5.4.75-rc1 review
This is the start of the stable review cycle for the 5.4.75 release. There are 214 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 Thu, 05 Nov 2020 20:29:58 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.75-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.75-rc1
Stephen Boyd <[email protected]>
KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesn't return SMCCC_RET_NOT_REQUIRED
Alexander Sverdlin <[email protected]>
staging: octeon: Drop on uncorrectable alignment or FCS error
Alexander Sverdlin <[email protected]>
staging: octeon: repair "fixed-link" support
Ian Abbott <[email protected]>
staging: comedi: cb_pcidas: Allow 2-channel commands for AO subdevice
Jing Xiangfeng <[email protected]>
staging: fieldbus: anybuss: jump to correct label in an error path
Marc Zyngier <[email protected]>
KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
Andy Shevchenko <[email protected]>
device property: Don't clear secondary pointer for shared primary firmware node
Andy Shevchenko <[email protected]>
device property: Keep secondary firmware node secondary by type
Krzysztof Kozlowski <[email protected]>
ARM: s3c24xx: fix missing system reset
Krzysztof Kozlowski <[email protected]>
ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
Frank Wunderlich <[email protected]>
arm: dts: mt7623: add missing pause for switchport
Helge Deller <[email protected]>
hil/parisc: Disable HIL driver when it gets stuck
Matthew Wilcox (Oracle) <[email protected]>
cachefiles: Handle readpage error correctly
Jisheng Zhang <[email protected]>
arm64: berlin: Select DW_APB_TIMER_OF
Linus Torvalds <[email protected]>
tty: make FONTX ioctl use the tty pointer they were actually passed
Evan Quan <[email protected]>
drm/amd/pm: increase mclk switch threshold to 200 us
Jisheng Zhang <[email protected]>
mmc: sdhci: Use Auto CMD Auto Select only when v4_mode is true
Michael Walle <[email protected]>
mmc: sdhci-of-esdhc: set timeout to max before tuning
Dave Airlie <[email protected]>
drm/ttm: fix eviction valuable range check.
Constantine Sapuntzakis <[email protected]>
ext4: fix superblock checksum calculation race
Luo Meng <[email protected]>
ext4: fix invalid inode checksum
Dinghao Liu <[email protected]>
ext4: fix error handling code in add_new_gdb
Eric Biggers <[email protected]>
ext4: fix leaking sysfs kobject after failed mount
Stefano Garzarella <[email protected]>
vringh: fix __vringh_iov() when riov and wiov are different
Qiujun Huang <[email protected]>
ring-buffer: Return 0 on success from ring_buffer_resize()
Matthew Wilcox (Oracle) <[email protected]>
9P: Cast to loff_t before multiplying
Ilya Dryomov <[email protected]>
libceph: clear con->out_msg on Policy::stateful_server faults
Matthew Wilcox (Oracle) <[email protected]>
ceph: promote to unsigned long long before shifting
Takashi Iwai <[email protected]>
drm/amd/display: Fix kernel panic by dal_gpio_open() error
Takashi Iwai <[email protected]>
drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally
Christian König <[email protected]>
drm/amdgpu: increase the reserved VM size to 2MB
Andrey Grodzovsky <[email protected]>
drm/amd/display: Avoid MST manager resource leak.
Jay Cornwall <[email protected]>
drm/amdkfd: Use same SQ prefetch setting as amdgpu
Evan Quan <[email protected]>
drm/amdgpu: correct the gpu reset handling for job != NULL case
Wesley Chalmers <[email protected]>
drm/amd/display: Increase timeout for DP Disable
Madhav Chauhan <[email protected]>
drm/amdgpu: don't map BO in reserved region
Krzysztof Kozlowski <[email protected]>
i2c: imx: Fix external abort on interrupt in exit paths
Bartosz Golaszewski <[email protected]>
rtc: rx8010: don't modify the global rtc ops
Krzysztof Kozlowski <[email protected]>
ia64: fix build error with !COREDUMP
Zhihao Cheng <[email protected]>
ubi: check kthread_should_stop() after the setting of task state
Vineet Gupta <[email protected]>
ARC: perf: redo the pct irq missing in device-tree handling
Jiri Olsa <[email protected]>
perf python scripting: Fix printable strings in python3 scripts
Zhihao Cheng <[email protected]>
ubifs: mount_ubifs: Release authentication resource in error handling path
Zhihao Cheng <[email protected]>
ubifs: Don't parse authentication mount options in remount process
Zhihao Cheng <[email protected]>
ubifs: Fix a memleak after dumping authentication mount options
Richard Weinberger <[email protected]>
ubifs: journal: Make sure to not dirty twice for auth nodes
Zhihao Cheng <[email protected]>
ubifs: xattr: Fix some potential memory leaks while iterating entries
Zhihao Cheng <[email protected]>
ubifs: dent: Fix some potential memory leaks while iterating entries
Chuck Lever <[email protected]>
NFSD: Add missing NFSv2 .pc_func methods
Olga Kornievskaia <[email protected]>
NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag
Benjamin Coddington <[email protected]>
NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE
Michael Neuling <[email protected]>
powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
Christophe Leroy <[email protected]>
powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
Mahesh Salgaonkar <[email protected]>
powerpc/powernv/elog: Fix race while processing OPAL error log event.
Aneesh Kumar K.V <[email protected]>
powerpc/memhotplug: Make lmb size 64bit
Joel Stanley <[email protected]>
powerpc: Warn about use of smt_snooze_delay
Andrew Donnellan <[email protected]>
powerpc/rtas: Restrict RTAS requests from userspace
Sven Schnelle <[email protected]>
s390/stp: add locking to sysfs functions
Maciej W. Rozycki <[email protected]>
MIPS: DEC: Restore bootmem reservation for firmware working memory area
Aneesh Kumar K.V <[email protected]>
powerpc/drmem: Make lmb_size 64 bit
Jonathan Cameron <[email protected]>
iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
Jonathan Cameron <[email protected]>
iio:adc:ti-adc12138 Fix alignment issue with timestamp
Jonathan Cameron <[email protected]>
iio:adc:ti-adc0832 Fix alignment issue with timestamp
Tobias Jordan <[email protected]>
iio: adc: gyroadc: fix leak of device node iterator
Jonathan Cameron <[email protected]>
iio:light:si1145: Fix timestamp alignment and prevent data leak.
Paul Cercueil <[email protected]>
dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status
Jan Kara <[email protected]>
udf: Fix memory leak when mounting
Jason Gerecke <[email protected]>
HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery
Jiri Slaby <[email protected]>
vt: keyboard, extend func_buf_lock to readers
Jiri Slaby <[email protected]>
vt: keyboard, simplify vt_kdgkbsent
Chris Wilson <[email protected]>
drm/i915: Force VT'd workarounds when running as a guest OS
Ran Wang <[email protected]>
usb: host: fsl-mph-dr-of: check return of dma_set_mask()
Li Jun <[email protected]>
usb: typec: tcpm: reset hard_reset_count for any disconnect
Jerome Brunet <[email protected]>
usb: cdc-acm: fix cooldown mechanism
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Resume pending requests after CLEAR_STALL
Li Jun <[email protected]>
usb: dwc3: core: don't trigger runtime pm when remove driver
Li Jun <[email protected]>
usb: dwc3: core: add phy cleanup for probe error handling
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Check MPS of the request length
Thinh Nguyen <[email protected]>
usb: dwc3: ep0: Fix ZLP for OUT ep0 requests
Raymond Tan <[email protected]>
usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality
Sandeep Singh <[email protected]>
usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC
Filipe Manana <[email protected]>
btrfs: fix readahead hang and use-after-free after removing a device
Filipe Manana <[email protected]>
btrfs: fix use-after-free on readahead extent after failure to create it
Daniel Xu <[email protected]>
btrfs: tree-checker: validate number of chunk stripes and parity
Josef Bacik <[email protected]>
btrfs: cleanup cow block on error
Qu Wenruo <[email protected]>
btrfs: tree-checker: fix false alert caused by legacy btrfs root item
Denis Efremov <[email protected]>
btrfs: use kvzalloc() to allocate clone_roots in btrfs_ioctl_send()
Filipe Manana <[email protected]>
btrfs: send, recompute reference path after orphanization of a directory
Filipe Manana <[email protected]>
btrfs: send, orphanize first all conflicting inodes when processing references
Filipe Manana <[email protected]>
btrfs: reschedule if necessary when logging directory items
Anand Jain <[email protected]>
btrfs: improve device scanning messages
Qu Wenruo <[email protected]>
btrfs: qgroup: fix wrong qgroup metadata reserve for delayed inode
Xiang Chen <[email protected]>
PM: runtime: Remove link state checks in rpm_get/put_supplier()
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix crash on session cleanup with unload
Helge Deller <[email protected]>
scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
Martin Fuzzey <[email protected]>
w1: mxc_w1: Fix timeout resolution problem leading to bus error
Wei Huang <[email protected]>
acpi-cpufreq: Honor _PSD table setting on new AMD CPUs
Rafael J. Wysocki <[email protected]>
ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe()
Rafael J. Wysocki <[email protected]>
ACPI: EC: PM: Flush EC work unconditionally after wakeup
Lukas Wunner <[email protected]>
PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI
Jamie Iles <[email protected]>
ACPI: debug: don't allow debugging when ACPI is disabled
Alex Hung <[email protected]>
ACPI: video: use ACPI backlight for HP 635 Notebook
Ben Hutchings <[email protected]>
ACPI / extlog: Check for RDMSR failure
[email protected] <[email protected]>
ACPI: button: fix handling lid state changes when input device closed
Ashish Sangwan <[email protected]>
NFS: fix nfs_path in case of a rename retry
Jan Kara <[email protected]>
fs: Don't invalidate page buffers in block_write_full_page()
Hans de Goede <[email protected]>
media: uvcvideo: Fix uvc_ctrl_fixup_xu_info() not having any effect
Marek Behún <[email protected]>
leds: bcm6328, bcm6358: use devres LED registering function
Krzysztof Kozlowski <[email protected]>
extcon: ptn5150: Fix usage of atomic GPIO with sleeping GPIO chips
Krzysztof Kozlowski <[email protected]>
spi: sprd: Release DMA channel also on probe deferral
Kim Phillips <[email protected]>
perf/x86/amd/ibs: Fix raw sample data accumulation
Kim Phillips <[email protected]>
perf/x86/amd/ibs: Don't include randomized bits in get_ibs_op_count()
Kan Liang <[email protected]>
perf/x86/intel: Fix Ice Lake event constraint table
Andy Lutomirski <[email protected]>
selftests/x86/fsgsbase: Test PTRACE_PEEKUSER for GSBASE with invalid LDT GS
Jann Horn <[email protected]>
seccomp: Make duplicate listener detection non-racy
Raul E Rangel <[email protected]>
mmc: sdhci-acpi: AMDI0040: Set SDHCI_QUIRK2_PRESET_VALUE_BROKEN
Adrian Hunter <[email protected]>
mmc: sdhci: Add LTR support for some Intel BYT based controllers
Song Liu <[email protected]>
md/raid5: fix oops during stripe resizing
Chao Leng <[email protected]>
nvme-rdma: fix crash when connect rejected
Douglas Gilbert <[email protected]>
sgl_alloc_order: fix memory leak
Xiubo Li <[email protected]>
nbd: make the config put is called before the notifying the waiter
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: remove dedicated 'audio-subsystem' node
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: move PMU node out of clock controller
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: move fixed clocks under root node
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: remove DMA controller bus node name to fix dtschema warnings
Dan Carpenter <[email protected]>
memory: emif: Remove bogus debugfs error handling
Tony Lindgren <[email protected]>
ARM: dts: omap4: Fix sgx clock rate for 4430
Yoshihiro Shimoda <[email protected]>
arm64: dts: renesas: ulcb: add full-pwr-cycle-in-suspend into eMMC nodes
Ronnie Sahlberg <[email protected]>
cifs: handle -EINTR in cifs_setattr
Anant Thazhemadam <[email protected]>
gfs2: add validation checks for size of superblock
Jamie Iles <[email protected]>
gfs2: use-after-free in sysfs deregistration
Fabiano Rosas <[email protected]>
KVM: PPC: Book3S HV: Do not allocate HPT for a nested guest
Jan Kara <[email protected]>
ext4: Detect already used quota file early
Madhuparna Bhowmik <[email protected]>
drivers: watchdog: rdc321x_wdt: Fix race condition bugs
Anant Thazhemadam <[email protected]>
net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid
Lorenzo Pieralisi <[email protected]>
asm-generic/io.h: Fix !CONFIG_GENERIC_IOMAP pci_iounmap() implementation
Tero Kristo <[email protected]>
clk: ti: clockdomain: fix static checker warning
Chris Lew <[email protected]>
rpmsg: glink: Use complete_all for open states
Michael Chan <[email protected]>
bnxt_en: Log unknown link speed appropriately.
Zhao Heming <[email protected]>
md/bitmap: md_bitmap_get_counter returns wrong blocks
Anand Jain <[email protected]>
btrfs: fix replace of seed device
Zhen Lei <[email protected]>
ARC: [dts] fix the errors detected by dtbs_check
Fangzhi Zuo <[email protected]>
drm/amd/display: HDMI remote sink need mode validation for Linux
Xiongfeng Wang <[email protected]>
power: supply: test_power: add missing newlines when printing parameters by sysfs
Jonathan Cameron <[email protected]>
ACPI: HMAT: Fix handling of changes from ACPI 6.2 to ACPI 6.3
Diana Craciun <[email protected]>
bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
Xie He <[email protected]>
drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values
Wright Feng <[email protected]>
brcmfmac: Fix warning message after dongle setup failed
Jonathan Cameron <[email protected]>
ACPI: Add out of bounds and numa_off protections to pxm_to_node()
Darrick J. Wong <[email protected]>
xfs: don't free rt blocks when we're doing a REMAP bunmapi call
Joakim Zhang <[email protected]>
can: flexcan: disable clocks during stop mode
Zhengyuan Liu <[email protected]>
arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
Chuck Lever <[email protected]>
SUNRPC: Mitigate cond_resched() in xprt_transmit()
Peter Chen <[email protected]>
usb: xhci: omit duplicate actions when suspending a runtime suspended host.
Linu Cherian <[email protected]>
coresight: Make sysfs functional on topologies with per core sink
Lang Dai <[email protected]>
uio: free uio id after uio file node is freed
Oliver Neukum <[email protected]>
USB: adutux: fix debugging
Alain Volmat <[email protected]>
cpufreq: sti-cpufreq: add stih418 support
Zong Li <[email protected]>
riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
Magnus Karlsson <[email protected]>
samples/bpf: Fix possible deadlock in xdpsock
Yonghong Song <[email protected]>
selftests/bpf: Define string const as global for test_sysctl_prog.c
Daniel W. S. Almeida <[email protected]>
media: uvcvideo: Fix dereference of out-of-bound list iterator
Yonghong Song <[email protected]>
bpf: Permit map_ptr arithmetic with opcode add and offset 0
Douglas Anderson <[email protected]>
kgdb: Make "kgdbcon" work properly with "kgdb_earlycon"
Masami Hiramatsu <[email protected]>
ia64: kprobes: Use generic kretprobe trampoline handler
John Ogness <[email protected]>
printk: reduce LOG_BUF_SHIFT range for H8300
Valentin Schneider <[email protected]>
arm64: topology: Stop using MPIDR for topology information
Antonio Borneo <[email protected]>
drm/bridge/synopsys: dsi: add support for non-continuous HS clock
Madhuparna Bhowmik <[email protected]>
mmc: via-sdmmc: Fix data race bug
Hans Verkuil <[email protected]>
media: imx274: fix frame interval handling
Tom Rix <[email protected]>
media: tw5864: check status of tw5864_frameinterval_get
Badhri Jagan Sridharan <[email protected]>
usb: typec: tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart
Xia Jiang <[email protected]>
media: platform: Improve queue set up flow for bug fixing
Hans Verkuil <[email protected]>
media: videodev2.h: RGB BT2020 and HSV are always full range
Andy Lutomirski <[email protected]>
selftests/x86/fsgsbase: Reap a forgotten child
Nadezda Lutovinova <[email protected]>
drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly
Sathishkumar Muruganandam <[email protected]>
ath10k: fix VHT NSS calculation when STBC is enabled
Wen Gong <[email protected]>
ath10k: start recovery process when payload length exceeds max htc length for sdio
Tom Rix <[email protected]>
video: fbdev: pvr2fb: initialize variables
Darrick J. Wong <[email protected]>
xfs: fix realtime bitmap/summary file truncation when growing rt volume
Krzysztof Kozlowski <[email protected]>
power: supply: bq27xxx: report "not charging" on all types
Dave Wysochanski <[email protected]>
NFS4: Fix oops when copy_file_range is attempted with NFS4.0 source
Douglas Anderson <[email protected]>
ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses
Jaegeuk Kim <[email protected]>
f2fs: handle errors of f2fs_get_meta_page_nofail
Johannes Berg <[email protected]>
um: change sigio_spinlock to a mutex
Vasily Gorbik <[email protected]>
s390/startup: avoid save_area_sync overflow
Chao Yu <[email protected]>
f2fs: fix to check segment boundary during SIT page readahead
Chao Yu <[email protected]>
f2fs: fix uninit-value in f2fs_lookup
Zhang Qilong <[email protected]>
f2fs: add trace exit in exception path
Nicholas Piggin <[email protected]>
sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
Nicholas Piggin <[email protected]>
powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
Nicholas Piggin <[email protected]>
mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
Oliver O'Halloran <[email protected]>
powerpc/powernv/smp: Fix spurious DBG() warning
Mateusz Nosek <[email protected]>
futex: Fix incorrect should_fail_futex() handling
Sascha Hauer <[email protected]>
ata: sata_nv: Fix retrieving of active qcs
Alok Prasad <[email protected]>
RDMA/qedr: Fix memory leak in iWARP CM
Amit Cohen <[email protected]>
mlxsw: core: Fix use-after-free in mlxsw_emad_trans_finish()
Jiri Slaby <[email protected]>
x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels
Sudeep Holla <[email protected]>
firmware: arm_scmi: Add missing Rx size re-initialisation
Etienne Carriere <[email protected]>
firmware: arm_scmi: Fix ARCH_COLD_RESET
Juergen Gross <[email protected]>
xen/events: block rogue events for some time
Juergen Gross <[email protected]>
xen/events: defer eoi in case of excessive number of events
Juergen Gross <[email protected]>
xen/events: use a common cpu hotplug hook for event channels
Juergen Gross <[email protected]>
xen/events: switch user event channels to lateeoi model
Juergen Gross <[email protected]>
xen/pciback: use lateeoi irq binding
Juergen Gross <[email protected]>
xen/pvcallsback: use lateeoi irq binding
Juergen Gross <[email protected]>
xen/scsiback: use lateeoi irq binding
Juergen Gross <[email protected]>
xen/netback: use lateeoi irq binding
Juergen Gross <[email protected]>
xen/blkback: use lateeoi irq binding
Juergen Gross <[email protected]>
xen/events: add a new "late EOI" evtchn framework
Juergen Gross <[email protected]>
xen/events: fix race in evtchn_fifo_unmask()
Juergen Gross <[email protected]>
xen/events: add a proper barrier to 2-level uevent unmasking
Juergen Gross <[email protected]>
xen/events: avoid removing an event channel while handling it
-------------
Diffstat:
Documentation/admin-guide/kernel-parameters.txt | 8 + Documentation/media/uapi/v4l/colorspaces-defs.rst | 9 +- .../media/uapi/v4l/colorspaces-details.rst | 5 +- Makefile | 4 +- arch/Kconfig | 7 + arch/arc/boot/dts/axc001.dtsi | 2 +- arch/arc/boot/dts/axc003.dtsi | 2 +- arch/arc/boot/dts/axc003_idu.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003_idu.dtsi | 2 +- arch/arc/kernel/perf_event.c | 27 +- arch/arm/Kconfig | 2 + arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 + arch/arm/boot/dts/omap4.dtsi | 2 +- arch/arm/boot/dts/omap443x.dtsi | 10 + arch/arm/boot/dts/s5pv210.dtsi | 163 ++++---- arch/arm/kernel/hw_breakpoint.c | 100 +++-- arch/arm/plat-samsung/Kconfig | 1 + arch/arm64/Kconfig.platforms | 1 + arch/arm64/boot/dts/renesas/ulcb.dtsi | 1 + arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/numa.h | 3 + arch/arm64/kernel/topology.c | 32 +- arch/arm64/kvm/sys_regs.c | 6 +- arch/arm64/mm/numa.c | 6 +- arch/ia64/kernel/Makefile | 2 +- arch/ia64/kernel/kprobes.c | 77 +--- arch/mips/dec/setup.c | 9 +- arch/powerpc/Kconfig | 14 + arch/powerpc/include/asm/drmem.h | 4 +- arch/powerpc/include/asm/mmu_context.h | 2 +- arch/powerpc/kernel/head_32.S | 2 +- arch/powerpc/kernel/rtas.c | 153 ++++++++ arch/powerpc/kernel/sysfs.c | 42 +- arch/powerpc/kernel/traps.c | 2 +- arch/powerpc/kvm/book3s_hv.c | 6 + arch/powerpc/platforms/powermac/sleep.S | 9 +- arch/powerpc/platforms/powernv/opal-elog.c | 33 +- arch/powerpc/platforms/powernv/smp.c | 2 +- arch/powerpc/platforms/pseries/hotplug-memory.c | 43 ++- arch/riscv/include/uapi/asm/auxvec.h | 3 + arch/s390/boot/head.S | 21 +- arch/s390/kernel/time.c | 118 ++++-- arch/sparc/kernel/smp_64.c | 65 +--- arch/um/kernel/sigio.c | 6 +- arch/x86/events/amd/ibs.c | 38 +- arch/x86/events/intel/core.c | 2 +- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kernel/unwind_orc.c | 9 +- drivers/acpi/acpi_dbg.c | 3 + drivers/acpi/acpi_extlog.c | 6 +- drivers/acpi/button.c | 13 +- drivers/acpi/ec.c | 10 +- drivers/acpi/hmat/hmat.c | 3 +- drivers/acpi/numa.c | 2 +- drivers/acpi/video_detect.c | 9 + drivers/ata/sata_nv.c | 2 +- drivers/base/core.c | 4 +- drivers/base/power/runtime.c | 5 +- drivers/block/nbd.c | 2 +- drivers/block/xen-blkback/blkback.c | 22 +- drivers/block/xen-blkback/xenbus.c | 5 +- drivers/bus/fsl-mc/mc-io.c | 7 +- drivers/clk/ti/clockdomain.c | 2 + drivers/cpufreq/acpi-cpufreq.c | 3 +- drivers/cpufreq/sti-cpufreq.c | 6 +- drivers/dma/dma-jz4780.c | 7 +- drivers/extcon/extcon-ptn5150.c | 8 +- drivers/firmware/arm_scmi/base.c | 2 + drivers/firmware/arm_scmi/clock.c | 2 + drivers/firmware/arm_scmi/common.h | 2 + drivers/firmware/arm_scmi/driver.c | 8 + drivers/firmware/arm_scmi/perf.c | 2 + drivers/firmware/arm_scmi/reset.c | 4 +- drivers/firmware/arm_scmi/sensors.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 +- .../drm/amd/amdkfd/kfd_device_queue_manager_v10.c | 5 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- .../amd/display/dc/dcn10/dcn10_stream_encoder.c | 4 +- drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 +- drivers/gpu/drm/amd/display/dc/os_types.h | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 2 +- .../drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 12 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 +- drivers/gpu/drm/i915/i915_drv.h | 6 +- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/hid/wacom_wac.c | 4 +- drivers/hwtracing/coresight/coresight-priv.h | 3 +- drivers/hwtracing/coresight/coresight.c | 62 ++- drivers/i2c/busses/i2c-imx.c | 24 +- drivers/iio/adc/rcar-gyroadc.c | 21 +- drivers/iio/adc/ti-adc0832.c | 11 +- drivers/iio/adc/ti-adc12138.c | 13 +- drivers/iio/gyro/itg3200_buffer.c | 15 +- drivers/iio/light/si1145.c | 19 +- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 1 + drivers/input/serio/hil_mlc.c | 21 +- drivers/input/serio/hp_sdc_mlc.c | 8 +- drivers/leds/leds-bcm6328.c | 2 +- drivers/leds/leds-bcm6358.c | 2 +- drivers/md/md-bitmap.c | 2 +- drivers/md/raid5.c | 4 +- drivers/media/i2c/imx274.c | 8 +- drivers/media/pci/tw5864/tw5864-video.c | 6 + drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 7 + drivers/media/usb/uvc/uvc_ctrl.c | 27 +- drivers/memory/emif.c | 33 +- drivers/message/fusion/mptscsih.c | 13 +- drivers/mmc/host/sdhci-acpi.c | 37 ++ drivers/mmc/host/sdhci-of-esdhc.c | 11 + drivers/mmc/host/sdhci-pci-core.c | 154 ++++++++ drivers/mmc/host/sdhci.c | 6 +- drivers/mmc/host/via-sdmmc.c | 3 + drivers/mtd/ubi/wl.c | 13 + drivers/net/can/flexcan.c | 30 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 + drivers/net/wan/hdlc_fr.c | 98 ++--- drivers/net/wireless/ath/ath10k/htt_rx.c | 8 +- drivers/net/wireless/ath/ath10k/sdio.c | 4 + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 10 +- drivers/net/xen-netback/common.h | 15 + drivers/net/xen-netback/interface.c | 61 ++- drivers/net/xen-netback/netback.c | 11 +- drivers/net/xen-netback/rx.c | 13 +- drivers/nvme/host/rdma.c | 1 - drivers/pci/pci-acpi.c | 10 + drivers/power/supply/bq27xxx_battery.c | 6 +- drivers/power/supply/test_power.c | 6 + drivers/rpmsg/qcom_glink_native.c | 6 +- drivers/rtc/rtc-rx8010.c | 24 +- drivers/scsi/qla2xxx/qla_target.c | 13 +- drivers/spi/spi-sprd.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas.c | 1 + drivers/staging/fieldbus/anybuss/arcx-anybus.c | 2 +- drivers/staging/octeon/ethernet-mdio.c | 6 - drivers/staging/octeon/ethernet-rx.c | 34 +- drivers/staging/octeon/ethernet.c | 9 + drivers/tty/vt/keyboard.c | 39 +- drivers/tty/vt/vt_ioctl.c | 32 +- drivers/uio/uio.c | 4 +- drivers/usb/class/cdc-acm.c | 12 +- drivers/usb/class/cdc-acm.h | 3 +- drivers/usb/dwc3/core.c | 15 +- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/dwc3-pci.c | 3 +- drivers/usb/dwc3/ep0.c | 27 +- drivers/usb/dwc3/gadget.c | 60 ++- drivers/usb/dwc3/gadget.h | 1 + drivers/usb/host/fsl-mph-dr-of.c | 9 +- drivers/usb/host/xhci-pci.c | 17 + drivers/usb/host/xhci.c | 7 +- drivers/usb/host/xhci.h | 1 + drivers/usb/misc/adutux.c | 1 + drivers/usb/typec/tcpm/tcpm.c | 8 +- drivers/vhost/vringh.c | 9 +- drivers/video/fbdev/pvr2fb.c | 2 + drivers/w1/masters/mxc_w1.c | 14 +- drivers/watchdog/rdc321x_wdt.c | 5 +- drivers/xen/events/events_2l.c | 9 +- drivers/xen/events/events_base.c | 422 +++++++++++++++++++-- drivers/xen/events/events_fifo.c | 83 ++-- drivers/xen/events/events_internal.h | 20 +- drivers/xen/evtchn.c | 7 +- drivers/xen/pvcalls-back.c | 76 ++-- drivers/xen/xen-pciback/pci_stub.c | 14 +- drivers/xen/xen-pciback/pciback.h | 12 +- drivers/xen/xen-pciback/pciback_ops.c | 48 ++- drivers/xen/xen-pciback/xenbus.c | 2 +- drivers/xen/xen-scsiback.c | 23 +- fs/9p/vfs_file.c | 4 +- fs/btrfs/ctree.c | 6 + fs/btrfs/ctree.h | 2 + fs/btrfs/delayed-inode.c | 3 +- fs/btrfs/dev-replace.c | 7 +- fs/btrfs/reada.c | 47 +++ fs/btrfs/send.c | 201 ++++++++-- fs/btrfs/tree-checker.c | 35 +- fs/btrfs/tree-log.c | 8 + fs/btrfs/volumes.c | 17 +- fs/btrfs/volumes.h | 1 + fs/buffer.c | 16 - fs/cachefiles/rdwr.c | 3 +- fs/ceph/addr.c | 2 +- fs/cifs/inode.c | 13 +- fs/exec.c | 17 +- fs/ext4/inode.c | 11 +- fs/ext4/resize.c | 4 +- fs/ext4/super.c | 17 + fs/f2fs/checkpoint.c | 10 +- fs/f2fs/dir.c | 8 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/node.c | 2 +- fs/f2fs/segment.c | 12 +- fs/gfs2/incore.h | 1 + fs/gfs2/ops_fstype.c | 40 +- fs/gfs2/super.c | 1 + fs/gfs2/sys.c | 5 +- fs/nfs/namespace.c | 12 +- fs/nfs/nfs4_fs.h | 8 + fs/nfs/nfs4file.c | 3 +- fs/nfs/nfs4proc.c | 90 +++-- fs/nfs/nfs4trace.h | 1 + fs/nfsd/nfsproc.c | 16 + fs/ubifs/debug.c | 1 + fs/ubifs/journal.c | 6 +- fs/ubifs/orphan.c | 2 + fs/ubifs/super.c | 44 ++- fs/ubifs/tnc.c | 3 + fs/ubifs/xattr.c | 2 + fs/udf/super.c | 21 +- fs/xfs/libxfs/xfs_bmap.c | 19 +- fs/xfs/xfs_rtalloc.c | 10 +- include/asm-generic/io.h | 39 +- include/linux/arm-smccc.h | 2 + include/linux/hil_mlc.h | 2 +- include/linux/usb/pd.h | 1 + include/uapi/linux/btrfs_tree.h | 14 + include/uapi/linux/nfs4.h | 3 + include/uapi/linux/videodev2.h | 17 +- include/xen/events.h | 29 +- init/Kconfig | 3 +- kernel/bpf/verifier.c | 4 + kernel/debug/debug_core.c | 22 +- kernel/futex.c | 4 +- kernel/seccomp.c | 38 +- kernel/trace/ring_buffer.c | 8 +- lib/scatterlist.c | 2 +- net/9p/trans_fd.c | 2 +- net/ceph/messenger.c | 5 + net/sunrpc/xprt.c | 6 +- samples/bpf/xdpsock_user.c | 1 + tools/perf/util/print_binary.c | 2 +- .../testing/selftests/bpf/progs/test_sysctl_prog.c | 4 +- tools/testing/selftests/x86/fsgsbase.c | 68 ++++ virt/kvm/arm/psci.c | 2 +- 239 files changed, 2954 insertions(+), 1226 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 31/214 ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses
From: Douglas Anderson <[email protected]>
[ Upstream commit 22c9e58299e5f18274788ce54c03d4fb761e3c5d ]
This is commit fdfeff0f9e3d ("arm64: hw_breakpoint: Handle inexact watchpoint addresses") but ported to arm32, which has the same problem.
This problem was found by Android CTS tests, notably the "watchpoint_imprecise" test [1]. I tested locally against a copycat (simplified) version of the test though.
[1] https://android.googlesource.com/platform/bionic/+/master/tests/sys_ptrace_test.cpp
--- arch/arm/kernel/hw_breakpoint.c | 100 +++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 28 deletions(-)
arch/arm/kernel/hw_breakpoint.c +72 -28
@@ -680,6 +680,40 @@ static void disable_single_step(struct perf_event *bp)arch_install_hw_breakpoint (bp); } +/* +* Arm32 hardware does not always report a watchpoint hit address that matches +* one of the watchpoints set. It can also report an address "near" the +* watchpoint if a single instruction access both watched and unwatched +* addresses. There is no straight-forward way, short of disassembling the +* offending instruction, to map that address back to the watchpoint. This +* function computes the distance of the memory access from the watchpoint as a +* heuristic for the likelyhood that a given access triggered the watchpoint. +* +* See this same function in the arm64 platform code, which has the same +* problem. +* +* The function returns the distance of the address from the bytes watched by +* the watchpoint. In case of an exact match, it returns 0. +*/ +static u32 get_distance_from_watchpoint (unsigned long addr,u32 val, +struct arch_hw_breakpoint_ctrl *ctrl) +{ +u32 wp_low, wp_high; +u32 lens, lene; + + lens =__ffs (ctrl->len); + lene =__fls (ctrl->len); + + wp_low = val + lens; + wp_high = val + lene; +if (addr < wp_low) +return wp_low - addr; +else if (addr > wp_high) +return addr - wp_high; +else +return 0 ; +} +static int watchpoint_fault_on_uaccess (struct pt_regs *regs,struct arch_hw_breakpoint *info) {
@@ -689,23 +723,25 @@ static int watchpoint_fault_on_uaccess(struct pt_regs *regs,static void watchpoint_handler (unsigned long addr,unsigned int fsr,struct pt_regs *regs) { -int i, access; -u32 val, ctrl_reg, alignment_mask; +int i, access, closest_match =0 ; +u32 min_dist =-1 , dist; +u32 val, ctrl_reg;struct perf_event *wp, **slots;struct arch_hw_breakpoint *info;struct arch_hw_breakpoint_ctrl ctrl; slots =this_cpu_ptr (wp_on_reg); +/* +* Find all watchpoints that match the reported address. If no exact +* match is found. Attribute the hit to the closest watchpoint. +*/ +rcu_read_lock ();for (i =0 ; i < core_num_wrps; ++i) { -rcu_read_lock (); - wp = slots[i]; -if (wp ==NULL ) - goto unlock; +continue ; - info =counter_arch_bp (wp);/* * The DFAR is an unknown value on debug architectures prior * to 7.1. Since we only allow a single watchpoint on these
@@ -714,33 +750,31 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,*/ if (debug_arch <ARM_DEBUG_ARCH_V7_1 ) {BUG_ON (i >0 ); + info =counter_arch_bp (wp); info->trigger = wp->attr.bp_addr; }else { -if (info->ctrl.len ==ARM_BREAKPOINT_LEN_8 ) - alignment_mask =0x7 ; -else - alignment_mask =0x3 ; - -/* Check if the watchpoint value matches. */ - val =read_wb_reg (ARM_BASE_WVR + i); -if (val != (addr & ~alignment_mask)) - goto unlock; - -/* Possible match, check the byte address select. */ - ctrl_reg =read_wb_reg (ARM_BASE_WCR + i); -decode_ctrl_reg (ctrl_reg, &ctrl); -if (!((1 << (addr & alignment_mask)) & ctrl.len)) - goto unlock; -/* Check that the access type matches. */ if (debug_exception_updates_fsr ()) { access = (fsr &ARM_FSR_ACCESS_MASK ) ?HW_BREAKPOINT_W :HW_BREAKPOINT_R ;if (!(access &hw_breakpoint_type (wp))) - goto unlock; +continue ; } + val =read_wb_reg (ARM_BASE_WVR + i); + ctrl_reg =read_wb_reg (ARM_BASE_WCR + i); +decode_ctrl_reg (ctrl_reg, &ctrl); + dist =get_distance_from_watchpoint (addr, val, &ctrl); +if (dist < min_dist) { + min_dist = dist; + closest_match = i; + } +/* Is this an exact match? */ +if (dist !=0 ) +continue ; +/* We have a winner. */ + info =counter_arch_bp (wp); info->trigger = addr; }
@@ -762,13 +796,23 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,* we can single-step over the watchpoint trigger. */ if (!is_default_overflow_handler (wp)) - goto unlock; - +continue ; step:enable_single_step (wp,instruction_pointer (regs)); -unlock: -rcu_read_unlock (); } + +if (min_dist >0 && min_dist !=-1 ) { +/* No exact match found. */ + wp = slots[closest_match]; + info =counter_arch_bp (wp); + info->trigger = addr; +pr_debug ("watchpoint fired: address = 0x%x\n" , info->trigger); +perf_bp_event (wp, regs); +if (is_default_overflow_handler (wp)) +enable_single_step (wp,instruction_pointer (regs)); + } + +rcu_read_unlock (); }static void watchpoint_single_step_handler (unsigned long pc)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 43/214 media: tw5864: check status of tw5864_frameinterval_get
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 780d815dcc9b34d93ae69385a8465c38d423ff0f ]
clang static analysis reports this problem
tw5864-video.c:773:32: warning: The left expression of the compound
assignment is an uninitialized value.
The computed value will also be garbage
fintv->stepwise.max.numerator *= std_max_fps;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^stepwise.max is set with frameinterval, which comes from
ret = tw5864_frameinterval_get(input, &frameinterval); fintv->stepwise.step = frameinterval; fintv->stepwise.min = frameinterval; fintv->stepwise.max = frameinterval; fintv->stepwise.max.numerator *= std_max_fps;
When tw5864_frameinterval_get() fails, frameinterval is not set. So check the status and fix another similar problem.
--- drivers/media/pci/tw5864/tw5864-video.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/pci/tw5864/tw5864-video.c +6 -0
@@ -767,6 +767,9 @@ static int tw5864_enum_frameintervals(struct file *file, void *priv, fintv->type =V4L2_FRMIVAL_TYPE_STEPWISE ; ret =tw5864_frameinterval_get (input, &frameinterval); +if (ret) +return ret; + fintv->stepwise.step = frameinterval; fintv->stepwise.min = frameinterval; fintv->stepwise.max = frameinterval;
@@ -785,6 +788,9 @@ static int tw5864_g_parm(struct file *file, void *priv, cp->capability =V4L2_CAP_TIMEPERFRAME ; ret =tw5864_frameinterval_get (input, &cp->timeperframe); +if (ret) +return ret; + cp->timeperframe.numerator *= input->frame_interval; cp->capturemode =0 ; cp->readbuffers =2 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 48/214 printk: reduce LOG_BUF_SHIFT range for H8300
In reply to Greg Kroah-HartmanFrom: John Ogness <[email protected]>
[ Upstream commit 550c10d28d21bd82a8bb48debbb27e6ed53262f6 ]
The .bss section for the h8300 is relatively small. A value of CONFIG_LOG_BUF_SHIFT that is larger than 19 will create a static printk ringbuffer that is too large. Limit the range appropriately for the H8300.
--- init/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
init/Kconfig +2 -1
@@ -594,7 +594,8 @@ config IKHEADERS config LOG_BUF_SHIFT int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" - range 12 25 + range 12 25 if !H8300 + range 12 19 if H8300 default 17 depends on PRINTK help
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 50/214 kgdb: Make "kgdbcon" work properly with "kgdb_earlycon"
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b18b099e04f450cdc77bec72acefcde7042bd1f3 ]
On my system the kernel processes the "kgdb_earlycon" parameter before the "kgdbcon" parameter. When we setup "kgdb_earlycon" we'll end up in kgdb_register_callbacks() and "kgdb_use_con" won't have been set yet so we'll never get around to starting "kgdbcon". Let's remedy this by detecting that the IO module was already registered when setting "kgdb_use_con" and registering the console then.
As part of this, to avoid pre-declaring things, move the handling of the "kgdbcon" further down in the file.
--- kernel/debug/debug_core.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
kernel/debug/debug_core.c +14 -8
@@ -96,14 +96,6 @@ int dbg_switch_cpu;/* Use kdb or gdbserver mode */ int dbg_kdb_mode =1 ; -static int __init opt_kgdb_con (char *str) -{ - kgdb_use_con =1 ; -return 0 ; -} - -early_param ("kgdbcon" , opt_kgdb_con); -module_param (kgdb_use_con, int,0644 );module_param (kgdbreboot, int,0644 );
@@ -876,6 +868,20 @@ static struct console kgdbcons = { .index = -1, }; +static int __init opt_kgdb_con (char *str) +{ + kgdb_use_con =1 ; + +if (kgdb_io_module_registered && !kgdb_con_registered) { +register_console (&kgdbcons); + kgdb_con_registered =1 ; + } + +return 0 ; +} + +early_param ("kgdbcon" , opt_kgdb_con); +#ifdef CONFIG_MAGIC_SYSRQ static void sysrq_handle_dbg (int key) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 53/214 selftests/bpf: Define string const as global for test_sysctl_prog.c
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 6e057fc15a2da4ee03eb1fa6889cf687e690106e ]
When tweaking llvm optimizations, I found that selftest build failed
with the following error:
libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
libbpf: prog 'sysctl_tcp_mem': bad map relo against '.L__const.is_tcp_mem.tcp_mem_name'
in section '.rodata.str1.1'
Error: failed to open BPF object file: Relocation failed
make: *** [/work/net-next/tools/testing/selftests/bpf/test_sysctl_prog.skel.h] Error 255
make: *** Deleting file `/work/net-next/tools/testing/selftests/bpf/test_sysctl_prog.skel.h'
The local string constant "tcp_mem_name" is put into '.rodata.str1.1' section which libbpf cannot handle. Using untweaked upstream llvm, "tcp_mem_name" is completely inlined after loop unrolling.
Commit 7fb5eefd7639 ("selftests/bpf: Fix test_sysctl_loop{1, 2} failure due to clang change") solved a similar problem by defining the string const as a global. Let us do the same here
for test_sysctl_prog.c so it can weather future potential llvm changes.
--- tools/testing/selftests/bpf/progs/test_sysctl_prog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/test_sysctl_prog.c +2 -2
@@ -19,11 +19,11 @@#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif +const char tcp_mem_name[] ="net/ipv4/tcp_mem" ; static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx) { -char tcp_mem_name[] ="net/ipv4/tcp_mem" ;unsigned char i; -char name[64 ]; +char name[sizeof (tcp_mem_name)];int ret;memset (name,0 ,sizeof (name));
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 54/214 samples/bpf: Fix possible deadlock in xdpsock
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 5a2a0dd88f0f267ac5953acd81050ae43a82201f ]
Fix a possible deadlock in the l2fwd application in xdpsock that can occur when there is no space in the Tx ring. There are two ways to get the kernel to consume entries in the Tx ring: calling sendto() to make it send packets and freeing entries from the completion ring, as the kernel will not send a packet if there is no space for it to add a completion entry in the completion ring. The Tx loop in l2fwd only used to call sendto(). This patches adds cleaning the completion ring in that loop.
--- samples/bpf/xdpsock_user.c | 1 + 1 file changed, 1 insertion(+)
samples/bpf/xdpsock_user.c +1 -0
@@ -677,6 +677,7 @@ static void l2fwd(struct xsk_socket_info *xsk, struct pollfd *fds)while (ret != rcvd) {if (ret <0 )exit_with_error (-ret); +complete_tx_l2fwd (xsk, fds);if (xsk_ring_prod__needs_wakeup (&xsk->tx))kick_tx (xsk); ret =xsk_ring_prod__reserve (&xsk->tx, rcvd, &idx_tx);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 55/214 riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
In reply to Greg Kroah-HartmanFrom: Zong Li <[email protected]>
[ Upstream commit b5fca7c55f9fbab5ad732c3bce00f31af6ba5cfa ]
AT_VECTOR_SIZE_ARCH should be defined with the maximum number of NEW_AUX_ENT entries that ARCH_DLINFO can contain, but it wasn't defined for RISC-V at all even though ARCH_DLINFO will contain one NEW_AUX_ENT for the VDSO address.
--- arch/riscv/include/uapi/asm/auxvec.h | 3 +++ 1 file changed, 3 insertions(+)
arch/riscv/include/uapi/asm/auxvec.h +3 -0
@@ -10,4 +10,7 @@/* vDSO location */ #define AT_SYSINFO_EHDR 33 +/* entries in ARCH_DLINFO */ +#define AT_VECTOR_SIZE_ARCH 1 +#endif /* _UAPI_ASM_RISCV_AUXVEC_H */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 56/214 cpufreq: sti-cpufreq: add stih418 support
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit 01a163c52039e9426c7d3d3ab16ca261ad622597 ]
The STiH418 can be controlled the same way as STiH407 & STiH410 regarding cpufreq.
--- drivers/cpufreq/sti-cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/sti-cpufreq.c +4 -2
@@ -141,7 +141,8 @@ static const struct reg_field sti_stih407_dvfs_regfields[DVFS_MAX_REGFIELDS] = {static const struct reg_field *sti_cpufreq_match (void ) {if (of_machine_is_compatible ("st,stih407" ) || -of_machine_is_compatible ("st,stih410" )) +of_machine_is_compatible ("st,stih410" ) || +of_machine_is_compatible ("st,stih418" ))return sti_stih407_dvfs_regfields;return NULL ;
@@ -258,7 +259,8 @@ static int sti_cpufreq_init(void)int ret;if ((!of_machine_is_compatible ("st,stih407" )) && - (!of_machine_is_compatible ("st,stih410" ))) + (!of_machine_is_compatible ("st,stih410" )) && + (!of_machine_is_compatible ("st,stih418" )))return -ENODEV ; ddata.cpu =get_cpu_device (0 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 59/214 coresight: Make sysfs functional on topologies with per core sink
In reply to Greg Kroah-HartmanFrom: Linu Cherian <[email protected]>
[ Upstream commit 6d578258b955fc8888e1bbd9a8fefe7b10065a84 ]
Coresight driver assumes sink is common across all the ETMs, and tries to build a path between ETM and the first enabled sink found using bus based search. This breaks sysFS usage on implementations that has multiple per core sinks in enabled state.
To fix this, coresight_get_enabled_sink API is updated to do a connection based search starting from the given source, instead of bus based search.
With sink selection using sysfs depecrated for perf interface, provision for reset is removed as well in this API.
--- drivers/hwtracing/coresight/coresight-priv.h | 3 +- drivers/hwtracing/coresight/coresight.c | 62 +++++++++----------- 2 files changed, 29 insertions(+), 36 deletions(-)
drivers/hwtracing/coresight/coresight-priv.h +2 -1
@@ -147,7 +147,8 @@ static inline void coresight_write_reg_pair(void __iomem *addr, u64 val,void coresight_disable_path (struct list_head *path);int coresight_enable_path (struct list_head *path,u32 mode,void *sink_data);struct coresight_device *coresight_get_sink (struct list_head *path); -struct coresight_device *coresight_get_enabled_sink (bool reset); +struct coresight_device * +coresight_get_enabled_sink (struct coresight_device *source);struct coresight_device *coresight_get_sink_by_id (u32 id);struct list_head *coresight_build_path (struct coresight_device *csdev,struct coresight_device *sink);
drivers/hwtracing/coresight/coresight.c +27 -35
88 lines not on this page · raw message
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 58/214 uio: free uio id after uio file node is freed
In reply to Greg Kroah-HartmanFrom: Lang Dai <[email protected]>
[ Upstream commit 8fd0e2a6df262539eaa28b0a2364cca10d1dc662 ]
uio_register_device() do two things.
1) get an uio id from a global pool, e.g. the id is <A>
2) create file nodes like /sys/class/uio/uio<A>
uio_unregister_device() do two things.
1) free the uio id <A> and return it to the global pool
2) free the file node /sys/class/uio/uio<A>
There is a situation is that one worker is calling uio_unregister_device(), and another worker is calling uio_register_device().
If the two workers are X and Y, they go as below sequence,
1) X free the uio id <AAA>
2) Y get an uio id <AAA>
3) Y create file node /sys/class/uio/uio<AAA>
4) X free the file note /sys/class/uio/uio<AAA>
Then it will failed at the 3rd step and cause the phenomenon we saw as it is creating a duplicated file node.
Failure reports as follows:
sysfs: cannot create duplicate filename '/class/uio/uio10'
Call Trace: sysfs_do_create_link_sd.isra.2+0x9e/0xb0 sysfs_create_link+0x25/0x40 device_add+0x2c4/0x640 __uio_register_device+0x1c5/0x576 [uio] adf_uio_init_bundle_dev+0x231/0x280 [intel_qat] adf_uio_register+0x1c0/0x340 [intel_qat] adf_dev_start+0x202/0x370 [intel_qat] adf_dev_start_async+0x40/0xa0 [intel_qat] process_one_work+0x14d/0x410 worker_thread+0x4b/0x460 kthread+0x105/0x140 ? process_one_work+0x410/0x410 ? kthread_bind+0x40/0x40 ret_from_fork+0x1f/0x40 Code: 85 c0 48 89 c3 74 12 b9 00 10 00 00 48 89 c2 31 f6 4c 89 ef e8 ec c4 ff ff 4c 89 e2 48 89 de 48 c7 c7 e8 b4 ee b4 e8 6a d4 d7 ff <0f> 0b 48 89 df e8 20 fa f3 ff 5b 41 5c 41 5d 5d c3 66 0f 1f 84 ---[ end trace a7531c1ed5269e84 ]--- c6xxvf b002:00:00.0: Failed to register UIO devices c6xxvf b002:00:00.0: Failed to register UIO devices
--- drivers/uio/uio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/uio/uio.c +2 -2
@@ -1010,8 +1010,6 @@ void uio_unregister_device(struct uio_info *info) idev = info->uio_dev; -uio_free_minor (idev); -mutex_lock (&idev->info_lock);uio_dev_del_attributes (idev);
@@ -1026,6 +1024,8 @@ void uio_unregister_device(struct uio_info *info)device_unregister (&idev->dev); +uio_free_minor (idev); +return ; }EXPORT_SYMBOL_GPL (uio_unregister_device);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 12/214 xen/events: defer eoi in case of excessive number of events
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit e99502f76271d6bc4e374fe368c50c67a1fd3070 upstream.
In case rogue guests are sending events at high frequency it might happen that xen_evtchn_do_upcall() won't stop processing events in dom0. As this is done in irq handling a crash might be the result.
In order to avoid that, delay further inter-domain events after some time in xen_evtchn_do_upcall() by forcing eoi processing into a worker on the same cpu, thus inhibiting new events coming in.
The time after which eoi processing is to be delayed is configurable via a new module parameter "event_loop_timeout" which specifies the maximum event loop time in jiffies (default: 2, the value was chosen after some tests showing that a value of 2 was the lowest with an only slight drop of dom0 network throughput while multiple guests performed an event storm).
How long eoi processing will be delayed can be specified via another parameter "event_eoi_delay" (again in jiffies, default 10, again the value was chosen after testing with different delay values).
This is part of XSA-332.
--- Documentation/admin-guide/kernel-parameters.txt | 8 + drivers/xen/events/events_2l.c | 7 drivers/xen/events/events_base.c | 189 +++++++++++++++++++++++- drivers/xen/events/events_fifo.c | 30 +-- drivers/xen/events/events_internal.h | 14 + 5 files changed, 216 insertions(+), 32 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +8 -0
@@ -5462,6 +5462,14 @@ as generic guest with no PV drivers. Currently support XEN HVM, KVM, HYPER_V and VMWARE guest. + xen.event_eoi_delay= [XEN] + How long to delay EOI handling in case of event + storms (jiffies). Default is 10. + + xen.event_loop_timeout= [XEN] + After which time (jiffies) the event handling loop + should start to delay EOI handling. Default is 2. + xirc2ps_cs= [NET,PCMCIA] Format: <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
drivers/xen/events/events_2l.c +2 -5
@@ -161,7 +161,7 @@ static inline xen_ulong_t active_evtchns* a bitset of words which contain pending event bits. The second * level is a bitset of pending events themselves. */ -static void evtchn_2l_handle_events (unsigned cpu) +static void evtchn_2l_handle_events (unsigned cpu,struct evtchn_loop_ctrl *ctrl) {int irq;xen_ulong_t pending_words;
@@ -242,10 +242,7 @@ static void evtchn_2l_handle_events(unsi/* Process port. */ port = (word_idx *BITS_PER_EVTCHN_WORD ) + bit_idx; - irq =get_evtchn_to_irq (port); - -if (irq !=-1 ) -generic_handle_irq (irq); +handle_irq_for_port (port, ctrl); bit_idx = (bit_idx +1 ) %BITS_PER_EVTCHN_WORD ;
drivers/xen/events/events_base.c +184 -5
289 lines not on this page · raw message
drivers/xen/events/events_fifo.c +11 -19
@@ -275,19 +275,9 @@ static uint32_t clear_linked(volatile evreturn w &EVTCHN_FIFO_LINK_MASK ; } -static void handle_irq_for_port (unsigned port) -{ -int irq; - - irq =get_evtchn_to_irq (port); -if (irq !=-1 ) -generic_handle_irq (irq); -} - -static void consume_one_event (unsigned cpu, +static void consume_one_event (unsigned cpu,struct evtchn_loop_ctrl *ctrl,struct evtchn_fifo_control_block *control_block, -unsigned priority,unsigned long *ready, -bool drop) +unsigned priority,unsigned long *ready) {struct evtchn_fifo_queue *q = &per_cpu (cpu_queue, cpu);uint32_t head;
@@ -320,16 +310,17 @@ static void consume_one_event(unsigned cclear_bit (priority, ready);if (evtchn_fifo_is_pending (port) && !evtchn_fifo_is_masked (port)) { -if (unlikely (drop)) +if (unlikely (!ctrl))pr_warn ("Dropping pending event for port %u\n" , port);else -handle_irq_for_port (port); +handle_irq_for_port (port, ctrl); } q->head[priority] = head; } -static void __evtchn_fifo_handle_events (unsigned cpu,bool drop) +static void __evtchn_fifo_handle_events (unsigned cpu, +struct evtchn_loop_ctrl *ctrl) {struct evtchn_fifo_control_block *control_block;unsigned long ready;
@@ -341,14 +332,15 @@ static void __evtchn_fifo_handle_events(while (ready) { q =find_first_bit (&ready,EVTCHN_FIFO_MAX_QUEUES ); -consume_one_event (cpu, control_block, q, &ready, drop); +consume_one_event (cpu, ctrl, control_block, q, &ready); ready |=xchg (&control_block->ready,0 ); } } -static void evtchn_fifo_handle_events (unsigned cpu) +static void evtchn_fifo_handle_events (unsigned cpu, +struct evtchn_loop_ctrl *ctrl) { -__evtchn_fifo_handle_events (cpu, false); +__evtchn_fifo_handle_events (cpu, ctrl); }static void evtchn_fifo_resume (void )
@@ -416,7 +408,7 @@ static int evtchn_fifo_percpu_init(unsigstatic int evtchn_fifo_percpu_deinit (unsigned int cpu) { -__evtchn_fifo_handle_events (cpu, true); +__evtchn_fifo_handle_events (cpu,NULL );return 0 ; }
drivers/xen/events/events_internal.h +11 -3
@@ -30,11 +30,15 @@ enum xen_irq_type {*/ struct irq_info {struct list_head list; +struct list_head eoi_list;int refcnt;enum xen_irq_type type;/* type */ unsigned irq;unsigned int evtchn;/* event channel */ unsigned short cpu;/* cpu bound */ +unsigned short eoi_cpu;/* EOI must happen on this cpu */ +unsigned int irq_epoch;/* If eoi_cpu valid: irq_epoch of event */ +u64 eoi_time;/* Time in jiffies when to EOI. */ union {unsigned short virq;
@@ -53,6 +57,8 @@ struct irq_info {#define PIRQ_SHAREABLE (1 << 1)#define PIRQ_MSI_GROUP (1 << 2) +struct evtchn_loop_ctrl ; +struct evtchn_ops {unsigned (*max_channels)(void );unsigned (*nr_channels)(void );
@@ -67,7 +73,7 @@ struct evtchn_ops {void (*mask)(unsigned port);void (*unmask)(unsigned port); -void (*handle_events)(unsigned cpu); +void (*handle_events)(unsigned cpu,struct evtchn_loop_ctrl *ctrl);void (*resume)(void );int (*percpu_init)(unsigned int cpu);
@@ -78,6 +84,7 @@ extern const struct evtchn_ops *evtchn_oextern int **evtchn_to_irq;int get_evtchn_to_irq (unsigned int evtchn); +void handle_irq_for_port (evtchn_port_t port,struct evtchn_loop_ctrl *ctrl);struct irq_info *info_for_irq (unsigned irq);unsigned cpu_from_irq (unsigned irq);
@@ -135,9 +142,10 @@ static inline void unmask_evtchn(unsignereturn evtchn_ops->unmask (port); } -static inline void xen_evtchn_handle_events (unsigned cpu) +static inline void xen_evtchn_handle_events (unsigned cpu, +struct evtchn_loop_ctrl *ctrl) { -return evtchn_ops->handle_events (cpu); +return evtchn_ops->handle_events (cpu, ctrl); }static inline void xen_evtchn_resume (void )
Greg Kroah-Hartman
maintainerPATCH 11/214 xen/events: use a common cpu hotplug hook for event channels
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
commit 7beb290caa2adb0a399e735a1e175db9aae0523a upstream.
Today only fifo event channels have a cpu hotplug callback. In order to prepare for more percpu (de)init work move that callback into events_base.c and add percpu_init() and percpu_deinit() hooks to struct evtchn_ops.
This is part of XSA-332.
--- drivers/xen/events/events_base.c | 25 +++++++++++++++++++++ drivers/xen/events/events_fifo.c | 40 ++++++++++++++++------------------- drivers/xen/events/events_internal.h | 3 ++ 3 files changed, 47 insertions(+), 21 deletions(-)
drivers/xen/events/events_base.c +25 -0
@@ -34,6 +34,7 @@#include <linux/irqnr.h> #include <linux/pci.h> #include <linux/spinlock.h> +#include <linux/cpuhotplug.h> #ifdef CONFIG_X86 #include <asm/desc.h>
@@ -1834,6 +1835,26 @@ void xen_callback_vector(void) {}static bool fifo_events = true;module_param (fifo_events, bool,0 ); +static int xen_evtchn_cpu_prepare (unsigned int cpu) +{ +int ret =0 ; + +if (evtchn_ops->percpu_init) + ret = evtchn_ops->percpu_init (cpu); + +return ret; +} + +static int xen_evtchn_cpu_dead (unsigned int cpu) +{ +int ret =0 ; + +if (evtchn_ops->percpu_deinit) + ret = evtchn_ops->percpu_deinit (cpu); + +return ret; +} +void __init xen_init_IRQ (void ) {int ret = -EINVAL ;
@@ -1844,6 +1865,10 @@ void __init xen_init_IRQ(void)if (ret <0 )xen_evtchn_2l_init (); +cpuhp_setup_state_nocalls (CPUHP_XEN_EVTCHN_PREPARE , +"xen/evtchn:prepare" , + xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); + evtchn_to_irq =kcalloc (EVTCHN_ROW (xen_evtchn_max_channels ()),sizeof (*evtchn_to_irq),GFP_KERNEL );BUG_ON (!evtchn_to_irq);
drivers/xen/events/events_fifo.c +19 -21
@@ -385,21 +385,6 @@ static void evtchn_fifo_resume(void) event_array_pages =0 ; } -static const struct evtchn_ops evtchn_ops_fifo = { - .max_channels = evtchn_fifo_max_channels, - .nr_channels = evtchn_fifo_nr_channels, - .setup = evtchn_fifo_setup, - .bind_to_cpu = evtchn_fifo_bind_to_cpu, - .clear_pending = evtchn_fifo_clear_pending, - .set_pending = evtchn_fifo_set_pending, - .is_pending = evtchn_fifo_is_pending, - .test_and_set_mask = evtchn_fifo_test_and_set_mask, - .mask = evtchn_fifo_mask, - .unmask = evtchn_fifo_unmask, - .handle_events = evtchn_fifo_handle_events, - .resume = evtchn_fifo_resume, -}; -static int evtchn_fifo_alloc_control_block (unsigned cpu) {void *control_block =NULL ;
@@ -422,19 +407,36 @@ static int evtchn_fifo_alloc_control_bloreturn ret; } -static int xen_evtchn_cpu_prepare (unsigned int cpu) +static int evtchn_fifo_percpu_init (unsigned int cpu) {if (!per_cpu (cpu_control_block, cpu))return evtchn_fifo_alloc_control_block (cpu);return 0 ; } -static int xen_evtchn_cpu_dead (unsigned int cpu) +static int evtchn_fifo_percpu_deinit (unsigned int cpu) {__evtchn_fifo_handle_events (cpu, true);return 0 ; } +static const struct evtchn_ops evtchn_ops_fifo = { + .max_channels = evtchn_fifo_max_channels, + .nr_channels = evtchn_fifo_nr_channels, + .setup = evtchn_fifo_setup, + .bind_to_cpu = evtchn_fifo_bind_to_cpu, + .clear_pending = evtchn_fifo_clear_pending, + .set_pending = evtchn_fifo_set_pending, + .is_pending = evtchn_fifo_is_pending, + .test_and_set_mask = evtchn_fifo_test_and_set_mask, + .mask = evtchn_fifo_mask, + .unmask = evtchn_fifo_unmask, + .handle_events = evtchn_fifo_handle_events, + .resume = evtchn_fifo_resume, + .percpu_init = evtchn_fifo_percpu_init, + .percpu_deinit = evtchn_fifo_percpu_deinit, +}; +int __init xen_evtchn_fifo_init (void ) {int cpu =smp_processor_id ();
@@ -448,9 +450,5 @@ int __init xen_evtchn_fifo_init(void) evtchn_ops = &evtchn_ops_fifo; -cpuhp_setup_state_nocalls (CPUHP_XEN_EVTCHN_PREPARE , -"xen/evtchn:prepare" , - xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); -return ret; }
drivers/xen/events/events_internal.h +3 -0
@@ -69,6 +69,9 @@ struct evtchn_ops {void (*handle_events)(unsigned cpu);void (*resume)(void ); + +int (*percpu_init)(unsigned int cpu); +int (*percpu_deinit)(unsigned int cpu); };extern const struct evtchn_ops *evtchn_ops;
Greg Kroah-Hartman
maintainerPATCH 60/214 usb: xhci: omit duplicate actions when suspending a runtime suspended host.
In reply to Greg Kroah-HartmanFrom: Peter Chen <[email protected]>
[ Upstream commit 18a367e8947d72dd91b6fc401e88a2952c6363f7 ]
If the xhci-plat.c is the platform driver, after the runtime pm is enabled, the xhci_suspend is called if nothing is connected on the port. When the system goes to suspend, it will call xhci_suspend again if USB wakeup is enabled.
Since the runtime suspend wakeup setting is not always the same as system suspend wakeup setting, eg, at runtime suspend we always need wakeup if the controller is in low power mode; but at system suspend, we may not need wakeup. So, we move the judgement after changing wakeup setting.
[commit message rewording -Mathias]
--- drivers/usb/host/xhci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +5 -2
@@ -982,12 +982,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) xhci->shared_hcd->state != HC_STATE_SUSPENDED)return -EINVAL ; -xhci_dbc_suspend (xhci); -/* Clear root port wake on bits if wakeup not allowed. */ if (!do_wakeup)xhci_disable_port_wake_on_bits (xhci); +if (!HCD_HW_ACCESSIBLE (hcd)) +return 0 ; + +xhci_dbc_suspend (xhci); +/* Don't poll the roothubs on bus suspend. */ xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__);clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 61/214 SUNRPC: Mitigate cond_resched() in xprt_transmit()
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 6f9f17287e78e5049931af2037b15b26d134a32a ]
The original purpose of this expensive call is to prevent a long queue of requests from blocking other work.
The cond_resched() call is unnecessary after just a single send operation.
For longer queues, instead of invoking the kernel scheduler, simply release the transport send lock and return to the RPC scheduler.
--- net/sunrpc/xprt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/xprt.c +4 -2
@@ -1503,10 +1503,13 @@ xprt_transmit(struct rpc_task *task) {struct rpc_rqst *next, *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; -int status; +int counter, status;spin_lock (&xprt->queue_lock); + counter =0 ;while (!list_empty (&xprt->xmit_queue)) { +if (++counter ==20 ) +break ; next =list_first_entry (&xprt->xmit_queue, struct rpc_rqst, rq_xmit);xprt_pin_rqst (next);
@@ -1514,7 +1517,6 @@ xprt_transmit(struct rpc_task *task) status =xprt_request_transmit (next, task);if (status == -EBADMSG && next != req) status =0 ; -cond_resched ();spin_lock (&xprt->queue_lock);xprt_unpin_rqst (next);if (status ==0 ) {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 33/214 power: supply: bq27xxx: report "not charging" on all types
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7bf738ba110722b63e9dc8af760d3fb2aef25593 ]
Commit 6f24ff97e323 ("power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor") and commit d74534c27775 ("power:bq27xxx_battery: Add support for additional bq27xxx family devices") added support for new device types by copying most of the code and adding necessary quirks.
However they did not copy the code in bq27xxx_battery_status() responsible for returning POWER_SUPPLY_STATUS_NOT_CHARGING.
Unify the bq27xxx_battery_status() so for all types when charger is supplied, it will return "not charging" status.
--- drivers/power/supply/bq27xxx_battery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/power/supply/bq27xxx_battery.c +4 -2
@@ -1678,8 +1678,6 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status =POWER_SUPPLY_STATUS_FULL ; else if (di->cache.flags & BQ27000_FLAG_CHGS) status =POWER_SUPPLY_STATUS_CHARGING ; - else if (power_supply_am_i_supplied(di->bat) > 0) - status =POWER_SUPPLY_STATUS_NOT_CHARGING ; else status =POWER_SUPPLY_STATUS_DISCHARGING ; }else {
@@ -1691,6 +1689,10 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status =POWER_SUPPLY_STATUS_CHARGING ; } +if ((status ==POWER_SUPPLY_STATUS_DISCHARGING ) && + (power_supply_am_i_supplied (di->bat) >0 )) + status =POWER_SUPPLY_STATUS_NOT_CHARGING ; + val->intval = status;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 14/214 firmware: arm_scmi: Fix ARCH_COLD_RESET
In reply to Greg Kroah-HartmanFrom: Etienne Carriere <[email protected]>
[ Upstream commit 45b9e04d5ba0b043783dfe2b19bb728e712cb32e ]
The defination for ARCH_COLD_RESET is wrong. Let us fix it according to the SCMI specification.
--- drivers/firmware/arm_scmi/reset.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/firmware/arm_scmi/reset.c +1 -3
@@ -35,9 +35,7 @@ struct scmi_msg_reset_domain_reset {#define EXPLICIT_RESET_ASSERT BIT(1)#define ASYNCHRONOUS_RESET BIT(2)__le32 reset_state; -#define ARCH_RESET_TYPE BIT(31) -#define COLD_RESET_STATE BIT(0) -#define ARCH_COLD_RESET (ARCH_RESET_TYPE | COLD_RESET_STATE) +#define ARCH_COLD_RESET 0 };struct reset_dom_info {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 64/214 xfs: dont free rt blocks when were doing a REMAP bunmapi call
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 8df0fa39bdd86ca81a8d706a6ed9d33cc65ca625 ]
When callers pass XFS_BMAPI_REMAP into xfs_bunmapi, they want the extent to be unmapped from the given file fork without the extent being freed. We do this for non-rt files, but we forgot to do this for realtime files. So far this isn't a big deal since nobody makes a bunmapi call to a rt file with the REMAP flag set, but don't leave a logic bomb.
--- fs/xfs/libxfs/xfs_bmap.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
fs/xfs/libxfs/xfs_bmap.c +12 -7
@@ -4985,20 +4985,25 @@ xfs_bmap_del_extent_real( flags =XFS_ILOG_CORE ;if (whichfork ==XFS_DATA_FORK &&XFS_IS_REALTIME_INODE (ip)) { -xfs_fsblock_t bno;xfs_filblks_t len;xfs_extlen_t mod; - bno =div_u64_rem (del->br_startblock, mp->m_sb.sb_rextsize, - &mod); -ASSERT (mod ==0 ); len =div_u64_rem (del->br_blockcount, mp->m_sb.sb_rextsize, &mod);ASSERT (mod ==0 ); - error =xfs_rtfree_extent (tp, bno, (xfs_extlen_t )len); -if (error) - goto done; +if (!(bflags &XFS_BMAPI_REMAP )) { +xfs_fsblock_t bno; + + bno =div_u64_rem (del->br_startblock, + mp->m_sb.sb_rextsize, &mod); +ASSERT (mod ==0 ); + + error =xfs_rtfree_extent (tp, bno, (xfs_extlen_t )len); +if (error) + goto done; + } + do_fx =0 ; nblks = len * mp->m_sb.sb_rextsize; qfield =XFS_TRANS_DQ_RTBCOUNT ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 65/214 ACPI: Add out of bounds and numa_off protections to pxm_to_node()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 8a3decac087aa897df5af04358c2089e52e70ac4 ]
The function should check the validity of the pxm value before using it to index the pxm_to_node_map[] array.
Whilst hardening this code may be good in general, the main intent here is to enable following patches that use this function to replace acpi_map_pxm_to_node() for non SRAT usecases which should return NO_NUMA_NODE for PXM entries not matching with those in SRAT.
--- drivers/acpi/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa.c +1 -1
@@ -31,7 +31,7 @@ int acpi_numa __initdata;int pxm_to_node (int pxm) { -if (pxm <0 ) +if (pxm <0 || pxm >=MAX_PXM_DOMAINS || numa_off)return NUMA_NO_NODE ;return pxm_to_node_map[pxm]; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 34/214 xfs: fix realtime bitmap/summary file truncation when growing rt volume
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit f4c32e87de7d66074d5612567c5eac7325024428 ]
The realtime bitmap and summary files are regular files that are hidden away from the directory tree. Since they're regular files, inode inactivation will try to purge what it thinks are speculative preallocations beyond the incore size of the file. Unfortunately, xfs_growfs_rt forgets to update the incore size when it resizes the inodes, with the result that inactivating the rt inodes at unmount time will cause their contents to be truncated.
Fix this by updating the incore size when we change the ondisk size as part of updating the superblock. Note that we don't do this when we're allocating blocks to the rt inodes because we actually want those blocks to get purged if the growfs fails.
This fixes corruption complaints from the online rtsummary checker when running xfs/233. Since that test requires rmap, one can also trigger this by growing an rt volume, cycling the mount, and creating rt files.
--- fs/xfs/xfs_rtalloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/xfs/xfs_rtalloc.c +8 -2
@@ -1021,10 +1021,13 @@ xfs_growfs_rt(xfs_ilock (mp->m_rbmip,XFS_ILOCK_EXCL );xfs_trans_ijoin (tp, mp->m_rbmip,XFS_ILOCK_EXCL );/* -* Update the bitmap inode's size. +* Update the bitmap inode's size ondisk and incore. We need +* to update the incore size so that inode inactivation won't +* punch what it thinks are "posteof" blocks. */ mp->m_rbmip->i_d.di_size = nsbp->sb_rbmblocks * nsbp->sb_blocksize; +i_size_write (VFS_I (mp->m_rbmip), mp->m_rbmip->i_d.di_size);xfs_trans_log_inode (tp, mp->m_rbmip,XFS_ILOG_CORE );/* * Get the summary inode into the transaction.
@@ -1032,9 +1035,12 @@ xfs_growfs_rt(xfs_ilock (mp->m_rsumip,XFS_ILOCK_EXCL );xfs_trans_ijoin (tp, mp->m_rsumip,XFS_ILOCK_EXCL );/* -* Update the summary inode's size. +* Update the summary inode's size. We need to update the +* incore size so that inode inactivation won't punch what it +* thinks are "posteof" blocks. */ mp->m_rsumip->i_d.di_size = nmp->m_rsumsize; +i_size_write (VFS_I (mp->m_rsumip), mp->m_rsumip->i_d.di_size);xfs_trans_log_inode (tp, mp->m_rsumip,XFS_ILOG_CORE );/* * Copy summary data from old to new sizes.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 37/214 ath10k: fix VHT NSS calculation when STBC is enabled
In reply to Greg Kroah-HartmanFrom: Sathishkumar Muruganandam <[email protected]>
[ Upstream commit 99f41b8e43b8b4b31262adb8ac3e69088fff1289 ]
When STBC is enabled, NSTS_SU value need to be accounted for VHT NSS calculation for SU case.
Without this fix, 1SS + STBC enabled case was reported wrongly as 2SS in radiotap header on monitor mode capture.
Tested-on: QCA9984 10.4-3.10-00047
--- drivers/net/wireless/ath/ath10k/htt_rx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt_rx.c +7 -1
@@ -949,6 +949,7 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,u8 preamble =0 ;u8 group_id;u32 info1, info2, info3; +u32 stbc, nsts_su; info1 =__le32_to_cpu (rxd->ppdu_start.info1); info2 =__le32_to_cpu (rxd->ppdu_start.info2);
@@ -993,11 +994,16 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,*/ bw = info2 &3 ; sgi = info3 &1 ; + stbc = (info2 >>3 ) &1 ; group_id = (info2 >>4 ) &0x3F ;if (GROUP_ID_IS_SU_MIMO (group_id)) { mcs = (info3 >>4 ) &0x0F ; - nss = ((info2 >>10 ) &0x07 ) +1 ; + nsts_su = ((info2 >>10 ) &0x07 ); +if (stbc) + nss = (nsts_su >>2 ) +1 ; +else + nss = (nsts_su +1 ); }else {/* Hardware doesn't decode VHT-SIG-B into Rx descriptor * so it's impossible to decode MCS. Also since
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 70/214 power: supply: test_power: add missing newlines when printing parameters by sysfs
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit c07fa6c1631333f02750cf59f22b615d768b4d8f ]
When I cat some module parameters by sysfs, it displays as follows. It's better to add a newline for easy reading.
root@syzkaller:~# cd /sys/module/test_power/parameters/ root@syzkaller:/sys/module/test_power/parameters# cat ac_online onroot@syzkaller:/sys/module/test_power/parameters# cat battery_present trueroot@syzkaller:/sys/module/test_power/parameters# cat battery_health goodroot@syzkaller:/sys/module/test_power/parameters# cat battery_status dischargingroot@syzkaller:/sys/module/test_power/parameters# cat battery_technology LIONroot@syzkaller:/sys/module/test_power/parameters# cat usb_online onroot@syzkaller:/sys/module/test_power/parameters#
--- drivers/power/supply/test_power.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/power/supply/test_power.c +6 -0
@@ -341,6 +341,7 @@ static int param_set_ac_online(const char *key, const struct kernel_param *kp)static int param_get_ac_online (char *buffer,const struct kernel_param *kp) {strcpy (buffer,map_get_key (map_ac_online, ac_online,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
@@ -354,6 +355,7 @@ static int param_set_usb_online(const char *key, const struct kernel_param *kp)static int param_get_usb_online (char *buffer,const struct kernel_param *kp) {strcpy (buffer,map_get_key (map_ac_online, usb_online,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
@@ -368,6 +370,7 @@ static int param_set_battery_status(const char *key,static int param_get_battery_status (char *buffer,const struct kernel_param *kp) {strcpy (buffer,map_get_key (map_status, battery_status,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
@@ -382,6 +385,7 @@ static int param_set_battery_health(const char *key,static int param_get_battery_health (char *buffer,const struct kernel_param *kp) {strcpy (buffer,map_get_key (map_health, battery_health,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
@@ -397,6 +401,7 @@ static int param_get_battery_present(char *buffer, const struct kernel_param *kp) {strcpy (buffer,map_get_key (map_present, battery_present,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
@@ -414,6 +419,7 @@ static int param_get_battery_technology(char *buffer, {strcpy (buffer,map_get_key (map_technology, battery_technology,"unknown" )); +strcat (buffer,"\n" );return strlen (buffer); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 39/214 selftests/x86/fsgsbase: Reap a forgotten child
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
[ Upstream commit ab2dd173330a3f07142e68cd65682205036cd00f ]
The ptrace() test forgot to reap its child. Reap it.
--- tools/testing/selftests/x86/fsgsbase.c | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/x86/fsgsbase.c +3 -0
@@ -499,6 +499,9 @@ static void test_ptrace_write_gsbase(void) END:ptrace (PTRACE_CONT , child,NULL ,NULL ); +wait (&status); +if (!WIFEXITED (status)) +printf ("[WARN]\tChild didn't exit cleanly.\n" ); }int main ()
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 72/214 ARC: [dts] fix the errors detected by dtbs_check
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 05b1be68c4d6d76970025e6139bfd735c2256ee5 ]
xxx/arc/boot/dts/axs101.dt.yaml: dw-apb-ictl@e0012000: $nodename:0: \
'dw-apb-ictl@e0012000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
From schema: xxx/interrupt-controller/snps,dw-apb-ictl.yaml
The node name of the interrupt controller must start with "interrupt-controller" instead of "dw-apb-ictl".
--- arch/arc/boot/dts/axc001.dtsi | 2 +- arch/arc/boot/dts/axc003.dtsi | 2 +- arch/arc/boot/dts/axc003_idu.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003.dtsi | 2 +- arch/arc/boot/dts/vdk_axc003_idu.dtsi | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arc/boot/dts/axc001.dtsi +1 -1
@@ -85,7 +85,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003.dtsi +1 -1
@@ -129,7 +129,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003_idu.dtsi +1 -1
@@ -135,7 +135,7 @@ * avoid duplicating the MB dtsi file given that IRQ from * this intc to cpu intc are different for axs101 and axs103 */ - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/vdk_axc003.dtsi +1 -1
@@ -46,7 +46,7 @@ }; - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0xe0012000 0x200 >;
arch/arc/boot/dts/vdk_axc003_idu.dtsi +1 -1
@@ -54,7 +54,7 @@ }; - mb_intc: dw-apb-ictl@e0012000 { + mb_intc: interrupt-controller@e0012000 { #interrupt-cells = <1>; compatible = "snps,dw-apb-ictl"; reg = < 0xe0012000 0x200 >;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 81/214 ext4: Detect already used quota file early
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit e0770e91424f694b461141cbc99adf6b23006b60 ]
When we try to use file already used as a quota file again (for the same or different quota type), strange things can happen. At the very least lockdep annotations may be wrong but also inode flags may be wrongly set / reset. When the file is used for two quota types at once we can even corrupt the file and likely crash the kernel. Catch all these cases by checking whether passed file is already used as quota file and bail early in that case.
This fixes occasional generic/219 failure due to lockdep complaint.
--- fs/ext4/super.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/super.c +5 -0
@@ -5856,6 +5856,11 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,/* Quotafile not on the same filesystem? */ if (path->dentry->d_sb != sb)return -EXDEV ; + +/* Quota already enabled for this file? */ +if (IS_NOQUOTA (d_inode (path->dentry))) +return -EBUSY ; +/* Journaling quota? */ if (EXT4_SB (sb)->s_qf_names[type]) {/* Quotafile not in fs root? */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 84/214 gfs2: add validation checks for size of superblock
In reply to Greg Kroah-HartmanFrom: Anant Thazhemadam <[email protected]>
[ Upstream commit 0ddc5154b24c96f20e94d653b0a814438de6032b ]
In gfs2_check_sb(), no validation checks are performed with regards to the size of the superblock.
syzkaller detected a slab-out-of-bounds bug that was primarily caused because the block size for a superblock was set to zero.
A valid size for a superblock is a power of 2 between 512 and PAGE_SIZE. Performing validation checks and ensuring that the size of the superblock is valid fixes this bug.
--- fs/gfs2/ops_fstype.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
fs/gfs2/ops_fstype.c +11 -7
@@ -169,15 +169,19 @@ static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)return -EINVAL ; } -/* If format numbers match exactly, we're done. */ - -if (sb->sb_fs_format ==GFS2_FORMAT_FS && - sb->sb_multihost_format ==GFS2_FORMAT_MULTI ) -return 0 ; +if (sb->sb_fs_format !=GFS2_FORMAT_FS || + sb->sb_multihost_format !=GFS2_FORMAT_MULTI ) { +fs_warn (sdp,"Unknown on-disk format, unable to mount\n" ); +return -EINVAL ; + } -fs_warn (sdp,"Unknown on-disk format, unable to mount\n" ); +if (sb->sb_bsize <512 || sb->sb_bsize >PAGE_SIZE || + (sb->sb_bsize & (sb->sb_bsize -1 ))) { +pr_warn ("Invalid superblock size\n" ); +return -EINVAL ; + } -return -EINVAL ; +return 0 ; }static void end_bio_io_page (struct bio *bio)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 86/214 arm64: dts: renesas: ulcb: add full-pwr-cycle-in-suspend into eMMC nodes
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit 992d7a8b88c83c05664b649fc54501ce58e19132 ]
Add full-pwr-cycle-in-suspend property to do a graceful shutdown of the eMMC device in system suspend.
--- arch/arm64/boot/dts/renesas/ulcb.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/renesas/ulcb.dtsi +1 -0
@@ -470,6 +470,7 @@ mmc-hs200-1_8v; mmc-hs400-1_8v; non-removable; + full-pwr-cycle-in-suspend; status = "okay"; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 85/214 cifs: handle -EINTR in cifs_setattr
In reply to Greg Kroah-HartmanFrom: Ronnie Sahlberg <[email protected]>
[ Upstream commit c6cc4c5a72505a0ecefc9b413f16bec512f38078 ]
RHBZ: 1848178
Some calls that set attributes, like utimensat(), are not supposed to return -EINTR and thus do not have handlers for this in glibc which causes us to leak -EINTR to the applications which are also unprepared to handle it.
For example tar will break if utimensat() return -EINTR and abort unpacking the archive. Other applications may break too.
To handle this we add checks, and retry, for -EINTR in cifs_setattr()
--- fs/cifs/inode.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/cifs/inode.c +9 -4
@@ -2614,13 +2614,18 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) {struct cifs_sb_info *cifs_sb =CIFS_SB (direntry->d_sb);struct cifs_tcon *pTcon =cifs_sb_master_tcon (cifs_sb); +int rc, retries =0 ; -if (pTcon->unix_ext) -return cifs_setattr_unix (direntry, attrs); - -return cifs_setattr_nounix (direntry, attrs); +do { +if (pTcon->unix_ext) + rc =cifs_setattr_unix (direntry, attrs); +else + rc =cifs_setattr_nounix (direntry, attrs); + retries++; + }while (is_retryable_error (rc) && retries <2 );/* BB: add cifs_setattr_legacy for really old servers */ +return rc; }#if 0
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 87/214 ARM: dts: omap4: Fix sgx clock rate for 4430
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 19d3e9a0bdd57b90175f30390edeb06851f5f9f3 ]
We currently have a different clock rate for droid4 compared to the stock v3.0.8 based Android Linux kernel:
# cat /sys/kernel/debug/clk/dpll_*_m7x2_ck/clk_rate 266666667 307200000 # cat /sys/kernel/debug/clk/l3_gfx_cm:clk:0000:0/clk_rate 307200000
Let's fix this by configuring sgx to use 153.6 MHz instead of 307.2 MHz. Looks like also at least duover needs this change to avoid hangs, so let's apply it for all 4430.
This helps a bit with thermal issues that seem to be related to memory corruption when using sgx. It seems that other driver related issues still remain though.
--- arch/arm/boot/dts/omap4.dtsi | 2 +- arch/arm/boot/dts/omap443x.dtsi | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap4.dtsi +1 -1
@@ -328,7 +328,7 @@ status = "disabled"; }; - target-module@56000000 { + sgx_module: target-module@56000000 { compatible = "ti,sysc-omap4", "ti,sysc"; reg = <0x5600fe00 0x4>, <0x5600fe10 0x4>;
arch/arm/boot/dts/omap443x.dtsi +10 -0
@@ -74,3 +74,13 @@ }; /include/ "omap443x-clocks.dtsi" + +/* + * Use dpll_per for sgx at 153.6MHz like droid4 stock v3.0.8 Android kernel + */ +&sgx_module { + assigned-clocks = <&l3_gfx_clkctrl OMAP4_GPU_CLKCTRL 24>, + <&dpll_per_m7x2_ck>; + assigned-clock-rates = <0>, <153600000>; + assigned-clock-parents = <&dpll_per_m7x2_ck>; +};
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 89/214 ARM: dts: s5pv210: remove DMA controller bus node name to fix dtschema warnings
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ea4e792f3c8931fffec4d700cf6197d84e9f35a6 ]
There is no need to keep DMA controller nodes under AMBA bus node. Remove the "amba" node to fix dtschema warnings like:
amba: $nodename:0: 'amba' does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
--- arch/arm/boot/dts/s5pv210.dtsi | 49 +++++++++++++++------------------- 1 file changed, 21 insertions(+), 28 deletions(-)
arch/arm/boot/dts/s5pv210.dtsi +21 -28
@@ -128,35 +128,28 @@ }; }; - amba { - #address-cells = <1>; - #size-cells = <1>; - compatible = "simple-bus"; - ranges; - - pdma0: dma@e0900000 { - compatible = "arm,pl330", "arm,primecell"; - reg = <0xe0900000 0x1000>; - interrupt-parent = <&vic0>; - interrupts = <19>; - clocks = <&clocks CLK_PDMA0>; - clock-names = "apb_pclk"; - #dma-cells = <1>; - #dma-channels = <8>; - #dma-requests = <32>; - }; + pdma0: dma@e0900000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0xe0900000 0x1000>; + interrupt-parent = <&vic0>; + interrupts = <19>; + clocks = <&clocks CLK_PDMA0>; + clock-names = "apb_pclk"; + #dma-cells = <1>; + #dma-channels = <8>; + #dma-requests = <32>; + }; - pdma1: dma@e0a00000 { - compatible = "arm,pl330", "arm,primecell"; - reg = <0xe0a00000 0x1000>; - interrupt-parent = <&vic0>; - interrupts = <20>; - clocks = <&clocks CLK_PDMA1>; - clock-names = "apb_pclk"; - #dma-cells = <1>; - #dma-channels = <8>; - #dma-requests = <32>; - }; + pdma1: dma@e0a00000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0xe0a00000 0x1000>; + interrupt-parent = <&vic0>; + interrupts = <20>; + clocks = <&clocks CLK_PDMA1>; + clock-names = "apb_pclk"; + #dma-cells = <1>; + #dma-channels = <8>; + #dma-requests = <32>; }; spi0: spi@e1300000 {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 73/214 btrfs: fix replace of seed device
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
[ Upstream commit c6a5d954950c5031444173ad2195efc163afcac9 ]
If you replace a seed device in a sprouted fs, it appears to have successfully replaced the seed device, but if you look closely, it didn't. Here is an example.
$ mkfs.btrfs /dev/sda $ btrfstune -S1 /dev/sda $ mount /dev/sda /btrfs $ btrfs device add /dev/sdb /btrfs $ umount /btrfs $ btrfs device scan --forget $ mount -o device=/dev/sda /dev/sdb /btrfs $ btrfs replace start -f /dev/sda /dev/sdc /btrfs $ echo $? 0
BTRFS info (device sdb): dev_replace from /dev/sda (devid 1) to /dev/sdc started BTRFS info (device sdb): dev_replace from /dev/sda (devid 1) to /dev/sdc finished
$ btrfs fi show Label: none uuid: ab2c88b7-be81-4a7e-9849-c3666e7f9f4f Total devices 2 FS bytes used 256.00KiB devid 1 size 3.00GiB used 520.00MiB path /dev/sdc devid 2 size 3.00GiB used 896.00MiB path /dev/sdb
Label: none uuid: 10bd3202-0415-43af-96a8-d5409f310a7e
Total devices 1 FS bytes used 128.00KiB
devid 1 size 3.00GiB used 536.00MiB path /dev/sda
So as per the replace start command and kernel log replace was successful. Now let's try to clean mount.
$ umount /btrfs $ btrfs device scan --forget
$ mount -o device=/dev/sdc /dev/sdb /btrfs mount: /btrfs: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.
[ 636.157517] BTRFS error (device sdc): failed to read chunk tree: -2 [ 636.180177] BTRFS error (device sdc): open_ctree failed
That's because per dev items it is still looking for the original seed device.
$ btrfs inspect-internal dump-tree -d /dev/sdb
item 0 key (DEV_ITEMS DEV_ITEM 1) itemoff 16185 itemsize 98 devid 1 total_bytes 3221225472 bytes_used 545259520 io_align 4096 io_width 4096 sector_size 4096 type 0 generation 6 start_offset 0 dev_group 0 seek_speed 0 bandwidth 0 uuid 59368f50-9af2-4b17-91da-8a783cc418d4 <--- seed uuid fsid 10bd3202-0415-43af-96a8-d5409f310a7e <--- seed fsid item 1 key (DEV_ITEMS DEV_ITEM 2) itemoff 16087 itemsize 98 devid 2 total_bytes 3221225472 bytes_used 939524096 io_align 4096 io_width 4096 sector_size 4096 type 0 generation 0 start_offset 0 dev_group 0 seek_speed 0 bandwidth 0 uuid 56a0a6bc-4630-4998-8daf-3c3030c4256a <- sprout uuid fsid ab2c88b7-be81-4a7e-9849-c3666e7f9f4f <- sprout fsid
But the replaced target has the following uuid+fsid in its superblock which doesn't match with the expected uuid+fsid in its devitem.
$ btrfs in dump-super /dev/sdc | egrep '^generation|dev_item.uuid|dev_item.fsid|devid' generation 20 dev_item.uuid 59368f50-9af2-4b17-91da-8a783cc418d4 dev_item.fsid ab2c88b7-be81-4a7e-9849-c3666e7f9f4f [match] dev_item.devid 1
So if you provide the original seed device the mount shall be successful. Which so long happening in the test case btrfs/163.
$ btrfs device scan --forget $ mount -o device=/dev/sda /dev/sdb /btrfs
Fix in this patch:
If a seed is not sprouted then there is no replacement of it, because of its read-only filesystem with a read-only device. Similarly, in the case of a sprouted filesystem, the seed device is still read only. So, mark it as you can't replace a seed device, you can only add a new device and then delete the seed device. If replace is attempted then returns -EINVAL.
--- fs/btrfs/dev-replace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/dev-replace.c +1 -1
@@ -190,7 +190,7 @@ static int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,int ret =0 ; *device_out =NULL ; -if (fs_info->fs_devices->seeding) { +if (srcdev->fs_devices->seeding) {btrfs_err (fs_info,"the filesystem is a seed filesystem!" );return -EINVAL ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 91/214 ARM: dts: s5pv210: move PMU node out of clock controller
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit bb98fff84ad1ea321823759edaba573a16fa02bd ]
The Power Management Unit (PMU) is a separate device which has little common with clock controller. Moving it to one level up (from clock controller child to SoC) allows to remove fake simple-bus compatible and dtbs_check warnings like:
clock-controller@e0100000: $nodename:0:
'clock-controller@e0100000' does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
--- arch/arm/boot/dts/s5pv210.dtsi | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
arch/arm/boot/dts/s5pv210.dtsi +5 -8
@@ -92,19 +92,16 @@ }; clocks: clock-controller@e0100000 { - compatible = "samsung,s5pv210-clock", "simple-bus"; + compatible = "samsung,s5pv210-clock"; reg = <0xe0100000 0x10000>; clock-names = "xxti", "xusbxti"; clocks = <&xxti>, <&xusbxti>; #clock-cells = <1>; - #address-cells = <1>; - #size-cells = <1>; - ranges; + }; - pmu_syscon: syscon@e0108000 { - compatible = "samsung-s5pv210-pmu", "syscon"; - reg = <0xe0108000 0x8000>; - }; + pmu_syscon: syscon@e0108000 { + compatible = "samsung-s5pv210-pmu", "syscon"; + reg = <0xe0108000 0x8000>; }; pinctrl0: pinctrl@e0200000 {
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 93/214 nbd: make the config put is called before the notifying the waiter
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
[ Upstream commit 87aac3a80af5cbad93e63250e8a1e19095ba0d30 ]
There has one race case for ceph's rbd-nbd tool. When do mapping it may fail with EBUSY from ioctl(nbd, NBD_DO_IT), but actually the nbd device has already unmaped.
It dues to if just after the wake_up(), the recv_work() is scheduled out and defers calling the nbd_config_put(), though the map process has exited the "nbd->recv_task" is not cleared.
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -787,9 +787,9 @@ static void recv_work(struct work_struct *work)blk_mq_complete_request (blk_mq_rq_from_pdu (cmd)); } +nbd_config_put (nbd);atomic_dec (&config->recv_threads);wake_up (&config->recv_wq); -nbd_config_put (nbd);kfree (args); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 94/214 sgl_alloc_order: fix memory leak
In reply to Greg Kroah-HartmanFrom: Douglas Gilbert <[email protected]>
[ Upstream commit b2a182a40278bc5849730e66bca01a762188ed86 ]
sgl_alloc_order() can fail when 'length' is large on a memory constrained system. When order > 0 it will potentially be making several multi-page allocations with the later ones more likely to fail than the earlier one. So it is important that sgl_alloc_order() frees up any pages it has obtained before returning NULL. In the case when order > 0 it calls the wrong free page function and leaks. In testing the leak was sufficient to bring down my 8 GiB laptop with OOM.
--- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/scatterlist.c +1 -1
@@ -514,7 +514,7 @@ struct scatterlist *sgl_alloc_order(unsigned long long length, elem_len =min_t (u64, length,PAGE_SIZE << order); page =alloc_pages (gfp, order);if (!page) { -sgl_free (sgl); +sgl_free_order (sgl, order);return NULL ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 95/214 nvme-rdma: fix crash when connect rejected
In reply to Greg Kroah-HartmanFrom: Chao Leng <[email protected]>
[ Upstream commit 43efdb8e870ee0f58633fd579aa5b5185bf5d39e ]
A crash can happened when a connect is rejected. The host establishes
the connection after received ConnectReply, and then continues to send the fabrics Connect command. If the controller does not receive the ReadyToUse capsule, host may receive a ConnectReject reply.
Call nvme_rdma_destroy_queue_ib after the host received the RDMA_CM_EVENT_REJECTED event. Then when the fabrics Connect command times out, nvme_rdma_timeout calls nvme_rdma_complete_rq to fail the request. A crash happenes due to use after free in nvme_rdma_complete_rq.
nvme_rdma_destroy_queue_ib is redundant when handling the RDMA_CM_EVENT_REJECTED event as nvme_rdma_destroy_queue_ib is already called in connection failure handler.
--- drivers/nvme/host/rdma.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/host/rdma.c +0 -1
@@ -1679,7 +1679,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,complete (&queue->cm_done);return 0 ;case RDMA_CM_EVENT_REJECTED : -nvme_rdma_destroy_queue_ib (queue); cm_error =nvme_rdma_conn_rejected (queue, ev);break ;case RDMA_CM_EVENT_ROUTE_ERROR :
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 96/214 md/raid5: fix oops during stripe resizing
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
commit b44c018cdf748b96b676ba09fdbc5b34fc443ada upstream.
KoWei reported crash during raid5 reshape:
[ 1032.252932] Oops: 0002 [#1] SMP PTI [...] [ 1032.252943] RIP: 0010:memcpy_erms+0x6/0x10 [...] [ 1032.252947] RSP: 0018:ffffba1ac0c03b78 EFLAGS: 00010286 [ 1032.252949] RAX: 0000784ac0000000 RBX: ffff91bec3d09740 RCX: 0000000000001000 [ 1032.252951] RDX: 0000000000001000 RSI: ffff91be6781c000 RDI: 0000784ac0000000 [ 1032.252953] RBP: ffffba1ac0c03bd8 R08: 0000000000001000 R09: ffffba1ac0c03bf8 [ 1032.252954] R10: 0000000000000000 R11: 0000000000000000 R12: ffffba1ac0c03bf8 [ 1032.252955] R13: 0000000000001000 R14: 0000000000000000 R15: 0000000000000000 [ 1032.252958] FS: 0000000000000000(0000) GS:ffff91becf500000(0000) knlGS:0000000000000000 [ 1032.252959] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1032.252961] CR2: 0000784ac0000000 CR3: 000000031780a002 CR4: 00000000001606e0 [ 1032.252962] Call Trace: [ 1032.252969] ? async_memcpy+0x179/0x1000 [async_memcpy] [ 1032.252977] ? raid5_release_stripe+0x8e/0x110 [raid456] [ 1032.252982] handle_stripe_expansion+0x15a/0x1f0 [raid456] [ 1032.252988] handle_stripe+0x592/0x1270 [raid456] [ 1032.252993] handle_active_stripes.isra.0+0x3cb/0x5a0 [raid456] [ 1032.252999] raid5d+0x35c/0x550 [raid456] [ 1032.253002] ? schedule+0x42/0xb0 [ 1032.253006] ? schedule_timeout+0x10e/0x160 [ 1032.253011] md_thread+0x97/0x160 [ 1032.253015] ? wait_woken+0x80/0x80 [ 1032.253019] kthread+0x104/0x140 [ 1032.253022] ? md_start_sync+0x60/0x60 [ 1032.253024] ? kthread_park+0x90/0x90 [ 1032.253027] ret_from_fork+0x35/0x40
This is because cache_size_mutex was unlocked too early in resize_stripes, which races with grow_one_stripe() that grow_one_stripe() allocates a stripe with wrong pool_size.
Fix this issue by unlocking cache_size_mutex after updating pool_size.
--- drivers/md/raid5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid5.c +2 -2
@@ -2407,8 +2407,6 @@ static int resize_stripes(struct r5conf }else err = -ENOMEM ; -mutex_unlock (&conf->cache_size_mutex); - conf->slab_cache = sc; conf->active_name =1 -conf->active_name;
@@ -2431,6 +2429,8 @@ static int resize_stripes(struct r5confif (!err) conf->pool_size = newsize; +mutex_unlock (&conf->cache_size_mutex); +return err; }
Greg Kroah-Hartman
maintainerPATCH 140/214 usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit d97c78a1908e59a1fdbcbece87cd0440b5d7a1f2 upstream.
According the programming guide (for all DWC3 IPs), when the driver handles ClearFeature(halt) request, it should issue CLEAR_STALL command _after_ the END_TRANSFER command completes. The END_TRANSFER command may take some time to complete. So, delay the ClearFeature(halt) request control status stage and wait for END_TRANSFER command completion interrupt. Only after END_TRANSFER command completes that the driver may issue CLEAR_STALL command.
--- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ep0.c | 16 ++++++++++++++++ drivers/usb/dwc3/gadget.c | 40 ++++++++++++++++++++++++++++++++-------- drivers/usb/dwc3/gadget.h | 1 + 4 files changed, 50 insertions(+), 8 deletions(-)
drivers/usb/dwc3/core.h +1 -0
@@ -700,6 +700,7 @@ struct dwc3_ep {#define DWC3_EP_END_TRANSFER_PENDING BIT(4)#define DWC3_EP_PENDING_REQUEST BIT(5)#define DWC3_EP_DELAY_START BIT(6) +#define DWC3_EP_PENDING_CLEAR_STALL BIT(11)/* This last one is specific to EP0 */ #define DWC3_EP0_DIR_IN BIT(31)
drivers/usb/dwc3/ep0.c +16 -0
@@ -524,6 +524,11 @@ static int dwc3_ep0_handle_endpoint(stru ret =__dwc3_gadget_ep_set_halt (dep, set, true);if (ret)return -EINVAL ; + +/* ClearFeature(Halt) may need delayed status */ +if (!set && (dep->flags &DWC3_EP_END_TRANSFER_PENDING )) +return USB_GADGET_DELAYED_STATUS ; +break ;default :return -EINVAL ;
@@ -1049,6 +1054,17 @@ static void dwc3_ep0_do_control_status(s__dwc3_ep0_do_control_status (dwc, dep); } +void dwc3_ep0_send_delayed_status (struct dwc3 *dwc) +{ +unsigned int direction = !dwc->ep0_expect_in; + +if (dwc->ep0state !=EP0_STATUS_PHASE ) +return ; + + dwc->delayed_status = false; +__dwc3_ep0_do_control_status (dwc, dwc->eps[direction]); +} +static void dwc3_ep0_end_control_data (struct dwc3 *dwc,struct dwc3_ep *dep) {struct dwc3_gadget_ep_cmd_params params;
drivers/usb/dwc3/gadget.c +32 -8
@@ -1719,6 +1719,18 @@ int __dwc3_gadget_ep_set_halt(struct dwcreturn 0 ; } +dwc3_stop_active_transfer (dep, true, true); + +list_for_each_entry_safe (req, tmp, &dep->started_list, list) +dwc3_gadget_move_cancelled_request (req); + +if (dep->flags &DWC3_EP_END_TRANSFER_PENDING ) { + dep->flags |=DWC3_EP_PENDING_CLEAR_STALL ; +return 0 ; + } + +dwc3_gadget_ep_cleanup_cancelled_requests (dep); + ret =dwc3_send_clear_stall_ep_cmd (dep);if (ret) { dev_err(dwc->dev, "failed to clear STALL on %s\n",
@@ -1728,14 +1740,6 @@ int __dwc3_gadget_ep_set_halt(struct dwc dep->flags &= ~(DWC3_EP_STALL |DWC3_EP_WEDGE ); -dwc3_stop_active_transfer (dep, true, true); - -list_for_each_entry_safe (req, tmp, &dep->started_list, list) -dwc3_gadget_move_cancelled_request (req); - -if (!(dep->flags &DWC3_EP_END_TRANSFER_PENDING )) -dwc3_gadget_ep_cleanup_cancelled_requests (dep); -if ((dep->flags &DWC3_EP_DELAY_START ) && !usb_endpoint_xfer_isoc (dep->endpoint.desc))__dwc3_gadget_kick_transfer (dep);
@@ -2767,6 +2771,26 @@ static void dwc3_endpoint_interrupt(stru dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING ; dep->flags &= ~DWC3_EP_TRANSFER_STARTED ;dwc3_gadget_ep_cleanup_cancelled_requests (dep); + +if (dep->flags &DWC3_EP_PENDING_CLEAR_STALL ) { +struct dwc3 *dwc = dep->dwc; + + dep->flags &= ~DWC3_EP_PENDING_CLEAR_STALL ; +if (dwc3_send_clear_stall_ep_cmd (dep)) { +struct usb_ep *ep0 = &dwc->eps[0 ]->endpoint; + +dev_err (dwc->dev,"failed to clear STALL on %s\n" , + dep->name); +if (dwc->delayed_status) +__dwc3_gadget_ep0_set_halt (ep0,1 ); +return ; + } + + dep->flags &= ~(DWC3_EP_STALL |DWC3_EP_WEDGE ); +if (dwc->delayed_status) +dwc3_ep0_send_delayed_status (dwc); + } +if ((dep->flags &DWC3_EP_DELAY_START ) && !usb_endpoint_xfer_isoc (dep->endpoint.desc))__dwc3_gadget_kick_transfer (dep);
drivers/usb/dwc3/gadget.h +1 -0
@@ -111,6 +111,7 @@ int dwc3_gadget_ep0_set_halt(struct usb_int dwc3_gadget_ep0_queue (struct usb_ep *ep,struct usb_request *request,gfp_t gfp_flags);int __dwc3_gadget_ep_set_halt (struct dwc3_ep *dep,int value,int protocol); +void dwc3_ep0_send_delayed_status (struct dwc3 *dwc);/** * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW
Greg Kroah-Hartman
maintainerPATCH 142/214 usb: typec: tcpm: reset hard_reset_count for any disconnect
In reply to Greg Kroah-HartmanFrom: Li Jun <[email protected]>
commit 2d9c6442a9c81f4f8dee678d0b3c183173ab1e2d upstream.
Current tcpm_detach() only reset hard_reset_count if port->attached is true, this may cause this counter clear is missed if the CC disconnect event is generated after tcpm_port_reset() is done by other events, e.g. VBUS off comes first before CC disconect for a power sink, in that case the first tcpm_detach() will only clear port->attached flag but leave hard_reset_count there because tcpm_port_is_disconnected() is still false, then later tcpm_detach() by CC disconnect will directly return due to port->attached is cleared, finally this will result tcpm will not try hard reset or error recovery for later attach.
ChiYuan reported this issue on his platform with below tcpm trace:
After power sink session setup after hard reset 2 times, detach from the power source and then attach:
[ 4848.046358] VBUS off [ 4848.046384] state change SNK_READY -> SNK_UNATTACHED [ 4848.050908] Setting voltage/current limit 0 mV 0 mA [ 4848.050936] polarity 0 [ 4848.052593] Requesting mux state 0, usb-role 0, orientation 0 [ 4848.053222] Start toggling [ 4848.086500] state change SNK_UNATTACHED -> TOGGLING [ 4848.089983] CC1: 0 -> 0, CC2: 3 -> 3 [state TOGGLING, polarity 0, connected] [ 4848.089993] state change TOGGLING -> SNK_ATTACH_WAIT [ 4848.090031] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @200 ms [ 4848.141162] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_ATTACH_WAIT, polarity 0, disconnected] [ 4848.141170] state change SNK_ATTACH_WAIT -> SNK_ATTACH_WAIT [ 4848.141184] pending state change SNK_ATTACH_WAIT -> SNK_UNATTACHED @20 ms [ 4848.163156] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [delayed 20 ms] [ 4848.163162] Start toggling [ 4848.216918] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] [ 4848.216954] state change TOGGLING -> SNK_ATTACH_WAIT [ 4848.217080] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @200 ms [ 4848.231771] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_ATTACH_WAIT, polarity 0, disconnected] [ 4848.231800] state change SNK_ATTACH_WAIT -> SNK_ATTACH_WAIT [ 4848.231857] pending state change SNK_ATTACH_WAIT -> SNK_UNATTACHED @20 ms [ 4848.256022] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [delayed20 ms] [ 4848.256049] Start toggling [ 4848.871148] VBUS on [ 4848.885324] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] [ 4848.885372] state change TOGGLING -> SNK_ATTACH_WAIT [ 4848.885548] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @200 ms [ 4849.088240] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed200 ms] [ 4849.088284] state change SNK_DEBOUNCED -> SNK_ATTACHED [ 4849.088291] polarity 1 [ 4849.088769] Requesting mux state 1, usb-role 2, orientation 2 [ 4849.088895] state change SNK_ATTACHED -> SNK_STARTUP [ 4849.088907] state change SNK_STARTUP -> SNK_DISCOVERY [ 4849.088915] Setting voltage/current limit 5000 mV 0 mA [ 4849.088927] vbus=0 charge:=1 [ 4849.090505] state change SNK_DISCOVERY -> SNK_WAIT_CAPABILITIES [ 4849.090828] pending state change SNK_WAIT_CAPABILITIES -> SNK_READY @240 ms [ 4849.335878] state change SNK_WAIT_CAPABILITIES -> SNK_READY [delayed240 ms]
this patch fix this issue by clear hard_reset_count at any cases of cc disconnect, í.e. don't check port->attached flag.
--- drivers/usb/typec/tcpm/tcpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +3 -3
@@ -2723,12 +2723,12 @@ static void tcpm_reset_port(struct tcpm_static void tcpm_detach (struct tcpm_port *port) { -if (!port->attached) -return ; -if (tcpm_port_is_disconnected (port)) port->hard_reset_count =0 ; +if (!port->attached) +return ; +tcpm_reset_port (port); }
Greg Kroah-Hartman
maintainerPATCH 143/214 usb: host: fsl-mph-dr-of: check return of dma_set_mask()
In reply to Greg Kroah-HartmanFrom: Ran Wang <[email protected]>
commit 3cd54a618834430a26a648d880dd83d740f2ae30 upstream.
fsl_usb2_device_register() should stop init if dma_set_mask() return error.
--- drivers/usb/host/fsl-mph-dr-of.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/host/fsl-mph-dr-of.c +6 -3
@@ -94,10 +94,13 @@ static struct platform_device *fsl_usb2_ pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask; -if (!pdev->dev.dma_mask) +if (!pdev->dev.dma_mask) { pdev->dev.dma_mask = &ofdev->dev.coherent_dma_mask; -else -dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); + }else { + retval =dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); +if (retval) + goto error; + } retval =platform_device_add_data (pdev, pdata,sizeof (*pdata));if (retval)
Greg Kroah-Hartman
maintainerPATCH 115/214 ACPI: EC: PM: Flush EC work unconditionally after wakeup
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 5e92442bb4121562231e6daf8a2d1306cb5f8805 upstream.
Commit 607b9df63057 ("ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive") has been reported to cause some power button wakeup events to be missed on some systems, so modify acpi_ec_dispatch_gpe() to call acpi_ec_flush_work() unconditionally to effectively reverse the changes made by that commit.
Also note that the problem which prompted commit 607b9df63057 is not reproducible any more on the affected machine.
--- drivers/acpi/ec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/ec.c +3 -4
@@ -1976,12 +1976,11 @@ bool acpi_ec_dispatch_gpe(void)* to allow the caller to process events properly after that. */ ret =acpi_dispatch_gpe (NULL , first_ec->gpe); -if (ret ==ACPI_INTERRUPT_HANDLED ) { +if (ret ==ACPI_INTERRUPT_HANDLED )pm_pr_dbg ("EC GPE dispatched\n" ); -/* Flush the event and query workqueues. */ -acpi_ec_flush_work (); - } +/* Flush the event and query workqueues. */ +acpi_ec_flush_work ();return false; }
Greg Kroah-Hartman
maintainerPATCH 141/214 usb: cdc-acm: fix cooldown mechanism
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
commit 38203b8385bf6283537162bde7d499f830964711 upstream.
Commit a4e7279cd1d1 ("cdc-acm: introduce a cool down") is causing regression if there is some USB error, such as -EPROTO.
This has been reported on some samples of the Odroid-N2 using the Combee II Zibgee USB dongle.
Quoted 1 line
struct acm *acm =
container_of(work, struct acm, work)
is incorrect in case of a delayed work and causes warnings, usually from the workqueue:
Quoted 1 line
WARNING: CPU: 0 PID: 0 at kernel/workqueue.c:1474 __queue_work+0x480/0x528.
When this happens, USB eventually stops working completely after a while. Also the ACM_ERROR_DELAY bit is never set, so the cooldown mechanism previously introduced cannot be triggered and acm_submit_read_urb() is never called.
This changes makes the cdc-acm driver use a single delayed work, fixing the pointer arithmetic in acm_softint() and set the ACM_ERROR_DELAY when the cooldown mechanism appear to be needed.
--- drivers/usb/class/cdc-acm.c | 12 +++++------- drivers/usb/class/cdc-acm.h | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/usb/class/cdc-acm.c +5 -7
@@ -507,6 +507,7 @@ static void acm_read_bulk_callback(struc "%s - cooling babbling device\n", __func__);usb_mark_last_busy (acm->dev);set_bit (rb->index, &acm->urbs_in_error_delay); +set_bit (ACM_ERROR_DELAY , &acm->flags); cooldown = true;break ;default :
@@ -532,7 +533,7 @@ static void acm_read_bulk_callback(strucif (stopped || stalled || cooldown) {if (stalled) -schedule_work (&acm->work); +schedule_delayed_work (&acm->dwork,0 );else if (cooldown)schedule_delayed_work (&acm->dwork,HZ /2 );return ;
@@ -562,13 +563,13 @@ static void acm_write_bulk(struct urb *uacm_write_done (acm, wb);spin_unlock_irqrestore (&acm->write_lock, flags);set_bit (EVENT_TTY_WAKEUP , &acm->flags); -schedule_work (&acm->work); +schedule_delayed_work (&acm->dwork,0 ); }static void acm_softint (struct work_struct *work) {int i; - struct acm *acm = container_of(work, struct acm, work); + struct acm *acm = container_of(work, struct acm, dwork.work);if (test_bit (EVENT_RX_STALL , &acm->flags)) {smp_mb ();/* against acm_suspend() */
@@ -584,7 +585,7 @@ static void acm_softint(struct work_struif (test_and_clear_bit (ACM_ERROR_DELAY , &acm->flags)) {for (i =0 ; i < acm->rx_buflimit; i++)if (test_and_clear_bit (i, &acm->urbs_in_error_delay)) -acm_submit_read_urb (acm, i,GFP_NOIO ); +acm_submit_read_urb (acm, i,GFP_KERNEL ); }if (test_and_clear_bit (EVENT_TTY_WAKEUP , &acm->flags))
@@ -1364,7 +1365,6 @@ made_compressed_probe: acm->ctrlsize = ctrlsize; acm->readsize = readsize; acm->rx_buflimit = num_rx_buf; -INIT_WORK (&acm->work, acm_softint);INIT_DELAYED_WORK (&acm->dwork, acm_softint);init_waitqueue_head (&acm->wioctl);spin_lock_init (&acm->write_lock);
@@ -1574,7 +1574,6 @@ static void acm_disconnect(struct usb_in }acm_kill_urbs (acm); -cancel_work_sync (&acm->work);cancel_delayed_work_sync (&acm->dwork);tty_unregister_device (acm_tty_driver, acm->minor);
@@ -1617,7 +1616,6 @@ static int acm_suspend(struct usb_interfreturn 0 ;acm_kill_urbs (acm); -cancel_work_sync (&acm->work);cancel_delayed_work_sync (&acm->dwork); acm->urbs_in_error_delay =0 ;
drivers/usb/class/cdc-acm.h +1 -2
@@ -112,8 +112,7 @@ struct acm {# define ACM_ERROR_DELAY 3unsigned long urbs_in_error_delay;/* these need to be restarted after a delay */ struct usb_cdc_line_coding line;/* bits, stop, parity */ -struct work_struct work;/* work queue entry for various purposes*/ -struct delayed_work dwork;/* for cool downs needed in error recovery */ +struct delayed_work dwork;/* work queue entry for various purposes */ unsigned int ctrlin;/* input control lines (DCD, DSR, RI, break, overruns) */ unsigned int ctrlout;/* output control lines (DTR, RTS) */ struct async_icount iocount;/* counters for control line changes */
Greg Kroah-Hartman
maintainerPATCH 147/214 HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery
In reply to Greg Kroah-HartmanFrom: Jason Gerecke <[email protected]>
commit d9216d753b2b1406b801243b12aaf00a5ce5b861 upstream.
It has recently been reported that the "heartbeat" report from devices like the 2nd-gen Intuos Pro (PTH-460, PTH-660, PTH-860) or the 2nd-gen Bluetooth-enabled Intuos tablets (CTL-4100WL, CTL-6100WL) can cause the driver to send a spurious BTN_TOUCH=0 once per second in the middle of drawing. This can result in broken lines while drawing on Chrome OS.
The source of the issue has been traced back to a change which modified the driver to only call wacom_wac_pad_report() once per report instead of once per collection. As part of this change, pad-handling code was removed from wacom_wac_collection() under the assumption that the WACOM_PEN_FIELD and WACOM_TOUCH_FIELD checks would not be satisfied when a pad or battery collection was being processed.
To be clear, the macros WACOM_PAD_FIELD and WACOM_PEN_FIELD do not currently check exclusive conditions. In fact, most "pad" fields will also appear to be "pen" fields simply due to their presence inside of a Digitizer application collection. Because of this, the removal of the check from wacom_wac_collection() just causes pad / battery collections to instead trigger a call to wacom_wac_pen_report() instead. The pen report function in turn resets the tip switch state just prior to exiting, resulting in the observed BTN_TOUCH=0 symptom.
To correct this, we restore a version of the WACOM_PAD_FIELD check in wacom_wac_collection() and return early. This effectively prevents pad / battery collections from being reported until the very end of the report as originally intended.
--- drivers/hid/wacom_wac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/wacom_wac.c +3 -1
@@ -2773,7 +2773,9 @@ static int wacom_wac_collection(struct hif (report->type !=HID_INPUT_REPORT )return -1 ; -if (WACOM_PEN_FIELD (field) && wacom->wacom_wac.pen_input) +if (WACOM_PAD_FIELD (field)) +return 0 ; +else if (WACOM_PEN_FIELD (field) && wacom->wacom_wac.pen_input)wacom_wac_pen_report (hdev, report);else if (WACOM_FINGER_FIELD (field) && wacom->wacom_wac.touch_input)wacom_wac_finger_report (hdev, report);
Greg Kroah-Hartman
maintainerPATCH 149/214 dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit baf6fd97b16ea8f981b8a8b04039596f32fc2972 upstream.
The jz4780_dma_tx_status() function would check if a channel's cookie state was set to 'completed', and if not, it would enter the critical section. However, in that time frame, the jz4780_dma_chan_irq() function was able to set the cookie to 'completed', and clear the jzchan->vchan pointer, which was deferenced in the critical section of the first function.
Fix this race by checking the channel's cookie state after entering the critical function and not before.
--- drivers/dma/dma-jz4780.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/dma/dma-jz4780.c +4 -3
@@ -639,11 +639,11 @@ static enum dma_status jz4780_dma_tx_staunsigned long flags;unsigned long residue =0 ; +spin_lock_irqsave (&jzchan->vchan.lock, flags); + status =dma_cookie_status (chan, cookie, txstate);if ((status ==DMA_COMPLETE ) || (txstate ==NULL )) -return status; - -spin_lock_irqsave (&jzchan->vchan.lock, flags); + goto out_unlock_irqrestore; vdesc =vchan_find_desc (&jzchan->vchan, cookie);if (vdesc) {
@@ -660,6 +660,7 @@ static enum dma_status jz4780_dma_tx_sta && jzchan->desc->status & (JZ_DMA_DCS_AR | JZ_DMA_DCS_HLT)) status =DMA_ERROR ; +out_unlock_irqrestore:spin_unlock_irqrestore (&jzchan->vchan.lock, flags);return status; }
Greg Kroah-Hartman
maintainerPATCH 150/214 iio:light:si1145: Fix timestamp alignment and prevent data leak.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 0456ecf34d466261970e0ff92b2b9c78a4908637 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses a 24 byte array of smaller elements on the stack. As Lars also noted this anti pattern can involve a leak of data to userspace and that indeed can happen here. We close both issues by moving to a suitable array in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak appart from previous readings.
Depending on the enabled channels, the location of the timestamp can be at various aligned offsets through the buffer. As such we any use of a structure to enforce this alignment would incorrectly suggest a single location for the timestamp. Comments adjusted to express this clearly in the code.
--- drivers/iio/light/si1145.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/iio/light/si1145.c +11 -8
@@ -169,6 +169,7 @@ struct si1145_part_info {* @part_info: Part information * @trig: Pointer to iio trigger * @meas_rate: Value of MEAS_RATE register. Only set in HW in auto mode +* @buffer: Used to pack data read from sensor. */ struct si1145_data {struct i2c_client *client;
@@ -180,6 +181,14 @@ struct si1145_data {bool autonomous;struct iio_trigger *trig;int meas_rate; +/* +* Ensure timestamp will be naturally aligned if present. +* Maximum buffer size (may be only partly used if not all +* channels are enabled): +* 6*2 bytes channels data + 4 bytes alignment + +* 8 bytes timestamp +*/ +u8 buffer[24 ]__aligned(8) ; };/**
@@ -441,12 +450,6 @@ static irqreturn_t si1145_trigger_handlestruct iio_poll_func *pf = private;struct iio_dev *indio_dev = pf->indio_dev;struct si1145_data *data =iio_priv (indio_dev); -/* -* Maximum buffer size: -* 6*2 bytes channels data + 4 bytes alignment + -* 8 bytes timestamp -*/ -u8 buffer[24 ];int i, j =0 ;int ret;u8 irq_status =0 ;
@@ -479,7 +482,7 @@ static irqreturn_t si1145_trigger_handle ret =i2c_smbus_read_i2c_block_data_or_emulated ( data->client, indio_dev->channels[i].address, -sizeof (u16) * run, &buffer[j]); +sizeof (u16) * run, &data->buffer[j]);if (ret <0 ) goto done; j += run *sizeof (u16);
@@ -494,7 +497,7 @@ static irqreturn_t si1145_trigger_handle goto done; } -iio_push_to_buffers_with_timestamp (indio_dev, buffer, +iio_push_to_buffers_with_timestamp (indio_dev, data->buffer,iio_get_time_ns (indio_dev)); done:
Greg Kroah-Hartman
maintainerPATCH 151/214 iio: adc: gyroadc: fix leak of device node iterator
In reply to Greg Kroah-HartmanFrom: Tobias Jordan <[email protected]>
commit da4410d4078ba4ead9d6f1027d6db77c5a74ecee upstream.
Add missing of_node_put calls when exiting the for_each_child_of_node loop in rcar_gyroadc_parse_subdevs early.
Also add goto-exception handling for the error paths in that loop.
--- drivers/iio/adc/rcar-gyroadc.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/iio/adc/rcar-gyroadc.c +15 -6
@@ -357,7 +357,7 @@ static int rcar_gyroadc_parse_subdevs(st num_channels =ARRAY_SIZE (rcar_gyroadc_iio_channels_3);break ;default : -return -EINVAL ; + goto err_e_inval; }/*
@@ -374,7 +374,7 @@ static int rcar_gyroadc_parse_subdevs(stdev_err (dev,"Failed to get child reg property of ADC \"%pOFn\".\n" , child); -return ret; + goto err_of_node_put; }/* Channel number is too high. */
@@ -382,7 +382,7 @@ static int rcar_gyroadc_parse_subdevs(stdev_err (dev,"Only %i channels supported with %pOFn, but reg = <%i>.\n" , num_channels, child, reg); -return -EINVAL ; + goto err_e_inval; } }
@@ -391,7 +391,7 @@ static int rcar_gyroadc_parse_subdevs(stdev_err (dev,"Channel %i uses different ADC mode than the rest.\n" , reg); -return -EINVAL ; + goto err_e_inval; }/* Channel is valid, grab the regulator. */
@@ -401,7 +401,8 @@ static int rcar_gyroadc_parse_subdevs(stif (IS_ERR (vref)) {dev_dbg (dev,"Channel %i 'vref' supply not connected.\n" , reg); -return PTR_ERR (vref); + ret =PTR_ERR (vref); + goto err_of_node_put; } priv->vref[reg] = vref;
@@ -425,8 +426,10 @@ static int rcar_gyroadc_parse_subdevs(st* attached to the GyroADC at a time, so if we found it, * we can stop parsing here. */ -if (childmode ==RCAR_GYROADC_MODE_SELECT_1_MB88101A ) +if (childmode ==RCAR_GYROADC_MODE_SELECT_1_MB88101A ) { +of_node_put (child);break ; + } }if (first) {
@@ -435,6 +438,12 @@ static int rcar_gyroadc_parse_subdevs(st }return 0 ; + +err_e_inval: + ret = -EINVAL ; +err_of_node_put: +of_node_put (child); +return ret; }static void rcar_gyroadc_deinit_supplies (struct iio_dev *indio_dev)
Greg Kroah-Hartman
maintainerPATCH 116/214 ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit e0e9ce390d7bc6a705653d4a8aa4ea92c9a65e53 upstream.
It turns out that in some cases there are EC events to flush in acpi_ec_dispatch_gpe() even though the ec_no_wakeup kernel parameter is set and the EC GPE is disabled while sleeping, so drop the ec_no_wakeup check that prevents those events from being processed from acpi_ec_dispatch_gpe().
--- drivers/acpi/ec.c | 3 --- 1 file changed, 3 deletions(-)
drivers/acpi/ec.c +0 -3
@@ -1968,9 +1968,6 @@ bool acpi_ec_dispatch_gpe(void)if (acpi_any_gpe_status_set (first_ec->gpe))return true; -if (ec_no_wakeup) -return false; -/* * Dispatch the EC GPE in-band, but do not report wakeup in any case * to allow the caller to process events properly after that.
Greg Kroah-Hartman
maintainerPATCH 153/214 iio:adc:ti-adc12138 Fix alignment issue with timestamp
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 293e809b2e8e608b65a949101aaf7c0bd1224247 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack.
We move to a suitable structure in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak apart from previous readings. Note that previously no leak at all could occur, but previous readings should never be a problem.
In this case the timestamp location depends on what other channels are enabled. As such we can't use a structure without misleading by suggesting only one possible timestamp location.
--- drivers/iio/adc/ti-adc12138.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc12138.c +9 -4
@@ -47,6 +47,12 @@ struct adc12138 {struct completion complete;/* The number of cclk periods for the S/H's acquisition time */ unsigned int acquisition_time; +/* +* Maximum size needed: 16x 2 bytes ADC data + 8 bytes timestamp. +* Less may be need if not all channels are enabled, as long as +* the 8 byte alignment of the timestamp is maintained. +*/ +__be16 data[20 ]__aligned(8) ;u8 tx_buf[2 ]____cacheline_aligned ;u8 rx_buf[2 ];
@@ -329,7 +335,6 @@ static irqreturn_t adc12138_trigger_handstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adc12138 *adc =iio_priv (indio_dev); -__be16 data[20 ] = { };/* 16x 2 bytes ADC data + 8 bytes timestamp */ __be16 trash;int ret;int scan_index;
@@ -345,7 +350,7 @@ static irqreturn_t adc12138_trigger_handreinit_completion (&adc->complete); ret =adc12138_start_and_read_conv (adc, scan_chan, - i ? &data[i -1 ] : &trash); + i ? &adc->data[i -1 ] : &trash);if (ret) {dev_warn (&adc->spi->dev,"failed to start conversion\n" );
@@ -362,7 +367,7 @@ static irqreturn_t adc12138_trigger_hand }if (i) { - ret =adc12138_read_conv_data (adc, &data[i -1 ]); + ret =adc12138_read_conv_data (adc, &adc->data[i -1 ]);if (ret) {dev_warn (&adc->spi->dev,"failed to get conversion data\n" );
@@ -370,7 +375,7 @@ static irqreturn_t adc12138_trigger_hand } } -iio_push_to_buffers_with_timestamp (indio_dev, data, +iio_push_to_buffers_with_timestamp (indio_dev, adc->data,iio_get_time_ns (indio_dev)); out:mutex_unlock (&adc->lock);
Greg Kroah-Hartman
maintainerPATCH 117/214 acpi-cpufreq: Honor _PSD table setting on new AMD CPUs
In reply to Greg Kroah-HartmanFrom: Wei Huang <[email protected]>
commit 5368512abe08a28525d9b24abbfc2a72493e8dba upstream.
acpi-cpufreq has a old quirk that overrides the _PSD table supplied by BIOS on AMD CPUs. However the _PSD table of new AMD CPUs (Family 19h+) now accurately reports the P-state dependency of CPU cores. Hence this quirk needs to be fixed in order to support new CPUs' frequency control.
--- drivers/cpufreq/acpi-cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/acpi-cpufreq.c +2 -1
@@ -688,7 +688,8 @@ static int acpi_cpufreq_cpu_init(structcpumask_copy (policy->cpus,topology_core_cpumask (cpu)); } -if (check_amd_hwpstate_cpu (cpu) && !acpi_pstate_strict) { +if (check_amd_hwpstate_cpu (cpu) && boot_cpu_data.x86 <0x19 && + !acpi_pstate_strict) {cpumask_clear (policy->cpus);cpumask_set_cpu (cpu, policy->cpus); cpumask_copy(data->freqdomain_cpus,
Greg Kroah-Hartman
maintainerPATCH 118/214 w1: mxc_w1: Fix timeout resolution problem leading to bus error
In reply to Greg Kroah-HartmanFrom: Martin Fuzzey <[email protected]>
commit c9723750a699c3bd465493ac2be8992b72ccb105 upstream.
On my platform (i.MX53) bus access sometimes fails with
w1_search: max_slave_count 64 reached, will continue next search.
The reason is the use of jiffies to implement a 200us timeout in mxc_w1_ds2_touch_bit().
On some platforms the jiffies timer resolution is insufficient for this.
Fix by replacing jiffies by ktime_get().
For consistency apply the same change to the other use of jiffies in mxc_w1_ds2_reset_bus().
--- drivers/w1/masters/mxc_w1.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/w1/masters/mxc_w1.c +7 -7
@@ -7,7 +7,7 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/io.h> -#include <linux/jiffies.h> +#include <linux/ktime.h> #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/platform_device.h>
@@ -40,12 +40,12 @@ struct mxc_w1_device {static u8 mxc_w1_ds2_reset_bus (void *data) {struct mxc_w1_device *dev = data; -unsigned long timeout; +ktime_t timeout;writeb (MXC_W1_CONTROL_RPP , dev->regs +MXC_W1_CONTROL );/* Wait for reset sequence 511+512us, use 1500us for sure */ - timeout = jiffies +usecs_to_jiffies (1500 ); + timeout =ktime_add_us (ktime_get (),1500 );udelay (511 +512 );
@@ -55,7 +55,7 @@ static u8 mxc_w1_ds2_reset_bus(void *dat/* PST bit is valid after the RPP bit is self-cleared */ if (!(ctrl &MXC_W1_CONTROL_RPP ))return !(ctrl &MXC_W1_CONTROL_PST ); - }while (time_is_after_jiffies (timeout)); + }while (ktime_before (ktime_get (), timeout));return 1 ; }
@@ -68,12 +68,12 @@ static u8 mxc_w1_ds2_reset_bus(void *datstatic u8 mxc_w1_ds2_touch_bit (void *data,u8 bit) {struct mxc_w1_device *dev = data; -unsigned long timeout; +ktime_t timeout;writeb (MXC_W1_CONTROL_WR (bit), dev->regs +MXC_W1_CONTROL );/* Wait for read/write bit (60us, Max 120us), use 200us for sure */ - timeout = jiffies +usecs_to_jiffies (200 ); + timeout =ktime_add_us (ktime_get (),200 );udelay (60 );
@@ -83,7 +83,7 @@ static u8 mxc_w1_ds2_touch_bit(void *dat/* RDST bit is valid after the WR1/RD bit is self-cleared */ if (!(ctrl &MXC_W1_CONTROL_WR (bit)))return !!(ctrl &MXC_W1_CONTROL_RDST ); - }while (time_is_after_jiffies (timeout)); + }while (ktime_before (ktime_get (), timeout));return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 120/214 scsi: qla2xxx: Fix crash on session cleanup with unload
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 50457dab670f396557e60c07f086358460876353 upstream.
On unload, session cleanup prematurely gave the signal for driver unload path to advance.
--- drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +7 -6
@@ -1230,14 +1230,15 @@ void qlt_schedule_sess_for_deletion(strucase DSC_DELETE_PEND :return ;case DSC_DELETED : -if (tgt && tgt->tgt_stop && (tgt->sess_count ==0 )) -wake_up_all (&tgt->waitQ); -if (sess->vha->fcport_count ==0 ) -wake_up_all (&sess->vha->fcport_waitQ); -if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN ] && - !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT ]) + !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT ]) { +if (tgt && tgt->tgt_stop && tgt->sess_count ==0 ) +wake_up_all (&tgt->waitQ); + +if (sess->vha->fcport_count ==0 ) +wake_up_all (&sess->vha->fcport_waitQ);return ; + }break ;case DSC_UPD_FCPORT :/*
Greg Kroah-Hartman
maintainerPATCH 112/214 ACPI: video: use ACPI backlight for HP 635 Notebook
In reply to Greg Kroah-HartmanFrom: Alex Hung <[email protected]>
commit b226faab4e7890bbbccdf794e8b94276414f9058 upstream.
The default backlight interface is AMD's radeon_bl0 which does not work on this system, so use the ACPI backlight interface on it instead.
--- drivers/acpi/video_detect.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/video_detect.c +9 -0
@@ -282,6 +282,15 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"), }, }, +/* https://bugs.launchpad.net/bugs/1894667 */ + { + .callback = video_detect_force_video, + .ident = "HP 635 Notebook", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Hewlett-Packard" ), + DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"), + }, + }, /* Non win8 machines which need native backlight nevertheless */ {
Greg Kroah-Hartman
maintainerPATCH 155/214 powerpc/drmem: Make lmb_size 64 bit
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit ec72024e35dddb88a81e40071c87ceb18b5ee835 upstream.
Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block panic") make sure different variables tracking lmb_size are updated to be 64 bit.
This was found by code audit.
--- arch/powerpc/include/asm/drmem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/drmem.h +2 -2
@@ -20,7 +20,7 @@ struct drmem_lmb {struct drmem_lmb_info {struct drmem_lmb *lmbs;int n_lmbs; -u32 lmb_size; +u64 lmb_size; };extern struct drmem_lmb_info *drmem_info;
@@ -79,7 +79,7 @@ struct of_drconf_cell_v2 {#define DRCONF_MEM_AI_INVALID 0x00000040#define DRCONF_MEM_RESERVED 0x00000080 -static inline u32 drmem_lmb_size (void ) +static inline u64 drmem_lmb_size (void ) {return drmem_info->lmb_size; }
Greg Kroah-Hartman
maintainerPATCH 164/214 NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE
In reply to Greg Kroah-HartmanFrom: Benjamin Coddington <[email protected]>
commit b4868b44c5628995fdd8ef2e24dda73cef963a75 upstream.
Since commit 0e0cb35b417f ("NFSv4: Handle NFS4ERR_OLD_STATEID in CLOSE/OPEN_DOWNGRADE") the following livelock may occur if a CLOSE races with the update of the nfs_state:
Process 1 Process 2 Server
========= ========= ========
OPEN file
OPEN file
Reply OPEN (1)
Reply OPEN (2)
Update state (1)
CLOSE file (1)
Reply OLD_STATEID (1)
CLOSE file (2)
Reply CLOSE (-1)
Update state (2)
wait for state change
OPEN file
wake
CLOSE file
OPEN file
wake
CLOSE file
...
...We can avoid this situation by not issuing an immediate retry with a bumped seqid when CLOSE/OPEN_DOWNGRADE receives NFS4ERR_OLD_STATEID. Instead, take the same approach used by OPEN and wait at least 5 seconds for outstanding stateid updates to complete if we can detect that we're out of sequence.
Note that after this change it is still possible (though unlikely) that CLOSE waits a full 5 seconds, bumps the seqid, and retries -- and that attempt races with another OPEN at the same time. In order to avoid this race (which would result in the livelock), update nfs_need_update_open_stateid() to handle the case where:
- the state is NFS_OPEN_STATE, and
- the stateid doesn't match the current open stateid
Finally, nfs_need_update_open_stateid() is modified to be idempotent and renamed to better suit the purpose of signaling that the stateid passed is the next stateid in sequence.
--- fs/nfs/nfs4_fs.h | 8 +++++ fs/nfs/nfs4proc.c | 81 ++++++++++++++++++++++++++++++----------------------- fs/nfs/nfs4trace.h | 1 3 files changed, 56 insertions(+), 34 deletions(-)
fs/nfs/nfs4_fs.h +8 -0
@@ -570,6 +570,14 @@ static inline bool nfs4_stateid_is_newerreturn (s32)(be32_to_cpu (s1->seqid) -be32_to_cpu (s2->seqid)) >0 ; } +static inline bool nfs4_stateid_is_next (const nfs4_stateid *s1,const nfs4_stateid *s2) +{ +u32 seq1 =be32_to_cpu (s1->seqid); +u32 seq2 =be32_to_cpu (s2->seqid); + +return seq2 == seq1 +1U || (seq2 ==1U && seq1 ==0xffffffffU ); +} +static inline void nfs4_stateid_seqid_inc (nfs4_stateid *s1) {u32 seqid =be32_to_cpu (s1->seqid);
fs/nfs/nfs4proc.c +47 -34
131 lines not on this page · raw message
fs/nfs/nfs4trace.h +1 -0
@@ -1291,6 +1291,7 @@ DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setDEFINE_NFS4_INODE_STATEID_EVENT (nfs4_delegreturn);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update);DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_open_stateid_update_wait); +DEFINE_NFS4_INODE_STATEID_EVENT (nfs4_close_stateid_update_wait); DECLARE_EVENT_CLASS(nfs4_getattr_event, TP_PROTO(
Greg Kroah-Hartman
maintainerPATCH 165/214 NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
commit 8c39076c276be0b31982e44654e2c2357473258a upstream.
RFC 7862 introduced a new flag that either client or server is allowed to set: EXCHGID4_FLAG_SUPP_FENCE_OPS.
Client needs to update its bitmask to allow for this flag value.
v2: changed minor version argument to unsigned int
--- fs/nfs/nfs4proc.c | 9 ++++++--- include/uapi/linux/nfs4.h | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +6 -3
@@ -7859,9 +7859,11 @@ int nfs4_proc_secinfo(struct inode *dir,* both PNFS and NON_PNFS flags set, and not having one of NON_PNFS, PNFS, or * DS flags set. */ -static int nfs4_check_cl_exchange_flags (u32 flags) +static int nfs4_check_cl_exchange_flags (u32 flags,u32 version) { -if (flags & ~EXCHGID4_FLAG_MASK_R ) +if (version >=2 && (flags & ~EXCHGID4_2_FLAG_MASK_R )) + goto out_inval; +else if (version <2 && (flags & ~EXCHGID4_FLAG_MASK_R )) goto out_inval;if ((flags &EXCHGID4_FLAG_USE_PNFS_MDS ) && (flags &EXCHGID4_FLAG_USE_NON_PNFS ))
@@ -8274,7 +8276,8 @@ static int _nfs4_proc_exchange_id(structif (status !=0 ) goto out; - status =nfs4_check_cl_exchange_flags (resp->flags); + status =nfs4_check_cl_exchange_flags (resp->flags, + clp->cl_mvops->minor_version);if (status !=0 ) goto out;
include/uapi/linux/nfs4.h +3 -0
@@ -136,6 +136,8 @@#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 + +#define EXCHGID4_FLAG_SUPP_FENCE_OPS 0x00000004/* * Since the validity of these bits depends on whether * they're set in the argument or response, have separate
@@ -143,6 +145,7 @@*/ #define EXCHGID4_FLAG_MASK_A 0x40070103#define EXCHGID4_FLAG_MASK_R 0x80070103 +#define EXCHGID4_2_FLAG_MASK_R 0x80070107#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
Greg Kroah-Hartman
maintainerPATCH 166/214 NFSD: Add missing NFSv2 .pc_func methods
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit 6b3dccd48de8a4c650b01499a0b09d1e2279649e upstream.
There's no protection in nfsd_dispatch() against a NULL .pc_func helpers. A malicious NFS client can trigger a crash by invoking the unused/unsupported NFSv2 ROOT or WRITECACHE procedures.
The current NFSD dispatcher does not support returning a void reply to a non-NULL procedure, so the reply to both of these is wrong, for the moment.
--- fs/nfsd/nfsproc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/nfsd/nfsproc.c +16 -0
@@ -118,6 +118,13 @@ done:return nfsd_return_attrs (nfserr, resp); } +/* Obsolete, replaced by MNTPROC_MNT. */ +static __be32 +nfsd_proc_root (struct svc_rqst *rqstp) +{ +return nfs_ok; +} +/* * Look up a path name component * Note: the dentry in the resp->fh may be negative if the file
@@ -203,6 +210,13 @@ nfsd_proc_read(struct svc_rqst *rqstp)return fh_getattr (&resp->fh, &resp->stat); } +/* Reserved */ +static __be32 +nfsd_proc_writecache (struct svc_rqst *rqstp) +{ +return nfs_ok; +} +/* * Write data to a file * N.B. After this call resp->fh needs an fh_put
@@ -617,6 +631,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT, }, [NFSPROC_ROOT] = { + .pc_func = nfsd_proc_root, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void),
@@ -654,6 +669,7 @@ static const struct svc_procedure nfsd_p .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4, }, [NFSPROC_WRITECACHE] = { + .pc_func = nfsd_proc_writecache, .pc_decode = nfssvc_decode_void, .pc_encode = nfssvc_encode_void, .pc_argsize = sizeof(struct nfsd_void),
Greg Kroah-Hartman
maintainerPATCH 167/214 ubifs: dent: Fix some potential memory leaks while iterating entries
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 58f6e78a65f1fcbf732f60a7478ccc99873ff3ba upstream.
Fix some potential memory leaks in error handling branches while iterating dent entries. For example, function dbg_check_dir() forgets to free pdent if it exists.
--- fs/ubifs/debug.c | 1 + 1 file changed, 1 insertion(+)
fs/ubifs/debug.c +1 -0
@@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, err =PTR_ERR (dent);if (err == -ENOENT )break ; +kfree (pdent);return err; }
Greg Kroah-Hartman
maintainerPATCH 168/214 ubifs: xattr: Fix some potential memory leaks while iterating entries
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit f2aae745b82c842221f4f233051f9ac641790959 upstream.
Fix some potential memory leaks in error handling branches while iterating xattr entries. For example, function ubifs_tnc_remove_ino() forgets to free pxent if it exists. Similar problems also exist in ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode().
--- fs/ubifs/journal.c | 2 ++ fs/ubifs/orphan.c | 2 ++ fs/ubifs/tnc.c | 3 +++ fs/ubifs/xattr.c | 2 ++ 4 files changed, 9 insertions(+)
fs/ubifs/journal.c +2 -0
@@ -894,6 +894,7 @@ int ubifs_jnl_write_inode(struct ubifs_iif (err == -ENOENT )break ; +kfree (pxent); goto out_release; }
@@ -906,6 +907,7 @@ int ubifs_jnl_write_inode(struct ubifs_iubifs_err (c,"dead directory entry '%s', error %d" , xent->name, err);ubifs_ro_mode (c, err); +kfree (pxent);kfree (xent); goto out_release; }
fs/ubifs/orphan.c +2 -0
@@ -173,6 +173,7 @@ int ubifs_add_orphan(struct ubifs_info * err =PTR_ERR (xent);if (err == -ENOENT )break ; +kfree (pxent);return err; }
@@ -182,6 +183,7 @@ int ubifs_add_orphan(struct ubifs_info * xattr_orphan =orphan_add (c, xattr_inum, orphan);if (IS_ERR (xattr_orphan)) { +kfree (pxent);kfree (xent);return PTR_ERR (xattr_orphan); }
fs/ubifs/tnc.c +3 -0
@@ -2885,6 +2885,7 @@ int ubifs_tnc_remove_ino(struct ubifs_in err =PTR_ERR (xent);if (err == -ENOENT )break ; +kfree (pxent);return err; }
@@ -2898,6 +2899,7 @@ int ubifs_tnc_remove_ino(struct ubifs_infname_len (&nm) =le16_to_cpu (xent->nlen); err =ubifs_tnc_remove_nm (c, &key1, &nm);if (err) { +kfree (pxent);kfree (xent);return err; }
@@ -2906,6 +2908,7 @@ int ubifs_tnc_remove_ino(struct ubifs_inhighest_ino_key (c, &key2, xattr_inum); err =ubifs_tnc_remove_range (c, &key1, &key2);if (err) { +kfree (pxent);kfree (xent);return err; }
fs/ubifs/xattr.c +2 -0
@@ -522,6 +522,7 @@ int ubifs_purge_xattrs(struct inode *hos xent->name, err);ubifs_ro_mode (c, err);kfree (pxent); +kfree (xent);return err; }
@@ -531,6 +532,7 @@ int ubifs_purge_xattrs(struct inode *hos err =remove_xattr (c, host, xino, &nm);if (err) {kfree (pxent); +kfree (xent);iput (xino);ubifs_err (c,"cannot remove xattr, error %d" , err);return err;
Greg Kroah-Hartman
maintainerPATCH 171/214 ubifs: Dont parse authentication mount options in remount process
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit bb674a4d4de1032837fcbf860a63939e66f0b7ad upstream.
There is no need to dump authentication options while remounting, because authentication initialization can only be doing once in the first mount process. Dumping authentication mount options in remount process may cause memory leak if UBIFS has already been mounted with old authentication mount options.
--- fs/ubifs/super.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
fs/ubifs/super.c +12 -6
@@ -1092,14 +1092,20 @@ static int ubifs_parse_options(struct ubbreak ; }case Opt_auth_key: - c->auth_key_name =kstrdup (args[0 ].from,GFP_KERNEL ); -if (!c->auth_key_name) -return -ENOMEM ; +if (!is_remount) { + c->auth_key_name =kstrdup (args[0 ].from, +GFP_KERNEL ); +if (!c->auth_key_name) +return -ENOMEM ; + }break ;case Opt_auth_hash_name: - c->auth_hash_name =kstrdup (args[0 ].from,GFP_KERNEL ); -if (!c->auth_hash_name) -return -ENOMEM ; +if (!is_remount) { + c->auth_hash_name =kstrdup (args[0 ].from, +GFP_KERNEL ); +if (!c->auth_hash_name) +return -ENOMEM ; + }break ;case Opt_ignore:break ;
Greg Kroah-Hartman
maintainerPATCH 170/214 ubifs: Fix a memleak after dumping authentication mount options
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 47f6d9ce45b03a40c34b668a9884754c58122b39 upstream.
Fix a memory leak after dumping authentication mount options in error handling branch.
--- fs/ubifs/super.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/ubifs/super.c +14 -2
@@ -1123,6 +1123,18 @@ static int ubifs_parse_options(struct ubreturn 0 ; } +/* +* ubifs_release_options - release mount parameters which have been dumped. +* @c: UBIFS file-system description object +*/ +static void ubifs_release_options (struct ubifs_info *c) +{ +kfree (c->auth_key_name); + c->auth_key_name =NULL ; +kfree (c->auth_hash_name); + c->auth_hash_name =NULL ; +} +/** * destroy_journal - destroy journal data structures. * @c: UBIFS file-system description object
@@ -1632,8 +1644,7 @@ static void ubifs_umount(struct ubifs_inubifs_lpt_free (c,0 );ubifs_exit_authentication (c); -kfree (c->auth_key_name); -kfree (c->auth_hash_name); +ubifs_release_options (c);kfree (c->cbuf);kfree (c->rcvrd_mst_node);kfree (c->mst_node);
@@ -2201,6 +2212,7 @@ out_umount: out_unlock:mutex_unlock (&c->umount_mutex); out_close: +ubifs_release_options (c);ubi_close_volume (c->ubi); out:return err;
Greg Kroah-Hartman
maintainerPATCH 173/214 perf python scripting: Fix printable strings in python3 scripts
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
commit 6fcd5ddc3b1467b3586972ef785d0d926ae4cdf4 upstream.
Hagen reported broken strings in python3 tracepoint scripts:
make PYTHON=python3 perf record -e sched:sched_switch -a -- sleep 5 perf script --gen-script py perf script -s ./perf-script.py
[..]
sched__sched_switch 7 563231.759525792 0 swapper prev_comm=bytearray(b'swapper/7\x00\x00\x00\x00\x00\x00\x00'), prev_pid=0, prev_prio=120, prev_state=, next_comm=bytearray(b'mutex-thread-co\x00'),
The problem is in the is_printable_array function that does not take the zero byte into account and claim such string as not printable, so the code will create byte array instead of string.
Committer testing:
After this fix:
sched__sched_switch 3 484522.497072626 1158680 kworker/3:0-eve prev_comm=kworker/3:0, prev_pid=1158680, prev_prio=120, prev_state=I, next_comm=swapper/3, next_pid=0, next_prio=120
Sample: {addr=0, cpu=3, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1158680, tid=1158680, time=484522497072626, transaction=0, values=[(0, 0)], weight=0}
sched__sched_switch 4 484522.497085610 1225814 perf prev_comm=perf, prev_pid=1225814, prev_prio=120, prev_state=, next_comm=migration/4, next_pid=30, next_prio=0
Sample: {addr=0, cpu=4, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744071841817196, period=1, phys_addr=0, pid=1225814, tid=1225814, time=484522497085610, transaction=0, values=[(0, 0)], weight=0}
--- tools/perf/util/print_binary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/print_binary.c +1 -1
@@ -50,7 +50,7 @@ int is_printable_array(char *p, unsigned len--; -for (i =0 ; i < len; i++) { +for (i =0 ; i < len && p[i]; i++) {if (!isprint (p[i]) && !isspace (p[i]))return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 174/214 ARC: perf: redo the pct irq missing in device-tree handling
In reply to Greg Kroah-HartmanFrom: Vineet Gupta <[email protected]>
commit 8c42a5c02bec6c7eccf08957be3c6c8fccf9790b upstream.
commit feb92d7d3813456c11dce21 "(ARC: perf: don't bail setup if pct irq missing in device-tree)" introduced a silly brown-paper bag bug:
The assignment and comparison in an if statement were not bracketed correctly leaving the order of evaluation undefined.
|
| if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
| ^^^ ^^^^And given such a chance, the compiler will bite you hard, fully entitled to generating this piece of beauty:
|
| # if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
|
| bl.d @platform_get_irq <-- irq returned in r0
|
| setge r2, r0, 0 <-- r2 is bool 1 or 0 if irq >= 0 true/false
| brlt.d r0, 0, @.L114
|
| st_s r2,[sp] <-- irq saved is bool 1 or 0, not actual return val
| st 1,[r3,160] # arc_pmu.18_29->irq <-- drops bool and assumes 1
|
| # return __request_percpu_irq(irq, handler, 0,
|
| bl.d @__request_percpu_irq;
| mov_s r0,1 <-- drops even bool and assumes 1 which failsWith the snafu fixed, everything is as expected.
| bl.d @platform_get_irq <-- returns irq in r0 | | mov_s r2,r0 | brlt.d r2, 0, @.L112 | | st_s r0,[sp] <-- irq isaved is actual return value above | st r0,[r13,160] #arc_pmu.18_27->irq | | bl.d @__request_percpu_irq <-- r0 unchanged so actual irq returned | add r4,r4,r12 #, tmp363, __ptr
--- arch/arc/kernel/perf_event.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
arch/arc/kernel/perf_event.c +19 -10
@@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct p {struct arc_reg_pct_build pct_bcr;struct arc_reg_cc_build cc_bcr; -int i, has_interrupts, irq; +int i, has_interrupts, irq =-1 ;int counter_size;/* in bits */ union cc_name {
@@ -637,18 +637,27 @@ static int arc_pmu_device_probe(struct p .attr_groups = arc_pmu->attr_groups, }; -if (has_interrupts && (irq =platform_get_irq (pdev,0 ) >=0 )) { +if (has_interrupts) { + irq =platform_get_irq (pdev,0 ); +if (irq >=0 ) { +int ret; + + arc_pmu->irq = irq; + +/* intc map function ensures irq_set_percpu_devid() called */ + ret =request_percpu_irq (irq, arc_pmu_intr,"ARC perf counters" , +this_cpu_ptr (&arc_pmu_cpu)); + +if (!ret) +on_each_cpu (arc_cpu_pmu_irq_init, &irq,1 ); +else + irq =-1 ; + } - arc_pmu->irq = irq; - -/* intc map function ensures irq_set_percpu_devid() called */ -request_percpu_irq (irq, arc_pmu_intr,"ARC perf counters" , -this_cpu_ptr (&arc_pmu_cpu)); + } -on_each_cpu (arc_cpu_pmu_irq_init, &irq,1 ); - }else { +if (irq ==-1 ) arc_pmu->pmu.capabilities |=PERF_PMU_CAP_NO_INTERRUPT ; - }/* * perf parser doesn't really like '-' symbol in events name, so let's
Greg Kroah-Hartman
maintainerPATCH 175/214 ubi: check kthread_should_stop() after the setting of task state
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit d005f8c6588efcfbe88099b6edafc6f58c84a9c1 upstream.
A detach hung is possible when a race occurs between the detach process and the ubi background thread. The following sequences outline the race:
ubi thread: if (list_empty(&ubi->works)...
ubi detach: set_bit(KTHREAD_SHOULD_STOP, &kthread->flags)
=> by kthread_stop()
wake_up_process()
=> ubi thread is still running, so 0 is returned
ubi thread: set_current_state(TASK_INTERRUPTIBLE)
schedule()
=> ubi thread will never be scheduled again
ubi detach: wait_for_completion()
=> hung task!
To fix that, we need to check kthread_should_stop() after we set the task state, so the ubi thread will either see the stop bit and exit or the task state is reset to runnable such that it isn't scheduled out indefinitely.
--- drivers/mtd/ubi/wl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mtd/ubi/wl.c +13 -0
@@ -1629,6 +1629,19 @@ int ubi_thread(void *u) !ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) {set_current_state (TASK_INTERRUPTIBLE );spin_unlock (&ubi->wl_lock); + +/* +* Check kthread_should_stop() after we set the task +* state to guarantee that we either see the stop bit +* and exit or the task state is reset to runnable such +* that it's not scheduled out indefinitely and detects +* the stop bit at kthread_should_stop(). +*/ +if (kthread_should_stop ()) { +set_current_state (TASK_RUNNING ); +break ; + } +schedule ();continue ; }
Greg Kroah-Hartman
maintainerPATCH 176/214 ia64: fix build error with !COREDUMP
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 7404840d87557c4092bf0272bce5e0354c774bf9 upstream.
Fix linkage error when CONFIG_BINFMT_ELF is selected but CONFIG_COREDUMP is not:
ia64-linux-ld: arch/ia64/kernel/elfcore.o: in function `elf_core_write_extra_phdrs':
elfcore.c:(.text+0x172): undefined reference to `dump_emit'
ia64-linux-ld: arch/ia64/kernel/elfcore.o: in function `elf_core_write_extra_data':
elfcore.c:(.text+0x2b2): undefined reference to `dump_emit'
--- arch/ia64/kernel/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/kernel/Makefile +1 -1
@@ -41,7 +41,7 @@ obj-y += esi_stub.o # must be in kern endif obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o -obj-$(CONFIG_BINFMT_ELF) += elfcore.o +obj-$(CONFIG_ELF_CORE) += elfcore.o # fp_emulate() expects f2-f5,f16-f31 to contain the user-level state. CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31
Greg Kroah-Hartman
maintainerPATCH 179/214 drm/amdgpu: dont map BO in reserved region
In reply to Greg Kroah-HartmanFrom: Madhav Chauhan <[email protected]>
commit c4aa8dff6091cc9536aeb255e544b0b4ba29faf4 upstream.
2MB area is reserved at top inside VM.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -0
@@ -561,6 +561,7 @@ int amdgpu_gem_va_ioctl(struct drm_devicstruct ww_acquire_ctx ticket;struct list_head list, duplicates;uint64_t va_flags; +uint64_t vm_size;int r =0 ;if (args->va_address <AMDGPU_VA_RESERVED_SIZE ) {
@@ -581,6 +582,15 @@ int amdgpu_gem_va_ioctl(struct drm_devic args->va_address &=AMDGPU_GMC_HOLE_MASK ; + vm_size = adev->vm_manager.max_pfn *AMDGPU_GPU_PAGE_SIZE ; + vm_size -=AMDGPU_VA_RESERVED_SIZE ; +if (args->va_address + args->map_size > vm_size) { +dev_dbg (&dev->pdev->dev, +"va_address 0x%llx is in top reserved area 0x%llx\n" , + args->va_address + args->map_size, vm_size); +return -EINVAL ; + } +if ((args->flags & ~valid_flags) && (args->flags & ~prt_flags)) {dev_dbg (&dev->pdev->dev,"invalid flags combination 0x%08X\n" , args->flags);
Greg Kroah-Hartman
maintainerPATCH 180/214 drm/amd/display: Increase timeout for DP Disable
In reply to Greg Kroah-HartmanFrom: Wesley Chalmers <[email protected]>
commit 37b7cb10f07c1174522faafc1d51c6591b1501d4 upstream.
[WHY]
When disabling DP video, the current REG_WAIT timeout of 50ms is too low for certain cases with very high VSYNC intervals.
[HOW]
Increase the timeout to 102ms, so that refresh rates as low as 10Hz can be handled properly.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +2 -2
@@ -898,10 +898,10 @@ void enc1_stream_encoder_dp_blank(*/ REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_DIS_DEFER ,2 );/* Larger delay to wait until VBLANK - use max retry of -* 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + +* 10us*10200=102ms. This covers 100.0ms of minimum 10 Hz mode + * a little more because we may not trust delay accuracy. */ - max_retries =DP_BLANK_MAX_RETRY *250 ; + max_retries =DP_BLANK_MAX_RETRY *501 ;/* disable DP stream */ REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_ENABLE ,0 );
Greg Kroah-Hartman
maintainerPATCH 182/214 drm/amdkfd: Use same SQ prefetch setting as amdgpu
In reply to Greg Kroah-HartmanFrom: Jay Cornwall <[email protected]>
commit d56b1980d7efe9ef08469e856fc0703d0cef65e4 upstream.
0 causes instruction fetch stall at cache line boundary under some conditions on Navi10. A non-zero prefetch is the preferred default in any case.
Fixes soft hang in Luxmark.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c +3 -2
@@ -58,8 +58,9 @@ static int update_qpd_v10(struct device_/* check if sh_mem_config register already configured */ if (qpd->sh_mem_config ==0 ) { qpd->sh_mem_config = -SH_MEM_ALIGNMENT_MODE_UNALIGNED << -SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ; + (SH_MEM_ALIGNMENT_MODE_UNALIGNED << +SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ) | + (3 <<SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT );#if 0 /* TODO: * This shouldn't be an issue with Navi10. Verify.
Greg Kroah-Hartman
maintainerPATCH 183/214 drm/amd/display: Avoid MST manager resource leak.
In reply to Greg Kroah-HartmanFrom: Andrey Grodzovsky <[email protected]>
commit 5dff80bdce9e385af5716ed083f9e33e814484ab upstream.
On connector destruction call drm_dp_mst_topology_mgr_destroy to release resources allocated in drm_dp_mst_topology_mgr_init. Do it only if MST manager was initilized before otherwsie a crash is seen on driver unload/device unplug.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -0
@@ -3956,6 +3956,13 @@ static void amdgpu_dm_connector_destroy(struct amdgpu_device *adev = connector->dev->dev_private;struct amdgpu_display_manager *dm = &adev->dm; +/* +* Call only if mst_mgr was iniitalized before since it's not done +* for all connector types. +*/ +if (aconnector->mst_mgr.dev) +drm_dp_mst_topology_mgr_destroy (&aconnector->mst_mgr); +#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE ) ||\ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE )
Greg Kroah-Hartman
maintainerPATCH 157/214 s390/stp: add locking to sysfs functions
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit b3bd02495cb339124f13135d51940cf48d83e5cb upstream.
The sysfs function might race with stp_work_fn. To prevent that, add the required locking. Another issue is that the sysfs functions are checking the stp_online flag, but this flag just holds the user setting whether STP is enabled. Add a flag to clock_sync_flag whether stp_info holds valid data and use that instead.
--- arch/s390/kernel/time.c | 118 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 85 insertions(+), 33 deletions(-)
arch/s390/kernel/time.c +85 -33
@@ -354,8 +354,9 @@ static DEFINE_PER_CPU(atomic_t, clock_systatic DEFINE_MUTEX (clock_sync_mutex);static unsigned long clock_sync_flags; -#define CLOCK_SYNC_HAS_STP 0 -#define CLOCK_SYNC_STP 1 +#define CLOCK_SYNC_HAS_STP 0 +#define CLOCK_SYNC_STP 1 +#define CLOCK_SYNC_STPINFO_VALID 2/* * The get_clock function for the physical clock. It will get the current
@@ -592,6 +593,22 @@ void stp_queue_work(void)queue_work (time_sync_wq, &stp_work); } +static int __store_stpinfo (void ) +{ +int rc =chsc_sstpi (stp_page, &stp_info,sizeof (struct stp_sstpi )); + +if (rc) +clear_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +else +set_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +return rc; +} + +static int stpinfo_valid (void ) +{ +return stp_online &&test_bit (CLOCK_SYNC_STPINFO_VALID , &clock_sync_flags); +} +static int stp_sync_clock (void *data) {struct clock_sync_data *sync = data;
@@ -613,8 +630,7 @@ static int stp_sync_clock(void *data)if (rc ==0 ) { sync->clock_delta = clock_delta;clock_sync_global (clock_delta); - rc =chsc_sstpi (stp_page, &stp_info, -sizeof (struct stp_sstpi )); + rc =__store_stpinfo ();if (rc ==0 && stp_info.tmd !=2 ) rc = -EAGAIN ; }
@@ -659,7 +675,7 @@ static void stp_work_fn(struct work_struif (rc) goto out_unlock; - rc =chsc_sstpi (stp_page, &stp_info,sizeof (struct stp_sstpi )); + rc =__store_stpinfo ();if (rc || stp_info.c ==0 ) goto out_unlock;
@@ -696,10 +712,14 @@ static ssize_t stp_ctn_id_show(struct destruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%016llx\n" , - *(unsigned long long *) stp_info.ctnid); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%016llx\n" , + *(unsigned long long *) stp_info.ctnid); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
@@ -708,9 +728,13 @@ static ssize_t stp_ctn_type_show(structstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.ctn); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.ctn); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
@@ -719,9 +743,13 @@ static ssize_t stp_dst_offset_show(strucstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x2000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.dsto); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x2000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.dsto); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
@@ -730,9 +758,13 @@ static ssize_t stp_leap_seconds_show(strstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x8000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.leaps); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x8000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.leaps); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
@@ -741,9 +773,13 @@ static ssize_t stp_stratum_show(struct dstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.stratum); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.stratum); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL);
@@ -752,9 +788,13 @@ static ssize_t stp_time_offset_show(strustruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x0800 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int ) stp_info.tto); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x0800 )) + ret =sprintf (buf,"%i\n" , (int ) stp_info.tto); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
@@ -763,9 +803,13 @@ static ssize_t stp_time_zone_offset_showstruct device_attribute *attr, char *buf) { -if (!stp_online || !(stp_info.vbits &0x4000 )) -return -ENODATA ; -return sprintf (buf,"%i\n" , (int )(s16 ) stp_info.tzo); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid () && (stp_info.vbits &0x4000 )) + ret =sprintf (buf,"%i\n" , (int )(s16 ) stp_info.tzo); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(time_zone_offset, 0400,
@@ -775,9 +819,13 @@ static ssize_t stp_timing_mode_show(strustruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.tmd); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.tmd); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
@@ -786,9 +834,13 @@ static ssize_t stp_timing_state_show(strstruct device_attribute *attr, char *buf) { -if (!stp_online) -return -ENODATA ; -return sprintf (buf,"%i\n" , stp_info.tst); + ssize_t ret = -ENODATA; + +mutex_lock (&stp_work_mutex); +if (stpinfo_valid ()) + ret =sprintf (buf,"%i\n" , stp_info.tst); +mutex_unlock (&stp_work_mutex); +return ret; } static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
Greg Kroah-Hartman
maintainerPATCH 184/214 drm/amdgpu: increase the reserved VM size to 2MB
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
commit 55bb919be4e4973cd037a04f527ecc6686800437 upstream.
Ideally this should be a multiple of the VM block size. 2MB should at least fit for Vega/Navi.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -2
@@ -105,8 +105,8 @@ struct amdgpu_bo_list_entry;#define AMDGPU_MMHUB_0 1#define AMDGPU_MMHUB_1 2 -/* hardcode that limit for now */ -#define AMDGPU_VA_RESERVED_SIZE (1ULL << 20) +/* Reserve 2MB at top/bottom of address space for kernel use */ +#define AMDGPU_VA_RESERVED_SIZE (2ULL << 20)/* max vmids dedicated for process */ #define AMDGPU_VM_MAX_RESERVED_VMID 1
Greg Kroah-Hartman
maintainerPATCH 185/214 drm/amd/display: Dont invoke kgdb_breakpoint() unconditionally
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 8b7dc1fe1a5c1093551f6cd7dfbb941bd9081c2e upstream.
ASSERT_CRITICAL() invokes kgdb_breakpoint() whenever either CONFIG_KGDB or CONFIG_HAVE_KGDB is set. This, however, may lead to a kernel panic when no kdb stuff is attached, since the kgdb_breakpoint() call issues INT3. It's nothing but a surprise for normal end-users.
For avoiding the pitfall, make the kgdb_breakpoint() call only when CONFIG_DEBUG_KERNEL_DC is set.
https://bugzilla.opensuse.org/show_bug.cgi?id=1177973
--- drivers/gpu/drm/amd/display/dc/os_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/os_types.h +1 -1
@@ -57,7 +57,7 @@* general debug capabilities * */ -#if defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ) +#if defined(CONFIG_DEBUG_KERNEL_DC ) && (defined(CONFIG_HAVE_KGDB ) || defined(CONFIG_KGDB ))#define ASSERT_CRITICAL (expr) do { \ if (WARN_ON(!(expr))) { \ kgdb_breakpoint(); \
Greg Kroah-Hartman
maintainerPATCH 188/214 libceph: clear con->out_msg on Policy::stateful_server faults
In reply to Greg Kroah-HartmanFrom: Ilya Dryomov <[email protected]>
commit 28e1581c3b4ea5f98530064a103c6217bedeea73 upstream.
con->out_msg must be cleared on Policy::stateful_server (!CEPH_MSG_CONNECT_LOSSY) faults. Not doing so botches the reconnection attempt, because after writing the banner the messenger moves on to writing the data section of that message (either from where it got interrupted by the connection reset or from the beginning) instead of writing struct ceph_msg_connect. This results in a bizarre error message because the server sends CEPH_MSGR_TAG_BADPROTOVER but we think we wrote struct ceph_msg_connect:
libceph: mds0 (1)172.21.15.45:6828 socket error on write
ceph: mds0 reconnect start
libceph: mds0 (1)172.21.15.45:6829 socket closed (con state OPEN)
libceph: mds0 (1)172.21.15.45:6829 protocol version mismatch, my 32 != server's 32
libceph: mds0 (1)172.21.15.45:6829 protocol version mismatch
AFAICT this bug goes back to the dawn of the kernel client. The reason it survived for so long is that only MDS sessions are stateful and only two MDS messages have a data section:CEPH_MSG_CLIENT_RECONNECT (always, but reconnecting is rare) and CEPH_MSG_CLIENT_REQUEST (only when xattrs are involved). The connection has to get reset precisely when such message is being sent -- in this case it was the former.
--- net/ceph/messenger.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ceph/messenger.c +5 -0
@@ -3007,6 +3007,11 @@ static void con_fault(struct ceph_connecceph_msg_put (con->in_msg); con->in_msg =NULL ; } +if (con->out_msg) { +BUG_ON (con->out_msg->con != con); +ceph_msg_put (con->out_msg); + con->out_msg =NULL ; + }/* Requeue anything that hasn't been acked */ list_splice_init (&con->out_sent, &con->out_queue);
Greg Kroah-Hartman
maintainerPATCH 189/214 9P: Cast to loff_t before multiplying
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit f5f7ab168b9a60e12a4b8f2bb6fcc91321dc23c1 upstream.
On 32-bit systems, this multiplication will overflow for files larger than 4GB.
--- fs/9p/vfs_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/9p/vfs_file.c +2 -2
@@ -609,9 +609,9 @@ static void v9fs_mmap_vm_close(struct vmstruct writeback_control wbc = { .nr_to_write =LONG_MAX , .sync_mode =WB_SYNC_ALL , - .range_start = vma->vm_pgoff *PAGE_SIZE , + .range_start = (loff_t )vma->vm_pgoff *PAGE_SIZE ,/* absolute end, byte at end included */ - .range_end = vma->vm_pgoff *PAGE_SIZE + + .range_end = (loff_t )vma->vm_pgoff *PAGE_SIZE + (vma->vm_end - vma->vm_start -1 ), };
Greg Kroah-Hartman
maintainerPATCH 190/214 ring-buffer: Return 0 on success from ring_buffer_resize()
In reply to Greg Kroah-HartmanFrom: Qiujun Huang <[email protected]>
commit 0a1754b2a97efa644aa6e84d1db5b17c42251483 upstream.
We don't need to check the new buffer size, and the return value had confused resize_buffer_duplicate_size().
...
ret = ring_buffer_resize(trace_buf->buffer, per_cpu_ptr(size_buf->data,cpu_id)->entries, cpu_id); if (ret == 0) per_cpu_ptr(trace_buf->data, cpu_id)->entries = per_cpu_ptr(size_buf->data, cpu_id)->entries;
...
--- kernel/trace/ring_buffer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/trace/ring_buffer.c +4 -4
@@ -1717,18 +1717,18 @@ int ring_buffer_resize(struct ring_buffe {struct ring_buffer_per_cpu *cpu_buffer;unsigned long nr_pages; -int cpu, err =0 ; +int cpu, err;/* * Always succeed at resizing a non-existent buffer: */ if (!buffer) -return size; +return 0 ;/* Make sure the requested buffer exists */ if (cpu_id !=RING_BUFFER_ALL_CPUS && !cpumask_test_cpu (cpu_id, buffer->cpumask)) -return size; +return 0 ; nr_pages =DIV_ROUND_UP (size,BUF_PAGE_SIZE );
@@ -1868,7 +1868,7 @@ int ring_buffer_resize(struct ring_buffe }mutex_unlock (&buffer->mutex); -return size; +return 0 ; out_err:for_each_buffer_cpu (buffer, cpu) {
Greg Kroah-Hartman
maintainerPATCH 191/214 vringh: fix __vringh_iov() when riov and wiov are different
In reply to Greg Kroah-HartmanFrom: Stefano Garzarella <[email protected]>
commit 5745bcfbbf89b158416075374254d3c013488f21 upstream.
If riov and wiov are both defined and they point to different objects, only riov is initialized. If the wiov is not initialized by the caller, the function fails returning -EINVAL and printing "Readable desc 0x... after writable" error message.
This issue happens when descriptors have both readable and writable buffers (eg. virtio-blk devices has virtio_blk_outhdr in the readable buffer and status as last byte of writable buffer) and we call __vringh_iov() to get both type of buffers in two different iovecs.
Let's replace the 'else if' clause with 'if' to initialize both riov and wiov if they are not NULL.
As checkpatch pointed out, we also avoid crashing the kernel when riov and wiov are both NULL, replacing BUG() with WARN_ON() and returning -EINVAL.
--- drivers/vhost/vringh.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/vhost/vringh.c +5 -4
@@ -274,13 +274,14 @@ __vringh_iov(struct vringh *vrh, u16 i, desc_max = vrh->vring.num; up_next =-1 ; +/* You must want something! */ +if (WARN_ON (!riov && !wiov)) +return -EINVAL ; +if (riov) riov->i = riov->used =0 ; -else if (wiov) +if (wiov) wiov->i = wiov->used =0 ; -else -/* You must want something! */ -BUG ();for (;;) {void *addr;
Greg Kroah-Hartman
maintainerPATCH 158/214 powerpc/rtas: Restrict RTAS requests from userspace
In reply to Greg Kroah-HartmanFrom: Andrew Donnellan <[email protected]>
commit bd59380c5ba4147dcbaad3e582b55ccfd120b764 upstream.
A number of userspace utilities depend on making calls to RTAS to retrieve information and update various things.
The existing API through which we expose RTAS to userspace exposes more RTAS functionality than we actually need, through the sys_rtas syscall, which allows root (or anyone with CAP_SYS_ADMIN) to make any RTAS call they want with arbitrary arguments.
Many RTAS calls take the address of a buffer as an argument, and it's up to the caller to specify the physical address of the buffer as an argument. We allocate a buffer (the "RMO buffer") in the Real Memory Area that RTAS can access, and then expose the physical address and size of this buffer in /proc/powerpc/rtas/rmo_buffer. Userspace is expected to read this address, poke at the buffer using /dev/mem, and pass an address in the RMO buffer to the RTAS call.
However, there's nothing stopping the caller from specifying whatever address they want in the RTAS call, and it's easy to construct a series of RTAS calls that can overwrite arbitrary bytes (even without /dev/mem access).
Additionally, there are some RTAS calls that do potentially dangerous things and for which there are no legitimate userspace use cases.
In the past, this would not have been a particularly big deal as it was assumed that root could modify all system state freely, but with Secure Boot and lockdown we need to care about this.
We can't fundamentally change the ABI at this point, however we can address this by implementing a filter that checks RTAS calls against a list of permitted calls and forces the caller to use addresses within the RMO buffer.
The list is based off the list of calls that are used by the librtas userspace library, and has been tested with a number of existing userspace RTAS utilities. For compatibility with any applications we are not aware of that require other calls, the filter can be turned off at build time.
--- arch/powerpc/Kconfig | 13 +++ arch/powerpc/kernel/rtas.c | 153 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+)
arch/powerpc/Kconfig +13 -0
@@ -1024,6 +1024,19 @@ config FSL_RIO Include support for RapidIO controller on Freescale embedded processors (MPC8548, MPC8641, etc). +config PPC_RTAS_FILTER + bool "Enable filtering of RTAS syscalls" + default y + depends on PPC_RTAS + help + The RTAS syscall API has security issues that could be used to + compromise system integrity. This option enforces restrictions on the + RTAS calls and arguments passed by userspace programs to mitigate + these issues. + + Say Y unless you know what you are doing and the filter is causing + problems for you. + endmenu config NONSTATIC_KERNEL
arch/powerpc/kernel/rtas.c +153 -0
177 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 193/214 ext4: fix error handling code in add_new_gdb
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
commit c9e87161cc621cbdcfc472fa0b2d81c63780c8f5 upstream.
When ext4_journal_get_write_access() fails, we should terminate the execution flow and release n_group_desc, iloc.bh, dind and gdb_bh.
--- fs/ext4/resize.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/resize.c +3 -1
@@ -861,8 +861,10 @@ static int add_new_gdb(handle_t *handle,BUFFER_TRACE (dind,"get_write_access" ); err =ext4_journal_get_write_access (handle, dind); -if (unlikely (err)) +if (unlikely (err)) {ext4_std_error (sb, err); + goto errout; + }/* ext4_reserve_inode_write() gets a reference on the iloc */ err =ext4_reserve_inode_write (handle, inode, &iloc);
Greg Kroah-Hartman
maintainerPATCH 159/214 powerpc: Warn about use of smt_snooze_delay
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
commit a02f6d42357acf6e5de6ffc728e6e77faf3ad217 upstream.
It's not done anything for a long time. Save the percpu variable, and emit a warning to remind users to not expect it to do anything.
This uses pr_warn_once instead of pr_warn_ratelimit as testing 'ppc64_cpu --smt=off' on a 24 core / 4 SMT system showed the warning to be noisy, as the online/offline loop is slow.
--- arch/powerpc/kernel/sysfs.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-)
arch/powerpc/kernel/sysfs.c +17 -25
@@ -31,29 +31,27 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); -/* -* SMT snooze delay stuff, 64-bit only for now -*/ -#ifdef CONFIG_PPC64 -/* Time in microseconds we delay before sleeping in the idle loop */ -static DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; +/* +* Snooze delay has not been hooked up since 3fa8cad82b94 ("powerpc/pseries/cpuidle: +* smt-snooze-delay cleanup.") and has been broken even longer. As was foretold in +* 2014: +* +* "ppc64_util currently utilises it. Once we fix ppc64_util, propose to clean +* up the kernel code." +* +* powerpc-utils stopped using it as of 1.3.8. At some point in the future this +* code should be removed. +*/ static ssize_t store_smt_snooze_delay (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { - struct cpu *cpu = container_of(dev, struct cpu, dev); -ssize_t ret; -long snooze; - - ret =sscanf (buf,"%ld" , &snooze); -if (ret !=1 ) -return -EINVAL ; - -per_cpu (smt_snooze_delay, cpu->dev.id) = snooze; +pr_warn_once ("%s (%d) stored to unsupported smt_snooze_delay, which has no effect.\n" , + current->comm, current->pid);return count; }
@@ -61,9 +59,9 @@ static ssize_t show_smt_snooze_delay(str struct device_attribute *attr, char *buf) { - struct cpu *cpu = container_of(dev, struct cpu, dev); - -return sprintf (buf,"%ld\n" ,per_cpu (smt_snooze_delay, cpu->dev.id)); + pr_warn_once("%s (%d) read from unsupported smt_snooze_delay\n", + current->comm, current->pid); +return sprintf (buf,"100\n" ); } static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
@@ -71,16 +69,10 @@ static DEVICE_ATTR(smt_snooze_delay, 064static int __init setup_smt_snooze_delay (char *str) { -unsigned int cpu; -long snooze; -if (!cpu_has_feature (CPU_FTR_SMT ))return 1 ; - snooze =simple_strtol (str,NULL ,10 ); -for_each_possible_cpu (cpu) -per_cpu (smt_snooze_delay, cpu) = snooze; - +pr_warn ("smt-snooze-delay command line option has no effect\n" );return 1 ; }__setup ("smt-snooze-delay=" , setup_smt_snooze_delay);
Greg Kroah-Hartman
maintainerPATCH 160/214 powerpc/memhotplug: Make lmb size 64bit
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit 301d2ea6572386245c5d2d2dc85c3b5a737b85ac upstream.
Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block panic") make sure different variables tracking lmb_size are updated to be 64 bit.
This was found by code audit.
--- arch/powerpc/platforms/pseries/hotplug-memory.c | 43 ++++++++++++++++-------- 1 file changed, 29 insertions(+), 14 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +29 -14
@@ -279,7 +279,7 @@ static int dlpar_offline_lmb(struct drmereturn dlpar_change_lmb_state (lmb, false); } -static int pseries_remove_memblock (unsigned long base,unsigned int memblock_size) +static int pseries_remove_memblock (unsigned long base,unsigned long memblock_size) {unsigned long block_sz, start_pfn;int sections_per_block;
@@ -310,10 +310,11 @@ out:static int pseries_remove_mem_node (struct device_node *np) { -const __be32 *regs; +const __be32 *prop;unsigned long base; -unsigned int lmb_size; +unsigned long lmb_size;int ret = -EINVAL ; +int addr_cells, size_cells;/* * Check to see if we are actually removing memory
@@ -324,12 +325,19 @@ static int pseries_remove_mem_node(struc/* * Find the base address and size of the memblock */ - regs =of_get_property (np,"reg" ,NULL ); -if (!regs) + prop =of_get_property (np,"reg" ,NULL ); +if (!prop)return ret; - base =be64_to_cpu (*(unsigned long *)regs); - lmb_size =be32_to_cpu (regs[3 ]); + addr_cells =of_n_addr_cells (np); + size_cells =of_n_size_cells (np); + +/* +* "reg" property represents (addr,size) tuple. +*/ + base =of_read_number (prop, addr_cells); + prop += addr_cells; + lmb_size =of_read_number (prop, size_cells);pseries_remove_memblock (base, lmb_size);return 0 ;
@@ -620,7 +628,7 @@ static int dlpar_memory_remove_by_ic(u32#else static inline int pseries_remove_memblock (unsigned long base, -unsigned int memblock_size) +unsigned long memblock_size) {return -EOPNOTSUPP ; }
@@ -953,10 +961,11 @@ int dlpar_memory(struct pseries_hp_errorstatic int pseries_add_mem_node (struct device_node *np) { -const __be32 *regs; +const __be32 *prop;unsigned long base; -unsigned int lmb_size; +unsigned long lmb_size;int ret = -EINVAL ; +int addr_cells, size_cells;/* * Check to see if we are actually adding memory
@@ -967,12 +976,18 @@ static int pseries_add_mem_node(struct d/* * Find the base and size of the memblock */ - regs =of_get_property (np,"reg" ,NULL ); -if (!regs) + prop =of_get_property (np,"reg" ,NULL ); +if (!prop)return ret; - base =be64_to_cpu (*(unsigned long *)regs); - lmb_size =be32_to_cpu (regs[3 ]); + addr_cells =of_n_addr_cells (np); + size_cells =of_n_size_cells (np); +/* +* "reg" property represents (addr,size) tuple. +*/ + base =of_read_number (prop, addr_cells); + prop += addr_cells; + lmb_size =of_read_number (prop, size_cells);/* * Update memory region to represent the memory add
Greg Kroah-Hartman
maintainerPATCH 161/214 powerpc/powernv/elog: Fix race while processing OPAL error log event.
In reply to Greg Kroah-HartmanFrom: Mahesh Salgaonkar <[email protected]>
commit aea948bb80b478ddc2448f7359d574387521a52d upstream.
Every error log reported by OPAL is exported to userspace through a sysfs interface and notified using kobject_uevent(). The userspace daemon (opal_errd) then reads the error log and acknowledges the error log is saved safely to disk. Once acknowledged the kernel removes the respective sysfs file entry causing respective resources to be released including kobject.
However it's possible the userspace daemon may already be scanning elog entries when a new sysfs elog entry is created by the kernel. User daemon may read this new entry and ack it even before kernel can notify userspace about it through kobject_uevent() call. If that happens then we have a potential race between elog_ack_store->kobject_put() and kobject_uevent which can lead to use-after-free of a kernfs object resulting in a kernel crash. eg:
BUG: Unable to handle kernel data access on read at 0x6b6b6b6b6b6b6bfb
Faulting instruction address: 0xc0000000008ff2a0
Oops: Kernel access of bad area, sig: 11 [#1]
LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA PowerNV
CPU: 27 PID: 805 Comm: irq/29-opal-elo Not tainted 5.9.0-rc2-gcc-8.2.0-00214-g6f56a67bcbb5-dirty #363
...
NIP kobject_uevent_env+0xa0/0x910
LR elog_event+0x1f4/0x2d0
Call Trace:
0x5deadbeef0000122 (unreliable)
elog_event+0x1f4/0x2d0
irq_thread_fn+0x4c/0xc0
irq_thread+0x1c0/0x2b0
kthread+0x1c4/0x1d0
ret_from_kernel_thread+0x5c/0x6cThis patch fixes this race by protecting the sysfs file creation/notification by holding a reference count on kobject until we safely send kobject_uevent().
The function create_elog_obj() returns the elog object which if used by caller function will end up in use-after-free problem again. However, the return value of create_elog_obj() function isn't being used today and there is no need as well. Hence change it to return void to make this fix complete.
--- arch/powerpc/platforms/powernv/opal-elog.c | 33 ++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
arch/powerpc/platforms/powernv/opal-elog.c +26 -7
@@ -179,14 +179,14 @@ static ssize_t raw_attr_read(struct filereturn count; } -static struct elog_obj *create_elog_obj (uint64_t id,size_t size,uint64_t type) +static void create_elog_obj (uint64_t id,size_t size,uint64_t type) {struct elog_obj *elog;int rc; elog =kzalloc (sizeof (*elog),GFP_KERNEL );if (!elog) -return NULL ; +return ; elog->kobj.kset = elog_kset;
@@ -219,18 +219,37 @@ static struct elog_obj *create_elog_obj( rc =kobject_add (&elog->kobj,NULL ,"0x%llx" , id);if (rc) {kobject_put (&elog->kobj); -return NULL ; +return ; } +/* +* As soon as the sysfs file for this elog is created/activated there is +* a chance the opal_errd daemon (or any userspace) might read and +* acknowledge the elog before kobject_uevent() is called. If that +* happens then there is a potential race between +* elog_ack_store->kobject_put() and kobject_uevent() which leads to a +* use-after-free of a kernfs object resulting in a kernel crash. +* +* To avoid that, we need to take a reference on behalf of the bin file, +* so that our reference remains valid while we call kobject_uevent(). +* We then drop our reference before exiting the function, leaving the +* bin file to drop the last reference (if it hasn't already). +*/ + +/* Take a reference for the bin file */ +kobject_get (&elog->kobj); rc =sysfs_create_bin_file (&elog->kobj, &elog->raw_attr); -if (rc) { +if (rc ==0 ) { +kobject_uevent (&elog->kobj,KOBJ_ADD ); + }else { +/* Drop the reference taken for the bin file */ kobject_put (&elog->kobj); -return NULL ; } -kobject_uevent (&elog->kobj,KOBJ_ADD ); +/* Drop our reference */ +kobject_put (&elog->kobj); -return elog; +return ; }static irqreturn_t elog_event (int irq,void *data)
Greg Kroah-Hartman
maintainerPATCH 154/214 iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 10ab7cfd5522f0041028556dac864a003e158556 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses a 16 byte array of smaller elements on the stack. This is fixed by using an explicit c structure. As there are no holes in the structure, there is no possiblity of data leakage in this case.
The explicit alignment of ts is not strictly necessary but potentially makes the code slightly less fragile. It also removes the possibility of this being cut and paste into another driver where the alignment isn't already true.
--- drivers/iio/gyro/itg3200_buffer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/iio/gyro/itg3200_buffer.c +10 -3
@@ -46,13 +46,20 @@ static irqreturn_t itg3200_trigger_handlstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct itg3200 *st =iio_priv (indio_dev); -__be16 buf[ITG3200_SCAN_ELEMENTS +sizeof (s64)/sizeof (u16)]; +/* +* Ensure correct alignment and padding including for the +* timestamp that may be inserted. +*/ +struct { +__be16 buf[ITG3200_SCAN_ELEMENTS ]; +s64 ts__aligned(8) ; + } scan; -int ret =itg3200_read_all_channels (st->i2c, buf); +int ret =itg3200_read_all_channels (st->i2c, scan.buf);if (ret <0 ) goto error_ret; -iio_push_to_buffers_with_timestamp (indio_dev, buf, pf->timestamp); +iio_push_to_buffers_with_timestamp (indio_dev, &scan, pf->timestamp);iio_trigger_notify_done (indio_dev->trig);
Greg Kroah-Hartman
maintainerPATCH 204/214 arm: dts: mt7623: add missing pause for switchport
In reply to Greg Kroah-HartmanFrom: Frank Wunderlich <[email protected]>
commit 36f0a5fc5284838c544218666c63ee8cfa46a9c3 upstream.
port6 of mt7530 switch (= cpu port 0) on bananapi-r2 misses pause option which causes rx drops on running iperf.
--- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +1 -0
@@ -192,6 +192,7 @@ fixed-link { speed = <1000>; full-duplex; + pause; }; }; };
Greg Kroah-Hartman
maintainerPATCH 206/214 ARM: s3c24xx: fix missing system reset
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit f6d7cde84f6c5551586c8b9b68d70f8e6dc9a000 upstream.
Commit f6361c6b3880 ("ARM: S3C24XX: remove separate restart code") removed usage of the watchdog reset platform code in favor of the Samsung SoC watchdog driver. However the latter was not selected thus S3C24xx platforms lost reset abilities.
--- arch/arm/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/Kconfig +2 -0
@@ -507,8 +507,10 @@ config ARCH_S3C24XX select HAVE_S3C2410_WATCHDOG if WATCHDOG select HAVE_S3C_RTC if RTC_CLASS select NEED_MACH_IO_H + select S3C2410_WATCHDOG select SAMSUNG_ATAGS select USE_OF + select WATCHDOG help Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
Greg Kroah-Hartman
maintainerPATCH 207/214 device property: Keep secondary firmware node secondary by type
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit d5dcce0c414fcbfe4c2037b66ac69ea5f9b3f75c upstream.
Behind primary and secondary we understand the type of the nodes which might define their ordering. However, if primary node gone, we can't maintain the ordering by definition of the linked list. Thus, by ordering secondary node becomes first in the list. But in this case the meaning of it is still secondary (or auxiliary). The type of the node is maintained by the secondary pointer in it:
secondary pointer Meaning
NULL or valid primary node
ERR_PTR(-ENODEV) secondary node
So, if by some reason we do the following sequence of calls
set_primary_fwnode(dev, NULL); set_primary_fwnode(dev, primary);
we should preserve secondary node.
This concept is supported by the description of set_primary_fwnode() along with implementation of set_secondary_fwnode(). Hence, fix the commit c15e1bdda436 to follow this as well.
--- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/core.c +1 -1
@@ -3414,7 +3414,7 @@ void set_primary_fwnode(struct device *d }else {if (fwnode_is_primary (fn)) { dev->fwnode = fn->secondary; - fn->secondary =NULL ; + fn->secondary =ERR_PTR (-ENODEV ); }else { dev->fwnode =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 208/214 device property: Dont clear secondary pointer for shared primary firmware node
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit 99aed9227073fb34ce2880cbc7063e04185a65e1 upstream.
It appears that firmware nodes can be shared between devices. In such case when a (child) device is about to be deleted, its firmware node may be shared and ACPI_COMPANION_SET(..., NULL) call for it breaks the secondary link of the shared primary firmware node.
In order to prevent that, check, if the device has a parent and parent's firmware node is shared with its child, and avoid crashing the link.
--- drivers/base/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/core.c +3 -1
@@ -3400,6 +3400,7 @@ static inline bool fwnode_is_primary(str*/ void set_primary_fwnode (struct device *dev,struct fwnode_handle *fwnode) { +struct device *parent = dev->parent;struct fwnode_handle *fn = dev->fwnode;if (fwnode) {
@@ -3414,7 +3415,8 @@ void set_primary_fwnode(struct device *d }else {if (fwnode_is_primary (fn)) { dev->fwnode = fn->secondary; - fn->secondary =ERR_PTR (-ENODEV ); +if (!(parent && fn == parent->fwnode)) + fn->secondary =ERR_PTR (-ENODEV ); }else { dev->fwnode =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 210/214 staging: fieldbus: anybuss: jump to correct label in an error path
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
commit 7e97e4cbf30026b49b0145c3bfe06087958382c5 upstream.
In current code, controller_probe() misses to call ida_simple_remove() in an error path. Jump to correct label to fix it.
--- drivers/staging/fieldbus/anybuss/arcx-anybus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fieldbus/anybuss/arcx-anybus.c +1 -1
@@ -297,7 +297,7 @@ static int controller_probe(struct platf regulator =devm_regulator_register (dev, &can_power_desc, &config);if (IS_ERR (regulator)) { err =PTR_ERR (regulator); - goto out_reset; + goto out_ida; }/* make controller info visible to userspace */ cd->class_dev =kzalloc (sizeof (*cd->class_dev),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 211/214 staging: comedi: cb_pcidas: Allow 2-channel commands for AO subdevice
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit 647a6002cb41d358d9ac5de101a8a6dc74748a59 upstream.
The "cb_pcidas" driver supports asynchronous commands on the analog output (AO) subdevice for those boards that have an AO FIFO. The code (in cb_pcidas_ao_check_chanlist() and cb_pcidas_ao_cmd()) to validate and set up the command supports output to a single channel or to two channels simultaneously (the boards have two AO channels). However, the code in cb_pcidas_auto_attach() that initializes the subdevices neglects to initialize the AO subdevice's len_chanlist member, leaving it set to 0, but the Comedi core will "correct" it to 1 if the driver neglected to set it. This limits commands to use a single channel (either channel 0 or 1), but the limit should be two channels. Set the AO subdevice's len_chanlist member to be the same value as the n_chan member, which will be 2.
--- drivers/staging/comedi/drivers/cb_pcidas.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/comedi/drivers/cb_pcidas.c +1 -0
@@ -1342,6 +1342,7 @@ static int cb_pcidas_auto_attach(structif (dev->irq && board->has_ao_fifo) { dev->write_subdev = s; s->subdev_flags |=SDF_CMD_WRITE ; + s->len_chanlist = s->n_chan; s->do_cmdtest = cb_pcidas_ao_cmdtest; s->do_cmd = cb_pcidas_ao_cmd; s->cancel = cb_pcidas_ao_cancel;
Greg Kroah-Hartman
maintainerPATCH 213/214 staging: octeon: Drop on uncorrectable alignment or FCS error
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
commit 49d28ebdf1e30d806410eefc7de0a7a1ca5d747c upstream.
Currently in case of alignment or FCS error if the packet cannot be corrected it's still not dropped. Report the error properly and drop the packet while making the code around a little bit more readable.
--- drivers/staging/octeon/ethernet-rx.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
drivers/staging/octeon/ethernet-rx.c +19 -15
@@ -69,15 +69,17 @@ static inline int cvm_oct_check_rcv_erroelse port = work->word1.cn38xx.ipprt; -if ((work->word2.snoip.err_code ==10 ) && (work->word1.len <=64 )) { +if ((work->word2.snoip.err_code ==10 ) && (work->word1.len <=64 ))/* * Ignore length errors on min size packets. Some * equipment incorrectly pads packets to 64+4FCS * instead of 60+4FCS. Note these packets still get * counted as frame errors. */ - }else if (work->word2.snoip.err_code ==5 || - work->word2.snoip.err_code ==7 ) { +return 0 ; + +if (work->word2.snoip.err_code ==5 || + work->word2.snoip.err_code ==7 ) {/* * We received a packet with either an alignment error * or a FCS error. This may be signalling that we are
@@ -108,7 +110,10 @@ static inline int cvm_oct_check_rcv_erro/* Port received 0xd5 preamble */ work->packet_ptr.s.addr += i +1 ; work->word1.len -= i +5 ; - }else if ((*ptr &0xf ) ==0xd ) { +return 0 ; + } + +if ((*ptr &0xf ) ==0xd ) {/* Port received 0xd preamble */ work->packet_ptr.s.addr += i; work->word1.len -= i +4 ;
@@ -118,21 +123,20 @@ static inline int cvm_oct_check_rcv_erro ((*(ptr +1 ) &0xf ) <<4 ); ptr++; } - }else { -printk_ratelimited ("Port %d unknown preamble, packet dropped\n" , - port); -cvm_oct_free_work (work); -return 1 ; +return 0 ; } + +printk_ratelimited ("Port %d unknown preamble, packet dropped\n" , + port); +cvm_oct_free_work (work); +return 1 ; } - }else { -printk_ratelimited ("Port %d receive error code %d, packet dropped\n" , - port, work->word2.snoip.err_code); -cvm_oct_free_work (work); -return 1 ; } -return 0 ; +printk_ratelimited ("Port %d receive error code %d, packet dropped\n" , + port, work->word2.snoip.err_code); +cvm_oct_free_work (work); +return 1 ; }static void copy_segments_to_skb (cvmx_wqe_t *work,struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 212/214 staging: octeon: repair "fixed-link" support
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
commit 179f5dc36b0a1aa31538d7d8823deb65c39847b3 upstream.
The PHYs must be registered once in device probe function, not in device open callback because it's only possible to register them once.
--- drivers/staging/octeon/ethernet-mdio.c | 6 ------ drivers/staging/octeon/ethernet.c | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/staging/octeon/ethernet-mdio.c +0 -6
@@ -147,12 +147,6 @@ int cvm_oct_phy_setup_device(struct net_ phy_node =of_parse_phandle (priv->of_node,"phy-handle" ,0 );if (!phy_node &&of_phy_is_fixed_link (priv->of_node)) { -int rc; - - rc =of_phy_register_fixed_link (priv->of_node); -if (rc) -return rc; - phy_node =of_node_get (priv->of_node); }if (!phy_node)
drivers/staging/octeon/ethernet.c +9 -0
@@ -13,6 +13,7 @@#include <linux/phy.h> #include <linux/slab.h> #include <linux/interrupt.h> +#include <linux/of_mdio.h> #include <linux/of_net.h> #include <linux/if_ether.h> #include <linux/if_vlan.h>
@@ -894,6 +895,14 @@ static int cvm_oct_probe(struct platformbreak ; } +if (priv->of_node &&of_phy_is_fixed_link (priv->of_node)) { +if (of_phy_register_fixed_link (priv->of_node)) { +netdev_err (dev,"Failed to register fixed link for interface %d, port %d\n" , + interface, priv->port); + dev->netdev_ops =NULL ; + } + } +if (!dev->netdev_ops) {free_netdev (dev); }else if (register_netdev (dev) <0 ) {
Greg Kroah-Hartman
maintainerPATCH 196/214 drm/ttm: fix eviction valuable range check.
In reply to Greg Kroah-HartmanFrom: Dave Airlie <[email protected]>
commit fea456d82c19d201c21313864105876deabe148b upstream.
This was adding size to start, but pfn and start are in pages, so it should be using num_pages.
Not sure this fixes anything in the real world, just noticed it during refactoring.
--- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -761,7 +761,7 @@ bool ttm_bo_eviction_valuable(struct ttm/* Don't evict this BO if it's outside of the * requested placement range */ -if (place->fpfn >= (bo->mem.start + bo->mem.size) || +if (place->fpfn >= (bo->mem.start + bo->mem.num_pages) || (place->lpfn && place->lpfn <= bo->mem.start))return false;
Greg Kroah-Hartman
maintainerPATCH 214/214 KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesnt return SMCCC_RET_NOT_REQUIRED
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit 1de111b51b829bcf01d2e57971f8fd07a665fa3f upstream.
According to the SMCCC spec[1](7.5.2 Discovery) the ARM_SMCCC_ARCH_WORKAROUND_1 function id only returns 0, 1, and SMCCC_RET_NOT_SUPPORTED.
0 is "workaround required and safe to call this function"
1 is "workaround not required but safe to call this function" SMCCC_RET_NOT_SUPPORTED is "might be vulnerable or might not be, who knows, I give up!"
SMCCC_RET_NOT_SUPPORTED might as well mean "workaround required, except calling this function may not work because it isn't implemented in some cases". Wonderful. We map this SMC call to
0 is SPECTRE_MITIGATED
1 is SPECTRE_UNAFFECTED
SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
For KVM hypercalls (hvc), we've implemented this function id to return SMCCC_RET_NOT_SUPPORTED, 0, and SMCCC_RET_NOT_REQUIRED. One of those isn't supposed to be there. Per the code we call arm64_get_spectre_v2_state() to figure out what to return for this feature discovery call.
0 is SPECTRE_MITIGATED
SMCCC_RET_NOT_REQUIRED is SPECTRE_UNAFFECTED
SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
Let's clean this up so that KVM tells the guest this mapping:
0 is SPECTRE_MITIGATED
1 is SPECTRE_UNAFFECTED
SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
Note: SMCCC_RET_NOT_AFFECTED is 1 but isn't part of the SMCCC spec
--- include/linux/arm-smccc.h | 2 ++ virt/kvm/arm/psci.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
include/linux/arm-smccc.h +2 -0
@@ -76,6 +76,8 @@ ARM_SMCCC_SMC_32, \ 0, 0x7fff) +#define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED 1 +#ifndef __ASSEMBLY__#include <linux/linkage.h>
virt/kvm/arm/psci.c +1 -1
@@ -408,7 +408,7 @@ int kvm_hvc_call_handler(struct kvm_vcpu val =SMCCC_RET_SUCCESS ;break ;case KVM_BP_HARDEN_NOT_REQUIRED : - val =SMCCC_RET_NOT_REQUIRED ; + val =SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED ;break ; }break ;
Greg Kroah-Hartman
maintainerPATCH 199/214 drm/amd/pm: increase mclk switch threshold to 200 us
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 83da6eea3af669ee0b1f1bc05ffd6150af984994 upstream.
To avoid underflow seen on Polaris10 with some 3440x1440 144Hz displays. As the threshold of 190 us cuts too close to minVBlankTime of 192 us.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
@@ -2864,7 +2864,7 @@ static int smu7_vblank_too_short(structif (hwmgr->is_kicker) switch_limit_us = data->is_memory_gddr5 ?450 :150 ;else - switch_limit_us = data->is_memory_gddr5 ?190 :150 ; + switch_limit_us = data->is_memory_gddr5 ?200 :150 ;break ;case CHIP_VEGAM : switch_limit_us =30 ;
Greg Kroah-Hartman
maintainerPATCH 200/214 tty: make FONTX ioctl use the tty pointer they were actually passed
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 90bfdeef83f1d6c696039b6a917190dcbbad3220 upstream.
Some of the font tty ioctl's always used the current foreground VC for their operations. Don't do that then.
This fixes a data race on fg_console.
Side note: both Michael Ellerman and Jiri Slaby point out that all these ioctls are deprecated, and should probably have been removed long ago, and everything seems to be using the KDFONTOP ioctl instead.
In fact, Michael points out that it looks like busybox's loadfont program seems to have switched over to using KDFONTOP exactly _because_ of this bug (ahem.. 12 years ago ;-).
--- drivers/tty/vt/vt_ioctl.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/tty/vt/vt_ioctl.c +17 -15
@@ -244,7 +244,7 @@ int vt_waitactive(int n)static inline int -do_fontx_ioctl (int cmd,struct consolefontdesc __user *user_cfd,int perm,struct console_font_op *op) +do_fontx_ioctl (struct vc_data *vc,int cmd,struct consolefontdesc __user *user_cfd,int perm,struct console_font_op *op) {struct consolefontdesc cfdarg;int i;
@@ -262,15 +262,16 @@ do_fontx_ioctl(int cmd, struct consolefo op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data = cfdarg.chardata; -return con_font_op (vc_cons[fg_console].d, op); -case GIO_FONTX : { +return con_font_op (vc, op); + +case GIO_FONTX : op->op =KD_FONT_OP_GET ; op->flags =KD_FONT_FLAG_OLD ; op->width =8 ; op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data = cfdarg.chardata; - i =con_font_op (vc_cons[fg_console].d, op); + i =con_font_op (vc, op);if (i)return i; cfdarg.charheight = op->height;
@@ -278,7 +279,6 @@ do_fontx_ioctl(int cmd, struct consolefoif (copy_to_user (user_cfd, &cfdarg,sizeof (struct consolefontdesc )))return -EFAULT ;return 0 ; - } }return -EINVAL ; }
@@ -924,7 +924,7 @@ int vt_ioctl(struct tty_struct *tty, op.height =0 ; op.charcount =256 ; op.data = up; - ret =con_font_op (vc_cons[fg_console].d, &op); + ret =con_font_op (vc, &op);break ; }
@@ -935,7 +935,7 @@ int vt_ioctl(struct tty_struct *tty, op.height =32 ; op.charcount =256 ; op.data = up; - ret =con_font_op (vc_cons[fg_console].d, &op); + ret =con_font_op (vc, &op);break ; }
@@ -952,7 +952,7 @@ int vt_ioctl(struct tty_struct *tty,case PIO_FONTX :case GIO_FONTX : - ret =do_fontx_ioctl (cmd, up, perm, &op); + ret =do_fontx_ioctl (vc, cmd, up, perm, &op);break ;case PIO_FONTRESET :
@@ -969,11 +969,11 @@ int vt_ioctl(struct tty_struct *tty, { op.op =KD_FONT_OP_SET_DEFAULT ; op.data =NULL ; - ret =con_font_op (vc_cons[fg_console].d, &op); + ret =con_font_op (vc, &op);if (ret)break ;console_lock (); -con_set_default_unimap (vc_cons[fg_console].d); +con_set_default_unimap (vc);console_unlock ();break ; }
@@ -1100,8 +1100,9 @@ struct compat_consolefontdesc { };static inline int -compat_fontx_ioctl (int cmd,struct compat_consolefontdesc __user *user_cfd, -int perm,struct console_font_op *op) +compat_fontx_ioctl (struct vc_data *vc,int cmd, +struct compat_consolefontdesc __user *user_cfd, +int perm,struct console_font_op *op) {struct compat_consolefontdesc cfdarg;int i;
@@ -1119,7 +1120,8 @@ compat_fontx_ioctl(int cmd, struct compa op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data =compat_ptr (cfdarg.chardata); -return con_font_op (vc_cons[fg_console].d, op); +return con_font_op (vc, op); +case GIO_FONTX : op->op =KD_FONT_OP_GET ; op->flags =KD_FONT_FLAG_OLD ;
@@ -1127,7 +1129,7 @@ compat_fontx_ioctl(int cmd, struct compa op->height = cfdarg.charheight; op->charcount = cfdarg.charcount; op->data =compat_ptr (cfdarg.chardata); - i =con_font_op (vc_cons[fg_console].d, op); + i =con_font_op (vc, op);if (i)return i; cfdarg.charheight = op->height;
@@ -1217,7 +1219,7 @@ long vt_compat_ioctl(struct tty_struct **/ case PIO_FONTX :case GIO_FONTX : -return compat_fontx_ioctl (cmd, up, perm, &op); +return compat_fontx_ioctl (vc, cmd, up, perm, &op);case KDFONTOP :return compat_kdfontop_ioctl (up, perm, &op, vc);
Greg Kroah-Hartman
maintainerPATCH 202/214 cachefiles: Handle readpage error correctly
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 9480b4e75b7108ee68ecf5bc6b4bd68e8031c521 upstream.
If ->readpage returns an error, it has already unlocked the page.
--- fs/cachefiles/rdwr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cachefiles/rdwr.c +2 -1
@@ -121,7 +121,7 @@ static int cachefiles_read_reissue(struc_debug ("reissue read" ); ret = bmapping->a_ops->readpage (NULL , backpage);if (ret <0 ) - goto unlock_discard; + goto discard; }/* but the page may have been read before the monitor was installed, so
@@ -138,6 +138,7 @@ static int cachefiles_read_reissue(struc unlock_discard:unlock_page (backpage); +discard:spin_lock_irq (&object->work_lock);list_del (&monitor->op_link);spin_unlock_irq (&object->work_lock);
Greg Kroah-Hartman
maintainerPATCH 203/214 hil/parisc: Disable HIL driver when it gets stuck
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 879bc2d27904354b98ca295b6168718e045c4aa2 upstream.
When starting a HP machine with HIL driver but without an HIL keyboard or HIL mouse attached, it may happen that data written to the HIL loop gets stuck (e.g. because the transaction queue is full). Usually one will then have to reboot the machine because all you see is and endless output of:
Transaction add failed: transaction already queued?
In the higher layers hp_sdc_enqueue_transaction() is called to queued up a HIL packet. This function returns an error code, and this patch adds the necessary checks for this return code and disables the HIL driver if further packets can't be sent.
Tested on a HP 730 and a HP 715/64 machine.
--- drivers/input/serio/hil_mlc.c | 21 ++++++++++++++++++--- drivers/input/serio/hp_sdc_mlc.c | 8 ++++---- include/linux/hil_mlc.h | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-)
drivers/input/serio/hil_mlc.c +18 -3
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(hil_mlc_unregister);static LIST_HEAD (hil_mlcs);static DEFINE_RWLOCK (hil_mlcs_lock);static struct timer_list hil_mlcs_kicker; -static int hil_mlcs_probe; +static int hil_mlcs_probe, hil_mlc_stop;static void hil_mlcs_process (unsigned long unused); static DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
@@ -702,9 +702,13 @@ static int hilse_donode(hil_mlc *mlc)if (!mlc->ostarted) { mlc->ostarted =1 ; mlc->opacket = pack; - mlc->out (mlc); + rc = mlc->out (mlc); nextidx =HILSEN_DOZE ;write_unlock_irqrestore (&mlc->lock, flags); +if (rc) { + hil_mlc_stop =1 ; +return 1 ; + }break ; } mlc->ostarted =0 ;
@@ -715,8 +719,13 @@ static int hilse_donode(hil_mlc *mlc)case HILSE_CTS :write_lock_irqsave (&mlc->lock, flags); - nextidx = mlc->cts (mlc) ? node->bad : node->good; + rc = mlc->cts (mlc); + nextidx = rc ? node->bad : node->good;write_unlock_irqrestore (&mlc->lock, flags); +if (rc) { + hil_mlc_stop =1 ; +return 1 ; + }break ;default :
@@ -780,6 +789,12 @@ static void hil_mlcs_process(unsigned lostatic void hil_mlcs_timer (struct timer_list *unused) { +if (hil_mlc_stop) { +/* could not send packet - stop immediately. */ +pr_warn (PREFIX "HIL seems stuck - Disabling HIL MLC.\n" ); +return ; + } + hil_mlcs_probe =1 ;tasklet_schedule (&hil_mlcs_tasklet);/* Re-insert the periodic task. */
drivers/input/serio/hp_sdc_mlc.c +4 -4
@@ -210,7 +210,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc) priv->tseq[2 ] =1 ; priv->tseq[3 ] =0 ; priv->tseq[4 ] =0 ; -__hp_sdc_enqueue_transaction (&priv->trans); +return __hp_sdc_enqueue_transaction (&priv->trans); busy:return 1 ; done:
@@ -219,7 +219,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)return 0 ; } -static void hp_sdc_mlc_out (hil_mlc *mlc) +static int hp_sdc_mlc_out (hil_mlc *mlc) {struct hp_sdc_mlc_priv_s *priv;
@@ -234,7 +234,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc) do_data:if (priv->emtestmode) {up (&mlc->osem); -return ; +return 0 ; }/* Shouldn't be sending commands when loop may be busy */ BUG_ON (down_trylock (&mlc->csem));
@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)BUG_ON (down_trylock (&mlc->csem)); } enqueue: -hp_sdc_enqueue_transaction (&priv->trans); +return hp_sdc_enqueue_transaction (&priv->trans); }static int __init hp_sdc_mlc_init (void )
include/linux/hil_mlc.h +1 -1
@@ -103,7 +103,7 @@ struct hilse_node {/* Methods for back-end drivers, e.g. hp_sdc_mlc */ typedef int (hil_mlc_cts ) (hil_mlc *mlc); -typedef void (hil_mlc_out ) (hil_mlc *mlc); +typedef int (hil_mlc_out ) (hil_mlc *mlc);typedef int (hil_mlc_in ) (hil_mlc *mlc,suseconds_t timeout);struct hil_mlc_devinfo {
Greg Kroah-Hartman
maintainerPATCH 194/214 ext4: fix invalid inode checksum
In reply to Greg Kroah-HartmanFrom: Luo Meng <[email protected]>
commit 1322181170bb01bce3c228b82ae3d5c6b793164f upstream.
During the stability test, there are some errors:
ext4_lookup:1590: inode #6967: comm fsstress: iget: checksum invalid.
If the inode->i_iblocks too big and doesn't set huge file flag, checksum will not be recalculated when update the inode information to it's buffer. If other inode marks the buffer dirty, then the inconsistent inode will be flushed to disk.
Fix this problem by checking i_blocks in advance.
--- fs/ext4/inode.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/ext4/inode.c +6 -5
@@ -5271,6 +5271,12 @@ static int ext4_do_update_inode(handle_tif (ext4_test_inode_state (inode,EXT4_STATE_NEW ))memset (raw_inode,0 ,EXT4_SB (inode->i_sb)->s_inode_size); + err =ext4_inode_blocks_set (handle, raw_inode, ei); +if (err) { +spin_unlock (&ei->i_raw_lock); + goto out_brelse; + } + raw_inode->i_mode =cpu_to_le16 (inode->i_mode); i_uid =i_uid_read (inode); i_gid =i_gid_read (inode);
@@ -5304,11 +5310,6 @@ static int ext4_do_update_inode(handle_tEXT4_INODE_SET_XTIME (i_atime, inode, raw_inode);EXT4_EINODE_SET_XTIME (i_crtime, ei, raw_inode); - err =ext4_inode_blocks_set (handle, raw_inode, ei); -if (err) { -spin_unlock (&ei->i_raw_lock); - goto out_brelse; - } raw_inode->i_dtime =cpu_to_le32 (ei->i_dtime); raw_inode->i_flags =cpu_to_le32 (ei->i_flags &0xFFFFFFFF );if (likely (!test_opt2 (inode->i_sb,HURD_COMPAT )))
Greg Kroah-Hartman
maintainerPATCH 101/214 perf/x86/intel: Fix Ice Lake event constraint table
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
commit 010cb00265f150bf82b23c02ad1fb87ce5c781e1 upstream.
An error occues when sampling non-PEBS INST_RETIRED.PREC_DIST(0x01c0) event.
perf record -e cpu/event=0xc0,umask=0x01/ -- sleep 1 Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cpu/event=0xc0,umask=0x01/).
/bin/dmesg | grep -i perf may provide additional information.
The idxmsk64 of the event is set to 0. The event never be successfully scheduled.
The event should be limit to the fixed counter 0.
--- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/core.c +1 -1
@@ -243,7 +243,7 @@ static struct extra_reg intel_skl_extra_static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -INTEL_UEVENT_CONSTRAINT (0x1c0 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* INST_RETIRED.PREC_DIST */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */
Greg Kroah-Hartman
maintainerPATCH 201/214 arm64: berlin: Select DW_APB_TIMER_OF
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
commit b0fc70ce1f028e14a37c186d9f7a55e51439b83a upstream.
Berlin SoCs always contain some DW APB timers which can be used as an always-on broadcast timer.
--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
@@ -54,6 +54,7 @@ config ARCH_BCM_IPROC config ARCH_BERLIN bool "Marvell Berlin SoC Family" select DW_APB_ICTL + select DW_APB_TIMER_OF select GPIOLIB select PINCTRL help
Greg Kroah-Hartman
maintainerPATCH 197/214 mmc: sdhci-of-esdhc: set timeout to max before tuning
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
commit 0add6e9b88d0632a25323aaf4987dbacb0e4ae64 upstream.
On rare occations there is the following error:
mmc0: Tuning timeout, falling back to fixed sampling clock
There are SD cards which takes a significant longer time to reply to the first CMD19 command. The eSDHC takes the data timeout value into account during the tuning period. The SDHCI core doesn't explicitly set this timeout for the tuning procedure. Thus on the slow cards, there might be a spurious "Buffer Read Ready" interrupt, which in turn triggers a wrong sequence of events. In the end this will lead to an unsuccessful tuning procedure and to the above error.
To workaround this, set the timeout to the maximum value (which is the best we can do) and the SDHCI core will take care of the proper timeout handling.
--- drivers/mmc/host/sdhci-of-esdhc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +11 -0
@@ -1004,6 +1004,17 @@ static int esdhc_execute_tuning(struct mesdhc_tuning_block_enable (host, true); +/* +* The eSDHC controller takes the data timeout value into account +* during tuning. If the SD card is too slow sending the response, the +* timer will expire and a "Buffer Read Ready" interrupt without data +* is triggered. This leads to tuning errors. +* +* Just set the timeout to the maximum value because the core will +* already take care of it in sdhci_send_tuning(). +*/ +sdhci_writeb (host,0xe ,SDHCI_TIMEOUT_CONTROL ); + hs400_tuning = host->flags &SDHCI_HS400_TUNING ; do {
Greg Kroah-Hartman
maintainerPATCH 198/214 mmc: sdhci: Use Auto CMD Auto Select only when v4_mode is true
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
commit b3e1ea16fb39fb6e1a1cf1dbdd6738531de3dc7d upstream.
sdhci-of-dwcmshc meets an eMMC read performance regression with below command after commit 427b6514d095 ("mmc: sdhci: Add Auto CMD Auto Select support"):
dd if=/dev/mmcblk0 of=/dev/null bs=8192 count=100000
Before the commit, the above command gives 120MB/s After the commit, the above command gives 51.3 MB/s
So it looks like sdhci-of-dwcmshc expects Version 4 Mode for Auto CMD Auto Select. Fix the performance degradation by ensuring v4_mode is true to use Auto CMD Auto Select.
--- drivers/mmc/host/sdhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +4 -2
@@ -1162,9 +1162,11 @@ static inline void sdhci_auto_cmd_select/* * In case of Version 4.10 or later, use of 'Auto CMD Auto * Select' is recommended rather than use of 'Auto CMD12 -* Enable' or 'Auto CMD23 Enable'. +* Enable' or 'Auto CMD23 Enable'. We require Version 4 Mode +* here because some controllers (e.g sdhci-of-dwmshc) expect it. */ -if (host->version >=SDHCI_SPEC_410 && (use_cmd12 || use_cmd23)) { +if (host->version >=SDHCI_SPEC_410 && host->v4_mode && + (use_cmd12 || use_cmd23)) { *mode |=SDHCI_TRNS_AUTO_SEL ; ctrl2 =sdhci_readw (host,SDHCI_HOST_CONTROL2 );
Greg Kroah-Hartman
maintainerPATCH 209/214 KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 4a1c2c7f63c52ccb11770b5ae25920a6b79d3548 upstream.
The DBGD{CCINT,SCRext} and DBGVCR register entries in the cp14 array are missing their target register, resulting in all accesses being targetted at the guard sysreg (indexed by __INVALID_SYSREG__).
Point the emulation code at the actual register entries.
--- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -209,6 +209,7 @@ enum vcpu_sysreg {#define cp14_DBGWCR0 (DBGWCR0_EL1 * 2)#define cp14_DBGWVR0 (DBGWVR0_EL1 * 2)#define cp14_DBGDCCINT (MDCCINT_EL1 * 2) +#define cp14_DBGVCR (DBGVCR32_EL2 * 2)#define NR_COPRO_REGS (NR_SYS_REGS * 2)
arch/arm64/kvm/sys_regs.c +3 -3
@@ -1746,9 +1746,9 @@ static const struct sys_reg_desc cp14_re { Op1( 0), CRn( 0), CRm( 1), Op2( 0), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (1 ),/* DBGDCCINT */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32, NULL, cp14_DBGDCCINT },/* DBGDSCRext */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32, NULL, cp14_DBGDSCRext },DBG_BCR_BVR_WCR_WVR (2 ),/* DBGDTR[RT]Xint */ { Op1( 0), CRn( 0), CRm( 3), Op2( 0), trap_raz_wi },
@@ -1763,7 +1763,7 @@ static const struct sys_reg_desc cp14_re { Op1( 0), CRn( 0), CRm( 6), Op2( 2), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (6 ),/* DBGVCR */ - { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32, NULL, cp14_DBGVCR },DBG_BCR_BVR_WCR_WVR (7 ),DBG_BCR_BVR_WCR_WVR (8 ), DBG_BCR_BVR_WCR_WVR(9),
Greg Kroah-Hartman
maintainerPATCH 205/214 ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 7be0d19c751b02db778ca95e3274d5ea7f31891c upstream.
Selecting CONFIG_SAMSUNG_PM_DEBUG (depending on CONFIG_DEBUG_LL) but without CONFIG_MMU leads to build errors:
arch/arm/plat-samsung/pm-debug.c: In function ‘s3c_pm_uart_base’:
arch/arm/plat-samsung/pm-debug.c:57:2: error:
implicit declaration of function ‘debug_ll_addr’ [-Werror=implicit-function-declaration]
--- arch/arm/plat-samsung/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/plat-samsung/Kconfig +1 -0
@@ -241,6 +241,7 @@ config SAMSUNG_PM_DEBUG depends on PM && DEBUG_KERNEL depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART + depends on DEBUG_LL && MMU help Say Y here if you want verbose debugging from the PM Suspend and Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
Greg Kroah-Hartman
maintainerPATCH 195/214 ext4: fix superblock checksum calculation race
In reply to Greg Kroah-HartmanFrom: Constantine Sapuntzakis <[email protected]>
commit acaa532687cdc3a03757defafece9c27aa667546 upstream.
The race condition could cause the persisted superblock checksum to not match the contents of the superblock, causing the superblock to be considered corrupt.
An example of the race follows. A first thread is interrupted in the middle of a checksum calculation. Then, another thread changes the superblock, calculates a new checksum, and sets it. Then, the first thread resumes and sets the checksum based on the older superblock.
To fix, serialize the superblock checksum calculation using the buffer header lock. While a spinlock is sufficient, the buffer header is already there and there is precedent for locking it (e.g. in ext4_commit_super).
Tested the patch by booting up a kernel with the patch, creating a filesystem and some files (including some orphans), and then unmounting and remounting the file system.
--- fs/ext4/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/ext4/super.c +11 -0
@@ -201,7 +201,18 @@ void ext4_superblock_csum_set(struct supif (!ext4_has_metadata_csum (sb))return ; +/* +* Locking the superblock prevents the scenario +* where: +* 1) a first thread pauses during checksum calculation. +* 2) a second thread updates the superblock, recalculates +* the checksum, and updates s_checksum +* 3) the first thread resumes and finishes its checksum calculation +* and updates s_checksum with a potentially stale or torn value. +*/ +lock_buffer (EXT4_SB (sb)->s_sbh); es->s_checksum =ext4_superblock_csum (sb, es); +unlock_buffer (EXT4_SB (sb)->s_sbh); }void *ext4_kvmalloc (size_t size,gfp_t flags)
Greg Kroah-Hartman
maintainerPATCH 163/214 powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
In reply to Greg Kroah-HartmanFrom: Michael Neuling <[email protected]>
commit 1da4a0272c5469169f78cd76cf175ff984f52f06 upstream.
__get_user_atomic_128_aligned() stores to kaddr using stvx which is a VMX store instruction, hence kaddr must be 16 byte aligned otherwise the store won't occur as expected.
Unfortunately when we call __get_user_atomic_128_aligned() in p9_hmi_special_emu(), the buffer we pass as kaddr (ie. vbuf) isn't guaranteed to be 16B aligned. This means that the write to vbuf in __get_user_atomic_128_aligned() has the bottom bits of the address truncated. This results in other local variables being overwritten. Also vbuf will not contain the correct data which results in the userspace emulation being wrong and hence undetected user data corruption.
In the past we've been mostly lucky as vbuf has ended up aligned but this is fragile and isn't always true. CONFIG_STACKPROTECTOR in particular can change the stack arrangement enough that our luck runs out.
This issue only occurs on POWER9 Nimbus <= DD2.1 bare metal.
The fix is to align vbuf to a 16 byte boundary.
--- arch/powerpc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +1 -1
@@ -877,7 +877,7 @@ static void p9_hmi_special_emu(struct pt {unsigned int ra, rb, t, i, sel, instr, rc;const void __user *addr; -u8 vbuf[16 ], *vdst; +u8 vbuf[16 ]__aligned(16) , *vdst;unsigned long ea, msr, msr_mask;bool swap;
Greg Kroah-Hartman
maintainerPATCH 162/214 powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 2c637d2df4ee4830e9d3eb2bd5412250522ce96e upstream.
low_sleep_handler() has an hardcoded restore of segment registers that doesn't take KUAP and KUEP into account.
Use head_32's load_segment_registers() routine instead.
--- arch/powerpc/kernel/head_32.S | 2 +- arch/powerpc/platforms/powermac/sleep.S | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-)
arch/powerpc/kernel/head_32.S +1 -1
@@ -843,7 +843,7 @@ BEGIN_MMU_FTR_SECTION END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) blr -load_segment_registers: +_GLOBAL(load_segment_registers) li r0, NUM_USER_SEGMENTS /* load up user segment register values */ mtctr r0 /* for context 0 */ li r3, 0 /* Kp = 0, Ks = 0, VSID = 0 */
arch/powerpc/platforms/powermac/sleep.S +1 -8
@@ -293,14 +293,7 @@ grackle_wake_up: * we do any r1 memory access as we are not sure they * are in a sane state above the first 256Mb region */ - li r0,16 /* load up segment register values */ - mtctr r0 /* for context 0 */ - lis r3,0x2000 /* Ku = 1, VSID = 0 */ - li r4,0 -3: mtsrin r3,r4 - addi r3,r3,0x111 /* increment VSID */ - addis r4,r4,0x1000 /* address of next segment */ - bdnz 3b + bl load_segment_registers sync isync
Greg Kroah-Hartman
maintainerPATCH 192/214 ext4: fix leaking sysfs kobject after failed mount
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit cb8d53d2c97369029cc638c9274ac7be0a316c75 upstream.
ext4_unregister_sysfs() only deletes the kobject. The reference to it needs to be put separately, like ext4_put_super() does.
This addresses the syzbot report
"memory leak in kobject_set_name_vargs (3)"
(https://syzkaller.appspot.com/bug?extid=9f864abad79fae7c17e1).
--- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/super.c +1 -0
@@ -4684,6 +4684,7 @@ cantfind_ext4: failed_mount8:ext4_unregister_sysfs (sb); +kobject_put (&sbi->s_kobj); failed_mount7:ext4_unregister_li_request (sb); failed_mount6:
Greg Kroah-Hartman
maintainerPATCH 186/214 drm/amd/display: Fix kernel panic by dal_gpio_open() error
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 920bb38c518408fa2600eaefa0af9e82cf48f166 upstream.
Currently both error code paths handled in dal_gpio_open_ex() issues ASSERT_CRITICAL(), and this leads to a kernel panic unnecessarily if CONFIG_KGDB is enabled. Since basically both are non-critical errors and can be recovered, drop those assert calls and use a safer one, BREAK_TO_DEBUGGER(), for allowing the debugging, instead.
--- drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c +2 -2
@@ -63,13 +63,13 @@ enum gpio_result dal_gpio_open_ex( enum gpio_mode mode) {if (gpio->pin) { -ASSERT_CRITICAL (false); +BREAK_TO_DEBUGGER ();return GPIO_RESULT_ALREADY_OPENED ; }// No action if allocation failed during gpio construct if (!gpio->hw_container.ddc) { -ASSERT_CRITICAL (false); +BREAK_TO_DEBUGGER ();return GPIO_RESULT_NON_SPECIFIC_ERROR ; } gpio->mode = mode;
Greg Kroah-Hartman
maintainerPATCH 181/214 drm/amdgpu: correct the gpu reset handling for job != NULL case
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 207ac684792560acdb9e06f9d707ebf63c84b0e0 upstream.
Current code wrongly treat all cases as job == NULL.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3890,7 +3890,7 @@ retry: /* Rest of adevs pre asic reset famdgpu_device_lock_adev (tmp_adev, false); r =amdgpu_device_pre_asic_reset (tmp_adev, -NULL , + (tmp_adev == adev) ? job :NULL , &need_full_reset);/*TODO Should we stop ?*/ if (r) {
Greg Kroah-Hartman
maintainerPATCH 178/214 i2c: imx: Fix external abort on interrupt in exit paths
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit e50e4f0b85be308a01b830c5fbdffc657e1a6dd0 upstream.
If interrupt comes late, during probe error path or device remove (could be triggered with CONFIG_DEBUG_SHIRQ), the interrupt handler i2c_imx_isr() will access registers with the clock being disabled. This leads to external abort on non-linefetch on Toradex Colibri VF50 module (with Vybrid VF5xx):
Unhandled fault: external abort on non-linefetch (0x1008) at 0x8882d003
Internal error: : 1008 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.7.0 #607
Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
(i2c_imx_isr) from [<8017009c>] (free_irq+0x25c/0x3b0)
(free_irq) from [<805844ec>] (release_nodes+0x178/0x284)
(release_nodes) from [<80580030>] (really_probe+0x10c/0x348)
(really_probe) from [<80580380>] (driver_probe_device+0x60/0x170)
(driver_probe_device) from [<80580630>] (device_driver_attach+0x58/0x60)
(device_driver_attach) from [<805806bc>] (__driver_attach+0x84/0xc0)
(__driver_attach) from [<8057e228>] (bus_for_each_dev+0x68/0xb4)
(bus_for_each_dev) from [<8057f3ec>] (bus_add_driver+0x144/0x1ec)
(bus_add_driver) from [<80581320>] (driver_register+0x78/0x110)
(driver_register) from [<8010213c>] (do_one_initcall+0xa8/0x2f4)
(do_one_initcall) from [<80c0100c>] (kernel_init_freeable+0x178/0x1dc)
(kernel_init_freeable) from [<80807048>] (kernel_init+0x8/0x110)
(kernel_init) from [<80100114>] (ret_from_fork+0x14/0x20)Additionally, the i2c_imx_isr() could wake up the wait queue (imx_i2c_struct->queue) before its initialization happens.
The resource-managed framework should not be used for interrupt handling, because the resource will be released too late - after disabling clocks. The interrupt handler is not prepared for such case.
--- drivers/i2c/busses/i2c-imx.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/i2c/busses/i2c-imx.c +13 -11
@@ -1112,14 +1112,6 @@ static int i2c_imx_probe(struct platformreturn ret; } -/* Request IRQ */ - ret =devm_request_irq (&pdev->dev, irq, i2c_imx_isr,IRQF_SHARED , - pdev->name, i2c_imx); -if (ret) { -dev_err (&pdev->dev,"can't claim irq %d\n" , irq); - goto clk_disable; - } -/* Init queue */ init_waitqueue_head (&i2c_imx->queue);
@@ -1138,6 +1130,14 @@ static int i2c_imx_probe(struct platformif (ret <0 ) goto rpm_disable; +/* Request IRQ */ + ret =request_threaded_irq (irq, i2c_imx_isr,NULL ,IRQF_SHARED , + pdev->name, i2c_imx); +if (ret) { +dev_err (&pdev->dev,"can't claim irq %d\n" , irq); + goto rpm_disable; + } +/* Set up clock divider */ i2c_imx->bitrate =IMX_I2C_BIT_RATE ; ret = of_property_read_u32(pdev->dev.of_node,
@@ -1180,13 +1180,12 @@ static int i2c_imx_probe(struct platform clk_notifier_unregister:clk_notifier_unregister (i2c_imx->clk, &i2c_imx->clk_change_nb); +free_irq (irq, i2c_imx); rpm_disable:pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);pm_runtime_dont_use_autosuspend (&pdev->dev); - -clk_disable:clk_disable_unprepare (i2c_imx->clk);return ret; }
@@ -1194,7 +1193,7 @@ clk_disable:static int i2c_imx_remove (struct platform_device *pdev) {struct imx_i2c_struct *i2c_imx =platform_get_drvdata (pdev); -int ret; +int irq, ret; ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 )
@@ -1214,6 +1213,9 @@ static int i2c_imx_remove(struct platforimx_i2c_write_reg (0 , i2c_imx,IMX_I2C_I2SR );clk_notifier_unregister (i2c_imx->clk, &i2c_imx->clk_change_nb); + irq =platform_get_irq (pdev,0 ); +if (irq >=0 ) +free_irq (irq, i2c_imx);clk_disable_unprepare (i2c_imx->clk);pm_runtime_put_noidle (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 177/214 rtc: rx8010: dont modify the global rtc ops
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
commit d3b14296da69adb7825022f3224ac6137eb30abf upstream.
The way the driver is implemented is buggy for the (admittedly unlikely) use case where there are two RTCs with one having an interrupt configured and the second not. This is caused by the fact that we use a global rtc_class_ops struct which we modify depending on whether the irq number is present or not.
Fix it by using two const ops structs with and without alarm operations. While at it: not being able to request a configured interrupt is an error so don't ignore it and bail out of probe().
--- drivers/rtc/rtc-rx8010.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/rtc/rtc-rx8010.c +17 -7
@@ -424,16 +424,26 @@ static int rx8010_ioctl(struct device *d } } -static struct rtc_class_ops rx8010_rtc_ops = { +static const struct rtc_class_ops rx8010_rtc_ops_default = { .read_time = rx8010_get_time, .set_time = rx8010_set_time, .ioctl = rx8010_ioctl, }; +static const struct rtc_class_ops rx8010_rtc_ops_alarm = { + .read_time = rx8010_get_time, + .set_time = rx8010_set_time, + .ioctl = rx8010_ioctl, + .read_alarm = rx8010_read_alarm, + .set_alarm = rx8010_set_alarm, + .alarm_irq_enable = rx8010_alarm_irq_enable, +}; +static int rx8010_probe (struct i2c_client *client,const struct i2c_device_id *id) {struct i2c_adapter *adapter = client->adapter; +const struct rtc_class_ops *rtc_ops;struct rx8010_data *rx8010;int err =0 ;
@@ -464,16 +474,16 @@ static int rx8010_probe(struct i2c_clienif (err) {dev_err (&client->dev,"unable to request IRQ\n" ); - client->irq =0 ; - }else { - rx8010_rtc_ops.read_alarm = rx8010_read_alarm; - rx8010_rtc_ops.set_alarm = rx8010_set_alarm; - rx8010_rtc_ops.alarm_irq_enable = rx8010_alarm_irq_enable; +return err; } + + rtc_ops = &rx8010_rtc_ops_alarm; + }else { + rtc_ops = &rx8010_rtc_ops_default; } rx8010->rtc =devm_rtc_device_register (&client->dev, client->name, - &rx8010_rtc_ops,THIS_MODULE ); + rtc_ops,THIS_MODULE );if (IS_ERR (rx8010->rtc)) {dev_err (&client->dev,"unable to register the class device\n" );
Greg Kroah-Hartman
maintainerPATCH 156/214 MIPS: DEC: Restore bootmem reservation for firmware working memory area
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit cf3af0a4d3b62ab48e0b90180ea161d0f5d4953f upstream.
Fix a crash on DEC platforms starting with:
VFS: Mounted root (nfs filesystem) on device 0:11. Freeing unused PROM memory: 124k freed
BUG: Bad page state in process swapper pfn:00001
page:(ptrval) refcount:0 mapcount:-128 mapping:00000000 index:0x1 pfn:0x1
flags: 0x0()
raw: 00000000 00000100 00000122 00000000 00000001 00000000 ffffff7f 00000000
page dumped because: nonzero mapcount
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.9.0-00858-g865c50e1d279 #1
Stack : 8065dc48 0000000b 8065d2b8 9bc27dcc 80645bfc 9bc259a4 806a1b97 80703124
80710000 8064a900 00000001 80099574 806b116c 1000ec00 9bc27d88 806a6f30
00000000 00000000 80645bfc 00000000 31232039 80706ba4 2e392e35 8039f348
2d383538 00000070 0000000a 35363867 00000000 806c2830 80710000 806b0000
80710000 8064a900 00000001 81000000 00000000 00000000 8035af2c 80700000
...
Call Trace:
[<8004bc5c>] show_stack+0x34/0x104
[<8015675c>] bad_page+0xfc/0x128
[<80157714>] free_pcppages_bulk+0x1f4/0x5dc
[<801591cc>] free_unref_page+0xc0/0x130
[<8015cb04>] free_reserved_area+0x144/0x1d8
[<805abd78>] kernel_init+0x20/0x100
[<80046070>] ret_from_kernel_thread+0x14/0x1cDisabling lock debugging due to kernel taint
caused by an attempt to free bootmem space that as from
commit b93ddc4f9156 ("mips: Reserve memory for the kernel image resources") has not been anymore reserved due to the removal of generic MIPS arch code that used to reserve all the memory from the beginning of RAM up to the kernel load address.
This memory does need to be reserved on DEC platforms however as it is used by REX firmware as working area, as per the TURBOchannel firmware specification[1]:
Table 2-2 REX Memory Regions
-------------------------------------------------------------------------
Starting Ending
Region Address Address Use
-------------------------------------------------------------------------
0 0xa0000000 0xa000ffff Restart block, exception vectors,
REX stack and bss
1 0xa0010000 0xa0017fff Keyboard or tty drivers
2 0xa0018000 0xa001f3ff 1) CRT driver
3 0xa0020000 0xa002ffff boot, cnfg, init and t objects
4 0xa0020000 0xa002ffff 64KB scratch space
-------------------------------------------------------------------------
1) Note that the last 3 Kbytes of region 2 are reserved for backward compatibility with previous system software.
-------------------------------------------------------------------------
(this table uses KSEG2 unmapped virtual addresses, which in the MIPS architecture are offset from physical addresses by a fixed value of 0xa0000000 and therefore the regions referred do correspond to the beginning of the physical address space) and we call into the firmware on several occasions throughout the bootstrap process. It is believed that pre-REX firmware used with non-TURBOchannel DEC platforms has the same requirements, as hinted by note #1 cited.
Recreate the discarded reservation then, in DEC platform code, removing the crash.
[1] "TURBOchannel Firmware Specification", On-line version, EK-TCAAD-FS-004, Digital Equipment Corporation, January 1993, Chapter 2 "System Module Firmware", p. 2-5
--- arch/mips/dec/setup.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/mips/dec/setup.c +8 -1
@@ -6,7 +6,7 @@* for more details. * * Copyright (C) 1998 Harald Koerfgen -* Copyright (C) 2000, 2001, 2002, 2003, 2005 Maciej W. Rozycki +* Copyright (C) 2000, 2001, 2002, 2003, 2005, 2020 Maciej W. Rozycki */ #include <linux/console.h> #include <linux/export.h>
@@ -15,6 +15,7 @@#include <linux/ioport.h> #include <linux/irq.h> #include <linux/irqnr.h> +#include <linux/memblock.h> #include <linux/param.h> #include <linux/percpu-defs.h> #include <linux/sched.h>
@@ -22,6 +23,7 @@#include <linux/types.h> #include <linux/pm.h> +#include <asm/addrspace.h> #include <asm/bootinfo.h> #include <asm/cpu.h> #include <asm/cpu-features.h>
@@ -29,7 +31,9 @@#include <asm/irq.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h> +#include <asm/page.h> #include <asm/reboot.h> +#include <asm/sections.h> #include <asm/time.h> #include <asm/traps.h> #include <asm/wbflush.h>
@@ -166,6 +170,9 @@ void __init plat_mem_setup(void) ioport_resource.start = ~0UL ; ioport_resource.end =0UL ; + +/* Stay away from the firmware working memory area for now. */ +memblock_reserve (PHYS_OFFSET ,__pa_symbol (&_text) -PHYS_OFFSET ); }/*
Greg Kroah-Hartman
maintainerPATCH 187/214 ceph: promote to unsigned long long before shifting
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit c403c3a2fbe24d4ed33e10cabad048583ebd4edf upstream.
On 32-bit systems, this shift will overflow for files larger than 4GB.
--- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/addr.c +1 -1
@@ -1427,7 +1427,7 @@ static vm_fault_t ceph_filemap_fault(strstruct ceph_inode_info *ci =ceph_inode (inode);struct ceph_file_info *fi = vma->vm_file->private_data;struct page *pinned_page =NULL ; -loff_t off = vmf->pgoff <<PAGE_SHIFT ; +loff_t off = (loff_t )vmf->pgoff <<PAGE_SHIFT ;int want, got, err;sigset_t oldset;vm_fault_t ret =VM_FAULT_SIGBUS ;
Greg Kroah-Hartman
maintainerPATCH 172/214 ubifs: mount_ubifs: Release authentication resource in error handling path
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit e2a05cc7f8229e150243cdae40f2af9021d67a4a upstream.
Release the authentication related resource in some error handling branches in mount_ubifs().
--- fs/ubifs/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ubifs/super.c +6 -4
@@ -1313,7 +1313,7 @@ static int mount_ubifs(struct ubifs_info err =ubifs_read_superblock (c);if (err) - goto out_free; + goto out_auth; c->probing =0 ;
@@ -1325,18 +1325,18 @@ static int mount_ubifs(struct ubifs_infoubifs_err (c,"'compressor \"%s\" is not compiled in" ,ubifs_compr_name (c, c->default_compr)); err = -ENOTSUPP ; - goto out_free; + goto out_auth; } err =init_constants_sb (c);if (err) - goto out_free; + goto out_auth; sz =ALIGN (c->max_idx_node_sz, c->min_io_size) *2 ; c->cbuf =kmalloc (sz,GFP_NOFS );if (!c->cbuf) { err = -ENOMEM ; - goto out_free; + goto out_auth; } err =alloc_wbufs (c);
@@ -1611,6 +1611,8 @@ out_wbufs:free_wbufs (c); out_cbuf:kfree (c->cbuf); +out_auth: +ubifs_exit_authentication (c); out_free:kfree (c->write_reserve_buf);kfree (c->bu.buf);
Greg Kroah-Hartman
maintainerPATCH 169/214 ubifs: journal: Make sure to not dirty twice for auth nodes
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
commit 78c7d49f55d8631b67c09f9bfbe8155211a9ea06 upstream.
When removing the last reference of an inode the size of an auth node is already part of write_len. So we must not call ubifs_add_auth_dirt(). Call it only when needed.
--- fs/ubifs/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/journal.c +2 -2
@@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_i inode->i_ino);release_head (c,BASEHD ); -ubifs_add_auth_dirt (c, lnum); -if (last_reference) { err =ubifs_tnc_remove_ino (c, inode->i_ino);if (err)
@@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_i }else {union ubifs_key key; +ubifs_add_auth_dirt (c, lnum); +ino_key_init (c, &key, inode->i_ino); err =ubifs_tnc_add (c, &key, lnum, offs, ilen, hash); }
Greg Kroah-Hartman
maintainerPATCH 119/214 scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 2f4843b172c2c0360ee7792ad98025fae7baefde upstream.
The mptscsih_remove() function triggers a kernel oops if the Scsi_Host pointer (ioc->sh) is NULL, as can be seen in this syslog:
ioc0: LSI53C1030 B2: Capabilities={Initiator,Target}
Begin: Waiting for root file system ...
scsi host2: error handler thread failed to spawn, error = -4
mptspi: ioc0: WARNING - Unable to register controller with SCSI subsystem
Backtrace: [<000000001045b7cc>] mptspi_probe+0x248/0x3d0 [mptspi] [<0000000040946470>] pci_device_probe+0x1ac/0x2d8 [<0000000040add668>] really_probe+0x1bc/0x988 [<0000000040ade704>] driver_probe_device+0x160/0x218 [<0000000040adee24>] device_driver_attach+0x160/0x188 [<0000000040adef90>] __driver_attach+0x144/0x320 [<0000000040ad7c78>] bus_for_each_dev+0xd4/0x158 [<0000000040adc138>] driver_attach+0x4c/0x80 [<0000000040adb3ec>] bus_add_driver+0x3e0/0x498 [<0000000040ae0130>] driver_register+0xf4/0x298 [<00000000409450c4>] __pci_register_driver+0x78/0xa8 [<000000000007d248>] mptspi_init+0x18c/0x1c4 [mptspi]
This patch adds the necessary NULL-pointer checks. Successfully tested on a HP C8000 parisc workstation with buggy SCSI drives.
--- drivers/message/fusion/mptscsih.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/message/fusion/mptscsih.c +8 -5
@@ -1176,8 +1176,10 @@ mptscsih_remove(struct pci_dev *pdev)MPT_SCSI_HOST *hd;int sz1; -if ((hd =shost_priv (host)) ==NULL ) -return ; +if (host ==NULL ) + hd =NULL ; +else + hd =shost_priv (host);mptscsih_shutdown (pdev);
@@ -1193,14 +1195,15 @@ mptscsih_remove(struct pci_dev *pdev)"Free'd ScsiLookup (%d) memory\n" , ioc->name, sz1)); -kfree (hd->info_kbuf); +if (hd) +kfree (hd->info_kbuf);/* NULL the Scsi_Host pointer */ ioc->sh =NULL ; -scsi_host_put (host); - +if (host) +scsi_host_put (host);mpt_detach (pdev); }
Greg Kroah-Hartman
maintainerPATCH 121/214 PM: runtime: Remove link state checks in rpm_get/put_supplier()
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
commit d12544fb2aa9944b180c35914031a8384ab082c1 upstream.
To support runtime PM for hisi SAS driver (the driver is in directory drivers/scsi/hisi_sas), we add device link between scsi_device->sdev_gendev (consumer device) and hisi_hba->dev(supplier device) with flags DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE.
After runtime suspended consumers and supplier, unload the dirver which causes a hung.
We found that it called function device_release_driver_internal() to release the supplier device (hisi_hba->dev), as the device link was busy, it set the device link state to DL_STATE_SUPPLIER_UNBIND, and then it called device_release_driver_internal() to release the consumer device (scsi_device->sdev_gendev).
Then it would try to call pm_runtime_get_sync() to resume the consumer device, but because consumer-supplier relation existed, it would try to resume the supplier first, but as the link state was already DL_STATE_SUPPLIER_UNBIND, so it skipped resuming the supplier and only resumed the consumer which hanged (it sends IOs to resume scsi_device while the SAS controller is suspended).
Simple flow is as follows:
device_release_driver_internal -> (supplier device)
if device_links_busy ->
device_links_unbind_consumers ->
...
WRITE_ONCE(link->status, DL_STATE_SUPPLIER_UNBIND)
device_release_driver_internal (consumer device)
pm_runtime_get_sync -> (consumer device)
...
__rpm_callback ->
rpm_get_suppliers ->
if link->state == DL_STATE_SUPPLIER_UNBIND -> skip the action of resuming the supplier
...
pm_runtime_clean_up_links
...Correct suspend/resume ordering between a supplier device and its consumer devices (resume the supplier device before resuming consumer devices, and suspend consumer devices before suspending the supplier device) should be guaranteed by runtime PM, but the state checks in rpm_get_supplier() and rpm_put_supplier() break this rule, so remove them.
--- drivers/base/power/runtime.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/base/power/runtime.c +1 -4
@@ -291,8 +291,7 @@ static int rpm_get_suppliers(struct devi device_links_read_lock_held()) {int retval; -if (!(link->flags &DL_FLAG_PM_RUNTIME ) || -READ_ONCE (link->status) ==DL_STATE_SUPPLIER_UNBIND ) +if (!(link->flags &DL_FLAG_PM_RUNTIME ))continue ; retval =pm_runtime_get_sync (link->supplier);
@@ -312,8 +311,6 @@ static void rpm_put_suppliers(struct devlist_for_each_entry_rcu (link, &dev->links.suppliers, c_node,device_links_read_lock_held ()) { -if (READ_ONCE (link->status) ==DL_STATE_SUPPLIER_UNBIND ) -continue ;while (refcount_dec_not_one (&link->rpm_active))pm_runtime_put (link->supplier);
Greg Kroah-Hartman
maintainerPATCH 152/214 iio:adc:ti-adc0832 Fix alignment issue with timestamp
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
commit 39e91f3be4cba51c1560bcda3a343ed1f64dc916 upstream.
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack.
We fix this issues by moving to a suitable structure in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak apart from previous readings. Note that previously no data could leak 'including' previous readings but I don't think it is an issue to potentially leak them like this now does.
In this case the postioning of the timestamp is depends on what other channels are enabled. As such we cannot use a structure to make the alignment explicit as it would be missleading by suggesting only one possible location for the timestamp.
--- drivers/iio/adc/ti-adc0832.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-adc0832.c +8 -3
@@ -28,6 +28,12 @@ struct adc0832 {struct regulator *reg;struct mutex lock;u8 mux_bits; +/* +* Max size needed: 16x 1 byte ADC data + 8 bytes timestamp +* May be shorter if not all channels are enabled subject +* to the timestamp remaining 8 byte aligned. +*/ +u8 data[24 ]__aligned(8) ;u8 tx_buf[2 ]____cacheline_aligned ;u8 rx_buf[2 ];
@@ -199,7 +205,6 @@ static irqreturn_t adc0832_trigger_handlstruct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adc0832 *adc =iio_priv (indio_dev); -u8 data[24 ] = { };/* 16x 1 byte ADC data + 8 bytes timestamp */ int scan_index;int i =0 ;
@@ -217,10 +222,10 @@ static irqreturn_t adc0832_trigger_handl goto out; } - data[i] = ret; + adc->data[i] = ret; i++; } -iio_push_to_buffers_with_timestamp (indio_dev, data, +iio_push_to_buffers_with_timestamp (indio_dev, adc->data,iio_get_time_ns (indio_dev)); out:mutex_unlock (&adc->lock);
Greg Kroah-Hartman
maintainerPATCH 148/214 udf: Fix memory leak when mounting
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit a7be300de800e755714c71103ae4a0d205e41e99 upstream.
udf_process_sequence() allocates temporary array for processing partition descriptors on volume which it fails to free. Free the array when it is not needed anymore.
--- fs/udf/super.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
fs/udf/super.c +13 -8
@@ -1703,7 +1703,8 @@ static noinline int udf_process_sequence"Pointers (max %u supported)\n" , UDF_MAX_TD_NESTING);brelse (bh); -return -EIO ; + ret = -EIO ; + goto out; } vdp = (struct volDescPtr *)bh->b_data;
@@ -1723,7 +1724,8 @@ static noinline int udf_process_sequence curr =get_volume_descriptor_record (ident, bh, &data);if (IS_ERR (curr)) {brelse (bh); -return PTR_ERR (curr); + ret =PTR_ERR (curr); + goto out; }/* Descriptor we don't care about? */ if (!curr)
@@ -1745,28 +1747,31 @@ static noinline int udf_process_sequence*/ if (!data.vds[VDS_POS_PRIMARY_VOL_DESC ].block) {udf_err (sb,"Primary Volume Descriptor not found!\n" ); -return -EAGAIN ; + ret = -EAGAIN ; + goto out; } ret =udf_load_pvoldesc (sb, data.vds[VDS_POS_PRIMARY_VOL_DESC ].block);if (ret <0 ) -return ret; + goto out;if (data.vds[VDS_POS_LOGICAL_VOL_DESC ].block) { ret =udf_load_logicalvol (sb, data.vds[VDS_POS_LOGICAL_VOL_DESC ].block, fileset);if (ret <0 ) -return ret; + goto out; }/* Now handle prevailing Partition Descriptors */ for (i =0 ; i < data.num_part_descs; i++) { ret =udf_load_partdesc (sb, data.part_descs_loc[i].rec.block);if (ret <0 ) -return ret; + goto out; } - -return 0 ; + ret =0 ; +out: +kfree (data.part_descs_loc); +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 146/214 vt: keyboard, extend func_buf_lock to readers
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
commit 82e61c3909db51d91b9d3e2071557b6435018b80 upstream.
Both read-side users of func_table/func_buf need locking. Without that, one can easily confuse the code by repeatedly setting altering strings like:
while (1)
for (a = 0; a < 2; a++) {
struct kbsentry kbs = {};
strcpy((char *)kbs.kb_string, a ? ".\n" : "88888\n");
ioctl(fd, KDSKBSENT, &kbs);
}When that program runs, one can get unexpected output by holding F1 (note the unxpected period on the last line):
.
88888
.8888
So protect all accesses to 'func_table' (and func_buf) by preexisting 'func_buf_lock'.
It is easy in 'k_fn' handler as 'puts_queue' is expected not to sleep. On the other hand, KDGKBSENT needs a local (atomic) copy of the string because copy_to_user can sleep. Use already allocated, but unused 'kbs->kb_string' for that purpose.
Note that the program above needs at least CAP_SYS_TTY_CONFIG.
This depends on the previous patch and on the func_buf_lock lock added in commit 46ca3f735f34 (tty/vt: fix write/write race in ioctl(KDSKBSENT) handler) in 5.2.
Likely fixes CVE-2020-25656.
--- drivers/tty/vt/keyboard.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/tty/vt/keyboard.c +13 -4
@@ -742,8 +742,13 @@ static void k_fn(struct vc_data *vc, unsreturn ;if ((unsigned )value <ARRAY_SIZE (func_table)) { +unsigned long flags; + +spin_lock_irqsave (&func_buf_lock, flags);if (func_table[value])puts_queue (vc, func_table[value]); +spin_unlock_irqrestore (&func_buf_lock, flags); + }else pr_err ("k_fn called with value=%d\n" , value); }
@@ -1990,7 +1995,7 @@ out:#undef s#undef v -/* FIXME: This one needs untangling and locking */ +/* FIXME: This one needs untangling */ int vt_do_kdgkb_ioctl (int cmd,struct kbsentry __user *user_kdgkb,int perm) {struct kbsentry *kbs;
@@ -2022,10 +2027,14 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbswitch (cmd) {case KDGKBSENT : {/* size should have been a struct member */ -unsigned char *from = func_table[i] ? :"" ; +ssize_t len =sizeof (user_kdgkb->kb_string); + +spin_lock_irqsave (&func_buf_lock, flags); + len =strlcpy (kbs->kb_string, func_table[i] ? :"" , len); +spin_unlock_irqrestore (&func_buf_lock, flags); - ret =copy_to_user (user_kdgkb->kb_string, from, -strlen (from) +1 ) ? -EFAULT :0 ; + ret =copy_to_user (user_kdgkb->kb_string, kbs->kb_string, + len +1 ) ? -EFAULT :0 ; goto reterr; }
Greg Kroah-Hartman
maintainerPATCH 145/214 vt: keyboard, simplify vt_kdgkbsent
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
commit 6ca03f90527e499dd5e32d6522909e2ad390896b upstream.
Use 'strlen' of the string, add one for NUL terminator and simply do 'copy_to_user' instead of the explicit 'for' loop. This makes the KDGKBSENT case more compact.
The only thing we need to take care about is NULL 'func_table[i]'. Use an empty string in that case.
The original check for overflow could never trigger as the func_buf strings are always shorter or equal to 'struct kbsentry's.
--- drivers/tty/vt/keyboard.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
drivers/tty/vt/keyboard.c +9 -19
@@ -1994,9 +1994,7 @@ out:int vt_do_kdgkb_ioctl (int cmd,struct kbsentry __user *user_kdgkb,int perm) {struct kbsentry *kbs; -char *p;u_char *q; -u_char __user *up;int sz, fnw_sz;int delta;char *first_free, *fj, *fnw;
@@ -2022,23 +2020,15 @@ int vt_do_kdgkb_ioctl(int cmd, struct kb i = kbs->kb_func;switch (cmd) { -case KDGKBSENT : - sz =sizeof (kbs->kb_string) -1 ;/* sz should have been -a struct member */ - up = user_kdgkb->kb_string; - p = func_table[i]; -if (p) -for ( ; *p && sz; p++, sz--) -if (put_user (*p, up++)) { - ret = -EFAULT ; - goto reterr; - } -if (put_user ('\0' , up)) { - ret = -EFAULT ; - goto reterr; - } -kfree (kbs); -return ((p && *p) ? -EOVERFLOW :0 ); +case KDGKBSENT : { +/* size should have been a struct member */ +unsigned char *from = func_table[i] ? :"" ; + + ret =copy_to_user (user_kdgkb->kb_string, from, +strlen (from) +1 ) ? -EFAULT :0 ; + + goto reterr; + }case KDSKBSENT :if (!perm) { ret = -EPERM ;
Greg Kroah-Hartman
maintainerPATCH 144/214 drm/i915: Force VTd workarounds when running as a guest OS
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 8195400f7ea95399f721ad21f4d663a62c65036f upstream.
If i915.ko is being used as a passthrough device, it does not know if the host is using intel_iommu. Mixing the iommu and gfx causes a few issues (such as scanout overfetch) which we need to workaround inside the driver, so if we detect we are running under a hypervisor, also assume the device access is being virtualised.
--- drivers/gpu/drm/i915/i915_drv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +5 -1
@@ -33,6 +33,8 @@#include <uapi/drm/i915_drm.h> #include <uapi/drm/drm_fourcc.h> +#include <asm/hypervisor.h> +#include <linux/io-mapping.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h>
@@ -2197,7 +2199,9 @@ static inline bool intel_vtd_active(voidif (intel_iommu_gfx_mapped)return true;#endif -return false; + +/* Running as a guest, we assume the host is enforcing VT'd */ +return !hypervisor_is_type (X86_HYPER_NATIVE ); }static inline bool intel_scanout_needs_vtd_wa (struct drm_i915_private *dev_priv)
Greg Kroah-Hartman
maintainerPATCH 139/214 usb: dwc3: gadget: Resume pending requests after CLEAR_STALL
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit c503672abe1348f10f5a54a662336358c6e1a297 upstream.
The function driver may queue new requests right after halting the endpoint (i.e. queue new requests while the endpoint is stalled). There's no restriction preventing it from doing so. However, dwc3 currently drops those requests after CLEAR_STALL. The driver should only drop started requests. Keep the pending requests in the pending list to resume and process them after the host issues ClearFeature(Halt) to the endpoint.
--- drivers/usb/dwc3/gadget.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/usb/dwc3/gadget.c +14 -8
@@ -1521,8 +1521,13 @@ static int __dwc3_gadget_ep_queue(structlist_add_tail (&req->list, &dep->pending_list); req->status =DWC3_REQUEST_STATUS_QUEUED ; -/* Start the transfer only after the END_TRANSFER is completed */ -if (dep->flags &DWC3_EP_END_TRANSFER_PENDING ) { +/* +* Start the transfer only after the END_TRANSFER is completed +* and endpoint STALL is cleared. +*/ +if ((dep->flags &DWC3_EP_END_TRANSFER_PENDING ) || + (dep->flags &DWC3_EP_WEDGE ) || + (dep->flags &DWC3_EP_STALL )) { dep->flags |=DWC3_EP_DELAY_START ;return 0 ; }
@@ -1728,13 +1733,14 @@ int __dwc3_gadget_ep_set_halt(struct dwclist_for_each_entry_safe (req, tmp, &dep->started_list, list)dwc3_gadget_move_cancelled_request (req); -list_for_each_entry_safe (req, tmp, &dep->pending_list, list) -dwc3_gadget_move_cancelled_request (req); - -if (!(dep->flags &DWC3_EP_END_TRANSFER_PENDING )) { - dep->flags &= ~DWC3_EP_DELAY_START ; +if (!(dep->flags &DWC3_EP_END_TRANSFER_PENDING ))dwc3_gadget_ep_cleanup_cancelled_requests (dep); - } + +if ((dep->flags &DWC3_EP_DELAY_START ) && + !usb_endpoint_xfer_isoc (dep->endpoint.desc)) +__dwc3_gadget_kick_transfer (dep); + + dep->flags &= ~DWC3_EP_DELAY_START ; }return ret;
Greg Kroah-Hartman
maintainerPATCH 138/214 usb: dwc3: core: dont trigger runtime pm when remove driver
In reply to Greg Kroah-HartmanFrom: Li Jun <[email protected]>
commit 266d0493900ac5d6a21cdbe6b1624ed2da94d47a upstream.
No need to trigger runtime pm in driver removal, otherwise if user disable auto suspend via sys file, runtime suspend may be entered, which will call dwc3_core_exit() again and there will be clock disable not balance warning:
[ 2026.820154] xhci-hcd xhci-hcd.0.auto: remove, state 4 [ 2026.825268] usb usb2: USB disconnect, device number 1 [ 2026.831017] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered [ 2026.836806] xhci-hcd xhci-hcd.0.auto: remove, state 4 [ 2026.842029] usb usb1: USB disconnect, device number 1 [ 2026.848029] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered [ 2026.865889] ------------[ cut here ]------------ [ 2026.870506] usb2_ctrl_root_clk already disabled [ 2026.875082] WARNING: CPU: 0 PID: 731 at drivers/clk/clk.c:958 clk_core_disable+0xa0/0xa8 [ 2026.883170] Modules linked in: dwc3(-) phy_fsl_imx8mq_usb [last unloaded: dwc3] [ 2026.890488] CPU: 0 PID: 731 Comm: rmmod Not tainted 5.8.0-rc7-00280-g9d08cca-dirty #245 [ 2026.898489] Hardware name: NXP i.MX8MQ EVK (DT) [ 2026.903020] pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--) [ 2026.908594] pc : clk_core_disable+0xa0/0xa8 [ 2026.912777] lr : clk_core_disable+0xa0/0xa8 [ 2026.916958] sp : ffff8000121b39a0 [ 2026.920271] x29: ffff8000121b39a0 x28: ffff0000b11f3700 [ 2026.925583] x27: 0000000000000000 x26: ffff0000b539c700 [ 2026.930895] x25: 000001d7e44e1232 x24: ffff0000b76fa800 [ 2026.936208] x23: ffff0000b76fa6f8 x22: ffff800008d01040 [ 2026.941520] x21: ffff0000b539ce00 x20: ffff0000b7105000 [ 2026.946832] x19: ffff0000b7105000 x18: 0000000000000010 [ 2026.952144] x17: 0000000000000001 x16: 0000000000000000 [ 2026.957456] x15: ffff0000b11f3b70 x14: ffffffffffffffff [ 2026.962768] x13: ffff8000921b36f7 x12: ffff8000121b36ff [ 2026.968080] x11: ffff8000119e1000 x10: ffff800011bf26d0 [ 2026.973392] x9 : 0000000000000000 x8 : ffff800011bf3000 [ 2026.978704] x7 : ffff800010695d68 x6 : 0000000000000252 [ 2026.984016] x5 : ffff0000bb9881f0 x4 : 0000000000000000 [ 2026.989327] x3 : 0000000000000027 x2 : 0000000000000023 [ 2026.994639] x1 : ac2fa471aa7cab00 x0 : 0000000000000000 [ 2026.999951] Call trace: [ 2027.002401] clk_core_disable+0xa0/0xa8 [ 2027.006238] clk_core_disable_lock+0x20/0x38 [ 2027.010508] clk_disable+0x1c/0x28 [ 2027.013911] clk_bulk_disable+0x34/0x50 [ 2027.017758] dwc3_core_exit+0xec/0x110 [dwc3] [ 2027.022122] dwc3_suspend_common+0x84/0x188 [dwc3] [ 2027.026919] dwc3_runtime_suspend+0x74/0x9c [dwc3] [ 2027.031712] pm_generic_runtime_suspend+0x28/0x40 [ 2027.036419] genpd_runtime_suspend+0xa0/0x258 [ 2027.040777] __rpm_callback+0x88/0x140 [ 2027.044526] rpm_callback+0x20/0x80 [ 2027.048015] rpm_suspend+0xd0/0x418 [ 2027.051503] __pm_runtime_suspend+0x58/0xa0 [ 2027.055693] dwc3_runtime_idle+0x7c/0x90 [dwc3] [ 2027.060224] __rpm_callback+0x88/0x140 [ 2027.063973] rpm_idle+0x78/0x150 [ 2027.067201] __pm_runtime_idle+0x58/0xa0 [ 2027.071130] dwc3_remove+0x64/0xc0 [dwc3] [ 2027.075140] platform_drv_remove+0x28/0x48 [ 2027.079239] device_release_driver_internal+0xf4/0x1c0 [ 2027.084377] driver_detach+0x4c/0xd8 [ 2027.087954] bus_remove_driver+0x54/0xa8 [ 2027.091877] driver_unregister+0x2c/0x58 [ 2027.095799] platform_driver_unregister+0x10/0x18 [ 2027.100509] dwc3_driver_exit+0x14/0x1408 [dwc3] [ 2027.105129] __arm64_sys_delete_module+0x178/0x218 [ 2027.109922] el0_svc_common.constprop.0+0x68/0x160 [ 2027.114714] do_el0_svc+0x20/0x80 [ 2027.118031] el0_sync_handler+0x88/0x190 [ 2027.121953] el0_sync+0x140/0x180 [ 2027.125267] ---[ end trace 027f4f8189958f1f ]--- [ 2027.129976] ------------[ cut here ]------------
--- drivers/usb/dwc3/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.c +2 -2
@@ -1581,9 +1581,9 @@ static int dwc3_remove(struct platform_ddwc3_core_exit (dwc);dwc3_ulpi_exit (dwc); -pm_runtime_put_sync (&pdev->dev); -pm_runtime_allow (&pdev->dev);pm_runtime_disable (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev);dwc3_free_event_buffers (dwc);dwc3_free_scratch_buffers (dwc);
Greg Kroah-Hartman
maintainerPATCH 137/214 usb: dwc3: core: add phy cleanup for probe error handling
In reply to Greg Kroah-HartmanFrom: Li Jun <[email protected]>
commit 03c1fd622f72c7624c81b64fdba4a567ae5ee9cb upstream.
Add the phy cleanup if dwc3 mode init fail, which is the missing part of de-init for dwc3 core init.
--- drivers/usb/dwc3/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/dwc3/core.c +11 -0
@@ -1535,6 +1535,17 @@ static int dwc3_probe(struct platform_de err5:dwc3_event_buffers_cleanup (dwc); + +usb_phy_shutdown (dwc->usb2_phy); +usb_phy_shutdown (dwc->usb3_phy); +phy_exit (dwc->usb2_generic_phy); +phy_exit (dwc->usb3_generic_phy); + +usb_phy_set_suspend (dwc->usb2_phy,1 ); +usb_phy_set_suspend (dwc->usb3_phy,1 ); +phy_power_off (dwc->usb2_generic_phy); +phy_power_off (dwc->usb3_generic_phy); +dwc3_ulpi_exit (dwc); err4:
Greg Kroah-Hartman
maintainerPATCH 136/214 usb: dwc3: gadget: Check MPS of the request length
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit ca3df3468eec87f6374662f7de425bc44c3810c1 upstream.
When preparing for SG, not all the entries are prepared at once. When resume, don't use the remaining request length to calculate for MPS alignment. Use the entire request->length to do that.
--- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/gadget.c +2 -2
@@ -1057,6 +1057,8 @@ static void dwc3_prepare_one_trb_sg(strustruct scatterlist *s;int i;unsigned int length = req->request.length; +unsigned int maxp =usb_endpoint_maxp (dep->endpoint.desc); +unsigned int rem = length % maxp;unsigned int remaining = req->request.num_mapped_sgs - req->num_queued_sgs;
@@ -1068,8 +1070,6 @@ static void dwc3_prepare_one_trb_sg(stru length -=sg_dma_len (s);for_each_sg (sg, s, remaining, i) { -unsigned int maxp =usb_endpoint_maxp (dep->endpoint.desc); -unsigned int rem = length % maxp;unsigned int trb_length;unsigned chain = true;
Greg Kroah-Hartman
maintainerPATCH 134/214 usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality
In reply to Greg Kroah-HartmanFrom: Raymond Tan <[email protected]>
commit a609ce2a13360d639b384b6ca783b38c1247f2db upstream.
Similar to some other IA platforms, Elkhart Lake too depends on the PMU register write to request transition of Dx power state.
Thus, we add the PCI_DEVICE_ID_INTEL_EHLLP to the list of devices that shall execute the ACPI _DSM method during D0/D3 sequence.
[[email protected]: included Fixes tag]
--- drivers/usb/dwc3/dwc3-pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-pci.c +2 -1
@@ -147,7 +147,8 @@ static int dwc3_pci_quirks(struct dwc3_pif (pdev->vendor ==PCI_VENDOR_ID_INTEL ) {if (pdev->device ==PCI_DEVICE_ID_INTEL_BXT || - pdev->device ==PCI_DEVICE_ID_INTEL_BXT_M ) { + pdev->device ==PCI_DEVICE_ID_INTEL_BXT_M || + pdev->device ==PCI_DEVICE_ID_INTEL_EHLLP ) {guid_parse (PCI_INTEL_BXT_DSM_GUID , &dwc->guid); dwc->has_dsm_for_pm = true; }
Greg Kroah-Hartman
maintainerPATCH 135/214 usb: dwc3: ep0: Fix ZLP for OUT ep0 requests
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit 66706077dc89c66a4777a4c6298273816afb848c upstream.
The current ZLP handling for ep0 requests is only for control IN requests. For OUT direction, DWC3 needs to check and setup for MPS alignment.
Usually, control OUT requests can indicate its transfer size via the wLength field of the control message. So usb_request->zero is usually not needed for OUT direction. To handle ZLP OUT for control endpoint, make sure the TRB is MPS size.
--- drivers/usb/dwc3/ep0.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/dwc3/ep0.c +9 -2
@@ -942,12 +942,16 @@ static void dwc3_ep0_xfer_complete(strucstatic void __dwc3_ep0_do_control_data (struct dwc3 *dwc,struct dwc3_ep *dep,struct dwc3_request *req) { +unsigned int trb_length =0 ;int ret; req->direction = !!dep->number;if (req->request.length ==0 ) { -dwc3_ep0_prepare_one_trb (dep, dwc->ep0_trb_addr,0 , +if (!req->direction) + trb_length = dep->endpoint.maxpacket; + +dwc3_ep0_prepare_one_trb (dep, dwc->bounce_addr, trb_length,DWC3_TRBCTL_CONTROL_DATA , false); ret =dwc3_ep0_start_trans (dep); } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
@@ -994,9 +998,12 @@ static void __dwc3_ep0_do_control_data(s req->trb = &dwc->ep0_trb[dep->trb_enqueue -1 ]; +if (!req->direction) + trb_length = dep->endpoint.maxpacket; +/* Now prepare one extra TRB to align transfer size */ dwc3_ep0_prepare_one_trb (dep, dwc->bounce_addr, -0 ,DWC3_TRBCTL_CONTROL_DATA , + trb_length,DWC3_TRBCTL_CONTROL_DATA , false); ret =dwc3_ep0_start_trans (dep); }else {
Greg Kroah-Hartman
maintainerPATCH 132/214 btrfs: fix readahead hang and use-after-free after removing a device
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 66d204a16c94f24ad08290a7663ab67e7fc04e82 upstream.
Very sporadically I had test case btrfs/069 from fstests hanging (for years, it is not a recent regression), with the following traces in dmesg/syslog:
[162301.160628] BTRFS info (device sdc): dev_replace from /dev/sdd (devid 2) to /dev/sdg started
[162301.181196] BTRFS info (device sdc): scrub: finished on devid 4 with status: 0
[162301.287162] BTRFS info (device sdc): dev_replace from /dev/sdd (devid 2) to /dev/sdg finished
[162513.513792] INFO: task btrfs-transacti:1356167 blocked for more than 120 seconds.
[162513.514318] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.514522] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.514747] task:btrfs-transacti state:D stack: 0 pid:1356167 ppid: 2 flags:0x00004000
[162513.514751] Call Trace:
[162513.514761] __schedule+0x5ce/0xd00
[162513.514765] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.514771] schedule+0x46/0xf0
[162513.514844] wait_current_trans+0xde/0x140 [btrfs]
[162513.514850] ? finish_wait+0x90/0x90
[162513.514864] start_transaction+0x37c/0x5f0 [btrfs]
[162513.514879] transaction_kthread+0xa4/0x170 [btrfs]
[162513.514891] ? btrfs_cleanup_transaction+0x660/0x660 [btrfs]
[162513.514894] kthread+0x153/0x170
[162513.514897] ? kthread_stop+0x2c0/0x2c0
[162513.514902] ret_from_fork+0x22/0x30
[162513.514916] INFO: task fsstress:1356184 blocked for more than 120 seconds.
[162513.515192] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.515431] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.515680] task:fsstress state:D stack: 0 pid:1356184 ppid:1356177 flags:0x00004000
[162513.515682] Call Trace:
[162513.515688] __schedule+0x5ce/0xd00
[162513.515691] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.515697] schedule+0x46/0xf0
[162513.515712] wait_current_trans+0xde/0x140 [btrfs]
[162513.515716] ? finish_wait+0x90/0x90
[162513.515729] start_transaction+0x37c/0x5f0 [btrfs]
[162513.515743] btrfs_attach_transaction_barrier+0x1f/0x50 [btrfs]
[162513.515753] btrfs_sync_fs+0x61/0x1c0 [btrfs]
[162513.515758] ? __ia32_sys_fdatasync+0x20/0x20
[162513.515761] iterate_supers+0x87/0xf0
[162513.515765] ksys_sync+0x60/0xb0
[162513.515768] __do_sys_sync+0xa/0x10
[162513.515771] do_syscall_64+0x33/0x80
[162513.515774] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.515781] RIP: 0033:0x7f5238f50bd7
[162513.515782] Code: Bad RIP value.
[162513.515784] RSP: 002b:00007fff67b978e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[162513.515786] RAX: ffffffffffffffda RBX: 000055b1fad2c560 RCX: 00007f5238f50bd7
[162513.515788] RDX: 00000000ffffffff RSI: 000000000daf0e74 RDI: 000000000000003a
[162513.515789] RBP: 0000000000000032 R08: 000000000000000a R09: 00007f5239019be0
[162513.515791] R10: fffffffffffff24f R11: 0000000000000206 R12: 000000000000003a
[162513.515792] R13: 00007fff67b97950 R14: 00007fff67b97906 R15: 000055b1fad1a340
[162513.515804] INFO: task fsstress:1356185 blocked for more than 120 seconds.
[162513.516064] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.516329] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.516617] task:fsstress state:D stack: 0 pid:1356185 ppid:1356177 flags:0x00000000
[162513.516620] Call Trace:
[162513.516625] __schedule+0x5ce/0xd00
[162513.516628] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.516634] schedule+0x46/0xf0
[162513.516647] wait_current_trans+0xde/0x140 [btrfs]
[162513.516650] ? finish_wait+0x90/0x90
[162513.516662] start_transaction+0x4d7/0x5f0 [btrfs]
[162513.516679] btrfs_setxattr_trans+0x3c/0x100 [btrfs]
[162513.516686] __vfs_setxattr+0x66/0x80
[162513.516691] __vfs_setxattr_noperm+0x70/0x200
[162513.516697] vfs_setxattr+0x6b/0x120
[162513.516703] setxattr+0x125/0x240
[162513.516709] ? lock_acquire+0xb1/0x480
[162513.516712] ? mnt_want_write+0x20/0x50
[162513.516721] ? rcu_read_lock_any_held+0x8e/0xb0
[162513.516723] ? preempt_count_add+0x49/0xa0
[162513.516725] ? __sb_start_write+0x19b/0x290
[162513.516727] ? preempt_count_add+0x49/0xa0
[162513.516732] path_setxattr+0xba/0xd0
[162513.516739] __x64_sys_setxattr+0x27/0x30
[162513.516741] do_syscall_64+0x33/0x80
[162513.516743] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.516745] RIP: 0033:0x7f5238f56d5a
[162513.516746] Code: Bad RIP value.
[162513.516748] RSP: 002b:00007fff67b97868 EFLAGS: 00000202 ORIG_RAX: 00000000000000bc
[162513.516750] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f5238f56d5a
[162513.516751] RDX: 000055b1fbb0d5a0 RSI: 00007fff67b978a0 RDI: 000055b1fbb0d470
[162513.516753] RBP: 000055b1fbb0d5a0 R08: 0000000000000001 R09: 00007fff67b97700
[162513.516754] R10: 0000000000000004 R11: 0000000000000202 R12: 0000000000000004
[162513.516756] R13: 0000000000000024 R14: 0000000000000001 R15: 00007fff67b978a0
[162513.516767] INFO: task fsstress:1356196 blocked for more than 120 seconds.
[162513.517064] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.517365] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.517763] task:fsstress state:D stack: 0 pid:1356196 ppid:1356177 flags:0x00004000
[162513.517780] Call Trace:
[162513.517786] __schedule+0x5ce/0xd00
[162513.517789] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.517796] schedule+0x46/0xf0
[162513.517810] wait_current_trans+0xde/0x140 [btrfs]
[162513.517814] ? finish_wait+0x90/0x90
[162513.517829] start_transaction+0x37c/0x5f0 [btrfs]
[162513.517845] btrfs_attach_transaction_barrier+0x1f/0x50 [btrfs]
[162513.517857] btrfs_sync_fs+0x61/0x1c0 [btrfs]
[162513.517862] ? __ia32_sys_fdatasync+0x20/0x20
[162513.517865] iterate_supers+0x87/0xf0
[162513.517869] ksys_sync+0x60/0xb0
[162513.517872] __do_sys_sync+0xa/0x10
[162513.517875] do_syscall_64+0x33/0x80
[162513.517878] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.517881] RIP: 0033:0x7f5238f50bd7
[162513.517883] Code: Bad RIP value.
[162513.517885] RSP: 002b:00007fff67b978e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a2
[162513.517887] RAX: ffffffffffffffda RBX: 000055b1fad2c560 RCX: 00007f5238f50bd7
[162513.517889] RDX: 0000000000000000 RSI: 000000007660add2 RDI: 0000000000000053
[162513.517891] RBP: 0000000000000032 R08: 0000000000000067 R09: 00007f5239019be0
[162513.517893] R10: fffffffffffff24f R11: 0000000000000206 R12: 0000000000000053
[162513.517895] R13: 00007fff67b97950 R14: 00007fff67b97906 R15: 000055b1fad1a340
[162513.517908] INFO: task fsstress:1356197 blocked for more than 120 seconds.
[162513.518298] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.518672] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.519157] task:fsstress state:D stack: 0 pid:1356197 ppid:1356177 flags:0x00000000
[162513.519160] Call Trace:
[162513.519165] __schedule+0x5ce/0xd00
[162513.519168] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.519174] schedule+0x46/0xf0
[162513.519190] wait_current_trans+0xde/0x140 [btrfs]
[162513.519193] ? finish_wait+0x90/0x90
[162513.519206] start_transaction+0x4d7/0x5f0 [btrfs]
[162513.519222] btrfs_create+0x57/0x200 [btrfs]
[162513.519230] lookup_open+0x522/0x650
[162513.519246] path_openat+0x2b8/0xa50
[162513.519270] do_filp_open+0x91/0x100
[162513.519275] ? find_held_lock+0x32/0x90
[162513.519280] ? lock_acquired+0x33b/0x470
[162513.519285] ? do_raw_spin_unlock+0x4b/0xc0
[162513.519287] ? _raw_spin_unlock+0x29/0x40
[162513.519295] do_sys_openat2+0x20d/0x2d0
[162513.519300] do_sys_open+0x44/0x80
[162513.519304] do_syscall_64+0x33/0x80
[162513.519307] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.519309] RIP: 0033:0x7f5238f4a903
[162513.519310] Code: Bad RIP value.
[162513.519312] RSP: 002b:00007fff67b97758 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
[162513.519314] RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007f5238f4a903
[162513.519316] RDX: 0000000000000000 RSI: 00000000000001b6 RDI: 000055b1fbb0d470
[162513.519317] RBP: 00007fff67b978c0 R08: 0000000000000001 R09: 0000000000000002
[162513.519319] R10: 00007fff67b974f7 R11: 0000000000000246 R12: 0000000000000013
[162513.519320] R13: 00000000000001b6 R14: 00007fff67b97906 R15: 000055b1fad1c620
[162513.519332] INFO: task btrfs:1356211 blocked for more than 120 seconds.
[162513.519727] Not tainted 5.9.0-rc6-btrfs-next-69 #1
[162513.520115] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[162513.520508] task:btrfs state:D stack: 0 pid:1356211 ppid:1356178 flags:0x00004002
[162513.520511] Call Trace:
[162513.520516] __schedule+0x5ce/0xd00
[162513.520519] ? _raw_spin_unlock_irqrestore+0x3c/0x60
[162513.520525] schedule+0x46/0xf0
[162513.520544] btrfs_scrub_pause+0x11f/0x180 [btrfs]
[162513.520548] ? finish_wait+0x90/0x90
[162513.520562] btrfs_commit_transaction+0x45a/0xc30 [btrfs]
[162513.520574] ? start_transaction+0xe0/0x5f0 [btrfs]
[162513.520596] btrfs_dev_replace_finishing+0x6d8/0x711 [btrfs]
[162513.520619] btrfs_dev_replace_by_ioctl.cold+0x1cc/0x1fd [btrfs]
[162513.520639] btrfs_ioctl+0x2a25/0x36f0 [btrfs]
[162513.520643] ? do_sigaction+0xf3/0x240
[162513.520645] ? find_held_lock+0x32/0x90
[162513.520648] ? do_sigaction+0xf3/0x240
[162513.520651] ? lock_acquired+0x33b/0x470
[162513.520655] ? _raw_spin_unlock_irq+0x24/0x50
[162513.520657] ? lockdep_hardirqs_on+0x7d/0x100
[162513.520660] ? _raw_spin_unlock_irq+0x35/0x50
[162513.520662] ? do_sigaction+0xf3/0x240
[162513.520671] ? __x64_sys_ioctl+0x83/0xb0
[162513.520672] __x64_sys_ioctl+0x83/0xb0
[162513.520677] do_syscall_64+0x33/0x80
[162513.520679] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[162513.520681] RIP: 0033:0x7fc3cd307d87
[162513.520682] Code: Bad RIP value.
[162513.520684] RSP: 002b:00007ffe30a56bb8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[162513.520686] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fc3cd307d87
[162513.520687] RDX: 00007ffe30a57a30 RSI: 00000000ca289435 RDI: 0000000000000003
[162513.520689] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[162513.520690] R10: 0000000000000008 R11: 0000000000000202 R12: 0000000000000003
[162513.520692] R13: 0000557323a212e0 R14: 00007ffe30a5a520 R15: 0000000000000001
[162513.520703]
Showing all locks held in the system:
[162513.520712] 1 lock held by khungtaskd/54:
[162513.520713] #0: ffffffffb40a91a0 (rcu_read_lock){....}-{1:2}, at: debug_show_all_locks+0x15/0x197
[162513.520728] 1 lock held by in:imklog/596:
[162513.520729] #0: ffff8f3f0d781400 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x4d/0x60
[162513.520782] 1 lock held by btrfs-transacti/1356167:
[162513.520784] #0: ffff8f3d810cc848 (&fs_info->transaction_kthread_mutex){+.+.}-{3:3}, at: transaction_kthread+0x4a/0x170 [btrfs]
[162513.520798] 1 lock held by btrfs/1356190:
[162513.520800] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write_file+0x22/0x60
[162513.520805] 1 lock held by fsstress/1356184:
[162513.520806] #0: ffff8f3d576440e8 (&type->s_umount_key#62){++++}-{3:3}, at: iterate_supers+0x6f/0xf0
[162513.520811] 3 locks held by fsstress/1356185:
[162513.520812] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x20/0x50
[162513.520815] #1: ffff8f3d80a650b8 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: vfs_setxattr+0x50/0x120
[162513.520820] #2: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]
[162513.520833] 1 lock held by fsstress/1356196:
[162513.520834] #0: ffff8f3d576440e8 (&type->s_umount_key#62){++++}-{3:3}, at: iterate_supers+0x6f/0xf0
[162513.520838] 3 locks held by fsstress/1356197:
[162513.520839] #0: ffff8f3d57644470 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x20/0x50
[162513.520843] #1: ffff8f3d506465e8 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: path_openat+0x2a7/0xa50
[162513.520846] #2: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]
[162513.520858] 2 locks held by btrfs/1356211:
[162513.520859] #0: ffff8f3d810cde30 (&fs_info->dev_replace.lock_finishing_cancel_unmount){+.+.}-{3:3}, at: btrfs_dev_replace_finishing+0x52/0x711 [btrfs]
[162513.520877] #1: ffff8f3d57644690 (sb_internal#2){.+.+}-{0:0}, at: start_transaction+0x40e/0x5f0 [btrfs]This was weird because the stack traces show that a transaction commit, triggered by a device replace operation, is blocking trying to pause any running scrubs but there are no stack traces of blocked tasks doing a scrub.
After poking around with drgn, I noticed there was a scrub task that was constantly running and blocking for shorts periods of time:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
t =
find_task(prog, 1356190)prog.stack_trace(t)
#0 __schedule+0x5ce/0xcfc #1 schedule+0x46/0xe4 #2 schedule_timeout+0x1df/0x475 #3 btrfs_reada_wait+0xda/0x132 #4 scrub_stripe+0x2a8/0x112f #5 scrub_chunk+0xcd/0x134 #6 scrub_enumerate_chunks+0x29e/0x5ee #7 btrfs_scrub_dev+0x2d5/0x91b #8 btrfs_ioctl+0x7f5/0x36e7 #9 __x64_sys_ioctl+0x83/0xb0
#10 do_syscall_64+0x33/0x77
#11 entry_SYSCALL_64+0x7c/0x156
Which corresponds to:
int btrfs_reada_wait(void *handle)
{
struct reada_control *rc = handle;
struct btrfs_fs_info *fs_info = rc->fs_info;
while (atomic_read(&rc->elems)) {
if (!atomic_read(&fs_info->reada_works_cnt))
reada_start_machine(fs_info);
wait_event_timeout(rc->wait, atomic_read(&rc->elems) == 0,
(HZ + 9) / 10);
}(...)
So the counter "rc->elems" was set to 1 and never decreased to 0, causing the scrub task to loop forever in that function. Then I used the following script for drgn to check the readahead requests:
$ cat dump_reada.py
import sys
import drgn
from drgn import NULL, Object, cast, container_of, execscript, \
reinterpret, sizeof
from drgn.helpers.linux import * mnt_path = b"/home/fdmanana/btrfs-tests/scratch_1"
mnt = None
for mnt in for_each_mount(prog, dst = mnt_path):
pass
if mnt is None:
sys.stderr.write(f'Error: mount point {mnt_path} not found\n') sys.exit(1)
fs_info = cast('struct btrfs_fs_info *', mnt.mnt.mnt_sb.s_fs_info)
def dump_re(re):
nzones = re.nzones.value_()
print(f're at {hex(re.value_())}')
print(f'\t logical {re.logical.value_()}') print(f'\t refcnt {re.refcnt.value_()}') print(f'\t nzones {nzones}')
for i in range(nzones):
dev = re.zones[i].device
name = dev.name.str.string_()
print(f'\t\t dev id {dev.devid.value_()} name {name}')
print()
for _, e in radix_tree_for_each(fs_info.reada_tree):
re = cast('struct reada_extent *', e) dump_re(re)
$ drgn dump_reada.py
re at 0xffff8f3da9d25ad8
logical 38928384
refcnt 1
nzones 1
dev id 0 name b'/dev/sdd'
$So there was one readahead extent with a single zone corresponding to the source device of that last device replace operation logged in dmesg/syslog. Also the ID of that zone's device was 0 which is a special value set in the source device of a device replace operation when the operation finishes (constant BTRFS_DEV_REPLACE_DEVID set at btrfs_dev_replace_finishing()), confirming again that device /dev/sdd was the source of a device replace operation.
Normally there should be as many zones in the readahead extent as there are devices, and I wasn't expecting the extent to be in a block group with a 'single' profile, so I went and confirmed with the following drgn script that there weren't any single profile block groups:
$ cat dump_block_groups.py
import sys
import drgn
from drgn import NULL, Object, cast, container_of, execscript, \
reinterpret, sizeof
from drgn.helpers.linux import * mnt_path = b"/home/fdmanana/btrfs-tests/scratch_1"
mnt = None
for mnt in for_each_mount(prog, dst = mnt_path):
pass
if mnt is None:
sys.stderr.write(f'Error: mount point {mnt_path} not found\n') sys.exit(1)
fs_info = cast('struct btrfs_fs_info *', mnt.mnt.mnt_sb.s_fs_info)
BTRFS_BLOCK_GROUP_DATA = (1 << 0)
BTRFS_BLOCK_GROUP_SYSTEM = (1 << 1)
BTRFS_BLOCK_GROUP_METADATA = (1 << 2)
BTRFS_BLOCK_GROUP_RAID0 = (1 << 3)
BTRFS_BLOCK_GROUP_RAID1 = (1 << 4)
BTRFS_BLOCK_GROUP_DUP = (1 << 5)
BTRFS_BLOCK_GROUP_RAID10 = (1 << 6)
BTRFS_BLOCK_GROUP_RAID5 = (1 << 7)
BTRFS_BLOCK_GROUP_RAID6 = (1 << 8)
BTRFS_BLOCK_GROUP_RAID1C3 = (1 << 9)
BTRFS_BLOCK_GROUP_RAID1C4 = (1 << 10)
def bg_flags_string(bg):
flags = bg.flags.value_()
ret = ''
if flags & BTRFS_BLOCK_GROUP_DATA:
ret = 'data'
if flags & BTRFS_BLOCK_GROUP_METADATA:
if len(ret) > 0:
ret += '|'
ret += 'meta'
if flags & BTRFS_BLOCK_GROUP_SYSTEM:
if len(ret) > 0:
ret += '|'
ret += 'system'
if flags & BTRFS_BLOCK_GROUP_RAID0:
ret += ' raid0'
elif flags & BTRFS_BLOCK_GROUP_RAID1:
ret += ' raid1'
elif flags & BTRFS_BLOCK_GROUP_DUP:
ret += ' dup'
elif flags & BTRFS_BLOCK_GROUP_RAID10:
ret += ' raid10'
elif flags & BTRFS_BLOCK_GROUP_RAID5:
ret += ' raid5'
elif flags & BTRFS_BLOCK_GROUP_RAID6:
ret += ' raid6'
elif flags & BTRFS_BLOCK_GROUP_RAID1C3:
ret += ' raid1c3'
elif flags & BTRFS_BLOCK_GROUP_RAID1C4:
ret += ' raid1c4'
else:
ret += ' single'
return ret def dump_bg(bg):
print()
print(f'block group at {hex(bg.value_())}')
print(f'\t start {bg.start.value_()} length {bg.length.value_()}')
print(f'\t flags {bg.flags.value_()} - {bg_flags_string(bg)}') bg_root = fs_info.block_group_cache_tree.address_of_()
for bg in rbtree_inorder_for_each_entry('struct btrfs_block_group', bg_root, 'cache_node'):
dump_bg(bg)
$ drgn dump_block_groups.py
block group at 0xffff8f3d673b0400
start 22020096 length 16777216
flags 258 - system raid6
block group at 0xffff8f3d53ddb400
start 38797312 length 536870912
flags 260 - meta raid6
block group at 0xffff8f3d5f4d9c00
start 575668224 length 2147483648
flags 257 - data raid6
block group at 0xffff8f3d08189000
start 2723151872 length 67108864
flags 258 - system raid6
block group at 0xffff8f3db70ff000
start 2790260736 length 1073741824
flags 260 - meta raid6
block group at 0xffff8f3d5f4dd800
start 3864002560 length 67108864
flags 258 - system raid6
block group at 0xffff8f3d67037000
start 3931111424 length 2147483648
flags 257 - data raid6
$
So there were only 2 reasons left for having a readahead extent with a single zone: reada_find_zone(), called when creating a readahead extent, returned NULL either because we failed to find the corresponding block group or because a memory allocation failed. With some additional and custom tracing I figured out that on every further ocurrence of the problem the block group had just been deleted when we were looping to create the zones for the readahead extent (at reada_find_extent()), so we ended up with only one zone in the readahead extent, corresponding to a device that ends up getting replaced.
So after figuring that out it became obvious why the hang happens:
1) Task A starts a scrub on any device of the filesystem, except for device /dev/sdd;
2) Task B starts a device replace with /dev/sdd as the source device;
3) Task A calls btrfs_reada_add() from scrub_stripe() and it is currently starting to scrub a stripe from block group X. This call to btrfs_reada_add() is the one for the extent tree. When btrfs_reada_add() calls reada_add_block(), it passes the logical address of the extent tree's root node as its 'logical' argument - a value of 38928384;
4) Task A then enters reada_find_extent(), called from reada_add_block(). It finds there isn't any existing readahead extent for the logical address 38928384, so it proceeds to the path of creating a new one.
It calls btrfs_map_block() to find out which stripes exist for the block group X. On the first iteration of the for loop that iterates over the stripes, it finds the stripe for device /dev/sdd, so it creates one zone for that device and adds it to the readahead extent. Before getting into the second iteration of the loop, the cleanup kthread deletes block group X because it was empty. So in the iterations for the remaining stripes it does not add more zones to the readahead extent, because the calls to reada_find_zone() returned NULL because they couldn't find block group X anymore.
As a result the new readahead extent has a single zone, corresponding to the device /dev/sdd;
4) Before task A returns to btrfs_reada_add() and queues the readahead job for the readahead work queue, task B finishes the device replace and at btrfs_dev_replace_finishing() swaps the device /dev/sdd with the new device /dev/sdg;
5) Task A returns to reada_add_block(), which increments the counter "->elems" of the reada_control structure allocated at btrfs_reada_add().
Then it returns back to btrfs_reada_add() and calls reada_start_machine(). This queues a job in the readahead work queue to run the function reada_start_machine_worker(), which calls __reada_start_machine().
At __reada_start_machine() we take the device list mutex and for each device found in the current device list, we call reada_start_machine_dev() to start the readahead work. However at this point the device /dev/sdd was already freed and is not in the device list anymore.
This means the corresponding readahead for the extent at 38928384 is never started, and therefore the "->elems" counter of the reada_control structure allocated at btrfs_reada_add() never goes down to 0, causing the call to btrfs_reada_wait(), done by the scrub task, to wait forever.
Note that the readahead request can be made either after the device replace started or before it started, however in pratice it is very unlikely that a device replace is able to start after a readahead request is made and is able to complete before the readahead request completes - maybe only on a very small and nearly empty filesystem.
This hang however is not the only problem we can have with readahead and device removals. When the readahead extent has other zones other than the one corresponding to the device that is being removed (either by a device replace or a device remove operation), we risk having a use-after-free on the device when dropping the last reference of the readahead extent.
For example if we create a readahead extent with two zones, one for the device /dev/sdd and one for the device /dev/sde:
1) Before the readahead worker starts, the device /dev/sdd is removed, and the corresponding btrfs_device structure is freed. However the readahead extent still has the zone pointing to the device structure;
2) When the readahead worker starts, it only finds device /dev/sde in the current device list of the filesystem;
3) It starts the readahead work, at reada_start_machine_dev(), using the device /dev/sde;
4) Then when it finishes reading the extent from device /dev/sde, it calls __readahead_hook() which ends up dropping the last reference on the readahead extent through the last call to reada_extent_put();
5) At reada_extent_put() it iterates over each zone of the readahead extent and attempts to delete an element from the device's 'reada_extents' radix tree, resulting in a use-after-free, as the device pointer of the zone for /dev/sdd is now stale. We can also access the device after dropping the last reference of a zone, through reada_zone_release(), also called by reada_extent_put().
And a device remove suffers the same problem, however since it shrinks the device size down to zero before removing the device, it is very unlikely to still have readahead requests not completed by the time we free the device, the only possibility is if the device has a very little space allocated.
While the hang problem is exclusive to scrub, since it is currently the only user of btrfs_reada_add() and btrfs_reada_wait(), the use-after-free problem affects any path that triggers readhead, which includes btree_readahead_hook() and __readahead_hook() (a readahead worker can trigger readahed for the children of a node) for example - any path that ends up calling reada_add_block() can trigger the use-after-free after a device is removed.
So fix this by waiting for any readahead requests for a device to complete before removing a device, ensuring that while waiting for existing ones no new ones can be made.
This problem has been around for a very long time - the readahead code was added in 2011, device remove exists since 2008 and device replace was introduced in 2013, hard to pick a specific commit for a git Fixes tag.
--- fs/btrfs/ctree.h | 2 ++ fs/btrfs/dev-replace.c | 5 +++++ fs/btrfs/reada.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/volumes.c | 3 +++ fs/btrfs/volumes.h | 1 + 5 files changed, 56 insertions(+)
fs/btrfs/ctree.h +2 -0
@@ -3404,6 +3404,8 @@ struct reada_control *btrfs_reada_add(stint btrfs_reada_wait (void *handle);void btrfs_reada_detach (void *handle);int btree_readahead_hook (struct extent_buffer *eb,int err); +void btrfs_reada_remove_dev (struct btrfs_device *dev); +void btrfs_reada_undo_remove_dev (struct btrfs_device *dev);static inline int is_fstree (u64 rootid) {
fs/btrfs/dev-replace.c +5 -0
@@ -631,6 +631,9 @@ static int btrfs_dev_replace_finishing(s }btrfs_wait_ordered_roots (fs_info,U64_MAX ,0 , (u64)-1 ); +if (!scrub_ret) +btrfs_reada_remove_dev (src_device); +/* * We have to use this loop approach because at this point src_device * has to be available for transaction commit to complete, yet new
@@ -639,6 +642,7 @@ static int btrfs_dev_replace_finishing(swhile (1 ) { trans =btrfs_start_transaction (root,0 );if (IS_ERR (trans)) { +btrfs_reada_undo_remove_dev (src_device);mutex_unlock (&dev_replace->lock_finishing_cancel_unmount);return PTR_ERR (trans); }
@@ -689,6 +693,7 @@ error:up_write (&dev_replace->rwsem);mutex_unlock (&fs_info->chunk_mutex);mutex_unlock (&fs_info->fs_devices->device_list_mutex); +btrfs_reada_undo_remove_dev (src_device);btrfs_rm_dev_replace_blocked (fs_info);if (tgt_device)btrfs_destroy_dev_replace_tgtdev (tgt_device);
fs/btrfs/reada.c +45 -0
54 lines not on this page · raw message
fs/btrfs/volumes.c +3 -0
@@ -2208,6 +2208,8 @@ int btrfs_rm_device(struct btrfs_fs_infomutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 ); +if (!ret) +btrfs_reada_remove_dev (device);mutex_lock (&uuid_mutex);if (ret) goto error_undo;
@@ -2294,6 +2296,7 @@ out:return ret; error_undo: +btrfs_reada_undo_remove_dev (device);if (test_bit (BTRFS_DEV_STATE_WRITEABLE , &device->dev_state)) {mutex_lock (&fs_info->chunk_mutex); list_add(&device->dev_alloc_list,
fs/btrfs/volumes.h +1 -0
@@ -56,6 +56,7 @@ struct btrfs_io_geometry {#define BTRFS_DEV_STATE_MISSING (2)#define BTRFS_DEV_STATE_REPLACE_TGT (3)#define BTRFS_DEV_STATE_FLUSH_SENT (4) +#define BTRFS_DEV_STATE_NO_READA (5)struct btrfs_device {struct list_head dev_list;/* device_list_mutex */
Greg Kroah-Hartman
maintainerPATCH 133/214 usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC
In reply to Greg Kroah-HartmanFrom: Sandeep Singh <[email protected]>
commit 2a632815683d2d34df52b701a36fe5ac6654e719 upstream.
On some platform of AMD, S3 fails with HCE and SRE errors. To fix this, need to disable a bit which is enable in sparse controller.
--- drivers/usb/host/xhci-pci.c | 17 +++++++++++++++++ drivers/usb/host/xhci.h | 1 + 2 files changed, 18 insertions(+)
drivers/usb/host/xhci-pci.c +17 -0
@@ -21,6 +21,8 @@#define SSIC_PORT_CFG2_OFFSET 0x30#define PROG_DONE (1 << 30)#define SSIC_PORT_UNUSED (1 << 31) +#define SPARSE_DISABLE_BIT 17 +#define SPARSE_CNTL_ENABLE 0xC12C/* Device for a quirk */ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
@@ -149,6 +151,9 @@ static void xhci_pci_quirks(struct devic (pdev->device == 0x15e0 || pdev->device == 0x15e1)) xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && pdev->device ==0x15e5 ) + xhci->quirks |=XHCI_DISABLE_SPARSE ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ;
@@ -467,6 +472,15 @@ static void xhci_pme_quirk(struct usb_hcreadl (reg); } +static void xhci_sparse_control_quirk (struct usb_hcd *hcd) +{ +u32 reg; + + reg =readl (hcd->regs +SPARSE_CNTL_ENABLE ); + reg &= ~BIT (SPARSE_DISABLE_BIT ); +writel (reg, hcd->regs +SPARSE_CNTL_ENABLE ); +} +static int xhci_pci_suspend (struct usb_hcd *hcd,bool do_wakeup) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -486,6 +500,9 @@ static int xhci_pci_suspend(struct usb_hif (xhci->quirks &XHCI_SSIC_PORT_UNUSED )xhci_ssic_port_unused_quirk (hcd, true); +if (xhci->quirks &XHCI_DISABLE_SPARSE ) +xhci_sparse_control_quirk (hcd); + ret =xhci_suspend (xhci, do_wakeup);if (ret && (xhci->quirks &XHCI_SSIC_PORT_UNUSED ))xhci_ssic_port_unused_quirk (hcd, false);
drivers/usb/host/xhci.h +1 -0
@@ -1873,6 +1873,7 @@ struct xhci_hcd {#define XHCI_DEFAULT_PM_RUNTIME_ALLOW BIT_ULL(33)#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34)#define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35) +#define XHCI_DISABLE_SPARSE BIT_ULL(38)unsigned int num_active_eps;unsigned int limit_active_eps;
Greg Kroah-Hartman
maintainerPATCH 130/214 btrfs: tree-checker: validate number of chunk stripes and parity
In reply to Greg Kroah-HartmanFrom: Daniel Xu <[email protected]>
commit 85d07fbe09efd1c529ff3e025e2f0d2c6c96a1b7 upstream.
If there's no parity and num_stripes < ncopies, a crafted image can trigger a division by zero in calc_stripe_length().
The image was generated through fuzzing.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209587
--- fs/btrfs/tree-checker.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
fs/btrfs/tree-checker.c +18 -0
@@ -577,18 +577,36 @@ int btrfs_check_chunk_valid(struct extenu64 type;u64 features;bool mixed = false; +int raid_index; +int nparity; +int ncopies; length =btrfs_chunk_length (leaf, chunk); stripe_len =btrfs_chunk_stripe_len (leaf, chunk); num_stripes =btrfs_chunk_num_stripes (leaf, chunk); sub_stripes =btrfs_chunk_sub_stripes (leaf, chunk); type =btrfs_chunk_type (leaf, chunk); + raid_index =btrfs_bg_flags_to_raid_index (type); + ncopies = btrfs_raid_array[raid_index].ncopies; + nparity = btrfs_raid_array[raid_index].nparity;if (!num_stripes) {chunk_err (leaf, chunk, logical,"invalid chunk num_stripes, have %u" , num_stripes);return -EUCLEAN ; } +if (num_stripes < ncopies) { +chunk_err (leaf, chunk, logical, +"invalid chunk num_stripes < ncopies, have %u < %d" , + num_stripes, ncopies); +return -EUCLEAN ; + } +if (nparity && num_stripes == nparity) { +chunk_err (leaf, chunk, logical, +"invalid chunk num_stripes == nparity, have %u == %d" , + num_stripes, nparity); +return -EUCLEAN ; + }if (!IS_ALIGNED (logical, fs_info->sectorsize)) { chunk_err(leaf, chunk, logical, "invalid chunk logical, have %llu should aligned to %u",
Greg Kroah-Hartman
maintainerPATCH 114/214 PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit c6e331312ebfb52b7186e5d82d517d68b4d2f2d8 upstream.
Recent laptops with dual AMD GPUs fail to suspend the discrete GPU, thus causing lockups on system sleep and high power consumption at runtime. The discrete GPU would normally be suspended to D3cold by turning off ACPI _PR3 Power Resources of the Root Port above the GPU.
However on affected systems, the Root Port is hotplug-capable and pci_bridge_d3_possible() only allows hotplug ports to go to D3 if they belong to a Thunderbolt device or if the Root Port possesses a "HotPlugSupportInD3" ACPI property. Neither is the case on affected laptops. The reason for whitelisting only specific, known to work hotplug ports for D3 is that there have been reports of SkyLake Xeon-SP systems raising Hardware Error NMIs upon suspending their hotplug ports:
https://lore.kernel.org/linux-pci/20170503180426.GA4058@otc-nc-03/
But if a hotplug port is power manageable by ACPI (as can be detected through presence of Power Resources and corresponding _PS0 and _PS3 methods) then it ought to be safe to suspend it to D3. To this end, amend acpi_pci_bridge_d3() to whitelist such ports for D3.
--- drivers/pci/pci-acpi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/pci-acpi.c +10 -0
@@ -944,6 +944,16 @@ static bool acpi_pci_bridge_d3(struct pcif (!dev->is_hotplug_bridge)return false; +/* Assume D3 support if the bridge is power-manageable by ACPI. */ + adev =ACPI_COMPANION (&dev->dev); +if (!adev && !pci_dev_is_added (dev)) { + adev =acpi_pci_find_companion (&dev->dev); +ACPI_COMPANION_SET (&dev->dev, adev); + } + +if (adev &&acpi_device_power_manageable (adev)) +return true; +/* * Look for a special _DSD property for the root port and if it * is set we know the hierarchy behind it supports D3 just fine.
Greg Kroah-Hartman
maintainerPATCH 131/214 btrfs: fix use-after-free on readahead extent after failure to create it
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 83bc1560e02e25c6439341352024ebe8488f4fbd upstream.
If we fail to find suitable zones for a new readahead extent, we end up leaving a stale pointer in the global readahead extents radix tree (fs_info->reada_tree), which can trigger the following trace later on:
[13367.696354] BUG: kernel NULL pointer dereference, address: 00000000000000b0 [13367.696802] #PF: supervisor read access in kernel mode [13367.697249] #PF: error_code(0x0000) - not-present page [13367.697721] PGD 0 P4D 0 [13367.698171] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI [13367.698632] CPU: 6 PID: 851214 Comm: btrfs Tainted: G W 5.9.0-rc6-btrfs-next-69 #1 [13367.699100] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [13367.700069] RIP: 0010:__lock_acquire+0x20a/0x3970 [13367.700562] Code: ff 1f 0f b7 c0 48 0f (...) [13367.701609] RSP: 0018:ffffb14448f57790 EFLAGS: 00010046 [13367.702140] RAX: 0000000000000000 RBX: 29b935140c15e8cf RCX: 0000000000000000 [13367.702698] RDX: 0000000000000002 RSI: ffffffffb3d66bd0 RDI: 0000000000000046 [13367.703240] RBP: ffff8a52ba8ac040 R08: 00000c2866ad9288 R09: 0000000000000001 [13367.703783] R10: 0000000000000001 R11: 00000000b66d9b53 R12: ffff8a52ba8ac9b0 [13367.704330] R13: 0000000000000000 R14: ffff8a532b6333e8 R15: 0000000000000000 [13367.704880] FS: 00007fe1df6b5700(0000) GS:ffff8a5376600000(0000) knlGS:0000000000000000 [13367.705438] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [13367.705995] CR2: 00000000000000b0 CR3: 000000022cca8004 CR4: 00000000003706e0 [13367.706565] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [13367.707127] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [13367.707686] Call Trace: [13367.708246] ? ___slab_alloc+0x395/0x740 [13367.708820] ? reada_add_block+0xae/0xee0 [btrfs] [13367.709383] lock_acquire+0xb1/0x480 [13367.709955] ? reada_add_block+0xe0/0xee0 [btrfs] [13367.710537] ? reada_add_block+0xae/0xee0 [btrfs] [13367.711097] ? rcu_read_lock_sched_held+0x5d/0x90 [13367.711659] ? kmem_cache_alloc_trace+0x8d2/0x990 [13367.712221] ? lock_acquired+0x33b/0x470 [13367.712784] _raw_spin_lock+0x34/0x80 [13367.713356] ? reada_add_block+0xe0/0xee0 [btrfs] [13367.713966] reada_add_block+0xe0/0xee0 [btrfs] [13367.714529] ? btrfs_root_node+0x15/0x1f0 [btrfs] [13367.715077] btrfs_reada_add+0x117/0x170 [btrfs] [13367.715620] scrub_stripe+0x21e/0x10d0 [btrfs] [13367.716141] ? kvm_sched_clock_read+0x5/0x10 [13367.716657] ? __lock_acquire+0x41e/0x3970 [13367.717184] ? scrub_chunk+0x60/0x140 [btrfs] [13367.717697] ? find_held_lock+0x32/0x90 [13367.718254] ? scrub_chunk+0x60/0x140 [btrfs] [13367.718773] ? lock_acquired+0x33b/0x470 [13367.719278] ? scrub_chunk+0xcd/0x140 [btrfs] [13367.719786] scrub_chunk+0xcd/0x140 [btrfs] [13367.720291] scrub_enumerate_chunks+0x270/0x5c0 [btrfs] [13367.720787] ? finish_wait+0x90/0x90 [13367.721281] btrfs_scrub_dev+0x1ee/0x620 [btrfs] [13367.721762] ? rcu_read_lock_any_held+0x8e/0xb0 [13367.722235] ? preempt_count_add+0x49/0xa0 [13367.722710] ? __sb_start_write+0x19b/0x290 [13367.723192] btrfs_ioctl+0x7f5/0x36f0 [btrfs] [13367.723660] ? __fget_files+0x101/0x1d0 [13367.724118] ? find_held_lock+0x32/0x90 [13367.724559] ? __fget_files+0x101/0x1d0 [13367.724982] ? __x64_sys_ioctl+0x83/0xb0 [13367.725399] __x64_sys_ioctl+0x83/0xb0 [13367.725802] do_syscall_64+0x33/0x80 [13367.726188] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [13367.726574] RIP: 0033:0x7fe1df7add87 [13367.726948] Code: 00 00 00 48 8b 05 09 91 (...) [13367.727763] RSP: 002b:00007fe1df6b4d48 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [13367.728179] RAX: ffffffffffffffda RBX: 000055ce1fb596a0 RCX: 00007fe1df7add87 [13367.728604] RDX: 000055ce1fb596a0 RSI: 00000000c400941b RDI: 0000000000000003 [13367.729021] RBP: 0000000000000000 R08: 00007fe1df6b5700 R09: 0000000000000000 [13367.729431] R10: 00007fe1df6b5700 R11: 0000000000000246 R12: 00007ffd922b07de [13367.729842] R13: 00007ffd922b07df R14: 00007fe1df6b4e40 R15: 0000000000802000 [13367.730275] Modules linked in: btrfs blake2b_generic xor (...) [13367.732638] CR2: 00000000000000b0 [13367.733166] ---[ end trace d298b6805556acd9 ]---
What happens is the following:
1) At reada_find_extent() we don't find any existing readahead extent for the metadata extent starting at logical address X;
2) So we proceed to create a new one. We then call btrfs_map_block() to get information about which stripes contain extent X;
3) After that we iterate over the stripes and create only one zone for the readahead extent - only one because reada_find_zone() returned NULL for all iterations except for one, either because a memory allocation failed or it couldn't find the block group of the extent (it may have just been deleted);
4) We then add the new readahead extent to the readahead extents radix tree at fs_info->reada_tree;
5) Then we iterate over each zone of the new readahead extent, and find that the device used for that zone no longer exists, because it was removed or it was the source device of a device replace operation. Since this left 'have_zone' set to 0, after finishing the loop we jump to the 'error' label, call kfree() on the new readahead extent and return without removing it from the radix tree at fs_info->reada_tree;
6) Any future call to reada_find_extent() for the logical address X will find the stale pointer in the readahead extents radix tree, increment its reference counter, which can trigger the use-after-free right away or return it to the caller reada_add_block() that results in the use-after-free of the example trace above.
So fix this by making sure we delete the readahead extent from the radix tree if we fail to setup zones for it (when 'have_zone = 0').
--- fs/btrfs/reada.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/reada.c +2 -0
@@ -445,6 +445,8 @@ static struct reada_extent *reada_find_e } have_zone =1 ; } +if (!have_zone) +radix_tree_delete (&fs_info->reada_tree, index);spin_unlock (&fs_info->reada_lock);up_read (&fs_info->dev_replace.rwsem);
Greg Kroah-Hartman
maintainerPATCH 129/214 btrfs: cleanup cow block on error
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 572c83acdcdafeb04e70aa46be1fa539310be20c upstream.
In fstest btrfs/064 a transaction abort in __btrfs_cow_block could lead to a system lockup. It gets stuck trying to write back inodes, and the write back thread was trying to lock an extent buffer:
$ cat /proc/2143497/stack [<0>] __btrfs_tree_lock+0x108/0x250 [<0>] lock_extent_buffer_for_io+0x35e/0x3a0 [<0>] btree_write_cache_pages+0x15a/0x3b0 [<0>] do_writepages+0x28/0xb0 [<0>] __writeback_single_inode+0x54/0x5c0 [<0>] writeback_sb_inodes+0x1e8/0x510 [<0>] wb_writeback+0xcc/0x440 [<0>] wb_workfn+0xd7/0x650 [<0>] process_one_work+0x236/0x560 [<0>] worker_thread+0x55/0x3c0 [<0>] kthread+0x13a/0x150 [<0>] ret_from_fork+0x1f/0x30
This is because we got an error while COWing a block, specifically here
if (test_bit(BTRFS_ROOT_SHAREABLE, &root->state)) {
ret = btrfs_reloc_cow_block(trans, root, buf, cow);
if (ret) {
btrfs_abort_transaction(trans, ret);
return ret;
}
}[16402.241552] BTRFS: Transaction aborted (error -2) [16402.242362] WARNING: CPU: 1 PID: 2563188 at fs/btrfs/ctree.c:1074 __btrfs_cow_block+0x376/0x540 [16402.249469] CPU: 1 PID: 2563188 Comm: fsstress Not tainted 5.9.0-rc6+ #8 [16402.249936] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 [16402.250525] RIP: 0010:__btrfs_cow_block+0x376/0x540 [16402.252417] RSP: 0018:ffff9cca40e578b0 EFLAGS: 00010282 [16402.252787] RAX: 0000000000000025 RBX: 0000000000000002 RCX: ffff9132bbd19388 [16402.253278] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9132bbd19380 [16402.254063] RBP: ffff9132b41a49c0 R08: 0000000000000000 R09: 0000000000000000 [16402.254887] R10: 0000000000000000 R11: ffff91324758b080 R12: ffff91326ef17ce0 [16402.255694] R13: ffff91325fc0f000 R14: ffff91326ef176b0 R15: ffff9132815e2000 [16402.256321] FS: 00007f542c6d7b80(0000) GS:ffff9132bbd00000(0000) knlGS:0000000000000000 [16402.256973] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [16402.257374] CR2: 00007f127b83f250 CR3: 0000000133480002 CR4: 0000000000370ee0 [16402.257867] Call Trace: [16402.258072] btrfs_cow_block+0x109/0x230 [16402.258356] btrfs_search_slot+0x530/0x9d0 [16402.258655] btrfs_lookup_file_extent+0x37/0x40 [16402.259155] __btrfs_drop_extents+0x13c/0xd60 [16402.259628] ? btrfs_block_rsv_migrate+0x4f/0xb0 [16402.259949] btrfs_replace_file_extents+0x190/0x820 [16402.260873] btrfs_clone+0x9ae/0xc00 [16402.261139] btrfs_extent_same_range+0x66/0x90 [16402.261771] btrfs_remap_file_range+0x353/0x3b1 [16402.262333] vfs_dedupe_file_range_one.part.0+0xd5/0x140 [16402.262821] vfs_dedupe_file_range+0x189/0x220 [16402.263150] do_vfs_ioctl+0x552/0x700 [16402.263662] __x64_sys_ioctl+0x62/0xb0 [16402.264023] do_syscall_64+0x33/0x40 [16402.264364] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [16402.264862] RIP: 0033:0x7f542c7d15cb [16402.266901] RSP: 002b:00007ffd35944ea8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [16402.267627] RAX: ffffffffffffffda RBX: 00000000009d1968 RCX: 00007f542c7d15cb [16402.268298] RDX: 00000000009d2490 RSI: 00000000c0189436 RDI: 0000000000000003 [16402.268958] RBP: 00000000009d2520 R08: 0000000000000036 R09: 00000000009d2e64 [16402.269726] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 [16402.270659] R13: 000000000001f000 R14: 00000000009d1970 R15: 00000000009d2e80 [16402.271498] irq event stamp: 0 [16402.271846] hardirqs last enabled at (0): [<0000000000000000>] 0x0 [16402.272497] hardirqs last disabled at (0): [<ffffffff910dbf59>] copy_process+0x6b9/0x1ba0 [16402.273343] softirqs last enabled at (0): [<ffffffff910dbf59>] copy_process+0x6b9/0x1ba0 [16402.273905] softirqs last disabled at (0): [<0000000000000000>] 0x0 [16402.274338] ---[ end trace 737874a5a41a8236 ]--- [16402.274669] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry [16402.276179] BTRFS info (device dm-9): forced readonly [16402.277046] BTRFS: error (device dm-9) in btrfs_replace_file_extents:2723: errno=-2 No such entry [16402.278744] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry [16402.279968] BTRFS: error (device dm-9) in __btrfs_cow_block:1074: errno=-2 No such entry [16402.280582] BTRFS info (device dm-9): balance: ended with status: -30
The problem here is that as soon as we allocate the new block it is locked and marked dirty in the btree inode. This means that we could attempt to writeback this block and need to lock the extent buffer. However we're not unlocking it here and thus we deadlock.
Fix this by unlocking the cow block if we have any errors inside of __btrfs_cow_block, and also free it so we do not leak it.
--- fs/btrfs/ctree.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/ctree.c +6 -0
@@ -1103,6 +1103,8 @@ static noinline int __btrfs_cow_block(st ret =update_ref_for_cow (trans, root, buf, cow, &last_ref);if (ret) { +btrfs_tree_unlock (cow); +free_extent_buffer (cow);btrfs_abort_transaction (trans, ret);return ret; }
@@ -1110,6 +1112,8 @@ static noinline int __btrfs_cow_block(stif (test_bit (BTRFS_ROOT_REF_COWS , &root->state)) { ret =btrfs_reloc_cow_block (trans, root, buf, cow);if (ret) { +btrfs_tree_unlock (cow); +free_extent_buffer (cow);btrfs_abort_transaction (trans, ret);return ret; }
@@ -1142,6 +1146,8 @@ static noinline int __btrfs_cow_block(stif (last_ref) { ret =tree_mod_log_free_eb (buf);if (ret) { +btrfs_tree_unlock (cow); +free_extent_buffer (cow);btrfs_abort_transaction (trans, ret);return ret; }
Greg Kroah-Hartman
maintainerPATCH 128/214 btrfs: tree-checker: fix false alert caused by legacy btrfs root item
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 1465af12e254a68706e110846f59cf0f09683184 upstream.
Commit 259ee7754b67 ("btrfs: tree-checker: Add ROOT_ITEM check") introduced btrfs root item size check, however btrfs root item has two versions, the legacy one which just ends before generation_v2 member, is smaller than current btrfs root item size.
This caused btrfs kernel to reject valid but old tree root leaves.
Fix this problem by also allowing legacy root item, since kernel can already handle them pretty well and upgrade to newer root item format when needed.
--- fs/btrfs/tree-checker.c | 17 ++++++++++++----- include/uapi/linux/btrfs_tree.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-)
fs/btrfs/tree-checker.c +12 -5
@@ -869,7 +869,7 @@ static int check_root_item(struct extent int slot) {struct btrfs_fs_info *fs_info = leaf->fs_info; -struct btrfs_root_item ri; +struct btrfs_root_item ri = {0 };const u64 valid_root_flags =BTRFS_ROOT_SUBVOL_RDONLY |BTRFS_ROOT_SUBVOL_DEAD ;
@@ -889,14 +889,21 @@ static int check_root_item(struct extentreturn -EUCLEAN ; } -if (btrfs_item_size_nr (leaf, slot) !=sizeof (ri)) { +if (btrfs_item_size_nr (leaf, slot) !=sizeof (ri) && +btrfs_item_size_nr (leaf, slot) !=btrfs_legacy_root_item_size ()) {generic_err (leaf, slot, -"invalid root item size, have %u expect %zu" , -btrfs_item_size_nr (leaf, slot),sizeof (ri)); +"invalid root item size, have %u expect %zu or %u" , +btrfs_item_size_nr (leaf, slot),sizeof (ri), +btrfs_legacy_root_item_size ()); } +/* +* For legacy root item, the members starting at generation_v2 will be +* all filled with 0. +* And since we allow geneartion_v2 as 0, it will still pass the check. +*/ read_extent_buffer (leaf, &ri,btrfs_item_ptr_offset (leaf, slot), -sizeof (ri)); +btrfs_item_size_nr (leaf, slot));/* Generation related */ if (btrfs_root_generation(&ri) >
include/uapi/linux/btrfs_tree.h +14 -0
@@ -4,6 +4,11 @@#include <linux/btrfs.h> #include <linux/types.h> +#ifdef __KERNEL__ +#include <linux/stddef.h> +#else +#include <stddef.h> +#endif /* * This header contains the structure definitions and constants used
@@ -651,6 +656,15 @@ struct btrfs_root_item { } __attribute__ ((__packed__));/* +* Btrfs root item used to be smaller than current size. The old format ends +* at where member generation_v2 is. +*/ +static inline __u32 btrfs_legacy_root_item_size (void ) +{ +return offsetof(struct btrfs_root_item , generation_v2); +} + +/* * this is used for both forward and backward root refs */ struct btrfs_root_ref {
Greg Kroah-Hartman
maintainerPATCH 127/214 btrfs: use kvzalloc() to allocate clone_roots in btrfs_ioctl_send()
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit 8eb2fd00153a3a96a19c62ac9c6d48c2efebe5e8 upstream.
btrfs_ioctl_send() used open-coded kvzalloc implementation earlier. The code was accidentally replaced with kzalloc() call [1]. Restore the original code by using kvzalloc() to allocate sctx->clone_roots.
[1] https://patchwork.kernel.org/patch/9757891/#20529627
--- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/send.c +1 -1
@@ -7352,7 +7352,7 @@ long btrfs_ioctl_send(struct file *mnt_f alloc_size =sizeof (struct clone_root ) * (arg->clone_sources_count +1 ); - sctx->clone_roots =kzalloc (alloc_size,GFP_KERNEL ); + sctx->clone_roots =kvzalloc (alloc_size,GFP_KERNEL );if (!sctx->clone_roots) { ret = -ENOMEM ; goto out;
Greg Kroah-Hartman
maintainerPATCH 126/214 btrfs: send, recompute reference path after orphanization of a directory
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 9c2b4e0347067396ceb3ae929d6888c81d610259 upstream.
During an incremental send, when an inode has multiple new references we might end up emitting rename operations for orphanizations that have a source path that is no longer valid due to a previous orphanization of some directory inode. This causes the receiver to fail since it tries to rename a path that does not exists.
Example reproducer:
$ cat reproducer.sh #!/bin/bash
mkfs.btrfs -f /dev/sdi >/dev/null
mount /dev/sdi /mnt/sdi
touch /mnt/sdi/f1
touch /mnt/sdi/f2
mkdir /mnt/sdi/d1
mkdir /mnt/sdi/d1/d2
# Filesystem looks like:
#
# . (ino 256) # |----- f1 (ino 257) # |----- f2 (ino 258) # |----- d1/ (ino 259) # |----- d2/ (ino 260)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap1 btrfs send -f /tmp/snap1.send /mnt/sdi/snap1
# Now do a series of changes such that:
#
# *) inode 258 has one new hardlink and the previous name changed #
# *) both names conflict with the old names of two other inodes:
#
# 1) the new name "d1" conflicts with the old name of inode 259,
# under directory inode 256 (root)
#
# 2) the new name "d2" conflicts with the old name of inode 260
# under directory inode 259
#
# *) inodes 259 and 260 now have the old names of inode 258 #
# *) inode 257 is now located under inode 260 - an inode with a number
# smaller than the inode (258) for which we created a second hard
# link and swapped its names with inodes 259 and 260
#
ln /mnt/sdi/f2 /mnt/sdi/d1/f2_link
mv /mnt/sdi/f1 /mnt/sdi/d1/d2/f1
# Swap d1 and f2.
mv /mnt/sdi/d1 /mnt/sdi/tmp
mv /mnt/sdi/f2 /mnt/sdi/d1
mv /mnt/sdi/tmp /mnt/sdi/f2
# Swap d2 and f2_link
mv /mnt/sdi/f2/d2 /mnt/sdi/tmp
mv /mnt/sdi/f2/f2_link /mnt/sdi/f2/d2
mv /mnt/sdi/tmp /mnt/sdi/f2/f2_link
# Filesystem now looks like:
#
# . (ino 256) # |----- d1 (ino 258) # |----- f2/ (ino 259) # |----- f2_link/ (ino 260) # | |----- f1 (ino 257) # | # |----- d2 (ino 258)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap2 btrfs send -f /tmp/snap2.send -p /mnt/sdi/snap1 /mnt/sdi/snap2
mkfs.btrfs -f /dev/sdj >/dev/null
mount /dev/sdj /mnt/sdj
btrfs receive -f /tmp/snap1.send /mnt/sdj
btrfs receive -f /tmp/snap2.send /mnt/sdj
umount /mnt/sdi
umount /mnt/sdj
When executed the receive of the incremental stream fails:
$ ./reproducer.sh Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap1' At subvol /mnt/sdi/snap1 Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap2' At subvol /mnt/sdi/snap2 At subvol snap1 At snapshot snap2 ERROR: rename d1/d2 -> o260-6-0 failed: No such file or directory
This happens because:
1) When processing inode 257 we end up computing the name for inode 259 because it is an ancestor in the send snapshot, and at that point it still has its old name, "d1", from the parent snapshot because inode 259 was not yet processed. We then cache that name, which is valid until we start processing inode 259 (or set the progress to 260 after processing its references);
2) Later we start processing inode 258 and collecting all its new references into the list sctx->new_refs. The first reference in the list happens to be the reference for name "d1" while the reference for name "d2" is next (the last element of the list).
We compute the full path "d1/d2" for this second reference and store it in the reference (its ->full_path member). The path used for the new parent directory was "d1" and not "f2" because inode 259, the new parent, was not yet processed;
3) When we start processing the new references at process_recorded_refs() we start with the first reference in the list, for the new name "d1". Because there is a conflicting inode that was not yet processed, which is directory inode 259, we orphanize it, renaming it from "d1" to "o259-6-0";
4) Then we start processing the new reference for name "d2", and we realize it conflicts with the reference of inode 260 in the parent snapshot. So we issue an orphanization operation for inode 260 by emitting a rename operation with a destination path of "o260-6-0" and a source path of "d1/d2" - this source path is the value we stored in the reference earlier at step 2), corresponding to the ->full_path member of the reference, however that path is no longer valid due to the orphanization of the directory inode 259 in step 3). This makes the receiver fail since the path does not exists, it should have been "o259-6-0/d2".
Fix this by recomputing the full path of a reference before emitting an orphanization if we previously orphanized any directory, since that directory could be a parent in the new path. This is a rare scenario so keeping it simple and not checking if that previously orphanized directory is in fact an ancestor of the inode we are trying to orphanize.
A test case for fstests follows soon.
--- fs/btrfs/send.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
fs/btrfs/send.c +72 -0
@@ -3813,6 +3813,72 @@ static int update_ref_path(struct send_c }/* +* When processing the new references for an inode we may orphanize an existing +* directory inode because its old name conflicts with one of the new references +* of the current inode. Later, when processing another new reference of our +* inode, we might need to orphanize another inode, but the path we have in the +* reference reflects the pre-orphanization name of the directory we previously +* orphanized. For example: +* +* parent snapshot looks like: +* +* . (ino 256) +* |----- f1 (ino 257) +* |----- f2 (ino 258) +* |----- d1/ (ino 259) +* |----- d2/ (ino 260) +* +* send snapshot looks like: +* +* . (ino 256) +* |----- d1 (ino 258) +* |----- f2/ (ino 259) +* |----- f2_link/ (ino 260) +* | |----- f1 (ino 257) +* | +* |----- d2 (ino 258) +* +* When processing inode 257 we compute the name for inode 259 as "d1", and we +* cache it in the name cache. Later when we start processing inode 258, when +* collecting all its new references we set a full path of "d1/d2" for its new +* reference with name "d2". When we start processing the new references we +* start by processing the new reference with name "d1", and this results in +* orphanizing inode 259, since its old reference causes a conflict. Then we +* move on the next new reference, with name "d2", and we find out we must +* orphanize inode 260, as its old reference conflicts with ours - but for the +* orphanization we use a source path corresponding to the path we stored in the +* new reference, which is "d1/d2" and not "o259-6-0/d2" - this makes the +* receiver fail since the path component "d1/" no longer exists, it was renamed +* to "o259-6-0/" when processing the previous new reference. So in this case we +* must recompute the path in the new reference and use it for the new +* orphanization operation. +*/ +static int refresh_ref_path (struct send_ctx *sctx,struct recorded_ref *ref) +{ +char *name; +int ret; + + name =kmemdup (ref->name, ref->name_len,GFP_KERNEL ); +if (!name) +return -ENOMEM ; + +fs_path_reset (ref->full_path); + ret =get_cur_path (sctx, ref->dir, ref->dir_gen, ref->full_path); +if (ret <0 ) + goto out; + + ret =fs_path_add (ref->full_path, name, ref->name_len); +if (ret <0 ) + goto out; + +/* Update the reference's base name pointer. */ +set_ref_path (ref, ref->full_path); +out: +kfree (name); +return ret; +} + +/* * This does all the move/link/unlink/rmdir magic. */ static int process_recorded_refs (struct send_ctx *sctx,int *pending_move)
@@ -3946,6 +4012,12 @@ static int process_recorded_refs(structstruct name_cache_entry *nce;struct waiting_dir_move *wdm; +if (orphanized_dir) { + ret =refresh_ref_path (sctx, cur); +if (ret <0 ) + goto out; + } + ret =orphanize_inode (sctx, ow_inode, ow_gen, cur->full_path);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 124/214 btrfs: reschedule if necessary when logging directory items
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit bb56f02f26fe23798edb1b2175707419b28c752a upstream.
Logging directories with many entries can take a significant amount of time, and in some cases monopolize a cpu/core for a long time if the logging task doesn't happen to block often enough.
Johannes and Lu Fengqi reported test case generic/041 triggering a soft lockup when the kernel has CONFIG_SOFTLOCKUP_DETECTOR=y. For this test case we log an inode with 3002 hard links, and because the test removed one hard link before fsyncing the file, the inode logging causes the parent directory do be logged as well, which has 6004 directory items to log (3002 BTRFS_DIR_ITEM_KEY items plus 3002 BTRFS_DIR_INDEX_KEY items), so it can take a significant amount of time and trigger the soft lockup.
So just make tree-log.c:log_dir_items() reschedule when necessary, releasing the current search path before doing so and then resume from where it was before the reschedule.
The stack trace produced when the soft lockup happens is the following:
[10480.277653] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [xfs_io:28172] [10480.279418] Modules linked in: dm_thin_pool dm_persistent_data (...) [10480.284915] irq event stamp: 29646366 [10480.285987] hardirqs last enabled at (29646365): [<ffffffff85249b66>] __slab_alloc.constprop.0+0x56/0x60 [10480.288482] hardirqs last disabled at (29646366): [<ffffffff8579b00d>] irqentry_enter+0x1d/0x50 [10480.290856] softirqs last enabled at (4612): [<ffffffff85a00323>] __do_softirq+0x323/0x56c [10480.293615] softirqs last disabled at (4483): [<ffffffff85800dbf>] asm_call_on_stack+0xf/0x20 [10480.296428] CPU: 2 PID: 28172 Comm: xfs_io Not tainted 5.9.0-rc4-default+ #1248 [10480.298948] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014 [10480.302455] RIP: 0010:__slab_alloc.constprop.0+0x19/0x60 [10480.304151] Code: 86 e8 31 75 21 00 66 66 2e 0f 1f 84 00 00 00 (...) [10480.309558] RSP: 0018:ffffadbe09397a58 EFLAGS: 00000282 [10480.311179] RAX: ffff8a495ab92840 RBX: 0000000000000282 RCX: 0000000000000006 [10480.313242] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff85249b66 [10480.315260] RBP: ffff8a497d04b740 R08: 0000000000000001 R09: 0000000000000001 [10480.317229] R10: ffff8a497d044800 R11: ffff8a495ab93c40 R12: 0000000000000000 [10480.319169] R13: 0000000000000000 R14: 0000000000000c40 R15: ffffffffc01daf70 [10480.321104] FS: 00007fa1dc5c0e40(0000) GS:ffff8a497da00000(0000) knlGS:0000000000000000 [10480.323559] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [10480.325235] CR2: 00007fa1dc5befb8 CR3: 0000000004f8a006 CR4: 0000000000170ea0 [10480.327259] Call Trace: [10480.328286] ? overwrite_item+0x1f0/0x5a0 [btrfs] [10480.329784] __kmalloc+0x831/0xa20 [10480.331009] ? btrfs_get_32+0xb0/0x1d0 [btrfs] [10480.332464] overwrite_item+0x1f0/0x5a0 [btrfs] [10480.333948] log_dir_items+0x2ee/0x570 [btrfs] [10480.335413] log_directory_changes+0x82/0xd0 [btrfs] [10480.336926] btrfs_log_inode+0xc9b/0xda0 [btrfs] [10480.338374] ? init_once+0x20/0x20 [btrfs] [10480.339711] btrfs_log_inode_parent+0x8d3/0xd10 [btrfs] [10480.341257] ? dget_parent+0x97/0x2e0 [10480.342480] btrfs_log_dentry_safe+0x3a/0x50 [btrfs] [10480.343977] btrfs_sync_file+0x24b/0x5e0 [btrfs] [10480.345381] do_fsync+0x38/0x70 [10480.346483] __x64_sys_fsync+0x10/0x20 [10480.347703] do_syscall_64+0x2d/0x70 [10480.348891] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [10480.350444] RIP: 0033:0x7fa1dc80970b [10480.351642] Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 (...) [10480.356952] RSP: 002b:00007fffb3d081d0 EFLAGS: 00000293 ORIG_RAX: 000000000000004a [10480.359458] RAX: ffffffffffffffda RBX: 0000562d93d45e40 RCX: 00007fa1dc80970b [10480.361426] RDX: 0000562d93d44ab0 RSI: 0000562d93d45e60 RDI: 0000000000000003 [10480.363367] RBP: 0000000000000001 R08: 0000000000000000 R09: 00007fa1dc7b2a40 [10480.365317] R10: 0000562d93d0e366 R11: 0000000000000293 R12: 0000000000000001 [10480.367299] R13: 0000562d93d45290 R14: 0000562d93d45e40 R15: 0000562d93d45e60
--- fs/btrfs/tree-log.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/btrfs/tree-log.c +8 -0
@@ -3639,6 +3639,7 @@ static noinline int log_dir_items(struct* search and this search we'll not find the key again and can just * bail. */ +search: ret =btrfs_search_slot (NULL , root, &min_key, path,0 ,0 );if (ret !=0 ) goto done;
@@ -3658,6 +3659,13 @@ static noinline int log_dir_items(structif (min_key.objectid != ino || min_key.type != key_type) goto done; + +if (need_resched ()) { +btrfs_release_path (path); +cond_resched (); + goto search; + } + ret =overwrite_item (trans, log, dst_path, src, i, &min_key);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 125/214 btrfs: send, orphanize first all conflicting inodes when processing references
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 98272bb77bf4cc20ed1ffca89832d713e70ebf09 upstream.
When doing an incremental send it is possible that when processing the new references for an inode we end up issuing rename or link operations that have an invalid path, which contains the orphanized name of a directory before we actually orphanized it, causing the receiver to fail.
The following reproducer triggers such scenario:
$ cat reproducer.sh #!/bin/bash
mkfs.btrfs -f /dev/sdi >/dev/null
mount /dev/sdi /mnt/sdi
touch /mnt/sdi/a
touch /mnt/sdi/b
mkdir /mnt/sdi/testdir
# We want "a" to have a lower inode number then "testdir" (257 vs 259). mv /mnt/sdi/a /mnt/sdi/testdir/a
# Filesystem looks like:
#
# . (ino 256) # |----- testdir/ (ino 259) # | |----- a (ino 257) # | # |----- b (ino 258)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap1 btrfs send -f /tmp/snap1.send /mnt/sdi/snap1
# Now rename 259 to "testdir_2", then change the name of 257 to # "testdir" and make it a direct descendant of the root inode (256). # Also create a new link for inode 257 with the old name of inode 258. # By swapping the names and location of several inodes and create a
# nasty dependency chain of rename and link operations. mv /mnt/sdi/testdir/a /mnt/sdi/a2 touch /mnt/sdi/testdir/a mv /mnt/sdi/b /mnt/sdi/b2 ln /mnt/sdi/a2 /mnt/sdi/b mv /mnt/sdi/testdir /mnt/sdi/testdir_2 mv /mnt/sdi/a2 /mnt/sdi/testdir
# Filesystem now looks like:
#
# . (ino 256) # |----- testdir_2/ (ino 259) # | |----- a (ino 260) # | # |----- testdir (ino 257) # |----- b (ino 257) # |----- b2 (ino 258)
btrfs subvolume snapshot -r /mnt/sdi /mnt/sdi/snap2 btrfs send -f /tmp/snap2.send -p /mnt/sdi/snap1 /mnt/sdi/snap2
mkfs.btrfs -f /dev/sdj >/dev/null
mount /dev/sdj /mnt/sdj
btrfs receive -f /tmp/snap1.send /mnt/sdj
btrfs receive -f /tmp/snap2.send /mnt/sdj
umount /mnt/sdi
umount /mnt/sdj
When running the reproducer, the receive of the incremental send stream fails:
$ ./reproducer.sh Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap1' At subvol /mnt/sdi/snap1 Create a readonly snapshot of '/mnt/sdi' in '/mnt/sdi/snap2' At subvol /mnt/sdi/snap2 At subvol snap1 At snapshot snap2 ERROR: link b -> o259-6-0/a failed: No such file or directory
The problem happens because of the following:
1) Before we start iterating the list of new references for inode 257, we generate its current path and store it at @valid_path, done at the very beginning of process_recorded_refs(). The generated path is "o259-6-0/a", containing the orphanized name for inode 259;
2) Then we iterate over the list of new references, which has the references "b" and "testdir" in that specific order;
3) We process reference "b" first, because it is in the list before reference "testdir". We then issue a link operation to create the new reference "b" using a target path corresponding to the content at @valid_path, which corresponds to "o259-6-0/a". However we haven't yet orphanized inode 259, its name is still "testdir", and not "o259-6-0". The orphanization of 259 did not happen yet because we will process the reference named "testdir" for inode 257 only in the next iteration of the loop that goes over the list of new references.
Fix the issue by having a preliminar iteration over all the new references at process_recorded_refs(). This iteration is responsible only for doing the orphanization of other inodes that have and old reference that conflicts with one of the new references of the inode we are currently processing. The emission of rename and link operations happen now in the next iteration of the new references.
A test case for fstests will follow soon.
--- fs/btrfs/send.c | 127 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 40 deletions(-)
fs/btrfs/send.c +87 -40
@@ -3880,52 +3880,56 @@ static int process_recorded_refs(struct goto out; } +/* +* Before doing any rename and link operations, do a first pass on the +* new references to orphanize any unprocessed inodes that may have a +* reference that conflicts with one of the new references of the current +* inode. This needs to happen first because a new reference may conflict +* with the old reference of a parent directory, so we must make sure +* that the path used for link and rename commands don't use an +* orphanized name when an ancestor was not yet orphanized. +* +* Example: +* +* Parent snapshot: +* +* . (ino 256) +* |----- testdir/ (ino 259) +* | |----- a (ino 257) +* | +* |----- b (ino 258) +* +* Send snapshot: +* +* . (ino 256) +* |----- testdir_2/ (ino 259) +* | |----- a (ino 260) +* | +* |----- testdir (ino 257) +* |----- b (ino 257) +* |----- b2 (ino 258) +* +* Processing the new reference for inode 257 with name "b" may happen +* before processing the new reference with name "testdir". If so, we +* must make sure that by the time we send a link command to create the +* hard link "b", inode 259 was already orphanized, since the generated +* path in "valid_path" already contains the orphanized name for 259. +* We are processing inode 257, so only later when processing 259 we do +* the rename operation to change its temporary (orphanized) name to +* "testdir_2". +*/ list_for_each_entry (cur, &sctx->new_refs, list) { -/* -* We may have refs where the parent directory does not exist -* yet. This happens if the parent directories inum is higher -* than the current inum. To handle this case, we create the -* parent directory out of order. But we need to check if this -* did already happen before due to other refs in the same dir. -*/ ret =get_cur_inode_state (sctx, cur->dir, cur->dir_gen);if (ret <0 ) goto out; -if (ret == inode_state_will_create) { - ret =0 ; -/* -* First check if any of the current inodes refs did -* already create the dir. -*/ -list_for_each_entry (cur2, &sctx->new_refs, list) { -if (cur == cur2) -break ; -if (cur2->dir == cur->dir) { - ret =1 ; -break ; - } - } - -/* -* If that did not happen, check if a previous inode -* did already create the dir. -*/ -if (!ret) - ret =did_create_dir (sctx, cur->dir); -if (ret <0 ) - goto out; -if (!ret) { - ret =send_create_inode (sctx, cur->dir); -if (ret <0 ) - goto out; - } - } +if (ret == inode_state_will_create) +continue ;/* -* Check if this new ref would overwrite the first ref of -* another unprocessed inode. If yes, orphanize the -* overwritten inode. If we find an overwritten ref that is -* not the first ref, simply unlink it. +* Check if this new ref would overwrite the first ref of another +* unprocessed inode. If yes, orphanize the overwritten inode. +* If we find an overwritten ref that is not the first ref, +* simply unlink it. */ ret = will_overwrite_ref(sctx, cur->dir, cur->dir_gen, cur->name, cur->name_len,
@@ -4002,6 +4006,49 @@ static int process_recorded_refs(structif (ret <0 ) goto out; } + } + + } + +list_for_each_entry (cur, &sctx->new_refs, list) { +/* +* We may have refs where the parent directory does not exist +* yet. This happens if the parent directories inum is higher +* than the current inum. To handle this case, we create the +* parent directory out of order. But we need to check if this +* did already happen before due to other refs in the same dir. +*/ + ret =get_cur_inode_state (sctx, cur->dir, cur->dir_gen); +if (ret <0 ) + goto out; +if (ret == inode_state_will_create) { + ret =0 ; +/* +* First check if any of the current inodes refs did +* already create the dir. +*/ +list_for_each_entry (cur2, &sctx->new_refs, list) { +if (cur == cur2) +break ; +if (cur2->dir == cur->dir) { + ret =1 ; +break ; + } + } + +/* +* If that did not happen, check if a previous inode +* did already create the dir. +*/ +if (!ret) + ret =did_create_dir (sctx, cur->dir); +if (ret <0 ) + goto out; +if (!ret) { + ret =send_create_inode (sctx, cur->dir); +if (ret <0 ) + goto out; + } }if (S_ISDIR (sctx->cur_inode_mode) && sctx->parent_root) {
Greg Kroah-Hartman
maintainerPATCH 113/214 ACPI: debug: dont allow debugging when ACPI is disabled
In reply to Greg Kroah-HartmanFrom: Jamie Iles <[email protected]>
commit 0fada277147ffc6d694aa32162f51198d4f10d94 upstream.
If ACPI is disabled then loading the acpi_dbg module will result in the following splat when lock debugging is enabled.
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 0 PID: 1 at kernel/locking/mutex.c:938 __mutex_lock+0xa10/0x1290 Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc8+ #103 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x4d8 show_stack+0x34/0x48 dump_stack+0x174/0x1f8 panic+0x360/0x7a0 __warn+0x244/0x2ec report_bug+0x240/0x398 bug_handler+0x50/0xc0 call_break_hook+0x160/0x1d8 brk_handler+0x30/0xc0 do_debug_exception+0x184/0x340 el1_dbg+0x48/0xb0 el1_sync_handler+0x170/0x1c8 el1_sync+0x80/0x100 __mutex_lock+0xa10/0x1290 mutex_lock_nested+0x6c/0xc0 acpi_register_debugger+0x40/0x88 acpi_aml_init+0xc4/0x114 do_one_initcall+0x24c/0xb10 kernel_init_freeable+0x690/0x728 kernel_init+0x20/0x1e8 ret_from_fork+0x10/0x18
This is because acpi_debugger.lock has not been initialized as acpi_debugger_init() is not called when ACPI is disabled. Fail module loading to avoid this and any subsequent problems that might arise by trying to debug AML when ACPI is disabled.
--- drivers/acpi/acpi_dbg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_dbg.c +3 -0
@@ -749,6 +749,9 @@ int __init acpi_aml_init(void) {int ret; +if (acpi_disabled) +return -ENODEV ; +/* Initialize AML IO interface */ mutex_init (&acpi_aml_io.lock);init_waitqueue_head (&acpi_aml_io.wait);
Greg Kroah-Hartman
maintainerPATCH 123/214 btrfs: improve device scanning messages
In reply to Greg Kroah-HartmanFrom: Anand Jain <[email protected]>
commit 79dae17d8d44b2d15779e332180080af45df5352 upstream.
Systems booting without the initramfs seems to scan an unusual kind of device path (/dev/root). And at a later time, the device is updated to the correct path. We generally print the process name and PID of the process scanning the device but we don't capture the same information if the device path is rescanned with a different pathname.
The current message is too long, so drop the unnecessary UUID and add process name and PID.
While at this also update the duplicate device warning to include the process name and PID so the messages are consistent
CC: [email protected] # 4.19+
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=89721
--- fs/btrfs/volumes.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/btrfs/volumes.c +8 -6
@@ -1123,16 +1123,18 @@ static noinline struct btrfs_device *devbdput (path_bdev);mutex_unlock (&fs_devices->device_list_mutex);btrfs_warn_in_rcu (device->fs_info, -"duplicate device fsid:devid for %pU:%llu old:%s new:%s" , - disk_super->fsid, devid, -rcu_str_deref (device->name), path); +"duplicate device %s devid %llu generation %llu scanned by %s (%d)" , + path, devid, found_transid, + current->comm, +task_pid_nr (current));return ERR_PTR (-EEXIST ); }bdput (path_bdev);btrfs_info_in_rcu (device->fs_info, -"device fsid %pU devid %llu moved old:%s new:%s" , - disk_super->fsid, devid, -rcu_str_deref (device->name), path); +"devid %llu device path %s changed to %s scanned by %s (%d)" , + devid,rcu_str_deref (device->name), + path, current->comm, +task_pid_nr (current)); } name =rcu_string_strdup (path,GFP_NOFS );