USB: serial: kl5kusb105: abort on open exception path
authorPan Bian <bianpan2016@163.com>
Tue, 29 Nov 2016 15:55:02 +0000 (16:55 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:28 +0000 (02:18 +0000)
commit5664ec4a68d8796ff1c788b1247d7f58540a41f4
tree6576577fff845d732a9703e145843f79a018c8d4
parentc5f6a29717ed96ed79599005330f202e3d18862b
USB: serial: kl5kusb105: abort on open exception path

commit 3c3dd1e058cb01e835dcade4b54a6f13ffaeaf7c upstream.

Function klsi_105_open() calls usb_control_msg() (to "enable read") and
checks its return value. When the return value is unexpected, it only
assigns the error code to the return variable retval, but does not
terminate the exception path. This patch fixes the bug by inserting
"goto err_generic_close;" when the call to usb_control_msg() fails.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Pan Bian <bianpan2016@163.com>
[johan: rebase on prerequisite fix and amend commit message]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/serial/kl5kusb105.c