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
Differential Revision: https://reviews.freebsd.org/D45225

(cherry picked from commit 4b3141f5d5373989598f9447ab5a9f87e2d1c9fb)

Details

Provenance
oshogboAuthored on May 19 2024, 12:53 PM
Reviewer
asomers
Differential Revision
D45225: geli: Allocate a UMA pool earlier
Parents
rG4c380c44c82f: iavf(4): Improve man page
Branches
Unknown
Tags
Unknown