Add the reference to the card object at control device initialization. This fixes the potential UAF by the delayed kobj release.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/control.c b/sound/core/control.c index 5b9340f5cb8c..7ac077b57709 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -2395,7 +2395,7 @@ int snd_ctl_create(struct snd_card *card) if (snd_BUG_ON(card->number < 0 || card->number >= SNDRV_CARDS)) return -ENXIO;
- snd_device_initialize(&card->ctl_dev, card, NULL); + snd_device_initialize(&card->ctl_dev, card, card); dev_set_name(&card->ctl_dev, "controlC%d", card->number);
err = snd_device_new(card, SNDRV_DEV_CONTROL, card, &ops);