Re: [PATCH] platform/x86: panasonic-laptop: fix NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Am 28.03.24 um 11:35 schrieb Maxim Korotkov:

When initializing the pcc by calling acpi_driver_data(), the "device"
pointer was dereferenced without checking for NULL. This seems like
a logical mistake.

Added a pointer check to ensure that it is valid
before using it for pcc initialization.


is this check even needed? I think the ACPI driver core takes care
of passing a valid ACPI device pointer to acpi_pcc_hotkey_remove().

Armin Wolf

Found by Security Code and Linux Verification Center(

Fixes: 709ee531c153 ("panasonic-laptop: add Panasonic Let's Note laptop extras driver v0.94")

Signed-off-by: Maxim Korotkov <korotkov.maxim.s@xxxxxxxxx>
  drivers/platform/x86/panasonic-laptop.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index cf845ee1c7b1..de29758b0384 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -1067,9 +1067,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)

  static void acpi_pcc_hotkey_remove(struct acpi_device *device)
-	struct pcc_acpi *pcc = acpi_driver_data(device);
+	struct pcc_acpi *pcc;

-	if (!device || !pcc)
+	if (!device)
+		return;
+	pcc = acpi_driver_data(device);
+	if (!pcc)


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux