selinux: check sidtab limit before adding a new entry
We need to error out when trying to add an entry above SIDTAB_MAX in
sidtab_reverse_lookup() to avoid overflow on the odd chance that this
happens.
Cc: stable@vger.kernel.org
Fixes: ee1a84fdfe
("selinux: overhaul sidtab to fix bug and improve performance")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
Родитель
ea74a685ad
Коммит
acbc372e61
|
@ -286,6 +286,11 @@ static int sidtab_reverse_lookup(struct sidtab *s, struct context *context,
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bail out if we already reached max entries */
|
||||||
|
rc = -EOVERFLOW;
|
||||||
|
if (count >= SIDTAB_MAX)
|
||||||
|
goto out_unlock;
|
||||||
|
|
||||||
/* insert context into new entry */
|
/* insert context into new entry */
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
dst = sidtab_do_lookup(s, count, 1);
|
dst = sidtab_do_lookup(s, count, 1);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче