From: Borislav Petkov <bp@alien8.de>
To: Eric-Terminal <ericterminal@gmail.com>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
Tony Luck <tony.luck@intel.com>,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
Yufan Chen <ericterminal@gmail.com>
Subject: Re: [PATCH] EDAC/versalnet: Fix resource leaks and NULL derefs in init_versalnet()
Date: Mon, 23 Feb 2026 13:47:29 +0000 [thread overview]
Message-ID: <6C330635-430F-408A-8AAE-F79DA2573417@alien8.de> (raw)
In-Reply-To: <20260222103918.90670-1-ericterminal@gmail.com>
On February 22, 2026 10:39:18 AM UTC, Eric-Terminal <ericterminal@gmail.com> wrote:
>From: Yufan Chen <ericterminal@gmail.com>
>
>init_versalnet() has several bugs in its error handling:
>
> - kzalloc() and kmalloc() return values are used without NULL checks,
> causing a NULL pointer dereference when allocation fails.
>
> - The cleanup loop uses while (i--) which skips the current failing
> index, leaking the resources already allocated for that slot.
>
> - edac_mc_del_mc() is called unconditionally during unwind, even for
> controllers that were never registered with edac_mc_add_mc().
>
> - sprintf() is used instead of snprintf() on a fixed-size buffer.
>
>Fix by adding NULL checks for dev and name allocations, replacing
>while (i--) with for (j = i; j >= 0; j--) to include the failing
>index, tracking successful edac_mc_add_mc() calls with a bool array,
>and switching to snprintf().
>
>Signed-off-by: Yufan Chen <ericterminal@gmail.com>
>---
> drivers/edac/versalnet_edac.c | 29 ++++++++++++++++++++++++-----
So that particular area of stinking goo is being dealt with here:
<https://lore.kernel.org/all/20251104093932.3838876-1-shubhrajyoti.datta@amd.com/T/#u>
And I'd usually say you can take the current diffs, productize them and send them after testing.
However, testing is the problem here - I highly doubt you have access to the hardware and Shubhrajyoti is probably one of small number of people who can test it.
Except that he's not really moving here - this particular issue has been outstanding for at least three months.
I'll ping him when I get back from vacation to see whether there's still interest in this driver or I can remove it for lack of support.
Oh well.
--
Small device. Typos and formatting crap
next prev parent reply other threads:[~2026-02-23 13:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-21 7:16 Eric-Terminal
2026-02-22 2:44 ` Borislav Petkov
[not found] ` <CAKNPVZA36XvT7R+QWTOTvAeQNA-sZfnG-h5jV3FnKvKOxqiGtA@mail.gmail.com>
[not found] ` <FE3C5380-E82B-4EC8-B1C0-16026CEEF8A2@alien8.de>
2026-02-22 10:39 ` Eric-Terminal
2026-02-23 13:47 ` Borislav Petkov [this message]
2026-02-23 14:58 ` Eric_Terminal
2026-02-26 6:54 ` Datta, Shubhrajyoti
2026-02-26 11:29 ` [PATCH v2] " Eric-Terminal
2026-02-26 12:59 ` Borislav Petkov
2026-02-26 16:52 ` Datta, Shubhrajyoti
2026-02-22 10:48 ` [PATCH] " Eric_Terminal
2026-02-23 8:54 ` Borislav Petkov
2026-02-23 10:08 ` Eric_Terminal
2026-02-23 10:40 ` Borislav Petkov
2026-02-23 10:52 ` Eric_Terminal
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=6C330635-430F-408A-8AAE-F79DA2573417@alien8.de \
--to=bp@alien8.de \
--cc=ericterminal@gmail.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shubhrajyoti.datta@amd.com \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®