[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1032c823-90aa-0144-eb7a-ff1a019c3094@perex.cz>
Date: Wed, 2 Jun 2021 08:47:04 +0200
From: Jaroslav Kysela <perex@...ex.cz>
To: Dongliang Mu <mudongliangabcd@...il.com>, tiwai@...e.com,
dan.carpenter@...cle.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Cc: syzbot+08a7d8b51ea048a74ffb@...kaller.appspotmail.com
Subject: Re: [PATCH v2] ALSA: control led: fix memory leak in
snd_ctl_led_register
On 02. 06. 21 5:41, Dongliang Mu wrote:
> The snd_ctl_led_sysfs_add and snd_ctl_led_sysfs_remove should contain
> the refcount operations in pair. However, snd_ctl_led_sysfs_remove fails
> to decrease the refcount to zero, which causes device_release never to
> be invoked. This leads to memory leak to some resources, like struct
> device_private. In addition, we also free some other similar memory
> leaks in snd_ctl_led_init/snd_ctl_led_exit.
>
> Fix this by replacing device_del to device_unregister
> in snd_ctl_led_sysfs_remove/snd_ctl_led_init/snd_ctl_led_exit.
>
> Note that, when CONFIG_DEBUG_KOBJECT_RELEASE is enabled, put_device will
> call kobject_release and delay the release of kobject, which will cause
> use-after-free when the memory backing the kobject is freed at once.
>
> Reported-by: syzbot+08a7d8b51ea048a74ffb@...kaller.appspotmail.com
> Fixes: a135dfb5de1 ("ALSA: led control - add sysfs kcontrol LED marking layer")
> Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
Many thanks to you and Dan to cover this.
Revieved-by: Jaroslav Kysela <perex@...ex.cz>
--
Jaroslav Kysela <perex@...ex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Powered by blists - more mailing lists