diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-25 17:59:12 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-04 10:28:19 -0500 |
commit | cc4e719e83cd4149bc96b7e1d1a73fe61797df6e (patch) | |
tree | 6effdfd0106e269f2300b7b0bef8adcdd1ac7be0 | |
parent | 7812bf173a0a65a1227fe207ba8683c0afecb5e8 (diff) | |
download | op-kernel-dev-cc4e719e83cd4149bc96b7e1d1a73fe61797df6e.zip op-kernel-dev-cc4e719e83cd4149bc96b7e1d1a73fe61797df6e.tar.gz |
fix the leak in integrity_read_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | security/integrity/iint.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/security/integrity/iint.c b/security/integrity/iint.c index 3d2f5b4..c2e3ccd 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c @@ -234,12 +234,13 @@ int __init integrity_read_file(const char *path, char **data) } rc = integrity_kernel_read(file, 0, buf, size); - if (rc < 0) - kfree(buf); - else if (rc != size) - rc = -EIO; - else + if (rc == size) { *data = buf; + } else { + kfree(buf); + if (rc >= 0) + rc = -EIO; + } out: fput(file); return rc; |