Skip to content
  1. Jul 19, 2023
    • Jason A. Donenfeld's avatar
      wireguard: netlink: send staged packets when setting initial private key · 3173bfdf
      Jason A. Donenfeld authored
      commit f58d0a9b upstream.
      
      Packets bound for peers can queue up prior to the device private key
      being set. For example, if persistent keepalive is set, a packet is
      queued up to be sent as soon as the device comes up. However, if the
      private key hasn't been set yet, the handshake message never sends, and
      no timer is armed to retry, since that would be pointless.
      
      But, if a user later sets a private key, the expectation is that those
      queued packets, such as a persistent keepalive, are actually sent. So
      adjust the configuration logic to account for this edge case, and add a
      test case to make sure this works.
      
      Maxim noticed this with a wg-quick(8) config to the tune of:
      
          [Interface]
          PostUp = wg set %i private-key somefile
      
          [Peer]
          PublicKey = ...
          Endpoint = ...
          PersistentKeepalive = 25
      
      Here, the private key gets set after the device comes up using a PostUp
      script, triggering the bug.
      
      Fixes: e7096c13
      
       ("net: WireGuard secure network tunnel")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarMaxim Cournoyer <maxim.cournoyer@gmail.com>
      Tested-by: default avatarMaxim Cournoyer <maxim.cournoyer@gmail.com>
      Link: https://lore.kernel.org/wireguard/87fs7xtqrv.fsf@gmail.com/
      
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3173bfdf
    • Jason A. Donenfeld's avatar
      wireguard: queueing: use saner cpu selection wrapping · 561aaadf
      Jason A. Donenfeld authored
      commit 7387943f upstream.
      
      Using `% nr_cpumask_bits` is slow and complicated, and not totally
      robust toward dynamic changes to CPU topologies. Rather than storing the
      next CPU in the round-robin, just store the last one, and also return
      that value. This simplifies the loop drastically into a much more common
      pattern.
      
      Fixes: e7096c13
      
       ("net: WireGuard secure network tunnel")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: default avatarManuel Leiner <manuel.leiner@gmx.de>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      561aaadf
    • Thadeu Lima de Souza Cascardo's avatar
      netfilter: nf_tables: prevent OOB access in nft_byteorder_eval · 40f83dd6
      Thadeu Lima de Souza Cascardo authored
      commit caf3ef74 upstream.
      
      When evaluating byteorder expressions with size 2, a union with 32-bit and
      16-bit members is used. Since the 16-bit members are aligned to 32-bit,
      the array accesses will be out-of-bounds.
      
      It may lead to a stack-out-of-bounds access like the one below:
      
      [   23.095215] ==================================================================
      [   23.095625] BUG: KASAN: stack-out-of-bounds in nft_byteorder_eval+0x13c/0x320
      [   23.096020] Read of size 2 at addr ffffc90000007948 by task ping/115
      [   23.096358]
      [   23.096456] CPU: 0 PID: 115 Comm: ping Not tainted 6.4.0+ #413
      [   23.096770] Call Trace:
      [   23.096910]  <IRQ>
      [   23.097030]  dump_stack_lvl+0x60/0xc0
      [   23.097218]  print_report+0xcf/0x630
      [   23.097388]  ? nft_byteorder_eval+0x13c/0x320
      [   23.097577]  ? kasan_addr_to_slab+0xd/0xc0
      [   23.097760]  ? nft_byteorder_eval+0x13c/0x320
      [   23.097949]  kasan_report+0xc9/0x110
      [   23.098106]  ? nft_byteorder_eval+0x13c/0x320
      [   23.098298]  __asan_load2+0x83/0xd0
      [   23.098453]  nft_byteorder_eval+0x13c/0x320
      [   23.098659]  nft_do_chain+0x1c8/0xc50
      [   23.098852]  ? __pfx_nft_do_chain+0x10/0x10
      [   23.099078]  ? __kasan_check_read+0x11/0x20
      [   23.099295]  ? __pfx___lock_acquire+0x10/0x10
      [   23.099535]  ? __pfx___lock_acquire+0x10/0x10
      [   23.099745]  ? __kasan_check_read+0x11/0x20
      [   23.099929]  nft_do_chain_ipv4+0xfe/0x140
      [   23.100105]  ? __pfx_nft_do_chain_ipv4+0x10/0x10
      [   23.100327]  ? lock_release+0x204/0x400
      [   23.100515]  ? nf_hook.constprop.0+0x340/0x550
      [   23.100779]  nf_hook_slow+0x6c/0x100
      [   23.100977]  ? __pfx_nft_do_chain_ipv4+0x10/0x10
      [   23.101223]  nf_hook.constprop.0+0x334/0x550
      [   23.101443]  ? __pfx_ip_local_deliver_finish+0x10/0x10
      [   23.101677]  ? __pfx_nf_hook.constprop.0+0x10/0x10
      [   23.101882]  ? __pfx_ip_rcv_finish+0x10/0x10
      [   23.102071]  ? __pfx_ip_local_deliver_finish+0x10/0x10
      [   23.102291]  ? rcu_read_lock_held+0x4b/0x70
      [   23.102481]  ip_local_deliver+0xbb/0x110
      [   23.102665]  ? __pfx_ip_rcv+0x10/0x10
      [   23.102839]  ip_rcv+0x199/0x2a0
      [   23.102980]  ? __pfx_ip_rcv+0x10/0x10
      [   23.103140]  __netif_receive_skb_one_core+0x13e/0x150
      [   23.103362]  ? __pfx___netif_receive_skb_one_core+0x10/0x10
      [   23.103647]  ? mark_held_locks+0x48/0xa0
      [   23.103819]  ? process_backlog+0x36c/0x380
      [   23.103999]  __netif_receive_skb+0x23/0xc0
      [   23.104179]  process_backlog+0x91/0x380
      [   23.104350]  __napi_poll.constprop.0+0x66/0x360
      [   23.104589]  ? net_rx_action+0x1cb/0x610
      [   23.104811]  net_rx_action+0x33e/0x610
      [   23.105024]  ? _raw_spin_unlock+0x23/0x50
      [   23.105257]  ? __pfx_net_rx_action+0x10/0x10
      [   23.105485]  ? mark_held_locks+0x48/0xa0
      [   23.105741]  __do_softirq+0xfa/0x5ab
      [   23.105956]  ? __dev_queue_xmit+0x765/0x1c00
      [   23.106193]  do_softirq.part.0+0x49/0xc0
      [   23.106423]  </IRQ>
      [   23.106547]  <TASK>
      [   23.106670]  __local_bh_enable_ip+0xf5/0x120
      [   23.106903]  __dev_queue_xmit+0x789/0x1c00
      [   23.107131]  ? __pfx___dev_queue_xmit+0x10/0x10
      [   23.107381]  ? find_held_lock+0x8e/0xb0
      [   23.107585]  ? lock_release+0x204/0x400
      [   23.107798]  ? neigh_resolve_output+0x185/0x350
      [   23.108049]  ? mark_held_locks+0x48/0xa0
      [   23.108265]  ? neigh_resolve_output+0x185/0x350
      [   23.108514]  neigh_resolve_output+0x246/0x350
      [   23.108753]  ? neigh_resolve_output+0x246/0x350
      [   23.109003]  ip_finish_output2+0x3c3/0x10b0
      [   23.109250]  ? __pfx_ip_finish_output2+0x10/0x10
      [   23.109510]  ? __pfx_nf_hook+0x10/0x10
      [   23.109732]  __ip_finish_output+0x217/0x390
      [   23.109978]  ip_finish_output+0x2f/0x130
      [   23.110207]  ip_output+0xc9/0x170
      [   23.110404]  ip_push_pending_frames+0x1a0/0x240
      [   23.110652]  raw_sendmsg+0x102e/0x19e0
      [   23.110871]  ? __pfx_raw_sendmsg+0x10/0x10
      [   23.111093]  ? lock_release+0x204/0x400
      [   23.111304]  ? __mod_lruvec_page_state+0x148/0x330
      [   23.111567]  ? find_held_lock+0x8e/0xb0
      [   23.111777]  ? find_held_lock+0x8e/0xb0
      [   23.111993]  ? __rcu_read_unlock+0x7c/0x2f0
      [   23.112225]  ? aa_sk_perm+0x18a/0x550
      [   23.112431]  ? filemap_map_pages+0x4f1/0x900
      [   23.112665]  ? __pfx_aa_sk_perm+0x10/0x10
      [   23.112880]  ? find_held_lock+0x8e/0xb0
      [   23.113098]  inet_sendmsg+0xa0/0xb0
      [   23.113297]  ? inet_sendmsg+0xa0/0xb0
      [   23.113500]  ? __pfx_inet_sendmsg+0x10/0x10
      [   23.113727]  sock_sendmsg+0xf4/0x100
      [   23.113924]  ? move_addr_to_kernel.part.0+0x4f/0xa0
      [   23.114190]  __sys_sendto+0x1d4/0x290
      [   23.114391]  ? __pfx___sys_sendto+0x10/0x10
      [   23.114621]  ? __pfx_mark_lock.part.0+0x10/0x10
      [   23.114869]  ? lock_release+0x204/0x400
      [   23.115076]  ? find_held_lock+0x8e/0xb0
      [   23.115287]  ? rcu_is_watching+0x23/0x60
      [   23.115503]  ? __rseq_handle_notify_resume+0x6e2/0x860
      [   23.115778]  ? __kasan_check_write+0x14/0x30
      [   23.116008]  ? blkcg_maybe_throttle_current+0x8d/0x770
      [   23.116285]  ? mark_held_locks+0x28/0xa0
      [   23.116503]  ? do_syscall_64+0x37/0x90
      [   23.116713]  __x64_sys_sendto+0x7f/0xb0
      [   23.116924]  do_syscall_64+0x59/0x90
      [   23.117123]  ? irqentry_exit_to_user_mode+0x25/0x30
      [   23.117387]  ? irqentry_exit+0x77/0xb0
      [   23.117593]  ? exc_page_fault+0x92/0x140
      [   23.117806]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [   23.118081] RIP: 0033:0x7f744aee2bba
      [   23.118282] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      [   23.119237] RSP: 002b:00007ffd04a7c9f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      [   23.119644] RAX: ffffffffffffffda RBX: 00007ffd04a7e0a0 RCX: 00007f744aee2bba
      [   23.120023] RDX: 0000000000000040 RSI: 000056488e9e6300 RDI: 0000000000000003
      [   23.120413] RBP: 000056488e9e6300 R08: 00007ffd04a80320 R09: 0000000000000010
      [   23.120809] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000040
      [   23.121219] R13: 00007ffd04a7dc38 R14: 00007ffd04a7ca00 R15: 00007ffd04a7e0a0
      [   23.121617]  </TASK>
      [   23.121749]
      [   23.121845] The buggy address belongs to the virtual mapping at
      [   23.121845]  [ffffc90000000000, ffffc90000009000) created by:
      [   23.121845]  irq_init_percpu_irqstack+0x1cf/0x270
      [   23.122707]
      [   23.122803] The buggy address belongs to the physical page:
      [   23.123104] page:0000000072ac19f0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24a09
      [   23.123609] flags: 0xfffffc0001000(reserved|node=0|zone=1|lastcpupid=0x1fffff)
      [   23.123998] page_type: 0xffffffff()
      [   23.124194] raw: 000fffffc0001000 ffffea0000928248 ffffea0000928248 0000000000000000
      [   23.124610] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
      [   23.125023] page dumped because: kasan: bad access detected
      [   23.125326]
      [   23.125421] Memory state around the buggy address:
      [   23.125682]  ffffc90000007800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   23.126072]  ffffc90000007880: 00 00 00 00 00 f1 f1 f1 f1 f1 f1 00 00 f2 f2 00
      [   23.126455] >ffffc90000007900: 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00
      [   23.126840]                                               ^
      [   23.127138]  ffffc90000007980: 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 f3 f3
      [   23.127522]  ffffc90000007a00: f3 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
      [   23.127906] ==================================================================
      [   23.128324] Disabling lock debugging due to kernel taint
      
      Using simple s16 pointers for the 16-bit accesses fixes the problem. For
      the 32-bit accesses, src and dst can be used directly.
      
      Fixes: 96518518
      
       ("netfilter: add nftables")
      Cc: stable@vger.kernel.org
      Reported-by: Tanguy DUBROCA (@SidewayRE) from @Synacktiv working with ZDI
      Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40f83dd6
    • Thadeu Lima de Souza Cascardo's avatar
      netfilter: nf_tables: do not ignore genmask when looking up chain by id · fc95c8b0
      Thadeu Lima de Souza Cascardo authored
      commit 515ad530 upstream.
      
      When adding a rule to a chain referring to its ID, if that chain had been
      deleted on the same batch, the rule might end up referring to a deleted
      chain.
      
      This will lead to a WARNING like following:
      
      [   33.098431] ------------[ cut here ]------------
      [   33.098678] WARNING: CPU: 5 PID: 69 at net/netfilter/nf_tables_api.c:2037 nf_tables_chain_destroy+0x23d/0x260
      [   33.099217] Modules linked in:
      [   33.099388] CPU: 5 PID: 69 Comm: kworker/5:1 Not tainted 6.4.0+ #409
      [   33.099726] Workqueue: events nf_tables_trans_destroy_work
      [   33.100018] RIP: 0010:nf_tables_chain_destroy+0x23d/0x260
      [   33.100306] Code: 8b 7c 24 68 e8 64 9c ed fe 4c 89 e7 e8 5c 9c ed fe 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7 c3 cc cc cc cc <0f> 0b 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7
      [   33.101271] RSP: 0018:ffffc900004ffc48 EFLAGS: 00010202
      [   33.101546] RAX: 0000000000000001 RBX: ffff888006fc0a28 RCX: 0000000000000000
      [   33.101920] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
      [   33.102649] RBP: ffffc900004ffc78 R08: 0000000000000000 R09: 0000000000000000
      [   33.103018] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880135ef500
      [   33.103385] R13: 0000000000000000 R14: dead000000000122 R15: ffff888006fc0a10
      [   33.103762] FS:  0000000000000000(0000) GS:ffff888024c80000(0000) knlGS:0000000000000000
      [   33.104184] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   33.104493] CR2: 00007fe863b56a50 CR3: 00000000124b0001 CR4: 0000000000770ee0
      [   33.104872] PKRU: 55555554
      [   33.104999] Call Trace:
      [   33.105113]  <TASK>
      [   33.105214]  ? show_regs+0x72/0x90
      [   33.105371]  ? __warn+0xa5/0x210
      [   33.105520]  ? nf_tables_chain_destroy+0x23d/0x260
      [   33.105732]  ? report_bug+0x1f2/0x200
      [   33.105902]  ? handle_bug+0x46/0x90
      [   33.106546]  ? exc_invalid_op+0x19/0x50
      [   33.106762]  ? asm_exc_invalid_op+0x1b/0x20
      [   33.106995]  ? nf_tables_chain_destroy+0x23d/0x260
      [   33.107249]  ? nf_tables_chain_destroy+0x30/0x260
      [   33.107506]  nf_tables_trans_destroy_work+0x669/0x680
      [   33.107782]  ? mark_held_locks+0x28/0xa0
      [   33.107996]  ? __pfx_nf_tables_trans_destroy_work+0x10/0x10
      [   33.108294]  ? _raw_spin_unlock_irq+0x28/0x70
      [   33.108538]  process_one_work+0x68c/0xb70
      [   33.108755]  ? lock_acquire+0x17f/0x420
      [   33.108977]  ? __pfx_process_one_work+0x10/0x10
      [   33.109218]  ? do_raw_spin_lock+0x128/0x1d0
      [   33.109435]  ? _raw_spin_lock_irq+0x71/0x80
      [   33.109634]  worker_thread+0x2bd/0x700
      [   33.109817]  ? __pfx_worker_thread+0x10/0x10
      [   33.110254]  kthread+0x18b/0x1d0
      [   33.110410]  ? __pfx_kthread+0x10/0x10
      [   33.110581]  ret_from_fork+0x29/0x50
      [   33.110757]  </TASK>
      [   33.110866] irq event stamp: 1651
      [   33.111017] hardirqs last  enabled at (1659): [<ffffffffa206a209>] __up_console_sem+0x79/0xa0
      [   33.111379] hardirqs last disabled at (1666): [<ffffffffa206a1ee>] __up_console_sem+0x5e/0xa0
      [   33.111740] softirqs last  enabled at (1616): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0
      [   33.112094] softirqs last disabled at (1367): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0
      [   33.112453] ---[ end trace 0000000000000000 ]---
      
      This is due to the nft_chain_lookup_byid ignoring the genmask. After this
      change, adding the new rule will fail as it will not find the chain.
      
      Fixes: 837830a4
      
       ("netfilter: nf_tables: add NFTA_RULE_CHAIN_ID attribute")
      Cc: stable@vger.kernel.org
      Reported-by: Mingi Cho of Theori working with ZDI
      Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc95c8b0
    • Florent Revest's avatar
      netfilter: conntrack: Avoid nf_ct_helper_hash uses after free · 05561f82
      Florent Revest authored
      commit 6eef7a2b upstream.
      
      If nf_conntrack_init_start() fails (for example due to a
      register_nf_conntrack_bpf() failure), the nf_conntrack_helper_fini()
      clean-up path frees the nf_ct_helper_hash map.
      
      When built with NF_CONNTRACK=y, further netfilter modules (e.g:
      netfilter_conntrack_ftp) can still be loaded and call
      nf_conntrack_helpers_register(), independently of whether nf_conntrack
      initialized correctly. This accesses the nf_ct_helper_hash dangling
      pointer and causes a uaf, possibly leading to random memory corruption.
      
      This patch guards nf_conntrack_helper_register() from accessing a freed
      or uninitialized nf_ct_helper_hash pointer and fixes possible
      uses-after-free when loading a conntrack module.
      
      Cc: stable@vger.kernel.org
      Fixes: 12f7a505
      
       ("netfilter: add user-space connection tracking helper infrastructure")
      Signed-off-by: default avatarFlorent Revest <revest@chromium.org>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05561f82
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: unbind non-anonymous set if rule construction fails · f1453733
      Pablo Neira Ayuso authored
      commit 3e704897 upstream.
      
      Otherwise a dangling reference to a rule object that is gone remains
      in the set binding list.
      
      Fixes: 26b5a571
      
       ("netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1453733
    • Lukas Bulwahn's avatar
      mtd: parsers: refer to ARCH_BCMBCA instead of ARCH_BCM4908 · ad2928e7
      Lukas Bulwahn authored
      commit 085679b1 upstream.
      
      Commit dd5c672d ("arm64: bcmbca: Merge ARCH_BCM4908 to ARCH_BCMBCA")
      removes config ARCH_BCM4908 as config ARCH_BCMBCA has the same intent.
      
      Probably due to concurrent development, commit 002181f5
      
       ("mtd: parsers:
      add Broadcom's U-Boot parser") introduces 'Broadcom's U-Boot partition
      parser' that depends on ARCH_BCM4908, but this use was not visible during
      the config refactoring from the commit above. Hence, these two changes
      create a reference to a non-existing config symbol.
      
      Adjust the MTD_BRCM_U_BOOT definition to refer to ARCH_BCMBCA instead of
      ARCH_BCM4908 to remove the reference to the non-existing config symbol
      ARCH_BCM4908.
      
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20221116124932.4748-1-lukas.bulwahn@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad2928e7
    • Imre Deak's avatar
      drm/i915/tc: Fix system resume MST mode restore for DP-alt sinks · 1bdcffaa
      Imre Deak authored
      commit 06f66261
      
       upstream.
      
      At least restoring the MST topology during system resume needs to use
      AUX before the display HW readout->sanitization sequence is complete,
      but on TC ports the PHY may be in the wrong mode for this, resulting in
      the AUX transfers to fail.
      
      The initial TC port mode is kept fixed as BIOS left it for the above HW
      readout sequence (to prevent changing the mode on an enabled port).  If
      the port is disabled this initial mode is TBT - as in any case the PHY
      ownership is not held - even if a DP-alt sink is connected. Thus, the
      AUX transfers during this time will use TBT mode instead of the expected
      DP-alt mode and so time out.
      
      Fix the above by connecting the PHY during port initialization if the
      port is disabled, which will switch to the expected mode (DP-alt in the
      above case).
      
      As the encoder/pipe HW state isn't read-out yet at this point, check if
      the port is enabled based on the DDI_BUF enabled flag. Save the read-out
      initial mode, so intel_tc_port_sanitize_mode() can check this wrt. the
      read-out encoder HW state.
      
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230316131724.359612-5-imre.deak@intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bdcffaa
    • Imre Deak's avatar
      drm/i915/tc: Fix TC port link ref init for DP MST during HW readout · 99025116
      Imre Deak authored
      commit 67165722
      
       upstream.
      
      An enabled TC MST port holds one TC port link reference, regardless of
      the number of enabled streams on it, but the TC port HW readout takes
      one reference for each active MST stream.
      
      Fix the HW readout, taking only one reference for MST ports.
      
      This didn't cause an actual problem, since the encoder HW readout doesn't
      yet support reading out the MST HW state.
      
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
      Reviewed-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230316131724.359612-3-imre.deak@intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99025116
    • Imre Deak's avatar
      drm/i915: Fix TypeC mode initialization during system resume · eaa0043a
      Imre Deak authored
      commit a82796a2
      
       upstream.
      
      During system resume DP MST requires AUX to be working already before
      the HW state readout of the given encoder. Since AUX requires the
      encoder/PHY TypeC mode to be initialized, which atm only happens during
      HW state readout, these AUX transfers can change the TypeC mode
      incorrectly (disconnecting the PHY for an enabled encoder) and trigger
      the state check WARNs in intel_tc_port_sanitize().
      
      Fix this by initializing the TypeC mode earlier both during driver
      loading and system resume and making sure that the mode can't change
      until the encoder's state is read out. While at it add the missing
      DocBook comments and rename
      intel_tc_port_sanitize()->intel_tc_port_sanitize_mode() for consistency.
      
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220922172148.2913088-1-imre.deak@intel.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eaa0043a
    • Liam R. Howlett's avatar
      mm/mmap: Fix extra maple tree write · a02c6dc0
      Liam R. Howlett authored
      based on commit 0503ea8f
      
       upstream.
      
      This was inadvertently fixed during the removal of __vma_adjust().
      
      When __vma_adjust() is adjusting next with a negative value (pushing
      vma->vm_end lower), there would be two writes to the maple tree.  The
      first write is unnecessary and uses all allocated nodes in the maple
      state.  The second write is necessary but will need to allocate nodes
      since the first write has used the allocated nodes.  This may be a
      problem as it may not be safe to allocate at this time, such as a low
      memory situation.  Fix the issue by avoiding the first write and only
      write the adjusted "next" VMA.
      
      Reported-by: default avatarJohn Hsu <John.Hsu@mediatek.com>
      Link: https://lore.kernel.org/lkml/9cb8c599b1d7f9c1c300d1a334d5eb70ec4d7357.camel@mediatek.com/
      
      
      Cc: stable@vger.kernel.org
      Cc: linux-mm@kvack.org
      Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a02c6dc0
    • Darrick J. Wong's avatar
      xfs: fix xfs_inodegc_stop racing with mod_delayed_work · 9222068b
      Darrick J. Wong authored
      commit 2254a739 upstream.
      
      syzbot reported this warning from the faux inodegc shrinker that tries
      to kick off inodegc work:
      
      ------------[ cut here ]------------
      WARNING: CPU: 1 PID: 102 at kernel/workqueue.c:1445 __queue_work+0xd44/0x1120 kernel/workqueue.c:1444
      RIP: 0010:__queue_work+0xd44/0x1120 kernel/workqueue.c:1444
      Call Trace:
       __queue_delayed_work+0x1c8/0x270 kernel/workqueue.c:1672
       mod_delayed_work_on+0xe1/0x220 kernel/workqueue.c:1746
       xfs_inodegc_shrinker_scan fs/xfs/xfs_icache.c:2212 [inline]
       xfs_inodegc_shrinker_scan+0x250/0x4f0 fs/xfs/xfs_icache.c:2191
       do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
       shrink_slab+0x175/0x660 mm/vmscan.c:1013
       shrink_one+0x502/0x810 mm/vmscan.c:5343
       shrink_many mm/vmscan.c:5394 [inline]
       lru_gen_shrink_node mm/vmscan.c:5511 [inline]
       shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
       kswapd_shrink_node mm/vmscan.c:7262 [inline]
       balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
       kswapd+0x677/0xd60 mm/vmscan.c:7712
       kthread+0x2e8/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
      
      This warning corresponds to this code in __queue_work:
      
      	/*
      	 * For a draining wq, only works from the same workqueue are
      	 * allowed. The __WQ_DESTROYING helps to spot the issue that
      	 * queues a new work item to a wq after destroy_workqueue(wq).
      	 */
      	if (unlikely(wq->flags & (__WQ_DESTROYING | __WQ_DRAINING) &&
      		     WARN_ON_ONCE(!is_chained_work(wq))))
      		return;
      
      For this to trip, we must have a thread draining the inodedgc workqueue
      and a second thread trying to queue inodegc work to that workqueue.
      This can happen if freezing or a ro remount race with reclaim poking our
      faux inodegc shrinker and another thread dropping an unlinked O_RDONLY
      file:
      
      Thread 0	Thread 1	Thread 2
      
      xfs_inodegc_stop
      
      				xfs_inodegc_shrinker_scan
      				xfs_is_inodegc_enabled
      				<yes, will continue>
      
      xfs_clear_inodegc_enabled
      xfs_inodegc_queue_all
      <list empty, do not queue inodegc worker>
      
      		xfs_inodegc_queue
      		<add to list>
      		xfs_is_inodegc_enabled
      		<no, returns>
      
      drain_workqueue
      <set WQ_DRAINING>
      
      				llist_empty
      				<no, will queue list>
      				mod_delayed_work_on(..., 0)
      				__queue_work
      				<sees WQ_DRAINING, kaboom>
      
      In other words, everything between the access to inodegc_enabled state
      and the decision to poke the inodegc workqueue requires some kind of
      coordination to avoid the WQ_DRAINING state.  We could perhaps introduce
      a lock here, but we could also try to eliminate WQ_DRAINING from the
      picture.
      
      We could replace the drain_workqueue call with a loop that flushes the
      workqueue and queues workers as long as there is at least one inode
      present in the per-cpu inodegc llists.  We've disabled inodegc at this
      point, so we know that the number of queued inodes will eventually hit
      zero as long as xfs_inodegc_start cannot reactivate the workers.
      
      There are four callers of xfs_inodegc_start.  Three of them come from the
      VFS with s_umount held: filesystem thawing, failed filesystem freezing,
      and the rw remount transition.  The fourth caller is mounting rw (no
      remount or freezing possible).
      
      There are three callers ofs xfs_inodegc_stop.  One is unmounting (no
      remount or thaw possible).  Two of them come from the VFS with s_umount
      held: fs freezing and ro remount transition.
      
      Hence, it is correct to replace the drain_workqueue call with a loop
      that drains the inodegc llists.
      
      Fixes: 6191cf3a
      
       ("xfs: flush inodegc workqueue tasks before cancel")
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Acked-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9222068b
    • Darrick J. Wong's avatar
      xfs: disable reaping in fscounters scrub · 1b206852
      Darrick J. Wong authored
      commit 2d5f38a3
      
       upstream.
      
      The fscounters scrub code doesn't work properly because it cannot
      quiesce updates to the percpu counters in the filesystem, hence it
      returns false corruption reports.  This has been fixed properly in
      one of the online repair patchsets that are under review by replacing
      the xchk_disable_reaping calls with an exclusive filesystem freeze.
      Disabling background gc isn't sufficient to fix the problem.
      
      In other words, scrub doesn't need to call xfs_inodegc_stop, which is
      just as well since it wasn't correct to allow scrub to call
      xfs_inodegc_start when something else could be calling xfs_inodegc_stop
      (e.g. trying to freeze the filesystem).
      
      Neuter the scrubber for now, and remove the xchk_*_reaping functions.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Acked-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b206852
    • Darrick J. Wong's avatar
      xfs: check that per-cpu inodegc workers actually run on that cpu · 25c1991f
      Darrick J. Wong authored
      commit b37c4c83
      
       upstream.
      
      Now that we've allegedly worked out the problem of the per-cpu inodegc
      workers being scheduled on the wrong cpu, let's put in a debugging knob
      to let us know if a worker ever gets mis-scheduled again.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Acked-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25c1991f
    • Darrick J. Wong's avatar
      xfs: explicitly specify cpu when forcing inodegc delayed work to run immediately · f6e37e24
      Darrick J. Wong authored
      commit 03e0add8 upstream.
      
      I've been noticing odd racing behavior in the inodegc code that could
      only be explained by one cpu adding an inode to its inactivation llist
      at the same time that another cpu is processing that cpu's llist.
      Preemption is disabled between get/put_cpu_ptr, so the only explanation
      is scheduler mayhem.  I inserted the following debug code into
      xfs_inodegc_worker (see the next patch):
      
      	ASSERT(gc->cpu == smp_processor_id());
      
      This assertion tripped during overnight tests on the arm64 machines, but
      curiously not on x86_64.  I think we haven't observed any resource leaks
      here because the lockfree list code can handle simultaneous llist_add
      and llist_del_all functions operating on the same list.  However, the
      whole point of having percpu inodegc lists is to take advantage of warm
      memory caches by inactivating inodes on the last processor to touch the
      inode.
      
      The incorrect scheduling seems to occur after an inodegc worker is
      subjected to mod_delayed_work().  This wraps mod_delayed_work_on with
      WORK_CPU_UNBOUND specified as the cpu number.  Unbound allows for
      scheduling on any cpu, not necessarily the same one that scheduled the
      work.
      
      Because preemption is disabled for as long as we have the gc pointer, I
      think it's safe to use current_cpu() (aka smp_processor_id) to queue the
      delayed work item on the correct cpu.
      
      Fixes: 7cf2b0f9
      
       ("xfs: bound maximum wait time for inodegc work")
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Acked-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f6e37e24
    • Jan Kara's avatar
      fs: no need to check source · 6b7c52f3
      Jan Kara authored
      commit 66d8fc05 upstream.
      
      The @source inode must be valid. It is even checked via IS_SWAPFILE()
      above making it pretty clear. So no need to check it when we unlock.
      
      What doesn't need to exist is the @target inode. The lock_two_inodes()
      helper currently swaps the @inode1 and @inode2 arguments if @inode1 is
      NULL to have consistent lock class usage. However, we know that at least
      for vfs_rename() that @inode1 is @source and thus is never NULL as per
      above. We also know that @source is a different inode than @target as
      that is checked right at the beginning of vfs_rename(). So we know that
      @source is valid and locked and that @target is locked. So drop the
      check whether @source is non-NULL.
      
      Fixes: 28eceeda
      
       ("fs: Lock moved directories")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Closes: https://lore.kernel.org/r/202307030026.9sE2pk2x-lkp@intel.com
      
      
      Message-Id: <20230703-vfs-rename-source-v1-1-37eebb29b65b@kernel.org>
      [brauner: use commit message from patch I sent concurrently]
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6b7c52f3
    • Yu Kuai's avatar
      blktrace: use inline function for blk_trace_remove() while blktrace is disabled · d53879f5
      Yu Kuai authored
      commit cbe7cff4
      
       upstream.
      
      If config is disabled, call blk_trace_remove() directly will trigger
      build warning, hence use inline function instead, prepare to fix
      blktrace debugfs entries leakage.
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20230610022003.2557284-2-yukuai1@huaweicloud.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d53879f5
    • Christian Marangi's avatar
      leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename · ab0bd172
      Christian Marangi authored
      commit cee4bd16 upstream.
      
      Dev can be renamed also while up for supported device. We currently
      wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
      event.
      
      Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
      correctly set the NETDEV_LED_MODE_LINKUP bit.
      
      Fixes: 5f820ed5
      
       ("leds: trigger: netdev: fix handling on interface rename")
      Cc: stable@vger.kernel.org # v5.5+
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarLee Jones <lee@kernel.org>
      Link: https://lore.kernel.org/r/20230419210743.3594-2-ansuelsmth@gmail.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab0bd172
    • Arnd Bergmann's avatar
      ARM: orion5x: fix d2net gpio initialization · 9077ec19
      Arnd Bergmann authored
      commit f8ef1233 upstream.
      
      The DT version of this board has a custom file with the gpio
      device. However, it does nothing because the d2net_init()
      has no caller or prototype:
      
      arch/arm/mach-orion5x/board-d2net.c:101:13: error: no previous prototype for 'd2net_init'
      
      Call it from the board-dt file as intended.
      
      Fixes: 94b0bd36
      
       ("ARM: orion5x: convert d2net to Device Tree")
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230516153109.514251-10-arnd@kernel.org
      
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9077ec19
    • Krzysztof Kozlowski's avatar
      ARM: dts: qcom: ipq4019: fix broken NAND controller properties override · 600b51aa
      Krzysztof Kozlowski authored
      commit edcbdd57 upstream.
      
      After renaming NAND controller node name from "qpic-nand" to
      "nand-controller", the board DTS/DTSI also have to be updated:
      
        Warning (unit_address_vs_reg): /soc/qpic-nand@79b0000: node has a unit name, but no reg or ranges property
      
      Cc: <stable@vger.kernel.org>
      Fixes: 9e1e00f1
      
       ("ARM: dts: qcom: Fix node name for NAND controller node")
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Reviewed-by: default avatarManivannan Sadhasivam <mani@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Link: https://lore.kernel.org/r/20230420072811.36947-1-krzysztof.kozlowski@linaro.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      600b51aa
    • Krzysztof Kozlowski's avatar
      regulator: tps65219: Fix matching interrupts for their regulators · 9030a7e8
      Krzysztof Kozlowski authored
      commit f050e56d upstream.
      
      The driver's probe() first registers regulators in a loop and then in a
      second loop passes them as irq data to the interrupt handlers.  However
      the function to get the regulator for given name
      tps65219_get_rdev_by_name() was a no-op due to argument passed by value,
      not pointer, thus the second loop assigned always same value - from
      previous loop.  The interrupts, when fired, where executed with wrong
      data.  Compiler also noticed it:
      
        drivers/regulator/tps65219-regulator.c: In function ‘tps65219_get_rdev_by_name’:
        drivers/regulator/tps65219-regulator.c:292:60: error: parameter ‘dev’ set but not used [-Werror=unused-but-set-parameter]
      
      Fixes: c12ac5fc
      
       ("regulator: drivers: Add TI TPS65219 PMIC regulators support")
      Cc: <stable@vger.kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarMarkus Schneider-Pargmann <msp@baylibre.com>
      Link: https://lore.kernel.org/r/20230507144656.192800-1-krzysztof.kozlowski@linaro.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9030a7e8
    • Ricardo Ribalda Delgado's avatar
      ASoC: mediatek: mt8173: Fix snd_soc_component_initialize error path · d9eaa90d
      Ricardo Ribalda Delgado authored
      commit a46d3701
      
       upstream.
      
      If the second component fails to initialize, cleanup the first on.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Cc: stable@kernel.org
      Fixes: f1b5bf07
      
       ("ASoC: mt2701/mt8173: replace platform to component")
      Signed-off-by: default avatarRicardo Ribalda Delgado <ribalda@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Link: https://lore.kernel.org/r/20230612-mt8173-fixup-v2-1-432aa99ce24d@chromium.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9eaa90d
    • Ricardo Ribalda Delgado's avatar
      ASoC: mediatek: mt8173: Fix irq error path · 1c9b356b
      Ricardo Ribalda Delgado authored
      commit f9c058d1
      
       upstream.
      
      After reordering the irq probe, the error path was not properly done.
      Lets fix it.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Cc: stable@kernel.org
      Fixes: 4cbb264d
      
       ("ASoC: mediatek: mt8173: Enable IRQ when pdata is ready")
      Signed-off-by: default avatarRicardo Ribalda Delgado <ribalda@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Link: https://lore.kernel.org/r/20230612-mt8173-fixup-v2-2-432aa99ce24d@chromium.org
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c9b356b
    • Filipe Manana's avatar
      btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block() · 3929b5dd
      Filipe Manana authored
      commit 40b0a749
      
       upstream.
      
      At __btrfs_cow_block(), instead of doing a BUG_ON() in case we fail to
      record a tree mod log root insertion operation, do a transaction abort
      instead. There's really no need for the BUG_ON(), we can properly
      release all resources in this context and turn the filesystem to RO mode
      and in an error state instead.
      
      CC: stable@vger.kernel.org # 5.4+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3929b5dd
    • Filipe Manana's avatar
      btrfs: fix extent buffer leak after tree mod log failure at split_node() · bc662a1e
      Filipe Manana authored
      commit ede600e4 upstream.
      
      At split_node(), if we fail to log the tree mod log copy operation, we
      return without unlocking the split extent buffer we just allocated and
      without decrementing the reference we own on it. Fix this by unlocking
      it and decrementing the ref count before returning.
      
      Fixes: 5de865ee
      
       ("Btrfs: fix tree mod logging")
      CC: stable@vger.kernel.org # 5.4+
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc662a1e
    • Filipe Manana's avatar
      btrfs: fix race when deleting quota root from the dirty cow roots list · a53d78d9
      Filipe Manana authored
      commit b31cb5a6 upstream.
      
      When disabling quotas we are deleting the quota root from the list
      fs_info->dirty_cowonly_roots without taking the lock that protects it,
      which is struct btrfs_fs_info::trans_lock. This unsynchronized list
      manipulation may cause chaos if there's another concurrent manipulation
      of this list, such as when adding a root to it with
      ctree.c:add_root_to_dirty_list().
      
      This can result in all sorts of weird failures caused by a race, such as
      the following crash:
      
        [337571.278245] general protection fault, probably for non-canonical address 0xdead000000000108: 0000 [#1] PREEMPT SMP PTI
        [337571.278933] CPU: 1 PID: 115447 Comm: btrfs Tainted: G        W          6.4.0-rc6-btrfs-next-134+ #1
        [337571.279153] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
        [337571.279572] RIP: 0010:commit_cowonly_roots+0x11f/0x250 [btrfs]
        [337571.279928] Code: 85 38 06 00 (...)
        [337571.280363] RSP: 0018:ffff9f63446efba0 EFLAGS: 00010206
        [337571.280582] RAX: ffff942d98ec2638 RBX: ffff9430b82b4c30 RCX: 0000000449e1c000
        [337571.280798] RDX: dead000000000100 RSI: ffff9430021e4900 RDI: 0000000000036070
        [337571.281015] RBP: ffff942d98ec2000 R08: ffff942d98ec2000 R09: 000000000000015b
        [337571.281254] R10: 0000000000000009 R11: 0000000000000001 R12: ffff942fe8fbf600
        [337571.281476] R13: ffff942dabe23040 R14: ffff942dabe20800 R15: ffff942d92cf3b48
        [337571.281723] FS:  00007f478adb7340(0000) GS:ffff94349fa40000(0000) knlGS:0000000000000000
        [337571.281950] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [337571.282184] CR2: 00007f478ab9a3d5 CR3: 000000001e02c001 CR4: 0000000000370ee0
        [337571.282416] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        [337571.282647] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        [337571.282874] Call Trace:
        [337571.283101]  <TASK>
        [337571.283327]  ? __die_body+0x1b/0x60
        [337571.283570]  ? die_addr+0x39/0x60
        [337571.283796]  ? exc_general_protection+0x22e/0x430
        [337571.284022]  ? asm_exc_general_protection+0x22/0x30
        [337571.284251]  ? commit_cowonly_roots+0x11f/0x250 [btrfs]
        [337571.284531]  btrfs_commit_transaction+0x42e/0xf90 [btrfs]
        [337571.284803]  ? _raw_spin_unlock+0x15/0x30
        [337571.285031]  ? release_extent_buffer+0x103/0x130 [btrfs]
        [337571.285305]  reset_balance_state+0x152/0x1b0 [btrfs]
        [337571.285578]  btrfs_balance+0xa50/0x11e0 [btrfs]
        [337571.285864]  ? __kmem_cache_alloc_node+0x14a/0x410
        [337571.286086]  btrfs_ioctl+0x249a/0x3320 [btrfs]
        [337571.286358]  ? mod_objcg_state+0xd2/0x360
        [337571.286577]  ? refill_obj_stock+0xb0/0x160
        [337571.286798]  ? seq_release+0x25/0x30
        [337571.287016]  ? __rseq_handle_notify_resume+0x3ba/0x4b0
        [337571.287235]  ? percpu_counter_add_batch+0x2e/0xa0
        [337571.287455]  ? __x64_sys_ioctl+0x88/0xc0
        [337571.287675]  __x64_sys_ioctl+0x88/0xc0
        [337571.287901]  do_syscall_64+0x38/0x90
        [337571.288126]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
        [337571.288352] RIP: 0033:0x7f478aaffe9b
      
      So fix this by locking struct btrfs_fs_info::trans_lock before deleting
      the quota root from that list.
      
      Fixes: bed92eae
      
       ("Btrfs: qgroup implementation and prototypes")
      CC: stable@vger.kernel.org # 4.14+
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a53d78d9
    • Naohiro Aota's avatar
      btrfs: reinsert BGs failed to reclaim · 9634e536
      Naohiro Aota authored
      commit 7e271809 upstream.
      
      The reclaim process can temporarily fail. For example, if the space is
      getting tight, it fails to make the block group read-only. If there are no
      further writes on that block group, the block group will never get back to
      the reclaim list, and the BG never gets reclaimed. In a certain workload,
      we can leave many such block groups never reclaimed.
      
      So, let's get it back to the list and give it a chance to be reclaimed.
      
      Fixes: 18bb8bbf
      
       ("btrfs: zoned: automatically reclaim zones")
      CC: stable@vger.kernel.org # 5.15+
      Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9634e536
    • David Sterba's avatar
      btrfs: add block-group tree to lockdep classes · d9f1e518
      David Sterba authored
      commit 1a1b0e72
      
       upstream.
      
      The block group tree was not present among the lockdep classes. We could
      get potentially lockdep warnings but so far none has been seen, also
      because block-group-tree is a relatively new feature.
      
      CC: stable@vger.kernel.org # 6.1+
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9f1e518
    • Naohiro Aota's avatar
      btrfs: bail out reclaim process if filesystem is read-only · 3702c534
      Naohiro Aota authored
      commit 93463ff7 upstream.
      
      When a filesystem is read-only, we cannot reclaim a block group as it
      cannot rewrite the data. Just bail out in that case.
      
      Note that it can drop block groups in this case. As we did
      sb_start_write(), read-only filesystem means we got a fatal error and
      forced read-only. There is no chance to reclaim them again.
      
      Fixes: 18bb8bbf
      
       ("btrfs: zoned: automatically reclaim zones")
      CC: stable@vger.kernel.org # 5.15+
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3702c534
    • Naohiro Aota's avatar
      btrfs: delete unused BGs while reclaiming BGs · 85608610
      Naohiro Aota authored
      commit 3ed01616 upstream.
      
      The reclaiming process only starts after the filesystem volumes are
      allocated to a certain level (75% by default). Thus, the list of
      reclaiming target block groups can build up so huge at the time the
      reclaim process kicks in. On a test run, there were over 1000 BGs in the
      reclaim list.
      
      As the reclaim involves rewriting the data, it takes really long time to
      reclaim the BGs. While the reclaim is running, btrfs_delete_unused_bgs()
      won't proceed because the reclaim side is holding
      fs_info->reclaim_bgs_lock. As a result, we will have a large number of
      unused BGs kept in the unused list. On my test run, I got 1057 unused BGs.
      
      Since deleting a block group is relatively easy and fast work, we can call
      btrfs_delete_unused_bgs() while it reclaims BGs, to avoid building up
      unused BGs.
      
      Fixes: 18bb8bbf
      
       ("btrfs: zoned: automatically reclaim zones")
      CC: stable@vger.kernel.org # 5.15+
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85608610
    • Matt Corallo's avatar
      btrfs: add handling for RAID1C23/DUP to btrfs_reduce_alloc_profile · 4fadf53f
      Matt Corallo authored
      commit 160fe8f6 upstream.
      
      Callers of `btrfs_reduce_alloc_profile` expect it to return exactly
      one allocation profile flag, and failing to do so may ultimately
      result in a WARN_ON and remount-ro when allocating new blocks, like
      the below transaction abort on 6.1.
      
      `btrfs_reduce_alloc_profile` has two ways of determining the profile,
      first it checks if a conversion balance is currently running and
      uses the profile we're converting to. If no balance is currently
      running, it returns the max-redundancy profile which at least one
      block in the selected block group has.
      
      This works by simply checking each known allocation profile bit in
      redundancy order. However, `btrfs_reduce_alloc_profile` has not been
      updated as new flags have been added - first with the `DUP` profile
      and later with the RAID1C34 profiles.
      
      Because of the way it checks, if we have blocks with different
      profiles and at least one is known, that profile will be selected.
      However, if none are known we may return a flag set with multiple
      allocation profiles set.
      
      This is currently only possible when a balance from one of the three
      unhandled profiles to another of the unhandled profiles is canceled
      after allocating at least one block using the new profile.
      
      In that case, a transaction abort like the below will occur and the
      filesystem will need to be mounted with -o skip_balance to get it
      mounted rw again (but the balance cannot be resumed without a
      similar abort).
      
        [770.648] ------------[ cut here ]------------
        [770.648] BTRFS: Transaction aborted (error -22)
        [770.648] WARNING: CPU: 43 PID: 1159593 at fs/btrfs/extent-tree.c:4122 find_free_extent+0x1d94/0x1e00 [btrfs]
        [770.648] CPU: 43 PID: 1159593 Comm: btrfs Tainted: G        W 6.1.0-0.deb11.7-powerpc64le #1  Debian 6.1.20-2~bpo11+1a~test
        [770.648] Hardware name: T2P9D01 REV 1.00 POWER9 0x4e1202 opal:skiboot-bc106a0 PowerNV
        [770.648] NIP:  c00800000f6784fc LR: c00800000f6784f8 CTR: c000000000d746c0
        [770.648] REGS: c000200089afe9a0 TRAP: 0700   Tainted: G        W (6.1.0-0.deb11.7-powerpc64le Debian 6.1.20-2~bpo11+1a~test)
        [770.648] MSR:  9000000002029033 <SF,HV,VEC,EE,ME,IR,DR,RI,LE>  CR: 28848282  XER: 20040000
        [770.648] CFAR: c000000000135110 IRQMASK: 0
      	    GPR00: c00800000f6784f8 c000200089afec40 c00800000f7ea800 0000000000000026
      	    GPR04: 00000001004820c2 c000200089afea00 c000200089afe9f8 0000000000000027
      	    GPR08: c000200ffbfe7f98 c000000002127f90 ffffffffffffffd8 0000000026d6a6e8
      	    GPR12: 0000000028848282 c000200fff7f3800 5deadbeef0000122 c00000002269d000
      	    GPR16: c0002008c7797c40 c000200089afef17 0000000000000000 0000000000000000
      	    GPR20: 0000000000000000 0000000000000001 c000200008bc5a98 0000000000000001
      	    GPR24: 0000000000000000 c0000003c73088d0 c000200089afef17 c000000016d3a800
      	    GPR28: c0000003c7308800 c00000002269d000 ffffffffffffffea 0000000000000001
        [770.648] NIP [c00800000f6784fc] find_free_extent+0x1d94/0x1e00 [btrfs]
        [770.648] LR [c00800000f6784f8] find_free_extent+0x1d90/0x1e00 [btrfs]
        [770.648] Call Trace:
        [770.648] [c000200089afec40] [c00800000f6784f8] find_free_extent+0x1d90/0x1e00 [btrfs] (unreliable)
        [770.648] [c000200089afed30] [c00800000f681398] btrfs_reserve_extent+0x1a0/0x2f0 [btrfs]
        [770.648] [c000200089afeea0] [c00800000f681bf0] btrfs_alloc_tree_block+0x108/0x670 [btrfs]
        [770.648] [c000200089afeff0] [c00800000f66bd68] __btrfs_cow_block+0x170/0x850 [btrfs]
        [770.648] [c000200089aff100] [c00800000f66c58c] btrfs_cow_block+0x144/0x288 [btrfs]
        [770.648] [c000200089aff1b0] [c00800000f67113c] btrfs_search_slot+0x6b4/0xcb0 [btrfs]
        [770.648] [c000200089aff2a0] [c00800000f679f60] lookup_inline_extent_backref+0x128/0x7c0 [btrfs]
        [770.648] [c000200089aff3b0] [c00800000f67b338] lookup_extent_backref+0x70/0x190 [btrfs]
        [770.648] [c000200089aff470] [c00800000f67b54c] __btrfs_free_extent+0xf4/0x1490 [btrfs]
        [770.648] [c000200089aff5a0] [c00800000f67d770] __btrfs_run_delayed_refs+0x328/0x1530 [btrfs]
        [770.648] [c000200089aff740] [c00800000f67ea2c] btrfs_run_delayed_refs+0xb4/0x3e0 [btrfs]
        [770.648] [c000200089aff800] [c00800000f699aa4] btrfs_commit_transaction+0x8c/0x12b0 [btrfs]
        [770.648] [c000200089aff8f0] [c00800000f6dc628] reset_balance_state+0x1c0/0x290 [btrfs]
        [770.648] [c000200089aff9a0] [c00800000f6e2f7c] btrfs_balance+0x1164/0x1500 [btrfs]
        [770.648] [c000200089affb40] [c00800000f6f8e4c] btrfs_ioctl+0x2b54/0x3100 [btrfs]
        [770.648] [c000200089affc80] [c00000000053be14] sys_ioctl+0x794/0x1310
        [770.648] [c000200089affd70] [c00000000002af98] system_call_exception+0x138/0x250
        [770.648] [c000200089affe10] [c00000000000c654] system_call_common+0xf4/0x258
        [770.648] --- interrupt: c00 at 0x7fff94126800
        [770.648] NIP:  00007fff94126800 LR: 0000000107e0b594 CTR: 0000000000000000
        [770.648] REGS: c000200089affe80 TRAP: 0c00   Tainted: G        W (6.1.0-0.deb11.7-powerpc64le Debian 6.1.20-2~bpo11+1a~test)
        [770.648] MSR:  900000000000d033 <SF,HV,EE,PR,ME,IR,DR,RI,LE>  CR: 24002848  XER: 00000000
        [770.648] IRQMASK: 0
      	    GPR00: 0000000000000036 00007fffc9439da0 00007fff94217100 0000000000000003
      	    GPR04: 00000000c4009420 00007fffc9439ee8 0000000000000000 0000000000000000
      	    GPR08: 00000000803c7416 0000000000000000 0000000000000000 0000000000000000
      	    GPR12: 0000000000000000 00007fff9467d120 0000000107e64c9c 0000000107e64d0a
      	    GPR16: 0000000107e64d06 0000000107e64cf1 0000000107e64cc4 0000000107e64c73
      	    GPR20: 0000000107e64c31 0000000107e64bf1 0000000107e64be7 0000000000000000
      	    GPR24: 0000000000000000 00007fffc9439ee0 0000000000000003 0000000000000001
      	    GPR28: 00007fffc943f713 0000000000000000 00007fffc9439ee8 0000000000000000
        [770.648] NIP [00007fff94126800] 0x7fff94126800
        [770.648] LR [0000000107e0b594] 0x107e0b594
        [770.648] --- interrupt: c00
        [770.648] Instruction dump:
        [770.648] 3b00ffe4 e8898828 481175f5 60000000 4bfff4fc 3be00000 4bfff570 3d220000
        [770.648] 7fc4f378 e8698830 4811cd95 e8410018 <0fe00000> f9c10060 f9e10068 fa010070
        [770.648] ---[ end trace 0000000000000000 ]---
        [770.648] BTRFS: error (device dm-2: state A) in find_free_extent_update_loop:4122: errno=-22 unknown
        [770.648] BTRFS info (device dm-2: state EA): forced readonly
        [770.648] BTRFS: error (device dm-2: state EA) in __btrfs_free_extent:3070: errno=-22 unknown
        [770.648] BTRFS error (device dm-2: state EA): failed to run delayed ref for logical 17838685708288 num_bytes 24576 type 184 action 2 ref_mod 1: -22
        [770.648] BTRFS: error (device dm-2: state EA) in btrfs_run_delayed_refs:2144: errno=-22 unknown
        [770.648] BTRFS: error (device dm-2: state EA) in reset_balance_state:3599: errno=-22 unknown
      
      Fixes: 47e6f742 ("btrfs: add support for 3-copy replication (raid1c3)")
      Fixes: 8d6fac00
      
       ("btrfs: add support for 4-copy replication (raid1c4)")
      CC: stable@vger.kernel.org # 5.10+
      Signed-off-by: default avatarMatt Corallo <blnxfsl@bluematt.me>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4fadf53f
    • Abhijeet Rastogi's avatar
      ipvs: increase ip_vs_conn_tab_bits range for 64BIT · 8fcb478b
      Abhijeet Rastogi authored
      commit 04292c69 upstream.
      
      Current range [8, 20] is set purely due to historical reasons
      because at the time, ~1M (2^20) was considered sufficient.
      With this change, 27 is the upper limit for 64-bit, 20 otherwise.
      
      Previous change regarding this limit is here.
      
      Link: https://lore.kernel.org/all/86eabeb9dd62aebf1e2533926fdd13fed48bab1f.1631289960.git.aclaudi@redhat.com/T/#u
      
      
      
      Signed-off-by: default avatarAbhijeet Rastogi <abhijeet.1989@gmail.com>
      Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
      Acked-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Cc: Allen Pais <apais@linux.microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8fcb478b
    • Mario Limonciello's avatar
      usb: typec: ucsi: Mark dGPUs as DEVICE scope · 759e582b
      Mario Limonciello authored
      commit a7fbfd44 upstream.
      
      power_supply_is_system_supplied() checks whether any power
      supplies are present that aren't batteries to decide whether
      the system is running on DC or AC.  Downstream drivers use
      this to make performance decisions.
      
      Navi dGPUs include an UCSI function that has been exported
      since commit 17631e8c ("i2c: designware: Add driver
      support for AMD NAVI GPU").
      
      This UCSI function registers a power supply since commit
      992a60ed ("usb: typec: ucsi: register with power_supply class")
      but this is not a system power supply.
      
      As the power supply for a dGPU is only for powering devices connected
      to dGPU, create a device property to indicate that the UCSI endpoint
      is only for the scope of `POWER_SUPPLY_SCOPE_DEVICE`.
      
      Link: https://lore.kernel.org/lkml/20230516182541.5836-2-mario.limonciello@amd.com/
      
      
      Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
      Tested-by: default avatarEvan Quan <evan.quan@amd.com>
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Acked-by: default avatarAndi Shyti <andi.shyti@kernel.org>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      759e582b
    • Wayne Chang's avatar
      i2c: nvidia-gpu: Remove ccgx,firmware-build property · f2a6ce3e
      Wayne Chang authored
      commit 430b3876
      
       upstream.
      
      Now the Cypress CCG driver has been updated to support the
      'firmware-name' property to align with device-tree, remove the
      'ccgx,firmware-build' property as this is no longer needed.
      
      Signed-off-by: default avatarWayne Chang <waynec@nvidia.com>
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Acked-by: default avatarAjay Gupta <ajayg@nvidia.com>
      Acked-by: default avatarWolfram Sang <wsa@kernel.org>
      Link: https://lore.kernel.org/r/20230131175748.256423-5-jonathanh@nvidia.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f2a6ce3e
    • Wayne Chang's avatar
      i2c: nvidia-gpu: Add ACPI property to align with device-tree · 7b67af8d
      Wayne Chang authored
      commit f510b0a3
      
       upstream.
      
      Device-tree uses the 'firmware-name' string property to pass a name of
      the firmware build to the Cypress CCGx driver. Add a new ACPI string
      property to the NVIDIA GPU I2C driver to align with device-tree so that
      we can migrate to using a common property name for both ACPI and
      device-tree.
      
      Signed-off-by: default avatarWayne Chang <waynec@nvidia.com>
      Co-developed-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Acked-by: default avatarAjay Gupta <ajayg@nvidia.com>
      Acked-by: default avatarWolfram Sang <wsa@kernel.org>
      Link: https://lore.kernel.org/r/20230131175748.256423-3-jonathanh@nvidia.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b67af8d
    • Jan Kara's avatar
      fs: Lock moved directories · f40d6213
      Jan Kara authored
      commit 28eceeda
      
       upstream.
      
      When a directory is moved to a different directory, some filesystems
      (udf, ext4, ocfs2, f2fs, and likely gfs2, reiserfs, and others) need to
      update their pointer to the parent and this must not race with other
      operations on the directory. Lock the directories when they are moved.
      Although not all filesystems need this locking, we perform it in
      vfs_rename() because getting the lock ordering right is really difficult
      and we don't want to expose these locking details to filesystems.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230601105830.13168-5-jack@suse.cz>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f40d6213
    • Jan Kara's avatar
      fs: Establish locking order for unrelated directories · 10c159f9
      Jan Kara authored
      commit f23ce757
      
       upstream.
      
      Currently the locking order of inode locks for directories that are not
      in ancestor relationship is not defined because all operations that
      needed to lock two directories like this were serialized by
      sb->s_vfs_rename_mutex. However some filesystems need to lock two
      subdirectories for RENAME_EXCHANGE operations and for this we need the
      locking order established even for two tree-unrelated directories.
      Provide a helper function lock_two_inodes() that establishes lock
      ordering for any two inodes and use it in lock_two_directories().
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230601105830.13168-4-jack@suse.cz>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10c159f9
    • Jan Kara's avatar
      Revert "f2fs: fix potential corruption when moving a directory" · 6654d2a1
      Jan Kara authored
      commit cde3c9d7 upstream.
      
      This reverts commit d9477215
      
      . The
      locking is going to be provided by VFS.
      
      CC: Jaegeuk Kim <jaegeuk@kernel.org>
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230601105830.13168-3-jack@suse.cz>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6654d2a1
    • Jan Kara's avatar
      ext4: Remove ext4 locking of moved directory · 6aaa22ec
      Jan Kara authored
      commit 3658840c upstream.
      
      Remove locking of moved directory in ext4_rename2(). We will take care
      of it in VFS instead. This effectively reverts commit 0813299c
      
      
      ("ext4: Fix possible corruption when moving a directory") and followup
      fixes.
      
      CC: Ted Tso <tytso@mit.edu>
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230601105830.13168-1-jack@suse.cz>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6aaa22ec
    • Thomas Weißschuh's avatar
      fs: avoid empty option when generating legacy mount string · 606e463e
      Thomas Weißschuh authored
      commit 62176420 upstream.
      
      As each option string fragment is always prepended with a comma it would
      happen that the whole string always starts with a comma. This could be
      interpreted by filesystem drivers as an empty option and may produce
      errors.
      
      For example the NTFS driver from ntfs.ko behaves like this and fails
      when mounted via the new API.
      
      Link: https://github.com/util-linux/util-linux/issues/2298
      
      
      Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
      Fixes: 3e1aeb00
      
       ("vfs: Implement a filesystem superblock creation/configuration context")
      Cc: stable@vger.kernel.org
      Message-Id: <20230607-fs-empty-option-v1-1-20c8dbf4671b@weissschuh.net>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      606e463e