-
Notifications
You must be signed in to change notification settings - Fork 349
ipc3: get_drv: Check comp_type also when driver is matched with UUID #7891
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,6 +121,11 @@ static const struct comp_driver *get_drv(struct sof_ipc_comp *comp) | |
| goto out; | ||
| } | ||
|
|
||
| if (comp->type > SOF_COMP_MODULE_ADAPTER) { | ||
| tr_err(&comp_tr, "Bad component type: %d\n", comp->type); | ||
| goto out; | ||
|
||
| } | ||
|
|
||
| /* search driver list with UUID */ | ||
| key = k_spin_lock(&drivers->lock); | ||
|
|
||
|
|
@@ -134,16 +139,23 @@ static const struct comp_driver *get_drv(struct sof_ipc_comp *comp) | |
| } | ||
| } | ||
|
|
||
| if (!drv) | ||
| k_spin_unlock(&drivers->lock, key); | ||
|
|
||
| if (!drv) { | ||
| tr_err(&comp_tr, | ||
| "get_drv(): the provided UUID (%8x%8x%8x%8x) doesn't match to any driver!", | ||
| *(uint32_t *)(&comp_ext->uuid[0]), | ||
| *(uint32_t *)(&comp_ext->uuid[4]), | ||
| *(uint32_t *)(&comp_ext->uuid[8]), | ||
| *(uint32_t *)(&comp_ext->uuid[12])); | ||
| goto out; | ||
| } | ||
|
|
||
| k_spin_unlock(&drivers->lock, key); | ||
|
|
||
| if (drv->type != comp->type && drv->type != SOF_COMP_MODULE_ADAPTER) { | ||
|
||
| tr_err(&comp_tr, "get_drv(): Found %pU driver and IPC type differ %d != %d", | ||
| drv->tctx->uuid_p, drv->type, comp->type); | ||
| drv = NULL; | ||
| } | ||
| out: | ||
| if (drv) | ||
| tr_dbg(&comp_tr, "get_drv(), found driver type %d, uuid %pU", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a rather significant change, and I think it will break at least this check:
sof/src/audio/module_adapter/module_adapter.c
Line 135 in 7027228
comp_specific_builder()would only affect IPC3. @ranj063 do you think this is a good idea?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh , but how would I know in comp_specific_builder() what kind of messages the module - found with uuid - actually accepts, unless its somehow built in to the module? I can of course add an extra member to struct comp_driver, but I do not think this issue can not be solved without adding the accepted component message type to each module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, don't think it's possible to check the type generically in common code for all components with the current module-adapter API. That's why I'm not proposing that. Instead I'm just proposing to (1) check that the type value in IPC is meaningful - one of the values, that the firmware recognises, and error out otherwise, instead of silently ignoring it, and (2) in each individual component driver check that the type from the IPC is correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, simple enough.