summaryrefslogtreecommitdiff |
diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-01-10 20:41:49 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-01-11 08:35:13 +0100 |
commit | 1218fe2357aa28513f93889ddb00c2b70fffe0f3 (patch) | |
tree | 262568e0ee4eff034098356b9439cd579bdbc5d0 | |
parent | d778a796ad96ac29f5c7157a02f255ca05313e54 (diff) |
ALSA: seq: Do error checks at creating system ports
(bsc#1121278).
-rw-r--r-- | patches.drivers/ALSA-seq-Do-error-checks-at-creating-system-ports.patch | 71 | ||||
-rw-r--r-- | series.conf | 1 |
2 files changed, 72 insertions, 0 deletions
diff --git a/patches.drivers/ALSA-seq-Do-error-checks-at-creating-system-ports.patch b/patches.drivers/ALSA-seq-Do-error-checks-at-creating-system-ports.patch new file mode 100644 index 0000000000..eec22a3065 --- /dev/null +++ b/patches.drivers/ALSA-seq-Do-error-checks-at-creating-system-ports.patch @@ -0,0 +1,71 @@ +From b8e131542b47b81236ecf6768c923128e1f5db6e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai <tiwai@suse.de> +Date: Tue, 28 Aug 2018 12:49:43 +0200 +Subject: [PATCH] ALSA: seq: Do error checks at creating system ports +Git-commit: b8e131542b47b81236ecf6768c923128e1f5db6e +Patch-mainline: v4.20-rc1 +References: bsc#1121278 + +snd_seq_system_client_init() doesn't check the errors returned from +its port creations. Let's do it properly and handle the error paths. + +Signed-off-by: Takashi Iwai <tiwai@suse.de> + +--- + sound/core/seq/seq_system.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c +index 3b89b0adad6a..0dc5d5a45ecc 100644 +--- a/sound/core/seq/seq_system.c ++++ b/sound/core/seq/seq_system.c +@@ -123,6 +123,7 @@ int __init snd_seq_system_client_init(void) + { + struct snd_seq_port_callback pcallbacks; + struct snd_seq_port_info *port; ++ int err; + + port = kzalloc(sizeof(*port), GFP_KERNEL); + if (!port) +@@ -148,7 +149,10 @@ int __init snd_seq_system_client_init(void) + port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; + port->addr.client = sysclient; + port->addr.port = SNDRV_SEQ_PORT_SYSTEM_TIMER; +- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); ++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, ++ port); ++ if (err < 0) ++ goto error_port; + + /* register announcement port */ + strcpy(port->name, "Announce"); +@@ -158,16 +162,24 @@ int __init snd_seq_system_client_init(void) + port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; + port->addr.client = sysclient; + port->addr.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; +- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); ++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, ++ port); ++ if (err < 0) ++ goto error_port; + announce_port = port->addr.port; + + kfree(port); + return 0; ++ ++ error_port: ++ snd_seq_system_client_done(); ++ kfree(port); ++ return err; + } + + + /* unregister our internal client */ +-void __exit snd_seq_system_client_done(void) ++void snd_seq_system_client_done(void) + { + int oldsysclient = sysclient; + +-- +2.20.1 + diff --git a/series.conf b/series.conf index 43b5f25d14..288be21bb4 100644 --- a/series.conf +++ b/series.conf @@ -40508,6 +40508,7 @@ patches.drivers/ALSA-pcm-Return-0-when-size-start_threshold-in-captu.patch patches.drivers/ALSA-pcm-signedness-bug-in-snd_pcm_plug_alloc.patch patches.drivers/ALSA-seq-add-error-check-in-snd_seq_system_client_in.patch + patches.drivers/ALSA-seq-Do-error-checks-at-creating-system-ports.patch patches.drivers/ALSA-memalloc-Don-t-align-the-size-to-power-of-two.patch patches.drivers/ALSA-memalloc-Simplify-snd_malloc_dev_pages-calls.patch patches.drivers/ALSA-memalloc-Add-non-cached-buffer-type.patch |