diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-12-26 09:52:54 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-12-26 09:52:54 -0500 |
commit | 7f50548abb5454bd82c25aae15f0a3bf6a530f46 (patch) | |
tree | 175b5d695437151f0f9f778ad8eb7f274468842f /security/selinux/hooks.c | |
parent | b3172f222ab5afdc91ea058bd11c42cf169728f3 (diff) | |
parent | 6b7b284958d47b77d06745b36bc7f36dab769d9b (diff) |
Merge commit 'v2.6.33-rc2' into for-2.6.33
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index bb230d5d7085..7a374c2eb043 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -91,7 +91,6 @@ | |||
91 | 91 | ||
92 | #define NUM_SEL_MNT_OPTS 5 | 92 | #define NUM_SEL_MNT_OPTS 5 |
93 | 93 | ||
94 | extern unsigned int policydb_loaded_version; | ||
95 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); | 94 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); |
96 | extern struct security_operations *security_ops; | 95 | extern struct security_operations *security_ops; |
97 | 96 | ||
@@ -3338,9 +3337,18 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | |||
3338 | return 0; | 3337 | return 0; |
3339 | } | 3338 | } |
3340 | 3339 | ||
3341 | static int selinux_kernel_module_request(void) | 3340 | static int selinux_kernel_module_request(char *kmod_name) |
3342 | { | 3341 | { |
3343 | return task_has_system(current, SYSTEM__MODULE_REQUEST); | 3342 | u32 sid; |
3343 | struct common_audit_data ad; | ||
3344 | |||
3345 | sid = task_sid(current); | ||
3346 | |||
3347 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); | ||
3348 | ad.u.kmod_name = kmod_name; | ||
3349 | |||
3350 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, | ||
3351 | SYSTEM__MODULE_REQUEST, &ad); | ||
3344 | } | 3352 | } |
3345 | 3353 | ||
3346 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) | 3354 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) |
@@ -4085,7 +4093,7 @@ static int selinux_sock_rcv_skb_compat(struct sock *sk, struct sk_buff *skb, | |||
4085 | char *addrp; | 4093 | char *addrp; |
4086 | 4094 | ||
4087 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4095 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4088 | ad.u.net.netif = skb->iif; | 4096 | ad.u.net.netif = skb->skb_iif; |
4089 | ad.u.net.family = family; | 4097 | ad.u.net.family = family; |
4090 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4098 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4091 | if (err) | 4099 | if (err) |
@@ -4147,7 +4155,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4147 | return 0; | 4155 | return 0; |
4148 | 4156 | ||
4149 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4157 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4150 | ad.u.net.netif = skb->iif; | 4158 | ad.u.net.netif = skb->skb_iif; |
4151 | ad.u.net.family = family; | 4159 | ad.u.net.family = family; |
4152 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4160 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4153 | if (err) | 4161 | if (err) |
@@ -4159,7 +4167,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4159 | err = selinux_skb_peerlbl_sid(skb, family, &peer_sid); | 4167 | err = selinux_skb_peerlbl_sid(skb, family, &peer_sid); |
4160 | if (err) | 4168 | if (err) |
4161 | return err; | 4169 | return err; |
4162 | err = selinux_inet_sys_rcv_skb(skb->iif, addrp, family, | 4170 | err = selinux_inet_sys_rcv_skb(skb->skb_iif, addrp, family, |
4163 | peer_sid, &ad); | 4171 | peer_sid, &ad); |
4164 | if (err) { | 4172 | if (err) { |
4165 | selinux_netlbl_err(skb, err, 0); | 4173 | selinux_netlbl_err(skb, err, 0); |
@@ -4714,10 +4722,7 @@ static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
4714 | if (err) | 4722 | if (err) |
4715 | return err; | 4723 | return err; |
4716 | 4724 | ||
4717 | if (policydb_loaded_version >= POLICYDB_VERSION_NLCLASS) | 4725 | return selinux_nlmsg_perm(sk, skb); |
4718 | err = selinux_nlmsg_perm(sk, skb); | ||
4719 | |||
4720 | return err; | ||
4721 | } | 4726 | } |
4722 | 4727 | ||
4723 | static int selinux_netlink_recv(struct sk_buff *skb, int capability) | 4728 | static int selinux_netlink_recv(struct sk_buff *skb, int capability) |
@@ -5830,12 +5835,12 @@ int selinux_disable(void) | |||
5830 | selinux_disabled = 1; | 5835 | selinux_disabled = 1; |
5831 | selinux_enabled = 0; | 5836 | selinux_enabled = 0; |
5832 | 5837 | ||
5833 | /* Try to destroy the avc node cache */ | ||
5834 | avc_disable(); | ||
5835 | |||
5836 | /* Reset security_ops to the secondary module, dummy or capability. */ | 5838 | /* Reset security_ops to the secondary module, dummy or capability. */ |
5837 | security_ops = secondary_ops; | 5839 | security_ops = secondary_ops; |
5838 | 5840 | ||
5841 | /* Try to destroy the avc node cache */ | ||
5842 | avc_disable(); | ||
5843 | |||
5839 | /* Unregister netfilter hooks. */ | 5844 | /* Unregister netfilter hooks. */ |
5840 | selinux_nf_ip_exit(); | 5845 | selinux_nf_ip_exit(); |
5841 | 5846 | ||