]>
Commit | Line | Data |
---|---|---|
b779c14e GKH |
1 | From b1fbebd4164b3d170ad916dcd692cf843c9c065d Mon Sep 17 00:00:00 2001 |
2 | From: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
3 | Date: Mon, 17 Sep 2018 17:25:24 +0900 | |
4 | Subject: ALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path | |
5 | ||
6 | From: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
7 | ||
8 | commit b1fbebd4164b3d170ad916dcd692cf843c9c065d upstream. | |
9 | ||
10 | After allocating model-dependent data for M-Audio FW1814 and ProjectMix | |
11 | I/O, ALSA bebob driver has memory leak at error path. | |
12 | ||
13 | This commit releases the allocated data at the error path. | |
14 | ||
15 | Fixes: 04a2c73c97eb('ALSA: bebob: delayed registration of sound card') | |
16 | Cc: <stable@vger.kernel.org> # v4.7+ | |
17 | Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
18 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | sound/firewire/bebob/bebob.c | 2 ++ | |
23 | sound/firewire/bebob/bebob_maudio.c | 4 ---- | |
24 | 2 files changed, 2 insertions(+), 4 deletions(-) | |
25 | ||
26 | --- a/sound/firewire/bebob/bebob.c | |
27 | +++ b/sound/firewire/bebob/bebob.c | |
28 | @@ -263,6 +263,8 @@ do_registration(struct work_struct *work | |
29 | error: | |
30 | mutex_unlock(&devices_mutex); | |
31 | snd_bebob_stream_destroy_duplex(bebob); | |
32 | + kfree(bebob->maudio_special_quirk); | |
33 | + bebob->maudio_special_quirk = NULL; | |
34 | snd_card_free(bebob->card); | |
35 | dev_info(&bebob->unit->device, | |
36 | "Sound card registration failed: %d\n", err); | |
37 | --- a/sound/firewire/bebob/bebob_maudio.c | |
38 | +++ b/sound/firewire/bebob/bebob_maudio.c | |
39 | @@ -290,10 +290,6 @@ snd_bebob_maudio_special_discover(struct | |
40 | bebob->midi_output_ports = 2; | |
41 | } | |
42 | end: | |
43 | - if (err < 0) { | |
44 | - kfree(params); | |
45 | - bebob->maudio_special_quirk = NULL; | |
46 | - } | |
47 | mutex_unlock(&bebob->mutex); | |
48 | return err; | |
49 | } |