mirror_ubuntu-kernels/drivers/usb/gadget/function
Konrad Gräfe 3c0f4f09c0 usb: gadget: u_ether: Fix host MAC address case
The CDC-ECM specification [1] requires to send the host MAC address as
an uppercase hexadecimal string in chapter "5.4 Ethernet Networking
Functional Descriptor":
    The Unicode character is chosen from the set of values 30h through
    39h and 41h through 46h (0-9 and A-F).

However, snprintf(.., "%pm", ..) generates a lowercase MAC address
string. While most host drivers are tolerant to this, UsbNcm.sys on
Windows 10 is not. Instead it uses a different MAC address with all
bytes set to zero including and after the first byte containing a
lowercase letter. On Windows 11 Microsoft fixed it, but apparently they
did not backport the fix.

This change fixes the issue by upper-casing the MAC to comply with the
specification.

[1]: https://www.usb.org/document-library/class-definitions-communication-devices-12, file ECM120.pdf

Fixes: bcd4a1c40b ("usb: gadget: u_ether: construct with default values and add setters/getters")
Cc: stable@vger.kernel.org
Signed-off-by: Konrad Gräfe <k.graefe@gateware.de>
Link: https://lore.kernel.org/r/20230505143640.443014-1-k.graefe@gateware.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-13 18:46:59 +09:00
..
f_acm.c USB: gadget: f_acm: use CDC defines 2022-07-25 10:57:42 +02:00
f_ecm.c usb: gadget: f_ecm: Add suspend/resume and remote wakeup support 2023-03-29 10:27:01 +02:00
f_eem.c
f_fs.c Merge 6.3-rc6 into usb-next 2023-04-10 08:56:59 +02:00
f_hid.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
f_loopback.c
f_mass_storage.c usb: gadget: Use kstrtobool() instead of strtobool() 2022-11-03 23:46:01 +09:00
f_mass_storage.h
f_midi.c
f_ncm.c usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate() 2023-01-17 17:10:34 +01:00
f_obex.c
f_phonet.c
f_printer.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
f_rndis.c
f_serial.c
f_sourcesink.c
f_subset.c
f_tcm.c Merge patch series "target: TMF and recovery fixes" 2023-03-24 17:39:15 -04:00
f_uac1_legacy.c
f_uac1.c usb: gadget: f_uac1: allow changing interface name via configfs 2022-01-26 14:10:40 +01:00
f_uac2.c usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints 2023-01-25 16:17:46 +01:00
f_uvc.c usb: gadget: uvc: Use custom strings if available 2023-02-07 08:46:37 +01:00
f_uvc.h
g_zero.h
Makefile
ndis.h
rndis.c usb: gadget: function: rndis: limit # of RNDIS instances to 1000 2022-08-31 09:07:52 +02:00
rndis.h usb: gadget: rndis: add spinlock for rndis response list 2022-02-24 11:16:57 +01:00
storage_common.c usb: gadget: Use kstrtobool() instead of strtobool() 2022-11-03 23:46:01 +09:00
storage_common.h usb: gadget: f_mass_storage: forced_eject attribute 2022-07-14 16:06:42 +02:00
tcm.h
u_audio.c usb: gadget: u_audio: don't let userspace block driver unbind 2023-03-09 14:56:32 +01:00
u_audio.h
u_ecm.h
u_eem.h
u_ether_configfs.h
u_ether.c usb: gadget: u_ether: Fix host MAC address case 2023-05-13 18:46:59 +09:00
u_ether.h usb: gadget: f_ecm: Add suspend/resume and remote wakeup support 2023-03-29 10:27:01 +02:00
u_fs.h usb: gadget: ffs: remove ENTER() macro 2023-03-29 08:55:58 +02:00
u_gether.h
u_hid.h
u_midi.h
u_ncm.h
u_phonet.h
u_printer.h
u_rndis.h
u_serial.c usb: gadget: u_serial: Add null pointer check in gserial_resume 2023-02-14 14:41:32 +01:00
u_serial.h
u_tcm.h
u_uac1_legacy.c usb: gadget: Replace runtime->status->state reference to runtime->state 2022-09-27 08:49:52 +02:00
u_uac1_legacy.h
u_uac1.h usb: gadget: f_uac1: allow changing interface name via configfs 2022-01-26 14:10:40 +01:00
u_uac2.h usb: gadget: f_uac2: Optionally determine bInterval for HS and SS 2022-01-31 14:26:18 +01:00
u_uvc.h usb: gadget: uvc: Allow linking function to string descs 2023-02-07 08:46:37 +01:00
uac_common.h
uvc_configfs.c usb: gadget: uvc: Make bmControls attr read/write 2023-03-29 08:51:26 +02:00
uvc_configfs.h usb: gadget: uvc: Allow linking XUs to string descriptors 2023-02-07 08:46:37 +01:00
uvc_queue.c Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets" 2022-10-26 14:09:06 +02:00
uvc_queue.h usb: gadget: uvc: rework uvcg_queue_next_buffer to uvcg_complete_buffer 2022-04-21 18:15:33 +02:00
uvc_v4l2.c usb: uvc: use v4l2_fill_fmtdesc instead of open coded format name 2023-01-31 09:40:43 +01:00
uvc_v4l2.h
uvc_video.c Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets" 2022-10-26 14:09:06 +02:00
uvc_video.h
uvc.h usb: gadget: uvc: Copy XU descriptors during .bind() 2023-02-07 08:46:36 +01:00