This fixes another regression in the IMA code.

Please pull.

The following changes since commit dc1ccc48159d63eca5089e507c82c7d22ef60839:

  Linux 3.13-rc2 (2013-11-29 12:57:14 -0800)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git 
for-linus

Roberto Sassu (1):
      ima: store address of template_fmt_copy in a pointer before calling strsep

 security/integrity/ima/ima_template.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
commit af91706d5ddecb4a9858cca9e90d463037cfd498
Author: Roberto Sassu <roberto.sa...@polito.it>
Date:   Wed Nov 27 14:40:41 2013 +0100

    ima: store address of template_fmt_copy in a pointer before calling strsep
    
    This patch stores the address of the 'template_fmt_copy' variable in a new
    variable, called 'template_fmt_ptr', so that the latter is passed as an
    argument of strsep() instead of the former. This modification is needed
    in order to correctly free the memory area referenced by
    'template_fmt_copy' (strsep() modifies the pointer of the passed string).
    
    Signed-off-by: Roberto Sassu <roberto.sa...@polito.it>
    Reported-by: Sebastian Ott <seb...@linux.vnet.ibm.com>
    Signed-off-by: Mimi Zohar <zo...@us.ibm.com>
    Signed-off-by: James Morris <james.l.mor...@oracle.com>

---

diff --git a/security/integrity/ima/ima_template.c 
b/security/integrity/ima/ima_template.c
index 913e192..635695f 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -110,7 +110,7 @@ static int template_desc_init_fields(const char 
*template_fmt,
                                     struct ima_template_field ***fields,
                                     int *num_fields)
 {
-       char *c, *template_fmt_copy;
+       char *c, *template_fmt_copy, *template_fmt_ptr;
        int template_num_fields = template_fmt_size(template_fmt);
        int i, result = 0;
 
@@ -127,7 +127,9 @@ static int template_desc_init_fields(const char 
*template_fmt,
                result = -ENOMEM;
                goto out;
        }
-       for (i = 0; (c = strsep(&template_fmt_copy, "|")) != NULL &&
+
+       template_fmt_ptr = template_fmt_copy;
+       for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL &&
             i < template_num_fields; i++) {
                struct ima_template_field *f = lookup_template_field(c);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to