From nobody Sun Dec 14 06:20:08 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1FFFC00140 for ; Mon, 15 Aug 2022 19:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245563AbiHOTXd (ORCPT ); Mon, 15 Aug 2022 15:23:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344350AbiHOTVB (ORCPT ); Mon, 15 Aug 2022 15:21:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E6857241; Mon, 15 Aug 2022 11:40:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6ACCE6117E; Mon, 15 Aug 2022 18:40:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44A35C433D6; Mon, 15 Aug 2022 18:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588807; bh=MqgJVKreUtjvSuyszG3RqV1no/q+gQLMEaab0NnhavA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONp/c1Tc83ovhMCKEJTx6bn3nwdcBNXh+HTK6SgFdMsO07SDpDVY480kkGVjLwPcv 1oesb29wG7NtSiZBgHLnkKQ0spSiR/0ZMp6AQhTx8zCYbyzgZT2V7uyGsRMwMLTKid TQZpCq6MfTB4xZZAyDnfswPQeCawudAzXezpwars= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 519/779] HID: amd_sfh: Add NULL check for hid device Date: Mon, 15 Aug 2022 20:02:43 +0200 Message-Id: <20220815180359.436246090@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar [ Upstream commit 06aa2a43c307cf4096f422dcb575e5d2913e528f ] On removal of hid device during SFH set report may cause NULL pointer exception. Hence add NULL check for hid device before accessing. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fus= ion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hi= d/amd_sfh_hid.c index a4bda2ac713e..3b0615c6aecf 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c @@ -98,11 +98,15 @@ static int amdtp_wait_for_response(struct hid_device *h= id) =20 void amdtp_hid_wakeup(struct hid_device *hid) { - struct amdtp_hid_data *hid_data =3D hid->driver_data; - struct amdtp_cl_data *cli_data =3D hid_data->cli_data; + struct amdtp_hid_data *hid_data; + struct amdtp_cl_data *cli_data; =20 - cli_data->request_done[cli_data->cur_hid_dev] =3D true; - wake_up_interruptible(&hid_data->hid_wait); + if (hid) { + hid_data =3D hid->driver_data; + cli_data =3D hid_data->cli_data; + cli_data->request_done[cli_data->cur_hid_dev] =3D true; + wake_up_interruptible(&hid_data->hid_wait); + } } =20 static struct hid_ll_driver amdtp_hid_ll_driver =3D { --=20 2.35.1