Skip to content

Commit

Permalink
Staging: ipack/devices/ipoctal: avoid kernel oops when uninstalling
Browse files Browse the repository at this point in the history
When uninstalling a device, there is a loop of calls that produces, at the end,
two calls to __ipoctal_remove() function with the same ipack_device argument.

The first time works fine, but the second will fail in tty_unregister_driver()

To avoid this situation, the call to __ipoctal_remove() it is done only from the
ipack bus driver and not from the ipack device driver.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Samuel Iglesias Gonsalvez authored and Greg Kroah-Hartman committed Jun 7, 2012
1 parent b2bc13c commit 597d473
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/staging/ipack/devices/ipoctal.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,6 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)

tty_unregister_driver(ipoctal->tty_drv);
put_tty_driver(ipoctal->tty_drv);

/* Tell the carrier board to free all the resources for this device */
if (ipoctal->dev->bus->ops->remove_device != NULL)
ipoctal->dev->bus->ops->remove_device(ipoctal->dev);

list_del(&ipoctal->list);
kfree(ipoctal);
}
Expand Down Expand Up @@ -889,7 +884,7 @@ static void __exit ipoctal_exit(void)
struct ipoctal *p, *next;

list_for_each_entry_safe(p, next, &ipoctal_list, list)
__ipoctal_remove(p);
p->dev->bus->ops->remove_device(p->dev);

ipack_driver_unregister(&driver);
}
Expand Down

0 comments on commit 597d473

Please sign in to comment.