Re: [PATCH net v1] net: qrtr: replace qrtr_tx_flow radix_tree with xarray to fix memory leak

From: Simon Horman

Date: Wed Mar 25 2026 - 14:32:28 EST


On Tue, Mar 24, 2026 at 04:06:44PM +0800, Jiayuan Chen wrote:
> From: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
>
> __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@xxxxxxxxx/T/
> Reported-by: syzbot+006987d1be3586e13555@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/all/000000000000bfba3a060bf4ffcf@xxxxxxxxxx/T/
> Fixes: 5fdeb0d372ab ("net: qrtr: Implement outgoing flow control")
> Cc: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>