Thread (13 messages) flat view 13 messages, 4 authors, 2021-05-24

Re: [PATCH net v2] r8152: check the informaton of the device

From: Johan Hovold <johan@kernel.org>
Date: 2021-05-24 07:44:37
Also in: linux-usb, lkml

On Mon, May 24, 2021 at 01:49:33AM +0000, Hayes Wang wrote:
Johan Hovold [off-list ref]
quoted
Sent: Saturday, May 22, 2021 4:07 PM
[...]
quoted
quoted
quoted
+	if (usb_endpoint_num(in) != 1) {
+		dev_err(&intf->dev, "Invalid Rx Endpoint\n");
"Invalid number of Rx endpoints"
Here it is the endpoint number (address) that is being checked so
"number of" would be wrong.

That said, perhaps none of these checks are even needed a bit depending
on how the driver is implemented. That is, if it hardcodes the endpoint
addresses or uses the result from usb_find_common_endpoints() above
(which I realise now that it does not so these checks are probably still
needed).
The purpose of the checks is to find out the fake devices. That is, even
the device supports in, out, and interrupt endpoints, it is treated as
fake or malicious device, if the addresses of these endpoints are wrong.
Therefore, I would keep the checks.
Strictly, you need to check for bad input which could cause your driver
to crash or malfunction. Generally you don't need to verify endpoint
addresses unless the driver is hardcoding those. But since that is
precisely what this particular driver is doing, these checks indeed need
to stay.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help