mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-26 12:34:41 +08:00
net: annotate accesses to sk->sk_rx_queue_mapping
sk->sk_rx_queue_mapping can be modified locklessly, add a couple of READ_ONCE()/WRITE_ONCE() to document this fact. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
342159ee39
commit
09b8984667
@ -1925,15 +1925,19 @@ static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb)
|
|||||||
static inline void sk_rx_queue_clear(struct sock *sk)
|
static inline void sk_rx_queue_clear(struct sock *sk)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING
|
#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING
|
||||||
sk->sk_rx_queue_mapping = NO_QUEUE_MAPPING;
|
WRITE_ONCE(sk->sk_rx_queue_mapping, NO_QUEUE_MAPPING);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int sk_rx_queue_get(const struct sock *sk)
|
static inline int sk_rx_queue_get(const struct sock *sk)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING
|
#ifdef CONFIG_SOCK_RX_QUEUE_MAPPING
|
||||||
if (sk && sk->sk_rx_queue_mapping != NO_QUEUE_MAPPING)
|
if (sk) {
|
||||||
return sk->sk_rx_queue_mapping;
|
int res = READ_ONCE(sk->sk_rx_queue_mapping);
|
||||||
|
|
||||||
|
if (res != NO_QUEUE_MAPPING)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user