Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp639878pxb; Tue, 1 Feb 2022 07:29:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0w3LaNVQxjNu1/umXhWu39S/NMWZKfRd9zIUO+Ri4ozvuhlseEFLFUIQgYKh+iPEFxUdO X-Received: by 2002:a62:7656:: with SMTP id r83mr26136579pfc.26.1643729389229; Tue, 01 Feb 2022 07:29:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643729389; cv=none; d=google.com; s=arc-20160816; b=UvDv0CE8NM/JPYACi6s5eYDHT3pWbePy+GYV0UrOi8PRueldsi1Ia7XhLn/fPii1qN QAPxds3G4jI8c//kPyeX73cN67AizzWV+BX9vsx9kq8XVH2oZXhOGlEkiM58eTI292LH L1sZunSUYQgo9myfwLGvGcnWk9TkDLkeCW3V3bHYKdPvSvR/Rvm1QHrUusNdzuI2VxGc Eq0K2smnINWLPikR7sNNYQcbbfENhF19fPfo4tw3fhZuQirDIwKFcgmGCgQX/4+STWaH +6rrSIQ/khvNSRVvfw8Yhn2kFyS/nNbtIZlEkgAwRM3EuiDam0CEVbUPUy5rIy5wr86E Czkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=r03ryjoJE+I6jzeUO7ZpiYA0DNC9txWpejJG0PG2+qM=; b=rGSg09tTXUz4IDRcsen/K5jhDD2q6QKjL8YCwhYAxjDb+qx/rhwoPyXQcXKQSk7oRg 99oasMKFy4O/3R0as58LWVGCt4D4rydCcKczWE5bilo5kiY5nr5QMmqog8AbiEo9JaBo rTYKgL28Qg7AihsKJVwDXadrnFV1wmxhKkwzGprNmcO2KrokttNC//d5VoZkBnMcsd1y +cebVSGPde48ZaGYx64cUI2YZhB3nKO6Qjcy4XOTrpeSR6Gg9Q74k4wOgJaScC3d3EXI UEbzRwCLDfVlBJ7PlzzHoXh8LY2D4al+QOXTDKajPPXBxFom0GffDToIhC6o5UZphUlT Zn2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=nWRTUQnM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d63si16844730pgc.592.2022.02.01.07.29.36; Tue, 01 Feb 2022 07:29:49 -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=@suse.de header.s=susede2_rsa header.b=nWRTUQnM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235034AbiAaFwt (ORCPT + 99 others); Mon, 31 Jan 2022 00:52:49 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:57852 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiAaFwr (ORCPT ); Mon, 31 Jan 2022 00:52:47 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 13C6E212C5; Mon, 31 Jan 2022 05:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643608366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=r03ryjoJE+I6jzeUO7ZpiYA0DNC9txWpejJG0PG2+qM=; b=nWRTUQnMtTQ0XajvwGyACUJrKXAzwLaW6bsouECJ5eaW756sAFyWi18iG0WynWFmi7vADu 9lvU6yssBQRb9beLwQKbuwbNAQig7yXWs5W1zpl++9pF/TVjV11Fmczd66E5rTMXzgpboZ 3AJD5s2B4a9Gwnpgws8zcfHXtornNa0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643608366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=r03ryjoJE+I6jzeUO7ZpiYA0DNC9txWpejJG0PG2+qM=; b=c3IAuy/cxQipjTDZ8VfHJwIx7X15VJGypjt3Ee8Jwp0yWobMYiJaGIU7iwTgsRvXo73jd0 q/LPuYQInLm72lAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 848B113638; Mon, 31 Jan 2022 05:52:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cShhHS1592FYJwAAMHmgww (envelope-from ); Mon, 31 Jan 2022 05:52:45 +0000 Date: Mon, 31 Jan 2022 06:52:43 +0100 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , Michal Hocko Subject: Re: [PATCH v1] drivers/base/memory: add memory block to memory group after registration succeeded Message-ID: References: <20220128144540.153902-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220128144540.153902-1-david@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 03:45:40PM +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. > > Fixes: 028fc57a1c36 ("drivers/base/memory: introduce "memory groups" to logically group memory blocks") > Cc: stable@vger.kernel.org # v5.15+ > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Oscar Salvador > Signed-off-by: David Hildenbrand Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE Labs