public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: abort on exception path
@ 2016-11-29 12:53 Pan Bian
  2016-11-29 15:35 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-11-29 12:53 UTC (permalink / raw)
  To: Johan Hovold, linux-usb; +Cc: linux-kernel, Pan Bian

Function klsi_105_open() calls usb_control_msg() 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 exit;" when the call
to usb_control_msg() fails.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/usb/serial/kl5kusb105.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index fc5d3a7..068919f 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -311,6 +311,7 @@ static int  klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
 	if (rc < 0) {
 		dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc);
 		retval = rc;
+		goto exit;
 	} else
 		dev_dbg(&port->dev, "%s - enabled reading\n", __func__);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-29 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 12:53 [PATCH 1/1] usb: abort on exception path Pan Bian
2016-11-29 15:35 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox