]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
f9e4669863fcad8cae1ffdc75fb93089603543dd
[thirdparty/kernel/stable-queue.git] /
1 From 0c264af7be2013266c5b4c644f3f366399ee490a Mon Sep 17 00:00:00 2001
2 From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 Date: Sun, 20 Aug 2017 15:54:26 +0900
4 Subject: ALSA: firewire: fix NULL pointer dereference when releasing uninitialized data of iso-resource
5
6 From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
7
8 commit 0c264af7be2013266c5b4c644f3f366399ee490a upstream.
9
10 When calling 'iso_resource_free()' for uninitialized data, this function
11 causes NULL pointer dereference due to its 'unit' member. This occurs when
12 unplugging audio and music units on IEEE 1394 bus at failure of card
13 registration.
14
15 This commit fixes the bug. The bug exists since kernel v4.5.
16
17 Fixes: 324540c4e05c ('ALSA: fireface: postpone sound card registration') at v4.12
18 Fixes: 8865a31e0fd8 ('ALSA: firewire-motu: postpone sound card registration') at v4.12
19 Fixes: b610386c8afb ('ALSA: firewire-tascam: deleyed registration of sound card') at v4.7
20 Fixes: 86c8dd7f4da3 ('ALSA: firewire-digi00x: delayed registration of sound card') at v4.7
21 Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card') at v4.7
22 Fixes: 7d3c1d5901aa ('ALSA: fireworks: delayed registration of sound card') at v4.7
23 Fixes: 04a2c73c97eb ('ALSA: bebob: delayed registration of sound card') at v4.7
24 Fixes: b59fb1900b4f ('ALSA: dice: postpone card registration') at v4.5
25 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
26 Signed-off-by: Takashi Iwai <tiwai@suse.de>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 sound/firewire/iso-resources.c | 7 ++++++-
31 1 file changed, 6 insertions(+), 1 deletion(-)
32
33 --- a/sound/firewire/iso-resources.c
34 +++ b/sound/firewire/iso-resources.c
35 @@ -210,9 +210,14 @@ EXPORT_SYMBOL(fw_iso_resources_update);
36 */
37 void fw_iso_resources_free(struct fw_iso_resources *r)
38 {
39 - struct fw_card *card = fw_parent_device(r->unit)->card;
40 + struct fw_card *card;
41 int bandwidth, channel;
42
43 + /* Not initialized. */
44 + if (r->unit == NULL)
45 + return;
46 + card = fw_parent_device(r->unit)->card;
47 +
48 mutex_lock(&r->mutex);
49
50 if (r->allocated) {