net: qrtr: Fix memory leak on qrtr_tx_wait failure
authorLoic Poulain <loic.poulain@linaro.org>
Tue, 30 Mar 2021 14:11:08 +0000 (16:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:42:08 +0000 (08:42 +0200)
commit6af631d1caf25811fc2e6d60dd54200827a8f405
tree759ba93884d085d5322d884f2a6409eda8f65a61
parentdfe7805e6aa6f54f7b01c3f11c23af938ad9bd7b
net: qrtr: Fix memory leak on qrtr_tx_wait failure

[ Upstream commit 8a03dd925786bdc3834d56ccc980bb70668efa35 ]

qrtr_tx_wait does not check for radix_tree_insert failure, causing
the 'flow' object to be unreferenced after qrtr_tx_wait return. Fix
that by releasing flow on radix_tree_insert failure.

Fixes: 5fdeb0d372ab ("net: qrtr: Implement outgoing flow control")
Reported-by: syzbot+739016799a89c530b32a@syzkaller.appspotmail.com
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/qrtr/qrtr.c