Message ID | 1594986348-52258-1-git-send-email-guohanjun@huawei.com (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Jarkko Sakkinen |
Headers | show |
Series | [1/3] tpm: Put the TCPA table buf after using it | expand |
On Fri, Jul 17, 2020 at 07:45:46PM +0800, Hanjun Guo wrote: > The acpi_get_table() should be coupled with acpi_put_table() if > the mapped table is not used for runtime to release the table > mapping, put the TCPA table buf after using it. > > Signed-off-by: Hanjun Guo <guohanjun@huawei.com> In a commit message you should first describe the action taken and then the rationale of doing that e.g. "Couple acpi_get_table() with acpi_put_table() in order to prevent a memory leak." In addition, please put a fixes tag. Please read the section two from the submitting patches guide: https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html Thank you. /Jarkko
On 2020/7/23 11:21, Jarkko Sakkinen wrote: > On Fri, Jul 17, 2020 at 07:45:46PM +0800, Hanjun Guo wrote: >> The acpi_get_table() should be coupled with acpi_put_table() if >> the mapped table is not used for runtime to release the table >> mapping, put the TCPA table buf after using it. >> >> Signed-off-by: Hanjun Guo <guohanjun@huawei.com> > > In a commit message you should first describe the action taken and > then the rationale of doing that e.g. "Couple acpi_get_table() with > acpi_put_table() in order to prevent a memory leak." > > In addition, please put a fixes tag. > > Please read the section two from the submitting patches guide: > > https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html Thanks for the comments, I will update this patch set and send a new version. Thanks Hanjun
diff --git a/drivers/char/tpm/eventlog/acpi.c b/drivers/char/tpm/eventlog/acpi.c index 63ada5e..e8ac30b 100644 --- a/drivers/char/tpm/eventlog/acpi.c +++ b/drivers/char/tpm/eventlog/acpi.c @@ -79,6 +79,9 @@ int tpm_read_log_acpi(struct tpm_chip *chip) start = buff->client.log_start_addr; break; } + + acpi_put_table((struct acpi_table_header *)buff); + if (!len) { dev_warn(&chip->dev, "%s: TCPA log area empty\n", __func__); return -EIO;
The acpi_get_table() should be coupled with acpi_put_table() if the mapped table is not used for runtime to release the table mapping, put the TCPA table buf after using it. Signed-off-by: Hanjun Guo <guohanjun@huawei.com> --- drivers/char/tpm/eventlog/acpi.c | 3 +++ 1 file changed, 3 insertions(+)