All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: "Daniel Baluta" <daniel.baluta@nxp.com>,
	alsa-devel@alsa-project.org,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	kernel-janitors@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH 1/2] ASoC: SOF: Prevent NULL dereference in sof_pcm_dai_link_fixup()
Date: Fri, 18 Mar 2022 09:42:51 -0500	[thread overview]
Message-ID: <cf4c4a84-335d-8799-7a5b-afe298881342@linux.intel.com> (raw)
In-Reply-To: <20220318071233.GB29472@kili>



On 3/18/22 02:12, Dan Carpenter wrote:
> The "dia" pointer can be NULL, so handle that condition first before
> storing "dia->private".
> 
> Fixes: 839e484f9e17 ("ASoC: SOF: make struct snd_sof_dai IPC agnostic")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the patch.

This part will be removed in follow-up patches, likely the reason why 
this problem was missed.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/sof/pcm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
> index 1661b0bc6f12..71f5bce0c4c7 100644
> --- a/sound/soc/sof/pcm.c
> +++ b/sound/soc/sof/pcm.c
> @@ -702,7 +702,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa
>   	struct snd_sof_dai *dai =
>   		snd_sof_find_dai(component, (char *)rtd->dai_link->name);
>   	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
> -	struct sof_dai_private_data *private = dai->private;
> +	struct sof_dai_private_data *private;
>   	struct snd_soc_dpcm *dpcm;
>   
>   	/* no topology exists for this BE, try a common configuration */
> @@ -727,6 +727,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa
>   	/* read format from topology */
>   	snd_mask_none(fmt);
>   
> +	private = dai->private;
>   	switch (private->comp_dai->config.frame_fmt) {
>   	case SOF_IPC_FRAME_S16_LE:
>   		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: alsa-devel@alsa-project.org,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	kernel-janitors@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Daniel Baluta" <daniel.baluta@nxp.com>,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH 1/2] ASoC: SOF: Prevent NULL dereference in sof_pcm_dai_link_fixup()
Date: Fri, 18 Mar 2022 09:42:51 -0500	[thread overview]
Message-ID: <cf4c4a84-335d-8799-7a5b-afe298881342@linux.intel.com> (raw)
In-Reply-To: <20220318071233.GB29472@kili>



On 3/18/22 02:12, Dan Carpenter wrote:
> The "dia" pointer can be NULL, so handle that condition first before
> storing "dia->private".
> 
> Fixes: 839e484f9e17 ("ASoC: SOF: make struct snd_sof_dai IPC agnostic")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the patch.

This part will be removed in follow-up patches, likely the reason why 
this problem was missed.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/sof/pcm.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
> index 1661b0bc6f12..71f5bce0c4c7 100644
> --- a/sound/soc/sof/pcm.c
> +++ b/sound/soc/sof/pcm.c
> @@ -702,7 +702,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa
>   	struct snd_sof_dai *dai =
>   		snd_sof_find_dai(component, (char *)rtd->dai_link->name);
>   	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
> -	struct sof_dai_private_data *private = dai->private;
> +	struct sof_dai_private_data *private;
>   	struct snd_soc_dpcm *dpcm;
>   
>   	/* no topology exists for this BE, try a common configuration */
> @@ -727,6 +727,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa
>   	/* read format from topology */
>   	snd_mask_none(fmt);
>   
> +	private = dai->private;
>   	switch (private->comp_dai->config.frame_fmt) {
>   	case SOF_IPC_FRAME_S16_LE:
>   		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

  parent reply	other threads:[~2022-03-18 14:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18  7:12 [PATCH 1/2] ASoC: SOF: Prevent NULL dereference in sof_pcm_dai_link_fixup() Dan Carpenter
2022-03-18  7:12 ` Dan Carpenter
2022-03-18  7:13 ` [PATCH 2/2] ASoC: SOF: check for NULL before dereferencing Dan Carpenter
2022-03-18  7:13   ` Dan Carpenter
2022-03-18 14:51   ` Pierre-Louis Bossart
2022-03-18 14:51     ` Pierre-Louis Bossart
2022-03-18 14:42 ` Pierre-Louis Bossart [this message]
2022-03-18 14:42   ` [PATCH 1/2] ASoC: SOF: Prevent NULL dereference in sof_pcm_dai_link_fixup() Pierre-Louis Bossart
2022-03-18 16:14   ` Ranjani Sridharan
2022-03-18 16:14     ` Ranjani Sridharan
2022-03-18 17:49     ` Mark Brown
2022-03-18 17:49       ` Mark Brown
2022-03-20 14:33 ` [Sound-open-firmware] " Curtis Malainey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf4c4a84-335d-8799-7a5b-afe298881342@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.