From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3CF9C433E1 for ; Thu, 27 Aug 2020 16:19:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C137622B4D for ; Thu, 27 Aug 2020 16:19:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="GhtCzp23" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbgH0QTw (ORCPT ); Thu, 27 Aug 2020 12:19:52 -0400 Received: from mail.skyhub.de ([5.9.137.197]:43576 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbgH0QTw (ORCPT ); Thu, 27 Aug 2020 12:19:52 -0400 Received: from zn.tnic (p200300ec2f104500059e4b9a4804679d.dip0.t-ipconnect.de [IPv6:2003:ec:2f10:4500:59e:4b9a:4804:679d]) (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 0D9791EC0423; Thu, 27 Aug 2020 18:19:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1598545191; 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=8QkVnkRzvDRQrZeUzmaDHT7ZWuqLDu370tFsz3uoBFk=; b=GhtCzp23m/8JrKlNe2AI+L5CSVBCovcFE+rSdbNl4qQvwW8E7FnRgZ0Erw+L1DLPjYArHB DwOaq0bqDxeRxZkmOs+1DhnUBCRyhzk1Bk9iwxBUHcD/oirjDG0Jh3JV/sSDxBkWIORIpT KVeILwGC2j5EK9F3KkFa0ROUSPuQ+Ss= Date: Thu, 27 Aug 2020 18:19:52 +0200 From: Borislav Petkov To: Shiju Jose Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, rrichter@marvell.com, linuxarm@huawei.com, Borislav Petkov Subject: Re: [PATCH v2 1/1] EDAC/ghes: Fix for NULL pointer dereference in ghes_edac_register() Message-ID: <20200827161952.GD30897@zn.tnic> References: <20200827140450.1620-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200827140450.1620-1-shiju.jose@huawei.com> Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org On Thu, Aug 27, 2020 at 03:04:50PM +0100, Shiju Jose wrote: > After the 'commit b9cae27728d1 ("EDAC/ghes: Scan the system once on driver init")' > applied, following error has occurred in the ghes_edac_register() when > CONFIG_DEBUG_TEST_DRIVER_REMOVE is enabled. The null ghes_hw.dimms pointer > in the mci_for_each_dimm() of ghes_edac_register() caused the error. > > The error occurs when all the previously initialized ghes instances are > removed and then probe a new ghes instance. In this case, the ghes_refcount > would be 0, ghes_hw.dimms and mci already freed. The ghes_hw.dimms would > be null because ghes_scan_system() would not call enumerate_dimms() again. > > Suggested-by: Borislav Petkov > Signed-off-by: Shiju Jose > --- > drivers/edac/ghes_edac.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) Thanks, queued in edac-urgent. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette