Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: soc-pcm: don't use soc_pcm_ret() on .prepare callback

commit 1f5664351410 ("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>

authored by

Kuninori Morimoto and committed by
Mark Brown
301c26a0 539a3f0c

+28 -4
+28 -4
sound/soc/soc-pcm.c
··· 38 38 switch (ret) { 39 39 case -EPROBE_DEFER: 40 40 case -ENOTSUPP: 41 - case -EINVAL: 42 41 break; 43 42 default: 44 43 dev_err(rtd->dev, ··· 985 986 } 986 987 987 988 out: 988 - return soc_pcm_ret(rtd, ret); 989 + /* 990 + * Don't use soc_pcm_ret() on .prepare callback to lower error log severity 991 + * 992 + * We don't want to log an error since we do not want to give userspace a way to do a 993 + * denial-of-service attack on the syslog / diskspace. 994 + */ 995 + return ret; 989 996 } 990 997 991 998 /* PCM prepare ops for non-DPCM streams */ ··· 1003 998 snd_soc_dpcm_mutex_lock(rtd); 1004 999 ret = __soc_pcm_prepare(rtd, substream); 1005 1000 snd_soc_dpcm_mutex_unlock(rtd); 1001 + 1002 + /* 1003 + * Don't use soc_pcm_ret() on .prepare callback to lower error log severity 1004 + * 1005 + * We don't want to log an error since we do not want to give userspace a way to do a 1006 + * denial-of-service attack on the syslog / diskspace. 1007 + */ 1006 1008 return ret; 1007 1009 } 1008 1010 ··· 2551 2539 be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; 2552 2540 } 2553 2541 2554 - return soc_pcm_ret(fe, ret); 2542 + /* 2543 + * Don't use soc_pcm_ret() on .prepare callback to lower error log severity 2544 + * 2545 + * We don't want to log an error since we do not want to give userspace a way to do a 2546 + * denial-of-service attack on the syslog / diskspace. 2547 + */ 2548 + return ret; 2555 2549 } 2556 2550 2557 2551 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) ··· 2597 2579 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 2598 2580 snd_soc_dpcm_mutex_unlock(fe); 2599 2581 2600 - return soc_pcm_ret(fe, ret); 2582 + /* 2583 + * Don't use soc_pcm_ret() on .prepare callback to lower error log severity 2584 + * 2585 + * We don't want to log an error since we do not want to give userspace a way to do a 2586 + * denial-of-service attack on the syslog / diskspace. 2587 + */ 2588 + return ret; 2601 2589 } 2602 2590 2603 2591 static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)