diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-07-05 03:25:59 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-05 08:39:27 -0400 |
commit | 873bd4cb4fbba6a3e99f750e17ef2ba6ef96e9d3 (patch) | |
tree | 7d18ae174562b57d195d01378fe9889366600fc5 /sound/soc | |
parent | 8d9afa08fe831ae521bf11a125b347bb0b578526 (diff) |
ASoC: Don't set invalid name string to snd_card->driver field
The snd_card->driver field contains a driver name string, and in
general it shouldn't contain space or special letters. The commit
2b39535b9e54888649923beaab443af212b6c0fd changed the string copy from
card->name, but the long name string may contain such letters, thus
it may still lead to a segfault.
A temporary fix is not to copy the long name string but just keep it
empty as the earlier version did.
Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d75043ed7fc0..b194be09e74d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1929,8 +1929,9 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1929 | "%s", card->name); | 1929 | "%s", card->name); |
1930 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), | 1930 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), |
1931 | "%s", card->long_name ? card->long_name : card->name); | 1931 | "%s", card->long_name ? card->long_name : card->name); |
1932 | snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), | 1932 | if (card->driver_name) |
1933 | "%s", card->driver_name ? card->driver_name : card->name); | 1933 | strlcpy(card->snd_card->driver, card->driver_name, |
1934 | sizeof(card->snd_card->driver)); | ||
1934 | 1935 | ||
1935 | if (card->late_probe) { | 1936 | if (card->late_probe) { |
1936 | ret = card->late_probe(card); | 1937 | ret = card->late_probe(card); |