mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
selinux: avoid avtab overflows
Prevent inserting more than the supported U32_MAX number of entries. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
parent
bbea03f474
commit
f785c54101
@ -110,7 +110,7 @@ static int avtab_insert(struct avtab *h, const struct avtab_key *key,
|
||||
struct avtab_node *prev, *cur, *newnode;
|
||||
u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
|
||||
|
||||
if (!h || !h->nslot)
|
||||
if (!h || !h->nslot || h->nel == U32_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
hvalue = avtab_hash(key, h->mask);
|
||||
@ -156,7 +156,7 @@ struct avtab_node *avtab_insert_nonunique(struct avtab *h,
|
||||
struct avtab_node *prev, *cur;
|
||||
u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
|
||||
|
||||
if (!h || !h->nslot)
|
||||
if (!h || !h->nslot || h->nel == U32_MAX)
|
||||
return NULL;
|
||||
hvalue = avtab_hash(key, h->mask);
|
||||
for (prev = NULL, cur = h->htable[hvalue];
|
||||
|
Loading…
Reference in New Issue
Block a user