tpm: fix a kernel memory leak in tpm-sysfs.c
[linux/fpc-iii.git] / security / apparmor / include / policy_unpack.h
blob4c1319eebc427553769c9fedfaa64863c1c1c7c8
1 /*
2 * AppArmor security module
4 * This file contains AppArmor policy loading interface function definitions.
6 * Copyright (C) 1998-2008 Novell/SUSE
7 * Copyright 2009-2010 Canonical Ltd.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation, version 2 of the
12 * License.
15 #ifndef __POLICY_INTERFACE_H
16 #define __POLICY_INTERFACE_H
18 #include <linux/list.h>
19 #include <linux/kref.h>
21 struct aa_load_ent {
22 struct list_head list;
23 struct aa_profile *new;
24 struct aa_profile *old;
25 struct aa_profile *rename;
26 const char *ns_name;
29 void aa_load_ent_free(struct aa_load_ent *ent);
30 struct aa_load_ent *aa_load_ent_alloc(void);
32 #define PACKED_FLAG_HAT 1
34 #define PACKED_MODE_ENFORCE 0
35 #define PACKED_MODE_COMPLAIN 1
36 #define PACKED_MODE_KILL 2
37 #define PACKED_MODE_UNCONFINED 3
39 /* struct aa_loaddata - buffer of policy load data set */
40 struct aa_loaddata {
41 struct kref count;
42 size_t size;
43 int abi;
44 unsigned char *hash;
45 char data[];
48 int aa_unpack(struct aa_loaddata *udata, struct list_head *lh, const char **ns);
50 static inline struct aa_loaddata *
51 aa_get_loaddata(struct aa_loaddata *data)
53 if (data)
54 kref_get(&(data->count));
55 return data;
58 void aa_loaddata_kref(struct kref *kref);
59 static inline void aa_put_loaddata(struct aa_loaddata *data)
61 if (data)
62 kref_put(&data->count, aa_loaddata_kref);
65 #endif /* __POLICY_INTERFACE_H */