All of lore.kernel.org
 help / color / mirror / Atom feed
From: Basavaraj Natikar <bnatikar@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Basavaraj Natikar <basavaraj.natikar@amd.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>,
	Malte Starostik <malte@starostik.de>,
	stable@vger.kernel.org,
	Linux regression tracking <regressions@leemhuis.info>,
	Haochen Tong <linux@hexchain.org>
Subject: Re: [PATCH] HID: amd_sfh: Check that sensors are enabled before set/get report
Date: Tue, 4 Jul 2023 14:58:18 +0530	[thread overview]
Message-ID: <b691b60d-80c4-2bf8-4f62-c957bf8fc1ba@amd.com> (raw)
In-Reply-To: <20230620193946.22208-1-mario.limonciello@amd.com>


On 6/21/2023 1:09 AM, Mario Limonciello wrote:
> A crash was reported in amd-sfh related to hid core initialization
> before SFH initialization has run.
>
> ```
>    amdtp_hid_request+0x36/0x50 [amd_sfh
> 2e3095779aada9fdb1764f08ca578ccb14e41fe4]
>    sensor_hub_get_feature+0xad/0x170 [hid_sensor_hub
> d6157999c9d260a1bfa6f27d4a0dc2c3e2c5654e]
>    hid_sensor_parse_common_attributes+0x217/0x310 [hid_sensor_iio_common
> 07a7935272aa9c7a28193b574580b3e953a64ec4]
>    hid_gyro_3d_probe+0x7f/0x2e0 [hid_sensor_gyro_3d
> 9f2eb51294a1f0c0315b365f335617cbaef01eab]
>    platform_probe+0x44/0xa0
>    really_probe+0x19e/0x3e0
> ```
>
> Ensure that sensors have been set up before calling into
> amd_sfh_get_report() or amd_sfh_set_report().
>
> Cc: stable@vger.kernel.org
> Cc: Linux regression tracking (Thorsten Leemhuis) <regressions@leemhuis.info>
> Fixes: 7bcfdab3f0c6 ("HID: amd_sfh: if no sensors are enabled, clean up")
> Reported-by: Haochen Tong <linux@hexchain.org>
> Link: https://lore.kernel.org/all/3250319.ancTxkQ2z5@zen/T/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/hid/amd-sfh-hid/amd_sfh_client.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> index d9b7b01900b5..88f3d913eaa1 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> @@ -25,6 +25,9 @@ void amd_sfh_set_report(struct hid_device *hid, int report_id,
>  	struct amdtp_cl_data *cli_data = hid_data->cli_data;
>  	int i;
>  
> +	if (!cli_data->is_any_sensor_enabled)
> +		return;
> +

can we check below patch series which solves this issue by initializing HID only
if is_any_sensor_enabled
https://lore.kernel.org/all/nycvar.YFH.7.76.2305231559000.29760@cbobk.fhfr.pm/

>  	for (i = 0; i < cli_data->num_hid_devices; i++) {
>  		if (cli_data->hid_sensor_hubs[i] == hid) {
>  			cli_data->cur_hid_dev = i;
> @@ -41,6 +44,9 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type)
>  	struct request_list *req_list = &cli_data->req_list;
>  	int i;
>  
> +	if (!cli_data->is_any_sensor_enabled)
> +		return -ENODEV;
> +

can we check below patch series which solves this issue by initializing HID only
if is_any_sensor_enabled.
https://lore.kernel.org/all/nycvar.YFH.7.76.2305231559000.29760@cbobk.fhfr.pm/

Thanks,
--
Basavaraj

>  	for (i = 0; i < cli_data->num_hid_devices; i++) {
>  		if (cli_data->hid_sensor_hubs[i] == hid) {
>  			struct request_list *new = kzalloc(sizeof(*new), GFP_KERNEL);


  reply	other threads:[~2023-07-04  9:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 19:39 [PATCH] HID: amd_sfh: Check that sensors are enabled before set/get report Mario Limonciello
2023-07-04  9:28 ` Basavaraj Natikar [this message]
2023-07-05 16:07   ` Limonciello, Mario
2023-07-06 11:28     ` Thorsten Leemhuis
2023-07-06 15:23       ` Limonciello, Mario
2023-06-20 20:01 Mario Limonciello

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=b691b60d-80c4-2bf8-4f62-c957bf8fc1ba@amd.com \
    --to=bnatikar@amd.com \
    --cc=bagasdotme@gmail.com \
    --cc=basavaraj.natikar@amd.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=linux@hexchain.org \
    --cc=malte@starostik.de \
    --cc=mario.limonciello@amd.com \
    --cc=regressions@leemhuis.info \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.