apparmor/lsm: Fix aa_dfa_unpack's error handling in aa_setup_dfa_engine

aa_dfa_unpack returns ERR_PTR not NULL when it fails, but aa_put_dfa
only checks NULL for its input, which would cause invalid memory access
in aa_put_dfa. Set nulldfa to NULL explicitly to fix that.

Fixes: 98b824ff89 ("apparmor: refcount the pdb")
Signed-off-by: GONG Ruiqi <gongruiqi1@huawei.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
GONG Ruiqi
2026-04-22 20:11:08 -07:00
committed by John Johansen
parent 828bf7929b
commit 11b7df0952
+1
View File
@@ -2456,6 +2456,7 @@ static int __init aa_setup_dfa_engine(void)
TO_ACCEPT2_FLAG(YYTD_DATA32));
if (IS_ERR(nulldfa)) {
error = PTR_ERR(nulldfa);
nulldfa = NULL;
goto fail;
}
nullpdb->dfa = aa_get_dfa(nulldfa);