]> git.baikalelectronics.ru Git - kernel.git/commit
net: qrtr: free memory on error path in radix_tree_insert()
authorNatalia Petrova <n.petrova@fintech.ru>
Wed, 25 Jan 2023 13:48:31 +0000 (16:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:15 +0000 (11:28 +0100)
commitc377a7c920216a6a1c8b9027e66c72193e3b33f0
tree5284dbf66a0e4e8dc8f9f773ff00fa58e5e73ee2
parentb16069eb931492b0321aa25d021ff89907d0cb91
net: qrtr: free memory on error path in radix_tree_insert()

commit 29de68c2b32ce58d64dea496d281e25ad0f551bd upstream.

Function radix_tree_insert() returns errors if the node hasn't
been initialized and added to the tree.

"kfree(node)" and return value "NULL" of node_get() help
to avoid using unclear node in other calls.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Cc: <stable@vger.kernel.org> # 5.7
Fixes: c2942963826d ("net: qrtr: Migrate nameservice to kernel from userspace")
Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://lore.kernel.org/r/20230125134831.8090-1-n.petrova@fintech.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/qrtr/ns.c