Skip to contentSkip to conversation

apparmor: Fix an error code in verify_table_headers()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 19, 2018 – Mar 24, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apparmor: Fix an error code in verify_table_headers()

We accidentally return a positive EPROTO instead of a negative -EPROTO. Since 71 is not an error pointer, that means it eventually results in an Oops in the caller.

Fixes d901d6a298dc ("apparmor: dfa split verification of table headers")
security/apparmor/match.c +1 -1
index dd4c995c5e25..280eba082c7b 100644
@@ -198,7 +198,7 @@ static int verify_table_headers(struct table_header **tables, int flags)
 static int verify_dfa(struct aa_dfa *dfa)
 {
 	size_t i, state_count, trans_count;
-	int error = EPROTO;
+	int error = -EPROTO;
 
 	state_count = dfa->tables[YYTD_ID_BASE]->td_lolen;
 	trans_count = dfa->tables[YYTD_ID_NXT]->td_lolen;
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dan Carpenter

We accidentally return a positive EPROTO instead of a negative -EPROTO. Since 71 is not an error pointer, that means it eventually results in an Oops in the caller.

Fixes d901d6a298dc ("apparmor: dfa split verification of table headers")

ouch, and pulled into apparmor-next

Quoted 14 lines
security/apparmor/match.c +1 -1
index dd4c995c5e25..280eba082c7b 100644
@@ -198,7 +198,7 @@ static int verify_table_headers(struct table_header **tables, int flags)
 static int verify_dfa(struct aa_dfa *dfa)
 {
 	size_t i, state_count, trans_count;
-	int error = EPROTO;
+	int error = -EPROTO;
 
 	state_count = dfa->tables[YYTD_ID_BASE]->td_lolen;
 	trans_count = dfa->tables[YYTD_ID_NXT]->td_lolen;