From: Dinh Nguyen <dinguyen@kernel.org>
To: bp@alien8.de, tony.luck@intel.com
Cc: dinguyen@kernel.org, rounakdas2025@gmail.com,
niravkumar.l.rabara@altera.com, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCHv3 3/4] EDAC/altera: Fix code leak on dci allocation failure
Date: Fri, 14 Aug 2026 08:48:53 -0500 [thread overview]
Message-ID: <20260814134854.2397810-4-dinguyen@kernel.org> (raw)
In-Reply-To: <20260814134854.2397810-1-dinguyen@kernel.org>
sashiko reports: If devres_open_group() fails, the function returns -ENOMEM
without freeing the dci structure allocated earlier with edac_device_alloc_ctl_info().
Free the dci structure if devres_open_group() fails.
Fixes: c3eea1942a16 ("EDAC, altera: Add Altera L2 cache and OCRAM support")
Cc: stable@vger.kernel.org
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
v3: No changes
v2: reworked v1 to include only true sashiko hits
---
drivers/edac/altera_edac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index d8a3438fb5f44..ccdfb35178b69 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -1516,8 +1516,10 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
altdev = dci->pvt_info;
*altdev = *device;
- if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL))
+ if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL)) {
+ edac_device_free_ctl_info(dci);
return -ENOMEM;
+ }
/* Update PortB specific values */
altdev->edac_dev_name = ecc_name;
--
2.42.0.411.g813d9a9188
next prev parent reply other threads:[~2026-08-14 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 13:48 [PATCHv3 0/4] EDAC/altera: Address sashiko reviews part 1(v3) Dinh Nguyen
2026-08-14 13:48 ` [PATCHv3 1/4] EDAC/altera: Do not allow driver unbinding Dinh Nguyen
2026-08-14 13:48 ` [PATCHv3 2/4] EDAC/altera: Drop __init from ECC setup paths for re-probe safety Dinh Nguyen
2026-08-14 13:48 ` Dinh Nguyen [this message]
2026-08-14 13:48 ` [PATCHv3 4/4] EDAC/altera: Fix use-after-free in error paths Dinh Nguyen
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=20260814134854.2397810-4-dinguyen@kernel.org \
--to=dinguyen@kernel.org \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=niravkumar.l.rabara@altera.com \
--cc=rounakdas2025@gmail.com \
--cc=stable@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.