From: Mikulas Patocka Date: Wed, 10 Aug 2022 13:00:42 +0000 (-0400) Subject: rds: add missing barrier to release_refill X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=84295ae9384c30d6873e0ecabd9f3e8b15dc4442;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git rds: add missing barrier to release_refill commit 9f414eb409daf4f778f011cf8266d36896bb930b 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 Cc: stable@vger.kernel.org Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 918d2e676b9b..82956be2c298 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -362,6 +362,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