Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3492726rwa; Tue, 23 Aug 2022 05:47:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ldvF4P6k0UG9n6+IFw+LI7MBW1JmFzfyuNN3gJ8efnZuIqCbw/vyzp0vPfcWfMgpVvTJC X-Received: by 2002:a17:907:1629:b0:73d:ac2e:5ac2 with SMTP id hb41-20020a170907162900b0073dac2e5ac2mr227396ejc.276.1661258835044; Tue, 23 Aug 2022 05:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661258835; cv=none; d=google.com; s=arc-20160816; b=LEj1ADXu018PGy1zpn8tDyRDu/uMOACwBp3a1bJjN/VrZzermRaCc2i+dr0JrOls/O RR3TZLWQEkKV+jJoGDFLNpcPHTYhDQYby4Sth0qDWG2LNTxKrhtt8NO+kYSR7sC3v6TW 65qt0fxr60cd4Pmv/hWjixyCRRtlmPezdD5yD5Vw9gaXzz7KH88xz0PqpFcBD8NTmQ4z EM0qoNYLk8t96+lFNxnd13hWZKaJw7F20swnN4PluwCc3Xmsg6cYhEodp+px+V3O+sjK Pp5052qAqYLzYep2Kz5CiBQ4AJCVWIyg0w5iDBXcbymxXK3eFcmeR9WWtVofpeqPw6qA wuxA== 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=iGyw++4XD7BofF8ghiQ75ITHeyn1sei2wJ1Tb/kMDxg=; b=npKGwANku+QWbLtuxyogVFgJ6EYTLRgphvlGZwEPv+3c5zG56QW63j1DcZnhQTpQM8 wUCNFQODP7ERWKgM4cxconBwvBFsFhNFk+jgSfDZoc/LrDUBQCOADCd6a0N8eLca1hE3 uGrZSzFQ8yEFLPJMslVSRRT4HXiVE+XMT0+QkZsJaA32mbb2jXOmCE7yeyUMgaf3cKpB ul0p1wFWg//uS/ntkfltQSW1yCXHCaiZKVyVWRWQhv4a1YesUiA2kczOh8Sixl7kwCUm pJHalouXVp/sggKMbVjgzuwEvvA52MUK3EzW5b8D8vmFg+UGVec3zFBIFbV4iSXcNnEu sb5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdCrBhG6; 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 bx21-20020a0564020b5500b00446efca2cb9si1926370edb.264.2022.08.23.05.46.49; Tue, 23 Aug 2022 05:47:15 -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=xdCrBhG6; 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 S1358446AbiHWLsr (ORCPT + 99 others); Tue, 23 Aug 2022 07:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358142AbiHWLpN (ORCPT ); Tue, 23 Aug 2022 07:45:13 -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 6B995D1272; Tue, 23 Aug 2022 02:30:05 -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 A451861381; Tue, 23 Aug 2022 09:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDD8C433C1; Tue, 23 Aug 2022 09:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661247003; bh=UCYycxyPUwO1hHOBKfBA1QUnk84cOVlOhcqdGlDU2ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdCrBhG6aHoUALTksWzXhKOFwtaO6C1T0EFpvQ3Qk3niTB7SozxD71sNvMPvrR/ON fL0D7mXi7pgf+/RNiK8ijP7rIdWrCArzLOQRcdHLMnNzn8DpMDzQpyaaruxZNbX13i 7U0irKUeLKcT4xJGEqU7U5WuetvLKhV4a7Ug9vAk= 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 5.4 287/389] rds: add missing barrier to release_refill Date: Tue, 23 Aug 2022 10:26:05 +0200 Message-Id: <20220823080127.533786856@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@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 @@ -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