CVE-2022-49337
Publication date:
26/02/2025
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock<br />
<br />
When user_dlm_destroy_lock failed, it didn&#39;t clean up the flags it set<br />
before exit. For USER_LOCK_IN_TEARDOWN, if this function fails because of<br />
lock is still in used, next time when unlink invokes this function, it<br />
will return succeed, and then unlink will remove inode and dentry if lock<br />
is not in used(file closed), but the dlm lock is still linked in dlm lock<br />
resource, then when bast come in, it will trigger a panic due to<br />
user-after-free. See the following panic call trace. To fix this,<br />
USER_LOCK_IN_TEARDOWN should be reverted if fail. And also error should<br />
be returned if USER_LOCK_IN_TEARDOWN is set to let user know that unlink<br />
fail.<br />
<br />
For the case of ocfs2_dlm_unlock failure, besides USER_LOCK_IN_TEARDOWN,<br />
USER_LOCK_BUSY is also required to be cleared. Even though spin lock is<br />
released in between, but USER_LOCK_IN_TEARDOWN is still set, for<br />
USER_LOCK_BUSY, if before every place that waits on this flag,<br />
USER_LOCK_IN_TEARDOWN is checked to bail out, that will make sure no flow<br />
waits on the busy flag set by user_dlm_destroy_lock(), then we can<br />
simplely revert USER_LOCK_BUSY when ocfs2_dlm_unlock fails. Fix<br />
user_dlm_cluster_lock() which is the only function not following this.<br />
<br />
[ 941.336392] (python,26174,16):dlmfs_unlink:562 ERROR: unlink<br />
004fb0000060000b5a90b8c847b72e1, error -16 from destroy<br />
[ 989.757536] ------------[ cut here ]------------<br />
[ 989.757709] kernel BUG at fs/ocfs2/dlmfs/userdlm.c:173!<br />
[ 989.757876] invalid opcode: 0000 [#1] SMP<br />
[ 989.758027] Modules linked in: ksplice_2zhuk2jr_ib_ipoib_new(O)<br />
ksplice_2zhuk2jr(O) mptctl mptbase xen_netback xen_blkback xen_gntalloc<br />
xen_gntdev xen_evtchn cdc_ether usbnet mii ocfs2 jbd2 rpcsec_gss_krb5<br />
auth_rpcgss nfsv4 nfsv3 nfs_acl nfs fscache lockd grace ocfs2_dlmfs<br />
ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs bnx2fc<br />
fcoe libfcoe libfc scsi_transport_fc sunrpc ipmi_devintf bridge stp llc<br />
rds_rdma rds bonding ib_sdp ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad<br />
rdma_cm ib_cm iw_cm falcon_lsm_serviceable(PE) falcon_nf_netcontain(PE)<br />
mlx4_vnic falcon_kal(E) falcon_lsm_pinned_13402(E) mlx4_ib ib_sa ib_mad<br />
ib_core ib_addr xenfs xen_privcmd dm_multipath iTCO_wdt iTCO_vendor_support<br />
pcspkr sb_edac edac_core i2c_i801 lpc_ich mfd_core ipmi_ssif i2c_core ipmi_si<br />
ipmi_msghandler<br />
[ 989.760686] ioatdma sg ext3 jbd mbcache sd_mod ahci libahci ixgbe dca ptp<br />
pps_core vxlan udp_tunnel ip6_udp_tunnel megaraid_sas mlx4_core crc32c_intel<br />
be2iscsi bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi ipv6 cxgb3 mdio<br />
libiscsi_tcp qla4xxx iscsi_boot_sysfs libiscsi scsi_transport_iscsi wmi<br />
dm_mirror dm_region_hash dm_log dm_mod [last unloaded:<br />
ksplice_2zhuk2jr_ib_ipoib_old]<br />
[ 989.761987] CPU: 10 PID: 19102 Comm: dlm_thread Tainted: P OE<br />
4.1.12-124.57.1.el6uek.x86_64 #2<br />
[ 989.762290] Hardware name: Oracle Corporation ORACLE SERVER<br />
X5-2/ASM,MOTHERBOARD,1U, BIOS 30350100 06/17/2021<br />
[ 989.762599] task: ffff880178af6200 ti: ffff88017f7c8000 task.ti:<br />
ffff88017f7c8000<br />
[ 989.762848] RIP: e030:[] []<br />
__user_dlm_queue_lockres.part.4+0x76/0x80 [ocfs2_dlmfs]<br />
[ 989.763185] RSP: e02b:ffff88017f7cbcb8 EFLAGS: 00010246<br />
[ 989.763353] RAX: 0000000000000000 RBX: ffff880174d48008 RCX:<br />
0000000000000003<br />
[ 989.763565] RDX: 0000000000120012 RSI: 0000000000000003 RDI:<br />
ffff880174d48170<br />
[ 989.763778] RBP: ffff88017f7cbcc8 R08: ffff88021f4293b0 R09:<br />
0000000000000000<br />
[ 989.763991] R10: ffff880179c8c000 R11: 0000000000000003 R12:<br />
ffff880174d48008<br />
[ 989.764204] R13: 0000000000000003 R14: ffff880179c8c000 R15:<br />
ffff88021db7a000<br />
[ 989.764422] FS: 0000000000000000(0000) GS:ffff880247480000(0000)<br />
knlGS:ffff880247480000<br />
[ 989.764685] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033<br />
[ 989.764865] CR2: ffff8000007f6800 CR3: 0000000001ae0000 CR4:<br />
0000000000042660<br />
[ 989.765081] Stack:<br />
[ 989.765167] 00000000000<br />
---truncated---
Severity CVSS v4.0: Pending analysis
Last modification:
26/02/2025