diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2015-07-10 17:19:57 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-07-13 13:31:59 -0400 |
commit | bd1741f4cf05d7709348f591d16eeb5f786de673 (patch) | |
tree | 282ed00d354dbd524846f1abe394c8c3b408c819 /security | |
parent | 5dee25d08eac01472904b0ab32ce35edee5c0518 (diff) |
selinux: Augment BUG_ON assertion for secclass_map.
Ensure that we catch any cases where tclass == 0.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/avc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 2d5e1b04cd50..324acc62f7e0 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -116,6 +116,7 @@ static void avc_dump_av(struct audit_buffer *ab, u16 tclass, u32 av) | |||
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | 118 | ||
119 | BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map)); | ||
119 | perms = secclass_map[tclass-1].perms; | 120 | perms = secclass_map[tclass-1].perms; |
120 | 121 | ||
121 | audit_log_format(ab, " {"); | 122 | audit_log_format(ab, " {"); |
@@ -164,7 +165,7 @@ static void avc_dump_query(struct audit_buffer *ab, u32 ssid, u32 tsid, u16 tcla | |||
164 | kfree(scontext); | 165 | kfree(scontext); |
165 | } | 166 | } |
166 | 167 | ||
167 | BUG_ON(tclass >= ARRAY_SIZE(secclass_map)); | 168 | BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map)); |
168 | audit_log_format(ab, " tclass=%s", secclass_map[tclass-1].name); | 169 | audit_log_format(ab, " tclass=%s", secclass_map[tclass-1].name); |
169 | } | 170 | } |
170 | 171 | ||