Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rds: add missing barrier to release_refill

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 <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mikulas Patocka and committed by
David S. Miller
9f414eb4 7ebfc85e

+1
+1
net/rds/ib_recv.c
··· 363 363 static void release_refill(struct rds_connection *conn) 364 364 { 365 365 clear_bit(RDS_RECV_REFILL, &conn->c_flags); 366 + smp_mb__after_atomic(); 366 367 367 368 /* We don't use wait_on_bit()/wake_up_bit() because our waking is in a 368 369 * hot path and finding waiters is very rare. We don't want to walk