diff options
author | Paul Moore <paul.moore@hp.com> | 2006-08-29 20:55:38 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:18:38 -0400 |
commit | e448e931309e703f51d71a557973c620ff12fbda (patch) | |
tree | 8a738f5f45367965c29210402d28464fec3c04be /security/selinux/ss/services.c | |
parent | 7b3bbb926f4b3dd3a007dcf8dfa00203f52cb58d (diff) |
[NetLabel]: uninline selinux_netlbl_inode_permission()
Uninline the selinux_netlbl_inode_permission() at the request of
Andrew Morton.
Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 4f7642c7337e..27ee28ccf266 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -2544,24 +2544,39 @@ u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb, u32 sock_sid) | |||
2544 | } | 2544 | } |
2545 | 2545 | ||
2546 | /** | 2546 | /** |
2547 | * __selinux_netlbl_inode_permission - Label a socket using NetLabel | 2547 | * selinux_netlbl_inode_permission - Verify the socket is NetLabel labeled |
2548 | * @inode: the file descriptor's inode | 2548 | * @inode: the file descriptor's inode |
2549 | * @mask: the permission mask | 2549 | * @mask: the permission mask |
2550 | * | 2550 | * |
2551 | * Description: | 2551 | * Description: |
2552 | * Try to label a socket with the inode's SID using NetLabel. Returns zero on | 2552 | * Looks at a file's inode and if it is marked as a socket protected by |
2553 | * success, negative values on failure. | 2553 | * NetLabel then verify that the socket has been labeled, if not try to label |
2554 | * the socket now with the inode's SID. Returns zero on success, negative | ||
2555 | * values on failure. | ||
2554 | * | 2556 | * |
2555 | */ | 2557 | */ |
2556 | int __selinux_netlbl_inode_permission(struct inode *inode, int mask) | 2558 | int selinux_netlbl_inode_permission(struct inode *inode, int mask) |
2557 | { | 2559 | { |
2558 | int rc; | 2560 | int rc; |
2559 | struct socket *sock = SOCKET_I(inode); | 2561 | struct inode_security_struct *isec; |
2560 | struct sk_security_struct *sksec = sock->sk->sk_security; | 2562 | struct sk_security_struct *sksec; |
2563 | struct socket *sock; | ||
2561 | 2564 | ||
2562 | lock_sock(sock->sk); | 2565 | if (!S_ISSOCK(inode->i_mode)) |
2563 | rc = selinux_netlbl_socket_setsid(sock, sksec->sid); | 2566 | return 0; |
2564 | release_sock(sock->sk); | 2567 | |
2568 | sock = SOCKET_I(inode); | ||
2569 | isec = inode->i_security; | ||
2570 | sksec = sock->sk->sk_security; | ||
2571 | down(&isec->sem); | ||
2572 | if (unlikely(sksec->nlbl_state == NLBL_REQUIRE && | ||
2573 | (mask & (MAY_WRITE | MAY_APPEND)))) { | ||
2574 | lock_sock(sock->sk); | ||
2575 | rc = selinux_netlbl_socket_setsid(sock, sksec->sid); | ||
2576 | release_sock(sock->sk); | ||
2577 | } else | ||
2578 | rc = 0; | ||
2579 | up(&isec->sem); | ||
2565 | 2580 | ||
2566 | return rc; | 2581 | return rc; |
2567 | } | 2582 | } |