Skip to contentSkip to conversation

Bug in hdmi codec driver in DPCM

DISCUSSION Rohit Kumar 2 participants 3 messages Oct 30, 2018 – Oct 31, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

We are facing crash in hdmi codec driver when we use DPCM based dai-links. Crash is happening in hdmi_codec_eld_chmap() while accessing chmap_info struct during hdmi_codec_startup(). However, chmap_info struct is allocated in hdmi_codec_pcm_new() which is only called in non-DPCM based dai-links.

Below is the crash stack:

[61.635493] Unable to handle kernel NULL pointer dereference at virtual address 00000018

.....

[61.666696]CM = 0, WnR = 1
[61.669778] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc0d6633000
[61.676526] [0000000000000018] *pgd=0000000153fc8003, *pud=0000000153fc8003, *pmd=0000000000000000
[61.685793] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[61.722955] CPU: 7 PID: 2238 Comm: aplay Not tainted 4.14.72 #21

..

[61.740269] PC is at hdmi_codec_startup+0x124/0x164
[61.745308] LR is at hdmi_codec_startup+0xe4/0x164

..

We would probably need to move the implementation on pcm_new() to some other function to make it compatible with DPCM.

Can you please provide suggestions in solving the issue.

Thanks,

Rohit

#1 lore raw
Quoted 24 lines · Rohit Kumar

Hi,

We are facing crash in hdmi codec driver when we use DPCM based dai-links. Crash is happening in hdmi_codec_eld_chmap() while accessing chmap_info struct during hdmi_codec_startup(). However, chmap_info struct is allocated in hdmi_codec_pcm_new() which is only called in non-DPCM based dai-links.

Below is the crash stack:

[61.635493] Unable to handle kernel NULL pointer dereference at virtual address 00000018

.....

[61.666696]CM = 0, WnR = 1
[61.669778] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc0d6633000
[61.676526] [0000000000000018] *pgd=0000000153fc8003, *pud=0000000153fc8003, *pmd=0000000000000000
[61.685793] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[61.722955] CPU: 7 PID: 2238 Comm: aplay Not tainted 4.14.72 #21

..

[61.740269] PC is at hdmi_codec_startup+0x124/0x164
Quoted 8 lines
[61.745308] LR is at hdmi_codec_startup+0xe4/0x164

..

We would probably need to move the implementation on pcm_new() to some other function to make it compatible with DPCM.

Can you please provide suggestions in solving the issue.

In my opinion, it is not responsibility of driver to speculate whether the ops it exposes would only be called under certain usage (non-DPCM in this case). I think ASoC framework should be updated to call pcm_new() of each driver even though no actual PCM device would be created for backend dailink.

Quoted 4 lines

Thanks,

Rohit

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
 a Linux Foundation Collaborative Project
#2 lore raw
Quoted 31 lines · Patrick Lai
Quoted 30 lines · Rohit Kumar

Hi,

We are facing crash in hdmi codec driver when we use DPCM based dai-links. Crash is happening in hdmi_codec_eld_chmap() while accessing chmap_info struct during hdmi_codec_startup(). However, chmap_info struct is allocated in hdmi_codec_pcm_new() which is only called in non-DPCM based dai-links.

Below is the crash stack:

[61.635493] Unable to handle kernel NULL pointer dereference at virtual address 00000018

.....

[61.666696]CM = 0, WnR = 1
[61.669778] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc0d6633000
[61.676526] [0000000000000018] *pgd=0000000153fc8003, *pud=0000000153fc8003, *pmd=0000000000000000
[61.685793] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[61.722955] CPU: 7 PID: 2238 Comm: aplay Not tainted 4.14.72 #21

..

[61.740269] PC is at hdmi_codec_startup+0x124/0x164
[61.745308] LR is at hdmi_codec_startup+0xe4/0x164

..

We would probably need to move the implementation on pcm_new() to some other function to make it compatible with DPCM.

Quoted 8 lines
Quoted 2 lines

Can you please provide suggestions in solving the issue.

In my opinion, it is not responsibility of driver to speculate whether the ops it exposes would only be called under certain usage (non-DPCM in this case). I think ASoC framework should be updated to call pcm_new() of each driver even though no actual PCM device would be created for backend dailink.

Thanks Patrick for the response. In that case, we should avoid no_pcm check before calling pcm_new() in soc_link_dai_pcm_new().
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/soc-core.c?h=v4.19#n1413

Mark, Can you please provide your opinion for the same.

Quoted 6 lines
Quoted 4 lines

Thanks,

Rohit

Signature · 2 lines
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the Linux Foundation.