mcctrl: fix NULL pointer dereference for unbooted OS instance shutdown
This commit is contained in:
@ -129,11 +129,15 @@ error_cleanup_channels:
|
||||
|
||||
int mcctrl_os_shutdown_notifier(int os_index)
|
||||
{
|
||||
if (os[os_index]) {
|
||||
sysfsm_cleanup(os[os_index]);
|
||||
free_topology_info(os[os_index]);
|
||||
ihk_os_unregister_user_call_handlers(os[os_index], mcctrl_uc + os_index);
|
||||
destroy_ikc_channels(os[os_index]);
|
||||
procfs_exit(os_index);
|
||||
}
|
||||
|
||||
os[os_index] = NULL;
|
||||
|
||||
printk("mcctrl: OS ID %d shutdown event handled\n", os_index);
|
||||
return 0;
|
||||
@ -151,11 +155,16 @@ static struct ihk_os_notifier mcctrl_os_notifier = {
|
||||
static int __init mcctrl_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
#ifndef DO_USER_MODE
|
||||
mcctrl_syscall_init();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < OS_MAX_MINOR; ++i) {
|
||||
os[i] = NULL;
|
||||
}
|
||||
|
||||
rus_page_hash_init();
|
||||
|
||||
binfmt_mcexec_init();
|
||||
|
||||
@ -311,6 +311,11 @@ void destroy_ikc_channels(ihk_os_t os)
|
||||
int i;
|
||||
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
||||
|
||||
if (!usrdata) {
|
||||
printk("%s: WARNING: no mcctrl_usrdata found\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
ihk_host_os_set_usrdata(os, NULL);
|
||||
|
||||
for (i = 0; i < usrdata->num_channels; i++) {
|
||||
|
||||
@ -481,8 +481,9 @@ procfs_exit(int osnum)
|
||||
|
||||
down(&procfs_file_list_lock);
|
||||
e = find_base_entry(osnum);
|
||||
if(e)
|
||||
if (e) {
|
||||
delete_procfs_entries(e);
|
||||
}
|
||||
up(&procfs_file_list_lock);
|
||||
}
|
||||
|
||||
|
||||
@ -1232,9 +1232,16 @@ sysfsm_cleanup(ihk_os_t os)
|
||||
int error;
|
||||
ihk_device_t dev = ihk_os_to_dev(os);
|
||||
struct mcctrl_usrdata *udp = ihk_host_os_get_usrdata(os);
|
||||
struct sysfsm_data *sdp = &udp->sysfsm_data;
|
||||
struct sysfsm_data *sdp;
|
||||
struct sysfsm_node *np;
|
||||
|
||||
if (!udp) {
|
||||
printk("%s: WARNING: no mcctrl_usrdata found\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
sdp = &udp->sysfsm_data;
|
||||
|
||||
dprintk("mcctrl:sysfsm_cleanup(%p)\n", os);
|
||||
|
||||
if (sdp->sysfs_buf) {
|
||||
|
||||
@ -191,6 +191,11 @@ void free_topology_info(ihk_os_t os)
|
||||
{
|
||||
struct mcctrl_usrdata *udp = ihk_host_os_get_usrdata(os);
|
||||
|
||||
if (!udp) {
|
||||
printk("%s: WARNING: no mcctrl_usrdata found\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
free_node_topology(udp);
|
||||
free_cpu_topology(udp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user