]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer
authorColin Ian King <colin.king@canonical.com>
Sat, 30 Mar 2019 00:17:12 +0000 (00:17 +0000)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commit1365667cee72e1561f1b328a4792735867c33524
treea284c0582e4e706e818d067712b981eb0f9d582e
parent6e0a9eebd33f12687f1a3f409f9cded6119033e2
platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 98e2630284ab741804bd0713e932e725466f2f84 ]

Currently the kfree of output.pointer can be potentially freeing
an uninitalized pointer in the case where out_data is NULL. Fix this
by reworking the case where out_data is not-null to perform the
ACPI status check and also the kfree of outpoint.pointer in one block
and hence ensuring the pointer is only freed when it has been used.

Also replace the if (ptr != NULL) idiom with just if (ptr).

Fixes: ff0e9f26288d ("platform/x86: alienware-wmi: Correct a memory leak")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/platform/x86/alienware-wmi.c