mdesc_update calling __init memory free code through a pointer at
non-init time. Since text page was already given back and reused
this results in an illegal instruction trap. Was not caught by
linker section mismatch checks due to pointer indirection.
This patch NULL's out mops pointer after __init time and then
checks for non-NULL before calling mops->free.
Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Acked-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit
6dbae4a0137d7855472c4845b5db11cffa32efc1)
(cherry picked from commit
f0673a413f04de21963ab7f3912eb9a84c52c66e)
static void mdesc_free(struct mdesc_handle *hp)
{
- hp->mops->free(hp);
+ if (hp->mops)
+ hp->mops->free(hp);
}
static struct mdesc_handle *cur_mdesc;
spin_lock_irqsave(&mdesc_lock, flags);
if (atomic_dec_and_test(&hp->refcnt)) {
list_del_init(&hp->list);
- hp->mops->free(hp);
+ mdesc_free(hp);
}
spin_unlock_irqrestore(&mdesc_lock, flags);
}
prom_halt();
}
+ /* current 'mops' pointers are dangerous if not __init code */
+ hp->mops = NULL;
cur_mdesc = hp;
report_platform_properties();