Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-06 Thread Markus Kolb

David Miller wrote on 03.05.2012 07:11:

From: Markus Kolblinux-201...@tower-net.de
Date: Thu, 03 May 2012 06:57:39 +0200


I'll build it during next rainy day and will report its success
after some usage ;-)


Thank you.


Works without any problem for me.
So maybe this patch will be included in the official kernels before I'll 
buy a new mobile phone?! ;-)




--
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4fa64ecc.7030...@kolbs-net.de



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-06 Thread David Miller
From: Markus Kolb mar...@kolbs-net.de
Date: Sun, 06 May 2012 12:13:32 +0200

 David Miller wrote on 03.05.2012 07:11:
 From: Markus Kolblinux-201...@tower-net.de
 Date: Thu, 03 May 2012 06:57:39 +0200

 I'll build it during next rainy day and will report its success
 after some usage ;-)

 Thank you.
 
 Works without any problem for me.
 So maybe this patch will be included in the official kernels before
 I'll buy a new mobile phone?! ;-)

Applied.



-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20120506.131214.1140346395458072945.da...@davemloft.net



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-03 Thread Bjørn Mork
Jonathan Nieder jrnie...@gmail.com writes:

 Hi Iker,

 David Miller wrote:
 From: Bjørn Mork bj...@mork.no
 Date: Thu, 26 Apr 2012 14:35:10 +0200

 The same comments as for v1 regarding testing applies.  This is build
 tested only.  Should go through some functional testing before being
 applied.

 Well?  Is anyone gonna test this?

 Looks like it's up to you, unless some firmware upgrade already
 made the problem go away.

 It works like this:

  0. prerequisites:

   apt-get install git build-essential

  1. grab the kernel history, if you don't already have it:

   git clone \
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

  2. add point releases:

   cd linux
   git remote add stable \
 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
   git fetch stable

  3. configure, build, test:

   git checkout stable/linux-3.2.y
   cp /boot/config-$(uname -r) .config; # current configuration
   make localmodconfig; # optional: minimize configuration
   scripts/config --disable DEBUG_INFO
   make deb-pkg; # optionally with -jnum for parallel build
   dpkg -i ../name of package; # as root
   reboot
   ... test test test ...

Hopefully it reproduces the problem.  So:

  4. try the patch (attached):

   cd linux
   git am -3sc /path/to/the/patch
   make deb-pkg; # maybe with -j4
   dpkg -i ../name of package; # as root
   reboot
   ... test test test ...

Actually, given that this is a really minor change to a module and not
touching any externally visible interfaces at all, you can get away with
far less work for a simple verification test.

Do step 1 and 2, and then

apt-get install linux-headers-`uname -r`; # as root
git checkout stable/linux-3.2.y
git am -3sc /path/to/the/patch
make -C /lib/modules/`uname -r`/build SUBDIRS=`pwd`/drivers/net/usb 
cdc_ether.ko
# as root:
rmmod cdc_ether
insmod drivers/net/usb/cdc_ether.ko


No reboot required, and no need to build all the unmodified drivers.
All thanks to the excellent Debian kernel packages :-)



Bjørn



--
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87aa1p1685@nemi.mork.no



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-02 Thread Jonathan Nieder
Hi Iker,

David Miller wrote:
 From: Bjørn Mork bj...@mork.no
 Date: Thu, 26 Apr 2012 14:35:10 +0200

 The same comments as for v1 regarding testing applies.  This is build
 tested only.  Should go through some functional testing before being
 applied.

 Well?  Is anyone gonna test this?

Looks like it's up to you, unless some firmware upgrade already
made the problem go away.

It works like this:

 0. prerequisites:

apt-get install git build-essential

 1. grab the kernel history, if you don't already have it:

git clone \
  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

 2. add point releases:

cd linux
git remote add stable \
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch stable

 3. configure, build, test:

git checkout stable/linux-3.2.y
cp /boot/config-$(uname -r) .config; # current configuration
make localmodconfig; # optional: minimize configuration
scripts/config --disable DEBUG_INFO
make deb-pkg; # optionally with -jnum for parallel build
dpkg -i ../name of package; # as root
reboot
... test test test ...

   Hopefully it reproduces the problem.  So:

 4. try the patch (attached):

cd linux
git am -3sc /path/to/the/patch
make deb-pkg; # maybe with -j4
dpkg -i ../name of package; # as root
reboot
... test test test ...

If you get a chance to try it, please report the result to Dave by
replying-to-all to his message (i.e., not this one).  If you have any
questions, please don't hesitate to ask.

Thanks and hope that helps,
Jonathan
From: Bjørn Mork bj...@mork.no
Date: Thu, 26 Apr 2012 14:35:10 +0200
Subject: cdc_ether: Ignore bogus union descriptor for RNDIS devices

Some RNDIS devices include a bogus CDC Union descriptor pointing
to non-existing interfaces.  The RNDIS code is already prepared
to handle devices without a CDC Union descriptor by hardwiring
the driver to use interfaces 0 and 1, which is correct for the
devices with the bogus descriptor as well. So we can reuse the
existing workaround.

Cc: Markus Kolb linux-201...@tower-net.de
Cc: Iker Salmón San Millán sha...@esdebian.org
Cc: Jonathan Nieder jrnie...@gmail.com
Cc: Oliver Neukum oli...@neukum.org
Cc: 655...@bugs.debian.org
Cc: sta...@vger.kernel.org
Signed-off-by: Bjørn Mork bj...@mork.no
Signed-off-by: Jonathan Nieder jrnie...@gmail.com
---
 drivers/net/usb/cdc_ether.c |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 4fd41443a9b0..eac4886afc36 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct 
usb_interface *intf)
struct cdc_state*info = (void *) dev-data;
int status;
int rndis;
+   boolandroid_rndis_quirk = false;
struct usb_driver   *driver = driver_of(intf);
struct usb_cdc_mdlm_desc*desc = NULL;
struct usb_cdc_mdlm_detail_desc *detail = NULL;
@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct 
usb_interface *intf)
info-control,
info-u-bSlaveInterface0,
info-data);
+   /* fall back to hard-wiring for RNDIS */
+   if (rndis) {
+   android_rndis_quirk = true;
+   goto next_desc;
+   }
goto bad_desc;
}
if (info-control != intf) {
@@ -271,11 +277,15 @@ next_desc:
/* Microsoft ActiveSync based and some regular RNDIS devices lack the
 * CDC descriptors, so we'll hard-wire the interfaces and not check
 * for descriptors.
+*
+* Some Android RNDIS devices have a CDC Union descriptor pointing
+* to non-existing interfaces.  Ignore that and attempt the same
+* hard-wired 0 and 1 interfaces.
 */
-   if (rndis  !info-u) {
+   if (rndis  (!info-u || android_rndis_quirk)) {
info-control = usb_ifnum_to_if(dev-udev, 0);
info-data = usb_ifnum_to_if(dev-udev, 1);
-   if (!info-control || !info-data) {
+   if (!info-control || !info-data || info-control != intf) {
dev_dbg(intf-dev,
rndis: master #0/%p slave #1/%p\n,
info-control,
-- 
1.7.10.1



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-02 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Thu, 26 Apr 2012 14:35:10 +0200

 The same comments as for v1 regarding testing applies.  This is build
 tested only.  Should go through some functional testing before being
 applied.

Well?  Is anyone gonna test this?



--
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20120502.211411.560705499667456177.da...@davemloft.net



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-02 Thread Markus Kolb


David Miller da...@davemloft.net schrieb:

From: Bjørn Mork bj...@mork.no
Date: Thu, 26 Apr 2012 14:35:10 +0200

 The same comments as for v1 regarding testing applies.  This is build
 tested only.  Should go through some functional testing before being
 applied.

Well?  Is anyone gonna test this?

I'll build it during next rainy day and will report its success after some 
usage ;-)

Markus



--
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/01138af4-69c3-4adb-b7f6-1e5e6f471...@email.android.com



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-05-02 Thread David Miller
From: Markus Kolb linux-201...@tower-net.de
Date: Thu, 03 May 2012 06:57:39 +0200

 I'll build it during next rainy day and will report its success
 after some usage ;-)

Thank you.



-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20120503.011129.639700793389264897.da...@davemloft.net



Bug#655387: [PATCH net v2] cdc_ether: Ignore bogus union descriptor for RNDIS devices

2012-04-26 Thread Bjørn Mork
Some RNDIS devices include a bogus CDC Union descriptor pointing
to non-existing interfaces.  The RNDIS code is already prepared
to handle devices without a CDC Union descriptor by hardwiring
the driver to use interfaces 0 and 1, which is correct for the
devices with the bogus descriptor as well. So we can reuse the
existing workaround.

Cc: Markus Kolb linux-201...@tower-net.de
Cc: Iker Salmón San Millán sha...@esdebian.org
Cc: Jonathan Nieder jrnie...@gmail.com
Cc: Oliver Neukum oli...@neukum.org
Cc: 655...@bugs.debian.org
Cc: sta...@vger.kernel.org
Signed-off-by: Bjørn Mork bj...@mork.no
---
v2: adding a test to verify that the resulting control interface is the
probed interface, as suggested by Oliver Neukum

The same comments as for v1 regarding testing applies.  This is build
tested only.  Should go through some functional testing before being
applied.


Bjørn

 drivers/net/usb/cdc_ether.c |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 90a3002..00880ed 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct 
usb_interface *intf)
struct cdc_state*info = (void *) dev-data;
int status;
int rndis;
+   boolandroid_rndis_quirk = false;
struct usb_driver   *driver = driver_of(intf);
struct usb_cdc_mdlm_desc*desc = NULL;
struct usb_cdc_mdlm_detail_desc *detail = NULL;
@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct 
usb_interface *intf)
info-control,
info-u-bSlaveInterface0,
info-data);
+   /* fall back to hard-wiring for RNDIS */
+   if (rndis) {
+   android_rndis_quirk = true;
+   goto next_desc;
+   }
goto bad_desc;
}
if (info-control != intf) {
@@ -271,11 +277,15 @@ next_desc:
/* Microsoft ActiveSync based and some regular RNDIS devices lack the
 * CDC descriptors, so we'll hard-wire the interfaces and not check
 * for descriptors.
+*
+* Some Android RNDIS devices have a CDC Union descriptor pointing
+* to non-existing interfaces.  Ignore that and attempt the same
+* hard-wired 0 and 1 interfaces.
 */
-   if (rndis  !info-u) {
+   if (rndis  (!info-u || android_rndis_quirk)) {
info-control = usb_ifnum_to_if(dev-udev, 0);
info-data = usb_ifnum_to_if(dev-udev, 1);
-   if (!info-control || !info-data) {
+   if (!info-control || !info-data || info-control != intf) {
dev_dbg(intf-dev,
rndis: master #0/%p slave #1/%p\n,
info-control,
-- 
1.7.10




--
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1335443710-2627-1-git-send-email-bj...@mork.no