Re: [PATCH 8/8] USB: serial: fix minor-number allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > ---
> >  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@xxxxxxxxxxxxxxxxxxx>
> 
> to them all if you want.

Thanks. All now applied.

Johan
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]