Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759160Ab1D0Mgy (ORCPT ); Wed, 27 Apr 2011 08:36:54 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:60967 "EHLO out2.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759119Ab1D0Mgs (ORCPT ); Wed, 27 Apr 2011 08:36:48 -0400 X-Sasl-enc: xr27hFH3xm/qMr5Dvpy6OrfldlW66dFnZXVJLvbsoJk2 1303907807 From: Roberto Sassu To: linux-security-module@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, jmorris@namei.org, zohar@linux.vnet.ibm.com, safford@watson.ibm.com, tyhicks@linux.vnet.ibm.com, kirkland@canonical.com, ecryptfs-devel@lists.launchpad.net, casey@schaufler-ca.com, eparis@redhat.com, sds@tycho.nsa.gov, selinux@tycho.nsa.gov, viro@zeniv.linux.org.uk, Roberto Sassu Subject: [RFC][PATCH 5/7] smack: import the security label in smack_secctx_to_secid() Date: Wed, 27 Apr 2011 14:34:13 +0200 Message-Id: <1303907657-18366-6-git-send-email-roberto.sassu@polito.it> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1303907657-18366-1-git-send-email-roberto.sassu@polito.it> References: <1303907657-18366-1-git-send-email-roberto.sassu@polito.it> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha1"; boundary="----444DA078C8E5969A1974F7B53AE2189E" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4365 Lines: 95 This is an S/MIME signed message ------444DA078C8E5969A1974F7B53AE2189E The security label passed as argument in smack_secctx_to_secid() must be first imported in the 'smack_known_list' list before finding the security identifier associated to it. This allows the function set_security_override_from_ctx() to be performed successfully even if the label is not yet present in the smack list. Signed-off-by: Roberto Sassu --- security/smack/smack_lsm.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 0e7ed31..6612ba1 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -3346,7 +3346,13 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) */ static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) { - *secid = smack_to_secid(secdata); + char *smack; + + smack = smk_import(secdata, seclen); + if (smack == NULL) + return -EINVAL; + + *secid = smack_to_secid(smack); return 0; } -- 1.7.4.4 ------444DA078C8E5969A1974F7B53AE2189E Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" MIIICQYJKoZIhvcNAQcCoIIH+jCCB/YCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3 DQEHAaCCBWQwggVgMIIESKADAgECAgICuzANBgkqhkiG9w0BAQUFADBlMQswCQYD VQQGEwJJVDEeMBwGA1UEChMVUG9saXRlY25pY28gZGkgVG9yaW5vMTYwNAYDVQQD Ey1Qb2xpdGVjbmljbyBkaSBUb3Jpbm8gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw HhcNMTAxMjIwMTExOTU0WhcNMTUxMjMxMjM1OTU5WjBfMQswCQYDVQQGEwJJVDEe MBwGA1UEChMVUG9saXRlY25pY28gZGkgVG9yaW5vMRcwFQYDVQQDEw5Sb2JlcnRv ICBTYXNzdTEXMBUGCgmSJomT8ixkAQETB2QwMjEzMDUwggEiMA0GCSqGSIb3DQEB AQUAA4IBDwAwggEKAoIBAQDS6p4SaJdmmJHJu9On9ZohhBFE2GgYiY7YtRnhhQJA NfOtHEhSbpUMaSOfq/Pna6ipR5nAFrlM8cOGcSHZdxrPcgzeJU7F2v1fl2ThvFOc TIkcC1aAJGQUuCaCXDlQt+KFecJWTrRZnalMHZueO+J6cgHcvR1CQz5e88dSzo3Q XZy0w/hxGL9Ht9velqsl48ohBk2rs/sv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FTbf8eL/XvBbK/oPC+Rew+Qql6M3DHnaS1q2SKUwwO/4VXA4 JsOdatFI68AMXH0Xx9UIcjRi+kvsyvwHlc0Z8AoAtfRMoIl4zFF4Qaowec2UunBK YlqPpFTtU9czuoEP12A86nqSVsoNok2mZOeYa9IdIjeE2rfdKx6k3YNRg08xggJt MIICaQIBATBrMGUxCzAJBgNVBAYTAklUMR4wHAYDVQQKExVQb2xpdGVjbmljbyBk aSBUb3Jpbm8xNjA0BgNVBAMTLVBvbGl0ZWNuaWNvIGRpIFRvcmlubyBDZXJ0aWZp Y2F0aW9uIEF1dGhvcml0eQICArswCQYFKw4DAhoFAKCB2DAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMTA0MjcxMjM0NTdaMCMGCSqG SIb3DQEJBDEWBBTd5qlWHtqtbs8d+Df/MjvL6WaRbDB5BgkqhkiG9w0BCQ8xbDBq MAsGCWCGSAFlAwQBKjALBglghkgBZQMEARYwCwYJYIZIAWUDBAECMAoGCCqGSIb3 DQMHMA4GCCqGSIb3DQMCAgIAgDANBggqhkiG9w0DAgIBQDAHBgUrDgMCBzANBggq hkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASCAQCZNToarAQUCmN8R9EnMH0V/B0q 8vQEc/WP0CnoxvI9r7mmDxzeKbgb4FxudGgAPBXgxM0AoOVsbo3zIbp9l96gwUku XOmo5SzD49G2oofcdWkdPdLl/yDBop6Ki9kt//n0bRO4lbkKg+0kAJXr58PwTBnc mToOexjGMrKWiQgM7BIqeXsrtybKKKkl+JSsQwV+M/w/cYVj3D5rOmmLOV6TqCo2 9GqWvEdikh6N6JDmG7Jl1zHqhFE2fnYejlhxeAoix6z5G1Gi6yP5rO6e4ScmuInr PwwwROGH8s3xVpL9y8il+jfzLbucCiYRwczPwVGHFGeN8XlD+g9JMBrCra3Q ------444DA078C8E5969A1974F7B53AE2189E-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/