diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-08-03 01:35:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-08-03 01:35:26 -0400 |
commit | 46f5960fdbf359f0c75989854bbaebc1de7a1eb4 (patch) | |
tree | 132d8d0eba110342bb88fcce2519c441ac771162 /security/selinux/hooks.c | |
parent | 90eb29efd0ca9301d80d03ea13662d32436f060e (diff) | |
parent | 29bbd72d6ee1dbf2d9f00d022f8e999aa528fb3a (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (32 commits)
[NET]: Fix more per-cpu typos
[SECURITY]: Fix build with CONFIG_SECURITY disabled.
[I/OAT]: Remove CPU hotplug lock from net_dma_rebalance
[DECNET]: Fix for routing bug
[AF_UNIX]: Kernel memory leak fix for af_unix datagram getpeersec patch
[NET]: skb_queue_lock_key() is no longer used.
[NET]: Remove lockdep_set_class() call from skb_queue_head_init().
[IPV6]: SNMPv2 "ipv6IfStatsOutFragCreates" counter error
[IPV6]: SNMPv2 "ipv6IfStatsInHdrErrors" counter error
[NET]: Kill the WARN_ON() calls for checksum fixups.
[NETFILTER]: xt_hashlimit/xt_string: missing string validation
[NETFILTER]: SIP helper: expect RTP streams in both directions
[E1000]: Convert to netdev_alloc_skb
[TG3]: Convert to netdev_alloc_skb
[NET]: Add netdev_alloc_skb().
[TCP]: Process linger2 timeout consistently.
[SECURITY] secmark: nul-terminate secdata
[NET] infiniband: Cleanup ib_addr module to use the netevents
[NET]: Core net changes to generate netevents
[NET]: Network Event Notifier Mechanism.
...
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index a91c961ba3..5d1b8c7331 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -3524,25 +3524,21 @@ out: | |||
3524 | return err; | 3524 | return err; |
3525 | } | 3525 | } |
3526 | 3526 | ||
3527 | static int selinux_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, u32 *seclen) | 3527 | static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
3528 | { | 3528 | { |
3529 | u32 peer_secid = SECSID_NULL; | ||
3529 | int err = 0; | 3530 | int err = 0; |
3530 | u32 peer_sid; | ||
3531 | 3531 | ||
3532 | if (skb->sk->sk_family == PF_UNIX) | 3532 | if (sock && (sock->sk->sk_family == PF_UNIX)) |
3533 | selinux_get_inode_sid(SOCK_INODE(skb->sk->sk_socket), | 3533 | selinux_get_inode_sid(SOCK_INODE(sock), &peer_secid); |
3534 | &peer_sid); | 3534 | else if (skb) |
3535 | else | 3535 | peer_secid = selinux_socket_getpeer_dgram(skb); |
3536 | peer_sid = selinux_socket_getpeer_dgram(skb); | ||
3537 | |||
3538 | if (peer_sid == SECSID_NULL) | ||
3539 | return -EINVAL; | ||
3540 | 3536 | ||
3541 | err = security_sid_to_context(peer_sid, secdata, seclen); | 3537 | if (peer_secid == SECSID_NULL) |
3542 | if (err) | 3538 | err = -EINVAL; |
3543 | return err; | 3539 | *secid = peer_secid; |
3544 | 3540 | ||
3545 | return 0; | 3541 | return err; |
3546 | } | 3542 | } |
3547 | 3543 | ||
3548 | static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority) | 3544 | static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority) |
@@ -4407,6 +4403,17 @@ static int selinux_setprocattr(struct task_struct *p, | |||
4407 | return size; | 4403 | return size; |
4408 | } | 4404 | } |
4409 | 4405 | ||
4406 | static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | ||
4407 | { | ||
4408 | return security_sid_to_context(secid, secdata, seclen); | ||
4409 | } | ||
4410 | |||
4411 | static void selinux_release_secctx(char *secdata, u32 seclen) | ||
4412 | { | ||
4413 | if (secdata) | ||
4414 | kfree(secdata); | ||
4415 | } | ||
4416 | |||
4410 | #ifdef CONFIG_KEYS | 4417 | #ifdef CONFIG_KEYS |
4411 | 4418 | ||
4412 | static int selinux_key_alloc(struct key *k, struct task_struct *tsk, | 4419 | static int selinux_key_alloc(struct key *k, struct task_struct *tsk, |
@@ -4587,6 +4594,9 @@ static struct security_operations selinux_ops = { | |||
4587 | .getprocattr = selinux_getprocattr, | 4594 | .getprocattr = selinux_getprocattr, |
4588 | .setprocattr = selinux_setprocattr, | 4595 | .setprocattr = selinux_setprocattr, |
4589 | 4596 | ||
4597 | .secid_to_secctx = selinux_secid_to_secctx, | ||
4598 | .release_secctx = selinux_release_secctx, | ||
4599 | |||
4590 | .unix_stream_connect = selinux_socket_unix_stream_connect, | 4600 | .unix_stream_connect = selinux_socket_unix_stream_connect, |
4591 | .unix_may_send = selinux_socket_unix_may_send, | 4601 | .unix_may_send = selinux_socket_unix_may_send, |
4592 | 4602 | ||