]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: qrtr: replace qrtr_tx_flow radix_tree with xarray to fix memory leak
authorJiayuan Chen <jiayuan.chen@shopee.com>
Tue, 24 Mar 2026 08:06:44 +0000 (16:06 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Mar 2026 03:22:38 +0000 (20:22 -0700)
commit2428083101f6883f979cceffa76cd8440751ffe6
tree0e3399b80d86c12b415f3267ef989443cb08c86a
parent04f272188ff293f112f914e235cb3bedf1063507
net: qrtr: replace qrtr_tx_flow radix_tree with xarray to fix memory leak

__radix_tree_create() allocates and links intermediate nodes into the
tree one by one. If a subsequent allocation fails, the already-linked
nodes remain in the tree with no corresponding leaf entry. These orphaned
internal nodes are never reclaimed because radix_tree_for_each_slot()
only visits slots containing leaf values.

The radix_tree API is deprecated in favor of xarray. As suggested by
Matthew Wilcox, migrate qrtr_tx_flow from radix_tree to xarray instead
of fixing the radix_tree itself [1]. xarray properly handles cleanup of
internal nodes — xa_destroy() frees all internal xarray nodes when the
qrtr_node is released, preventing the leak.

[1] https://lore.kernel.org/all/20260225071623.41275-1-jiayuan.chen@linux.dev/T/
Reported-by: syzbot+006987d1be3586e13555@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/000000000000bfba3a060bf4ffcf@google.com/T/
Fixes: 5fdeb0d372ab ("net: qrtr: Implement outgoing flow control")
Signed-off-by: Jiayuan Chen <jiayuan.chen@shopee.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260324080645.290197-1-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/qrtr/af_qrtr.c