Skip to content

Commit

Permalink
rds: add missing barrier to release_refill
Browse files Browse the repository at this point in the history
The functions clear_bit and set_bit do not imply a memory barrier, thus it
may be possible that the waitqueue_active function (which does not take
any locks) is moved before clear_bit and it could miss a wakeup event.

Fix this bug by adding a memory barrier after clear_bit.

Signed-off-by: Mikulas Patocka <[email protected]>
Cc: [email protected]
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Mikulas Patocka authored and davem330 committed Aug 12, 2022
1 parent 7ebfc85 commit 9f414eb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/rds/ib_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ static int acquire_refill(struct rds_connection *conn)
static void release_refill(struct rds_connection *conn)
{
clear_bit(RDS_RECV_REFILL, &conn->c_flags);
smp_mb__after_atomic();

/* We don't use wait_on_bit()/wake_up_bit() because our waking is in a
* hot path and finding waiters is very rare. We don't want to walk
Expand Down

0 comments on commit 9f414eb

Please sign in to comment.