]> git.itanic.dy.fi Git - linux-stable/commit
ALSA: firewire: fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Thu, 8 Aug 2019 05:50:58 +0000 (00:50 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Nov 2019 15:57:13 +0000 (15:57 +0000)
commit2654ab2efb3bcb77ccc50061e2bf7ff042d28383
tree3f4c106e955f683e4a9fed3c996e640c8103e35a
parenta81c4add9f2966cb2b17406cd62e58a435a95b57
ALSA: firewire: fix a memory leak bug

commit 1be3c1fae6c1e1f5bb982b255d2034034454527a upstream.

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 <wenwen@cs.uga.edu>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/firewire/packets-buffer.c