CVE-2026-139796: ocfs2/heartbeat: serialize concurrent writes to a region's dev attribute

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

ocfs2/heartbeat: serialize concurrent writes to a region's dev attribute

o2hbregiondevstore() checks reg->hrbdevfile to see if the region is already started, but nothing stops two writers from doing that at the same time. configfs only serializes writes through the same open file, so two processes that each open the dev attribute can both get past the check:

A: hrbdevfile is NULL, opens file A, sets hrbdevfile = A B: hrbdevfile is NULL, opens file B, sets hrbdevfile = B A: start fails, fput(hrbdevfile) drops B, sets it to NULL B: start fails, fput(NULL)

Both calls also use the same hrslots, hrslotdata and hrtmpblock, so the error paths can free the slot data twice.

syzbot hit the fput(NULL) with an unbound loop device, where every start fails with -EIO. With four threads doing the same thing on a KASAN kernel I get both crashes within a second:

BUG: KASAN: double-free in o2hbunmapslotdata+0x14d/0x2f0 BUG: kernel NULL pointer dereference, address: 0000000000000158

Add a mutex to the region and hold it in devstore(), in the blockbytes, startblock and blocks stores, and in devshow(), since they all look at hrbdevfile. devstore() cleans up with goto, so it takes the mutex in a small wrapper rather than with guard(). The mutex is dropped while devstore() waits for the heartbeat to become steady, which takes seconds, so a read of dev doesn't stall behind a start. hrbdevfile is already set at that point, so other writers still get -EINVAL, and the cleanup after the wait retakes the mutex.

With the patch the same test ran for 10 minutes with lockdep on and nothing was reported. So did a second one, with a working loop device, that interrupts starts during the wait while other threads read and write the attributes.

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:38 PM
Data Sourced
via MITRE·01:38 PM
Description

Frequently Asked Questions

1

What access is needed to trigger this issue?

An attacker or local process needs to be able to perform concurrent writes to an OCFS2 heartbeat region's configfs dev attribute through separate open file handles. The race occurs because configfs serializes writes only through the same open file.

2

What conditions make exploitation more likely?

The issue requires two or more writers to pass the check for an unstarted region at the same time. Failed region starts can expose the faulty cleanup paths; the reported reproducer used an unbound loop device that caused starts to fail with -EIO.

3

What can happen if the race is triggered?

Concurrent operations can overwrite the region's block-device file state and use shared slot-related data simultaneously. Reported outcomes include a double-free and a kernel NULL pointer dereference, which can crash the kernel.

4

How is the issue resolved?

The fix adds a mutex for each heartbeat region and uses it to serialize dev attribute handling, related block and slot configuration stores, and dev attribute reads. The listed stable-kernel references identify commits containing the fix.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203