Skip to content

Commit

Permalink
Input: synaptics-rmi4 - fix possible double free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pan Bian authored and Dmitry Torokhov committed Apr 24, 2019
1 parent f06eba7 commit bce1a78
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/input/rmi4/rmi_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit bce1a78

Please sign in to comment.