Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] libusb: fix descriptor parsing
@ 2021-05-09  4:37 noarchwastaken
  2021-05-09 20:38 ` [PR PATCH] [Merged]: " ericonr
  0 siblings, 1 reply; 2+ messages in thread
From: noarchwastaken @ 2021-05-09  4:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]

There is a new pull request by noarchwastaken against master on the void-packages repository

https://github.com/noarchwastaken/void-packages libusb
https://github.com/void-linux/void-packages/pull/30757

libusb: fix descriptor parsing
backported upstream commit
<https://github.com/libusb/libusb/commit/f6d2cb56>

which fixes a regression for multi-configuration devices, e.g. iPhone.

Many other distros have backported this fix, since the bug prevents all iOS devices from connecting.

https://changelogs.ubuntu.com/changelogs/pool/main/libu/libusb-1.0/libusb-1.0_1.0.24-3/changelog
https://koji.fedoraproject.org/koji/buildinfo?buildID=1712858
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/30757.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libusb-30757.patch --]
[-- Type: text/x-diff, Size: 2417 bytes --]

From ab12a88beeceb7f025658e7a8857a9f2545a16ba Mon Sep 17 00:00:00 2001
From: noarchwastaken <noarch@n0ar.ch>
Date: Sun, 9 May 2021 00:25:44 -0400
Subject: [PATCH] libusb: fix descriptor parsing

backported upstream commit
<https://github.com/libusb/libusb/commit/f6d2cb56>

which fixes a regression for multi-configuration devices, e.g. iPhone.
---
 .../patches/fix-descriptor-parsing.patch      | 35 +++++++++++++++++++
 srcpkgs/libusb/template                       |  2 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libusb/patches/fix-descriptor-parsing.patch

diff --git a/srcpkgs/libusb/patches/fix-descriptor-parsing.patch b/srcpkgs/libusb/patches/fix-descriptor-parsing.patch
new file mode 100644
index 000000000000..41b78b7348b3
--- /dev/null
+++ b/srcpkgs/libusb/patches/fix-descriptor-parsing.patch
@@ -0,0 +1,35 @@
+--- libusb/os/linux_usbfs.c
++++ libusb/os/linux_usbfs.c
+@@ -641,7 +641,12 @@ static int seek_to_next_config(struct libusb_context *ctx,
+ 	uint8_t *buffer, size_t len)
+ {
+ 	struct usbi_descriptor_header *header;
+-	int offset = 0;
++	int offset;
++
++	/* Start seeking past the config descriptor */
++	offset = LIBUSB_DT_CONFIG_SIZE;
++	buffer += LIBUSB_DT_CONFIG_SIZE;
++	len -= LIBUSB_DT_CONFIG_SIZE;
+ 
+ 	while (len > 0) {
+ 		if (len < 2) {
+@@ -718,7 +723,7 @@ static int parse_config_descriptors(struct libusb_device *dev)
+ 		}
+ 
+ 		if (priv->sysfs_dir) {
+-			 /*
++			/*
+ 			 * In sysfs wTotalLength is ignored, instead the kernel returns a
+ 			 * config descriptor with verified bLength fields, with descriptors
+ 			 * with an invalid bLength removed.
+@@ -727,8 +732,7 @@ static int parse_config_descriptors(struct libusb_device *dev)
+ 			int offset;
+ 
+ 			if (num_configs > 1 && idx < num_configs - 1) {
+-				offset = seek_to_next_config(ctx, buffer + LIBUSB_DT_CONFIG_SIZE,
+-							     remaining - LIBUSB_DT_CONFIG_SIZE);
++				offset = seek_to_next_config(ctx, buffer, remaining);
+ 				if (offset < 0)
+ 					return offset;
+ 				sysfs_config_len = (uint16_t)offset;
diff --git a/srcpkgs/libusb/template b/srcpkgs/libusb/template
index 1f2036d0ecad..8c5ff6054eed 100644
--- a/srcpkgs/libusb/template
+++ b/srcpkgs/libusb/template
@@ -1,7 +1,7 @@
 # Template file for 'libusb'
 pkgname=libusb
 version=1.0.24
-revision=1
+revision=2
 build_style=gnu-configure
 hostmakedepends="pkg-config"
 makedepends="eudev-libudev-devel"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR PATCH] [Merged]: libusb: fix descriptor parsing
  2021-05-09  4:37 [PR PATCH] libusb: fix descriptor parsing noarchwastaken
@ 2021-05-09 20:38 ` ericonr
  0 siblings, 0 replies; 2+ messages in thread
From: ericonr @ 2021-05-09 20:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

There's a merged pull request on the void-packages repository

libusb: fix descriptor parsing
https://github.com/void-linux/void-packages/pull/30757

Description:
backported upstream commit
<https://github.com/libusb/libusb/commit/f6d2cb56>

which fixes a regression for multi-configuration devices, e.g. iPhone.

Many other distros have backported this fix, since the bug prevents all iOS devices from connecting.

https://changelogs.ubuntu.com/changelogs/pool/main/libu/libusb-1.0/libusb-1.0_1.0.24-3/changelog
https://koji.fedoraproject.org/koji/buildinfo?buildID=1712858
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [x] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-09 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09  4:37 [PR PATCH] libusb: fix descriptor parsing noarchwastaken
2021-05-09 20:38 ` [PR PATCH] [Merged]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).