Linux EDAC development
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Robert Richter <rric@kernel.org>
Cc: Toshi Kani <toshi.kani@hpe.com>,
	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()
Date: Mon, 25 Jul 2022 12:14:21 +0200	[thread overview]
Message-ID: <Yt5s/f/jyRcFY1Md@zn.tnic> (raw)
In-Reply-To: <Yt5oAjbZ5Koy9v5i@rric.localdomain>

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

  reply	other threads:[~2022-07-25 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 18:05 [PATCH v2] EDAC/ghes: Fix buffer overflow in ghes_edac_register() Toshi Kani
2022-07-22 13:20 ` Borislav Petkov
2022-07-22 15:24   ` Kani, Toshi
2022-07-25  9:53   ` Robert Richter
2022-07-25 10:14     ` Borislav Petkov [this message]
2022-07-25 10:45       ` Robert Richter
2022-07-25 11:09         ` Robert Richter
2022-07-25 11:23           ` Borislav Petkov
2022-07-25 11:30             ` Robert Richter
2022-07-25 12:54               ` Borislav Petkov
2022-07-25 16:41             ` Kani, Toshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yt5s/f/jyRcFY1Md@zn.tnic \
    --to=bp@alien8.de \
    --cc=elliott@hpe.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=toshi.kani@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox