Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp15253imm; Thu, 30 Aug 2018 07:17:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaQxR/u7CxhW7eOlxbk3iwl3f6gGvT6yzvh3q5gZ5UZy9Gg27hZ0X9zPvBoL7//kwGN8nsJ X-Received: by 2002:a62:234d:: with SMTP id j74-v6mr10619869pfj.106.1535638621727; Thu, 30 Aug 2018 07:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535638621; cv=none; d=google.com; s=arc-20160816; b=EWbYk/GZuz6hMJ517aGbzgZy6ZXorw+fTvaGUVyrhtmsaDaFagcDEra+HK8BqCCog5 I7Pt8nwv6bIb84/Z9HEr5AS6GAjXRMCqa9eH2JsWNtY4YPQZqq39RVwgGapIclTHDXVG vICV8d9RssOzFl0eiUi5qqTxWfj4oRD89TKGk253dFNm+Sl38RlmbhrMUX8DK7ey4gB+ 7/gFDeNuVyuRhbO8eYV6XEEs8TlBwTQFUDy+0w8BYqnXLxjjegoYqZSp6COItYlLLH5v ficUswPKhrG9o+o6NwuQ4/VgyWKUYBtMjNAliWsoYvcKcICJ89rSilMLbI3yblkljnnV lWxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=zurj3wZUUdvWmLzrXQJDu57Ik/qb9GDh/+UW5PIu2QQ=; b=lPVrV8FA8McHu6bdahFtJ91wny4kq/ZFxSCzXUcju8L49zjocJRadvkud2b1Y4C3pr xG0mYHra66nRkkbK3mhUbJNN5KSvVPV8sfboa/Vup/NdBrtlftFsmtJUxLe9n6kkm5Sr NFkdnCeuc/UszxqhXXzDINqiObblxa6RGWeWxYOvDOlsO5XNUk5YDStb25rcAbeO/COZ zyqouk3xoMkxN9TE5YfCS38sIGmc654ruNzzOmJ8HdaT7uJrYyziuj7h+9T8+uw/iluO WP1BmqrVKTtBsj/nqvtKd1y308q6bBqmpSejaAky7+uthG+I4dLE7R38hQC5tmrGPkGD ql0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oTBm6Ljn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14-v6si6880851pgg.216.2018.08.30.07.16.46; Thu, 30 Aug 2018 07:17:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oTBm6Ljn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729279AbeH3SRL (ORCPT + 99 others); Thu, 30 Aug 2018 14:17:11 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:45231 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729045AbeH3SRK (ORCPT ); Thu, 30 Aug 2018 14:17:10 -0400 Received: by mail-pf1-f176.google.com with SMTP id i26-v6so3930332pfo.12; Thu, 30 Aug 2018 07:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=zurj3wZUUdvWmLzrXQJDu57Ik/qb9GDh/+UW5PIu2QQ=; b=oTBm6Ljn1dFfokD++mhPANd3O6PaHiOTIW4DSVGAx8qrkpvXZX5HtxnDx3TLubV7rZ wqKPuc73wWPtQN6G8SftIWfEss76Hc2T80LmnD9MgNarNTm0+ZvXjrJZbByENpQJurN0 BbUMeRRywA9NhW0NzDkuj850zQx8kdgAZSkmZJZY6aQ6j9xTyh/xdtMaIT3zE8d0TGJe 0soXV5YLUZ1km27qkbqXSjTDarVyBFOJmb1sGPKxAa1e38ya+uyt1eWJHfL22tXfkhip EsrpUwXZQUXTStmQwq9JBiN7WJhiUKKsfIkru6Quw43/cCWwYWvCYhrAOq8R3e15tJGF Z1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=zurj3wZUUdvWmLzrXQJDu57Ik/qb9GDh/+UW5PIu2QQ=; b=ATXaUVF5ACKoUeW1cnrFf6+IpsPv5sZS0DaFV8LTloAt1RgcmMA+VFiegnlOpsrRLG oK1oXNg/hFyhnj1CuPTi2ld0v2s4lcF9YFDhTsAg14o9ynVzov9L9uSzwlbsOGTxRPlP YclOqYWjWMyRzqsn+uDcebEcqfUiOgp03eLIIhvs/4/9hH93oEjSvxfk88wFBBZpDrMh DDfO4so0C68CSvt8jdr+JbkP6NDNyFmwr8ZPpTwsLdHOQ887MtuItPlB6myFRu58FFXu iunDFUkSOleXX7CXQdQq7NBtFS37xv3tY2JyXo2f7ikScW8CDBbLM7mRgTMhaY1bINEm pQEw== X-Gm-Message-State: APzg51D0S91YhTSHJVYGR951TxYnTJ0hS4tdV6BuFG7Zw84hLG8BdHHK sEgNCOZSEgpcDWSK2/pYld4= X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr10715469pfo.151.1535638489928; Thu, 30 Aug 2018 07:14:49 -0700 (PDT) Received: from localhost (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.gmail.com with ESMTPSA id q26-v6sm24972519pfj.127.2018.08.30.07.14.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 07:14:49 -0700 (PDT) Date: Fri, 31 Aug 2018 00:14:46 +1000 From: Balbir Singh To: jglisse@redhat.com Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Ralph Campbell , stable@vger.kernel.org Subject: Re: [PATCH 3/7] mm/hmm: fix race between hmm_mirror_unregister() and mmu_notifier callback Message-ID: <20180830141446.GB28695@350D> References: <20180824192549.30844-1-jglisse@redhat.com> <20180824192549.30844-4-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180824192549.30844-4-jglisse@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 24, 2018 at 03:25:45PM -0400, jglisse@redhat.com wrote: > From: Ralph Campbell > > In hmm_mirror_unregister(), mm->hmm is set to NULL and then > mmu_notifier_unregister_no_release() is called. That creates a small > window where mmu_notifier can call mmu_notifier_ops with mm->hmm equal > to NULL. Fix this by first unregistering mmu notifier callbacks and > then setting mm->hmm to NULL. > > Similarly in hmm_register(), set mm->hmm before registering mmu_notifier > callbacks so callback functions always see mm->hmm set. > > Signed-off-by: Ralph Campbell > Reviewed-by: John Hubbard > Reviewed-by: J?r?me Glisse > Cc: Andrew Morton > Cc: stable@vger.kernel.org Reviewed-by: Balbir Singh