From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:52566 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbcEIF0a (ORCPT ); Mon, 9 May 2016 01:26:30 -0400 Date: Mon, 9 May 2016 07:26:27 +0200 From: Greg KH To: Johan Hovold Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 8/8] USB: serial: fix minor-number allocation Message-ID: <20160509052627.GA4734@kroah.com> References: <1462730883-9025-1-git-send-email-johan@kernel.org> <1462730883-9025-9-git-send-email-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462730883-9025-9-git-send-email-johan@kernel.org> Sender: stable-owner@vger.kernel.org List-ID: 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, greg k-h