Re: [RFC][PATCH 3/4]integrity: Linux Integrity Module(LIM)

From: James Morris
Date: Wed May 21 2008 - 22:14:35 EST


On Wed, 21 May 2008, Mimi Zohar wrote:

> +int register_template(char *template_name,
> + struct template_operations *template_ops)
> +{
> + int template_len;
> + struct template_list_entry *entry;
> +
> + if (!template_initialized++)
> + INIT_LIST_HEAD(&integrity_templates);
> +
> + entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
> + INIT_LIST_HEAD(&entry->template);
> +
> + template_len = strlen(template_name);
> + if (template_len > TEMPLATE_NAME_LEN_MAX)
> + template_len = TEMPLATE_NAME_LEN_MAX;
> + memcpy(entry->template_name, template_name, template_len);
> + entry->template_name[template_len] = '\0';
> + entry->template_ops = template_ops;
> + list_add(&entry->template, &integrity_templates);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(register_template);

There's no locking around the mainpulation of integrity_templates list.
It seems that this could lead to list corruption.



- James
--
James Morris
<jmorris@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/