2009-04-03 14:59:00

by Eugene T. Bordenkircher

[permalink] [raw]
Subject: Problem with f_rndis.c

The following is an artifact in f_rndis.c that is present because of the USB
gadget refactoring

679 rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
680 rndis_set_host_mac(rndis->config, rndis->ethaddr);
681
682 #if 0
683 // FIXME
684 if (rndis_set_param_vendor(rndis->config, vendorID,
685 manufacturer))
686 goto fail0;
687 #endif
688
689 /* NOTE: all that is done without knowing or caring about
690 * the network link ... which is unavailable to this code
691 * until we're activated via set_alt().

The bad news is that I'm hitting an oops because of it.

Newer versions of the windows rndis driver never seem to call
OID_GEN_VENDOR_DESCRIPTION so this isn't a problem. However, older versions of
XP SP2 and earlier machines still call this, and since the vendor string is
never set in rndis_per_dev_params(rndis.c) the kernel ends up SEGV'ing by
accessing the null pointer for the vendor string.

I played around with this for about 3-4 hours yesterday trying to get the
vendorID and manufacturer in some reasonable manner, but could not find a way
to backtrack to them.

Any suggestions to help me fix it? or even better solutions? :) I have plenty
of boxes that are oops'ing so I can test solutions as needed.

Eugene T. Bordenkircher


2009-04-03 20:44:14

by David Brownell

[permalink] [raw]
Subject: Re: Problem with f_rndis.c

On Friday 03 April 2009, Eugene T. Bordenkircher wrote:
> The following is an artifact in f_rndis.c that is present because of the USB
> gadget refactoring
>
> 679 rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
> 680 rndis_set_host_mac(rndis->config, rndis->ethaddr);
> 681
> 682 #if 0
> 683 // FIXME
> 684 if (rndis_set_param_vendor(rndis->config, vendorID,
> 685 manufacturer))
> 686 goto fail0;
> 687 #endif
> 688
> 689 /* NOTE: all that is done without knowing or caring about
> 690 * the network link ... which is unavailable to this code
> 691 * until we're activated via set_alt().
>
> The bad news is that I'm hitting an oops because of it.
>
> Newer versions of the windows rndis driver never seem to call
> OID_GEN_VENDOR_DESCRIPTION so this isn't a problem. However, older versions of
> XP SP2 and earlier machines still call this, and since the vendor string is
> never set in rndis_per_dev_params(rndis.c) the kernel ends up SEGV'ing by
> accessing the null pointer for the vendor string.
>
> I played around with this for about 3-4 hours yesterday trying to get the
> vendorID and manufacturer in some reasonable manner, but could not find a way
> to backtrack to them.
>
> Any suggestions to help me fix it? or even better solutions? :) I have plenty
> of boxes that are oops'ing so I can test solutions as needed.

Maybe just add more params to rndis_bind_config() and
call that code from there.