From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kunwu Chan <chentao@kylinos.cn>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Sasha Levin <sashal@kernel.org>,
minipli@grsecurity.net, linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 02/52] Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails
Date: Fri, 29 Mar 2024 08:44:56 -0400 [thread overview]
Message-ID: <20240329124605.3091273-2-sashal@kernel.org> (raw)
In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org>
From: Kunwu Chan <chentao@kylinos.cn>
[ Upstream commit bc4996184d56cfaf56d3811ac2680c8a0e2af56e ]
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>
---
drivers/input/rmi4/rmi_driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 258d5fe3d395c..aa32371f04af6 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -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);
--
2.43.0
next parent reply other threads:[~2024-03-29 12:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240329124605.3091273-1-sashal@kernel.org>
2024-03-29 12:44 ` Sasha Levin [this message]
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 36/52] input/touchscreen: imagis: Correct the maximum touch area value Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 37/52] input/touchscreen: imagis: Add support for Imagis IST3038B Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 38/52] input/touchscreen: imagis: add support for IST3032C Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 45/52] Input: make input_class constant Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 46/52] Input: imagis - use FIELD_GET where applicable Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 47/52] Input: imagis - add touch key support Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 48/52] Input: allocate keycode for Display refresh rate toggle Sasha Levin
2024-03-29 12:45 ` [PATCH AUTOSEL 6.1 49/52] platform/x86: touchscreen_dmi: Add an extra entry for a variant of the Chuwi Vi8 tablet Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240329124605.3091273-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=chentao@kylinos.cn \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@grsecurity.net \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).