usb: hso: check for return value in hso_serial_common_create()
Subsystems (5)
PATCH 1/1 usb: hso: check for return value in hso_serial_common_create()
in case of an error tty_register_device_attr() returns ERR_PTR(), add IS_ERR() check
Reported-and-tested-by [email protected]
Signed-off-by Rustam Kovhaev <[email protected]>
--- drivers/net/usb/hso.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/usb/hso.c +4 -1
@@ -2261,12 +2261,14 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, minor =get_free_serial_index ();if (minor <0 ) - goto exit; + goto exit2;/* register our minor number */ serial->parent->dev =tty_port_register_device_attr (&serial->port, tty_drv, minor, &serial->parent->interface->dev, serial->parent, hso_serial_dev_groups); +if (IS_ERR (serial->parent->dev)) + goto exit2;/* fill in specific data for later use */ serial->minor = minor;
@@ -2311,6 +2313,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,return 0 ; exit:hso_serial_tty_unregister (serial); +exit2:hso_serial_common_free (serial);return -1 ; }
Signature · 1 line
2.27.0
Quoted 6 lines · Rustam Kovhaev
in case of an error
tty_register_device_attr()returnsERR_PTR(), addIS_ERR()checkReported-and-tested-by [email protected]Signed-off-by Rustam Kovhaev <[email protected]>
Looks good, thanks!
Reviewed-by Greg Kroah-Hartman <[email protected]>
From: Rustam Kovhaev <[email protected]>
Date: Mon, 27 Jul 2020 23:42:17 -0700
Quoted 6 lines
in case of an error
tty_register_device_attr()returnsERR_PTR(), addIS_ERR()checkReported-and-tested-by [email protected]Signed-off-by Rustam Kovhaev <[email protected]>
Applied, thank you.