HomeFreeBSD

geli: allocate a UMA pool earlier

Description

geli: allocate a UMA pool earlier

The functions g_eli_init_uma and g_eli_fini_uma are used to trace
the number of devices in GELI. There is an issue where the g_eli_create
function may fail before g_eli_init_uma is called, however
g_eli_fini_uma is still executed in the fail path. This can
incorrectly decrease the device count to zero, potentially leading to
the UMA pool being freed. Accessing the device after the pool has been
freed causes a system panic.

This commit resolves the issue by ensuring devices count is increassed
eariler.

PR: 278828
Reported by: Andre Albsmeier <mail@fbsd2.e4m.org>
Reviewed by: asomers
MFC after: 3 days
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D45225

(cherry picked from commit 4b3141f5d5373989598f9447ab5a9f87e2d1c9fb)
(cherry picked from commit ea5a708625e5b5c89333e3e3e9a48fe588f05361)

Details

Provenance
oshogboAuthored on May 19 2024, 12:53 PM
Reviewer
asomers
Differential Revision
D45225: geli: Allocate a UMA pool earlier
Parents
rG3b9c88fa9916: fix (nuageinit): SSH keys are not handled in metadata but in userdata
Branches
Unknown
Tags
Unknown