From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D6EC77B73 for ; Mon, 22 May 2023 17:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231460AbjEVRoh (ORCPT ); Mon, 22 May 2023 13:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbjEVRog (ORCPT ); Mon, 22 May 2023 13:44:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A13118 for ; Mon, 22 May 2023 10:44:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6D29062135 for ; Mon, 22 May 2023 17:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 675E8C433A7; Mon, 22 May 2023 17:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684777461; bh=BgrqWbgwGuthIzCk9UBs/kGAYfPT3zJMopIwynjXwXw=; h=Subject:To:Cc:From:Date:From; b=fDix1novo69MwqYisvUzSWk4mTjslBD8tBsV75oj3Vcgv90c2v4iUqfd4E4IiQAoq GEr5l2VwRGCHRzgSwwT6OohC2Q9ocwMl/Ip4gp0oN3cF6/BuLMlAMF5KyTkH3EYKW3 2Y2JqDXzoknLMLf0+NqT+Xc+qa/Y5N7qB5psH9dw= Subject: FAILED: patch "[PATCH] usb: gadget: u_ether: Fix host MAC address case" failed to apply to 5.4-stable tree To: k.graefe@gateware.de, gregkh@linuxfoundation.org Cc: From: Date: Mon, 22 May 2023 18:44:11 +0100 Message-ID: <2023052211-lying-sandworm-11db@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 3c0f4f09c063e143822393d99cb2b19a85451c07 # git commit -s git send-email --to '' --in-reply-to '2023052211-lying-sandworm-11db@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: 3c0f4f09c063 ("usb: gadget: u_ether: Fix host MAC address case") 938fc6453176 ("usb: gadget: u_ether: Convert prints to device prints") 508aeb54e4f0 ("usb: gadget: u_ether: Remove duplicated include in u_ether.c") 890d5b40908b ("usb: gadget: u_ether: fix race in setting MAC address in setup phase") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 3c0f4f09c063e143822393d99cb2b19a85451c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Gr=C3=A4fe?= Date: Fri, 5 May 2023 16:36:40 +0200 Subject: [PATCH] usb: gadget: u_ether: Fix host MAC address case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: bcd4a1c40bee ("usb: gadget: u_ether: construct with default values and add setters/getters") Cc: stable@vger.kernel.org Signed-off-by: Konrad Gräfe Link: https://lore.kernel.org/r/20230505143640.443014-1-k.graefe@gateware.de Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 6956ad8ba8dd..a366abb45623 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "u_ether.h" @@ -965,6 +966,8 @@ int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len) dev = netdev_priv(net); snprintf(host_addr, len, "%pm", dev->host_mac); + string_upper(host_addr, host_addr); + return strlen(host_addr); } EXPORT_SYMBOL_GPL(gether_get_host_addr_cdc);