]> git.hungrycats.org Git - linux/commit
rpmsg: smd: fix memory leak on channel create
authorColin Ian King <colin.king@canonical.com>
Thu, 27 Sep 2018 21:36:27 +0000 (22:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:17:03 +0000 (11:17 -0800)
commit245af7ee61ef0a399521a48babe12a32fa36d336
tree6da5b9feedbfc12cd880a32cdbfa04227fda9e59
parent5fa09dbe0fd46da335f8870bacf8df723c2a6420
rpmsg: smd: fix memory leak on channel create

commit 940c620d6af8fca7d115de40f19870fba415efac upstream.

Currently a failed allocation of channel->name leads to an
immediate return without freeing channel. Fix this by setting
ret to -ENOMEM and jumping to an exit path that kfree's channel.

Detected by CoverityScan, CID#1473692 ("Resource Leak")

Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
Cc: stable@vger.kernel.org
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rpmsg/qcom_smd.c