dma-buf: fix resource leak on -ENOTTY error return path
authorColin Ian King <colin.king@canonical.com>
Mon, 16 Dec 2019 16:10:59 +0000 (16:10 +0000)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:34:02 +0000 (16:34 +0100)
commit6f5e2db1b29616ceb1460c2055f974fe9b5a6644
tree45f91a97221dc1a1d7a7ac81a3b1b151e2a60766
parent87b394435d2009b6af1c2be7caa84b07e1099e6b
dma-buf: fix resource leak on -ENOTTY error return path

Commit f9d3b2c600075d1f79efcd5cdb1718c2f554c0f9 upstream.

The -ENOTTY error return path does not free the allocated
kdata as it returns directly. Fix this by returning via the
error handling label err.

Addresses-Coverity: ("Resource leak")
Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191216161059.269492-1-colin.king@canonical.com
drivers/dma-buf/dma-heap.c