Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934008AbcK2Pfc (ORCPT ); Tue, 29 Nov 2016 10:35:32 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36393 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933940AbcK2PfW (ORCPT ); Tue, 29 Nov 2016 10:35:22 -0500 Date: Tue, 29 Nov 2016 16:35:10 +0100 From: Johan Hovold To: Pan Bian Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] usb: abort on exception path Message-ID: <20161129153510.GE29872@localhost> References: <1480424015-24930-1-git-send-email-bianpan2016@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1480424015-24930-1-git-send-email-bianpan2016@163.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 41 On Tue, Nov 29, 2016 at 08:53:35PM +0800, Pan Bian wrote: > 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 Thanks for the patch. It turns out there were more issues with the error handling in this function; for example, the URBs submitted by generic_open were never stopped on failure to read the line status a bit further down. I fixed that up and rebased your patch on top. I'll post both patches to the list shortly. And next time, please include which driver you are changing in the patch summary and not just the subsystem prefix (e.g. use "USB: serial: kl5kusb105: ..."). > --- > 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__); Thanks, Johan