Skip to content

Commit

Permalink
fix the leak in integrity_read_file()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jan 4, 2016
1 parent 7812bf1 commit cc4e719
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions security/integrity/iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cc4e719

Please sign in to comment.