[alsa-devel] ALSA become "Segmentation fault" on current linus tree
Dear Liam, Mark
Currect linus tree become "Segmentation fault" when I use aplay.
# aplay xxx.wav Segmentation fault
I used "git bisect" and 1st bad commit was below. I'm using sh7372 mackerel board.
commit 22de71ba03311cdc1063757c50a1488cb90a1fca Author: Liam Girdwood lrg@ti.com Date: Thu May 12 16:14:04 2011 +0100
ASoC: core - allow ASoC more flexible machine name
Allow ASoC machine drivers to register a driver name and a longname. This allows user space to determine the flavour of machine driver.
Signed-off-by: Liam Girdwood lrg@ti.com Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
Best regards --- Kuninori Morimoto
At Tue, 05 Jul 2011 13:10:49 +0900, kuninori.morimoto.gx@renesas.com wrote:
Dear Liam, Mark
Currect linus tree become "Segmentation fault" when I use aplay.
# aplay xxx.wav Segmentation fault
I used "git bisect" and 1st bad commit was below. I'm using sh7372 mackerel board.
commit 22de71ba03311cdc1063757c50a1488cb90a1fca Author: Liam Girdwood lrg@ti.com Date: Thu May 12 16:14:04 2011 +0100
ASoC: core - allow ASoC more flexible machine name
Allow ASoC machine drivers to register a driver name and a longname. This allows user space to determine the flavour of machine driver.
Signed-off-by: Liam Girdwood lrg@ti.com Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
Hm, this should have been fixed by the later commit: commit 2b39535b9e54888649923beaab443af212b6c0fd Author: Jarkko Nikula jhnikula@gmail.com Date: Fri May 20 15:47:40 2011 +0300
ASoC: core: Don't set "(null)" as a driver name
Could you check whether the segfault occurs at this point? It's possible that another bug was introduced after it, of course.
thanks,
Takashi
Dear Takashi
Thanks for your reply
Hm, this should have been fixed by the later commit: commit 2b39535b9e54888649923beaab443af212b6c0fd Author: Jarkko Nikula jhnikula@gmail.com Date: Fri May 20 15:47:40 2011 +0300
ASoC: core: Don't set "(null)" as a driver name
Could you check whether the segfault occurs at this point? It's possible that another bug was introduced after it, of course.
Hmm... segfault still happen on this commit.
Best regards --- Kuninori Morimoto
At Tue, 05 Jul 2011 14:57:41 +0900, kuninori.morimoto.gx@renesas.com wrote:
Dear Takashi
Thanks for your reply
Hm, this should have been fixed by the later commit: commit 2b39535b9e54888649923beaab443af212b6c0fd Author: Jarkko Nikula jhnikula@gmail.com Date: Fri May 20 15:47:40 2011 +0300
ASoC: core: Don't set "(null)" as a driver name
Could you check whether the segfault occurs at this point? It's possible that another bug was introduced after it, of course.
Hmm... segfault still happen on this commit.
Can you trap the segfault via gdb to see where it happens?
Takashi
Dear Takashi, Liam, Mark
Thanks for your reply
Hm, this should have been fixed by the later commit: commit 2b39535b9e54888649923beaab443af212b6c0fd Author: Jarkko Nikula jhnikula@gmail.com Date: Fri May 20 15:47:40 2011 +0300
ASoC: core: Don't set "(null)" as a driver name
Could you check whether the segfault occurs at this point? It's possible that another bug was introduced after it, of course.
Hmm... segfault still happen on this commit.
Is this become hint ?
my kernel boot log is
-------------- ... fsi-pcm-audio sh_fsi2: clocks managed by runtime pm ak4642-codec 0-0013: AK4642 Audio Codec 0.0.1 asoc: ak4642-hifi <-> fsia-dai mapping ok sh-mobile-hdmi sh-mobile-hdmi: SH Mobile HDMI Audio Codec asoc: sh_mobile_hdmi-hifi <-> fsib-dai mapping ok ALSA device list: #0: FSI2A (AK4643) #1: FSI2B (SH MOBILE HDMI) --------------
I don't know why, but the segfault didn't happen if I applied below patch
------------------- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bb7cd58..e84bf6d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1929,8 +1929,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card * "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name); - snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), - "%s", card->driver_name ? card->driver_name : card->name); +// snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), +// "%s", card->driver_name ? card->driver_name : card->name);
if (card->late_probe) { ret = card->late_probe(card); -------------------
Best regards --- Kuninori Morimoto
At Tue, 05 Jul 2011 15:07:28 +0900, kuninori.morimoto.gx@renesas.com wrote:
Dear Takashi, Liam, Mark
Thanks for your reply
Hm, this should have been fixed by the later commit: commit 2b39535b9e54888649923beaab443af212b6c0fd Author: Jarkko Nikula jhnikula@gmail.com Date: Fri May 20 15:47:40 2011 +0300
ASoC: core: Don't set "(null)" as a driver name
Could you check whether the segfault occurs at this point? It's possible that another bug was introduced after it, of course.
Hmm... segfault still happen on this commit.
Is this become hint ?
my kernel boot log is
... fsi-pcm-audio sh_fsi2: clocks managed by runtime pm ak4642-codec 0-0013: AK4642 Audio Codec 0.0.1 asoc: ak4642-hifi <-> fsia-dai mapping ok sh-mobile-hdmi sh-mobile-hdmi: SH Mobile HDMI Audio Codec asoc: sh_mobile_hdmi-hifi <-> fsib-dai mapping ok ALSA device list: #0: FSI2A (AK4643)
#1: FSI2B (SH MOBILE HDMI)
I don't know why, but the segfault didn't happen if I applied below patch
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bb7cd58..e84bf6d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1929,8 +1929,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card * "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name);
snprintf(card->snd_card->driver, sizeof(card->snd_card->driver),
"%s", card->driver_name ? card->driver_name : card->name);
+// snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), +// "%s", card->driver_name ? card->driver_name : card->name);
So, driver name setup seems screwing up. What shows /proc/asound/cards? It contains also the driver string.
Takashi
Dear Takashi
So, driver name setup seems screwing up. What shows /proc/asound/cards? It contains also the driver string.
Current /proc/asound/cards is
---------------------------------- # cat /proc/asound/cards 0 [AK4643 ]: FSI2A (AK4643) - FSI2A (AK4643) FSI2A (AK4643) 1 [HDMI ]: FSI2B (SH MOBIL - FSI2B (SH MOBILE HDMI) FSI2B (SH MOBILE HDMI) ----------------------------------
Ohh my... If I modified like this, it start works
---------------------------------- # cat /proc/asound/cards 0 [FSI2A ]: FSI2A - FSI2A FSI2A 1 [FSI2B ]: FSI2B - FSI2B FSI2B ----------------------------------
Should it be short name ?
Best regards --- Kuninori Morimoto
At Tue, 05 Jul 2011 15:29:39 +0900, kuninori.morimoto.gx@renesas.com wrote:
Dear Takashi
So, driver name setup seems screwing up. What shows /proc/asound/cards? It contains also the driver string.
Current /proc/asound/cards is
# cat /proc/asound/cards 0 [AK4643 ]: FSI2A (AK4643) - FSI2A (AK4643) FSI2A (AK4643) 1 [HDMI ]: FSI2B (SH MOBIL - FSI2B (SH MOBILE HDMI) FSI2B (SH MOBILE HDMI)
Ohh my... If I modified like this, it start works
# cat /proc/asound/cards 0 [FSI2A ]: FSI2A - FSI2A FSI2A 1 [FSI2B ]: FSI2B - FSI2B FSI2B
Should it be short name ?
For the compatible behavior, we can keep it empty like the patch below. It wasn't set in the earlier versions.
Alternatively, driver name can be deduced from shortname by replacing invalid characters. In general, it shouldn't contain space letters and special letters like parentheses.
But, driver_name should override if defined, and ASoC stuff has worked well without driver name setup, we can keep it empty as default, I guess.
thanks,
Takashi
--- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d08abf4..954e3b7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1420,8 +1420,9 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name); - snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), - "%s", card->driver_name ? card->driver_name : card->name); + if (card->driver_name) + snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), + "%s", card->driver_name);
if (card->late_probe) { ret = card->late_probe(card);
Dear Takashi, Liam, Mark
Thank you for your solution
For the compatible behavior, we can keep it empty like the patch below. It wasn't set in the earlier versions.
Alternatively, driver name can be deduced from shortname by replacing invalid characters. In general, it shouldn't contain space letters and special letters like parentheses.
But, driver_name should override if defined, and ASoC stuff has worked well without driver name setup, we can keep it empty as default, I guess.
Takashi's patch works well. Thanks I didn't know that there is a NG characters.
To Mark, Liam
I guess it is FSI driver side issue. I will send FSI side fixup patch. I don't know which is better though (Takashi's patch / FSI fixup patch)
Best regards --- Kuninori Morimoto
Dear Mark, Liam
These are fsi-xxx card name fixup patches. It are needed for current linus tree.
Kuninori Morimoto (3): ASoC: sh: fsi-ak4642: fixup snd_soc_card name ASoC: sh: fsi-da7210: fixup snd_soc_card name ASoC: sh: fsi-hdmi: fixup snd_soc_card name
Best regards --- Kuninori Morimoto
it shouldn't contain space letters and special letters like parentheses.
aplay will be "Segmentation fault" without this patch. special thanks to Takashi.
Cc: Takashi Iwai tiwai@suse.de Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/fsi-ak4642.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index d6f4703..770a71a 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -97,7 +97,7 @@ static int fsi_ak4642_remove(struct platform_device *pdev)
static struct fsi_ak4642_data fsi_a_ak4642 = { .name = "AK4642", - .card = "FSIA (AK4642)", + .card = "FSIA-AK4642", .cpu_dai = "fsia-dai", .codec = "ak4642-codec.0-0012", .platform = "sh_fsi.0", @@ -106,7 +106,7 @@ static struct fsi_ak4642_data fsi_a_ak4642 = {
static struct fsi_ak4642_data fsi_b_ak4642 = { .name = "AK4642", - .card = "FSIB (AK4642)", + .card = "FSIB-AK4642", .cpu_dai = "fsib-dai", .codec = "ak4642-codec.0-0012", .platform = "sh_fsi.0", @@ -115,7 +115,7 @@ static struct fsi_ak4642_data fsi_b_ak4642 = {
static struct fsi_ak4642_data fsi_a_ak4643 = { .name = "AK4643", - .card = "FSIA (AK4643)", + .card = "FSIA-AK4643", .cpu_dai = "fsia-dai", .codec = "ak4642-codec.0-0013", .platform = "sh_fsi.0", @@ -124,7 +124,7 @@ static struct fsi_ak4642_data fsi_a_ak4643 = {
static struct fsi_ak4642_data fsi_b_ak4643 = { .name = "AK4643", - .card = "FSIB (AK4643)", + .card = "FSIB-AK4643", .cpu_dai = "fsib-dai", .codec = "ak4642-codec.0-0013", .platform = "sh_fsi.0", @@ -133,7 +133,7 @@ static struct fsi_ak4642_data fsi_b_ak4643 = {
static struct fsi_ak4642_data fsi2_a_ak4642 = { .name = "AK4642", - .card = "FSI2A (AK4642)", + .card = "FSI2A-AK4642", .cpu_dai = "fsia-dai", .codec = "ak4642-codec.0-0012", .platform = "sh_fsi2", @@ -142,7 +142,7 @@ static struct fsi_ak4642_data fsi2_a_ak4642 = {
static struct fsi_ak4642_data fsi2_b_ak4642 = { .name = "AK4642", - .card = "FSI2B (AK4642)", + .card = "FSI2B-AK4642", .cpu_dai = "fsib-dai", .codec = "ak4642-codec.0-0012", .platform = "sh_fsi2", @@ -151,7 +151,7 @@ static struct fsi_ak4642_data fsi2_b_ak4642 = {
static struct fsi_ak4642_data fsi2_a_ak4643 = { .name = "AK4643", - .card = "FSI2A (AK4643)", + .card = "FSI2A-AK4643", .cpu_dai = "fsia-dai", .codec = "ak4642-codec.0-0013", .platform = "sh_fsi2", @@ -160,7 +160,7 @@ static struct fsi_ak4642_data fsi2_a_ak4643 = {
static struct fsi_ak4642_data fsi2_b_ak4643 = { .name = "AK4643", - .card = "FSI2B (AK4643)", + .card = "FSI2B-AK4643", .cpu_dai = "fsib-dai", .codec = "ak4642-codec.0-0013", .platform = "sh_fsi2",
it shouldn't contain space letters and special letters like parentheses.
aplay will be "Segmentation fault" without this patch. special thanks to Takashi.
Cc: Takashi Iwai tiwai@suse.de Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/fsi-da7210.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c index dbafd7a..59553fd 100644 --- a/sound/soc/sh/fsi-da7210.c +++ b/sound/soc/sh/fsi-da7210.c @@ -42,7 +42,7 @@ static struct snd_soc_dai_link fsi_da7210_dai = { };
static struct snd_soc_card fsi_soc_card = { - .name = "FSI (DA7210)", + .name = "FSI-DA7210", .dai_link = &fsi_da7210_dai, .num_links = 1, };
it shouldn't contain space letters and special letters like parentheses.
aplay will be "Segmentation fault" without this patch special thanks to Takashi.
Cc: Takashi Iwai tiwai@suse.de Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/sh/fsi-hdmi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c index 9719985..d3d9fd8 100644 --- a/sound/soc/sh/fsi-hdmi.c +++ b/sound/soc/sh/fsi-hdmi.c @@ -83,13 +83,13 @@ static int fsi_hdmi_remove(struct platform_device *pdev)
static struct fsi_hdmi_data fsi2_a_hdmi = { .cpu_dai = "fsia-dai", - .card = "FSI2A (SH MOBILE HDMI)", + .card = "FSI2A-HDMI", .id = FSI_PORT_A, };
static struct fsi_hdmi_data fsi2_b_hdmi = { .cpu_dai = "fsib-dai", - .card = "FSI2B (SH MOBILE HDMI)", + .card = "FSI2B-HDMI", .id = FSI_PORT_B, };
At Tue, 05 Jul 2011 00:12:04 -0700 (PDT), kuninori.morimoto.gx@renesas.com wrote:
Dear Mark, Liam
These are fsi-xxx card name fixup patches. It are needed for current linus tree.
Kuninori Morimoto (3): ASoC: sh: fsi-ak4642: fixup snd_soc_card name ASoC: sh: fsi-da7210: fixup snd_soc_card name ASoC: sh: fsi-hdmi: fixup snd_soc_card name
The name string itself is allowed to contain spaces or other special letters. These are copied to longname and shortname. But the driver_name string isn't, and the problem is to reuse the same string for it.
Since no driver sets driver_name string yet, a better fix would be to keep it empty like the earlier version. The revised patch below.
Takashi
--- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] 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 Signed-off-by: Takashi Iwai tiwai@suse.de --- 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 d75043e..b194be0 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) "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name); - snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), - "%s", card->driver_name ? card->driver_name : card->name); + if (card->driver_name) + strlcpy(card->snd_card->driver, card->driver_name, + sizeof(card->snd_card->driver));
if (card->late_probe) { ret = card->late_probe(card);
Dear Takashi
Kuninori Morimoto (3): ASoC: sh: fsi-ak4642: fixup snd_soc_card name ASoC: sh: fsi-da7210: fixup snd_soc_card name ASoC: sh: fsi-hdmi: fixup snd_soc_card name
The name string itself is allowed to contain spaces or other special letters. These are copied to longname and shortname. But the driver_name string isn't, and the problem is to reuse the same string for it.
Thanks. I understand it.
Since no driver sets driver_name string yet, a better fix would be to keep it empty like the earlier version. The revised patch below.
Thanks. I need this patch on current linus tree.
Best regards --- Kuninori Morimoto
On 05/07/11 08:33, Takashi Iwai wrote:
At Tue, 05 Jul 2011 00:12:04 -0700 (PDT), kuninori.morimoto.gx@renesas.com wrote:
Dear Mark, Liam
These are fsi-xxx card name fixup patches. It are needed for current linus tree.
Kuninori Morimoto (3): ASoC: sh: fsi-ak4642: fixup snd_soc_card name ASoC: sh: fsi-da7210: fixup snd_soc_card name ASoC: sh: fsi-hdmi: fixup snd_soc_card name
The name string itself is allowed to contain spaces or other special letters. These are copied to longname and shortname. But the driver_name string isn't, and the problem is to reuse the same string for it.
Since no driver sets driver_name string yet, a better fix would be to keep it empty like the earlier version. The revised patch below.
I can give a little background here, the intention is to allow a single "family" driver to support several different machines. i.e. the Panda, Blaze and SDP4430 are use the same "OMAP4" sound driver, but all have slightly different analog outputs (requiring slightly different userspace alsa-lib/UCM configs).
I do have a patch queued using driver name for OMAP4, but that will be for 3.2.
Takashi
From: Takashi Iwai tiwai@suse.de Subject: [PATCH] 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 Signed-off-by: Takashi Iwai tiwai@suse.de
Acked-by: Liam Girdwood lrg@ti.com
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 d75043e..b194be0 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) "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name);
- snprintf(card->snd_card->driver, sizeof(card->snd_card->driver),
"%s", card->driver_name ? card->driver_name : card->name);
if (card->driver_name)
strlcpy(card->snd_card->driver, card->driver_name,
sizeof(card->snd_card->driver));
if (card->late_probe) { ret = card->late_probe(card);
At Tue, 5 Jul 2011 11:22:33 +0100, Liam Girdwood wrote:
On 05/07/11 08:33, Takashi Iwai wrote:
At Tue, 05 Jul 2011 00:12:04 -0700 (PDT), kuninori.morimoto.gx@renesas.com wrote:
Dear Mark, Liam
These are fsi-xxx card name fixup patches. It are needed for current linus tree.
Kuninori Morimoto (3): ASoC: sh: fsi-ak4642: fixup snd_soc_card name ASoC: sh: fsi-da7210: fixup snd_soc_card name ASoC: sh: fsi-hdmi: fixup snd_soc_card name
The name string itself is allowed to contain spaces or other special letters. These are copied to longname and shortname. But the driver_name string isn't, and the problem is to reuse the same string for it.
Since no driver sets driver_name string yet, a better fix would be to keep it empty like the earlier version. The revised patch below.
I can give a little background here, the intention is to allow a single "family" driver to support several different machines. i.e. the Panda, Blaze and SDP4430 are use the same "OMAP4" sound driver, but all have slightly different analog outputs (requiring slightly different userspace alsa-lib/UCM configs).
Setting a right driver_name makes sense in such a case, indeed.
I do have a patch queued using driver name for OMAP4, but that will be for 3.2.
Takashi
From: Takashi Iwai tiwai@suse.de Subject: [PATCH] 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 Signed-off-by: Takashi Iwai tiwai@suse.de
Acked-by: Liam Girdwood lrg@ti.com
Thanks, now applied to fix/asoc branch.
Takashi
On Tue, Jul 05, 2011 at 02:41:18PM +0200, Takashi Iwai wrote:
Liam Girdwood wrote:
Acked-by: Liam Girdwood lrg@ti.com
Thanks, now applied to fix/asoc branch.
For what little it's worth
Acked-by: Mark Brown broonie@opensource.wolfsonmicro.com
participants (5)
-
Kuninori Morimoto
-
kuninori.morimoto.gx@renesas.com
-
Liam Girdwood
-
Mark Brown
-
Takashi Iwai