Skip to content
  1. Aug 03, 2022
    • Junxiao Bi's avatar
      Revert "ocfs2: mount shared volume without ha stack" · 46f6301f
      Junxiao Bi authored
      commit c80af0c2 upstream.
      
      This reverts commit 912f655d.
      
      This commit introduced a regression that can cause mount hung.  The
      changes in __ocfs2_find_empty_slot causes that any node with none-zero
      node number can grab the slot that was already taken by node 0, so node 1
      will access the same journal with node 0, when it try to grab journal
      cluster lock, it will hung because it was already acquired by node 0.
      It's very easy to reproduce this, in one cluster, mount node 0 first, then
      node 1, you will see the following call trace from node 1.
      
      [13148.735424] INFO: task mount.ocfs2:53045 blocked for more than 122 seconds.
      [13148.739691]       Not tainted 5.15.0-2148.0.4.el8uek.mountracev2.x86_64 #2
      [13148.742560] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [13148.745846] task:mount.ocfs2     state:D stack:    0 pid:53045 ppid: 53044 flags:0x00004000
      [13148.749354] Call Trace:
      [13148.750718]  <TASK>
      [13148.752019]  ? usleep_range+0x90/0x89
      [13148.753882]  __schedule+0x210/0x567
      [13148.755684]  schedule+0x44/0xa8
      [13148.757270]  schedule_timeout+0x106/0x13c
      [13148.759273]  ? __prepare_to_swait+0x53/0x78
      [13148.761218]  __wait_for_common+0xae/0x163
      [13148.763144]  __ocfs2_cluster_lock.constprop.0+0x1d6/0x870 [ocfs2]
      [13148.765780]  ? ocfs2_inode_lock_full_nested+0x18d/0x398 [ocfs2]
      [13148.768312]  ocfs2_inode_lock_full_nested+0x18d/0x398 [ocfs2]
      [13148.770968]  ocfs2_journal_init+0x91/0x340 [ocfs2]
      [13148.773202]  ocfs2_check_volume+0x39/0x461 [ocfs2]
      [13148.775401]  ? iput+0x69/0xba
      [13148.777047]  ocfs2_mount_volume.isra.0.cold+0x40/0x1f5 [ocfs2]
      [13148.779646]  ocfs2_fill_super+0x54b/0x853 [ocfs2]
      [13148.781756]  mount_bdev+0x190/0x1b7
      [13148.783443]  ? ocfs2_remount+0x440/0x440 [ocfs2]
      [13148.785634]  legacy_get_tree+0x27/0x48
      [13148.787466]  vfs_get_tree+0x25/0xd0
      [13148.789270]  do_new_mount+0x18c/0x2d9
      [13148.791046]  __x64_sys_mount+0x10e/0x142
      [13148.792911]  do_syscall_64+0x3b/0x89
      [13148.794667]  entry_SYSCALL_64_after_hwframe+0x170/0x0
      [13148.797051] RIP: 0033:0x7f2309f6e26e
      [13148.798784] RSP: 002b:00007ffdcee7d408 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
      [13148.801974] RAX: ffffffffffffffda RBX: 00007ffdcee7d4a0 RCX: 00007f2309f6e26e
      [13148.804815] RDX: 0000559aa762a8ae RSI: 0000559aa939d340 RDI: 0000559aa93a22b0
      [13148.807719] RBP: 00007ffdcee7d5b0 R08: 0000559aa93a2290 R09: 00007f230a0b4820
      [13148.810659] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffdcee7d420
      [13148.813609] R13: 0000000000000000 R14: 0000559aa939f000 R15: 0000000000000000
      [13148.816564]  </TASK>
      
      To fix it, we can just fix __ocfs2_find_empty_slot.  But original commit
      introduced the feature to mount ocfs2 locally even it is cluster based,
      that is a very dangerous, it can easily cause serious data corruption,
      there is no way to stop other nodes mounting the fs and corrupting it.
      Setup ha or other cluster-aware stack is just the cost that we have to
      take for avoiding corruption, otherwise we have to do it in kernel.
      
      Link: https://lkml.kernel.org/r/20220603222801.42488-1-junxiao.bi@oracle.com
      Fixes: 912f655d
      
      ("ocfs2: mount shared volume without ha stack")
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Acked-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <heming.zhao@suse.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46f6301f
    • Luiz Augusto von Dentz's avatar
      Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put · f32d5615
      Luiz Augusto von Dentz authored
      commit d0be8347
      
       upstream.
      
      This fixes the following trace which is caused by hci_rx_work starting up
      *after* the final channel reference has been put() during sock_close() but
      *before* the references to the channel have been destroyed, so instead
      the code now rely on kref_get_unless_zero/l2cap_chan_hold_unless_zero to
      prevent referencing a channel that is about to be destroyed.
      
        refcount_t: increment on 0; use-after-free.
        BUG: KASAN: use-after-free in refcount_dec_and_test+0x20/0xd0
        Read of size 4 at addr ffffffc114f5bf18 by task kworker/u17:14/705
      
        CPU: 4 PID: 705 Comm: kworker/u17:14 Tainted: G S      W
        4.14.234-00003-g1fb6d0bd49a4-dirty #28
        Hardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150
        Google Inc. MSM sm8150 Flame DVT (DT)
        Workqueue: hci0 hci_rx_work
        Call trace:
         dump_backtrace+0x0/0x378
         show_stack+0x20/0x2c
         dump_stack+0x124/0x148
         print_address_description+0x80/0x2e8
         __kasan_report+0x168/0x188
         kasan_report+0x10/0x18
         __asan_load4+0x84/0x8c
         refcount_dec_and_test+0x20/0xd0
         l2cap_chan_put+0x48/0x12c
         l2cap_recv_frame+0x4770/0x6550
         l2cap_recv_acldata+0x44c/0x7a4
         hci_acldata_packet+0x100/0x188
         hci_rx_work+0x178/0x23c
         process_one_work+0x35c/0x95c
         worker_thread+0x4cc/0x960
         kthread+0x1a8/0x1c4
         ret_from_fork+0x10/0x18
      
      Cc: stable@kernel.org
      Reported-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Tested-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f32d5615
  2. Jul 29, 2022