[RFC][PATCH 3/7] smack: assign the label set in file->f_cred to new file descriptors

From: Roberto Sassu
Date: Wed Apr 27 2011 - 08:36:43 EST


The SMACK label of new file descriptors is obtained from the credentials
set in the 'f_cred' field of the same structure.

Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxx>
---
security/smack/smack_lsm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index c6f8fca..e3c9e54 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1011,7 +1011,7 @@ static int smack_file_permission(struct file *file, int mask)
*/
static int smack_file_alloc_security(struct file *file)
{
- file->f_security = smk_of_current();
+ file->f_security = smk_of_task(file->f_cred->security);
return 0;
}

--
1.7.4.4

Attachment: smime.p7s
Description: S/MIME cryptographic signature