Skip to contentSkip to conversation

NFC: fdp: fix incorrect free object

PATCH In review Pan Bian 2 participants 2 messages Nov 5, 2019 – Nov 6, 2019

Subsystems (3)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 NFC: fdp: fix incorrect free object

The address of fw_vsc_cfg is on stack. Releasing it with devm_kfree() is incorrect, which may result in a system crash or other security impacts. The expected object to free is *fw_vsc_cfg.

---
 drivers/nfc/fdp/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/fdp/i2c.c +1 -1
index 1cd113c8d7cb..ad0abb1f0bae 100644
@@ -259,7 +259,7 @@ static void fdp_nci_i2c_read_device_properties(struct device *dev,
 						  *fw_vsc_cfg, len);
 
 		if (r) {
-			devm_kfree(dev, fw_vsc_cfg);
+			devm_kfree(dev, *fw_vsc_cfg);
 			goto vsc_read_err;
 		}
 	} else {
Signature · 1 line
2.7.4
maintainer
#1 lore raw

From: Pan Bian <[email protected]>
Date: Tue, 5 Nov 2019 16:34:07 +0800

Quoted 5 lines

The address of fw_vsc_cfg is on stack. Releasing it with devm_kfree() is incorrect, which may result in a system crash or other security impacts. The expected object to free is *fw_vsc_cfg.

Applied and queued up for -stable, thanks.