From ede19ea0c47fb23f3fc779833d1e57cf76f3371e Mon Sep 17 00:00:00 2001 From: Yannick GICQUEL Date: Mon, 19 Oct 2015 15:57:07 +0200 Subject: kernel: smack security backport from kernel 4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is the backport of all patches relating to smack support on kernel side. For more details, see file: meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/README Please note that patches are applied only if "smack" is in the ditro features. Here are the 2 lines to add in the local.conf OVERRIDES .= ":smack" DISTRO_FEATURES_append = " smack" Change-Id: I147a3532aec531f977d6ec34c576261835711f1e Signed-off-by: Yannick GICQUEL Signed-off-by: José Bollo --- ...ogic-in-smack_inode_init_security-functio.patch | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0046-smack-fix-logic-in-smack_inode_init_security-functio.patch (limited to 'meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0046-smack-fix-logic-in-smack_inode_init_security-functio.patch') diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0046-smack-fix-logic-in-smack_inode_init_security-functio.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0046-smack-fix-logic-in-smack_inode_init_security-functio.patch new file mode 100644 index 0000000..ec5221d --- /dev/null +++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0046-smack-fix-logic-in-smack_inode_init_security-functio.patch @@ -0,0 +1,43 @@ +From b9fb9ef37ee4c2d9c30564afa8bfbb1bc3d58124 Mon Sep 17 00:00:00 2001 +From: Lukasz Pawelczyk +Date: Wed, 26 Nov 2014 15:31:07 +0100 +Subject: [PATCH 46/54] smack: fix logic in smack_inode_init_security function + +In principle if this function was called with "value" == NULL and "len" +not NULL it could return different results for the "len" compared to a +case where "name" was not NULL. This is a hypothetical case that does +not exist in the kernel, but it's a logic bug nonetheless. + +Signed-off-by: Lukasz Pawelczyk +--- + security/smack/smack_lsm.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c +index eacd7fc..2ec6cdb 100644 +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -800,7 +800,7 @@ static int smack_inode_init_security(struct inode *inode, struct inode *dir, + if (name) + *name = XATTR_SMACK_SUFFIX; + +- if (value) { ++ if (value && len) { + rcu_read_lock(); + may = smk_access_entry(skp->smk_known, dsp->smk_known, + &skp->smk_rules); +@@ -821,10 +821,9 @@ static int smack_inode_init_security(struct inode *inode, struct inode *dir, + *value = kstrdup(isp->smk_known, GFP_NOFS); + if (*value == NULL) + return -ENOMEM; +- } + +- if (len) + *len = strlen(isp->smk_known); ++ } + + return 0; + } +-- +2.1.4 + -- cgit 1.2.3-korg