mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pan Bian <bianpan2016@163.com>
To: Johan Hovold <johan@kernel.org>, linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Pan Bian <bianpan2016@163.com>
Subject: [PATCH 1/1] usb: abort on exception path
Date: Tue, 29 Nov 2016 20:53:35 +0800	[thread overview]
Message-ID: <1480424015-24930-1-git-send-email-bianpan2016@163.com> (raw)

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

             reply	other threads:[~2016-11-29 13:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 12:53 Pan Bian [this message]
2016-11-29 15:35 ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480424015-24930-1-git-send-email-bianpan2016@163.com \
    --to=bianpan2016@163.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®