stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg KH <greg@kroah.com>
Cc: Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 8/8] USB: serial: fix minor-number allocation
Date: Tue, 10 May 2016 09:45:41 +0200	[thread overview]
Message-ID: <20160510074541.GE30924@localhost> (raw)
In-Reply-To: <20160509052627.GA4734@kroah.com>

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 <johan@kernel.org>
> > ---
> >  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 <gregkh@linuxfoundation.org>
> 
> to them all if you want.

Thanks. All now applied.

Johan

      reply	other threads:[~2016-05-10  7:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08 18:07 [PATCH 0/8] USB: serial: fix interface URB leaks and use-after-free Johan Hovold
2016-05-08 18:07 ` [PATCH 1/8] USB: serial: io_edgeport: fix memory leaks in attach error path Johan Hovold
2016-05-08 18:07 ` [PATCH 2/8] USB: serial: io_edgeport: fix memory leaks in probe " Johan Hovold
2016-05-08 18:07 ` [PATCH 3/8] USB: serial: keyspan: fix use-after-free " Johan Hovold
2016-05-08 18:07 ` [PATCH 4/8] USB: serial: keyspan: fix URB unlink Johan Hovold
2016-05-08 18:08 ` [PATCH 5/8] USB: serial: keyspan: fix debug and error messages Johan Hovold
2016-05-08 18:08 ` [PATCH 6/8] USB: serial: mxuport: fix use-after-free in probe error path Johan Hovold
2016-05-08 18:08 ` [PATCH 7/8] USB: serial: quatech2: " Johan Hovold
2016-05-08 18:08 ` [PATCH 8/8] USB: serial: fix minor-number allocation Johan Hovold
2016-05-09  5:26   ` Greg KH
2016-05-10  7:45     ` Johan Hovold [this message]

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=20160510074541.GE30924@localhost \
    --to=johan@kernel.org \
    --cc=greg@kroah.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).