From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751795AbdFAQvb (ORCPT ); Thu, 1 Jun 2017 12:51:31 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:32889 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdFAPnV (ORCPT ); Thu, 1 Jun 2017 11:43:21 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Johan Hovold" Date: Thu, 01 Jun 2017 16:40:55 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 096/101] USB: serial: omninet: fix reference leaks at open In-Reply-To: X-SA-Exim-Connect-IP: 82.70.136.246 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.89-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 30572418b445d85fcfe6c8fe84c947d2606767d8 upstream. This driver needlessly took another reference to the tty on open, a reference which was then never released on close. This lead to not just a leak of the tty, but also a driver reference leak that prevented the driver from being unloaded after a port had once been opened. Fixes: 4a90f09b20f4 ("tty: usb-serial krefs") Signed-off-by: Johan Hovold [bwh: Backported to 3.2: - The 'serial' variable is still needed for other initialisation - Adjust context] Signed-off-by: Ben Hutchings --- --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -171,14 +171,10 @@ static int omninet_attach(struct usb_ser static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - struct usb_serial_port *wport; int result = 0; dbg("%s - port %d", __func__, port->number); - wport = serial->port[1]; - tty_port_tty_set(&wport->port, tty); - /* Start reading from the device */ usb_fill_bulk_urb(port->read_urb, serial->dev, usb_rcvbulkpipe(serial->dev,