lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220314030337.777685-1-keitasuzuki.park@sslab.ics.keio.ac.jp>
Date:   Mon, 14 Mar 2022 03:03:36 +0000
From:   Keita Suzuki <keitasuzuki.park@...ab.ics.keio.ac.jp>
To:     unlisted-recipients:; (no To-header on input)
Cc:     keitasuzuki.park@...ab.ics.keio.ac.jp,
        heikki.krogerus@...ux.intel.com, wsa+renesas@...g-engineering.com,
        pmalani@...omium.org, Benson Leung <bleung@...omium.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] platform/chrome: chromeos_laptop - Fix potential double free

In chromeos_laptop_prepare(), cros_laptop->i2c_peripherals is allocated
inside chromeos_prepare_i2c_peripherals(), and is also freed when
encountering an error. The caller later calls chromeos_laptop_destroy()
to perform cleanup, which tries to free the same value again. As the
value is not NULLed, this will cause a double free error.

Fix this by setting cros_laptop->i2c_peripherals to NULL in the error
handler inside chromeos_prepare_i2c_peripherals() after conducting the
free.

Signed-off-by: Keita Suzuki <keitasuzuki.park@...ab.ics.keio.ac.jp>
---
 drivers/platform/chrome/chromeos_laptop.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
index 4e14b4d6635d..3d10257b1107 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -785,6 +785,7 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
 			fwnode_remove_software_node(info->fwnode);
 	}
 	kfree(cros_laptop->i2c_peripherals);
+	cros_laptop->i2c_peripherals = NULL;
 	return error;
 }
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ