diff mbox series

[1/3] tpm: Put the TCPA table buf after using it

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

Commit Message

Hanjun Guo July 17, 2020, 11:45 a.m. UTC
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(+)

Comments

Jarkko Sakkinen July 23, 2020, 3:21 a.m. UTC | #1
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
Hanjun Guo July 23, 2020, 3:43 a.m. UTC | #2
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 mbox series

Patch

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;