Skip to content

Commit 301c26a

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-pcm: don't use soc_pcm_ret() on .prepare callback
commit 1f56643 ("ASoC: lower "no backend DAIs enabled for ... Port" log severity") ignores -EINVAL error message on common soc_pcm_ret(). It is used from many functions, ignoring -EINVAL is over-kill. The reason why -EINVAL was ignored was it really should only be used upon invalid parameters coming from userspace and in that case we don't want to log an error since we do not want to give userspace a way to do a denial-of-service attack on the syslog / diskspace. So don't use soc_pcm_ret() on .prepare callback is better idea. Link: https://lore.kernel.org/r/87v7vptzap.wl-kuninori.morimoto.gx@renesas.com Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87bjxg8jju.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 539a3f0 commit 301c26a

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

sound/soc/soc-pcm.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static inline int _soc_pcm_ret(struct snd_soc_pcm_runtime *rtd,
3838
switch (ret) {
3939
case -EPROBE_DEFER:
4040
case -ENOTSUPP:
41-
case -EINVAL:
4241
break;
4342
default:
4443
dev_err(rtd->dev,
@@ -986,7 +985,13 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
986985
}
987986

988987
out:
989-
return soc_pcm_ret(rtd, ret);
988+
/*
989+
* Don't use soc_pcm_ret() on .prepare callback to lower error log severity
990+
*
991+
* We don't want to log an error since we do not want to give userspace a way to do a
992+
* denial-of-service attack on the syslog / diskspace.
993+
*/
994+
return ret;
990995
}
991996

992997
/* PCM prepare ops for non-DPCM streams */
@@ -998,6 +1003,13 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
9981003
snd_soc_dpcm_mutex_lock(rtd);
9991004
ret = __soc_pcm_prepare(rtd, substream);
10001005
snd_soc_dpcm_mutex_unlock(rtd);
1006+
1007+
/*
1008+
* Don't use soc_pcm_ret() on .prepare callback to lower error log severity
1009+
*
1010+
* We don't want to log an error since we do not want to give userspace a way to do a
1011+
* denial-of-service attack on the syslog / diskspace.
1012+
*/
10011013
return ret;
10021014
}
10031015

@@ -2539,7 +2551,13 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
25392551
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
25402552
}
25412553

2542-
return soc_pcm_ret(fe, ret);
2554+
/*
2555+
* Don't use soc_pcm_ret() on .prepare callback to lower error log severity
2556+
*
2557+
* We don't want to log an error since we do not want to give userspace a way to do a
2558+
* denial-of-service attack on the syslog / diskspace.
2559+
*/
2560+
return ret;
25432561
}
25442562

25452563
static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
@@ -2579,7 +2597,13 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
25792597
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
25802598
snd_soc_dpcm_mutex_unlock(fe);
25812599

2582-
return soc_pcm_ret(fe, ret);
2600+
/*
2601+
* Don't use soc_pcm_ret() on .prepare callback to lower error log severity
2602+
*
2603+
* We don't want to log an error since we do not want to give userspace a way to do a
2604+
* denial-of-service attack on the syslog / diskspace.
2605+
*/
2606+
return ret;
25832607
}
25842608

25852609
static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)

0 commit comments

Comments
 (0)