Skip to content

ASoC: topology: Use the correct dobj to free enum control values and … - #786

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
ranj063:enum_fix
Apr 5, 2019
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
ranj063:enum_fix

Conversation

@ranj063

@ranj063 ranj063 commented Apr 4, 2019

Copy link
Copy Markdown
Collaborator

…texts

"dobj" is the widget dobj. dvalues and dtexts belong to the enum
kcontrol's dobj (se->dobj). So, use this to free the control values
and texts to prevent the NULL pointer dereference while removing
widgets.

Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com

@ranj063
ranj063 requested review from bardliao and plbossart April 4, 2019 21:02

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, the commit message isn't easy to follow and requires too much understanding of topology internals. Please try to reword it in a 'topology for dummies' style. There are fewer than 10 people in the universe that can understand that stuff.

@ranj063

ranj063 commented Apr 4, 2019

Copy link
Copy Markdown
Collaborator Author

Sorry, the commit message isn't easy to follow and requires too much understanding of topology internals. Please try to reword it in a 'topology for dummies' style. There are fewer than 10 people in the universe that can understand that stuff.

@plbossart how does it read now? I thought this would be an obvious error to fix but apparently not. Please let me know if it makes better sense to readers now

@plbossart

Copy link
Copy Markdown
Member

Thanks @ranj063, but still too many words and convoluted explanations. How about this:

The control values and texts of the enum kcontrol associated with a widget need to be freed when the widget is removed. However both struct snd_soc_dapm_widget and struct soc_enum contain
a dobj member, which resulted in a confusion: the existing code generates a null pointer dereference by attempting to free a dobj which belongs to the widget instead of freeing the dobj belonging to the enum kcontrol.

The suggested fix is to use the correct dobj member (se->dobj) of the enum kcontrol

…texts

The control values and texts of the enum kcontrol associated
with a widget need to be freed when the widget is removed.
However, both struct snd_soc_dapm_widget and struct soc_enum
contain a dobj member, which resulted in a confusion.
The existing code generates a null pointer dereference by
attempting to free the values and texts from the dobj which
belongs to the widget instead of the dobj belonging to the
enum kcontrol.

The suggested fix is to use the correct dobj member (se->dobj)
of the enum kcontrol.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems like a clear bug and the description is now easy to follow (with limited topology experience).

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks @ranj063, can you send this to alsa-devel as well?

@plbossart
plbossart merged commit 4e3c671 into thesofproject:topic/sof-dev Apr 5, 2019
@ranj063

ranj063 commented Apr 5, 2019

Copy link
Copy Markdown
Collaborator Author

thanks @ranj063, can you send this to alsa-devel as well?

@plbossart I already sent it out last night.

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.

3 participants