summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2019-04-19 07:39:00 +0000
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-04-24 16:33:37 +0000
commitbce1a78423961fce676ac65540a31b6ffd179e6d (patch)
tree8201f766f8de098ddcc1aa48c338b7e9a4cffae9
parentf06eba72274788db6a43012a05a99915c0283aef (diff)
downloadlinux-bce1a78423961fce676ac65540a31b6ffd179e6d.tar.gz
linux-bce1a78423961fce676ac65540a31b6ffd179e6d.tar.bz2
linux-bce1a78423961fce676ac65540a31b6ffd179e6d.zip
Input: synaptics-rmi4 - fix possible double free
The RMI4 function structure has been released in rmi_register_function if error occurs. However, it will be released again in the function rmi_create_function, which may result in a double-free bug. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/rmi4/rmi_driver.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index fc3ab93b7aea..7fb358f96195 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -860,7 +860,7 @@ static int rmi_create_function(struct rmi_device *rmi_dev,
error = rmi_register_function(fn);
if (error)
- goto err_put_fn;
+ return error;
if (pdt->function_number == 0x01)
data->f01_container = fn;
@@ -870,10 +870,6 @@ static int rmi_create_function(struct rmi_device *rmi_dev,
list_add_tail(&fn->node, &data->function_list);
return RMI_SCAN_CONTINUE;
-
-err_put_fn:
- put_device(&fn->dev);
- return error;
}
void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)