mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/xsm: flask: restore sidtab state on policy load failure
Error path of failed sidtab_map() leaves global sidtab in shutdown state and from that point system is unable to allocate new SIDs in sidtab_context_to_sid(). To restore sidtab state new function sidtab_cancel_shutdown() is introduced, which only resets shutdown flag, rewinding effect of sidtab_shutdown(). Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com> Acked-by: Daniel P. Smith <dpsmith@apertussoutions.com>
This commit is contained in:
1 parent
38eb999ba3
commit
7a058df1a4
3 files changed
+9
No files matched your search
@@ -1428,6 +1428,7 @@ int security_load_policy(const void *data, size_t len)
|
||||
if ( sidtab_map(&sidtab, clone_sid, &newsidtab) )
|
||||
{
|
||||
rc = -ENOMEM;
|
||||
sidtab_cancel_shutdown(&sidtab);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,3 +320,10 @@ void sidtab_shutdown(struct sidtab *s)
|
||||
s->shutdown = 1;
|
||||
SIDTAB_UNLOCK(s);
|
||||
}
|
||||
|
||||
void sidtab_cancel_shutdown(struct sidtab *s)
|
||||
{
|
||||
SIDTAB_LOCK(s);
|
||||
s->shutdown = 0;
|
||||
SIDTAB_UNLOCK(s);
|
||||
}
|
||||
@@ -49,5 +49,6 @@ void sidtab_hash_eval(struct sidtab *h, char *tag);
|
||||
void sidtab_destroy(struct sidtab *s);
|
||||
void sidtab_set(struct sidtab *dst, struct sidtab *src);
|
||||
void sidtab_shutdown(struct sidtab *s);
|
||||
void sidtab_cancel_shutdown(struct sidtab *s);
|
||||
|
||||
#endif /* _SS_SIDTAB_H_ */
|
||||