[PARISC] Fix double free when removing HIL drivers

On Thu, Mar 30, 2006 at 08:31:02AM -0500, Dmitry Torokhov wrote:
> Don't do that, its double free. input_unregister_device() normally
> causes release() to be called and free the device. input_free_device
> is only to be called when input_register_device has not been called or
> failed.
>
> Plus you might want to unregister device after closing serio port,
> otherwise your interrupt routine might be referencing already freed
> memory.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
Kyle McMartin 2006-03-30 11:47:32 -05:00 committed by Kyle McMartin
parent 4da9f131a7
commit cd7a9202a5
3 changed files with 2 additions and 5 deletions

View File

@ -240,9 +240,8 @@ static void hil_kbd_disconnect(struct serio *serio)
return;
}
input_unregister_device(kbd->dev);
serio_close(serio);
input_free_device(kbd->dev);
input_unregister_device(kbd->dev);
kfree(kbd);
}

View File

@ -334,7 +334,6 @@ static void __exit hil_exit(void)
input_unregister_device(hil_dev.dev);
input_free_device(hil_dev.dev);
hil_dev.dev = NULL;
#if defined(CONFIG_PARISC)

View File

@ -233,9 +233,8 @@ static void hil_ptr_disconnect(struct serio *serio)
return;
}
input_unregister_device(ptr->dev);
serio_close(serio);
input_free_device(ptr->dev);
input_unregister_device(ptr->dev);
kfree(ptr);
}