From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by gnuweeb.org (Postfix) with ESMTPS id 195997E6FF for ; Mon, 28 Mar 2022 08:05:26 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (1024-bit key; unprotected) header.d=alien8.de header.i=@alien8.de header.a=rsa-sha256 header.s=dkim header.b=V9Iqrlxx; dkim-atps=neutral Received: from zn.tnic (p2e55dff8.dip0.t-ipconnect.de [46.85.223.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A840D1EC03AD; Mon, 28 Mar 2022 10:05:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1648454720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=TgYlt5nc7wuciyx7G8H9YwvEKtCL+n4QE5+p7msxcds=; b=V9IqrlxxviCrGiqelyL2A4fuZ02xoQlvZmW05/np63cGMoImBaU6+12OzilUmj4ggY+GFn JqZ46zIiR4h3DyaxRKVol9wqXLnKyG4q07tz+4NovtOaz7R5QZtUzn4OF/M2iBtGsq3rlU 6Ypa1ZH/furZtBZNMAb0GDqQb2+xj48= Date: Mon, 28 Mar 2022 10:05:22 +0200 From: Borislav Petkov To: Ammar Faizi Cc: Thomas Gleixner , Alviro Iskandar Setiawan , Alviro Iskandar Setiawan , Dave Hansen , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , Tony Luck , Yazen Ghannam , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, gwml@vger.gnuweeb.org, x86@kernel.org Subject: Re: [PATCH v5 2/2] x86/MCE/AMD: Fix memory leak when `threshold_create_bank()` fails Message-ID: References: <20220310015306.445359-1-ammarfaizi2@gnuweeb.org> <20220310015306.445359-3-ammarfaizi2@gnuweeb.org> <82609267-8fc6-5b3d-c931-c0d93ab14788@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <82609267-8fc6-5b3d-c931-c0d93ab14788@gnuweeb.org> List-Id: On Mon, Mar 28, 2022 at 11:12:53AM +0700, Ammar Faizi wrote: > Although, I am not sure if that 100% guarantees mce_threshold_remove_device() > will not mess up with the interrupt (e.g. freeing the data while the interrupt > reading it), unless we're using RCU stuff. > > What do you think? I would've said it doesn't matter but that thresholding device creation is part of hotplug and it can happen multiple times even *after* the interrupt vector has been set during setup so a potential teardown and concurrent thresholding interrupt firing might really hit in a not fully initialized/cleaned up state so yeah, let's do Yazen's thing. The alternative would be the temporarily re-assign mce_threshold_vector to default_threshold_interrupt while setup is being done but that's not really necessary atm. But call that helper function __threshold_remove_device(). Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette