Skip to content
Snippets Groups Projects
Commit 98ad224d authored by Mark Langsdorf's avatar Mark Langsdorf Committed by Yongqiang Liu
Browse files

ACPI: custom_method: fix a possible memory leak

mainline inclusion
from mainline-v5.13-rc1
commit 1cfd8956437f842836e8a066b40d1ec2fc01f13e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5LBE7


CVE: NA

--------------------------------

In cm_write(), if the 'buf' is allocated memory but not fully consumed,
it is possible to reallocate the buffer without freeing it by passing
'*ppos' as 0 on a subsequent call.

Add an explicit kfree() before kzalloc() to prevent the possible memory
leak.

Fixes: 526b4af4 ("ACPI: Split out custom_method functionality into an own driver")
Signed-off-by: default avatarMark Langsdorf <mlangsdo@redhat.com>
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 0c62d310
No related branches found
No related tags found
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment