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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed,  7 Jun 2023 15:57:00 +0200
From: Foster Snowhill <forst@....gy>
To: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>
Cc: Georgi Valkov <gvalkov@...il.com>,
	Simon Horman <simon.horman@...igine.com>,
	Jan Kiszka <jan.kiszka@...mens.com>,
	linux-usb@...r.kernel.org,
	netdev@...r.kernel.org
Subject: [PATCH net-next v4 2/4] usbnet: ipheth: transmit URBs without trailing padding

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 <forst@....gy>
Tested-by: Georgi Valkov <gvalkov@...il.com>
---
Tested by Georgi Valkov on iPhone 3G (iOS 4.2.1), iPhone 4s (iOS 8.4),
iPhone 7 Plus (iOS 15.7.6).

Tested by Foster Snowhill on iPhone Xs Max (iOS 16.5).

Additionally both Georgi and Foster did USB traffic captures with the
devices above on macOS 13.4, this confirmed the macOS driver behaviour.

v4:
  No code change.
  Factored out from "usbnet: ipheth: add CDC NCM support".
v3: n/a
  Part of https://lore.kernel.org/netdev/20230527130309.34090-2-forst@pen.gy/
v2: n/a
  Part of https://lore.kernel.org/netdev/20230525194255.4516-2-forst@pen.gy/
v1: n/a
  Part of https://lore.kernel.org/netdev/20230516210127.35841-1-forst@pen.gy/
---
 drivers/net/usb/ipheth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 8875a3d0e..dd809e247 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -373,12 +373,10 @@ static netdev_tx_t ipheth_tx(struct sk_buff *skb, struct net_device *net)
 	}
 
 	memcpy(dev->tx_buf, skb->data, skb->len);
-	if (skb->len < IPHETH_BUF_SIZE)
-		memset(dev->tx_buf + skb->len, 0, IPHETH_BUF_SIZE - skb->len);
 
 	usb_fill_bulk_urb(dev->tx_urb, udev,
 			  usb_sndbulkpipe(udev, dev->bulk_out),
-			  dev->tx_buf, IPHETH_BUF_SIZE,
+			  dev->tx_buf, skb->len,
 			  ipheth_sndbulk_callback,
 			  dev);
 	dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ