]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rds: add missing barrier to release_refill
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 10 Aug 2022 13:00:42 +0000 (09:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:18 +0000 (11:18 +0200)
commit 83441718fd359226c1b756ad1094d2f8e0338a69 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/rds/ib_recv.c

index a0f99bbf362ca0302d9028453ae26edbb7e6bdd1..6dd3f45df9ca64e8c70009cac592f6ea49bd11fd 100644 (file)
@@ -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