<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/net/usb/ipheth.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-02-17T09:05:16+00:00</updated>
<entry>
<title>usbnet: ipheth: document scope of NCM implementation</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=829a5645616f3cf60f15fc6cab9a5e033e5b8170'/>
<id>urn:sha1:829a5645616f3cf60f15fc6cab9a5e033e5b8170</id>
<content type='text'>
commit be154b598fa54136e2be17d6dd13c8a8bc0078ce upstream.

Clarify that the "NCM" implementation in `ipheth` is very limited, as
iOS devices aren't compatible with the CDC NCM specification in regular
tethering mode.

For a standards-compliant implementation, one shall turn to
the `cdc_ncm` module.

Cc: stable@vger.kernel.org # 6.5.x
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: fix DPE OoB read</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5835bf66c50ac2b85ed28b282c2456c3516ef0a6'/>
<id>urn:sha1:5835bf66c50ac2b85ed28b282c2456c3516ef0a6</id>
<content type='text'>
commit ee591f2b281721171896117f9946fced31441418 upstream.

Fix an out-of-bounds DPE read, limit the number of processed DPEs to
the amount that fits into the fixed-size NDP16 header.

Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
Cc: stable@vger.kernel.org
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: break up NCM header size computation</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c0912ae6586e61d6b83755aed681c56f41eb33dd'/>
<id>urn:sha1:c0912ae6586e61d6b83755aed681c56f41eb33dd</id>
<content type='text'>
commit efcbc678a14be268040ffc1fa33c98faf2d55141 upstream.

Originally, the total NCM header size was computed as the sum of two
vaguely labelled constants. While accurate, it wasn't particularly clear
where they were coming from.

Use sizes of existing NCM structs where available. Define the total
NDP16 size based on the maximum amount of DPEs that can fit into the
iOS-specific fixed-size header.

This change does not fix any particular issue. Rather, it introduces
intermediate constants that will simplify subsequent commits.
It should also make it clearer for the reader where the constant values
come from.

Cc: stable@vger.kernel.org # 6.5.x
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: refactor NCM datagram loop</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf63d65ab9bb78a50f440ac9e59431e8e66de622'/>
<id>urn:sha1:cf63d65ab9bb78a50f440ac9e59431e8e66de622</id>
<content type='text'>
commit 2a9a196429e98fcc64078366c2679bc40aba5466 upstream.

Introduce an rx_error label to reduce repetitions in the header
signature checks.

Store wDatagramIndex and wDatagramLength after endianness conversion to
avoid repeated le16_to_cpu() calls.

Rewrite the loop to return on a null trailing DPE, which is required
by the CDC NCM spec. In case it is missing, fall through to rx_error.

This change does not fix any particular issue. Its purpose is to
simplify a subsequent commit that fixes a potential OoB read by limiting
the maximum amount of processed DPEs.

Cc: stable@vger.kernel.org # 6.5.x
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: check that DPE points past NCM header</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=387ec9277a9e74db5c28b0be74bb3e4db850fb75'/>
<id>urn:sha1:387ec9277a9e74db5c28b0be74bb3e4db850fb75</id>
<content type='text'>
commit 429fa68b58cefb9aa9de27e4089637298b46b757 upstream.

By definition, a DPE points at the start of a network frame/datagram.
Thus it makes no sense for it to point at anything that's part of the
NCM header. It is not a security issue, but merely an indication of
a malformed DPE.

Enforce that all DPEs point at the data portion of the URB, past the
NCM header.

Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
Cc: stable@vger.kernel.org
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: use static NDP16 location in URB</title>
<updated>2025-02-17T09:05:16+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf1ac7f7cf601ac31d1580559c002b5e37b733b7'/>
<id>urn:sha1:cf1ac7f7cf601ac31d1580559c002b5e37b733b7</id>
<content type='text'>
commit 86586dcb75cb8fd062a518aca8ee667938b91efb upstream.

Original code allowed for the start of NDP16 to be anywhere within the
URB based on the `wNdpIndex` value in NTH16. Only the start position of
NDP16 was checked, so it was possible for even the fixed-length part
of NDP16 to extend past the end of URB, leading to an out-of-bounds
read.

On iOS devices, the NDP16 header always directly follows NTH16. Rely on
and check for this specific format.

This, along with NCM-specific minimal URB length check that already
exists, will ensure that the fixed-length part of NDP16 plus a set
amount of DPEs fit within the URB.

Note that this commit alone does not fully address the OoB read.
The limit on the amount of DPEs needs to be enforced separately.

Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
Cc: stable@vger.kernel.org
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: fix possible overflow in DPE length check</title>
<updated>2025-02-17T09:05:15+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2025-01-25T23:54:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d677e7dd59ad6837496f5a02d8e5d39824278dfd'/>
<id>urn:sha1:d677e7dd59ad6837496f5a02d8e5d39824278dfd</id>
<content type='text'>
commit c219427ed296f94bb4b91d08626776dc7719ee27 upstream.

Originally, it was possible for the DPE length check to overflow if
wDatagramIndex + wDatagramLength &gt; U16_MAX. This could lead to an OoB
read.

Move the wDatagramIndex term to the other side of the inequality.

An existing condition ensures that wDatagramIndex &lt; urb-&gt;actual_length.

Fixes: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support")
Cc: stable@vger.kernel.org
Signed-off-by: Foster Snowhill &lt;forst@pen.gy&gt;
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usbnet: ipheth: fix carrier detection in modes 1 and 4</title>
<updated>2024-08-09T12:54:21+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:21+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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:20+00:00</updated>
<author>
<name>Foster Snowhill</name>
<email>forst@pen.gy</email>
</author>
<published>2024-08-06T17:28:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/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>
</feed>
