svn commit: r367755 - head/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Tue Nov 17 10:27:42 UTC 2020
Author: andrew
Date: Tue Nov 17 10:27:42 2020
New Revision: 367755
URL: https://svnweb.freebsd.org/changeset/base/367755
Log:
Stop calling gic_v3_detach when we haven't called gic_v3_attach
The former tries to dereference memory allocated by the latter. If counting
the redistributor fails it may try to dereference memory that was never
allocated.
Sponsored by: Innovate UK
Modified:
head/sys/arm64/arm64/gic_v3_acpi.c
Modified: head/sys/arm64/arm64/gic_v3_acpi.c
==============================================================================
--- head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 10:17:18 2020 (r367754)
+++ head/sys/arm64/arm64/gic_v3_acpi.c Tue Nov 17 10:27:42 2020 (r367755)
@@ -262,7 +262,7 @@ gic_v3_acpi_attach(device_t dev)
err = gic_v3_acpi_count_regions(dev);
if (err != 0)
- goto error;
+ goto count_error;
err = gic_v3_attach(dev);
if (err != 0)
@@ -294,12 +294,13 @@ gic_v3_acpi_attach(device_t dev)
return (0);
error:
+ /* Failure so free resources */
+ gic_v3_detach(dev);
+count_error:
if (bootverbose) {
device_printf(dev,
"Failed to attach. Error %d\n", err);
}
- /* Failure so free resources */
- gic_v3_detach(dev);
return (err);
}
More information about the svn-src-all
mailing list