Skip to content
Snippets Groups Projects
user avatar
Leon Yu authored
Commit a3a10ce3 ("Avoid usb reset crashes by making tty_io cdevs truly
dynamic") which mixes using cdev_alloc() and cdev_init() is problematic.
Subsequent call to cdev_init() after cdev_alloc() sets kobj release method
from cdev_dynamic_release() to cdev_default_release() and thus makes it
impossible to free allocated cdev.

This patch also consolidates error path of cdev_add() as cdev can also leak
here if things went wrong.

Signed-off-by: default avatarLeon Yu <chianglungyu@gmail.com>
Fixes: a3a10ce3 ("Avoid usb reset crashes by making tty_io cdevs truly dynamic")
Acked-by: default avatarRichard Watts <rrw@kynesim.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
c1a752ba
History