]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Mon, 8 Aug 2022 13:21:58 +0000 (21:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:30:48 +0000 (18:30 +0200)
commit39d5137085a6c37ace4680ee4d24020a4a03e7dc
treed1ea9888e104eb284670dcb3b96ecab0e8fa0718
parente37e3b6cc8dcc5a4f47a46eee39f3890abac16ea
thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR

commit 7931e28098a4c1a2a6802510b0cbe57546d2049d upstream.

In some case, the GDDV returns a package with a buffer which has
zero length. It causes that kmemdup() returns ZERO_SIZE_PTR (0x10).

Then the data_vault_read() got NULL point dereference problem when
accessing the 0x10 value in data_vault.

[   71.024560] BUG: kernel NULL pointer dereference, address:
0000000000000010

This patch uses ZERO_OR_NULL_PTR() for checking ZERO_SIZE_PTR or
NULL value in data_vault.

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Larry: backport to 5.15.y. Minor conflict resolved due to missing commit 9e5d3d6be664
  thermal: int340x: Consolidate freeing of acpi_buffer pointer ]
Signed-off-by: Larry Bassel <larry.bassel@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thermal/intel/int340x_thermal/int3400_thermal.c