Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408676rwa; Tue, 23 Aug 2022 04:24:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR5mf9Z+3eMVcjarYyCjbYz4qtJthYD3csQ4PIqIgBpFAaWZALnzfi5OzVHB+ID35h/6X9bJ X-Received: by 2002:a17:90b:4c47:b0:1fa:dd14:aabd with SMTP id np7-20020a17090b4c4700b001fadd14aabdmr2907271pjb.76.1661253871868; Tue, 23 Aug 2022 04:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253871; cv=none; d=google.com; s=arc-20160816; b=sePmri1wOV40q98SFklKFUn6bqVLRZv+0El3v2bn2lJU11lIbpib5jZxXxnR9Z6iCg U36rCUlcau8NHl7BA8IlLRE6ijTVqfb2GqFoNK4K8qeWWQZHt2xVTni2th9+o2Wgx+OU tzamO3M94FDkx6B1a7u8icn0hX4dhv/9UIqcYOKShcD/Wn2I22aDU+iPn9EVvo5kOSqr yNCbdIfYUcFVh7k2NWz6tDi+y0NhZh6WYzfTyqmvROtwS9rinrvnPuFepNeugiN16mi7 YlWvt8DR/lxGLXjq9fAd1Pj2ImrFxbzV31xKxuyLfajfoLW5xK18YJArI4oitHANeg3S Crkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HzeiAponrVaFwE2r7rkk9zocN9D+6mAUjz43OrmpGAI=; b=FRRBnVH378564DFgKCCz4F1ytzxwLcszMTt+s5i4z/em/rNJE09+YAguDcFzhXKa6H +ISMlkDhSr4kQp5oimdG6AfROdr7crcioId/f4VFGHAR2r+SXy0U96TTa/z8AAUDD3IY z1Cr5WwLgTCBu5hgpjS95zbl2ZjIVORF86eXM0DetJLZR1k7sOXuMDC4O9HFGUfomdPV bszmmUEB/e7oOeLwGrN9xpXWWInaD43y7hPStkrKH29uNTsOFZSaIV7BPVwFX2v7Myph A5elEcqGR/orkEgCkYVmOmL5bMPWyNvnCWASsrKxKW3rrJhprFz3vDNc7o+TdxIKccan r/uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mbbvKrI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a63f701000000b00429b4bd247asi15545545pgh.397.2022.08.23.04.24.19; Tue, 23 Aug 2022 04:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mbbvKrI5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354826AbiHWKxJ (ORCPT + 99 others); Tue, 23 Aug 2022 06:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355878AbiHWKpW (ORCPT ); Tue, 23 Aug 2022 06:45:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB6174DC1; Tue, 23 Aug 2022 02:11:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D6AE60DB4; Tue, 23 Aug 2022 09:11:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 129F7C433C1; Tue, 23 Aug 2022 09:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245867; bh=eQhmZHt5ptWLP7a417Uv9ecOnBX2k8sOFo408lcOWcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbbvKrI5dwpITd0djBNiQ4Diyg0miTDvmcKTL4yrTRoxyserzRHcAN6ZknO3VDHa9 0YfWTCwhIyWc0Jk+XFK/fi9T5V5hi2k8+MhUZKIobRKovrIbCIJhShQXmMiDvhj8yg t6duFnnSpj9caBYjgzjaLyCHaklVxCSIHcUq6XAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , "David S. Miller" Subject: [PATCH 4.19 216/287] rds: add missing barrier to release_refill Date: Tue, 23 Aug 2022 10:26:25 +0200 Message-Id: <20220823080108.234392303@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka 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 --- net/rds/ib_recv.c | 1 + 1 file changed, 1 insertion(+) --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -362,6 +362,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