Closed keshonok closed 8 years ago
rcu_dereference_sk_user_data()
is used just in a handful of places in the Linux kernel. I have found only four kernel source files in the Linux kernel up to version 4.5. All of these places are related to the receive part of the UDP protocol and the like, i.e. backlog_rcv()
callback of udplite_prot{}
.
This macro definition had been introduced with this patch: torvalds/linux@559835ea7292e2f09304d81eda16f4209433245e. While the motivation for the change is clear, in my opinion the change doesn't get along very well with the RCU infrastructure. The use of this construct should occur under an explicit RCU lock which is not the case. So when CONFIG_PROVE_RCU
kernel option is on, LOCKDEP will issue warnings when this macro happens to be executed outside of an RCU-locked section of code.
I believe we should explicitly use ACCESS_ONCE()
macro to dereference sk->sk_user_data()
.
Corrected via 21db128.
I have seen this just once so far.