Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASoC: bcm: add missing .owner fields in sound card drivers #1300

Merged
merged 1 commit into from
Feb 25, 2016

Conversation

HiassofT
Copy link
Contributor

If snd_soc_card.owner is not set the kernel won't do usage refcounting
and one can remove the card driver module while it's in use (eg playback
active) - which leads to a kernel crash.

The missing owner field also prevents ALSA slot ordering
(options snd slots=module-name1,module-name-2,...) from working with
the I2S cards as it has no module name to match against.

Fix these issues by setting the .owner field in the snd_soc_card structs.

@popcornmix @pelwell if you merge this please also cherry-pick this commit into the 4.1 and 4.5 trees

If snd_soc_card.owner is not set the kernel won't do usage refcounting
and one can remove the card driver module while it's in use (eg playback
active) - which leads to a kernel crash.

The missing owner field also prevents ALSA slot ordering
(options snd slots=module-name1,module-name-2,...) from working with
the I2S cards as it has no module name to match against.

Fix these issues by setting the .owner field in the snd_soc_card structs.

Signed-off-by: Matthias Reichl <hias@horus.com>
@clivem
Copy link

clivem commented Feb 23, 2016

Good catch. And off-topic, but thanks anyway. It also told me what I needed to do to be able to "position" sun4i_codec driver on Cubietruck using "slots". I half realised what the problem was with that when "cat /proc/asound/modules" returned null rather than a module name, but this gave it to me on a plate, so thanks for that. ;)

pelwell added a commit that referenced this pull request Feb 25, 2016
ASoC: bcm: add missing .owner fields in sound card drivers
@pelwell pelwell merged commit 371f4f6 into raspberrypi:rpi-4.4.y Feb 25, 2016
@pelwell
Copy link
Contributor

pelwell commented Feb 25, 2016

Merged, with thanks.

@HiassofT HiassofT deleted the card-owner-fix branch February 25, 2016 10:08
davet321 pushed a commit to davet321/rpi-linux that referenced this pull request Feb 26, 2016
commit b3aff6c upstream.

Commit 4b4b451 ("arm/arm64: KVM: Rework the arch timer to use
level-triggered semantics") brought the virtual architected timer
closer to the VGIC. There is one occasion were we don't properly
check for the VGIC actually having been initialized before, but
instead go on to check the active state of some IRQ number.
If userland hasn't instantiated a virtual GIC, we end up with a
kernel NULL pointer dereference:
=========
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ffffffc9745c5000
[00000000] *pgd=00000009f631e003, *pud=00000009f631e003, *pmd=0000000000000000
Internal error: Oops: 96000006 [raspberrypi#2] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 2144 Comm: kvm_simplest-ar Tainted: G      D 4.5.0-rc2+ raspberrypi#1300
Hardware name: ARM Juno development board (r1) (DT)
task: ffffffc976da8000 ti: ffffffc976e28000 task.ti: ffffffc976e28000
PC is at vgic_bitmap_get_irq_val+0x78/0x90
LR is at kvm_vgic_map_is_active+0xac/0xc8
pc : [<ffffffc0000b7e28>] lr : [<ffffffc0000b972c>] pstate: 20000145
....
=========

Fix this by bailing out early of kvm_timer_flush_hwstate() if we don't
have a VGIC at all.

Reported-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
anholt pushed a commit to anholt/linux that referenced this pull request Feb 27, 2016
Commit 4b4b451 ("arm/arm64: KVM: Rework the arch timer to use
level-triggered semantics") brought the virtual architected timer
closer to the VGIC. There is one occasion were we don't properly
check for the VGIC actually having been initialized before, but
instead go on to check the active state of some IRQ number.
If userland hasn't instantiated a virtual GIC, we end up with a
kernel NULL pointer dereference:
=========
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = ffffffc9745c5000
[00000000] *pgd=00000009f631e003, *pud=00000009f631e003, *pmd=0000000000000000
Internal error: Oops: 96000006 [#2] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 2144 Comm: kvm_simplest-ar Tainted: G      D 4.5.0-rc2+ raspberrypi#1300
Hardware name: ARM Juno development board (r1) (DT)
task: ffffffc976da8000 ti: ffffffc976e28000 task.ti: ffffffc976e28000
PC is at vgic_bitmap_get_irq_val+0x78/0x90
LR is at kvm_vgic_map_is_active+0xac/0xc8
pc : [<ffffffc0000b7e28>] lr : [<ffffffc0000b972c>] pstate: 20000145
....
=========

Fix this by bailing out early of kvm_timer_flush_hwstate() if we don't
have a VGIC at all.

Reported-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: <stable@vger.kernel.org> # 4.4.x
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Feb 29, 2016
See: raspberrypi/linux#1294

kernel: config: Enable HCI over UARTs

kernel: Add 1-bit SDIO with the minimum pins required for that mode: GPIOs 22-25
See: raspberrypi/linux#1301

kernel: ASoC: bcm: add missing .owner fields in sound card drivers
See: raspberrypi/linux#1300

kernel: Add overlay and enable support for QCA7000 board
See: raspberrypi/linux#1308

kernel: bcm2835-virtgpio: Virtual GPIO driver

kernel: BCM270X_DT: Add Pi3 support

firmware: arm_ldconfig: Use arm_loader API for determining clock frequencies
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Feb 29, 2016
See: raspberrypi/linux#1294

kernel: config: Enable HCI over UARTs

kernel: Add 1-bit SDIO with the minimum pins required for that mode: GPIOs 22-25
See: raspberrypi/linux#1301

kernel: ASoC: bcm: add missing .owner fields in sound card drivers
See: raspberrypi/linux#1300

kernel: Add overlay and enable support for QCA7000 board
See: raspberrypi/linux#1308

kernel: bcm2835-virtgpio: Virtual GPIO driver

kernel: BCM270X_DT: Add Pi3 support

firmware: arm_ldconfig: Use arm_loader API for determining clock frequencies
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
See: raspberrypi/linux#1294

kernel: config: Enable HCI over UARTs

kernel: Add 1-bit SDIO with the minimum pins required for that mode: GPIOs 22-25
See: raspberrypi/linux#1301

kernel: ASoC: bcm: add missing .owner fields in sound card drivers
See: raspberrypi/linux#1300

kernel: Add overlay and enable support for QCA7000 board
See: raspberrypi/linux#1308

kernel: bcm2835-virtgpio: Virtual GPIO driver

kernel: BCM270X_DT: Add Pi3 support

firmware: arm_ldconfig: Use arm_loader API for determining clock frequencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants