From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f51.google.com ([209.85.215.51]:33595 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750955AbcEJHpm (ORCPT ); Tue, 10 May 2016 03:45:42 -0400 Date: Tue, 10 May 2016 09:45:41 +0200 From: Johan Hovold To: Greg KH Cc: Johan Hovold , linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 8/8] USB: serial: fix minor-number allocation Message-ID: <20160510074541.GE30924@localhost> References: <1462730883-9025-1-git-send-email-johan@kernel.org> <1462730883-9025-9-git-send-email-johan@kernel.org> <20160509052627.GA4734@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160509052627.GA4734@kroah.com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, May 09, 2016 at 07:26:27AM +0200, Greg Kroah-Hartman wrote: > On Sun, May 08, 2016 at 08:08:03PM +0200, Johan Hovold wrote: > > Due to a missing upper bound, invalid minor numbers could be assigned to > > ports. Such devices would later fail to register, but let's catch this > > early as intended and avoid having devices with only a subset of their > > ports registered (potentially the empty set). > > > > Signed-off-by: Johan Hovold > > --- > > drivers/usb/serial/usb-serial.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c > > index 7ecf4ff86b9a..4d2b310de55d 100644 > > --- a/drivers/usb/serial/usb-serial.c > > +++ b/drivers/usb/serial/usb-serial.c > > @@ -96,7 +96,8 @@ static int allocate_minors(struct usb_serial *serial, int num_ports) > > mutex_lock(&table_lock); > > for (i = 0; i < num_ports; ++i) { > > port = serial->port[i]; > > - minor = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL); > > + minor = idr_alloc(&serial_minors, port, 0, > > + USB_SERIAL_TTY_MINORS, GFP_KERNEL); > > if (minor < 0) > > goto error; > > port->minor = minor; > > Nice catch for this one, and all the others in this series. > > Feel free to add: > Acked-by: Greg Kroah-Hartman > > to them all if you want. Thanks. All now applied. Johan