netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rds: add missing barrier to release_refill
@ 2022-08-10 13:00 Mikulas Patocka
  2022-08-12  9:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2022-08-10 13:00 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: netdev, linux-rdma, rds-devel

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

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rds: add missing barrier to release_refill
  2022-08-10 13:00 [PATCH] rds: add missing barrier to release_refill Mikulas Patocka
@ 2022-08-12  9:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-12  9:50 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: santosh.shilimkar, netdev, linux-rdma, rds-devel

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 13:00 [PATCH] rds: add missing barrier to release_refill Mikulas Patocka
2022-08-12  9:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).