Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASoC: sdca: test adev before calling acpi_dev_for_each_child #5238

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

bardliao
Copy link
Collaborator

sdca_lookup_functions may be called by a Peripheral that is not listed in the ACPI table. Testing adev is required to avoid kernel NULL pointer dereference.

Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bardliao, nice catch!

@@ -165,6 +165,10 @@ void sdca_lookup_functions(struct sdw_slave *slave)
struct device *dev = &slave->dev;
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);

if (!adev) {
dev_dbg(dev, "Not an ACPI device\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this to info level to be visible and rephrase the print to something like 'No matching ACPI device found, ignoring peripheral`

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do you need/want Fixes tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do you need/want Fixes tag?

Yes, done.

sdca_lookup_functions may be called by a Peripheral that is not listed
in the ACPI table. Testing adev is required to avoid kernel NULL pointer
dereference.

Fixes: 3a513da ("ASoC: SDCA: add initial module")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@ranj063 ranj063 merged commit 9f81212 into thesofproject:topic/sof-dev Nov 12, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants