]> git.itanic.dy.fi Git - linux-stable/commit
arm64: acpi: Fix possible memory leak of ffh_ctxt
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 23 Feb 2023 13:57:42 +0000 (13:57 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 24 Feb 2023 14:21:49 +0000 (14:21 +0000)
commit1b561d3949f8478c5403c9752b5533211a757226
tree849ce6f588deed10dba0b262413338353d2a1280
parent060a2c92d1b627c86c5c42ca69baf00457c00c5a
arm64: acpi: Fix possible memory leak of ffh_ctxt

Allocated 'ffh_ctxt' memory leak is possible if the SMCCC version
and conduit checks fail and -EOPNOTSUPP is returned without freeing the
allocated memory.

Fix the same by moving the allocation after the SMCCC version and
conduit checks.

Fixes: 1d280ce099db ("arm64: Add architecture specific ACPI FFH Opregion callbacks")
Cc: <stable@vger.kernel.org> # 6.2.x
Cc: Will Deacon <will@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Suggested-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202302191417.dAl9NuE8-lkp@intel.com/
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20230223135742.2952091-1-sudeep.holla@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/acpi.c