OSDN Git Service

ima: fix memory leak in ima_release_policy
authorEric Richter <erichte@linux.vnet.ibm.com>
Thu, 13 Oct 2016 22:47:36 +0000 (17:47 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:30 +0000 (11:39 +0100)
commit825e6a0f7c51cc2c7e56604d2ea89c86aebef914
treef809e89aef1ad92042bdeb991fa9f26ff02a5f48
parentc4c11b4bdbf684540f9baf9f17fc1c7fb688f1fb
ima: fix memory leak in ima_release_policy

commit 9a11a18902bc3b904353063763d06480620245a6 upstream.

When the "policy" securityfs file is opened for read, it is opened as a
sequential file. However, when it is eventually released, there is no
cleanup for the sequential file, therefore some memory is leaked.

This patch adds a call to seq_release() in ima_release_policy() to clean up
the memory when the file is opened for read.

Fixes: 80eae209d63a IMA: allow reading back the current policy
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Eric Richter <erichte@linux.vnet.ibm.com>
Tested-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/integrity/ima/ima_fs.c