-
Notifications
You must be signed in to change notification settings - Fork 140
ASoC: SOF: Intel: hda: Fix NULL pointer dereference #5650
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
base: topic/sof-dev
Are you sure you want to change the base?
Conversation
If there's a mismatch between the DAI links in the machine driver and the topology, it is possible that the playback/capture widget is not set, especially in the case of loopback capture for echo reference where we use the dummy DAI link. Return the error when the widget is not set to avoid a null pointer dereference like below when the topology is broken. RIP: 0010:hda_dai_get_ops.isra.0+0x14/0xa0 [snd_sof_intel_hda_common] Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add a virtual CPU DAI for loopback capture for echo reference implementation. We can't use the snd-soc-dummy-dai because it is already used for the bluetooth DAI link. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Don't use the dummy CPU DAI but use the virtual loopback capture CPU DAI instead. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
c3c4b5f to
b1a743e
Compare
| * this is unlikely if the topology and the machine driver DAI links match. | ||
| * But if there's a missing DAI link in topology, this will prevent a NULL pointer | ||
| * dereference later on. | ||
| */ |
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.
is such a case viable? Shouldn't it be caught before this call, maybe even in the driver? But maybe this is indeed the first location where such a check is feasible, not sure really, just clarifying
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 if the topology is clean and it matches the machine driver exactly, this isnt possible but I encountered the problem with echo ref defined in the machine driver and topology but BT only in the machine driver. This will not happen in production topologies but even for development topologies an error is more graceful than a crash
majunkier
left a comment
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.
i have tested this PR, fixes problem. +1
If there's a mismatch between the DAI links in the machine driver and the topology, it is possible that the playback/capture widget is not set, especially in the case of iloopback capture for echo reference where we use the dummy DAI link. Return the error when the widget is not set to avoid a null pointer dereference like below when the topology is broken.
RIP: 0010:hda_dai_get_ops.isra.0+0x14/0xa0 [snd_sof_intel_hda_common]