]> Git Repo - J-linux.git/commitdiff
ALSA: firewire: fix a memory leak bug
authorWenwen Wang <[email protected]>
Thu, 8 Aug 2019 05:50:58 +0000 (00:50 -0500)
committerTakashi Iwai <[email protected]>
Thu, 8 Aug 2019 09:12:26 +0000 (11:12 +0200)
In iso_packets_buffer_init(), 'b->packets' is allocated through
kmalloc_array(). Then, the aligned packet size is checked. If it is
larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
However, the allocated 'b->packets' is not deallocated on this path,
leading to a memory leak.

To fix the above issue, free 'b->packets' before returning the error code.

Fixes: 31ef9134eb52 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
Signed-off-by: Wenwen Wang <[email protected]>
Reviewed-by: Takashi Sakamoto <[email protected]>
Cc: <[email protected]> # v2.6.39+
Signed-off-by: Takashi Iwai <[email protected]>
sound/firewire/packets-buffer.c

index 0d35359d25cd8643e5c5ab23fd00af6add754d73..0ecafd0c672271d08d844fe09c78c63fd5fccddf 100644 (file)
@@ -37,7 +37,7 @@ int iso_packets_buffer_init(struct iso_packets_buffer *b, struct fw_unit *unit,
        packets_per_page = PAGE_SIZE / packet_size;
        if (WARN_ON(!packets_per_page)) {
                err = -EINVAL;
-               goto error;
+               goto err_packets;
        }
        pages = DIV_ROUND_UP(count, packets_per_page);
 
This page took 0.048748 seconds and 4 git commands to generate.