Skip to content

Commit

Permalink
Input: synaptics-rmi4 - fail probing if memory allocation for "phys" …
Browse files Browse the repository at this point in the history
…fails

[ Upstream commit bc49961 ]

While input core can work with input->phys set to NULL userspace might
depend on it, so better fail probing if allocation fails. The system must
be in a pretty bad shape for it to happen anyway.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240117073124.143636-1-chentao@kylinos.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
KunWuChan authored and gregkh committed Apr 13, 2024
1 parent d6b2fe2 commit eafaec4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/input/rmi4/rmi_driver.c
Expand Up @@ -1196,7 +1196,11 @@ static int rmi_driver_probe(struct device *dev)
}
rmi_driver_set_input_params(rmi_dev, data->input);
data->input->phys = devm_kasprintf(dev, GFP_KERNEL,
"%s/input0", dev_name(dev));
"%s/input0", dev_name(dev));
if (!data->input->phys) {
retval = -ENOMEM;
goto err;
}
}

retval = rmi_init_functions(data);
Expand Down

0 comments on commit eafaec4

Please sign in to comment.