mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
net: add {READ|WRITE}_ONCE() annotations on ->rskq_accept_head
[ Upstream commit60b173ca3d
] reqsk_queue_empty() is called from inet_csk_listen_poll() while other cpus might write ->rskq_accept_head value. Use {READ|WRITE}_ONCE() to avoid compiler tricks and potential KCSAN splats. Fixes:fff1f3001c
("tcp: add a spinlock to protect struct request_sock_queue") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2ffb5a9b39
commit
681c8c92c4
|
@ -792,7 +792,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev,
|
|||
mappass->reqcopy = *req;
|
||||
icsk = inet_csk(mappass->sock->sk);
|
||||
queue = &icsk->icsk_accept_queue;
|
||||
data = queue->rskq_accept_head != NULL;
|
||||
data = READ_ONCE(queue->rskq_accept_head) != NULL;
|
||||
if (data) {
|
||||
mappass->reqcopy.cmd = 0;
|
||||
ret = 0;
|
||||
|
|
|
@ -181,7 +181,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,
|
|||
|
||||
static inline bool reqsk_queue_empty(const struct request_sock_queue *queue)
|
||||
{
|
||||
return queue->rskq_accept_head == NULL;
|
||||
return READ_ONCE(queue->rskq_accept_head) == NULL;
|
||||
}
|
||||
|
||||
static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue,
|
||||
|
@ -193,7 +193,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue
|
|||
req = queue->rskq_accept_head;
|
||||
if (req) {
|
||||
sk_acceptq_removed(parent);
|
||||
queue->rskq_accept_head = req->dl_next;
|
||||
WRITE_ONCE(queue->rskq_accept_head, req->dl_next);
|
||||
if (queue->rskq_accept_head == NULL)
|
||||
queue->rskq_accept_tail = NULL;
|
||||
}
|
||||
|
|
|
@ -936,7 +936,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk,
|
|||
req->sk = child;
|
||||
req->dl_next = NULL;
|
||||
if (queue->rskq_accept_head == NULL)
|
||||
queue->rskq_accept_head = req;
|
||||
WRITE_ONCE(queue->rskq_accept_head, req);
|
||||
else
|
||||
queue->rskq_accept_tail->dl_next = req;
|
||||
queue->rskq_accept_tail = req;
|
||||
|
|
Loading…
Reference in New Issue
Block a user