diff mbox series

rds: add missing barrier to release_refill

Message ID alpine.LRH.2.02.2208100858130.19047@file01.intranet.prod.int.rdu2.redhat.com (mailing list archive)
State Accepted
Commit 9f414eb409daf4f778f011cf8266d36896bb930b
Delegated to: Netdev Maintainers
Headers show
Series rds: add missing barrier to release_refill | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Mikulas Patocka Aug. 10, 2022, 1 p.m. UTC
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

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 12, 2022, 9:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 10 Aug 2022 09:00:42 -0400 (EDT) you wrote:
> 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

Here is the summary with links:
  - rds: add missing barrier to release_refill
    https://git.kernel.org/netdev/net/c/9f414eb409da

You are awesome, thank you!
diff mbox series

Patch

Index: linux-2.6/net/rds/ib_recv.c
===================================================================
--- linux-2.6.orig/net/rds/ib_recv.c
+++ linux-2.6/net/rds/ib_recv.c
@@ -363,6 +363,7 @@  static int acquire_refill(struct rds_con
 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