]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
NFC: fdp: fix incorrect free object
authorPan Bian <bianpan2016@163.com>
Tue, 5 Nov 2019 08:34:07 +0000 (16:34 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 4 Dec 2019 09:29:26 +0000 (10:29 +0100)
BugLink: https://bugs.launchpad.net/bugs/1852338
[ Upstream commit 517ce4e93368938b204451285e53014549804868 ]

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.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/nfc/fdp/i2c.c

index 1cd113c8d7cba702d623860aac986b4b6751b9f9..ad0abb1f0bae9b76135d9f41ed2763d36c95ebac 100644 (file)
@@ -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 {