Skip to contentSkip to conversation

Avoid usb reset crashes by making tty_io cdevs truly dynamic

PATCH New Richard Watts 1 participant 1 message May 19, 2015

lore
Share & tools
lore
#0 lore raw

cover Avoid usb reset crashes by making tty_io cdevs truly dynamic

Sometimes, usb buses on which CDC ACM devices sit encounter a usb reset.

When this happens, particularly when CONFIG_DEBUG_KOBJECT_RELEASE is on, we attempt to destroy the cdev for the associated tty and then rapidly re-initialise it. Since kobject destruction is not immediate, this potentially leaves us with cdev_init() calling kobject_init() on a kobject that is about to be destroyed.

This turns out not to be such a good thing and this patch solves the problem by making the cdevs tty_operations->cdevs dynamically allocated.

This may not be a problem in the wild (though I have some circumstantial evidence that it is), but I submit that we might want to think about fixing it anyway, since it makes debugging on systems with CONFIG_DEBUG_KOBJECT_RELEASE=y and USB resets rather difficult (guess what I have been doing lately .. ).

Patch is against e26081808edadfd257c6c9d81014e3b25e9a6118 (head of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git ).

(in fact, you will still get an oops - which is the subject of
another, more controversial, patchset ..)

Richard.