Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1024596pxb; Tue, 1 Feb 2022 16:06:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwidAI97Hcb7uLT9a63GXVOlf4lQXnmBEwdd+DedRM3UVsPVWNu3d3J/chrCs5arTPv/jtW X-Received: by 2002:a05:6402:50cf:: with SMTP id h15mr20772943edb.102.1643760416293; Tue, 01 Feb 2022 16:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643760416; cv=none; d=google.com; s=arc-20160816; b=o9D8rCYeqo6IVi+DSpQrIlS+VqUzBh3wngXEfPCuEsrebAPHCXeoxJ/xsaGp/+563e a5cmm/XaZ0ZJPsc10Cu/t2n1o0A2LZGMHGSIFLwHG6U51Z+OkvJUg/6vUbdkeJKzeUQC DooHRv5+nSWGOlZy/noHaWxVADPF69h5htQDOw9kvrxqrO2i+NpGqs7vk4cZPMmNYzt4 E1Vcu1hQz+mw1NXk16HAoYhZ5X4Koz+F0xfuPd48EmsHzWQwdsGmQkc5ojbAPsoIxZPv IZbyVn194vRjpLdpPpqvM/6iz5PFYPWd0L1mxVtchrgR0jf7thRIzmJv2ouWXOlVsZRX 7lAg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=LSgxTVVkQwlXqjufokK1yLX8mtu3UofuoLTMqGN8+Ig=; b=uyZYhl7v1uJm8FYcyqtkUnwnu5d1l4/8iG+MVgvoyGYixzbSlu2EChyLm2LbA0pSu+ OssySojr1zf6CfVnqsrE/Qjd5HgWNJUE/bsk1smK+vp96IfzXycz0Cs0xj4TA4FIv6D7 51M0QfJxo7Y8uCH5Qen7/RJpVL597l33Hy+47+GWqR7T/PWcnT0+YXZ4CMpntJTsxQ/H 7VH/+Vs0U49Ox0gfi5Nws0jJQGQtHR0VmyJ6Ams7c2IvdtOVk2Xy6eLsuNtRES9V/1jR 1HRHSoaVl7gM3v6qUBxLXRlugRHLqso9txUeGwxJFydkvxX83i/X0jKADWhLR/FrLisu QpPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=qVY6JB8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si11960312ejw.570.2022.02.01.16.06.31; Tue, 01 Feb 2022 16:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=qVY6JB8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbiBABB0 (ORCPT + 99 others); Mon, 31 Jan 2022 20:01:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231404AbiBABBZ (ORCPT ); Mon, 31 Jan 2022 20:01:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF16C06173B; Mon, 31 Jan 2022 17:01:25 -0800 (PST) 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 3C3916114C; Tue, 1 Feb 2022 01:01:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2B1C340EC; Tue, 1 Feb 2022 01:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643677284; bh=0gFRkMeBrEbAJtvV7jiZaYWjZsJplBWCxekudIaSp9A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qVY6JB8ceUixUrS/C2NR5cD+aF6hRCO00ofiUauUPVPyEHCcvBXiO1N1E5SOaqL8Z 3mPjfEK4a/hIKGi9VvvbDBZKyvIlOHCq0mp/xE4l14hkCBJcHtu1i/Um6BGldYqaLO DN1QgqpNs8tHSQ151UisvL2O0jv4M916ev+7OnWk= Date: Mon, 31 Jan 2022 17:01:23 -0800 From: Andrew Morton To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Michal Hocko , Oscar Salvador Subject: Re: [PATCH v1] drivers/base/memory: add memory block to memory group after registration succeeded Message-Id: <20220131170123.42d7f46ecea0da1cb1579113@linux-foundation.org> In-Reply-To: <20220128144540.153902-1-david@redhat.com> References: <20220128144540.153902-1-david@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Jan 2022 15:45:40 +0100 David Hildenbrand wrote: > If register_memory() fails, we freed the memory block but already added > the memory block to the group list, not good. Let's defer adding the > block to the memory group to after registering the memory block device. > > We do handle it properly during unregister_memory(), but that's not > called when the registration fails. > I guess this has never been known to happen. So I queued the fix for 5.18-rc1, cc:stable.