From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: Nehal Shah <nehal-bakulchandra.shah@amd.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
"open list:AMD SENSOR FUSION HUB DRIVER"
<linux-input@vger.kernel.org>
Cc: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Subject: [PATCH 1/4] amd_sfh: Fix potential NULL pointer dereference
Date: Thu, 23 Sep 2021 17:59:27 +0530 [thread overview]
Message-ID: <20210923122930.3873914-2-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20210923122930.3873914-1-Basavaraj.Natikar@amd.com>
The cl_data field of a privdata must be allocated and updated before
using in amd_sfh_hid_client_init() function.
Hence handling NULL pointer cl_data accordingly.
Fixes: d46ef750ed58 ("HID: amd_sfh: Fix potential NULL pointer dereference")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 076b46251c91..f5e580f598cd 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -251,21 +251,17 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
return rc;
}
- rc = amd_sfh_hid_client_init(privdata);
- if (rc)
- return rc;
-
privdata->cl_data = devm_kzalloc(&pdev->dev, sizeof(struct amdtp_cl_data), GFP_KERNEL);
if (!privdata->cl_data)
return -ENOMEM;
- rc = devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
+ mp2_select_ops(privdata);
+
+ rc = amd_sfh_hid_client_init(privdata);
if (rc)
return rc;
- mp2_select_ops(privdata);
-
- return 0;
+ return devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
}
static int __maybe_unused amd_mp2_pci_resume(struct device *dev)
--
2.25.1
next prev parent reply other threads:[~2021-09-23 12:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-23 12:29 [PATCH 0/4] Fixes and updates to amd-sfh driver Basavaraj Natikar
2021-09-23 12:29 ` Basavaraj Natikar [this message]
2021-09-23 12:29 ` [PATCH 2/4] amd_sfh: Use dma_set_mask_and_coherent() Basavaraj Natikar
2021-09-23 12:29 ` [PATCH 3/4] amd_sfh: switch from 'pci_' to 'dev_' API Basavaraj Natikar
2021-09-23 12:29 ` [PATCH 4/4] amd_sfh: Update Copyright details Basavaraj Natikar
2021-09-27 7:46 ` [PATCH 0/4] Fixes and updates to amd-sfh driver Jiri Kosina
2021-09-27 7:56 ` Basavaraj Natikar
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=20210923122930.3873914-2-Basavaraj.Natikar@amd.com \
--to=basavaraj.natikar@amd.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=nehal-bakulchandra.shah@amd.com \
/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 NNTP newsgroup(s).