* [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
@ 2018-05-27 22:15 ` Colin King
0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2018-05-27 22:15 UTC (permalink / raw)
To: Matthew Garrett, Mimi Zohar, James Morris, Serge E . Hallyn,
linux-integrity, linux-security-module
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The allocation of 'temp' is not kfree'd and hence there is a memory
leak on each call of evm_read_xattrs. Fix this by kfree'ing it
after copying data from it back to the user space buffer 'buf'.
Detected by CoverityScan, CID#1469386 ("Resource Leak")
Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
security/integrity/evm/evm_secfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index a7a0a1acae99..fb8bc950aceb 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
mutex_unlock(&xattr_list_mutex);
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
+ kfree(temp);
+
return rc;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
@ 2018-05-27 22:15 ` Colin King
0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2018-05-27 22:15 UTC (permalink / raw)
To: Matthew Garrett, Mimi Zohar, James Morris, Serge E . Hallyn,
linux-integrity, linux-security-module
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The allocation of 'temp' is not kfree'd and hence there is a memory
leak on each call of evm_read_xattrs. Fix this by kfree'ing it
after copying data from it back to the user space buffer 'buf'.
Detected by CoverityScan, CID#1469386 ("Resource Leak")
Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
security/integrity/evm/evm_secfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index a7a0a1acae99..fb8bc950aceb 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
mutex_unlock(&xattr_list_mutex);
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
+ kfree(temp);
+
return rc;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
@ 2018-05-27 22:15 ` Colin King
0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2018-05-27 22:15 UTC (permalink / raw)
To: linux-security-module
From: Colin Ian King <colin.king@canonical.com>
The allocation of 'temp' is not kfree'd and hence there is a memory
leak on each call of evm_read_xattrs. Fix this by kfree'ing it
after copying data from it back to the user space buffer 'buf'.
Detected by CoverityScan, CID#1469386 ("Resource Leak")
Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
security/integrity/evm/evm_secfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index a7a0a1acae99..fb8bc950aceb 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
mutex_unlock(&xattr_list_mutex);
rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
+ kfree(temp);
+
return rc;
}
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
2018-05-27 22:15 ` Colin King
(?)
@ 2018-05-31 15:00 ` Mimi Zohar
-1 siblings, 0 replies; 6+ messages in thread
From: Mimi Zohar @ 2018-05-31 15:00 UTC (permalink / raw)
To: Colin King, Matthew Garrett, James Morris, Serge E . Hallyn,
linux-integrity, linux-security-module
Cc: kernel-janitors, linux-kernel
On Sun, 2018-05-27 at 23:15 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The allocation of 'temp' is not kfree'd and hence there is a memory
> leak on each call of evm_read_xattrs. Fix this by kfree'ing it
> after copying data from it back to the user space buffer 'buf'.
>
> Detected by CoverityScan, CID#1469386 ("Resource Leak")
>
> Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks, this patch and "EVM: Fix null dereference on xattr when xattr
fails to allocate" are queued in the next-integrity branch.
Mimi
> ---
> security/integrity/evm/evm_secfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
> index a7a0a1acae99..fb8bc950aceb 100644
> --- a/security/integrity/evm/evm_secfs.c
> +++ b/security/integrity/evm/evm_secfs.c
> @@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
> mutex_unlock(&xattr_list_mutex);
> rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
>
> + kfree(temp);
> +
> return rc;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
@ 2018-05-31 15:00 ` Mimi Zohar
0 siblings, 0 replies; 6+ messages in thread
From: Mimi Zohar @ 2018-05-31 15:00 UTC (permalink / raw)
To: Colin King, Matthew Garrett, James Morris, Serge E . Hallyn,
linux-integrity, linux-security-module
Cc: kernel-janitors, linux-kernel
On Sun, 2018-05-27 at 23:15 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The allocation of 'temp' is not kfree'd and hence there is a memory
> leak on each call of evm_read_xattrs. Fix this by kfree'ing it
> after copying data from it back to the user space buffer 'buf'.
>
> Detected by CoverityScan, CID#1469386 ("Resource Leak")
>
> Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks, this patch and "EVM: Fix null dereference on xattr when xattr
fails to allocate" are queued in the next-integrity branch.
Mimi
> ---
> security/integrity/evm/evm_secfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
> index a7a0a1acae99..fb8bc950aceb 100644
> --- a/security/integrity/evm/evm_secfs.c
> +++ b/security/integrity/evm/evm_secfs.c
> @@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
> mutex_unlock(&xattr_list_mutex);
> rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
>
> + kfree(temp);
> +
> return rc;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH][next] EVM: fix memory leak of temporary buffer 'temp'
@ 2018-05-31 15:00 ` Mimi Zohar
0 siblings, 0 replies; 6+ messages in thread
From: Mimi Zohar @ 2018-05-31 15:00 UTC (permalink / raw)
To: linux-security-module
On Sun, 2018-05-27 at 23:15 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The allocation of 'temp' is not kfree'd and hence there is a memory
> leak on each call of evm_read_xattrs. Fix this by kfree'ing it
> after copying data from it back to the user space buffer 'buf'.
>
> Detected by CoverityScan, CID#1469386 ("Resource Leak")
>
> Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Thanks, this patch and "EVM: Fix null dereference on xattr when xattr
fails to allocate" are queued in the next-integrity branch.
Mimi
> ---
> security/integrity/evm/evm_secfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
> index a7a0a1acae99..fb8bc950aceb 100644
> --- a/security/integrity/evm/evm_secfs.c
> +++ b/security/integrity/evm/evm_secfs.c
> @@ -158,6 +158,8 @@ static ssize_t evm_read_xattrs(struct file *filp, char __user *buf,
> mutex_unlock(&xattr_list_mutex);
> rc = simple_read_from_buffer(buf, count, ppos, temp, strlen(temp));
>
> + kfree(temp);
> +
> return rc;
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-31 15:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-27 22:15 [PATCH][next] EVM: fix memory leak of temporary buffer 'temp' Colin King
2018-05-27 22:15 ` Colin King
2018-05-27 22:15 ` Colin King
2018-05-31 15:00 ` Mimi Zohar
2018-05-31 15:00 ` Mimi Zohar
2018-05-31 15:00 ` Mimi Zohar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.