lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMz4kuKAn=nEtCkjc6VBVkVbCf7CWYmgzBNHHcg59f=A3y93gg@mail.gmail.com>
Date:	Thu, 19 Nov 2015 14:48:38 +0800
From:	Baolin Wang <baolin.wang@...aro.org>
To:	Peter Hurley <peter@...leysoftware.com>
Cc:	Felipe Balbi <balbi@...com>, Greg KH <gregkh@...uxfoundation.org>,
	r.baldyga@...sung.com, fabio.estevam@...escale.com,
	Philip Oberstaller <Philip.Oberstaller@...tentrio.com>,
	scottwood@...escale.com, Mark Brown <broonie@...nel.org>,
	USB <linux-usb@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: gadget: Add the console support for usb-to-serial port

>
>> +{
>> +     struct gscons_info *info = gserial_cons.data;
>> +     int port_num = gserial_cons.index;
>> +     struct usb_request *req;
>> +     struct gs_port *port;
>> +     struct usb_ep *ep;
>> +
>> +     if (port_num >= MAX_U_SERIAL_PORTS || port_num < 0) {
>> +             pr_err("%s: port num [%d] exceeds the range.\n",
>> +                    __func__, port_num);
>> +             return -ENXIO;
>> +     }
>> +
>> +     port = ports[port_num].port;
>> +     if (!port) {
>> +             pr_err("%s: serial line [%d] not allocated.\n",
>> +                    __func__, port_num);
>> +             return -ENODEV;
>> +     }
>> +
>> +     if (!port->port_usb) {
>> +             pr_err("%s: no port usb.\n", __func__);
>> +             return -ENODEV;
>> +     }
>> +
>> +     ep = port->port_usb->in;
>> +     if (!ep) {
>> +             pr_err("%s: no usb endpoint.\n", __func__);
>> +             return -ENXIO;
>> +     }
>
> Looking at the caller, gserial_connect(), none of the error
> conditions above look possible.
>

I re-look the code and do some tests, I found the checking is
necessary. Cause we get the port number from the console->index, if
the cmdline is not set the ttyGS0 as the console, the console->index
will be -1 that is a wrong value. Also the serial.c file will create 1
usb-to-seial port as default (default n_ports = 1), so we need to
check the port and the endpoint of the port. So I think here checking
is necessary and I have tested it.



-- 
Baolin.wang
Best Regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ