[PATCH RFC 5/6] ALSA: control: Reference card by ctl_dev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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);
-- 
2.35.3




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux