]> git.baikalelectronics.ru Git - kernel.git/commit
net: qrtr: ns: Fix the incorrect usage of rcu_read_lock()
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Mon, 5 Oct 2020 07:16:42 +0000 (12:46 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Oct 2020 13:01:35 +0000 (06:01 -0700)
commitb9d9d4821a31ce07d2a60d8d2e541bf2536cb136
tree22d6c00b0b58982eeaf072fe968814cfcd873b10
parent9ed649be9d912ac5b9b78f4a052704ba5a3aa898
net: qrtr: ns: Fix the incorrect usage of rcu_read_lock()

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: ed0906b18fb0 ("net: qrtr: ns: Protect radix_tree_deref_slot() using rcu read locks")
Reported-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Alex Elder <elder@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/qrtr/ns.c