Skip to content

Commit d3ac41b

Browse files
Lukasz NowakFelipe Balbi
authored andcommitted
usb: gadget: f_ecm: fix host mac address for multiple instances
In case there are multiple ecm instances, either for multiple otg controllers, or multiple virtual links using libcomposite, each instance needs to have its own host mac address string value for iMACAddress. Update the source array (ecm_string_defs), every time before usb_gstrings_attach(). Without that, all links wrongly were getting the same, last allocated, host mac address, rather than the correct one, as requested via configfs. Signed-off-by: Lukasz Nowak <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent eea5274 commit d3ac41b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/gadget/function/f_ecm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,8 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
705705
ecm_opts->bound = true;
706706
}
707707

708+
ecm_string_defs[1].s = ecm->ethaddr;
709+
708710
us = usb_gstrings_attach(cdev, ecm_strings,
709711
ARRAY_SIZE(ecm_string_defs));
710712
if (IS_ERR(us))
@@ -928,7 +930,6 @@ static struct usb_function *ecm_alloc(struct usb_function_instance *fi)
928930
mutex_unlock(&opts->lock);
929931
return ERR_PTR(-EINVAL);
930932
}
931-
ecm_string_defs[1].s = ecm->ethaddr;
932933

933934
ecm->port.ioport = netdev_priv(opts->net);
934935
mutex_unlock(&opts->lock);

0 commit comments

Comments
 (0)