diff options
Diffstat (limited to 'net/netlabel/netlabel_mgmt.c')
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 0ac314f18ad1..53c9079ad2c3 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -87,11 +87,14 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
87 | struct netlbl_dom_map *entry = NULL; | 87 | struct netlbl_dom_map *entry = NULL; |
88 | size_t tmp_size; | 88 | size_t tmp_size; |
89 | u32 tmp_val; | 89 | u32 tmp_val; |
90 | struct netlbl_audit audit_info; | ||
90 | 91 | ||
91 | if (!info->attrs[NLBL_MGMT_A_DOMAIN] || | 92 | if (!info->attrs[NLBL_MGMT_A_DOMAIN] || |
92 | !info->attrs[NLBL_MGMT_A_PROTOCOL]) | 93 | !info->attrs[NLBL_MGMT_A_PROTOCOL]) |
93 | goto add_failure; | 94 | goto add_failure; |
94 | 95 | ||
96 | netlbl_netlink_auditinfo(skb, &audit_info); | ||
97 | |||
95 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 98 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
96 | if (entry == NULL) { | 99 | if (entry == NULL) { |
97 | ret_val = -ENOMEM; | 100 | ret_val = -ENOMEM; |
@@ -108,7 +111,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
108 | 111 | ||
109 | switch (entry->type) { | 112 | switch (entry->type) { |
110 | case NETLBL_NLTYPE_UNLABELED: | 113 | case NETLBL_NLTYPE_UNLABELED: |
111 | ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid); | 114 | ret_val = netlbl_domhsh_add(entry, &audit_info); |
112 | break; | 115 | break; |
113 | case NETLBL_NLTYPE_CIPSOV4: | 116 | case NETLBL_NLTYPE_CIPSOV4: |
114 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) | 117 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) |
@@ -125,7 +128,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
125 | rcu_read_unlock(); | 128 | rcu_read_unlock(); |
126 | goto add_failure; | 129 | goto add_failure; |
127 | } | 130 | } |
128 | ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid); | 131 | ret_val = netlbl_domhsh_add(entry, &audit_info); |
129 | rcu_read_unlock(); | 132 | rcu_read_unlock(); |
130 | break; | 133 | break; |
131 | default: | 134 | default: |
@@ -156,12 +159,15 @@ add_failure: | |||
156 | static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info) | 159 | static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info) |
157 | { | 160 | { |
158 | char *domain; | 161 | char *domain; |
162 | struct netlbl_audit audit_info; | ||
159 | 163 | ||
160 | if (!info->attrs[NLBL_MGMT_A_DOMAIN]) | 164 | if (!info->attrs[NLBL_MGMT_A_DOMAIN]) |
161 | return -EINVAL; | 165 | return -EINVAL; |
162 | 166 | ||
167 | netlbl_netlink_auditinfo(skb, &audit_info); | ||
168 | |||
163 | domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]); | 169 | domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]); |
164 | return netlbl_domhsh_remove(domain, NETLINK_CB(skb).sid); | 170 | return netlbl_domhsh_remove(domain, &audit_info); |
165 | } | 171 | } |
166 | 172 | ||
167 | /** | 173 | /** |
@@ -264,10 +270,13 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
264 | int ret_val = -EINVAL; | 270 | int ret_val = -EINVAL; |
265 | struct netlbl_dom_map *entry = NULL; | 271 | struct netlbl_dom_map *entry = NULL; |
266 | u32 tmp_val; | 272 | u32 tmp_val; |
273 | struct netlbl_audit audit_info; | ||
267 | 274 | ||
268 | if (!info->attrs[NLBL_MGMT_A_PROTOCOL]) | 275 | if (!info->attrs[NLBL_MGMT_A_PROTOCOL]) |
269 | goto adddef_failure; | 276 | goto adddef_failure; |
270 | 277 | ||
278 | netlbl_netlink_auditinfo(skb, &audit_info); | ||
279 | |||
271 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 280 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
272 | if (entry == NULL) { | 281 | if (entry == NULL) { |
273 | ret_val = -ENOMEM; | 282 | ret_val = -ENOMEM; |
@@ -277,8 +286,7 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
277 | 286 | ||
278 | switch (entry->type) { | 287 | switch (entry->type) { |
279 | case NETLBL_NLTYPE_UNLABELED: | 288 | case NETLBL_NLTYPE_UNLABELED: |
280 | ret_val = netlbl_domhsh_add_default(entry, | 289 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); |
281 | NETLINK_CB(skb).sid); | ||
282 | break; | 290 | break; |
283 | case NETLBL_NLTYPE_CIPSOV4: | 291 | case NETLBL_NLTYPE_CIPSOV4: |
284 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) | 292 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) |
@@ -295,8 +303,7 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
295 | rcu_read_unlock(); | 303 | rcu_read_unlock(); |
296 | goto adddef_failure; | 304 | goto adddef_failure; |
297 | } | 305 | } |
298 | ret_val = netlbl_domhsh_add_default(entry, | 306 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); |
299 | NETLINK_CB(skb).sid); | ||
300 | rcu_read_unlock(); | 307 | rcu_read_unlock(); |
301 | break; | 308 | break; |
302 | default: | 309 | default: |
@@ -324,7 +331,11 @@ adddef_failure: | |||
324 | */ | 331 | */ |
325 | static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info) | 332 | static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info) |
326 | { | 333 | { |
327 | return netlbl_domhsh_remove_default(NETLINK_CB(skb).sid); | 334 | struct netlbl_audit audit_info; |
335 | |||
336 | netlbl_netlink_auditinfo(skb, &audit_info); | ||
337 | |||
338 | return netlbl_domhsh_remove_default(&audit_info); | ||
328 | } | 339 | } |
329 | 340 | ||
330 | /** | 341 | /** |