]> git.baikalelectronics.ru Git - kernel.git/commit
staging: bcm2835-audio: Fix memory corruption
authorPhil Elwell <phil@raspberrypi.org>
Sun, 24 Sep 2017 14:20:49 +0000 (15:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Oct 2017 13:09:45 +0000 (15:09 +0200)
commit7b2ad0ec51da3a4fea3082cf4b1cbb9989252b9d
tree0e6b16525e082f13bf06a31c9a4fb5e09e9655a0
parente474ee3d85904e7402109f9fd858803539a7c26a
staging: bcm2835-audio: Fix memory corruption

The previous commit (358d9007) fixed a memory leak but also freed a
block in the success case, causing a stale pointer to be used with
potentially fatal results. Only free the vchi_instance block in the
case that vchi_connect fails; once connected, the instance is
retained for subsequent connections.

Simplifying the code by removing a bunch of gotos and returning errors
directly.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Fixes: 358d90073e97 ("staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection()")
Cc: stable <stable@vger.kernel.org> # 4.12+
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c