Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2606469imi; Mon, 25 Jul 2022 03:20:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGd1BpXDsGAi5je0IqHVUhH0NMQWWgLbso5LHudSSBIavewpOKCQ8m6miQ7uvnK6FB8P0+ X-Received: by 2002:a65:4c0b:0:b0:415:d3a4:44d1 with SMTP id u11-20020a654c0b000000b00415d3a444d1mr10507486pgq.191.1658744457124; Mon, 25 Jul 2022 03:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658744457; cv=none; d=google.com; s=arc-20160816; b=TC+xiTOdLuSa20ZtxLxqtlh6Zt0x/LRyWZOF4w9KXXnlcWm4+WbZqX9exJqkriB1LQ l4MVMOhHHY23c/t8BRNnWcpB2yow5Mssp3BUId1hQhmMius48kwsd7ucRVSVYU5OmF8v MhUNH9gkPe37DuIElMjkYnaZgKzN1+MgfyGixeK7JUxP+R4YzRGyJbDRCK5CMLcIihX/ n7NBmRNKVmkAXggyspfSMMDPhjdO8wc11p3QPLYm8VdBpMfWSAA3NW6KcEZ2Gyqeym/r vQ0GVMDaFcyTAiWyR8KUB6oX+n9gW556peIt+Qs0v8NlRf///iiaM1CifHE3VwXdYVl0 34jw== 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; bh=UG3HyB+a1rEuod/npdxD9V9DqUguu9NB6mUos5iP184=; b=ea9O3Di9Ku1hE0mBEHhPvHtmA1tN+tPxHN2bzg23vdZSDqPAEnKrrff7pd4BzQ0zNW KTok+b0THzhNlIjOydwLObw4i72kNuIMZ5t1rQgWBaexeqdcjhZ0oxjshRAOKI+RbTpO aOT0hQ406eZqNBA94OcQvLS3H/n5zjAAkS/ABV6IGKJzGVHgdEgbE+IHdvVoEymzOY9X CCS79u20mhh+qgmflehUiePHs8HlWTrjWL17aAOJ9XEG9D/gO6C8DCKtzrIpOK7TqFYM HmGounEK55IPhxO89Q6UHJrRdPgi1k5Pty3SdZwyiZ6KFQDqZcHxojfMPnWJYRj23Pt/ B7oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Lq3tyrIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a170902d10100b0016bedb87daasi12496057plw.437.2022.07.25.03.20.40; Mon, 25 Jul 2022 03:20:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Lq3tyrIy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233967AbiGYKOg (ORCPT + 99 others); Mon, 25 Jul 2022 06:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbiGYKOe (ORCPT ); Mon, 25 Jul 2022 06:14:34 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B49B164ED; Mon, 25 Jul 2022 03:14:33 -0700 (PDT) Received: from zn.tnic (p200300ea972976f8329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9729:76f8:329c:23ff:fea6:a903]) (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 EA3AC1EC02AD; Mon, 25 Jul 2022 12:14:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1658744067; 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=UG3HyB+a1rEuod/npdxD9V9DqUguu9NB6mUos5iP184=; b=Lq3tyrIyax/V1WQYaRZGfpC21SBrLPnzksuggi9y9EcQCe2hA531lfI3iR6Bt3zL+gvQXB O6eRlG9m/yKACmGBma6zMLOGHb4J6Z87JoXhkWLUKft/IuJ2iYQHZmSxOynoRUYMk2bmCR eF4lXkhsCgLg9j+hESxedamBcCdpqbo= Date: Mon, 25 Jul 2022 12:14:21 +0200 From: Borislav Petkov To: Robert Richter Cc: Toshi Kani , mchehab@kernel.org, elliott@hpe.com, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] EDAC/ghes: Fix buffer overflow in ghes_edac_register() Message-ID: References: <20220721180503.896050-1-toshi.kani@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 25, 2022 at 11:53:06AM +0200, Robert Richter wrote: > The dimm->label buffer must be pre-initialized zero. This broke with: > > b9cae27728d1 EDAC/ghes: Scan the system once on driver init > > since krealloc/krealloc_array() does not zero out the new allocated > buffer for struct dimm_info in enumerate_dimms(). This uninitialized > broken struct is then copied in ghes_edac_register() to the final > dimm_info destination. Originally, before b9cae27728d1, the struct was > zero initialized with kzalloc'ed by edac_mc_alloc() and directly used. > Now, that a copy is created first, this copy must be also zero > initialized. > > IMO this is the proper fix: Maybe, but this needs fixing too: /* both strings must be non-zero */ if (bank && *bank && device && *device) Obviously one of those strings are zero coming from that BIOS... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette