You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
NetLabel: make netlbl_lsm_secattr struct easier/quicker to understand
The existing netlbl_lsm_secattr struct required the LSM to check all of the fields to determine if any security attributes were present resulting in a lot of work in the common case of no attributes. This patch adds a 'flags' field which is used to indicate which attributes are present in the structure; this should allow the LSM to do a quick comparison to determine if the structure holds any security attributes. Example: if (netlbl_lsm_secattr->flags) /* security attributes present */ else /* NO security attributes present */ Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
committed by
David S. Miller
parent
c6fa82a9dd
commit
701a90bad9
+11
-2
@@ -111,11 +111,17 @@ struct netlbl_lsm_cache {
|
||||
void (*free) (const void *data);
|
||||
void *data;
|
||||
};
|
||||
#define NETLBL_SECATTR_NONE 0x00000000
|
||||
#define NETLBL_SECATTR_DOMAIN 0x00000001
|
||||
#define NETLBL_SECATTR_CACHE 0x00000002
|
||||
#define NETLBL_SECATTR_MLS_LVL 0x00000004
|
||||
#define NETLBL_SECATTR_MLS_CAT 0x00000008
|
||||
struct netlbl_lsm_secattr {
|
||||
u32 flags;
|
||||
|
||||
char *domain;
|
||||
|
||||
u32 mls_lvl;
|
||||
u32 mls_lvl_vld;
|
||||
unsigned char *mls_cat;
|
||||
size_t mls_cat_len;
|
||||
|
||||
@@ -174,7 +180,10 @@ static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
|
||||
*/
|
||||
static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
|
||||
{
|
||||
memset(secattr, 0, sizeof(*secattr));
|
||||
secattr->flags = 0;
|
||||
secattr->domain = NULL;
|
||||
secattr->mls_cat = NULL;
|
||||
secattr->cache = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user