Skip to content

"Kernel Panic" run 'soft/kmod_scripts/sof_bootone.sh' cause kernel panic on BYT with sof-byt-rt5651.tplg #68

Closed

Description

System Environment:
Kernel repo: topic/sof-dev: 46b7b64
soft repo: topic/master: cfff9e0
using the tplg: sof-byt-rt5651.tplg

Reproduce step:
run the "soft/kmod_scripts/sof_bootone.sh" script, that means do the module reload one time.
the panic will be hit.

the log:
dmesg.txt

Activity

  1. plbossart commented on Aug 8, 2018

    @plbossart
    Member

    Are you saying the kernel oops happens in the chunk of code below?
    If yes, can you try and protect the dereferences when kcontrols is NULL?

    if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
    /* enumerated widget mixer */
    for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
    struct snd_kcontrol *kcontrol = w->kcontrols[i];
    struct soc_enum *se =
    (struct soc_enum *)kcontrol->private_value;
    int j;

    		snd_ctl_remove(card, kcontrol);
    
    		kfree(se->dobj.control.dvalues);
    		for (j = 0; j < se->items; j++)
    			kfree(se->dobj.control.dtexts[j]);
    
    		kfree(se);
    		kfree(w->kcontrol_news[i].name);
    	}
    } else {
    	/* volume mixer or bytes controls */
    	for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
    		struct snd_kcontrol *kcontrol = w->kcontrols[i];
    
    		if (dobj->widget.kcontrol_type
    		    == SND_SOC_TPLG_TYPE_MIXER)
    			kfree(kcontrol->tlv.p);
    
    		/* Private value is used as struct soc_mixer_control
    		 * for volume mixers or soc_bytes_ext for bytes
    		 * controls.
    		 */
    		kfree((void *)kcontrol->private_value);
    		snd_ctl_remove(card, kcontrol);
    		kfree(w->kcontrol_news[i].name);
    	}
    }
    
  2. plbossart commented on Aug 8, 2018

    @plbossart
    Member

    Thanks. Since this is going to touch non-SOF code in soc-topology, we'll have to be more generic and check what happens for other widgets as well, not just the control ones.
    Alternatively we'd want to bail when the unknown binding is found, that might actually be a better way of doing things?

  3. lgirdwood commented on Aug 8, 2018

    @lgirdwood
    Member

    @zhigang-wu please try and switch on the kernel memory debugging tools (under kconfig debug options). This will mean a kernel rebuild, but it does help to shed light on any double frees or use after free issues.

  4. added
    bugSomething isn't working
    P1Blocker bugs or important features
    on Sep 16, 2018
  5. 6 remaining items

  6. mengdonglin commented on Dec 11, 2018

    @mengdonglin

    @stevyan @markyang Could you help to check if this issue is gone with fixing of #144 by #311?

  7. markyang commented on Dec 12, 2018

    @markyang

    Summary:
    This issue cannot be reproduced on BYT with ALC5651 using the build on Dec 7
    There is no Kernel Panic, both arecord and aplay worked fine.

    Test steps:

    1. kmod_scripts/sof_bootone.sh
    2. arecord -Dhw:0,0 -c2 -fS16_LE -vv -i ~/mytest.wav #OK
    3. aplay -Dhw:0,0 -c2 -fS16_LE -vv -i ~/mytest.wav #OK

    Test env:
    sof master: b5d6c71 #Dec 7
    kernel sof-dev: a71221d #Dec 7
    tplg: test-ssp2-mclk-0-I2S-volume-s16le-s16le-48k-19200k-codec.tplg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BYTApplies to Baytrail platformP2Critical bugs or normal featuresbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions