USB: gadget: Replace %pK with %pM
commit 7d08f0c4e3b7c35e ("usb: gadget: replace %p with %pK") modifies the %pM (MAC address format specifier) as %pKM in usb drivers. when usb composition switch happens ecm function bind_config() access the invalid host's ethernet address and leads usb enumeration failure. Fix this by replace %pKM with %pM only for usb-eth module. Change-Id: I29364891fbdf381b5a6ea360ecdbe3ef237f24bd Signed-off-by: Arumuga Durai A <cadurai@codeaurora.org>
This commit is contained in:
parent
3a7e752617
commit
c173d5504d
5 changed files with 11 additions and 11 deletions
|
@ -2537,7 +2537,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
|
||||||
/* export host's Ethernet address in CDC format */
|
/* export host's Ethernet address in CDC format */
|
||||||
random_ether_addr(gsi->d_port.ipa_init_params.device_ethaddr);
|
random_ether_addr(gsi->d_port.ipa_init_params.device_ethaddr);
|
||||||
random_ether_addr(gsi->d_port.ipa_init_params.host_ethaddr);
|
random_ether_addr(gsi->d_port.ipa_init_params.host_ethaddr);
|
||||||
log_event_dbg("setting host_ethaddr=%pKM, device_ethaddr = %pKM",
|
log_event_dbg("setting host_ethaddr=%pM, device_ethaddr = %pM",
|
||||||
gsi->d_port.ipa_init_params.host_ethaddr,
|
gsi->d_port.ipa_init_params.host_ethaddr,
|
||||||
gsi->d_port.ipa_init_params.device_ethaddr);
|
gsi->d_port.ipa_init_params.device_ethaddr);
|
||||||
memcpy(gsi->ethaddr, &gsi->d_port.ipa_init_params.host_ethaddr,
|
memcpy(gsi->ethaddr, &gsi->d_port.ipa_init_params.host_ethaddr,
|
||||||
|
@ -2669,7 +2669,7 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
|
||||||
/* export host's Ethernet address in CDC format */
|
/* export host's Ethernet address in CDC format */
|
||||||
random_ether_addr(gsi->d_port.ipa_init_params.device_ethaddr);
|
random_ether_addr(gsi->d_port.ipa_init_params.device_ethaddr);
|
||||||
random_ether_addr(gsi->d_port.ipa_init_params.host_ethaddr);
|
random_ether_addr(gsi->d_port.ipa_init_params.host_ethaddr);
|
||||||
log_event_dbg("setting host_ethaddr=%pKM, device_ethaddr = %pKM",
|
log_event_dbg("setting host_ethaddr=%pM, device_ethaddr = %pM",
|
||||||
gsi->d_port.ipa_init_params.host_ethaddr,
|
gsi->d_port.ipa_init_params.host_ethaddr,
|
||||||
gsi->d_port.ipa_init_params.device_ethaddr);
|
gsi->d_port.ipa_init_params.device_ethaddr);
|
||||||
|
|
||||||
|
|
|
@ -1134,7 +1134,7 @@ ecm_qc_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
|
||||||
if (ecm->xport != USB_GADGET_XPORT_BAM2BAM_IPA)
|
if (ecm->xport != USB_GADGET_XPORT_BAM2BAM_IPA)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
pr_debug("setting ecm_ipa, host_ethaddr=%pKM, device_ethaddr=%pKM",
|
pr_debug("setting ecm_ipa, host_ethaddr=%pM, device_ethaddr=%pM",
|
||||||
ipa_params.host_ethaddr, ipa_params.device_ethaddr);
|
ipa_params.host_ethaddr, ipa_params.device_ethaddr);
|
||||||
status = ecm_ipa_init(&ipa_params);
|
status = ecm_ipa_init(&ipa_params);
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ usb_function *rndis_qc_bind_config_vendor(struct usb_function_instance *fi,
|
||||||
/* export host's Ethernet address in CDC format */
|
/* export host's Ethernet address in CDC format */
|
||||||
random_ether_addr(rndis_ipa_params.host_ethaddr);
|
random_ether_addr(rndis_ipa_params.host_ethaddr);
|
||||||
random_ether_addr(rndis_ipa_params.device_ethaddr);
|
random_ether_addr(rndis_ipa_params.device_ethaddr);
|
||||||
pr_debug("setting host_ethaddr=%pKM, device_ethaddr=%pKM\n",
|
pr_debug("setting host_ethaddr=%pM, device_ethaddr=%pM\n",
|
||||||
rndis_ipa_params.host_ethaddr,
|
rndis_ipa_params.host_ethaddr,
|
||||||
rndis_ipa_params.device_ethaddr);
|
rndis_ipa_params.device_ethaddr);
|
||||||
rndis_ipa_supported = true;
|
rndis_ipa_supported = true;
|
||||||
|
|
|
@ -971,8 +971,8 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g,
|
||||||
free_netdev(net);
|
free_netdev(net);
|
||||||
dev = ERR_PTR(status);
|
dev = ERR_PTR(status);
|
||||||
} else {
|
} else {
|
||||||
INFO(dev, "MAC %pKM\n", net->dev_addr);
|
INFO(dev, "MAC %pM\n", net->dev_addr);
|
||||||
INFO(dev, "HOST MAC %pKM\n", dev->host_mac);
|
INFO(dev, "HOST MAC %pM\n", dev->host_mac);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* two kinds of host-initiated state changes:
|
* two kinds of host-initiated state changes:
|
||||||
|
@ -1040,7 +1040,7 @@ int gether_register_netdev(struct net_device *net)
|
||||||
dev_dbg(&g->dev, "register_netdev failed, %d\n", status);
|
dev_dbg(&g->dev, "register_netdev failed, %d\n", status);
|
||||||
return status;
|
return status;
|
||||||
} else {
|
} else {
|
||||||
INFO(dev, "HOST MAC %pKM\n", dev->host_mac);
|
INFO(dev, "HOST MAC %pM\n", dev->host_mac);
|
||||||
|
|
||||||
/* two kinds of host-initiated state changes:
|
/* two kinds of host-initiated state changes:
|
||||||
* - iff DATA transfer is active, carrier is "on"
|
* - iff DATA transfer is active, carrier is "on"
|
||||||
|
@ -1056,7 +1056,7 @@ int gether_register_netdev(struct net_device *net)
|
||||||
if (status)
|
if (status)
|
||||||
pr_warn("cannot set self ethernet address: %d\n", status);
|
pr_warn("cannot set self ethernet address: %d\n", status);
|
||||||
else
|
else
|
||||||
INFO(dev, "MAC %pKM\n", dev->dev_mac);
|
INFO(dev, "MAC %pM\n", dev->dev_mac);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1124,7 @@ int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
dev = netdev_priv(net);
|
dev = netdev_priv(net);
|
||||||
snprintf(host_addr, len, "%pKm", dev->host_mac);
|
snprintf(host_addr, len, "%pM", dev->host_mac);
|
||||||
|
|
||||||
return strlen(host_addr);
|
return strlen(host_addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,8 +317,8 @@ int gether_qc_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
|
||||||
dev_dbg(&g->dev, "register_netdev failed, %d\n", status);
|
dev_dbg(&g->dev, "register_netdev failed, %d\n", status);
|
||||||
free_netdev(net);
|
free_netdev(net);
|
||||||
} else {
|
} else {
|
||||||
INFO(dev, "MAC %pKM\n", net->dev_addr);
|
INFO(dev, "MAC %pM\n", net->dev_addr);
|
||||||
INFO(dev, "HOST MAC %pKM\n", dev->host_mac);
|
INFO(dev, "HOST MAC %pM\n", dev->host_mac);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue