diff mbox series

[v1] ALSA: vx222: fix null-ptr-deref

Message ID 20210907014746.1445278-1-ztong0001@gmail.com
State Accepted
Commit 8491f59e3b130ea8b5116e363d400c42f91544fc
Headers show
Series [v1] ALSA: vx222: fix null-ptr-deref | expand

Commit Message

Tong Zhang Sept. 7, 2021, 1:47 a.m. UTC
a recent refactor created a null pointer vx in snd_vx222_probe().
The vx pointer should have been populated in snd_vx222_create() as
suggested in earlier version, otherwise vx->core.ibl.size will throw an
error.

[    1.298398] BUG: kernel NULL pointer dereference, address: 00000000000001d8
[    1.316799] RIP: 0010:snd_vx222_probe+0x155/0x290 [snd_vx222]

Fixes: 3bde3359aa16 ("ALSA: vx222: Allocate resources with device-managed APIs")
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
---
 sound/pci/vx222/vx222.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Takashi Iwai Sept. 7, 2021, 5:16 a.m. UTC | #1
On Tue, 07 Sep 2021 03:47:45 +0200,
Tong Zhang wrote:
> 
> a recent refactor created a null pointer vx in snd_vx222_probe().
> The vx pointer should have been populated in snd_vx222_create() as
> suggested in earlier version, otherwise vx->core.ibl.size will throw an
> error.
> 
> [    1.298398] BUG: kernel NULL pointer dereference, address: 00000000000001d8
> [    1.316799] RIP: 0010:snd_vx222_probe+0x155/0x290 [snd_vx222]
> 
> Fixes: 3bde3359aa16 ("ALSA: vx222: Allocate resources with device-managed APIs")
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index f48cc20b9e8a..468a6a20dc1e 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -137,6 +137,7 @@  static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
 	}
 	chip->irq = pci->irq;
 	card->sync_irq = chip->irq;
+	*rchip = vx;
 
 	return 0;
 }