Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Commit d857393

Browse files
committed
ALSA: seq: Don't allow resizing pool in use
This is a fix for a (sort of) fallout in the recent commit d15d662 ("ALSA: seq: Fix racy pool initializations") for CVE-2018-1000004. As the pool resize deletes the existing cells, it may lead to a race when another thread is writing concurrently, eventually resulting a UAF. A simple workaround is not to allow the pool resizing when the pool is in use. It's an invalid behavior in anyway. Fixes: d15d662 ("ALSA: seq: Fix racy pool initializations") Reported-by: 范龙飞 <long7573@126.com> Reported-by: Nicolai Stange <nstange@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e312a86 commit d857393

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/core/seq/seq_clientmgr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,9 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
18381838
(! snd_seq_write_pool_allocated(client) ||
18391839
info->output_pool != client->pool->size)) {
18401840
if (snd_seq_write_pool_allocated(client)) {
1841+
/* is the pool in use? */
1842+
if (atomic_read(&client->pool->counter))
1843+
return -EBUSY;
18411844
/* remove all existing cells */
18421845
snd_seq_pool_mark_closing(client->pool);
18431846
snd_seq_queue_client_leave_cells(client->number);

0 commit comments

Comments
 (0)