<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/drivers/net/usb/ipheth.c, branch jd/bump-compilers</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/drivers/net/usb/ipheth.c?h=jd%2Fbump-compilers</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/drivers/net/usb/ipheth.c?h=jd%2Fbump-compilers'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-08-09T12:54:21Z</updated>
<entry>
<title>usbnet: ipheth: fix carrier detection in modes 1 and 4</title>
<updated>2024-08-09T12:54:21Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=67927a1b255d883881be9467508e0af9a5e0be9d'/>
<id>urn:sha1:67927a1b255d883881be9467508e0af9a5e0be9d</id>
<content type='text'>
Apart from the standard "configurations", "interfaces" and "alternate
interface settings" in USB, iOS devices also have a notion of
"modes". In different modes, the device exposes a different set of
available configurations.

Depending on the iOS version, and depending on the current mode, the
length and contents of the carrier state control message differs:

* 1 byte (seen on iOS 4.2.1, 8.4):
    * 03: carrier off (mode 0)
    * 04: carrier on (mode 0)
* 3 bytes (seen on iOS 10.3.4, 15.7.6):
    * 03 03 03: carrier off (mode 0)
    * 04 04 03: carrier on (mode 0)
* 4 bytes (seen on iOS 16.5, 17.6):
    * 03 03 03 00: carrier off (mode 0)
    * 04 03 03 00: carrier off (mode 1)
    * 06 03 03 00: carrier off (mode 4)
    * 04 04 03 04: carrier on (mode 0 and 1)
    * 06 04 03 04: carrier on (mode 4)

Before this change, the driver always used the first byte of the
response to determine carrier state.

From this larger sample, the first byte seems to indicate the number of
available USB configurations in the current mode (with the exception of
the default mode 0), and in some cases (namely mode 1 and 4) does not
correlate with the carrier state.

Previous logic erroneously counted `04 03 03 00` as "carrier on" and
`06 04 03 04` as "carrier off" on iOS versions that support mode 1 and
mode 4 respectively.

Only modes 0, 1 and 4 expose the USB Ethernet interfaces necessary for
the ipheth driver.

Check the second byte of the control message where possible, and fall
back to checking the first byte on older iOS versions.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Tested-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: do not stop RX on failing RX callback</title>
<updated>2024-08-09T12:54:21Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=74efed51e0a4d62f998f806c307778b47fc73395'/>
<id>urn:sha1:74efed51e0a4d62f998f806c307778b47fc73395</id>
<content type='text'>
RX callbacks can fail for multiple reasons:

* Payload too short
* Payload formatted incorrecly (e.g. bad NCM framing)
* Lack of memory

None of these should cause the driver to seize up.

Make such failures non-critical and continue processing further
incoming URBs.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: drop RX URBs with no payload</title>
<updated>2024-08-09T12:54:20Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=94d7eeb6c0ef0310992944f0d0296929816a2cb0'/>
<id>urn:sha1:94d7eeb6c0ef0310992944f0d0296929816a2cb0</id>
<content type='text'>
On iPhone 15 Pro Max one can observe periodic URBs with no payload
on the "bulk in" (RX) endpoint. These don't seem to do anything
meaningful. Reproduced on iOS 17.5.1 and 17.6.

This behaviour isn't observed on iPhone 11 on the same iOS version. The
nature of these zero-length URBs is so far unknown.

Drop RX URBs with no payload.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: remove extraneous rx URB length check</title>
<updated>2024-08-09T12:54:20Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=655b46d7a39ac6f049698b27c1568c0f7ff85d1e'/>
<id>urn:sha1:655b46d7a39ac6f049698b27c1568c0f7ff85d1e</id>
<content type='text'>
Rx URB length was already checked in ipheth_rcvbulk_callback_legacy()
and ipheth_rcvbulk_callback_ncm(), depending on the current mode.
The check in ipheth_rcvbulk_callback() was thus mostly a duplicate.

The only place in ipheth_rcvbulk_callback() where we care about the URB
length is for the initial control frame. These frames are always 4 bytes
long. This has been checked as far back as iOS 4.2.1 on iPhone 3G.

Remove the extraneous URB length check. For control frames, check for
the specific 4-byte length instead.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Tested-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: race between ipheth_close and error handling</title>
<updated>2024-08-09T12:54:20Z</updated>
<author>
<name>Oliver Neukum</name>
<email>oneukum@suse.com</email>
</author>
<published>2024-08-06T17:28:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e5876b088ba03a62124266fa20d00e65533c7269'/>
<id>urn:sha1:e5876b088ba03a62124266fa20d00e65533c7269</id>
<content type='text'>
ipheth_sndbulk_callback() can submit carrier_work
as a part of its error handling. That means that
the driver must make sure that the work is cancelled
after it has made sure that no more URB can terminate
with an error condition.

Hence the order of actions in ipheth_close() needs
to be inverted.

Signed-off-by: Oliver Neukum &lt;oneukum@suse.com&gt;
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Tested-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: add CDC NCM support</title>
<updated>2023-06-09T09:26:57Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2023-06-07T13:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=a2d274c62e44b1995c170595db3865c6fe701226'/>
<id>urn:sha1:a2d274c62e44b1995c170595db3865c6fe701226</id>
<content type='text'>
Recent iOS releases support CDC NCM encapsulation on RX. This mode is
the default on macOS and Windows. In this mode, an iOS device may include
one or more Ethernet frames inside a single URB.

Freshly booted iOS devices start in legacy mode, but are put into
NCM mode by the official Apple driver. When reconnecting such a device
from a macOS/Windows machine to a Linux host, the device stays in
NCM mode, making it unusable with the legacy ipheth driver code.

To correctly support such a device, the driver has to either support
the NCM mode too, or put the device back into legacy mode.

To match the behaviour of the macOS/Windows driver, and since there
is no documented control command to revert to legacy mode, implement
NCM support. The device is attempted to be put into NCM mode by default,
and falls back to legacy mode if the attempt fails.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Tested-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: transmit URBs without trailing padding</title>
<updated>2023-06-09T09:26:57Z</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2023-06-07T13:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=3e65efcca87a9bb5f3b864e0a43d167bc0a8688c'/>
<id>urn:sha1:3e65efcca87a9bb5f3b864e0a43d167bc0a8688c</id>
<content type='text'>
The behaviour of the official iOS tethering driver on macOS is to not
transmit any trailing padding at the end of URBs. This is applicable
to both NCM and legacy modes, including older devices.

Adapt the driver to not include trailing padding in TX URBs, matching
the behaviour of the official macOS driver.

Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Tested-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: fix risk of NULL pointer deallocation</title>
<updated>2023-06-09T09:26:57Z</updated>
<author>
<name>Georgi Valkov</name>
<email>gvalkov@gmail.com</email>
</author>
<published>2023-06-07T13:56:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=2203718c2f59ffdd6c78d54e5add594aebb4461e'/>
<id>urn:sha1:2203718c2f59ffdd6c78d54e5add594aebb4461e</id>
<content type='text'>
The cleanup precedure in ipheth_probe will attempt to free a
NULL pointer in dev-&gt;ctrl_buf if the memory allocation for
this buffer is not successful. While kfree ignores NULL pointers,
and the existing code is safe, it is a better design to rearrange
the goto labels and avoid this.

Signed-off-by: Georgi Valkov &lt;gvalkov@gmail.com&gt;
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback</title>
<updated>2022-02-02T04:25:38Z</updated>
<author>
<name>Georgi Valkov</name>
<email>gvalkov@abv.bg</email>
</author>
<published>2022-02-01T07:16:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=63e4b45c82ed1bde979da7052229a4229ce9cabf'/>
<id>urn:sha1:63e4b45c82ed1bde979da7052229a4229ce9cabf</id>
<content type='text'>
When rx_buf is allocated we need to account for IPHETH_IP_ALIGN,
which reduces the usable size by 2 bytes. Otherwise we have 1512
bytes usable instead of 1514, and if we receive more than 1512
bytes, ipheth_rcvbulk_callback is called with status -EOVERFLOW,
after which the driver malfunctiones and all communication stops.

Resolves ipheth 2-1:4.2: ipheth_rcvbulk_callback: urb status: -75

Fixes: f33d9e2b48a3 ("usbnet: ipheth: fix connectivity with iOS 14")
Signed-off-by: Georgi Valkov &lt;gvalkov@abv.bg&gt;
Tested-by: Jan Kiszka &lt;jan.kiszka@siemens.com&gt;
Link: https://lore.kernel.org/all/B60B8A4B-92A0-49B3-805D-809A2433B46C@abv.bg/
Link: https://lore.kernel.org/all/24851bd2769434a5fc24730dce8e8a984c5a4505.1643699778.git.jan.kiszka@siemens.com/
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: usb: use eth_hw_addr_set()</title>
<updated>2021-10-02T13:18:25Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-01T21:32:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=1681371762335221b02cb9266ac1a8b05c16fdef'/>
<id>urn:sha1:1681371762335221b02cb9266ac1a8b05c16fdef</id>
<content type='text'>
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev-&gt;dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Convert usb drivers from memcpy(... ETH_ADDR) to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - memcpy(dev-&gt;dev_addr, np, ETH_ALEN)
  + eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
