Message ID | 20161207190608.boi7svavwrkx3epm@breakpoint.cc (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Wed, 2016-12-07 at 20:06 +0100, Sebastian Andrzej Siewior wrote: > > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > drivers/acpi/cppc_acpi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c > index d0d0504b7c89..93252e5374c5 100644 > --- a/drivers/acpi/cppc_acpi.c > +++ b/drivers/acpi/cppc_acpi.c > @@ -803,6 +803,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) > if (addr) > iounmap(addr); > } > + per_cpu(cpc_desc_ptr, pr->id) = NULL; > kfree(cpc_ptr); > > out_buf_free: > @@ -824,6 +825,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr) > void __iomem *addr; > > cpc_ptr = per_cpu(cpc_desc_ptr, pr->id); > + if (!cpc_ptr) > + return; I agree that not handling null pointer here is a bug that should be fixed. The cpc_ptr is checked at other places like acpi_get_psd_map. We could potentially have a null cpc_ptr say when the parsing of CPC table failed. We should handle such cases gracefully. Tim -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index d0d0504b7c89..93252e5374c5 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -803,6 +803,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) if (addr) iounmap(addr); } + per_cpu(cpc_desc_ptr, pr->id) = NULL; kfree(cpc_ptr); out_buf_free: @@ -824,6 +825,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr) void __iomem *addr; cpc_ptr = per_cpu(cpc_desc_ptr, pr->id); + if (!cpc_ptr) + return; /* Free all the mapped sys mem areas for this CPU */ for (i = 2; i < cpc_ptr->num_entries; i++) {