Re: [PATCH v3] net: qrtr: ns: Fix the incorrect usage of rcu_read_lock()

From: David Miller
Date: Tue Oct 06 2020 - 09:04:43 EST


From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
Date: Mon, 5 Oct 2020 12:46:42 +0530

> The rcu_read_lock() is not supposed to lock the kernel_sendmsg() API
> since it has the lock_sock() in qrtr_sendmsg() which will sleep. Hence,
> fix it by excluding the locking for kernel_sendmsg().
>
> While at it, let's also use radix_tree_deref_retry() to confirm the
> validity of the pointer returned by radix_tree_deref_slot() and use
> radix_tree_iter_resume() to resume iterating the tree properly before
> releasing the lock as suggested by Doug.
>
> Fixes: a7809ff90ce6 ("net: qrtr: ns: Protect radix_tree_deref_slot() using rcu read locks")
> Reported-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Tested-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Tested-by: Alex Elder <elder@xxxxxxxxxx>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>

Applied, thank you.