Bug 2368939

Summary: Double free in grub-core/loader/efi/chainloader.c
Product: [Fedora] Fedora Reporter: Thomas Frauendorfer <tf>
Component: grub2Assignee: Nicolas Frayer <nfrayer>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: lkundrak, lsandova, mlewando, nfrayer, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: grub2-2.12-32.fc42 grub2-2.12-25.fc41 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-06-21 01:27:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch fixing the problem
none
Patch v2 none

Description Thomas Frauendorfer 2025-05-28 12:01:02 UTC
The fail path in grub_cmd_chainloader calls grub_free(cmdline) in line 1190 and line 1197

The error was introduced in bf774366935874d59995f3649740c6d464d4762d 'Add secureboot support on efi chainloader'
where the second free call was added in as line 1107

The same issue also exists in other fedora versions that are based on Grub 2.12

Reproducible: Always

Comment 1 Thomas Frauendorfer 2025-05-28 12:02:31 UTC
Created attachment 2091898 [details]
Patch fixing the problem

Comment 2 Nicolas Frayer 2025-05-28 15:30:24 UTC
Hi Thomas,

Thanks for reporting this as well as the patch.
Please add a Signed-off-by and also a Reviewed-by: Nicolas Frayer <nfrayer>

Regards,

Nicolas

Comment 3 Thomas Frauendorfer 2025-05-28 15:59:11 UTC
Created attachment 2091928 [details]
Patch v2

Added signed-off and reviewed-by

Comment 4 Fedora Update System 2025-06-17 16:56:43 UTC
FEDORA-2025-b0ae534a31 (grub2-2.12-32.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-b0ae534a31

Comment 5 Fedora Update System 2025-06-19 01:43:26 UTC
FEDORA-2025-b0ae534a31 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-b0ae534a31`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-b0ae534a31

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2025-06-19 13:34:28 UTC
FEDORA-2025-eb145f3cb9 (grub2-2.12-25.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb145f3cb9

Comment 7 Fedora Update System 2025-06-21 01:27:26 UTC
FEDORA-2025-b0ae534a31 (grub2-2.12-32.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2025-06-21 02:24:10 UTC
FEDORA-2025-eb145f3cb9 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-eb145f3cb9`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb145f3cb9

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2025-06-24 01:05:05 UTC
FEDORA-2025-eb145f3cb9 (grub2-2.12-25.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.