• Russell King's avatar
    ASoC: hdmi-codec: fix oops on re-probe · 0ce23d6d
    Russell King authored
    hdmi-codec oopses the kernel when it is unbound from a successfully
    bound audio subsystem, and is then rebound:
    
    Unable to handle kernel NULL pointer dereference at virtual address 0000001c
    pgd = ee3f0000
    [0000001c] *pgd=3cc59831
    Internal error: Oops: 817 [#1] PREEMPT ARM
    Modules linked in: ext2 snd_soc_spdif_tx vmeta dove_thermal snd_soc_kirkwood ofpart marvell_cesa m25p80 orion_wdt mtd spi_nor des_generic gpio_ir_recv snd_soc_kirkwood_spdif bmm_dmabuf auth_rpcgss nfsd autofs4 etnaviv thermal_sys hwmon gpu_sched tda9950
    CPU: 0 PID: 1005 Comm: bash Not tainted 4.20.0+ #1762
    Hardware name: Marvell Dove (Cubox)
    PC is at hdmi_dai_probe+0x68/0x80
    LR is at find_held_lock+0x20/0x94
    pc : [<c04c7de0>]    lr : [<c0063bf4>]    psr: 600f0013
    sp : ee15bd28  ip : eebd8b1c  fp : c093b488
    r10: ee048000  r9 : eebdab18  r8 : ee048600
    r7 : 00000001  r6 : 00000000  r5 : 00000000  r4 : ee82c100
    r3 : 00000006  r2 : 00000001  r1 : c067e38c  r0 : ee82c100
    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none[  297.318599] Control: 10c5387d  Table: 2e3f0019  DAC: 00000051
    Process bash (pid: 1005, stack limit = 0xee15a248)
    ...
    [<c04c7de0>] (hdmi_dai_probe) from [<c04b7060>] (soc_probe_dai.part.9+0x34/0x70)
    [<c04b7060>] (soc_probe_dai.part.9) from [<c04b81a8>] (snd_soc_instantiate_card+0x734/0xc9c)
    [<c04b81a8>] (snd_soc_instantiate_card) from [<c04b8b6c>] (snd_soc_add_component+0x29c/0x378)
    [<c04b8b6c>] (snd_soc_add_component) from [<c04b8c8c>] (snd_soc_register_component+0x44/0x54)
    [<c04b8c8c>] (snd_soc_register_component) from [<c04c64b4>] (devm_snd_soc_register_component+0x48/0x84)
    [<c04c64b4>] (devm_snd_soc_register_component) from [<c04c7be8>] (hdmi_codec_probe+0x150/0x260)
    [<c04c7be8>] (hdmi_codec_probe) from [<c0373124>] (platform_drv_probe+0x48/0x98)
    
    This happens because hdmi_dai_probe() attempts to access the HDMI
    codec private data, but this has not been assigned by hdmi_dai_probe()
    before it calls devm_snd_soc_register_component().  Move the call to
    dev_set_drvdata() before devm_snd_soc_register_component() to avoid
    this oops.
    Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Cc: stable@vger.kernel.org
    0ce23d6d
hdmi-codec.c 24.1 KB