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: soc-pcm: harden dpcm_be_connect #3735

Closed

Conversation

plbossart
Copy link
Member

A kernel oops can happen in dpcm_be_connect() when changing the
substream atomicity. Add a check and report an error log when the FE
or BE substream is not initialized.

Reported-by: Alex Natalsson harmoniesworlds@gmail.com
Link: https://lore.kernel.org/alsa-devel/15259e38-eccf-d294-a330-a48b5bbbdedf@linux.intel.com/
Fixes: bbf7d3b ("ASoC: soc-pcm: align BE 'atomicity' with that of the FE")
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com

A kernel oops can happen in dpcm_be_connect() when changing the
substream atomicity. Add a check and report an error log when the FE
or BE substream is not initialized.

Reported-by: Alex Natalsson <harmoniesworlds@gmail.com>
Link: https://lore.kernel.org/alsa-devel/15259e38-eccf-d294-a330-a48b5bbbdedf@linux.intel.com/
Fixes: bbf7d3b ("ASoC: soc-pcm: align BE 'atomicity' with that of the FE")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
if (!be_substream) {
dev_err(be->dev, "%s: be_substream not initialized for direction %d\n", __func__, stream);
return -EINVAL;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@plbossart, before bbf7d3b neither fe or be stream was checked, no error was generated if any of them was initialized at a later time.
Should we only protect the atomicity check and fixup with if (fe_substream && be_substream) { } ?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the BE substream can be initialized later, then the atomicity check is done in the wrong location. It would happen that we have a later initialization of an atomic BE and that would throw all kinds of errors.

@plbossart plbossart marked this pull request as draft July 5, 2022 17:03
@plbossart plbossart closed this Jul 13, 2022
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.

2 participants